SidebarController.cxx (f120fe41) SidebarController.cxx (54eaaa32)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 17 unchanged lines hidden (view full) ---

26#include "DeckTitleBar.hxx"
27#include "Panel.hxx"
28#include "SidebarPanel.hxx"
29#include "SidebarResource.hxx"
30#include "TabBar.hxx"
31#include "sfx2/sidebar/Theme.hxx"
32#include "SidebarDockingWindow.hxx"
33#include "Context.hxx"
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 17 unchanged lines hidden (view full) ---

26#include "DeckTitleBar.hxx"
27#include "Panel.hxx"
28#include "SidebarPanel.hxx"
29#include "SidebarResource.hxx"
30#include "TabBar.hxx"
31#include "sfx2/sidebar/Theme.hxx"
32#include "SidebarDockingWindow.hxx"
33#include "Context.hxx"
34#include "Tools.hxx"
34
35#include "sfxresid.hxx"
36#include "sfx2/sfxsids.hrc"
37#include "sfx2/titledockwin.hxx"
38#include "sfxlocal.hrc"
39#include <vcl/floatwin.hxx>
40#include "splitwin.hxx"
41#include <svl/smplhint.hxx>

--- 15 unchanged lines hidden (view full) ---

57#include <boost/function.hpp>
58#include <boost/scoped_array.hpp>
59
60
61using namespace css;
62using namespace cssu;
63using ::rtl::OUString;
64
35
36#include "sfxresid.hxx"
37#include "sfx2/sfxsids.hrc"
38#include "sfx2/titledockwin.hxx"
39#include "sfxlocal.hrc"
40#include <vcl/floatwin.hxx>
41#include "splitwin.hxx"
42#include <svl/smplhint.hxx>

--- 15 unchanged lines hidden (view full) ---

58#include <boost/function.hpp>
59#include <boost/scoped_array.hpp>
60
61
62using namespace css;
63using namespace cssu;
64using ::rtl::OUString;
65
65#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
66#define S2A(s) OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr()
67
68
69namespace sfx2 { namespace sidebar {
70
71namespace {
72 enum MenuId
73 {
74 MID_UNLOCK_TASK_PANEL = 1,

--- 157 unchanged lines hidden (view full) ---

232 }
233
234 Window* pParentWindow = mpTabBar->GetParent();
235
236 const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
237 const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
238
239 // Place the deck.
66
67
68namespace sfx2 { namespace sidebar {
69
70namespace {
71 enum MenuId
72 {
73 MID_UNLOCK_TASK_PANEL = 1,

--- 157 unchanged lines hidden (view full) ---

231 }
232
233 Window* pParentWindow = mpTabBar->GetParent();
234
235 const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
236 const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
237
238 // Place the deck.
240 if ( ! mbIsDeckClosed)
241 {
242 OSL_ASSERT(mpCurrentDeck!=NULL);
243 }
244 if (mpCurrentDeck)
245 {
246 mpCurrentDeck->SetPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
247 mpCurrentDeck->Show();
248 mpCurrentDeck->RequestLayout();
249 }
250
251 // Place the tab bar.

--- 67 unchanged lines hidden (view full) ---

319 pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(rContext, mxFrame);
320 else
321 pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId);
322 if (pDeckDescriptor != NULL)
323 {
324 msCurrentDeckId = pDeckDescriptor->msId;
325 SwitchToDeck(*pDeckDescriptor, rContext);
326 }
239 if (mpCurrentDeck)
240 {
241 mpCurrentDeck->SetPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
242 mpCurrentDeck->Show();
243 mpCurrentDeck->RequestLayout();
244 }
245
246 // Place the tab bar.

--- 67 unchanged lines hidden (view full) ---

314 pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(rContext, mxFrame);
315 else
316 pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId);
317 if (pDeckDescriptor != NULL)
318 {
319 msCurrentDeckId = pDeckDescriptor->msId;
320 SwitchToDeck(*pDeckDescriptor, rContext);
321 }
322
323#ifdef DEBUG
324 // Show the context name in the deck title bar.
325 if (mpCurrentDeck)
326 {
327 DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
328 if (pTitleBar != NULL)
329 pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+rContext.msContext+A2S(")"));
330 }
331#endif
327 }
328}
329
330
331
332
333void SidebarController::SwitchToDeck (
334 const ::rtl::OUString& rsDeckId)

--- 32 unchanged lines hidden (view full) ---

367 // Determine the panels to display in the deck.
368 ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
369 ResourceManager::Instance().GetMatchingPanels(
370 aPanelContextDescriptors,
371 rContext,
372 rDeckDescriptor.msId,
373 mxFrame);
374
332 }
333}
334
335
336
337
338void SidebarController::SwitchToDeck (
339 const ::rtl::OUString& rsDeckId)

--- 32 unchanged lines hidden (view full) ---

372 // Determine the panels to display in the deck.
373 ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
374 ResourceManager::Instance().GetMatchingPanels(
375 aPanelContextDescriptors,
376 rContext,
377 rDeckDescriptor.msId,
378 mxFrame);
379
380 if (aPanelContextDescriptors.empty())
381 {
382 // There are no panels to be displayed in the current context.
383 if (EnumContext::GetContextEnum(rContext.msContext) != EnumContext::Context_Empty)
384 {
385 // Switch to the "empty" context and try again.
386 SwitchToDeck(
387 rDeckDescriptor,
388 Context(
389 rContext.msApplication,
390 EnumContext::GetContextName(EnumContext::Context_Empty)));
391 return;
392 }
393 else
394 {
395 // This is already the "empty" context. Looks like we have
396 // to live with an empty deck.
397 }
398 }
399
375 if (mpCurrentDeck
376 && ArePanelSetsEqual(mpCurrentDeck->GetPanels(), aPanelContextDescriptors))
377 {
378 // Requested set of panels is identical to the current set of
379 // panels => Nothing to do.
380 return;
381 }
382
383 // Provide a configuration and Deck object.
384 if ( ! mpCurrentDeck)
385 {
386 mpCurrentDeck.reset(
387 new Deck(
388 rDeckDescriptor,
389 mpParentWindow,
390 ::boost::bind(&SidebarController::CloseDeck, this)));
400 if (mpCurrentDeck
401 && ArePanelSetsEqual(mpCurrentDeck->GetPanels(), aPanelContextDescriptors))
402 {
403 // Requested set of panels is identical to the current set of
404 // panels => Nothing to do.
405 return;
406 }
407
408 // Provide a configuration and Deck object.
409 if ( ! mpCurrentDeck)
410 {
411 mpCurrentDeck.reset(
412 new Deck(
413 rDeckDescriptor,
414 mpParentWindow,
415 ::boost::bind(&SidebarController::CloseDeck, this)));
416 msCurrentDeckTitle = rDeckDescriptor.msTitle;
391 }
392 if ( ! mpCurrentDeck)
393 return;
394
395 // Update the panel list.
396 const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
397 SharedPanelContainer aNewPanels;
398 const SharedPanelContainer& rCurrentPanels (mpCurrentDeck->GetPanels());

--- 493 unchanged lines hidden ---
417 }
418 if ( ! mpCurrentDeck)
419 return;
420
421 // Update the panel list.
422 const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
423 SharedPanelContainer aNewPanels;
424 const SharedPanelContainer& rCurrentPanels (mpCurrentDeck->GetPanels());

--- 493 unchanged lines hidden ---