[Libreoffice-commits] core.git: sfx2/source

Szymon Kłos eszkadev at gmail.com
Fri Oct 7 17:49:09 UTC 2016


 sfx2/source/notebookbar/SfxNotebookBar.cxx |   48 ++++++++++++++++++++---------
 1 file changed, 34 insertions(+), 14 deletions(-)

New commits:
commit 1b786fb2db9b555fd9882487f1f0375bd93f6e32
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Oct 6 21:34:27 2016 +0200

    tdf#102776 : switching the menubar in all windows
    
    Change-Id: I74804605ec9dd15d1e4dbea15f09709dbf9c8770
    Reviewed-on: https://gerrit.libreoffice.org/29580
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <eszkadev at gmail.com>

diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 182b70a..73053b8 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -353,29 +353,49 @@ void SfxNotebookBar::ShowMenubar(bool bShow)
     {
         m_bLock = true;
 
-        if (SfxViewFrame::Current())
+        Reference<frame::XFrame> xFrame;
+        vcl::EnumContext::Application eCurrentApp = vcl::EnumContext::Application::Application_None;
+        uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+        const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext );
+
+        if ( SfxViewFrame::Current() )
         {
-            const Reference<frame::XFrame>& xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
-            if (xFrame.is())
+            xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
+            eCurrentApp = vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xFrame ) );
+        }
+
+        SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst();
+        while( pViewFrame )
+        {
+            xFrame = pViewFrame->GetFrame().GetFrameInterface();
+            if ( xFrame.is() )
             {
-                const Reference<frame::XLayoutManager>& xLayoutManager =
-                                                        lcl_getLayoutManager(xFrame);
+                vcl::EnumContext::Application eApp =
+                        vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xFrame ) );
 
-                if (xLayoutManager.is())
+                if ( eApp == eCurrentApp )
                 {
-                    xLayoutManager->lock();
+                    const Reference<frame::XLayoutManager>& xLayoutManager =
+                                                            lcl_getLayoutManager( xFrame );
 
-                    if (xLayoutManager->getElement(MENUBAR_STR).is())
+                    if (xLayoutManager.is())
                     {
-                        if (xLayoutManager->isElementVisible(MENUBAR_STR) && !bShow)
-                            xLayoutManager->hideElement(MENUBAR_STR);
-                        else if(!xLayoutManager->isElementVisible(MENUBAR_STR) && bShow)
-                            xLayoutManager->showElement(MENUBAR_STR);
-                    }
+                        xLayoutManager->lock();
+
+                        if (xLayoutManager->getElement(MENUBAR_STR).is())
+                        {
+                            if (xLayoutManager->isElementVisible(MENUBAR_STR) && !bShow)
+                                xLayoutManager->hideElement(MENUBAR_STR);
+                            else if(!xLayoutManager->isElementVisible(MENUBAR_STR) && bShow)
+                                xLayoutManager->showElement(MENUBAR_STR);
+                        }
 
-                    xLayoutManager->unlock();
+                        xLayoutManager->unlock();
+                    }
                 }
             }
+
+            pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
         }
         m_bLock = false;
     }


More information about the Libreoffice-commits mailing list