SidebarController.cxx (56798e4b) SidebarController.cxx (239cbbc0)
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

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

94 mpParentWindow,
95 rxFrame,
96 ::boost::bind(&SidebarController::SwitchToDeck, this, _1),
97 ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))),
98 mxFrame(rxFrame),
99 maCurrentContext(OUString(), OUString()),
100 msCurrentDeckId(A2S("PropertyDeck")),
101 maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)),
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

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

94 mpParentWindow,
95 rxFrame,
96 ::boost::bind(&SidebarController::SwitchToDeck, this, _1),
97 ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))),
98 mxFrame(rxFrame),
99 maCurrentContext(OUString(), OUString()),
100 msCurrentDeckId(A2S("PropertyDeck")),
101 maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)),
102 maContextChangeUpdate(::boost::bind(&SidebarController::UpdateConfigurations, this)),
102 mbIsDeckClosed(false),
103 mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width())
104{
105 if (pParentWindow == NULL)
106 {
107 OSL_ASSERT(pParentWindow!=NULL);
108 return;
109 }

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

170}
171
172
173
174
175void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
176 throw(cssu::RuntimeException)
177{
103 mbIsDeckClosed(false),
104 mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width())
105{
106 if (pParentWindow == NULL)
107 {
108 OSL_ASSERT(pParentWindow!=NULL);
109 return;
110 }

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

171}
172
173
174
175
176void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
177 throw(cssu::RuntimeException)
178{
178 UpdateConfigurations(
179 Context(
180 rEvent.ApplicationName,
181 rEvent.ContextName));
179 // Update to the requested new context asynchronously to avoid
180 // subtle errors caused by SFX2 which in rare cases can not
181 // properly handle a synchronous update.
182 maRequestedContext = Context(
183 rEvent.ApplicationName,
184 rEvent.ContextName);
185 if (maRequestedContext != maCurrentContext)
186 maContextChangeUpdate.RequestCall();
182}
183
184
185
186
187void SAL_CALL SidebarController::disposing (const css::lang::EventObject& rEventObject)
188 throw(cssu::RuntimeException)
189{

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

280 }
281 }
282#endif
283}
284
285
286
287
187}
188
189
190
191
192void SAL_CALL SidebarController::disposing (const css::lang::EventObject& rEventObject)
193 throw(cssu::RuntimeException)
194{

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

285 }
286 }
287#endif
288}
289
290
291
292
288void SidebarController::UpdateConfigurations (const Context& rContext)
293void SidebarController::UpdateConfigurations (void)
289{
294{
290 if (maCurrentContext != rContext)
295 if (maCurrentContext != maRequestedContext)
291 {
296 {
292 maCurrentContext = rContext;
297 maCurrentContext = maRequestedContext;
293
294 // Notify the tab bar about the updated set of decks.
295 ResourceManager::IdContainer aDeckIds;
296 ResourceManager::Instance().GetMatchingDecks (
297 aDeckIds,
298
299 // Notify the tab bar about the updated set of decks.
300 ResourceManager::IdContainer aDeckIds;
301 ResourceManager::Instance().GetMatchingDecks (
302 aDeckIds,
298 rContext,
303 maCurrentContext,
299 mxFrame);
300 mpTabBar->SetDecks(aDeckIds);
301
302 // Check if the current deck is among the matching decks.
303 bool bCurrentDeckMatches (false);
304 for (ResourceManager::IdContainer::const_iterator
305 iDeck(aDeckIds.begin()),
306 iEnd(aDeckIds.end());

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

311 {
312 bCurrentDeckMatches = true;
313 break;
314 }
315 }
316
317 DeckDescriptor const* pDeckDescriptor = NULL;
318 if ( ! bCurrentDeckMatches)
304 mxFrame);
305 mpTabBar->SetDecks(aDeckIds);
306
307 // Check if the current deck is among the matching decks.
308 bool bCurrentDeckMatches (false);
309 for (ResourceManager::IdContainer::const_iterator
310 iDeck(aDeckIds.begin()),
311 iEnd(aDeckIds.end());

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

316 {
317 bCurrentDeckMatches = true;
318 break;
319 }
320 }
321
322 DeckDescriptor const* pDeckDescriptor = NULL;
323 if ( ! bCurrentDeckMatches)
319 pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(rContext, mxFrame);
324 pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(maCurrentContext, mxFrame);
320 else
321 pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId);
322 if (pDeckDescriptor != NULL)
323 {
324 msCurrentDeckId = pDeckDescriptor->msId;
325 else
326 pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId);
327 if (pDeckDescriptor != NULL)
328 {
329 msCurrentDeckId = pDeckDescriptor->msId;
325 SwitchToDeck(*pDeckDescriptor, rContext);
330 SwitchToDeck(*pDeckDescriptor, maCurrentContext);
326
327 // Tell the tab bar to highlight the button associated
328 // with the deck.
329 mpTabBar->HighlightDeck(msCurrentDeckId);
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)
331
332 // Tell the tab bar to highlight the button associated
333 // with the deck.
334 mpTabBar->HighlightDeck(msCurrentDeckId);
335 }
336
337#ifdef DEBUG
338 // Show the context name in the deck title bar.
339 if (mpCurrentDeck)
340 {
341 DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar();
342 if (pTitleBar != NULL)
338 pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+rContext.msContext+A2S(")"));
343 pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+maCurrentContext.msContext+A2S(")"));
339 }
340#endif
341 }
342}
343
344
345
346

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

864
865
866
867bool SidebarController::CanModifyChildWindowWidth (void) const
868{
869 SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
870 if (pSplitWindow == NULL)
871 {
344 }
345#endif
346 }
347}
348
349
350
351

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

869
870
871
872bool SidebarController::CanModifyChildWindowWidth (void) const
873{
874 SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
875 if (pSplitWindow == NULL)
876 {
872 OSL_ASSERT(pSplitWindow!=NULL);
873 return 0;
874 }
875
876 sal_uInt16 nRow (0xffff);
877 sal_uInt16 nColumn (0xffff);
878 pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow);
879
880 sal_uInt16 nRowCount (pSplitWindow->GetWindowCount(nColumn));

--- 58 unchanged lines hidden ---
877 return 0;
878 }
879
880 sal_uInt16 nRow (0xffff);
881 sal_uInt16 nColumn (0xffff);
882 pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow);
883
884 sal_uInt16 nRowCount (pSplitWindow->GetWindowCount(nColumn));

--- 58 unchanged lines hidden ---