[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 3 commits - sd/source sfx2/source

Andre Fischer af at apache.org
Tue May 21 03:07:36 PDT 2013


 sd/source/ui/sidebar/LayoutMenu.cxx          |    1 
 sd/source/ui/view/drviews1.cxx               |    3 +
 sd/source/ui/view/drviewsa.cxx               |    2 
 sfx2/source/sidebar/SidebarController.cxx    |   63 +++++++++++++--------------
 sfx2/source/sidebar/SidebarController.hxx    |    6 --
 sfx2/source/sidebar/SidebarDockingWindow.cxx |    2 
 sfx2/source/sidebar/TabBar.cxx               |   26 ++++-------
 sfx2/source/sidebar/TabBar.hxx               |   13 ++++-
 8 files changed, 60 insertions(+), 56 deletions(-)

New commits:
commit d8b17867f3c58d5623cca129d6459bae0eb11729
Author: Andre Fischer <af at apache.org>
Date:   Tue May 21 09:46:08 2013 +0000

    i122336: Show docked tab bar after closing undocked sidebar.

diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 1b6dcd8..b6b56a1 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -98,8 +98,8 @@ sal_Bool SidebarDockingWindow::Close (void)
     {
         // Do not close the floating window.
         // Dock it and close just the deck instead.
-        mpSidebarController->RequestCloseDeck();
         SetFloatingMode(sal_False);
+        mpSidebarController->RequestCloseDeck();
         mpSidebarController->NotifyResize();
         return sal_False;
     }
commit b89784c822670593cb253bcc0d260b93c9936e1c
Author: Andre Fischer <af at apache.org>
Date:   Tue May 21 09:22:27 2013 +0000

    i122291: Showing the right set of layouts for handout mode.  Fixed painting selection in layout panel.

diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index dd26a07..2aac13f 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -816,6 +816,7 @@ void LayoutMenu::UpdateSelection (void)
             break;
 
         // Find the entry of the menu for to the layout.
+        SetNoSelection();
         sal_uInt16 nItemCount (GetItemCount());
         for (sal_uInt16 nId=1; nId<=nItemCount; nId++)
         {
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 615063f..4bc9851 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -519,6 +519,9 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
 
         if (meEditMode == EM_PAGE)
             SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawPage));
+        else if (mePageKind == PK_HANDOUT)
+
+            SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_HandoutPage));
         else
             SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_MasterPage));
     }
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 1410116..8cb2297 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -158,6 +158,8 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
 
     if (mpFrameView->GetViewShEditMode(mePageKind) == EM_PAGE)
         SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawPage));
+    else if (mePageKind == PK_HANDOUT)
+        SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_HandoutPage));
     else
         SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_MasterPage));
 }
commit b27563ac5988d7ce407b045466e952114f54e07c
Author: Andre Fischer <af at apache.org>
Date:   Tue May 21 08:49:40 2013 +0000

    i122352: Do not allow selection of disabled decks via menu.

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index a6a4d73..0078418 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -110,7 +110,7 @@ SidebarController::SidebarController (
               mpParentWindow,
               rxFrame,
               ::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, _1),
-              ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))),
+              ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2))),
       mxFrame(rxFrame),
       maCurrentContext(OUString(), OUString()),
       maRequestedContext(),
@@ -802,10 +802,9 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
 
 void SidebarController::ShowPopupMenu (
     const Rectangle& rButtonBox,
-    const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
-    const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
+    const ::std::vector<TabBar::DeckMenuData>& rMenuData) const
 {
-    ::boost::shared_ptr<PopupMenu> pMenu = CreatePopupMenu(rDeckSelectionData, rDeckShowData);
+    ::boost::shared_ptr<PopupMenu> pMenu = CreatePopupMenu(rMenuData);
     pMenu->SetSelectHdl(LINK(this, SidebarController, OnMenuItemSelected));
 
     // pass toolbox button rect so the menu can stay open on button up
@@ -837,9 +836,9 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
 
 
 ::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
-    const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
-    const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
+    const ::std::vector<TabBar::DeckMenuData>& rMenuData) const
 {
+    // Create the top level popup menu.
     ::boost::shared_ptr<PopupMenu> pMenu (new PopupMenu());
     FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
     if (pMenuWindow != NULL)
@@ -847,21 +846,36 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
         pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE);
     }
 
+    // Create sub menu for customization (hiding of deck tabs.)
+    PopupMenu* pCustomizationMenu = new PopupMenu();
+
     SidebarResource aLocalResource;
 
     // Add one entry for every tool panel element to individually make
     // them visible or hide them.
+    sal_Int32 nIndex (0);
+    for(::std::vector<TabBar::DeckMenuData>::const_iterator
+            iItem(rMenuData.begin()),
+            iEnd(rMenuData.end());
+        iItem!=iEnd;
+        ++iItem,++nIndex)
     {
-        sal_Int32 nIndex (MID_FIRST_PANEL);
-        for(::std::vector<TabBar::DeckMenuData>::const_iterator
-                iItem(rDeckSelectionData.begin()),
-                iEnd(rDeckSelectionData.end());
-            iItem!=iEnd;
-            ++iItem)
+        const sal_Int32 nMenuIndex (nIndex+MID_FIRST_PANEL);
+        pMenu->InsertItem(nMenuIndex, iItem->msDisplayName, MIB_RADIOCHECK);
+        pMenu->CheckItem(nMenuIndex, iItem->mbIsCurrentDeck ? sal_True : sal_False);
+        pMenu->EnableItem(nMenuIndex, (iItem->mbIsEnabled&&iItem->mbIsActive) ? sal_True : sal_False);
+
+        const sal_Int32 nSubMenuIndex (nIndex+MID_FIRST_HIDE);
+        if (iItem->mbIsCurrentDeck)
+        {
+            // Don't allow the currently visible deck to be disabled.
+            pCustomizationMenu->InsertItem(nSubMenuIndex, iItem->msDisplayName, MIB_RADIOCHECK);
+            pCustomizationMenu->CheckItem(nSubMenuIndex, sal_True);
+        }
+        else
         {
-            pMenu->InsertItem(nIndex, iItem->get<0>(), MIB_RADIOCHECK);
-            pMenu->CheckItem(nIndex, iItem->get<2>());
-            ++nIndex;
+            pCustomizationMenu->InsertItem(nSubMenuIndex, iItem->msDisplayName, MIB_CHECKABLE);
+            pCustomizationMenu->CheckItem(nSubMenuIndex, iItem->mbIsActive ? sal_True : sal_False);
         }
     }
 
@@ -873,22 +887,6 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co
     else
         pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, String(SfxResId(STR_SFX_UNDOCK)));
 
-    // Add sub menu for customization (hiding of deck tabs.)
-    PopupMenu* pCustomizationMenu = new PopupMenu();
-    {
-        sal_Int32 nIndex (MID_FIRST_HIDE);
-        for(::std::vector<TabBar::DeckMenuData>::const_iterator
-                iItem(rDeckShowData.begin()),
-                iEnd(rDeckShowData.end());
-            iItem!=iEnd;
-            ++iItem)
-        {
-            pCustomizationMenu->InsertItem(nIndex, iItem->get<0>(), MIB_CHECKABLE);
-            pCustomizationMenu->CheckItem(nIndex, iItem->get<2>());
-            ++nIndex;
-        }
-    }
-
     pCustomizationMenu->InsertSeparator();
     pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, String(SfxResId(STRING_RESTORE)));
 
@@ -934,7 +932,8 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu)
                 if (nIndex >= MID_FIRST_PANEL && nIndex<MID_FIRST_HIDE)
                     SwitchToDeck(mpTabBar->GetDeckIdForIndex(nIndex - MID_FIRST_PANEL));
                 else if (nIndex >=MID_FIRST_HIDE)
-                    mpTabBar->ToggleHideFlag(nIndex-MID_FIRST_HIDE);
+                    if (pMenu->GetItemBits(nIndex) == MIB_CHECKABLE)
+                        mpTabBar->ToggleHideFlag(nIndex-MID_FIRST_HIDE);
             }
             catch (RuntimeException&)
             {
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index e940974..6f02b57 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -182,12 +182,10 @@ private:
         const Context& rContext);
     void ShowPopupMenu (
         const Rectangle& rButtonBox,
-        const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
-        const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
+        const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
     void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const;
     ::boost::shared_ptr<PopupMenu> CreatePopupMenu (
-        const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
-        const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
+        const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
     DECL_LINK(OnMenuItemSelected, Menu*);
     void BroadcastPropertyChange (void);
 
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 0521c7a..5b87856 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -379,8 +379,7 @@ void TabBar::UpdateFocusManager (FocusManager& rFocusManager)
 
 IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
 {
-    ::std::vector<DeckMenuData> aSelectionData;
-    ::std::vector<DeckMenuData> aShowData;
+    ::std::vector<DeckMenuData> aMenuData;
 
     for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
         iItem!=iEnd;
@@ -389,18 +388,14 @@ IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
         const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
         if (pDeckDescriptor != NULL)
         {
-            if ( ! iItem->mbIsHidden)
-                aSelectionData.push_back(
-                    DeckMenuData(
-                        pDeckDescriptor->msTitle,
-                        pDeckDescriptor->msId,
-                        iItem->mpButton->IsChecked()));
-
-            aShowData.push_back(
-                DeckMenuData(
-                    pDeckDescriptor->msTitle,
-                    pDeckDescriptor->msId,
-                    !iItem->mbIsHidden));
+            DeckMenuData aData;
+            aData.msDisplayName = pDeckDescriptor->msTitle;
+            aData.msDeckId = pDeckDescriptor->msId;
+            aData.mbIsCurrentDeck = iItem->mpButton->IsChecked();
+            aData.mbIsActive = !iItem->mbIsHidden;
+            aData.mbIsEnabled = iItem->mpButton->IsEnabled();
+
+            aMenuData.push_back(aData);
         }
     }
 
@@ -408,8 +403,7 @@ IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
         Rectangle(
             mpMenuButton->GetPosPixel(),
             mpMenuButton->GetSizePixel()),
-        aSelectionData,
-        aShowData);
+        aMenuData);
 
     return 0;
 }
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index 6f18545..f1ef6f2 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -56,11 +56,18 @@ public:
          - isCurrentDeck for the deck selection data
          - isEnabled     for the show/hide menu
     */
-    typedef ::boost::tuple<rtl::OUString,rtl::OUString,bool> DeckMenuData;
+    class DeckMenuData
+    {
+    public:
+        ::rtl::OUString msDisplayName;
+        ::rtl::OUString msDeckId;
+        bool mbIsCurrentDeck;
+        bool mbIsActive;
+        bool mbIsEnabled;
+    };
     typedef ::boost::function<void(
             const Rectangle&,
-            const ::std::vector<DeckMenuData>& rDeckSelectionData,
-            const ::std::vector<DeckMenuData>& rDeckShowData)> PopupMenuProvider;
+            const ::std::vector<DeckMenuData>& rMenuData)> PopupMenuProvider;
     TabBar (
         Window* pParentWindow,
         const cssu::Reference<css::frame::XFrame>& rxFrame,


More information about the Libreoffice-commits mailing list