SidebarController.cxx (22f77e9e) | SidebarController.cxx (56798e4b) |
---|---|
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 --- 53 unchanged lines hidden (view full) --- 62#include <boost/scoped_array.hpp> 63 64 65using namespace css; 66using namespace cssu; 67using ::rtl::OUString; 68 69 | 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 --- 53 unchanged lines hidden (view full) --- 62#include <boost/scoped_array.hpp> 63 64 65using namespace css; 66using namespace cssu; 67using ::rtl::OUString; 68 69 |
70#undef VERBOSE |
|
70 71namespace sfx2 { namespace sidebar { 72 73namespace { 74 enum MenuId 75 { 76 MID_UNLOCK_TASK_PANEL = 1, 77 MID_LOCK_TASK_PANEL, --- 74 unchanged lines hidden (view full) --- 152 { 153 mpParentWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler)); 154 mpParentWindow = NULL; 155 } 156 157 if (mpCurrentDeck) 158 { 159 mpCurrentDeck->Dispose(); | 71 72namespace sfx2 { namespace sidebar { 73 74namespace { 75 enum MenuId 76 { 77 MID_UNLOCK_TASK_PANEL = 1, 78 MID_LOCK_TASK_PANEL, --- 74 unchanged lines hidden (view full) --- 153 { 154 mpParentWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler)); 155 mpParentWindow = NULL; 156 } 157 158 if (mpCurrentDeck) 159 { 160 mpCurrentDeck->Dispose(); |
160 OSL_TRACE("deleting deck window subtree"); | |
161 mpCurrentDeck->PrintWindowTree(); 162 mpCurrentDeck.reset(); 163 } 164 165 mpTabBar.reset(); 166 167 Theme::GetPropertySet()->removePropertyChangeListener( 168 A2S(""), --- 90 unchanged lines hidden (view full) --- 259 if (pTitleBar != NULL && pTitleBar->IsVisible()) 260 pTitleBar->SetCloserVisible(CanModifyChildWindowWidth()); 261 } 262 263 if (nWidth > TabBar::GetDefaultWidth()) 264 mnSavedSidebarWidth = nWidth; 265 266 RestrictWidth(); | 161 mpCurrentDeck->PrintWindowTree(); 162 mpCurrentDeck.reset(); 163 } 164 165 mpTabBar.reset(); 166 167 Theme::GetPropertySet()->removePropertyChangeListener( 168 A2S(""), --- 90 unchanged lines hidden (view full) --- 259 if (pTitleBar != NULL && pTitleBar->IsVisible()) 260 pTitleBar->SetCloserVisible(CanModifyChildWindowWidth()); 261 } 262 263 if (nWidth > TabBar::GetDefaultWidth()) 264 mnSavedSidebarWidth = nWidth; 265 266 RestrictWidth(); |
267#ifdef DEBUG | 267#ifdef VERBOSE |
268 if (mpCurrentDeck) 269 { 270 mpCurrentDeck->PrintWindowTree(); 271 sal_Int32 nPanelIndex (0); 272 for (SharedPanelContainer::const_iterator 273 iPanel(mpCurrentDeck->GetPanels().begin()), 274 iEnd(mpCurrentDeck->GetPanels().end()); 275 iPanel!=iEnd; --- 42 unchanged lines hidden (view full) --- 318 if ( ! bCurrentDeckMatches) 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); | 268 if (mpCurrentDeck) 269 { 270 mpCurrentDeck->PrintWindowTree(); 271 sal_Int32 nPanelIndex (0); 272 for (SharedPanelContainer::const_iterator 273 iPanel(mpCurrentDeck->GetPanels().begin()), 274 iEnd(mpCurrentDeck->GetPanels().end()); 275 iPanel!=iEnd; --- 42 unchanged lines hidden (view full) --- 318 if ( ! bCurrentDeckMatches) 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 327 // Tell the tab bar to highlight the button associated 328 // with the deck. 329 mpTabBar->HighlightDeck(msCurrentDeckId); |
|
326 } 327 328#ifdef DEBUG 329 // Show the context name in the deck title bar. 330 if (mpCurrentDeck) 331 { 332 DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar(); 333 if (pTitleBar != NULL) --- 108 unchanged lines hidden (view full) --- 442 SharedPanelContainer::const_iterator iPanel (::std::find_if( 443 rCurrentPanels.begin(), 444 rCurrentPanels.end(), 445 ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rPanelContexDescriptor.msId)))); 446 if (iPanel != rCurrentPanels.end()) 447 { 448 // Panel already exists in current deck. Reuse it. 449 aNewPanels[nWriteIndex] = *iPanel; | 330 } 331 332#ifdef DEBUG 333 // Show the context name in the deck title bar. 334 if (mpCurrentDeck) 335 { 336 DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar(); 337 if (pTitleBar != NULL) --- 108 unchanged lines hidden (view full) --- 446 SharedPanelContainer::const_iterator iPanel (::std::find_if( 447 rCurrentPanels.begin(), 448 rCurrentPanels.end(), 449 ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rPanelContexDescriptor.msId)))); 450 if (iPanel != rCurrentPanels.end()) 451 { 452 // Panel already exists in current deck. Reuse it. 453 aNewPanels[nWriteIndex] = *iPanel; |
450 OSL_TRACE(" reusing panel %s", S2A(rPanelContexDescriptor.msId)); | |
451 } 452 else 453 { 454 // Panel does not yet exist. Create it. 455 aNewPanels[nWriteIndex] = CreatePanel( 456 rPanelContexDescriptor.msId, 457 mpCurrentDeck->GetPanelParentWindow(), 458 rPanelContexDescriptor.msMenuCommand); | 454 } 455 else 456 { 457 // Panel does not yet exist. Create it. 458 aNewPanels[nWriteIndex] = CreatePanel( 459 rPanelContexDescriptor.msId, 460 mpCurrentDeck->GetPanelParentWindow(), 461 rPanelContexDescriptor.msMenuCommand); |
459 OSL_TRACE(" creating panel %s", S2A(rPanelContexDescriptor.msId)); | |
460 bHasPanelSetChanged = true; 461 } 462 if (aNewPanels[nWriteIndex] != NULL) 463 { 464 // Depending on the context we have to collapse the panel. 465 aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible); 466 467 ++nWriteIndex; --- 6 unchanged lines hidden (view full) --- 474 mpCurrentDeck->SetPosSizePixel( 475 0, 476 0, 477 mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(), 478 mpParentWindow->GetSizePixel().Height()); 479 mpCurrentDeck->SetPanels(aNewPanels); 480 mpCurrentDeck->Show(); 481 | 462 bHasPanelSetChanged = true; 463 } 464 if (aNewPanels[nWriteIndex] != NULL) 465 { 466 // Depending on the context we have to collapse the panel. 467 aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible); 468 469 ++nWriteIndex; --- 6 unchanged lines hidden (view full) --- 476 mpCurrentDeck->SetPosSizePixel( 477 0, 478 0, 479 mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(), 480 mpParentWindow->GetSizePixel().Height()); 481 mpCurrentDeck->SetPanels(aNewPanels); 482 mpCurrentDeck->Show(); 483 |
482 // Tell the tab bar to highlight the button associated with the 483 // deck. 484 mpTabBar->HighlightDeck(rDeckDescriptor.msId); 485 | |
486 mpParentWindow->SetText(rDeckDescriptor.msTitle); 487 488 if (bHasPanelSetChanged) 489 NotifyResize(); 490 491 // Tell the focus manager about the new panels and tab bar 492 // buttons. 493 maFocusManager.SetPanels(aNewPanels); 494 mpTabBar->UpdateFocusManager(maFocusManager); 495} 496 497 498 499 500bool SidebarController::ArePanelSetsEqual ( 501 const SharedPanelContainer& rCurrentPanels, 502 const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels) 503{ | 484 mpParentWindow->SetText(rDeckDescriptor.msTitle); 485 486 if (bHasPanelSetChanged) 487 NotifyResize(); 488 489 // Tell the focus manager about the new panels and tab bar 490 // buttons. 491 maFocusManager.SetPanels(aNewPanels); 492 mpTabBar->UpdateFocusManager(maFocusManager); 493} 494 495 496 497 498bool SidebarController::ArePanelSetsEqual ( 499 const SharedPanelContainer& rCurrentPanels, 500 const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels) 501{ |
504#ifdef DEBUG | 502#ifdef VERBOSE |
505 OSL_TRACE("current panel list:"); 506 for (SharedPanelContainer::const_iterator 507 iPanel(rCurrentPanels.begin()), 508 iEnd(rCurrentPanels.end()); 509 iPanel!=iEnd; 510 ++iPanel) 511 { 512 OSL_TRACE(" panel %s", S2A((*iPanel)->GetId())); --- 29 unchanged lines hidden (view full) --- 542 const OUString& rsPanelId, 543 ::Window* pParentWindow, 544 const OUString& rsMenuCommand) 545{ 546 const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId); 547 if (pPanelDescriptor == NULL) 548 return SharedPanel(); 549 | 503 OSL_TRACE("current panel list:"); 504 for (SharedPanelContainer::const_iterator 505 iPanel(rCurrentPanels.begin()), 506 iEnd(rCurrentPanels.end()); 507 iPanel!=iEnd; 508 ++iPanel) 509 { 510 OSL_TRACE(" panel %s", S2A((*iPanel)->GetId())); --- 29 unchanged lines hidden (view full) --- 540 const OUString& rsPanelId, 541 ::Window* pParentWindow, 542 const OUString& rsMenuCommand) 543{ 544 const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId); 545 if (pPanelDescriptor == NULL) 546 return SharedPanel(); 547 |
550#ifdef DEBUG 551 // Prevent the panel not being created in the same memory of an old panel. 552 ::boost::scoped_array<char> pUnused (new char[sizeof(Panel)]); 553 OSL_TRACE("allocated memory at %x", pUnused.get()); 554#endif 555 | |
556 // Create the panel which is the parent window of the UIElement. 557 SharedPanel pPanel (new Panel( 558 *pPanelDescriptor, 559 pParentWindow, 560 ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()), 561 rsMenuCommand.getLength()>0 562 ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rsMenuCommand) 563 : ::boost::function<void(void)>())); --- 383 unchanged lines hidden --- | 548 // Create the panel which is the parent window of the UIElement. 549 SharedPanel pPanel (new Panel( 550 *pPanelDescriptor, 551 pParentWindow, 552 ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()), 553 rsMenuCommand.getLength()>0 554 ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rsMenuCommand) 555 : ::boost::function<void(void)>())); --- 383 unchanged lines hidden --- |