sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx | 49 - sd/source/ui/framework/configuration/Configuration.cxx | 32 sd/source/ui/framework/configuration/ConfigurationController.cxx | 102 +- sd/source/ui/framework/configuration/ConfigurationUpdater.cxx | 24 sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx | 20 sd/source/ui/framework/factories/BasicPaneFactory.cxx | 126 +-- sd/source/ui/framework/factories/BasicToolBarFactory.cxx | 60 - sd/source/ui/framework/factories/BasicViewFactory.cxx | 136 +-- sd/source/ui/framework/factories/ChildWindowPane.cxx | 42 - sd/source/ui/framework/factories/FullScreenPane.cxx | 26 sd/source/ui/framework/factories/PresentationFactory.cxx | 32 sd/source/ui/framework/module/CenterViewFocusModule.cxx | 44 - sd/source/ui/framework/module/ModuleController.cxx | 64 - sd/source/ui/framework/module/ShellStackGuard.cxx | 22 sd/source/ui/framework/module/SlideSorterModule.cxx | 112 +-- sd/source/ui/framework/module/ToolBarModule.cxx | 104 +- sd/source/ui/framework/module/ViewTabBarModule.cxx | 170 ++-- sd/source/ui/framework/tools/FrameworkHelper.cxx | 52 - sd/source/ui/func/fubullet.cxx | 242 +++--- sd/source/ui/func/fuconarc.cxx | 52 - sd/source/ui/func/fuconbez.cxx | 46 - sd/source/ui/func/fuconrec.cxx | 298 ++++---- sd/source/ui/func/fucopy.cxx | 346 ++++----- sd/source/ui/func/fuexpand.cxx | 274 +++---- sd/source/ui/func/fuformatpaintbrush.cxx | 40 - sd/source/ui/func/fuhhconv.cxx | 104 +- sd/source/ui/func/fuinsert.cxx | 124 +-- sd/source/ui/func/fuinsfil.cxx | 194 ++--- sd/source/ui/func/fulinend.cxx | 140 ++-- sd/source/ui/func/fumorph.cxx | 324 ++++----- sd/source/ui/func/fuoaprms.cxx | 350 +++++----- sd/source/ui/func/fupage.cxx | 24 sd/source/ui/func/fupoor.cxx | 113 +-- sd/source/ui/func/fuprlout.cxx | 146 ++-- sd/source/ui/func/fuprobjs.cxx | 70 +- sd/source/ui/func/fusearch.cxx | 48 - sd/source/ui/func/fusldlg.cxx | 184 ++--- sd/source/ui/func/futext.cxx | 180 ++--- sd/source/ui/func/fuvect.cxx | 51 - sd/source/ui/func/smarttag.cxx | 24 40 files changed, 2296 insertions(+), 2295 deletions(-)
New commits: commit 86e5ec2e5f199185dd8e9a03e72d4a2f81d9eabc Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 14 09:12:06 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Feb 15 09:48:47 2019 +0100 loplugin:flatten in sd/source/ui/framework Change-Id: Id1da25f6ee6ee867e93e0b4c58b6429e07b12429 Reviewed-on: https://gerrit.libreoffice.org/67834 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx index debdc348acf1..6f02779ead31 100644 --- a/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx +++ b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx @@ -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); } } diff --git a/sd/source/ui/framework/configuration/Configuration.cxx b/sd/source/ui/framework/configuration/Configuration.cxx index a28e52b316ad..57d28207ea50 100644 --- a/sd/source/ui/framework/configuration/Configuration.cxx +++ b/sd/source/ui/framework/configuration/Configuration.cxx @@ -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 diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx index bbaa961a16eb..601eb228ee51 100644 --- a/sd/source/ui/framework/configuration/ConfigurationController.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx @@ -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 ( diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index f13c17bb9538..9ed25ff10af5 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -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); } } diff --git a/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx index dcc24c7af6cc..fc9043270343 100644 --- a/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx +++ b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx @@ -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; } } diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index d4a3755e6512..402389db7bf0 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -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 ========================================================== diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx index 80a16b6e01b1..b7f3d307ff39 100644 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx +++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx @@ -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 -------------------------------------------------- diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 7537882625ea..3bc14fdfbea8 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -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; } } diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx index 3ad243701290..fc39e14566f9 100644 --- a/sd/source/ui/framework/factories/ChildWindowPane.cxx +++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx @@ -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() diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx index 58adbd63343c..961e8f328202 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.cxx +++ b/sd/source/ui/framework/factories/FullScreenPane.cxx @@ -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) diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx index ed879e090776..1f962160bedd 100644 --- a/sd/source/ui/framework/factories/PresentationFactory.cxx +++ b/sd/source/ui/framework/factories/PresentationFactory.cxx @@ -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"); } } diff --git a/sd/source/ui/framework/module/CenterViewFocusModule.cxx b/sd/source/ui/framework/module/CenterViewFocusModule.cxx index 4cbe71f7564e..6cca423ecc38 100644 --- a/sd/source/ui/framework/module/CenterViewFocusModule.cxx +++ b/sd/source/ui/framework/module/CenterViewFocusModule.cxx @@ -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); } } } diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index bfb6507b7f01..d827d282fd40 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -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 ------------------------------------------------------- diff --git a/sd/source/ui/framework/module/ShellStackGuard.cxx b/sd/source/ui/framework/module/ShellStackGuard.cxx index 180aa5119f9a..877a66f1a5de 100644 --- a/sd/source/ui/framework/module/ShellStackGuard.cxx +++ b/sd/source/ui/framework/module/ShellStackGuard.cxx @@ -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(); } } diff --git a/sd/source/ui/framework/module/SlideSorterModule.cxx b/sd/source/ui/framework/module/SlideSorterModule.cxx index 5eca32192f00..009dde064d62 100644 --- a/sd/source/ui/framework/module/SlideSorterModule.cxx +++ b/sd/source/ui/framework/module/SlideSorterModule.cxx @@ -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); } } diff --git a/sd/source/ui/framework/module/ToolBarModule.cxx b/sd/source/ui/framework/module/ToolBarModule.cxx index 4d46c254006a..42d4549da228 100644 --- a/sd/source/ui/framework/module/ToolBarModule.cxx +++ b/sd/source/ui/framework/module/ToolBarModule.cxx @@ -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; } } diff --git a/sd/source/ui/framework/module/ViewTabBarModule.cxx b/sd/source/ui/framework/module/ViewTabBarModule.cxx index eccfe626b297..2e026de3cdc1 100644 --- a/sd/source/ui/framework/module/ViewTabBarModule.cxx +++ b/sd/source/ui/framework/module/ViewTabBarModule.cxx @@ -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 diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index fb1c2acf35f0..67818b6a6313 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -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); } } commit abe047f1e8c65e65d63077923fb051b32673fddd Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 14 09:11:53 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Feb 15 09:48:37 2019 +0100 loplugin:flatten in sd/source/ui/func Change-Id: I1d5d3ea51d012ade653aef70a17f2c173d31d3b9 Reviewed-on: https://gerrit.libreoffice.org/67833 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index 81dc443b5a7c..3f9527f92200 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -117,35 +117,35 @@ void FuBullet::InsertFormattingMark( sal_Unicode cMark ) } // insert string - if(pOV && pOL) - { - // prevent flickering - pOV->HideCursor(); - pOL->SetUpdateMode(false); + if(!(pOV && pOL)) + return; - // remove old selected text - pOV->InsertText( "" ); + // prevent flickering + pOV->HideCursor(); + pOL->SetUpdateMode(false); - // prepare undo - SfxUndoManager& rUndoMgr = pOL->GetUndoManager(); - rUndoMgr.EnterListAction(SdResId(STR_UNDO_INSERT_SPECCHAR), - "", 0, mpViewShell->GetViewShellBase().GetViewShellId() ); + // remove old selected text + pOV->InsertText( "" ); - // insert given text - OUString aStr( cMark ); - pOV->InsertText( aStr, true); + // prepare undo + SfxUndoManager& rUndoMgr = pOL->GetUndoManager(); + rUndoMgr.EnterListAction(SdResId(STR_UNDO_INSERT_SPECCHAR), + "", 0, mpViewShell->GetViewShellBase().GetViewShellId() ); - ESelection aSel = pOV->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; - pOV->SetSelection(aSel); + // insert given text + OUString aStr( cMark ); + pOV->InsertText( aStr, true); - rUndoMgr.LeaveListAction(); + ESelection aSel = pOV->GetSelection(); + aSel.nStartPara = aSel.nEndPara; + aSel.nStartPos = aSel.nEndPos; + pOV->SetSelection(aSel); - // restart repainting - pOL->SetUpdateMode(true); - pOV->ShowCursor(); - } + rUndoMgr.LeaveListAction(); + + // restart repainting + pOL->SetUpdateMode(true); + pOV->ShowCursor(); } void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq ) @@ -200,83 +200,83 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq ) return; } - if (!aChars.isEmpty()) - { - OutlinerView* pOV = nullptr; - ::Outliner* pOL = nullptr; + if (aChars.isEmpty()) + return; - // determine depending on ViewShell Outliner and OutlinerView - if(dynamic_cast< const DrawViewShell *>( mpViewShell )) - { - pOV = mpView->GetTextEditOutlinerView(); - if (pOV) - { - pOL = mpView->GetTextEditOutliner(); - } - } - else if(dynamic_cast< const OutlineViewShell *>( mpViewShell )) - { - pOL = &static_cast<OutlineView*>(mpView)->GetOutliner(); - pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow( - mpViewShell->GetActiveWindow()); - } + OutlinerView* pOV = nullptr; + ::Outliner* pOL = nullptr; - // insert special character + // determine depending on ViewShell Outliner and OutlinerView + if(dynamic_cast< const DrawViewShell *>( mpViewShell )) + { + pOV = mpView->GetTextEditOutlinerView(); if (pOV) { - // prevent flicker - pOV->HideCursor(); - pOL->SetUpdateMode(false); - - /* remember old attributes: - To do that, remove selected area before (it has to go anyway). - With that, we get unique attributes (and since there is no - DeleteSelected() in OutlinerView, it is deleted by inserting an - empty string). */ - pOV->InsertText( "" ); - - SfxItemSet aOldSet( mpDoc->GetPool(), svl::Items<EE_CHAR_FONTINFO, EE_CHAR_FONTINFO>{} ); - aOldSet.Put( pOV->GetAttribs() ); - - SfxUndoManager& rUndoMgr = pOL->GetUndoManager(); - ViewShellId nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : ViewShellId(-1); - rUndoMgr.EnterListAction(SdResId(STR_UNDO_INSERT_SPECCHAR), - "", 0, nViewShellId ); - pOV->InsertText(aChars, true); - - // set attributes (set font) - SfxItemSet aSet(pOL->GetEmptyItemSet()); - SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(), - aFont.GetStyleName(), aFont.GetPitch(), - aFont.GetCharSet(), - EE_CHAR_FONTINFO); - aSet.Put(aFontItem); - aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK); - aSet.Put(aFontItem); - aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL); - aSet.Put(aFontItem); - pOV->SetAttribs(aSet); - - ESelection aSel = pOV->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; - pOV->SetSelection(aSel); - - // do not go ahead with setting attributes of special characters - pOV->GetOutliner()->QuickSetAttribs(aOldSet, aSel); - - rUndoMgr.LeaveListAction(); - - // show it again - pOL->SetUpdateMode(true); - pOV->ShowCursor(); + pOL = mpView->GetTextEditOutliner(); } } + else if(dynamic_cast< const OutlineViewShell *>( mpViewShell )) + { + pOL = &static_cast<OutlineView*>(mpView)->GetOutliner(); + pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow( + mpViewShell->GetActiveWindow()); + } + + // insert special character + if (!pOV) + return; + + // prevent flicker + pOV->HideCursor(); + pOL->SetUpdateMode(false); + + /* remember old attributes: + To do that, remove selected area before (it has to go anyway). + With that, we get unique attributes (and since there is no + DeleteSelected() in OutlinerView, it is deleted by inserting an + empty string). */ + pOV->InsertText( "" ); + + SfxItemSet aOldSet( mpDoc->GetPool(), svl::Items<EE_CHAR_FONTINFO, EE_CHAR_FONTINFO>{} ); + aOldSet.Put( pOV->GetAttribs() ); + + SfxUndoManager& rUndoMgr = pOL->GetUndoManager(); + ViewShellId nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : ViewShellId(-1); + rUndoMgr.EnterListAction(SdResId(STR_UNDO_INSERT_SPECCHAR), + "", 0, nViewShellId ); + pOV->InsertText(aChars, true); + + // set attributes (set font) + SfxItemSet aSet(pOL->GetEmptyItemSet()); + SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(), + aFont.GetStyleName(), aFont.GetPitch(), + aFont.GetCharSet(), + EE_CHAR_FONTINFO); + aSet.Put(aFontItem); + aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK); + aSet.Put(aFontItem); + aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL); + aSet.Put(aFontItem); + pOV->SetAttribs(aSet); + + ESelection aSel = pOV->GetSelection(); + aSel.nStartPara = aSel.nEndPara; + aSel.nStartPos = aSel.nEndPos; + pOV->SetSelection(aSel); + + // do not go ahead with setting attributes of special characters + pOV->GetOutliner()->QuickSetAttribs(aOldSet, aSel); + + rUndoMgr.LeaveListAction(); + + // show it again + pOL->SetUpdateMode(true); + pOV->ShowCursor(); } void FuBullet::GetSlotState( SfxItemSet& rSet, ViewShell const * pViewShell, SfxViewFrame* pViewFrame ) { - if( SfxItemState::DEFAULT == rSet.GetItemState( SID_CHARMAP ) || + if( !(SfxItemState::DEFAULT == rSet.GetItemState( SID_CHARMAP ) || SfxItemState::DEFAULT == rSet.GetItemState( SID_CHARMAP_CONTROL ) || SfxItemState::DEFAULT == rSet.GetItemState( FN_INSERT_SOFT_HYPHEN ) || SfxItemState::DEFAULT == rSet.GetItemState( FN_INSERT_HARDHYPHEN ) || @@ -284,44 +284,44 @@ void FuBullet::GetSlotState( SfxItemSet& rSet, ViewShell const * pViewShell, Sfx SfxItemState::DEFAULT == rSet.GetItemState( SID_INSERT_RLM ) || SfxItemState::DEFAULT == rSet.GetItemState( SID_INSERT_LRM ) || SfxItemState::DEFAULT == rSet.GetItemState( SID_INSERT_ZWNBSP ) || - SfxItemState::DEFAULT == rSet.GetItemState( SID_INSERT_ZWSP )) - { - ::sd::View* pView = pViewShell ? pViewShell->GetView() : nullptr; - OutlinerView* pOLV = pView ? pView->GetTextEditOutlinerView() : nullptr; + SfxItemState::DEFAULT == rSet.GetItemState( SID_INSERT_ZWSP ))) + return; - const bool bTextEdit = pOLV; + ::sd::View* pView = pViewShell ? pViewShell->GetView() : nullptr; + OutlinerView* pOLV = pView ? pView->GetTextEditOutlinerView() : nullptr; - SvtCTLOptions aCTLOptions; - const bool bCtlEnabled = aCTLOptions.IsCTLFontEnabled(); + const bool bTextEdit = pOLV; - if(!bTextEdit ) - { - rSet.DisableItem(FN_INSERT_SOFT_HYPHEN); - rSet.DisableItem(FN_INSERT_HARDHYPHEN); - rSet.DisableItem(FN_INSERT_HARD_SPACE); - rSet.DisableItem(SID_INSERT_ZWNBSP); - rSet.DisableItem(SID_INSERT_ZWSP); - } + SvtCTLOptions aCTLOptions; + const bool bCtlEnabled = aCTLOptions.IsCTLFontEnabled(); - if( !bTextEdit && (dynamic_cast<OutlineViewShell const *>( pViewShell ) == nullptr) ) - { - rSet.DisableItem(SID_CHARMAP); - rSet.DisableItem(SID_CHARMAP_CONTROL); - } + if(!bTextEdit ) + { + rSet.DisableItem(FN_INSERT_SOFT_HYPHEN); + rSet.DisableItem(FN_INSERT_HARDHYPHEN); + rSet.DisableItem(FN_INSERT_HARD_SPACE); + rSet.DisableItem(SID_INSERT_ZWNBSP); + rSet.DisableItem(SID_INSERT_ZWSP); + } - if(!bTextEdit || !bCtlEnabled ) - { - rSet.DisableItem(SID_INSERT_RLM); - rSet.DisableItem(SID_INSERT_LRM); - } + if( !bTextEdit && (dynamic_cast<OutlineViewShell const *>( pViewShell ) == nullptr) ) + { + rSet.DisableItem(SID_CHARMAP); + rSet.DisableItem(SID_CHARMAP_CONTROL); + } - if( pViewFrame ) - { - SfxBindings& rBindings = pViewFrame->GetBindings(); + if(!bTextEdit || !bCtlEnabled ) + { + rSet.DisableItem(SID_INSERT_RLM); + rSet.DisableItem(SID_INSERT_LRM); + } - rBindings.SetVisibleState( SID_INSERT_RLM, bCtlEnabled ); - rBindings.SetVisibleState( SID_INSERT_LRM, bCtlEnabled ); - } + if( pViewFrame ) + { + SfxBindings& rBindings = pViewFrame->GetBindings(); + + rBindings.SetVisibleState( SID_INSERT_RLM, bCtlEnabled ); + rBindings.SetVisibleState( SID_INSERT_LRM, bCtlEnabled ); } } } // end of namespace sd diff --git a/sd/source/ui/func/fuconarc.cxx b/sd/source/ui/func/fuconarc.cxx index 4f7cf8c0252f..9ca9d9468733 100644 --- a/sd/source/ui/func/fuconarc.cxx +++ b/sd/source/ui/func/fuconarc.cxx @@ -75,32 +75,32 @@ void FuConstructArc::DoExecute( SfxRequest& rReq ) const SfxItemSet *pArgs = rReq.GetArgs (); - if (pArgs) - { - const SfxUInt32Item* pCenterX = rReq.GetArg<SfxUInt32Item>(ID_VAL_CENTER_X); - const SfxUInt32Item* pCenterY = rReq.GetArg<SfxUInt32Item>(ID_VAL_CENTER_Y); - const SfxUInt32Item* pAxisX = rReq.GetArg<SfxUInt32Item>(ID_VAL_AXIS_X); - const SfxUInt32Item* pAxisY = rReq.GetArg<SfxUInt32Item>(ID_VAL_AXIS_Y); - const SfxUInt32Item* pPhiStart = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLESTART); - const SfxUInt32Item* pPhiEnd = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLEEND); - - ::tools::Rectangle aNewRectangle (pCenterX->GetValue () - pAxisX->GetValue () / 2, - pCenterY->GetValue () - pAxisY->GetValue () / 2, - pCenterX->GetValue () + pAxisX->GetValue () / 2, - pCenterY->GetValue () + pAxisY->GetValue () / 2); - - Activate(); // sets aObjKind - SdrCircObj* pNewCircle = - new SdrCircObj( - mpView->getSdrModelFromSdrView(), - static_cast<SdrObjKind>(mpView->GetCurrentObjIdentifier()), - aNewRectangle, - static_cast<long>(pPhiStart->GetValue () * 10.0), - static_cast<long>(pPhiEnd->GetValue () * 10.0)); - SdrPageView *pPV = mpView->GetSdrPageView(); - - mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER); - } + if (!pArgs) + return; + + const SfxUInt32Item* pCenterX = rReq.GetArg<SfxUInt32Item>(ID_VAL_CENTER_X); + const SfxUInt32Item* pCenterY = rReq.GetArg<SfxUInt32Item>(ID_VAL_CENTER_Y); + const SfxUInt32Item* pAxisX = rReq.GetArg<SfxUInt32Item>(ID_VAL_AXIS_X); + const SfxUInt32Item* pAxisY = rReq.GetArg<SfxUInt32Item>(ID_VAL_AXIS_Y); + const SfxUInt32Item* pPhiStart = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLESTART); + const SfxUInt32Item* pPhiEnd = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLEEND); + + ::tools::Rectangle aNewRectangle (pCenterX->GetValue () - pAxisX->GetValue () / 2, + pCenterY->GetValue () - pAxisY->GetValue () / 2, + pCenterX->GetValue () + pAxisX->GetValue () / 2, + pCenterY->GetValue () + pAxisY->GetValue () / 2); + + Activate(); // sets aObjKind + SdrCircObj* pNewCircle = + new SdrCircObj( + mpView->getSdrModelFromSdrView(), + static_cast<SdrObjKind>(mpView->GetCurrentObjIdentifier()), + aNewRectangle, + static_cast<long>(pPhiStart->GetValue () * 10.0), + static_cast<long>(pPhiEnd->GetValue () * 10.0)); + SdrPageView *pPV = mpView->GetSdrPageView(); + + mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER); } bool FuConstructArc::MouseButtonDown( const MouseEvent& rMEvt ) diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx index 1acc46a41f9c..978e27ddca3d 100644 --- a/sd/source/ui/func/fuconbez.cxx +++ b/sd/source/ui/func/fuconbez.cxx @@ -104,31 +104,31 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq ) const SfxItemSet* pArgs = rReq.GetArgs(); - if( pArgs ) - { - const SfxPoolItem* pPoolItem = nullptr; - if( SfxItemState::SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, true, &pPoolItem ) ) - maTargets = static_cast<const SfxUnoAnyItem*>( pPoolItem )->GetValue(); + if( !pArgs ) + return; - if (nSlotId == SID_DRAW_FREELINE_NOFILL) - { - const SfxUInt16Item* pTransparence = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1); - const SfxStringItem* pColor = rReq.GetArg<SfxStringItem>(FN_PARAM_2); - const SfxUInt16Item* pWidth = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3); + const SfxPoolItem* pPoolItem = nullptr; + if( SfxItemState::SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, true, &pPoolItem ) ) + maTargets = static_cast<const SfxUnoAnyItem*>( pPoolItem )->GetValue(); - if (pTransparence && pTransparence->GetValue() > 0) - { - mnTransparence = pTransparence->GetValue(); - } - if (pColor && !pColor->GetValue().isEmpty()) - { - msColor = pColor->GetValue(); - } - if (pWidth && pWidth->GetValue() > 0) - { - mnWidth = pWidth->GetValue(); - } - } + if (nSlotId != SID_DRAW_FREELINE_NOFILL) + return; + + const SfxUInt16Item* pTransparence = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1); + const SfxStringItem* pColor = rReq.GetArg<SfxStringItem>(FN_PARAM_2); + const SfxUInt16Item* pWidth = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3); + + if (pTransparence && pTransparence->GetValue() > 0) + { + mnTransparence = pTransparence->GetValue(); + } + if (pColor && !pColor->GetValue().isEmpty()) + { + msColor = pColor->GetValue(); + } + if (pWidth && pWidth->GetValue() > 0) + { + mnWidth = pWidth->GetValue(); } } diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index fff0fac7ce5c..bee469d76e09 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -613,7 +613,7 @@ static ::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj) { - if ( (rObj.GetObjIdentifier() == OBJ_EDGE && + if ( !((rObj.GetObjIdentifier() == OBJ_EDGE && nSlotId != SID_TOOL_CONNECTOR && nSlotId != SID_CONNECTOR_LINE && nSlotId != SID_CONNECTOR_LINES && @@ -624,177 +624,177 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj nSlotId == SID_LINE_ARROW_CIRCLE || nSlotId == SID_LINE_CIRCLE_ARROW || nSlotId == SID_LINE_ARROW_SQUARE || - nSlotId == SID_LINE_SQUARE_ARROW ) + nSlotId == SID_LINE_SQUARE_ARROW) ) + return; + + // set attributes of line start and ends + SdrModel& rModel(rObj.getSdrModelFromSdrObject()); + + // arrowhead + ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) ); + if( !aArrow.count() ) + { + ::basegfx::B2DPolygon aNewArrow; + aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0)); + aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0)); + aNewArrow.append(::basegfx::B2DPoint(20.0, 30.0)); + aNewArrow.setClosed(true); + aArrow.append(aNewArrow); + } + + // Circles + ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) ); + if( !aCircle.count() ) { - // set attributes of line start and ends - SdrModel& rModel(rObj.getSdrModelFromSdrObject()); + ::basegfx::B2DPolygon aNewCircle; + aNewCircle = ::basegfx::utils::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0); + aNewCircle.setClosed(true); + aCircle.append(aNewCircle); + } + + // Square + ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) ); + if( !aSquare.count() ) + { + ::basegfx::B2DPolygon aNewSquare; + aNewSquare.append(::basegfx::B2DPoint(0.0, 0.0)); + aNewSquare.append(::basegfx::B2DPoint(10.0, 0.0)); + aNewSquare.append(::basegfx::B2DPoint(10.0, 10.0)); + aNewSquare.append(::basegfx::B2DPoint(0.0, 10.0)); + aNewSquare.setClosed(true); + aSquare.append(aNewSquare); + } + + SfxItemSet aSet( mpDoc->GetPool() ); + mpView->GetAttributes( aSet ); - // arrowhead - ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) ); - if( !aArrow.count() ) + // #i3908# Here, the default Line Start/End width for arrow construction is + // set. To have the same value in all situations (construction) in i3908 + // it was decided to change the default to 0.03 cm for all situations. + long nWidth = 300; // (1/100th mm) + + // determine line width and calculate with it the line end width + if( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) + { + long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue(); + if( nValue > 0 ) + nWidth = nValue * 3; + } + + switch (nSlotId) + { + case SID_CONNECTOR_ARROWS: + case SID_CONNECTOR_LINE_ARROWS: + case SID_CONNECTOR_LINES_ARROWS: + case SID_CONNECTOR_CURVE_ARROWS: + case SID_LINE_ARROWS: { - ::basegfx::B2DPolygon aNewArrow; - aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0)); - aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0)); - aNewArrow.append(::basegfx::B2DPoint(20.0, 30.0)); - aNewArrow.setClosed(true); - aArrow.append(aNewArrow); + // connector with arrow ends + rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); + rAttr.Put(XLineStartWidthItem(nWidth)); + rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); + rAttr.Put(XLineEndWidthItem(nWidth)); } + break; - // Circles - ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) ); - if( !aCircle.count() ) + case SID_CONNECTOR_ARROW_START: + case SID_CONNECTOR_LINE_ARROW_START: + case SID_CONNECTOR_LINES_ARROW_START: + case SID_CONNECTOR_CURVE_ARROW_START: + case SID_LINE_ARROW_START: + case SID_LINE_ARROW_CIRCLE: + case SID_LINE_ARROW_SQUARE: { - ::basegfx::B2DPolygon aNewCircle; - aNewCircle = ::basegfx::utils::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0); - aNewCircle.setClosed(true); - aCircle.append(aNewCircle); + // connector with arrow start + rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); + rAttr.Put(XLineStartWidthItem(nWidth)); } + break; - // Square - ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) ); - if( !aSquare.count() ) + case SID_CONNECTOR_ARROW_END: + case SID_CONNECTOR_LINE_ARROW_END: + case SID_CONNECTOR_LINES_ARROW_END: + case SID_CONNECTOR_CURVE_ARROW_END: + case SID_LINE_ARROW_END: + case SID_LINE_CIRCLE_ARROW: + case SID_LINE_SQUARE_ARROW: { - ::basegfx::B2DPolygon aNewSquare; - aNewSquare.append(::basegfx::B2DPoint(0.0, 0.0)); - aNewSquare.append(::basegfx::B2DPoint(10.0, 0.0)); - aNewSquare.append(::basegfx::B2DPoint(10.0, 10.0)); - aNewSquare.append(::basegfx::B2DPoint(0.0, 10.0)); - aNewSquare.setClosed(true); - aSquare.append(aNewSquare); + // connector with arrow end + rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); + rAttr.Put(XLineEndWidthItem(nWidth)); } + break; - SfxItemSet aSet( mpDoc->GetPool() ); - mpView->GetAttributes( aSet ); - - // #i3908# Here, the default Line Start/End width for arrow construction is - // set. To have the same value in all situations (construction) in i3908 - // it was decided to change the default to 0.03 cm for all situations. - long nWidth = 300; // (1/100th mm) - - // determine line width and calculate with it the line end width - if( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) + case SID_CONNECTOR_CIRCLES: + case SID_CONNECTOR_LINE_CIRCLES: + case SID_CONNECTOR_LINES_CIRCLES: + case SID_CONNECTOR_CURVE_CIRCLES: { - long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue(); - if( nValue > 0 ) - nWidth = nValue * 3; + // connector with circle ends + rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); + rAttr.Put(XLineStartWidthItem(nWidth)); + rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); + rAttr.Put(XLineEndWidthItem(nWidth)); } + break; - switch (nSlotId) + case SID_CONNECTOR_CIRCLE_START: + case SID_CONNECTOR_LINE_CIRCLE_START: + case SID_CONNECTOR_LINES_CIRCLE_START: + case SID_CONNECTOR_CURVE_CIRCLE_START: { - case SID_CONNECTOR_ARROWS: - case SID_CONNECTOR_LINE_ARROWS: - case SID_CONNECTOR_LINES_ARROWS: - case SID_CONNECTOR_CURVE_ARROWS: - case SID_LINE_ARROWS: - { - // connector with arrow ends - rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); - rAttr.Put(XLineStartWidthItem(nWidth)); - rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); - rAttr.Put(XLineEndWidthItem(nWidth)); - } - break; - - case SID_CONNECTOR_ARROW_START: - case SID_CONNECTOR_LINE_ARROW_START: - case SID_CONNECTOR_LINES_ARROW_START: - case SID_CONNECTOR_CURVE_ARROW_START: - case SID_LINE_ARROW_START: - case SID_LINE_ARROW_CIRCLE: - case SID_LINE_ARROW_SQUARE: - { - // connector with arrow start - rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); - rAttr.Put(XLineStartWidthItem(nWidth)); - } - break; - - case SID_CONNECTOR_ARROW_END: - case SID_CONNECTOR_LINE_ARROW_END: - case SID_CONNECTOR_LINES_ARROW_END: - case SID_CONNECTOR_CURVE_ARROW_END: - case SID_LINE_ARROW_END: - case SID_LINE_CIRCLE_ARROW: - case SID_LINE_SQUARE_ARROW: - { - // connector with arrow end - rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); - rAttr.Put(XLineEndWidthItem(nWidth)); - } - break; - - case SID_CONNECTOR_CIRCLES: - case SID_CONNECTOR_LINE_CIRCLES: - case SID_CONNECTOR_LINES_CIRCLES: - case SID_CONNECTOR_CURVE_CIRCLES: - { - // connector with circle ends - rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); - rAttr.Put(XLineStartWidthItem(nWidth)); - rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); - rAttr.Put(XLineEndWidthItem(nWidth)); - } - break; - - case SID_CONNECTOR_CIRCLE_START: - case SID_CONNECTOR_LINE_CIRCLE_START: - case SID_CONNECTOR_LINES_CIRCLE_START: - case SID_CONNECTOR_CURVE_CIRCLE_START: - { - // connector with circle start - rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); - rAttr.Put(XLineStartWidthItem(nWidth)); - } - break; + // connector with circle start + rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); + rAttr.Put(XLineStartWidthItem(nWidth)); + } + break; - case SID_CONNECTOR_CIRCLE_END: - case SID_CONNECTOR_LINE_CIRCLE_END: - case SID_CONNECTOR_LINES_CIRCLE_END: - case SID_CONNECTOR_CURVE_CIRCLE_END: - { - // connector with circle ends - rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); - rAttr.Put(XLineEndWidthItem(nWidth)); - } - break; + case SID_CONNECTOR_CIRCLE_END: + case SID_CONNECTOR_LINE_CIRCLE_END: + case SID_CONNECTOR_LINES_CIRCLE_END: + case SID_CONNECTOR_CURVE_CIRCLE_END: + { + // connector with circle ends + rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); + rAttr.Put(XLineEndWidthItem(nWidth)); } + break; + } - // and again, for the still missing ends - switch (nSlotId) + // and again, for the still missing ends + switch (nSlotId) + { + case SID_LINE_ARROW_CIRCLE: { - case SID_LINE_ARROW_CIRCLE: - { - // circle end - rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); - rAttr.Put(XLineEndWidthItem(nWidth)); - } - break; + // circle end + rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); + rAttr.Put(XLineEndWidthItem(nWidth)); + } + break; - case SID_LINE_CIRCLE_ARROW: - { - // circle start - rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); - rAttr.Put(XLineStartWidthItem(nWidth)); - } - break; + case SID_LINE_CIRCLE_ARROW: + { + // circle start + rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle)); + rAttr.Put(XLineStartWidthItem(nWidth)); + } + break; - case SID_LINE_ARROW_SQUARE: - { - // square end - rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_SQUARE), aSquare)); - rAttr.Put(XLineEndWidthItem(nWidth)); - } - break; + case SID_LINE_ARROW_SQUARE: + { + // square end + rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_SQUARE), aSquare)); + rAttr.Put(XLineEndWidthItem(nWidth)); + } + break; - case SID_LINE_SQUARE_ARROW: - { - // square start - rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_SQUARE), aSquare)); - rAttr.Put(XLineStartWidthItem(nWidth)); - } - break; + case SID_LINE_SQUARE_ARROW: + { + // square start + rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_SQUARE), aSquare)); + rAttr.Put(XLineStartWidthItem(nWidth)); } + break; } } diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx index f81d5ae4a0c2..18e7dbb5e1bf 100644 --- a/sd/source/ui/func/fucopy.cxx +++ b/sd/source/ui/func/fucopy.cxx @@ -64,226 +64,226 @@ rtl::Reference<FuPoor> FuCopy::Create( ViewShell* pViewSh, ::sd::Window* pWin, : void FuCopy::DoExecute( SfxRequest& rReq ) { - if( mpView->AreObjectsMarked() ) + if( !mpView->AreObjectsMarked() ) + return; + + // Undo + OUString aString( mpView->GetDescriptionOfMarkedObjects() ); + aString += " " + SdResId( STR_UNDO_COPYOBJECTS ); + mpView->BegUndo( aString ); + + const SfxItemSet* pArgs = rReq.GetArgs(); + + if( !pArgs ) { - // Undo - OUString aString( mpView->GetDescriptionOfMarkedObjects() ); - aString += " " + SdResId( STR_UNDO_COPYOBJECTS ); - mpView->BegUndo( aString ); + SfxItemSet aSet( mpViewShell->GetPool(), + svl::Items<ATTR_COPY_START, ATTR_COPY_END>{} ); - const SfxItemSet* pArgs = rReq.GetArgs(); + // indicate color attribute + SfxItemSet aAttr( mpDoc->GetPool() ); + mpView->GetAttributes( aAttr ); + const SfxPoolItem* pPoolItem = nullptr; - if( !pArgs ) + if( SfxItemState::SET == aAttr.GetItemState( XATTR_FILLSTYLE, true, &pPoolItem ) ) { - SfxItemSet aSet( mpViewShell->GetPool(), - svl::Items<ATTR_COPY_START, ATTR_COPY_END>{} ); + drawing::FillStyle eStyle = static_cast<const XFillStyleItem*>(pPoolItem)->GetValue(); - // indicate color attribute - SfxItemSet aAttr( mpDoc->GetPool() ); - mpView->GetAttributes( aAttr ); - const SfxPoolItem* pPoolItem = nullptr; - - if( SfxItemState::SET == aAttr.GetItemState( XATTR_FILLSTYLE, true, &pPoolItem ) ) + if( eStyle == drawing::FillStyle_SOLID && + SfxItemState::SET == aAttr.GetItemState( XATTR_FILLCOLOR, true, &pPoolItem ) ) { - drawing::FillStyle eStyle = static_cast<const XFillStyleItem*>(pPoolItem)->GetValue(); - - if( eStyle == drawing::FillStyle_SOLID && - SfxItemState::SET == aAttr.GetItemState( XATTR_FILLCOLOR, true, &pPoolItem ) ) - { - const XFillColorItem* pItem = static_cast<const XFillColorItem*>(pPoolItem); - XColorItem aXColorItem( ATTR_COPY_START_COLOR, pItem->GetName(), - pItem->GetColorValue() ); - aSet.Put( aXColorItem ); + const XFillColorItem* pItem = static_cast<const XFillColorItem*>(pPoolItem); + XColorItem aXColorItem( ATTR_COPY_START_COLOR, pItem->GetName(), + pItem->GetColorValue() ); + aSet.Put( aXColorItem ); - } } + } - SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetFrameWeld(), aSet, mpView )); + SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); + ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetFrameWeld(), aSet, mpView )); - sal_uInt16 nResult = pDlg->Execute(); + sal_uInt16 nResult = pDlg->Execute(); - switch( nResult ) - { - case RET_OK: - pDlg->GetAttr( aSet ); - rReq.Done( aSet ); - pArgs = rReq.GetArgs(); - break; + switch( nResult ) + { + case RET_OK: + pDlg->GetAttr( aSet ); + rReq.Done( aSet ); + pArgs = rReq.GetArgs(); + break; - default: - { - pDlg.disposeAndClear(); - mpView->EndUndo(); - return; // Cancel - } + default: + { + pDlg.disposeAndClear(); + mpView->EndUndo(); + return; // Cancel } } + } - ::tools::Rectangle aRect; - sal_Int32 lWidth = 0, lHeight = 0, lSizeX = 0, lSizeY = 0, lAngle = 0; - sal_uInt16 nNumber = 0; - Color aStartColor, aEndColor; - bool bColor = false; - const SfxPoolItem* pPoolItem = nullptr; - - // Count - if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_NUMBER, true, &pPoolItem ) ) - nNumber = static_cast<const SfxUInt16Item*>( pPoolItem )->GetValue(); - - // translation - if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) ) - lSizeX = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) ) - lSizeY = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) ) - lAngle = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - - // scale - if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) ) - lWidth = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits