diff options
-rw-r--r-- | include/sfx2/sidebar/ResourceManager.hxx | 1 | ||||
-rw-r--r-- | include/sfx2/sidebar/SidebarController.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/ResourceManager.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 33 |
4 files changed, 14 insertions, 31 deletions
diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx index 275737dd531e..bd69b9e62c4f 100644 --- a/include/sfx2/sidebar/ResourceManager.hxx +++ b/include/sfx2/sidebar/ResourceManager.hxx @@ -67,6 +67,7 @@ public: void UpdateModel(css::uno::Reference<css::frame::XModel> xModel); + void disposeDecks(); class DeckContextDescriptor { diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index b90f037c7586..1774fe140742 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -160,7 +160,7 @@ public: void updateModel(css::uno::Reference<css::frame::XModel> xModel); - void disposeDecks(css::uno::Reference<css::frame::XController> xController); + void disposeDecks(); private: diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index d3d47505f660..243f4a6b4401 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -649,7 +649,8 @@ bool ResourceManager::IsDeckEnabled ( void ResourceManager::UpdateModel(css::uno::Reference<css::frame::XModel> xModel) { - for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr) { + for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr) + { if (!itr->mpDeck) continue; @@ -661,8 +662,12 @@ void ResourceManager::UpdateModel(css::uno::Reference<css::frame::XModel> xModel } } +} - +void ResourceManager::disposeDecks() +{ + for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr) + itr->mpDeck.disposeAndClear(); } } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 896b06d61133..1d882863738c 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -174,7 +174,7 @@ void SidebarController::registerSidebarForFrame(SidebarController* pController, void SidebarController::unregisterSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xController) { - pController->disposeDecks(xController); + pController->disposeDecks(); css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( css::ui::ContextChangeEventMultiplexer::get( ::comphelper::getProcessComponentContext())); @@ -184,34 +184,11 @@ void SidebarController::unregisterSidebarForFrame(SidebarController* pController xController); } -void SidebarController::disposeDecks(css::uno::Reference<css::frame::XController> xController) +void SidebarController::disposeDecks() { - // clear decks - ResourceManager::DeckContextDescriptorContainer aDecks; - - mpResourceManager->GetMatchingDecks ( - aDecks, - GetCurrentContext(), - IsDocumentReadOnly(), - xController); - - for (ResourceManager::DeckContextDescriptorContainer::const_iterator - iDeck(aDecks.begin()), iEnd(aDecks.end()); - iDeck!=iEnd; ++iDeck) - { - const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId); - VclPtr<Deck> aDeck = deckDesc->mpDeck; - if (aDeck == mpCurrentDeck) - { - mpCurrentDeck.clear(); - maFocusManager.Clear(); - } - if (aDeck) - { - aDeck.disposeAndClear(); - mpResourceManager->SetDeckToDescriptor(iDeck->msId, VclPtr<Deck>()); - } - } + mpCurrentDeck.clear(); + maFocusManager.Clear(); + mpResourceManager->disposeDecks(); } void SAL_CALL SidebarController::disposing() |