summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-07-19 15:58:09 +0200
committerCaolán McNamara <caolanm@redhat.com>2015-10-01 14:07:27 +0000
commit0f8784572120f0a637aa0f1250e45e04f446f287 (patch)
tree14da9b5171d324876019609eb08d4cca0fd54223
parentfd151aa15cfbc3d03ac38082a7463fe023dd102a (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> Reviewed-on: https://gerrit.libreoffice.org/19070
-rw-r--r--fpicker/source/office/PlacesListBox.hxx4
-rw-r--r--fpicker/source/office/iodlg.cxx99
2 files changed, 100 insertions, 3 deletions
diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx
index 0d2a4742a958..e2e0ab138bcd 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 451d5ba07269..4e0d5f721cbb 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;
+
+ 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
OUString( "/org.openoffice.Office.UI/FilePicker" )
);
- _pContainer->init(_pImp, _pFileView, _pSplitter);
+ _pContainer->init(_pImp, _pFileView, _pSplitter, _pImp->_pBtnNewFolder, _pImp->_pEdFileName);
_pContainer->Show();
Resize();