Kaydet (Commit) 86e5ec2e authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:flatten in sd/source/ui/framework

Change-Id: Id1da25f6ee6ee867e93e0b4c58b6429e07b12429
Reviewed-on: https://gerrit.libreoffice.org/67834
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst abe047f1
......@@ -131,36 +131,35 @@ void ChangeRequestQueueProcessor::ProcessOneEvent()
SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ProcessOneEvent");
if (mxConfiguration.is()
&& ! maQueue.empty())
{
// Get and remove the first entry from the queue.
Reference<XConfigurationChangeRequest> xRequest (maQueue.front());
maQueue.pop_front();
if (!mxConfiguration.is() || maQueue.empty())
return;
// Execute the change request.
if (xRequest.is())
{
// Get and remove the first entry from the queue.
Reference<XConfigurationChangeRequest> xRequest (maQueue.front());
maQueue.pop_front();
// Execute the change request.
if (xRequest.is())
{
#if DEBUG_SD_CONFIGURATION_TRACE
TraceRequest(xRequest);
TraceRequest(xRequest);
#endif
xRequest->execute(mxConfiguration);
}
if (maQueue.empty())
{
SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": All requests are processed");
// The queue is empty so tell the ConfigurationManager to update
// its state.
if (mpConfigurationUpdater != nullptr)
{
xRequest->execute(mxConfiguration);
}
if (!maQueue.empty())
return;
SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": All requests are processed");
// The queue is empty so tell the ConfigurationManager to update
// its state.
if (mpConfigurationUpdater != nullptr)
{
#if DEBUG_SD_CONFIGURATION_TRACE
ConfigurationTracer::TraceConfiguration (
mxConfiguration, "updating to configuration");
ConfigurationTracer::TraceConfiguration (
mxConfiguration, "updating to configuration");
#endif
mpConfigurationUpdater->RequestUpdate(mxConfiguration);
}
}
mpConfigurationUpdater->RequestUpdate(mxConfiguration);
}
}
......
......@@ -243,24 +243,24 @@ void Configuration::PostEvent (
{
OSL_ASSERT(rxResourceId.is());
if (mxBroadcaster.is())
{
ConfigurationChangeEvent aEvent;
aEvent.ResourceId = rxResourceId;
if (bActivation)
if (mbBroadcastRequestEvents)
aEvent.Type = FrameworkHelper::msResourceActivationRequestEvent;
else
aEvent.Type = FrameworkHelper::msResourceActivationEvent;
if (!mxBroadcaster.is())
return;
ConfigurationChangeEvent aEvent;
aEvent.ResourceId = rxResourceId;
if (bActivation)
if (mbBroadcastRequestEvents)
aEvent.Type = FrameworkHelper::msResourceActivationRequestEvent;
else
aEvent.Type = FrameworkHelper::msResourceActivationEvent;
else
if (mbBroadcastRequestEvents)
aEvent.Type = FrameworkHelper::msResourceDeactivationRequestEvent;
else
if (mbBroadcastRequestEvents)
aEvent.Type = FrameworkHelper::msResourceDeactivationRequestEvent;
else
aEvent.Type = FrameworkHelper::msResourceDeactivationEvent;
aEvent.Configuration = this;
aEvent.Type = FrameworkHelper::msResourceDeactivationEvent;
aEvent.Configuration = this;
mxBroadcaster->notifyEvent(aEvent);
}
mxBroadcaster->notifyEvent(aEvent);
}
void Configuration::ThrowIfDisposed() const
......
......@@ -249,38 +249,38 @@ void SAL_CALL ConfigurationController::requestResourceActivation (
SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::requestResourceActivation() " <<
FrameworkHelper::ResourceIdToString(rxResourceId));
if (rxResourceId.is())
if (!rxResourceId.is())
return;
if (eMode == ResourceActivationMode_REPLACE)
{
if (eMode == ResourceActivationMode_REPLACE)
// Get a list of the matching resources and create deactivation
// requests for them.
Sequence<Reference<XResourceId> > aResourceList (
mpImplementation->mxRequestedConfiguration->getResources(
rxResourceId->getAnchor(),
rxResourceId->getResourceTypePrefix(),
AnchorBindingMode_DIRECT));
for (sal_Int32 nIndex=0; nIndex<aResourceList.getLength(); ++nIndex)
{
// Get a list of the matching resources and create deactivation
// requests for them.
Sequence<Reference<XResourceId> > aResourceList (
mpImplementation->mxRequestedConfiguration->getResources(
rxResourceId->getAnchor(),
rxResourceId->getResourceTypePrefix(),
AnchorBindingMode_DIRECT));
for (sal_Int32 nIndex=0; nIndex<aResourceList.getLength(); ++nIndex)
{
// Do not request the deactivation of the resource for which
// this method was called. Doing it would not change the
// outcome but would result in unnecessary work.
if (rxResourceId->compareTo(aResourceList[nIndex]) == 0)
continue;
// Request the deactivation of a resource and all resources
// linked to it.
requestResourceDeactivation(aResourceList[nIndex]);
}
// Do not request the deactivation of the resource for which
// this method was called. Doing it would not change the
// outcome but would result in unnecessary work.
if (rxResourceId->compareTo(aResourceList[nIndex]) == 0)
continue;
// Request the deactivation of a resource and all resources
// linked to it.
requestResourceDeactivation(aResourceList[nIndex]);
}
Reference<XConfigurationChangeRequest> xRequest(
new GenericConfigurationChangeRequest(
rxResourceId,
GenericConfigurationChangeRequest::Activation));
postChangeRequest(xRequest);
}
Reference<XConfigurationChangeRequest> xRequest(
new GenericConfigurationChangeRequest(
rxResourceId,
GenericConfigurationChangeRequest::Activation));
postChangeRequest(xRequest);
}
void SAL_CALL ConfigurationController::requestResourceDeactivation (
......@@ -292,31 +292,31 @@ void SAL_CALL ConfigurationController::requestResourceDeactivation (
SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::requestResourceDeactivation() " <<
FrameworkHelper::ResourceIdToString(rxResourceId));
if (rxResourceId.is())
{
// Request deactivation of all resources linked to the specified one
// as well.
const Sequence<Reference<XResourceId> > aLinkedResources (
mpImplementation->mxRequestedConfiguration->getResources(
rxResourceId,
OUString(),
AnchorBindingMode_DIRECT));
const sal_Int32 nCount (aLinkedResources.getLength());
for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
{
// We do not add deactivation requests directly but call this
// method recursively, so that when one time there are resources
// linked to linked resources, these are handled correctly, too.
requestResourceDeactivation(aLinkedResources[nIndex]);
}
if (!rxResourceId.is())
return;
// Add a deactivation request for the specified resource.
Reference<XConfigurationChangeRequest> xRequest(
new GenericConfigurationChangeRequest(
rxResourceId,
GenericConfigurationChangeRequest::Deactivation));
postChangeRequest(xRequest);
// Request deactivation of all resources linked to the specified one
// as well.
const Sequence<Reference<XResourceId> > aLinkedResources (
mpImplementation->mxRequestedConfiguration->getResources(
rxResourceId,
OUString(),
AnchorBindingMode_DIRECT));
const sal_Int32 nCount (aLinkedResources.getLength());
for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
{
// We do not add deactivation requests directly but call this
// method recursively, so that when one time there are resources
// linked to linked resources, these are handled correctly, too.
requestResourceDeactivation(aLinkedResources[nIndex]);
}
// Add a deactivation request for the specified resource.
Reference<XConfigurationChangeRequest> xRequest(
new GenericConfigurationChangeRequest(
rxResourceId,
GenericConfigurationChangeRequest::Deactivation));
postChangeRequest(xRequest);
}
Reference<XResource> SAL_CALL ConfigurationController::getResource (
......
......@@ -191,19 +191,19 @@ void ConfigurationUpdater::UpdateConfiguration()
void ConfigurationUpdater::CleanRequestedConfiguration()
{
if (mxControllerManager.is())
if (!mxControllerManager.is())
return;
// Request the deactivation of pure anchors that have no child.
vector<Reference<XResourceId> > aResourcesToDeactivate;
CheckPureAnchors(mxRequestedConfiguration, aResourcesToDeactivate);
if (!aResourcesToDeactivate.empty())
{
// Request the deactivation of pure anchors that have no child.
vector<Reference<XResourceId> > aResourcesToDeactivate;
CheckPureAnchors(mxRequestedConfiguration, aResourcesToDeactivate);
if (!aResourcesToDeactivate.empty())
{
Reference<XConfigurationController> xCC (
mxControllerManager->getConfigurationController());
for (auto& rxId : aResourcesToDeactivate)
if (rxId.is())
xCC->requestResourceDeactivation(rxId);
}
Reference<XConfigurationController> xCC (
mxControllerManager->getConfigurationController());
for (auto& rxId : aResourcesToDeactivate)
if (rxId.is())
xCC->requestResourceDeactivation(rxId);
}
}
......
......@@ -45,18 +45,18 @@ GenericConfigurationChangeRequest::~GenericConfigurationChangeRequest() throw()
void SAL_CALL GenericConfigurationChangeRequest::execute (
const Reference<XConfiguration>& rxConfiguration)
{
if (rxConfiguration.is())
if (!rxConfiguration.is())
return;
switch (meMode)
{
switch (meMode)
{
case Activation:
rxConfiguration->addResource(mxResourceId);
break;
case Activation:
rxConfiguration->addResource(mxResourceId);
break;
case Deactivation:
rxConfiguration->removeResource(mxResourceId);
break;
}
case Deactivation:
rxConfiguration->removeResource(mxResourceId);
break;
}
}
......
......@@ -126,78 +126,78 @@ void SAL_CALL BasicPaneFactory::disposing()
void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments)
{
if (aArguments.getLength() > 0)
if (aArguments.getLength() <= 0)
return;
try
{
// Get the XController from the first argument.
Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
mxControllerWeak = xController;
// Tunnel through the controller to obtain access to the ViewShellBase.
try
{
// Get the XController from the first argument.
Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
mxControllerWeak = xController;
// Tunnel through the controller to obtain access to the ViewShellBase.
try
{
Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
DrawController* pController
= reinterpret_cast<DrawController*>(
(sal::static_int_cast<sal_uIntPtr>(
xTunnel->getSomething(DrawController::getUnoTunnelId()))));
mpViewShellBase = pController->GetViewShellBase();
}
catch(RuntimeException&)
{}
Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
DrawController* pController
= reinterpret_cast<DrawController*>(
(sal::static_int_cast<sal_uIntPtr>(
xTunnel->getSomething(DrawController::getUnoTunnelId()))));
mpViewShellBase = pController->GetViewShellBase();
}
catch(RuntimeException&)
{}
Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
Reference<XConfigurationController> xCC (xCM->getConfigurationController());
mxConfigurationControllerWeak = xCC;
Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
Reference<XConfigurationController> xCC (xCM->getConfigurationController());
mxConfigurationControllerWeak = xCC;
// Add pane factories for the two left panes (one for Impress and one for
// Draw) and the center pane.
if (xController.is() && xCC.is())
{
PaneDescriptor aDescriptor;
aDescriptor.msPaneURL = FrameworkHelper::msCenterPaneURL;
aDescriptor.mePaneId = CenterPaneId;
aDescriptor.mbIsReleased = false;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
aDescriptor.msPaneURL = FrameworkHelper::msFullScreenPaneURL;
aDescriptor.mePaneId = FullScreenPaneId;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
aDescriptor.msPaneURL = FrameworkHelper::msLeftImpressPaneURL;
aDescriptor.mePaneId = LeftImpressPaneId;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
aDescriptor.msPaneURL = FrameworkHelper::msLeftDrawPaneURL;
aDescriptor.mePaneId = LeftDrawPaneId;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
}
// Register as configuration change listener.
if (xCC.is())
{
xCC->addConfigurationChangeListener(
this,
FrameworkHelper::msConfigurationUpdateStartEvent,
makeAny(gnConfigurationUpdateStartEvent));
xCC->addConfigurationChangeListener(
this,
FrameworkHelper::msConfigurationUpdateEndEvent,
makeAny(gnConfigurationUpdateEndEvent));
}
// Add pane factories for the two left panes (one for Impress and one for
// Draw) and the center pane.
if (xController.is() && xCC.is())
{
PaneDescriptor aDescriptor;
aDescriptor.msPaneURL = FrameworkHelper::msCenterPaneURL;
aDescriptor.mePaneId = CenterPaneId;
aDescriptor.mbIsReleased = false;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
aDescriptor.msPaneURL = FrameworkHelper::msFullScreenPaneURL;
aDescriptor.mePaneId = FullScreenPaneId;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
aDescriptor.msPaneURL = FrameworkHelper::msLeftImpressPaneURL;
aDescriptor.mePaneId = LeftImpressPaneId;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
aDescriptor.msPaneURL = FrameworkHelper::msLeftDrawPaneURL;
aDescriptor.mePaneId = LeftDrawPaneId;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
}
catch (RuntimeException&)
// Register as configuration change listener.
if (xCC.is())
{
Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
if (xCC.is())
xCC->removeResourceFactoryForReference(this);
xCC->addConfigurationChangeListener(
this,
FrameworkHelper::msConfigurationUpdateStartEvent,
makeAny(gnConfigurationUpdateStartEvent));
xCC->addConfigurationChangeListener(
this,
FrameworkHelper::msConfigurationUpdateEndEvent,
makeAny(gnConfigurationUpdateEndEvent));
}
}
catch (RuntimeException&)
{
Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
if (xCC.is())
xCC->removeResourceFactoryForReference(this);
}
}
//===== XPaneFactory ==========================================================
......
......@@ -69,44 +69,44 @@ void BasicToolBarFactory::Shutdown()
void SAL_CALL BasicToolBarFactory::initialize (const Sequence<Any>& aArguments)
{
if (aArguments.getLength() > 0)
if (aArguments.getLength() <= 0)
return;
try
{
try
{
// Get the XController from the first argument.
mxController.set(aArguments[0], UNO_QUERY_THROW);
// Get the XController from the first argument.
mxController.set(aArguments[0], UNO_QUERY_THROW);
utl::MediaDescriptor aDescriptor (mxController->getModel()->getArgs());
if ( ! aDescriptor.getUnpackedValueOrDefault(
utl::MediaDescriptor::PROP_PREVIEW(),
false))
{
// Register the factory for its supported tool bars.
Reference<XControllerManager> xControllerManager(mxController, UNO_QUERY_THROW);
mxConfigurationController = xControllerManager->getConfigurationController();
if (mxConfigurationController.is())
{
mxConfigurationController->addResourceFactory(
FrameworkHelper::msViewTabBarURL, this);
}
Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY);
if (xComponent.is())
xComponent->addEventListener(static_cast<lang::XEventListener*>(this));
}
else
utl::MediaDescriptor aDescriptor (mxController->getModel()->getArgs());
if ( ! aDescriptor.getUnpackedValueOrDefault(
utl::MediaDescriptor::PROP_PREVIEW(),
false))
{
// Register the factory for its supported tool bars.
Reference<XControllerManager> xControllerManager(mxController, UNO_QUERY_THROW);
mxConfigurationController = xControllerManager->getConfigurationController();
if (mxConfigurationController.is())
{
// The view shell is in preview mode and thus does not need
// the view tab bar.
mxConfigurationController = nullptr;
mxConfigurationController->addResourceFactory(
FrameworkHelper::msViewTabBarURL, this);
}
Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY);
if (xComponent.is())
xComponent->addEventListener(static_cast<lang::XEventListener*>(this));
}
catch (RuntimeException&)
else
{
Shutdown();
throw;
// The view shell is in preview mode and thus does not need
// the view tab bar.
mxConfigurationController = nullptr;
}
}
catch (RuntimeException&)
{
Shutdown();
throw;
}
}
//----- lang::XEventListener --------------------------------------------------
......
......@@ -185,87 +185,87 @@ void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxV
if ( ! rxView.is())
throw lang::IllegalArgumentException();
if (rxView.is() && mpBase!=nullptr)
if (!rxView.is() || !mpBase)
return;
ViewShellContainer::iterator iViewShell (
::std::find_if(
mpViewShellContainer->begin(),
mpViewShellContainer->end(),
[&] (std::shared_ptr<ViewDescriptor> const& pVD) {
return ViewDescriptor::CompareView(pVD, rxView);
} ));
if (iViewShell == mpViewShellContainer->end())
{
ViewShellContainer::iterator iViewShell (
::std::find_if(
mpViewShellContainer->begin(),
mpViewShellContainer->end(),
[&] (std::shared_ptr<ViewDescriptor> const& pVD) {
return ViewDescriptor::CompareView(pVD, rxView);
} ));
if (iViewShell == mpViewShellContainer->end())
{
throw lang::IllegalArgumentException();
}
throw lang::IllegalArgumentException();
}
std::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell);
std::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell);
if ((*iViewShell)->mxViewId->isBoundToURL(
FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
if ((*iViewShell)->mxViewId->isBoundToURL(
FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
{
// Obtain a pointer to and connect to the frame view of the
// view. The next view, that is created, will be
// initialized with this frame view.
if (mpFrameView == nullptr)
{
// Obtain a pointer to and connect to the frame view of the
// view. The next view, that is created, will be
// initialized with this frame view.
if (mpFrameView == nullptr)
{
mpFrameView = pViewShell->GetFrameView();
if (mpFrameView)
mpFrameView->Connect();
}
// With the view in the center pane the sub controller is
// released, too.
mpBase->GetDrawController().SetSubController(
Reference<drawing::XDrawSubController>());
SfxViewShell* pSfxViewShell = pViewShell->GetViewShell();
if (pSfxViewShell != nullptr)
pSfxViewShell->DisconnectAllClients();
mpFrameView = pViewShell->GetFrameView();
if (mpFrameView)
mpFrameView->Connect();
}
ReleaseView(*iViewShell, false);
// With the view in the center pane the sub controller is
// released, too.
mpBase->GetDrawController().SetSubController(
Reference<drawing::XDrawSubController>());
mpViewShellContainer->erase(iViewShell);
SfxViewShell* pSfxViewShell = pViewShell->GetViewShell();
if (pSfxViewShell != nullptr)
pSfxViewShell->DisconnectAllClients();
}
ReleaseView(*iViewShell, false);
mpViewShellContainer->erase(iViewShell);
}
void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
{
if (aArguments.getLength() > 0)
if (aArguments.getLength() <= 0)
return;
try
{
try
{
// Get the XController from the first argument.
Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
// Tunnel through the controller to obtain a ViewShellBase.
Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
if (pController != nullptr)
mpBase = pController->GetViewShellBase();
// Register the factory for its supported views.
Reference<XControllerManager> xCM (xController,UNO_QUERY_THROW);
mxConfigurationController = xCM->getConfigurationController();
if ( ! mxConfigurationController.is())
throw RuntimeException();
mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this);
}
catch (RuntimeException&)
{
mpBase = nullptr;
if (mxConfigurationController.is())
mxConfigurationController->removeResourceFactoryForReference(this);
throw;
}
// Get the XController from the first argument.
Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
// Tunnel through the controller to obtain a ViewShellBase.
Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
if (pController != nullptr)
mpBase = pController->GetViewShellBase();
// Register the factory for its supported views.
Reference<XControllerManager> xCM (xController,UNO_QUERY_THROW);
mxConfigurationController = xCM->getConfigurationController();
if ( ! mxConfigurationController.is())
throw RuntimeException();
mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this);
}
catch (RuntimeException&)
{
mpBase = nullptr;
if (mxConfigurationController.is())
mxConfigurationController->removeResourceFactoryForReference(this);
throw;
}
}
......
......@@ -52,39 +52,39 @@ ChildWindowPane::ChildWindowPane (
mrViewShellBase.GetViewShellManager()->ActivateShell(mpShell.get());
SfxViewFrame* pViewFrame = mrViewShellBase.GetViewFrame();
if (pViewFrame != nullptr)
if (pViewFrame == nullptr)
return;
if (mrViewShellBase.IsActive())
{
if (mrViewShellBase.IsActive())
if (pViewFrame->KnowsChildWindow(mnChildWindowId))
{
if (pViewFrame->KnowsChildWindow(mnChildWindowId))
if (pViewFrame->HasChildWindow(mnChildWindowId))
{
if (pViewFrame->HasChildWindow(mnChildWindowId))
{
// The ViewShellBase has already been activated. Make
// the child window visible as soon as possible.
pViewFrame->SetChildWindow(mnChildWindowId, true);
}
else
{
// The window is created asynchronously. Rely on the
// ConfigurationUpdater to try another update, and with
// that another request for this window, in a short
// time.
}
// The ViewShellBase has already been activated. Make
// the child window visible as soon as possible.
pViewFrame->SetChildWindow(mnChildWindowId, true);
}
else
{
SAL_WARN("sd", "ChildWindowPane:not known");
// The window is created asynchronously. Rely on the
// ConfigurationUpdater to try another update, and with
// that another request for this window, in a short
// time.
}
}
else
{
// The ViewShellBase has not yet been activated. Hide the
// window and wait a little before it is made visible. See
// comments in the GetWindow() method for an explanation.
pViewFrame->SetChildWindow(mnChildWindowId, false);
SAL_WARN("sd", "ChildWindowPane:not known");
}
}
else
{
// The ViewShellBase has not yet been activated. Hide the
// window and wait a little before it is made visible. See
// comments in the GetWindow() method for an explanation.
pViewFrame->SetChildWindow(mnChildWindowId, false);
}
}
ChildWindowPane::~ChildWindowPane()
......
......@@ -151,21 +151,21 @@ void SAL_CALL FullScreenPane::setAccessible (
{
ThrowIfDisposed();
if (mpWindow != nullptr)
if (mpWindow == nullptr)
return;
Reference<lang::XInitialization> xInitializable (rxAccessible, UNO_QUERY);
if (xInitializable.is())
{
Reference<lang::XInitialization> xInitializable (rxAccessible, UNO_QUERY);
if (xInitializable.is())
{
vcl::Window* pParentWindow = mpWindow->GetParent();
Reference<css::accessibility::XAccessible> xAccessibleParent;
if (pParentWindow != nullptr)
xAccessibleParent = pParentWindow->GetAccessible();
Sequence<Any> aArguments (1);
aArguments[0] <<= xAccessibleParent;
xInitializable->initialize(aArguments);
}
GetWindow()->SetAccessible(rxAccessible);
vcl::Window* pParentWindow = mpWindow->GetParent();
Reference<css::accessibility::XAccessible> xAccessibleParent;
if (pParentWindow != nullptr)
xAccessibleParent = pParentWindow->GetAccessible();
Sequence<Any> aArguments (1);
aArguments[0] <<= xAccessibleParent;
xInitializable->initialize(aArguments);
}
GetWindow()->SetAccessible(rxAccessible);
}
IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent&, rEvent, void)
......
......@@ -185,23 +185,23 @@ void PresentationFactoryProvider::disposing()
void SAL_CALL PresentationFactoryProvider::initialize(
const Sequence<Any>& aArguments)
{
if (aArguments.getLength() > 0)
if (aArguments.getLength() <= 0)
return;
try
{
try
{
// Get the XController from the first argument.
Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
Reference<XConfigurationController> xCC (xCM->getConfigurationController());
if (xCC.is())
xCC->addResourceFactory(
gsPresentationViewURL,
new PresentationFactory(xController));
}
catch (RuntimeException&)
{
DBG_UNHANDLED_EXCEPTION("sd");
}
// Get the XController from the first argument.
Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
Reference<XConfigurationController> xCC (xCM->getConfigurationController());
if (xCC.is())
xCC->addResourceFactory(
gsPresentationViewURL,
new PresentationFactory(xController));
}
catch (RuntimeException&)
{
DBG_UNHANDLED_EXCEPTION("sd");
}
}
......
......@@ -118,30 +118,30 @@ void SAL_CALL CenterViewFocusModule::notifyConfigurationChange (
void CenterViewFocusModule::HandleNewView (
const Reference<XConfiguration>& rxConfiguration)
{
if (mbNewViewCreated)
if (!mbNewViewCreated)
return;
mbNewViewCreated = false;
// Make the center pane the active one. Tunnel through the
// controller to obtain a ViewShell pointer.
Sequence<Reference<XResourceId> > xViewIds (rxConfiguration->getResources(
FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL),
FrameworkHelper::msViewURLPrefix,
AnchorBindingMode_DIRECT));
Reference<XView> xView;
if (xViewIds.getLength() > 0)
xView.set( mxConfigurationController->getResource(xViewIds[0]),UNO_QUERY);
Reference<lang::XUnoTunnel> xTunnel (xView, UNO_QUERY);
if (xTunnel.is() && mpBase!=nullptr)
{
mbNewViewCreated = false;
// Make the center pane the active one. Tunnel through the
// controller to obtain a ViewShell pointer.
Sequence<Reference<XResourceId> > xViewIds (rxConfiguration->getResources(
FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL),
FrameworkHelper::msViewURLPrefix,
AnchorBindingMode_DIRECT));
Reference<XView> xView;
if (xViewIds.getLength() > 0)
xView.set( mxConfigurationController->getResource(xViewIds[0]),UNO_QUERY);
Reference<lang::XUnoTunnel> xTunnel (xView, UNO_QUERY);
if (xTunnel.is() && mpBase!=nullptr)
ViewShellWrapper* pViewShellWrapper = reinterpret_cast<ViewShellWrapper*>(
xTunnel->getSomething(ViewShellWrapper::getUnoTunnelId()));
if (pViewShellWrapper != nullptr)
{
ViewShellWrapper* pViewShellWrapper = reinterpret_cast<ViewShellWrapper*>(
xTunnel->getSomething(ViewShellWrapper::getUnoTunnelId()));
if (pViewShellWrapper != nullptr)
{
std::shared_ptr<ViewShell> pViewShell = pViewShellWrapper->GetViewShell();
if (pViewShell != nullptr)
mpBase->GetViewShellManager()->MoveToTop(*pViewShell);
}
std::shared_ptr<ViewShell> pViewShell = pViewShellWrapper->GetViewShell();
if (pViewShell != nullptr)
mpBase->GetViewShellManager()->MoveToTop(*pViewShell);
}
}
}
......
......@@ -201,40 +201,40 @@ void ModuleController::ProcessStartupService (const ::std::vector<Any>& rValues)
void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL)
{
ResourceToFactoryMap::const_iterator iFactory (mpResourceToFactoryMap->find(rsResourceURL));
if (iFactory != mpResourceToFactoryMap->end())
if (iFactory == mpResourceToFactoryMap->end())
return;
// Check that the factory has already been loaded and not been
// destroyed in the meantime.
Reference<XInterface> xFactory;
LoadedFactoryContainer::const_iterator iLoadedFactory (
mpLoadedFactories->find(iFactory->second));
if (iLoadedFactory != mpLoadedFactories->end())
xFactory.set(iLoadedFactory->second, UNO_QUERY);
if ( xFactory.is())
return;
// Create a new instance of the factory.
Reference<uno::XComponentContext> xContext =
::comphelper::getProcessComponentContext();
// Create the factory service.
Sequence<Any> aArguments(1);
aArguments[0] <<= mxController;
try
{
// Check that the factory has already been loaded and not been
// destroyed in the meantime.
Reference<XInterface> xFactory;
LoadedFactoryContainer::const_iterator iLoadedFactory (
mpLoadedFactories->find(iFactory->second));
if (iLoadedFactory != mpLoadedFactories->end())
xFactory.set(iLoadedFactory->second, UNO_QUERY);
if ( ! xFactory.is())
{
// Create a new instance of the factory.
Reference<uno::XComponentContext> xContext =
::comphelper::getProcessComponentContext();
// Create the factory service.
Sequence<Any> aArguments(1);
aArguments[0] <<= mxController;
try
{
xFactory = xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
iFactory->second,
aArguments,
xContext);
}
catch (const Exception&)
{
SAL_WARN("sd.fwk", "caught exception while creating factory.");
}
// Remember that this factory has been instanced.
(*mpLoadedFactories)[iFactory->second] = xFactory;
}
xFactory = xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
iFactory->second,
aArguments,
xContext);
}
catch (const Exception&)
{
SAL_WARN("sd.fwk", "caught exception while creating factory.");
}
// Remember that this factory has been instanced.
(*mpLoadedFactories)[iFactory->second] = xFactory;
}
//----- XInitialization -------------------------------------------------------
......
......@@ -122,18 +122,18 @@ IMPL_LINK(ShellStackGuard, TimeoutHandler, Timer*, pIdle, void)
#else
(void)pIdle;
#endif
if (mpUpdateLock != nullptr)
if (mpUpdateLock == nullptr)
return;
if ( ! IsPrinting())
{
if ( ! IsPrinting())
{
// Printing finished. Release the update lock.
mpUpdateLock.reset();
}
else
{
// Wait long for the printing to finish.
maPrinterPollingIdle.Start();
}
// Printing finished. Release the update lock.
mpUpdateLock.reset();
}
else
{
// Wait long for the printing to finish.
maPrinterPollingIdle.Start();
}
}
......
......@@ -77,28 +77,28 @@ SlideSorterModule::SlideSorterModule (
makeAny(ResourceDeactivationRequestEvent));
}
}
if (mxConfigurationController.is())
{
UpdateViewTabBar(nullptr);
if (SvtSlideSorterBarOptions().GetVisibleImpressView())
AddActiveMainView(FrameworkHelper::msImpressViewURL);
if (SvtSlideSorterBarOptions().GetVisibleOutlineView())
AddActiveMainView(FrameworkHelper::msOutlineViewURL);
if (SvtSlideSorterBarOptions().GetVisibleNotesView())
AddActiveMainView(FrameworkHelper::msNotesViewURL);
if (SvtSlideSorterBarOptions().GetVisibleHandoutView())
AddActiveMainView(FrameworkHelper::msHandoutViewURL);
if (SvtSlideSorterBarOptions().GetVisibleSlideSorterView())
AddActiveMainView(FrameworkHelper::msSlideSorterURL);
if (SvtSlideSorterBarOptions().GetVisibleDrawView())
AddActiveMainView(FrameworkHelper::msDrawViewURL);
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceActivationEvent,
Any());
}
if (!mxConfigurationController.is())
return;
UpdateViewTabBar(nullptr);
if (SvtSlideSorterBarOptions().GetVisibleImpressView())
AddActiveMainView(FrameworkHelper::msImpressViewURL);
if (SvtSlideSorterBarOptions().GetVisibleOutlineView())
AddActiveMainView(FrameworkHelper::msOutlineViewURL);
if (SvtSlideSorterBarOptions().GetVisibleNotesView())
AddActiveMainView(FrameworkHelper::msNotesViewURL);
if (SvtSlideSorterBarOptions().GetVisibleHandoutView())
AddActiveMainView(FrameworkHelper::msHandoutViewURL);
if (SvtSlideSorterBarOptions().GetVisibleSlideSorterView())
AddActiveMainView(FrameworkHelper::msSlideSorterURL);
if (SvtSlideSorterBarOptions().GetVisibleDrawView())
AddActiveMainView(FrameworkHelper::msDrawViewURL);
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceActivationEvent,
Any());
}
SlideSorterModule::~SlideSorterModule()
......@@ -202,22 +202,22 @@ void SlideSorterModule::UpdateViewTabBar (const Reference<XTabBar>& rxTabBar)
xBar.set(xCC->getResource(mxViewTabBarId), UNO_QUERY);
}
if (xBar.is())
{
TabBarButton aButtonA;
aButtonA.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msSlideSorterURL,
FrameworkHelper::msCenterPaneURL);
aButtonA.ButtonLabel = SdResId(STR_SLIDE_SORTER_MODE);
TabBarButton aButtonB;
aButtonB.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msHandoutViewURL,
FrameworkHelper::msCenterPaneURL);
if ( ! xBar->hasTabBarButton(aButtonA))
xBar->addTabBarButtonAfter(aButtonA, aButtonB);
}
if (!xBar.is())
return;
TabBarButton aButtonA;
aButtonA.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msSlideSorterURL,
FrameworkHelper::msCenterPaneURL);
aButtonA.ButtonLabel = SdResId(STR_SLIDE_SORTER_MODE);
TabBarButton aButtonB;
aButtonB.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msHandoutViewURL,
FrameworkHelper::msCenterPaneURL);
if ( ! xBar->hasTabBarButton(aButtonA))
xBar->addTabBarButtonAfter(aButtonA, aButtonB);
}
void SlideSorterModule::AddActiveMainView (
......@@ -250,25 +250,25 @@ void SlideSorterModule::HandleMainViewSwitch (
else
msCurrentMainViewURL.clear();
if (mxConfigurationController.is())
{
ConfigurationController::Lock aLock (mxConfigurationController);
if (!mxConfigurationController.is())
return;
if (maActiveMainViewContainer.find(msCurrentMainViewURL)
!= maActiveMainViewContainer.end())
{
// Activate resource.
mxConfigurationController->requestResourceActivation(
mxResourceId->getAnchor(),
ResourceActivationMode_ADD);
mxConfigurationController->requestResourceActivation(
mxResourceId,
ResourceActivationMode_REPLACE);
}
else
{
mxConfigurationController->requestResourceDeactivation(mxResourceId);
}
ConfigurationController::Lock aLock (mxConfigurationController);
if (maActiveMainViewContainer.find(msCurrentMainViewURL)
!= maActiveMainViewContainer.end())
{
// Activate resource.
mxConfigurationController->requestResourceActivation(
mxResourceId->getAnchor(),
ResourceActivationMode_ADD);
mxConfigurationController->requestResourceActivation(
mxResourceId,
ResourceActivationMode_REPLACE);
}
else
{
mxConfigurationController->requestResourceDeactivation(mxResourceId);
}
}
......
......@@ -59,29 +59,29 @@ ToolBarModule::ToolBarModule (
}
Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
if (xControllerManager.is())
{
mxConfigurationController = xControllerManager->getConfigurationController();
if (mxConfigurationController.is())
{
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msConfigurationUpdateStartEvent,
makeAny(gnConfigurationUpdateStartEvent));
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msConfigurationUpdateEndEvent,
makeAny(gnConfigurationUpdateEndEvent));
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceActivationRequestEvent,
makeAny(gnResourceActivationRequestEvent));
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceDeactivationRequestEvent,
makeAny(gnResourceDeactivationRequestEvent));
}
}
if (!xControllerManager.is())
return;
mxConfigurationController = xControllerManager->getConfigurationController();
if (!mxConfigurationController.is())
return;
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msConfigurationUpdateStartEvent,
makeAny(gnConfigurationUpdateStartEvent));
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msConfigurationUpdateEndEvent,
makeAny(gnConfigurationUpdateEndEvent));
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceActivationRequestEvent,
makeAny(gnResourceActivationRequestEvent));
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceDeactivationRequestEvent,
makeAny(gnResourceDeactivationRequestEvent));
}
ToolBarModule::~ToolBarModule()
......@@ -99,36 +99,36 @@ void SAL_CALL ToolBarModule::disposing()
void SAL_CALL ToolBarModule::notifyConfigurationChange (
const ConfigurationChangeEvent& rEvent)
{
if (mxConfigurationController.is())
if (!mxConfigurationController.is())
return;
sal_Int32 nEventType = 0;
rEvent.UserData >>= nEventType;
switch (nEventType)
{
sal_Int32 nEventType = 0;
rEvent.UserData >>= nEventType;
switch (nEventType)
{
case gnConfigurationUpdateStartEvent:
HandleUpdateStart();
break;
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;
}
case gnConfigurationUpdateStartEvent:
HandleUpdateStart();
break;
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;
}
}
......
......@@ -54,27 +54,27 @@ ViewTabBarModule::ViewTabBarModule (
{
Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
if (xControllerManager.is())
{
mxConfigurationController = xControllerManager->getConfigurationController();
if (mxConfigurationController.is())
{
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceActivationRequestEvent,
makeAny(ResourceActivationRequestEvent));
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceDeactivationRequestEvent,
makeAny(ResourceDeactivationRequestEvent));
UpdateViewTabBar(nullptr);
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceActivationEvent,
makeAny(ResourceActivationEvent));
}
}
if (!xControllerManager.is())
return;
mxConfigurationController = xControllerManager->getConfigurationController();
if (!mxConfigurationController.is())
return;
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceActivationRequestEvent,
makeAny(ResourceActivationRequestEvent));
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceDeactivationRequestEvent,
makeAny(ResourceDeactivationRequestEvent));
UpdateViewTabBar(nullptr);
mxConfigurationController->addConfigurationChangeListener(
this,
FrameworkHelper::msResourceActivationEvent,
makeAny(ResourceActivationEvent));
}
ViewTabBarModule::~ViewTabBarModule()
......@@ -92,34 +92,34 @@ void SAL_CALL ViewTabBarModule::disposing()
void SAL_CALL ViewTabBarModule::notifyConfigurationChange (
const ConfigurationChangeEvent& rEvent)
{
if (mxConfigurationController.is())
if (!mxConfigurationController.is())
return;
sal_Int32 nEventType = 0;
rEvent.UserData >>= nEventType;
switch (nEventType)
{
sal_Int32 nEventType = 0;
rEvent.UserData >>= nEventType;
switch (nEventType)
{
case ResourceActivationRequestEvent:
if (mxViewTabBarId->isBoundTo(rEvent.ResourceId, AnchorBindingMode_DIRECT))
{
mxConfigurationController->requestResourceActivation(
mxViewTabBarId,
ResourceActivationMode_ADD);
}
break;
case ResourceDeactivationRequestEvent:
if (mxViewTabBarId->isBoundTo(rEvent.ResourceId, AnchorBindingMode_DIRECT))
{
mxConfigurationController->requestResourceDeactivation(mxViewTabBarId);
}
break;
case ResourceActivationEvent:
if (rEvent.ResourceId->compareTo(mxViewTabBarId) == 0)
{
UpdateViewTabBar(Reference<XTabBar>(rEvent.ResourceObject,UNO_QUERY));
}
}
case ResourceActivationRequestEvent:
if (mxViewTabBarId->isBoundTo(rEvent.ResourceId, AnchorBindingMode_DIRECT))
{
mxConfigurationController->requestResourceActivation(
mxViewTabBarId,
ResourceActivationMode_ADD);
}
break;
case ResourceDeactivationRequestEvent:
if (mxViewTabBarId->isBoundTo(rEvent.ResourceId, AnchorBindingMode_DIRECT))
{
mxConfigurationController->requestResourceDeactivation(mxViewTabBarId);
}
break;
case ResourceActivationEvent:
if (rEvent.ResourceId->compareTo(mxViewTabBarId) == 0)
{
UpdateViewTabBar(Reference<XTabBar>(rEvent.ResourceObject,UNO_QUERY));
}
}
}
......@@ -137,43 +137,43 @@ void SAL_CALL ViewTabBarModule::disposing (
void ViewTabBarModule::UpdateViewTabBar (const Reference<XTabBar>& rxTabBar)
{
if (mxConfigurationController.is())
{
Reference<XTabBar> xBar (rxTabBar);
if ( ! xBar.is())
xBar.set( mxConfigurationController->getResource(mxViewTabBarId), UNO_QUERY);
if (xBar.is())
{
TabBarButton aEmptyButton;
Reference<XResourceId> xAnchor (mxViewTabBarId->getAnchor());
TabBarButton aImpressViewButton;
aImpressViewButton.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msImpressViewURL,
xAnchor);
aImpressViewButton.ButtonLabel = SdResId(STR_NORMAL_MODE);
if ( ! xBar->hasTabBarButton(aImpressViewButton))
xBar->addTabBarButtonAfter(aImpressViewButton, aEmptyButton);
TabBarButton aOutlineViewButton;
aOutlineViewButton.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msOutlineViewURL,
xAnchor);
aOutlineViewButton.ButtonLabel = SdResId(STR_OUTLINE_MODE);
if ( ! xBar->hasTabBarButton(aOutlineViewButton))
xBar->addTabBarButtonAfter(aOutlineViewButton, aImpressViewButton);
TabBarButton aNotesViewButton;
aNotesViewButton.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msNotesViewURL,
xAnchor);
aNotesViewButton.ButtonLabel = SdResId(STR_NOTES_MODE);
if ( ! xBar->hasTabBarButton(aNotesViewButton))
xBar->addTabBarButtonAfter(aNotesViewButton, aOutlineViewButton);
}
}
if (!mxConfigurationController.is())
return;
Reference<XTabBar> xBar (rxTabBar);
if ( ! xBar.is())
xBar.set( mxConfigurationController->getResource(mxViewTabBarId), UNO_QUERY);
if (!xBar.is())
return;
TabBarButton aEmptyButton;
Reference<XResourceId> xAnchor (mxViewTabBarId->getAnchor());
TabBarButton aImpressViewButton;
aImpressViewButton.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msImpressViewURL,
xAnchor);
aImpressViewButton.ButtonLabel = SdResId(STR_NORMAL_MODE);
if ( ! xBar->hasTabBarButton(aImpressViewButton))
xBar->addTabBarButtonAfter(aImpressViewButton, aEmptyButton);
TabBarButton aOutlineViewButton;
aOutlineViewButton.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msOutlineViewURL,
xAnchor);
aOutlineViewButton.ButtonLabel = SdResId(STR_OUTLINE_MODE);
if ( ! xBar->hasTabBarButton(aOutlineViewButton))
xBar->addTabBarButtonAfter(aOutlineViewButton, aImpressViewButton);
TabBarButton aNotesViewButton;
aNotesViewButton.ResourceId = FrameworkHelper::CreateResourceId(
FrameworkHelper::msNotesViewURL,
xAnchor);
aNotesViewButton.ButtonLabel = SdResId(STR_NOTES_MODE);
if ( ! xBar->hasTabBarButton(aNotesViewButton))
xBar->addTabBarButtonAfter(aNotesViewButton, aOutlineViewButton);
}
} } // end of namespace sd::framework
......
......@@ -730,21 +730,21 @@ void FrameworkHelper::disposing (const lang::EventObject& rEventObject)
void FrameworkHelper::UpdateConfiguration()
{
if (mxConfigurationController.is())
if (!mxConfigurationController.is())
return;
try
{
try
{
if (mxConfigurationController.is())
mxConfigurationController->update();
}
catch (lang::DisposedException&)
{
Dispose();
}
catch (RuntimeException&)
{
DBG_UNHANDLED_EXCEPTION("sd");
}
if (mxConfigurationController.is())
mxConfigurationController->update();
}
catch (lang::DisposedException&)
{
Dispose();
}
catch (RuntimeException&)
{
DBG_UNHANDLED_EXCEPTION("sd");
}
}
......@@ -900,20 +900,20 @@ void SAL_CALL CallbackCaller::disposing (const lang::EventObject& rEvent)
void SAL_CALL CallbackCaller::notifyConfigurationChange (
const ConfigurationChangeEvent& rEvent)
{
if (rEvent.Type == msEventType && maFilter(rEvent))
if (!(rEvent.Type == msEventType && maFilter(rEvent)))
return;
maCallback(true);
if (mxConfigurationController.is())
{
maCallback(true);
if (mxConfigurationController.is())
{
// Reset the reference to the configuration controller so that
// dispose() will not try to remove the listener a second time.
Reference<XConfigurationController> xCC (mxConfigurationController);
mxConfigurationController = nullptr;
// Reset the reference to the configuration controller so that
// dispose() will not try to remove the listener a second time.
Reference<XConfigurationController> xCC (mxConfigurationController);
mxConfigurationController = nullptr;
// Removing this object from the controller may very likely lead
// to its destruction, so no calls after that.
xCC->removeConfigurationChangeListener(this);
}
// Removing this object from the controller may very likely lead
// to its destruction, so no calls after that.
xCC->removeConfigurationChangeListener(this);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment