diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2015-07-19 15:58:09 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-03 08:21:32 +0000 |
commit | 7088dadc52d56e56aa674c95673a3f83cf4e1ab3 (patch) | |
tree | 60d4cc07af9660628dac3022e66b9a2bd3d48689 /fpicker | |
parent | 8775593bcc543b3d7021e20736f42fa13035870d (diff) |
tdf#57370 : 'Places' in the LibreOffice file dialog is inaccessible
Change-Id: I94ba2fea74703d69e65c0864744ab81ccf205f9c
Reviewed-on: https://gerrit.libreoffice.org/17192
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/PlacesListBox.hxx | 4 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 99 |
2 files changed, 100 insertions, 3 deletions
diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx index a3f6c0c620ce..b7909e245077 100644 --- a/fpicker/source/office/PlacesListBox.hxx +++ b/fpicker/source/office/PlacesListBox.hxx @@ -66,6 +66,10 @@ class PlacesListBox : public Control void SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE; void updateView( ); + VclPtr<PushButton> GetAddButton() const { return mpAddBtn; } + VclPtr<PushButton> GetDeleteButton() const { return mpDelBtn; } + VclPtr<PlacesListBox_Impl> GetPlacesListBox() const { return mpImpl; } + private: Image getEntryIcon( PlacePtr pPlace ); diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 4c76083d330c..68b738181538 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -347,16 +347,31 @@ SvtFileDialog::SvtFileDialog ( vcl::Window* _pParent, WinBits nBits ) class CustomContainer : public vcl::Window { + enum FocusState + { + Prev = 0, + Places, + Add, + Delete, + FileView, + Next, + FocusCount + }; + SvtExpFileDlg_Impl* _pImp; VclPtr<SvtFileView> _pFileView; VclPtr<Splitter> _pSplitter; + int m_nCurrentFocus; + VclPtr<vcl::Window> m_pFocusWidgets[FocusState::FocusCount]; + public: CustomContainer(vcl::Window *pParent) : Window(pParent) , _pImp(NULL) , _pFileView(NULL) , _pSplitter(NULL) + , m_nCurrentFocus(FocusState::Prev) { } virtual ~CustomContainer() { disposeOnce(); } @@ -369,11 +384,20 @@ public: void init(SvtExpFileDlg_Impl* pImp, SvtFileView* pFileView, - Splitter* pSplitter) + Splitter* pSplitter, + vcl::Window* pPrev, + vcl::Window* pNext) { _pImp = pImp; _pFileView = pFileView; _pSplitter = pSplitter; + + m_pFocusWidgets[FocusState::Prev] = pPrev; + m_pFocusWidgets[FocusState::Places] = _pImp->_pPlaces->GetPlacesListBox(); + m_pFocusWidgets[FocusState::Add] = _pImp->_pPlaces->GetAddButton(); + m_pFocusWidgets[FocusState::Delete] = _pImp->_pPlaces->GetDeleteButton(); + m_pFocusWidgets[FocusState::FileView] = pFileView; + m_pFocusWidgets[FocusState::Next] = pNext; } virtual void Resize() SAL_OVERRIDE @@ -403,9 +427,78 @@ public: _pImp->_pPlaces->SetSizePixel( placesNewSize ); } + void changeFocus( bool bReverse ) + { + if( !_pFileView || !_pImp || !_pImp->_pPlaces ) + return; + + if( bReverse && m_nCurrentFocus > FocusState::Prev && m_nCurrentFocus <= FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false); + m_pFocusWidgets[m_nCurrentFocus]->LoseFocus(); + + m_pFocusWidgets[--m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + else if( !bReverse && m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus < FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false); + m_pFocusWidgets[m_nCurrentFocus]->LoseFocus(); + + m_pFocusWidgets[++m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + } + virtual void GetFocus() SAL_OVERRIDE { - _pFileView->GrabFocus(); + if( !_pFileView || !_pImp || !_pImp->_pPlaces ) + return; + + GetFocusFlags aFlags = GetGetFocusFlags(); + + if( aFlags & GetFocusFlags::Forward ) + m_nCurrentFocus = FocusState::Places; + else if( aFlags & GetFocusFlags::Backward ) + m_nCurrentFocus = FocusState::FileView; + + if( m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus <= FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + } + + virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE + { + if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) + { + // we must also update counter when user change focus using mouse + for(int i = FocusState::Prev; i <= FocusState::Next; i++) + { + if( rNEvt.GetWindow() == m_pFocusWidgets[i] ) + { + m_nCurrentFocus = i; + return true; + } + } + + // GETFOCUS for one of FileView's subcontrols + m_nCurrentFocus = FocusState::FileView; + return true; + } + if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + { + const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); + const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode(); + bool bShift = rCode.IsShift(); + if( rCode.GetCode() == KEY_TAB ) + { + changeFocus( bShift ); + return true; + } + } + return Window::Notify( rNEvt ); } }; @@ -668,7 +761,7 @@ void SvtFileDialog::Init_Impl OUString( "/org.openoffice.Office.UI/FilePicker" ) ); - _pContainer->init(_pImp, _pFileView, _pSplitter); + _pContainer->init(_pImp, _pFileView, _pSplitter, _pImp->_pBtnNewFolder, _pImp->_pEdFileName); _pContainer->Show(); Resize(); |