diff options
author | Laurent Godard <lgodard.libre@laposte.net> | 2015-04-30 16:56:14 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2015-06-22 04:59:07 +0000 |
commit | a64999511ae654131d997eec9a3d78478cfc1c75 (patch) | |
tree | e2a06cde98747c7f8b1eb409f9c7b1918582c897 /sfx2/source/sidebar/TabBar.cxx | |
parent | d16e154c627ecc0cb21aaf4b28f7f5ae48ebbde1 (diff) |
new uno sidebar api tdf#91806
the entry point is SfxBaseController::getSidebar()
the Decks and panels are now per SidebarController and not global anymore
' macro example
Sub testSidebarApi
controller = thisComponent.currentcontroller
frameIni = thisComponent.currentcontroller.frame
sidebar = thisComponent.currentcontroller.getSidebar()
sidebar.setVisible(true)
frame = sidebar.getFrame()
decks = sidebar.getdecks()
c = decks.count
h = decks.hasElements()
e = decks.getElementNames()
a = decks.hasByName("MyDeck")
deck = decks.getByName("MyDeck")
deck.activate(true)
t = deck.getTitle()
deck.setTitle("new deck title")
deck.moveFirst()
deck.moveLast()
deck.moveUp()
deck.moveDown()
index = deck.getOrderIndex()
panels = deck.getPanels()
ep = panels.getElementnames()
ap = panels.hasByName("aPanelName")
panel = panels.getByName("aPanelName")
panel.setTitle("new panel title")
panel.collapse()
panel.expand(true) ' expand and collapse other
index = panel.getOrderIndex()
panel.moveLast()
panel.moveFirst()
panel.moveDown()
panel.moveUp()
End Sub
Change-Id: I7a4b953f2277dea483bb296ba6ead35de7205ace
Reviewed-on: https://gerrit.libreoffice.org/15856
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sfx2/source/sidebar/TabBar.cxx')
-rw-r--r-- | sfx2/source/sidebar/TabBar.cxx | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index bc2fe28761b1..4733898ada0a 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -17,14 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "TabBar.hxx" -#include "TabItem.hxx" +#include <sfx2/sidebar/TabBar.hxx> +#include <sfx2/sidebar/TabItem.hxx> #include <sfx2/sidebar/ControlFactory.hxx> -#include "DeckDescriptor.hxx" -#include "Paint.hxx" +#include <sfx2/sidebar/DeckDescriptor.hxx> +#include <sfx2/sidebar/Paint.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/Tools.hxx> -#include "FocusManager.hxx" +#include <sfx2/sidebar/FocusManager.hxx> + +#include <sfx2/sidebar/SidebarController.hxx> #include <vcl/gradient.hxx> #include <vcl/image.hxx> @@ -42,14 +44,18 @@ namespace sfx2 { namespace sidebar { TabBar::TabBar(vcl::Window* pParentWindow, const Reference<frame::XFrame>& rxFrame, const boost::function<void(const OUString&)>& rDeckActivationFunctor, - const PopupMenuProvider& rPopupMenuProvider) + const PopupMenuProvider& rPopupMenuProvider, + SidebarController* rParentSidebarController + ) : Window(pParentWindow, WB_DIALOGCONTROL), mxFrame(rxFrame), mpMenuButton(ControlFactory::CreateMenuButton(this)), maItems(), maDeckActivationFunctor(rDeckActivationFunctor), - maPopupMenuProvider(rPopupMenuProvider) + maPopupMenuProvider(rPopupMenuProvider), + pParentSidebarController(rParentSidebarController) { + SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu)); @@ -110,7 +116,7 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe for (ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck(rDecks.begin()); iDeck != rDecks.end(); ++iDeck) { - const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(iDeck->msId); + const DeckDescriptor* pDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId); if (pDescriptor == NULL) { OSL_ASSERT(pDescriptor!=NULL); @@ -149,7 +155,8 @@ void TabBar::UpdateButtonIcons() iItem!=iEnd; ++iItem) { - const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId); + const DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId); + if (pDeckDescriptor != NULL) { aImage = GetItemImage(*pDeckDescriptor); @@ -293,7 +300,8 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex) else { maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden; - ResourceManager::Instance().SetIsDeckEnabled( + + pParentSidebarController->GetResourceManager()->SetIsDeckEnabled( maItems[nIndex].msDeckId, maItems[nIndex].mbIsHidden); Layout(); @@ -337,7 +345,8 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked) for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem) { - const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId); + const DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId); + if (pDeckDescriptor != NULL) { DeckMenuData aData; |