[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - 2 commits - sd/source

David Tardon dtardon at redhat.com
Thu Jun 16 14:41:59 UTC 2016


 sd/source/ui/sidebar/SlideBackground.cxx |    2 
 sd/source/ui/view/ViewShellBase.cxx      |   86 ++++++++++---------------------
 2 files changed, 31 insertions(+), 57 deletions(-)

New commits:
commit a19c48d1cc617681f5b788edccee0c557cf3e059
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Jun 16 16:11:17 2016 +0200

    sort the array
    
    Change-Id: Iab15a4344d2174db2763603d0107bc9ec372e4fb
    (cherry picked from commit 90fa0d8f1a00c690d5199129d26fbe6ee4762972)
    Signed-off-by: David Tardon <dtardon at redhat.com>

diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index ff5f84c..087e172 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -342,9 +342,9 @@ IMPL_LINK_TYPED(SlideBackground, EventMultiplexerListener,
         {
             static sal_uInt16 SidArray[] = {
                 SID_ATTR_PAGE_COLOR,
+                SID_ATTR_PAGE_GRADIENT,
                 SID_ATTR_PAGE_HATCH,
                 SID_ATTR_PAGE_BITMAP,
-                SID_ATTR_PAGE_GRADIENT,
                 SID_ATTR_PAGE_FILLSTYLE,
                 SID_DISPLAY_MASTER_BACKGROUND,
                 SID_DISPLAY_MASTER_OBJECTS,
commit e5eee24b3db998f9375abf6c0e280eaf5d8f94a5
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Jun 15 16:52:26 2016 +0200

    rhbz#1343752 fix view status in menu
    
    ... after commit 229fc164dc1773484b74eca016863cf68860e81b .
    
    Change-Id: Ibfbbb86c81527f008b8e1cbe9d8ca3174a944931
    (cherry picked from commit c4c7fe98b0f05329edf7930ff92b44892d4724e6)
    Signed-off-by: David Tardon <dtardon at redhat.com>

diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 72b3f3b..ae01eb9 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1221,13 +1221,13 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
         SfxWhichIter aSetIterator (rSet);
         sal_uInt16 nItemId (aSetIterator.FirstWhich());
 
-        FrameView *pFrameView;
         while (nItemId > 0)
         {
             bool bState (false);
             Reference<XResourceId> xResourceId;
             try
             {
+                // Check if the right view is active
                 switch (nItemId)
                 {
                     case SID_LEFT_PANE_IMPRESS:
@@ -1242,22 +1242,13 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
                         bState = xConfiguration->hasResource(xResourceId);
                         break;
 
+                    case SID_DRAWINGMODE:
                     case SID_NORMAL_MULTI_PANE_GUI:
-                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
-                        {
-                            pFrameView = pViewShell->GetFrameView();
-                            bState = pFrameView->GetViewShEditMode() == EM_PAGE
-                                && pFrameView->GetPageKind() == PK_STANDARD;
-                        }
-                        break;
-
                     case SID_SLIDE_MASTER_MODE:
-                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
-                        {
-                            pFrameView = pViewShell->GetFrameView();
-                            bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
-                                && pFrameView->GetPageKind() == PK_STANDARD;
-                        }
+                        xResourceId = ResourceId::createWithAnchorURL(
+                            xContext, FrameworkHelper::msImpressViewURL,
+                            FrameworkHelper::msCenterPaneURL);
+                        bState = xConfiguration->hasResource(xResourceId);
                         break;
 
                     case SID_SLIDE_SORTER_MULTI_PANE_GUI:
@@ -1278,30 +1269,18 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
                         break;
 
                     case SID_HANDOUT_MASTER_MODE:
-                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
-                        {
-                            pFrameView = pViewShell->GetFrameView();
-                            bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
-                                && pFrameView->GetPageKind() == PK_HANDOUT;
-                        }
+                        xResourceId = ResourceId::createWithAnchorURL(
+                            xContext, FrameworkHelper::msHandoutViewURL,
+                            FrameworkHelper::msCenterPaneURL);
+                        bState = xConfiguration->hasResource(xResourceId);
                         break;
 
                     case SID_NOTES_MODE:
-                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
-                        {
-                            pFrameView = pViewShell->GetFrameView();
-                            bState = pFrameView->GetViewShEditMode() == EM_PAGE
-                                && pFrameView->GetPageKind() == PK_NOTES;
-                        }
-                        break;
-
                     case SID_NOTES_MASTER_MODE:
-                        if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
-                        {
-                            pFrameView = pViewShell->GetFrameView();
-                            bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
-                                && pFrameView->GetPageKind() == PK_NOTES;
-                        }
+                        xResourceId = ResourceId::createWithAnchorURL(
+                            xContext, FrameworkHelper::msNotesViewURL,
+                            FrameworkHelper::msCenterPaneURL);
+                        bState = xConfiguration->hasResource(xResourceId);
                         break;
 
                     case SID_TOGGLE_TABBAR_VISIBILITY:
@@ -1318,32 +1297,27 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
             {
             }
 
-            // Take the master page mode into account.
-            switch (nItemId)
+            // Check if edit mode fits too
+            if (bState)
             {
-                case SID_NORMAL_MULTI_PANE_GUI:
-                case SID_NOTES_MODE:
+                ViewShell* const pCenterViewShell = FrameworkHelper::Instance(mrBase)->GetViewShell(
+                    FrameworkHelper::msCenterPaneURL).get();
+                DrawViewShell* const pShell = dynamic_cast<DrawViewShell*>(pCenterViewShell);
+                if (pShell)
                 {
-                    // Determine the master page mode.
-                    ViewShell* pCenterViewShell = FrameworkHelper::Instance(mrBase)->GetViewShell(
-                        FrameworkHelper::msCenterPaneURL).get();
-                    bool bMasterPageMode (false);
-                    if (DrawViewShell* pShell = dynamic_cast<DrawViewShell*>(pCenterViewShell))
+                    switch (nItemId)
                     {
-                        if (pShell->GetEditMode() == EM_MASTERPAGE)
-                        {
-                            bMasterPageMode = true;
-                        }
+                        case SID_DRAWINGMODE:
+                        case SID_NORMAL_MULTI_PANE_GUI:
+                        case SID_NOTES_MODE:
+                            bState = pShell->GetEditMode() == EM_PAGE;
+                            break;
+                        case SID_SLIDE_MASTER_MODE:
+                        case SID_NOTES_MASTER_MODE:
+                            bState = pShell->GetEditMode() == EM_MASTERPAGE;
+                            break;
                     }
-
-                    bState &= !bMasterPageMode;
-                    break;
                 }
-
-                case SID_HANDOUT_MASTER_MODE:
-                    // There is only the master page mode for the handout
-                    // view so ignore the master page flag.
-                    break;
             }
 
             // And finally set the state.


More information about the Libreoffice-commits mailing list