ToolBarModule::ToolBarModule ( const rtl::Reference<sd::DrawController>& rxController)
: mpBase(nullptr),
mbMainViewSwitchUpdatePending(false)
{ // Tunnel through the controller to obtain a ViewShellBase. if (rxController != nullptr)
mpBase = rxController->GetViewShellBase();
if (!rxController.is()) return;
mxConfigurationController = rxController->getConfigurationController(); if (!mxConfigurationController.is()) return;
// since EventMultiplexer isn't available when the ToolBarModule is // initialized, subscribing the event listener hacked here. if (!mbListeningEventMultiplexer && mpBase)
{
mpBase->GetEventMultiplexer()->AddEventListener(
LINK(this, ToolBarModule, EventMultiplexerListener));
mbListeningEventMultiplexer = true;
}
case gnConfigurationUpdateEndEvent:
HandleUpdateEnd(); break;
case gnResourceActivationRequestEvent: case gnResourceDeactivationRequestEvent: // Remember the request for the activation or deactivation // of the center pane view. When that happens then on end // of the next configuration update the set of visible tool // bars will be updated. if ( ! mbMainViewSwitchUpdatePending) if (rEvent.ResourceId->getResourceURL().match(
FrameworkHelper::msViewURLPrefix)
&& rEvent.ResourceId->isBoundToURL(
FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
{
mbMainViewSwitchUpdatePending = true;
} break;
}
}
switch(pViewShell->GetShellType())
{ // shells that override mainviewshell functionality when used in a pane case ViewShell::ST_NOTESPANEL:
mpBase->GetViewShellManager()->SetOverridingMainShell(pViewShell);
UpdateToolbars(pViewShell.get()); break; default: break;
}
mpToolBarManagerLock.reset();
}
void ToolBarModule::HandleUpdateStart()
{ // Lock the ToolBarManager and tell it to lock the ViewShellManager as // well. This way the ToolBarManager can optimize the releasing of // locks and arranging of updates of both tool bars and the view shell // stack. if (mpBase != nullptr)
{
std::shared_ptr<ToolBarManager> pToolBarManager (mpBase->GetToolBarManager());
mpToolBarManagerLock.reset(new ToolBarManager::UpdateLock(pToolBarManager));
pToolBarManager->LockViewShellManager();
}
}
void ToolBarModule::HandleUpdateEnd()
{ if (mbMainViewSwitchUpdatePending)
{
mbMainViewSwitchUpdatePending = false; // Update the set of visible tool bars and deactivate those that are // no longer visible. This is done before the old view shell is // destroyed in order to avoid unnecessary updates of those tool // bars. if (mpBase != nullptr)
{
std::shared_ptr<ToolBarManager> pToolBarManager (mpBase->GetToolBarManager());
std::shared_ptr<FrameworkHelper> pFrameworkHelper (
FrameworkHelper::Instance(*mpBase)); auto pViewShell
= pFrameworkHelper->GetViewShell(FrameworkHelper::msCenterPaneURL);
UpdateToolbars(pViewShell.get());
}
} // Releasing the update lock of the ToolBarManager will let the // ToolBarManager with the help of the ViewShellManager take care of // updating tool bars and view shell with the minimal amount of // shell stack modifications and tool bar updates.
mpToolBarManagerLock.reset();
}
void ToolBarModule::UpdateToolbars(const ViewShell* pViewShell)
{ // Update the set of visible tool bars and deactivate those that are // no longer visible. This is done before the old view shell is // destroyed in order to avoid unnecessary updates of those tool // bars. if (!mpBase) return;
void SAL_CALL ToolBarModule::disposing (const lang::EventObject& rEvent)
{ if (mxConfigurationController.is()
&& rEvent.Source == mxConfigurationController)
{ // Without the configuration controller this class can do nothing.
mxConfigurationController = nullptr;
dispose();
}
}
IMPL_LINK(ToolBarModule, EventMultiplexerListener, sd::tools::EventMultiplexerEvent&, rEvent, void)
{ if (!mpBase) return;
switch(rEvent.meEventId)
{ case EventMultiplexerEventId::FocusShifted:
{
uno::Reference<drawing::framework::XResourceId> xResourceId{ rEvent.mxUserData,
UNO_QUERY }; if (xResourceId.is())
HandlePaneViewShellFocused(xResourceId); break;
} default: break;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.