summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-11-24 13:11:18 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2021-11-25 13:22:20 +0100
commitceddcf25c2ffbec97b2ae99d7628eed20c796717 (patch)
tree5750f5e07d89d12a53de43c663cb8487a909b416
parentBump version to 21.06.8.1 (diff)
downloadcore-ceddcf25c2ffbec97b2ae99d7628eed20c796717.tar.gz
core-ceddcf25c2ffbec97b2ae99d7628eed20c796717.zip
jsdialog: sidebar: enable animation panel effects
- enable subcontrol .ui for jsdialogs in annimation panel - optimize to not recreate widget on every sidebar refresh - don't sent close message for whole sidebar when called from subcontrol This fixes widgets in annimation panel like: Direction listbox, or other replacements for selecting color, font etc. for font effect Change-Id: I5683ca9cefe384ed0d2a34d46936ddf4a9b45bce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125757 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx4
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx14
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx9
-rw-r--r--vcl/jsdialog/enabled.cxx3
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx6
5 files changed, 31 insertions, 5 deletions
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index b3b7b8591453..face9e1b9a71 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -45,6 +45,7 @@
#include <svtools/ctrlbox.hxx>
#include <svtools/ctrltool.hxx>
#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <tools/diagnose_ex.h>
@@ -85,7 +86,8 @@ using ::com::sun::star::beans::XPropertySet;
namespace sd {
SdPropertySubControl::SdPropertySubControl(weld::Container* pParent)
- : mxBuilder(Application::CreateBuilder(pParent, "modules/simpress/ui/customanimationfragment.ui"))
+ : mxBuilder(Application::CreateBuilder(pParent, "modules/simpress/ui/customanimationfragment.ui",
+ false, reinterpret_cast<sal_uInt64>(SfxViewShell::Current())))
, mxContainer(mxBuilder->weld_container("EffectFragment"))
, mpParent(pParent)
{
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index e1a705846478..67fe4590916f 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -551,6 +551,9 @@ void CustomAnimationPane::updateControls()
if (!mxLBSubControl || nOldPropertyType != nNewPropertyType)
{
+ // for LOK destroy old widgets first
+ mxLBSubControl.reset(nullptr);
+ // then create new control, to keep correct pointers for actions
mxLBSubControl = SdPropertySubControl::create(nNewPropertyType, mxFTProperty.get(), mxPlaceholderBox.get(), GetFrameWeld(), aValue, pEffect->getPresetId(), LINK(this, CustomAnimationPane, implPropertyHdl));
}
else
@@ -661,7 +664,16 @@ void CustomAnimationPane::updateControls()
else
{
// use an empty direction box to fill the space
- mxLBSubControl = SdPropertySubControl::create(nPropertyTypeDirection, mxFTProperty.get(), mxPlaceholderBox.get(), GetFrameWeld(), uno::Any(), OUString(), LINK(this, CustomAnimationPane, implPropertyHdl));
+ if (!mxLBSubControl || (nOldPropertyType != nPropertyTypeDirection && nOldPropertyType != nPropertyTypeNone))
+ {
+ // for LOK destroy old widgets first
+ mxLBSubControl.reset(nullptr);
+ // then create new control, to keep correct pointers for actions
+ mxLBSubControl = SdPropertySubControl::create(nPropertyTypeDirection, mxFTProperty.get(), mxPlaceholderBox.get(), GetFrameWeld(), uno::Any(), OUString(), LINK(this, CustomAnimationPane, implPropertyHdl));
+ }
+ else
+ mxLBSubControl->setValue(uno::Any(), OUString());
+
mxPlaceholderBox->set_sensitive(false);
mxFTProperty->set_sensitive(false);
mxFTStartDelay->set_sensitive(false);
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index b7cec478dc37..e9102f7e9d8c 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -136,10 +136,17 @@ class JSDialogSender
{
std::unique_ptr<JSDialogNotifyIdle> mpIdleNotify;
+protected:
+ bool m_bCanClose; // specifies if can send a close message
+
public:
- JSDialogSender() = default;
+ JSDialogSender()
+ : m_bCanClose(true)
+ {
+ }
JSDialogSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
std::string sTypeOfJSON)
+ : m_bCanClose(true)
{
initializeSender(aNotifierWindow, aContentWindow, sTypeOfJSON);
}
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index e06e59a6c68b..8c02b074992e 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -119,7 +119,8 @@ bool isBuilderEnabledForSidebar(const OUString& rUIFile)
|| rUIFile == "svx/ui/inspectortextpanel.ui"
|| rUIFile == "modules/swriter/ui/sidebarstylepresets.ui"
|| rUIFile == "modules/swriter/ui/sidebartheme.ui"
- || rUIFile == "modules/swriter/ui/sidebartableedit.ui")
+ || rUIFile == "modules/swriter/ui/sidebartableedit.ui"
+ || rUIFile == "modules/simpress/ui/customanimationfragment.ui")
return true;
return false;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index e63f6e861a6f..981ff5fb746a 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -331,7 +331,7 @@ void JSDialogSender::sendFullUpdate(bool bForce)
void JSDialogSender::sendClose()
{
- if (!mpIdleNotify)
+ if (!mpIdleNotify || !m_bCanClose)
return;
mpIdleNotify->clearQueue();
@@ -549,6 +549,10 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR
}
else
{
+ // embedded fragments cannot send close message for whole sidebar
+ if (rUIFile == "modules/simpress/ui/customanimationfragment.ui")
+ m_bCanClose = false;
+
// builder for PanelLayout, get SidebarDockingWindow as m_aContentWindow
m_aContentWindow = pRoot;
for (int i = 0; i < 9 && m_aContentWindow; i++)