Kaydet (Commit) 0f878457 authored tarafından Szymon Kłos's avatar Szymon Kłos Kaydeden (comit) Caolán McNamara

tdf#57370 : 'Places' in the LibreOffice file dialog is inaccessible

Change-Id: I94ba2fea74703d69e65c0864744ab81ccf205f9c
Reviewed-on: https://gerrit.libreoffice.org/17192Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/19070
üst fd151aa1
...@@ -66,6 +66,10 @@ class PlacesListBox : public Control ...@@ -66,6 +66,10 @@ class PlacesListBox : public Control
void SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE; void SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
void updateView( ); void updateView( );
VclPtr<PushButton> GetAddButton() const { return mpAddBtn; }
VclPtr<PushButton> GetDeleteButton() const { return mpDelBtn; }
VclPtr<PlacesListBox_Impl> GetPlacesListBox() const { return mpImpl; }
private: private:
Image getEntryIcon( PlacePtr pPlace ); Image getEntryIcon( PlacePtr pPlace );
......
...@@ -347,16 +347,31 @@ SvtFileDialog::SvtFileDialog ( vcl::Window* _pParent, WinBits nBits ) ...@@ -347,16 +347,31 @@ SvtFileDialog::SvtFileDialog ( vcl::Window* _pParent, WinBits nBits )
class CustomContainer : public vcl::Window class CustomContainer : public vcl::Window
{ {
enum FocusState
{
Prev = 0,
Places,
Add,
Delete,
FileView,
Next,
FocusCount
};
SvtExpFileDlg_Impl* _pImp; SvtExpFileDlg_Impl* _pImp;
VclPtr<SvtFileView> _pFileView; VclPtr<SvtFileView> _pFileView;
VclPtr<Splitter> _pSplitter; VclPtr<Splitter> _pSplitter;
int m_nCurrentFocus;
VclPtr<vcl::Window> m_pFocusWidgets[FocusState::FocusCount];
public: public:
CustomContainer(vcl::Window *pParent) CustomContainer(vcl::Window *pParent)
: Window(pParent) : Window(pParent)
, _pImp(NULL) , _pImp(NULL)
, _pFileView(NULL) , _pFileView(NULL)
, _pSplitter(NULL) , _pSplitter(NULL)
, m_nCurrentFocus(FocusState::Prev)
{ {
} }
virtual ~CustomContainer() { disposeOnce(); } virtual ~CustomContainer() { disposeOnce(); }
...@@ -369,11 +384,20 @@ public: ...@@ -369,11 +384,20 @@ public:
void init(SvtExpFileDlg_Impl* pImp, void init(SvtExpFileDlg_Impl* pImp,
SvtFileView* pFileView, SvtFileView* pFileView,
Splitter* pSplitter) Splitter* pSplitter,
vcl::Window* pPrev,
vcl::Window* pNext)
{ {
_pImp = pImp; _pImp = pImp;
_pFileView = pFileView; _pFileView = pFileView;
_pSplitter = pSplitter; _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 virtual void Resize() SAL_OVERRIDE
...@@ -403,9 +427,78 @@ public: ...@@ -403,9 +427,78 @@ public:
_pImp->_pPlaces->SetSizePixel( placesNewSize ); _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 virtual void GetFocus() SAL_OVERRIDE
{ {
_pFileView->GrabFocus(); if( !_pFileView || !_pImp || !_pImp->_pPlaces )
return;
sal_uInt16 aFlags = GetGetFocusFlags();
if( aFlags & GETFOCUS_FORWARD )
m_nCurrentFocus = FocusState::Places;
else if( aFlags & GETFOCUS_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 ...@@ -668,7 +761,7 @@ void SvtFileDialog::Init_Impl
OUString( "/org.openoffice.Office.UI/FilePicker" ) OUString( "/org.openoffice.Office.UI/FilePicker" )
); );
_pContainer->init(_pImp, _pFileView, _pSplitter); _pContainer->init(_pImp, _pFileView, _pSplitter, _pImp->_pBtnNewFolder, _pImp->_pEdFileName);
_pContainer->Show(); _pContainer->Show();
Resize(); Resize();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment