[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - fpicker/source

Szymon Kłos eszkadev at gmail.com
Thu Oct 1 07:07:51 PDT 2015


 fpicker/source/office/PlacesListBox.hxx |    4 +
 fpicker/source/office/iodlg.cxx         |   99 +++++++++++++++++++++++++++++++-
 2 files changed, 100 insertions(+), 3 deletions(-)

New commits:
commit 0f8784572120f0a637aa0f1250e45e04f446f287
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Sun Jul 19 15:58:09 2015 +0200

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/19070

diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx
index 0d2a474..e2e0ab1 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 451d5ba..4e0d5f7 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();


More information about the Libreoffice-commits mailing list