[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 12 commits - desktop/source include/svx include/vcl sc/source sd/source sfx2/source svx/source svx/uiconfig sw/source vcl/inc vcl/jsdialog vcl/source vcl/unx
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Sat Apr 10 20:37:01 UTC 2021
desktop/source/lib/init.cxx | 18 ++
include/svx/svdedtv.hxx | 6
include/vcl/weld.hxx | 3
sc/source/ui/app/inputwin.cxx | 13 +
sc/source/ui/inc/inputwin.hxx | 2
sd/source/ui/func/futransf.cxx | 13 +
sfx2/source/sidebar/SidebarPanelBase.cxx | 1
svx/source/inc/StylesPreviewWindow.hxx | 47 +++--
svx/source/svdraw/svdedtv1.cxx | 8 -
svx/source/tbxctrls/StylesPreviewWindow.cxx | 221 +++++++++++-----------------
svx/uiconfig/ui/stylespreview.ui | 157 +++----------------
sw/source/uibase/app/docst.cxx | 4
vcl/inc/jsdialog/jsdialogbuilder.hxx | 10 +
vcl/inc/salvtables.hxx | 1
vcl/jsdialog/executor.cxx | 5
vcl/jsdialog/jsdialogbuilder.cxx | 53 ++++++
vcl/source/app/salvtables.cxx | 6
vcl/unx/gtk3/gtk3gtkinst.cxx | 13 +
18 files changed, 292 insertions(+), 289 deletions(-)
New commits:
commit 2c449dd68a451e6e38451e7b75c5ca80c9b765bf
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Mar 29 12:11:27 2021 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 22:22:32 2021 +0200
online: update calc inputbar position on change
Change-Id: I9b340cb0f5d5d28b0cc683878ba8fad2c4d8a5af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113307
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113807
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 21cf4519cd83..60a759a1b1d7 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -474,6 +474,19 @@ void ScInputWindow::SetSizePixel( const Size& rNewSize )
ToolBox::SetSizePixel(rNewSize);
}
+void ScInputWindow::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags)
+{
+ ToolBox::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags);
+ if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+ {
+ std::vector<vcl::LOKPayloadItem> aItems;
+ aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
+ aItems.emplace_back("size", GetSizePixel().toString());
+ aItems.emplace_back("lines", OString::number(mxTextWindow->GetNumLines()));
+ pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
+ }
+}
+
void ScInputWindow::Resize()
{
ToolBox::Resize();
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index ab806987b78c..faeda5e77c92 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -293,6 +293,8 @@ public:
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
virtual void PixelInvalidate(const tools::Rectangle* pRectangle) override;
+ virtual void setPosSizePixel( long nX, long nY, long nWidth, long nHeight,
+ PosSizeFlags nFlags = PosSizeFlags::All ) override;
virtual void SetSizePixel( const Size& rNewSize ) override;
virtual void Resize() override;
virtual void Select() override;
commit 24af0aba5526e4ead7f9c6f655966bc59fc924d4
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Mar 15 16:23:48 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 22:21:10 2021 +0200
jsdialog: simplify unselect for treeview
Change-Id: Iaadd8122d735103d89e4acb65bef1ca8c1ad2e1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112532
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113679
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 503f8ac49d78..5578efbf20a8 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -242,9 +242,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
OString nRowString
= OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
- std::unique_ptr<weld::TreeIter> itSelected(pTreeView->make_iterator());
- pTreeView->get_selected(itSelected.get());
- pTreeView->unselect(*itSelected);
+ pTreeView->unselect_all();
int nAbsPos = std::atoi(nRowString.getStr());
@@ -261,7 +259,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
= OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
int nRow = std::atoi(nRowString.getStr());
- pTreeView->unselect(pTreeView->get_selected_index());
+ pTreeView->unselect_all();
pTreeView->select(nRow);
pTreeView->set_cursor(nRow);
LOKTrigger::trigger_changed(*pTreeView);
commit 38f9702ebe2df4d9c124cbb8951afe47fe923273
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Mar 12 09:35:30 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 22:20:58 2021 +0200
jsdialog: unselect treeview entry by iterator
avoid crash when using relative position from
deeper levels returned by get_selected_index
to unselect entry using unselect function
on root level
Change-Id: Iaaddb131031eb5273cb06412c976f310f7323f52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112374
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113678
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 7504db8900fe..503f8ac49d78 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -241,7 +241,10 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
{
OString nRowString
= OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
- pTreeView->unselect(pTreeView->get_selected_index());
+
+ std::unique_ptr<weld::TreeIter> itSelected(pTreeView->make_iterator());
+ pTreeView->get_selected(itSelected.get());
+ pTreeView->unselect(*itSelected);
int nAbsPos = std::atoi(nRowString.getStr());
commit 2426342438730e56d9e8a5fcb47dbc4f3f35ef13
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Tue Mar 2 19:09:21 2021 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 22:20:29 2021 +0200
jsdialog: JSMessageDialog tweaks when builder is nullptr
"CreateMessageDialog" creates the message dialog without
builder, so some buttons need a click handler to close the
message dialog.
Change-Id: I73ac99020abfb23a1b1313468b6b0f5a8a17f039
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111852
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113692
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index c3fc77ae3d3c..ceeb5c1298b6 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -249,6 +249,9 @@ public:
VclButtonsType eButtonType,
const OUString& rPrimaryMessage);
+ static void AddChildWidget(sal_uInt64 nWindowId, const OString& id, weld::Widget* pWidget);
+ static void RemoveWindowWidget(sal_uInt64 nWindowId);
+
private:
const std::string& GetTypeOfJSON();
VclPtr<vcl::Window>& GetContentWindow();
@@ -449,11 +452,17 @@ public:
class JSMessageDialog : public JSWidget<SalInstanceMessageDialog, ::MessageDialog>
{
std::unique_ptr<JSDialogSender> m_pOwnedSender;
+ std::unique_ptr<JSButton> m_pOK;
+ std::unique_ptr<JSButton> m_pCancel;
+
+ DECL_LINK(OKHdl, weld::Button&, void);
+ DECL_LINK(CancelHdl, weld::Button&, void);
public:
JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
bool bTakeOwnership);
JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+ virtual ~JSMessageDialog();
virtual void set_primary_text(const OUString& rText) override;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index e039566805d3..43bd5ffaed5c 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -533,6 +533,26 @@ void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget)
}
}
+void JSInstanceBuilder::AddChildWidget(sal_uInt64 nWindowId, const OString& id,
+ weld::Widget* pWidget)
+{
+ auto it = GetLOKWeldWidgetsMap().find(nWindowId);
+ if (it != GetLOKWeldWidgetsMap().end())
+ {
+ it->second.erase(id);
+ it->second.insert(WidgetMap::value_type(id, pWidget));
+ }
+}
+
+void JSInstanceBuilder::RemoveWindowWidget(sal_uInt64 nWindowId)
+{
+ auto it = JSInstanceBuilder::GetLOKWeldWidgetsMap().find(nWindowId);
+ if (it != JSInstanceBuilder::GetLOKWeldWidgetsMap().end())
+ {
+ JSInstanceBuilder::GetLOKWeldWidgetsMap().erase(it);
+ }
+}
+
const std::string& JSInstanceBuilder::GetTypeOfJSON() { return m_sTypeOfJSON; }
VclPtr<vcl::Window>& JSInstanceBuilder::GetContentWindow()
@@ -803,6 +823,8 @@ weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParen
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.get());
}
+ xMessageDialog->SetLOKTunnelingState(false);
+ InsertWindowToMap(xMessageDialog->GetLOKWindowId());
return new JSMessageDialog(xMessageDialog, nullptr, true);
}
@@ -992,8 +1014,39 @@ JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* p
, m_pOwnedSender(new JSDialogSender(pDialog, pDialog, "dialog"))
{
m_pSender = m_pOwnedSender.get();
+
+ if (!pBuilder)
+ {
+ if (::OKButton* pOKBtn
+ = dynamic_cast<::OKButton*>(m_xMessageDialog->get_widget_for_response(RET_OK)))
+ {
+ m_pOK.reset(new JSButton(m_pSender, pOKBtn, nullptr, false));
+ JSInstanceBuilder::AddChildWidget(m_xMessageDialog->GetLOKWindowId(),
+ pOKBtn->get_id().toUtf8(), m_pOK.get());
+ m_pOK->connect_clicked(LINK(this, JSMessageDialog, OKHdl));
+ }
+
+ if (::CancelButton* pCancelBtn
+ = dynamic_cast<::CancelButton*>(m_xMessageDialog->get_widget_for_response(RET_CANCEL)))
+ {
+ m_pCancel.reset(new JSButton(m_pSender, pCancelBtn, nullptr, false));
+ JSInstanceBuilder::AddChildWidget(m_xMessageDialog->GetLOKWindowId(),
+ pCancelBtn->get_id().toUtf8(), m_pCancel.get());
+ m_pCancel->connect_clicked(LINK(this, JSMessageDialog, CancelHdl));
+ }
+ }
+}
+
+JSMessageDialog::~JSMessageDialog()
+{
+ if (m_pOK || m_pCancel)
+ JSInstanceBuilder::RemoveWindowWidget(m_xMessageDialog->GetLOKWindowId());
}
+IMPL_LINK_NOARG(JSMessageDialog, OKHdl, weld::Button&, void) { response(RET_OK); }
+
+IMPL_LINK_NOARG(JSMessageDialog, CancelHdl, weld::Button&, void) { response(RET_CANCEL); }
+
void JSMessageDialog::set_primary_text(const OUString& rText)
{
SalInstanceMessageDialog::set_primary_text(rText);
commit 444f7484e7968063ea66b251eb023539fbb8b796
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Mar 5 19:53:51 2021 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 22:20:17 2021 +0200
lok: add "MacroSecurityLevel" option
Change-Id: I1cf4e6d4495c552b94c6fe80333291fc4ab20936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112043
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113691
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9d11c2619690..15250bc35085 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -136,6 +136,8 @@
#include <vcl/ITiledRenderable.hxx>
#include <vcl/dialoghelper.hxx>
#include <unicode/uchar.h>
+#include <unotools/securityoptions.hxx>
+#include <unotools/configmgr.hxx>
#include <unotools/confignode.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <unotools/mediadescriptor.hxx>
@@ -2265,6 +2267,18 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
aFilterOptions[1].Name = "InteractionHandler";
aFilterOptions[1].Value <<= xInteraction;
+ int nMacroSecurityLevel = 1;
+ const OUString aMacroSecurityLevel = extractParameter(aOptions, u"MacroSecurityLevel");
+ if (!aMacroSecurityLevel.isEmpty())
+ {
+ double nNumber;
+ sal_uInt32 nFormat = 1;
+ SvNumberFormatter aFormatter(::comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US);
+ if (aFormatter.IsNumberFormat(aMacroSecurityLevel, nFormat, nNumber))
+ nMacroSecurityLevel = static_cast<int>(nNumber);
+ }
+ SvtSecurityOptions().SetMacroSecurityLevel(nMacroSecurityLevel);
+
const OUString aEnableMacrosExecution = extractParameter(aOptions, u"EnableMacrosExecution");
sal_Int16 nMacroExecMode = aEnableMacrosExecution == "true" ? document::MacroExecMode::USE_CONFIG :
document::MacroExecMode::NEVER_EXECUTE;
commit 14c16b9f8672451bbe37700371316b47d319d306
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Mar 5 16:28:57 2021 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 22:20:05 2021 +0200
lok: add "EnableMacrosExecution" option
Change-Id: I2ad31e2e7f66fdfca1eee07622a4a9fec8b62861
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112030
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113690
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 058ff56be341..9d11c2619690 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2265,7 +2265,9 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
aFilterOptions[1].Name = "InteractionHandler";
aFilterOptions[1].Value <<= xInteraction;
- sal_Int16 nMacroExecMode = document::MacroExecMode::NEVER_EXECUTE;
+ const OUString aEnableMacrosExecution = extractParameter(aOptions, u"EnableMacrosExecution");
+ sal_Int16 nMacroExecMode = aEnableMacrosExecution == "true" ? document::MacroExecMode::USE_CONFIG :
+ document::MacroExecMode::NEVER_EXECUTE;
aFilterOptions[2].Name = "MacroExecutionMode";
aFilterOptions[2].Value <<= nMacroExecMode;
commit 0d2f9c4c7b1b277907df521340a905f150170802
Author: mert <mert.tumer at collabora.com>
AuthorDate: Thu Mar 4 12:17:27 2021 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 22:19:48 2021 +0200
Fix wrong position on move when page has margin
Change-Id: I9ac2d9914b86210ca2148b44488c2c70cc5870d4
Signed-off-by: mert <mert.tumer at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111949
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111929
Tested-by: Jenkins
diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
index b215108c24c8..001223425a44 100644
--- a/include/svx/svdedtv.hxx
+++ b/include/svx/svdedtv.hxx
@@ -304,7 +304,11 @@ public:
// geometrical attribute (position, size, rotation angle)
// A PageOrigin set at a position is taken into account.
SfxItemSet GetGeoAttrFromMarked() const;
- void SetGeoAttrToMarked(const SfxItemSet& rAttr);
+ // In LOK, interactive shape movement uses this function
+ // in that case, margin is not taken into account
+ // and the final position of the shape becomes incorrect
+ // However, "Position and Size" dialog and other cases already add the margins.
+ void SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin = false);
// Returns NULL if:
// - nothing is marked,
diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
index fa7398e48b43..6c07e0e70be6 100644
--- a/sd/source/ui/func/futransf.cxx
+++ b/sd/source/ui/func/futransf.cxx
@@ -28,6 +28,7 @@
#include <sdresid.hxx>
#include <drawdoc.hxx>
#include <svx/svxdlg.hxx>
+#include <comphelper/lok.hxx>
#include <memory>
@@ -48,14 +49,13 @@ rtl::Reference<FuPoor> FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pW
namespace {
-void setUndo(::sd::View* pView, const SfxItemSet* pArgs)
+void setUndo(::sd::View* pView, const SfxItemSet* pArgs, bool addPageMargin)
{
// Undo
OUString aString = pView->GetDescriptionOfMarkedObjects() +
" " + SdResId(STR_TRANSFORM);
pView->BegUndo(aString);
-
- pView->SetGeoAttrToMarked(*pArgs);
+ pView->SetGeoAttrToMarked(*pArgs, addPageMargin);
pView->SetAttributes(*pArgs);
pView->EndUndo();
}
@@ -71,7 +71,9 @@ void FuTransform::DoExecute( SfxRequest& rReq )
if (pArgs)
{
- setUndo(mpView, pArgs);
+ // If this comes from LOK, that means the shape is moved by mouse
+ // only then pArgs is pre-set.
+ setUndo(mpView, pArgs, comphelper::LibreOfficeKit::isActive());
return;
}
@@ -115,7 +117,8 @@ void FuTransform::DoExecute( SfxRequest& rReq )
if (nResult == RET_OK)
{
pRequest->Done(*(pDlg->GetOutputItemSet()));
- setUndo(mpView, pRequest->GetArgs());
+ // Page margin is already calculated at this point.
+ setUndo(mpView, pRequest->GetArgs(), false);
}
// deferred until the dialog ends
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 0beba3a215aa..81a70902cab4 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -1512,7 +1512,7 @@ static Point ImpGetPoint(const tools::Rectangle& rRect, RectPoint eRP)
return Point(); // Should not happen!
}
-void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
+void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin)
{
const bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
@@ -1520,6 +1520,12 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
if(GetSdrPageView())
{
+ if (addPageMargin)
+ {
+ SdrPage * pPage = GetSdrPageView()->GetPage();
+ Point upperLeft(pPage->GetLeftBorder(), pPage->GetUpperBorder());
+ aRect.Move(upperLeft.getX(), upperLeft.getY());
+ }
GetSdrPageView()->LogicToPagePos(aRect);
}
commit 364ae0dda5d2ac67e679b43ac2700a59b4534839
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Mon Mar 1 10:25:09 2021 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 22:16:05 2021 +0200
lok: disable macro execution
Change-Id: I97a1fd7992d6be57e54c186045e62c3402b99375
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111752
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113685
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0d1b7999dae1..058ff56be341 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2265,7 +2265,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
aFilterOptions[1].Name = "InteractionHandler";
aFilterOptions[1].Value <<= xInteraction;
- sal_Int16 nMacroExecMode = document::MacroExecMode::USE_CONFIG;
+ sal_Int16 nMacroExecMode = document::MacroExecMode::NEVER_EXECUTE;
aFilterOptions[2].Name = "MacroExecutionMode";
aFilterOptions[2].Value <<= nMacroExecMode;
commit 8d5d3f4fa978288de212b4822833843d3e201f78
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Mar 2 12:18:21 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:59:38 2021 +0200
Styles preview: use listener to trigger update
Do not render all styles on every selection change.
Use listener to detect styles modification.
Change-Id: I6d41acd7acad160d1477281d2b3d473233def4d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111833
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112013
Tested-by: Jenkins
diff --git a/svx/source/inc/StylesPreviewWindow.hxx b/svx/source/inc/StylesPreviewWindow.hxx
index 416c8a15a63f..4c7fdd43dfa5 100644
--- a/svx/source/inc/StylesPreviewWindow.hxx
+++ b/svx/source/inc/StylesPreviewWindow.hxx
@@ -28,6 +28,7 @@
class StylesPreviewWindow_Base;
+/// Listener for style selection
class StyleStatusListener : public SfxStatusListener
{
StylesPreviewWindow_Base* m_pPreviewControl;
@@ -40,6 +41,19 @@ public:
void StateChanged(SfxItemState eState, const SfxPoolItem* pState) override;
};
+/// Listener for styles creation or modification
+class StylePoolChangeListener : public SfxListener
+{
+ StylesPreviewWindow_Base* m_pPreviewControl;
+ SfxStyleSheetBasePool* m_pStyleSheetPool;
+
+public:
+ StylePoolChangeListener(StylesPreviewWindow_Base* pPreviewControl);
+ ~StylePoolChangeListener();
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+};
+
class StyleItemController
{
static constexpr unsigned LEFT_MARGIN = 8;
@@ -76,6 +90,7 @@ protected:
StyleStatusListener* m_pStatusListener;
css::uno::Reference<css::lang::XComponent> m_xStatusListener;
+ std::unique_ptr<StylePoolChangeListener> m_pStylePoolChangeListener;
std::vector<std::pair<OUString, OUString>> m_aDefaultStyles;
std::vector<std::pair<OUString, OUString>> m_aAllStyles;
@@ -93,10 +108,10 @@ public:
~StylesPreviewWindow_Base();
void Select(const OUString& rStyleName);
+ void UpdateStylesList();
private:
void Update();
- void UpdateStylesList();
bool Command(const CommandEvent& rEvent);
};
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index 6dfcb6c7d139..312d849800c1 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -74,6 +74,32 @@ void StyleStatusListener::StateChanged(SfxItemState /*eState*/, const SfxPoolIte
m_pPreviewControl->Select(pStateItem->GetStyleName());
}
+StylePoolChangeListener::StylePoolChangeListener(StylesPreviewWindow_Base* pPreviewControl)
+ : SfxListener()
+ , m_pPreviewControl(pPreviewControl)
+{
+ SfxObjectShell* pDocShell = SfxObjectShell::Current();
+
+ if (pDocShell)
+ m_pStyleSheetPool = pDocShell->GetStyleSheetPool();
+
+ if (m_pStyleSheetPool)
+ {
+ StartListening(*m_pStyleSheetPool);
+ }
+}
+
+StylePoolChangeListener::~StylePoolChangeListener()
+{
+ if (m_pStyleSheetPool)
+ EndListening(*m_pStyleSheetPool);
+}
+
+void StylePoolChangeListener::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
+{
+ m_pPreviewControl->UpdateStylesList();
+}
+
StyleItemController::StyleItemController(const std::pair<OUString, OUString>& aStyleName)
: m_eStyleFamily(SfxStyleFamily::Para)
, m_aStyleName(aStyleName)
@@ -351,6 +377,9 @@ StylesPreviewWindow_Base::StylesPreviewWindow_Base(
m_pStatusListener = new StyleStatusListener(this, xDispatchProvider);
m_xStatusListener.set(static_cast<cppu::OWeakObject*>(m_pStatusListener), css::uno::UNO_QUERY);
+ m_pStylePoolChangeListener.reset(new StylePoolChangeListener(this));
+
+ UpdateStylesList();
Update();
}
@@ -406,14 +435,11 @@ void StylesPreviewWindow_Base::Select(const OUString& rStyleName)
{
m_sSelectedStyle = rStyleName;
- UpdateStylesList();
Update();
}
void StylesPreviewWindow_Base::Update()
{
- UpdateStylesList();
-
for (unsigned long i = 0; i < m_aAllStyles.size(); ++i)
{
if (m_aAllStyles[i].first == m_sSelectedStyle || m_aAllStyles[i].second == m_sSelectedStyle)
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index fb16bd4a02d4..2907b54e6a9e 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1311,6 +1311,8 @@ void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWr
break;
default: break;
}
+
+ m_xDoc->BroadcastStyleOperation(rName, nFamily, SfxHintId::StyleSheetModified);
}
// NewByExample
@@ -1504,6 +1506,8 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
default: break;
}
+
+ m_xDoc->BroadcastStyleOperation(rName, nFamily, SfxHintId::StyleSheetCreated);
}
sfx::AccessibilityIssueCollection SwDocShell::runAccessibilityCheck()
commit fc4ba7c56259f0758ca5c6f48b379a7ae5feb3b0
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Feb 23 15:29:06 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:56:10 2021 +0200
jsdialog: refresh on thaw
Change-Id: Iaab6fe615bc916cab02a8027275264e899d3cabb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111405
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Henry Castro <hcastro at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112093
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index c907b128bbd3..c3fc77ae3d3c 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -336,6 +336,7 @@ public:
{
BaseInstanceClass::thaw();
m_bIsFreezed = false;
+ sendUpdate();
}
virtual void sendClose() override
commit 6953f6afcf001556fd328102f7456b6ca224b602
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Feb 2 16:12:55 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:55:58 2021 +0200
tdf#139429 Convert Style previews widget to IconView
- this adds labels to easily identify the styles
- easier to work with many styles
- nice native widget in gtk3
- double click opens the style settings
- added Command callback fro iconview
Change-Id: I08743515cbd2a4e4bd592d1509e48bbe2a43b129
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110408
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 29f671940c85..573a749d641b 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1236,6 +1236,7 @@ private:
protected:
Link<IconView&, void> m_aSelectionChangeHdl;
Link<IconView&, bool> m_aItemActivatedHdl;
+ Link<const CommandEvent&, bool> m_aCommandHdl;
void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); }
bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); }
@@ -1272,6 +1273,8 @@ public:
*/
void connect_item_activated(const Link<IconView&, bool>& rLink) { m_aItemActivatedHdl = rLink; }
+ void connect_command(const Link<const CommandEvent&, bool>& rLink) { m_aCommandHdl = rLink; }
+
virtual OUString get_selected_id() const = 0;
virtual void clear() = 0;
diff --git a/svx/source/inc/StylesPreviewWindow.hxx b/svx/source/inc/StylesPreviewWindow.hxx
index 9e90c4d36288..416c8a15a63f 100644
--- a/svx/source/inc/StylesPreviewWindow.hxx
+++ b/svx/source/inc/StylesPreviewWindow.hxx
@@ -40,24 +40,17 @@ public:
void StateChanged(SfxItemState eState, const SfxPoolItem* pState) override;
};
-class StyleItemController : public weld::CustomWidgetController
+class StyleItemController
{
static constexpr unsigned LEFT_MARGIN = 8;
SfxStyleFamily m_eStyleFamily;
std::pair<OUString, OUString> m_aStyleName;
- bool m_bSelected;
- css::uno::Reference<css::frame::XDispatchProvider> m_xDispatchProvider;
public:
- StyleItemController(
- const std::pair<OUString, OUString>& aStyleName,
- const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider);
-
- void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ StyleItemController(const std::pair<OUString, OUString>& aStyleName);
- bool MouseButtonDown(const MouseEvent& rMEvt) override;
- bool Command(const CommandEvent& rEvent) override;
+ void Paint(vcl::RenderContext& rRenderContext);
void SetStyle(const std::pair<OUString, OUString>& sStyleName);
@@ -77,23 +70,21 @@ class StylesPreviewWindow_Base
protected:
static constexpr unsigned STYLES_COUNT = 6;
- std::unique_ptr<StyleItemController> m_xStyleControllers[STYLES_COUNT];
- std::unique_ptr<weld::CustomWeld> m_xStyleControllersWeld[STYLES_COUNT];
+ css::uno::Reference<css::frame::XDispatchProvider> m_xDispatchProvider;
+
+ std::unique_ptr<weld::IconView> m_xStylesView;
StyleStatusListener* m_pStatusListener;
css::uno::Reference<css::lang::XComponent> m_xStatusListener;
- std::unique_ptr<weld::Toolbar> m_xUp;
- std::unique_ptr<weld::Toolbar> m_xDown;
-
std::vector<std::pair<OUString, OUString>> m_aDefaultStyles;
std::vector<std::pair<OUString, OUString>> m_aAllStyles;
- unsigned m_nStyleIterator;
OUString m_sSelectedStyle;
- DECL_LINK(GoUp, const OString&, void);
- DECL_LINK(GoDown, const OString&, void);
+ DECL_LINK(Selected, weld::IconView&, void);
+ DECL_LINK(DoubleClick, weld::IconView&, bool);
+ DECL_LINK(DoCommand, const CommandEvent&, bool);
public:
StylesPreviewWindow_Base(
@@ -106,8 +97,7 @@ public:
private:
void Update();
void UpdateStylesList();
- void MakeCurrentStyleVisible();
- std::pair<OUString, OUString> GetVisibleStyle(unsigned nPosition);
+ bool Command(const CommandEvent& rEvent);
};
class StylesPreviewWindow_Impl : public InterimItemWindow, public StylesPreviewWindow_Base
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index 40d070477065..6dfcb6c7d139 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -27,6 +27,7 @@
#include <sfx2/sfxsids.hrc>
#include <sfx2/tplpitem.hxx>
#include <sfx2/viewsh.hxx>
+#include <vcl/virdev.hxx>
#include <editeng/editids.hrc>
#include <editeng/fontitem.hxx>
@@ -73,18 +74,13 @@ void StyleStatusListener::StateChanged(SfxItemState /*eState*/, const SfxPoolIte
m_pPreviewControl->Select(pStateItem->GetStyleName());
}
-StyleItemController::StyleItemController(
- const std::pair<OUString, OUString>& aStyleName,
- const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider)
+StyleItemController::StyleItemController(const std::pair<OUString, OUString>& aStyleName)
: m_eStyleFamily(SfxStyleFamily::Para)
, m_aStyleName(aStyleName)
- , m_bSelected(false)
- , m_xDispatchProvider(xDispatchProvider)
{
}
-void StyleItemController::Paint(vcl::RenderContext& rRenderContext,
- const tools::Rectangle& /*rRect*/)
+void StyleItemController::Paint(vcl::RenderContext& rRenderContext)
{
rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
@@ -93,51 +89,19 @@ void StyleItemController::Paint(vcl::RenderContext& rRenderContext,
rRenderContext.Pop();
}
-void StyleItemController::SetStyle(const std::pair<OUString, OUString>& sStyleName)
-{
- m_aStyleName = sStyleName;
- Invalidate();
-}
-
-void StyleItemController::Select(bool bSelect)
-{
- m_bSelected = bSelect;
- Invalidate();
-}
-
-bool StyleItemController::MouseButtonDown(const MouseEvent& rMEvt)
-{
- if (rMEvt.IsLeft())
- {
- css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
- aArgs[0].Value <<= m_aStyleName.second;
- aArgs[1].Name = "Family";
- aArgs[1].Value <<= sal_Int16(m_eStyleFamily);
-
- aArgs[0].Name = "Template";
- SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs);
- }
-
- return false;
-}
-
-bool StyleItemController::Command(const CommandEvent& rEvent)
+bool StylesPreviewWindow_Base::Command(const CommandEvent& rEvent)
{
if (rEvent.GetCommand() != CommandEventId::ContextMenu)
- return CustomWidgetController::Command(rEvent);
+ return false;
std::unique_ptr<weld::Builder> xBuilder(
- Application::CreateBuilder(GetDrawingArea(), "svx/ui/stylemenu.ui"));
+ Application::CreateBuilder(m_xStylesView.get(), "svx/ui/stylemenu.ui"));
std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("menu"));
std::string_view rIdent = xMenu->popup_at_rect(
- GetDrawingArea(), tools::Rectangle(rEvent.GetMousePosPixel(), Size(1, 1)));
+ m_xStylesView.get(), tools::Rectangle(rEvent.GetMousePosPixel(), Size(1, 1)));
if (rIdent == "update" || rIdent == "edit")
{
- css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
- aArgs[0].Name = "Param";
- aArgs[0].Value <<= m_aStyleName.second;
- aArgs[1].Name = "Family";
- aArgs[1].Value <<= sal_Int16(m_eStyleFamily);
+ css::uno::Sequence<css::beans::PropertyValue> aArgs(0);
SfxToolBoxControl::Dispatch(m_xDispatchProvider,
rIdent == "update" ? OUString(".uno:StyleUpdateByExample")
@@ -261,24 +225,13 @@ void StyleItemController::DrawEntry(vcl::RenderContext& rRenderContext)
Size aSize(rRenderContext.GetOutputSizePixel());
tools::Rectangle aFullRect(Point(0, 0), aSize);
- aSize = Size(aSize.getWidth() - 6, aSize.getHeight() - 6);
tools::Rectangle aContentRect(aFullRect);
Color aOriginalColor = rRenderContext.GetFillColor();
Color aOriginalLineColor = rRenderContext.GetLineColor();
- vcl::Region aOriginalClipRegion(aFullRect);
-
- if (m_bSelected)
- {
- aContentRect = tools::Rectangle(Point(3, 3), aSize);
- DrawSelection(rRenderContext);
- }
DrawContentBackground(rRenderContext, aContentRect, aOriginalColor);
- vcl::Region aClipRegion(aContentRect);
- rRenderContext.SetClipRegion(aClipRegion);
-
std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
if (!pItemSet)
return;
@@ -328,7 +281,6 @@ void StyleItemController::DrawEntry(vcl::RenderContext& rRenderContext)
rRenderContext.SetFillColor(aOriginalColor);
rRenderContext.SetLineColor(aOriginalLineColor);
- rRenderContext.SetClipRegion(aOriginalClipRegion);
}
void StyleItemController::DrawContentBackground(vcl::RenderContext& rRenderContext,
@@ -388,30 +340,51 @@ void StyleItemController::DrawText(vcl::RenderContext& rRenderContext)
StylesPreviewWindow_Base::StylesPreviewWindow_Base(
weld::Builder& xBuilder, std::vector<std::pair<OUString, OUString>>& aDefaultStyles,
const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider)
- : m_xUp(xBuilder.weld_toolbar("uptoolbar"))
- , m_xDown(xBuilder.weld_toolbar("downtoolbar"))
+ : m_xDispatchProvider(xDispatchProvider)
+ , m_xStylesView(xBuilder.weld_icon_view("stylesview"))
, m_aDefaultStyles(aDefaultStyles)
- , m_nStyleIterator(0)
{
- for (unsigned int i = 0; i < STYLES_COUNT; i++)
- {
- auto aStyle
- = i < aDefaultStyles.size() ? aDefaultStyles[i] : std::pair<OUString, OUString>("", "");
- m_xStyleControllers[i].reset(new StyleItemController(aStyle, xDispatchProvider));
+ m_xStylesView->connect_selection_changed(LINK(this, StylesPreviewWindow_Base, Selected));
+ m_xStylesView->connect_item_activated(LINK(this, StylesPreviewWindow_Base, DoubleClick));
+ m_xStylesView->connect_command(LINK(this, StylesPreviewWindow_Base, DoCommand));
- OUString sIdOUString = "style" + OUString::number(i + 1);
- OString sId = OUStringToOString(sIdOUString, RTL_TEXTENCODING_ASCII_US);
+ m_pStatusListener = new StyleStatusListener(this, xDispatchProvider);
+ m_xStatusListener.set(static_cast<cppu::OWeakObject*>(m_pStatusListener), css::uno::UNO_QUERY);
- m_xStyleControllersWeld[i].reset(
- new weld::CustomWeld(xBuilder, sId, *m_xStyleControllers[i]));
- m_xStyleControllersWeld[i]->set_size_request(128, 28);
- }
+ Update();
+}
- m_xUp->connect_clicked(LINK(this, StylesPreviewWindow_Base, GoUp));
- m_xDown->connect_clicked(LINK(this, StylesPreviewWindow_Base, GoDown));
+IMPL_LINK(StylesPreviewWindow_Base, Selected, weld::IconView&, rIconView, void)
+{
+ OUString sStyleName = rIconView.get_selected_text();
- m_pStatusListener = new StyleStatusListener(this, xDispatchProvider);
- m_xStatusListener.set(static_cast<cppu::OWeakObject*>(m_pStatusListener), css::uno::UNO_QUERY);
+ css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
+ aArgs[0].Value <<= sStyleName;
+ aArgs[1].Name = "Family";
+ aArgs[1].Value <<= sal_Int16(SfxStyleFamily::Para);
+
+ aArgs[0].Name = "Template";
+ SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs);
+}
+
+IMPL_LINK(StylesPreviewWindow_Base, DoubleClick, weld::IconView&, rIconView, bool)
+{
+ OUString sStyleName = rIconView.get_selected_text();
+
+ css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
+ aArgs[0].Name = "Param";
+ aArgs[0].Value <<= sStyleName;
+ aArgs[1].Name = "Family";
+ aArgs[1].Value <<= sal_Int16(SfxStyleFamily::Para);
+
+ SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:EditStyle", aArgs);
+
+ return true;
+}
+
+IMPL_LINK(StylesPreviewWindow_Base, DoCommand, const CommandEvent&, rPos, bool)
+{
+ return Command(rPos);
}
StylesPreviewWindow_Base::~StylesPreviewWindow_Base()
@@ -429,56 +402,25 @@ StylesPreviewWindow_Base::~StylesPreviewWindow_Base()
m_pStatusListener = nullptr;
}
-std::pair<OUString, OUString> StylesPreviewWindow_Base::GetVisibleStyle(unsigned nPosition)
-{
- if (nPosition >= STYLES_COUNT || !m_aAllStyles.size())
- return std::make_pair<OUString, OUString>("", "");
-
- return m_aAllStyles[(m_nStyleIterator + nPosition) % m_aAllStyles.size()];
-}
-
void StylesPreviewWindow_Base::Select(const OUString& rStyleName)
{
m_sSelectedStyle = rStyleName;
UpdateStylesList();
- MakeCurrentStyleVisible();
Update();
}
-void StylesPreviewWindow_Base::MakeCurrentStyleVisible()
-{
- if (!m_aAllStyles.size())
- return;
-
- unsigned nNewIterator = m_nStyleIterator;
- auto aFound = std::find_if(m_aAllStyles.begin(), m_aAllStyles.end(), [this](auto it) {
- return it.first == m_sSelectedStyle || it.second == m_sSelectedStyle;
- });
- if (aFound != m_aAllStyles.end())
- nNewIterator = aFound - m_aAllStyles.begin();
-
- bool bIsAlreadyVisible
- = nNewIterator >= m_nStyleIterator % m_aAllStyles.size()
- && nNewIterator < m_nStyleIterator % m_aAllStyles.size() + STYLES_COUNT;
- if (!bIsAlreadyVisible)
- m_nStyleIterator = nNewIterator;
-}
-
void StylesPreviewWindow_Base::Update()
{
UpdateStylesList();
- for (unsigned int i = 0; i < STYLES_COUNT; i++)
+ for (unsigned long i = 0; i < m_aAllStyles.size(); ++i)
{
- std::pair<OUString, OUString> sStyleName = GetVisibleStyle(i);
- m_xStyleControllers[i]->SetStyle(sStyleName);
- m_xStyleControllersWeld[i]->set_tooltip_text(sStyleName.second);
-
- if (sStyleName.first == m_sSelectedStyle || sStyleName.second == m_sSelectedStyle)
- m_xStyleControllers[i]->Select(true);
- else
- m_xStyleControllers[i]->Select(false);
+ if (m_aAllStyles[i].first == m_sSelectedStyle || m_aAllStyles[i].second == m_sSelectedStyle)
+ {
+ m_xStylesView->select(i);
+ break;
+ }
}
}
@@ -505,22 +447,19 @@ void StylesPreviewWindow_Base::UpdateStylesList()
pStyle = xIter->Next();
}
}
-}
-IMPL_LINK(StylesPreviewWindow_Base, GoUp, const OString&, /*rItem*/, void)
-{
- if (m_nStyleIterator == 0)
- m_nStyleIterator = m_aAllStyles.size();
- else
- m_nStyleIterator = m_nStyleIterator - 2;
+ m_xStylesView->clear();
+ for (auto& rStyle : m_aAllStyles)
+ {
+ ScopedVclPtr<VirtualDevice> pImg = VclPtr<VirtualDevice>::Create();
+ const Size aSize(100, 30);
+ pImg->SetOutputSizePixel(aSize);
- Update();
-}
+ StyleItemController aStyleController(rStyle);
+ aStyleController.Paint(*pImg);
-IMPL_LINK(StylesPreviewWindow_Base, GoDown, const OString&, /*rItem*/, void)
-{
- m_nStyleIterator = m_nStyleIterator + 2;
- Update();
+ m_xStylesView->append(rStyle.first, rStyle.second, pImg);
+ }
}
StylesPreviewWindow_Impl::StylesPreviewWindow_Impl(
@@ -530,10 +469,6 @@ StylesPreviewWindow_Impl::StylesPreviewWindow_Impl(
reinterpret_cast<sal_uInt64>(SfxViewShell::Current()))
, StylesPreviewWindow_Base(*m_xBuilder, aDefaultStyles, xDispatchProvider)
{
- m_xUp->set_stack_background();
- m_xDown->set_stack_background();
- m_xContainer->set_stack_background();
-
SetOptimalSize();
}
@@ -541,11 +476,7 @@ StylesPreviewWindow_Impl::~StylesPreviewWindow_Impl() { disposeOnce(); }
void StylesPreviewWindow_Impl::dispose()
{
- m_xUp.reset();
- m_xDown.reset();
-
- for (unsigned int i = 0; i < STYLES_COUNT; i++)
- m_xStyleControllersWeld[i].reset();
+ m_xStylesView.reset();
InterimItemWindow::dispose();
}
diff --git a/svx/uiconfig/ui/stylespreview.ui b/svx/uiconfig/ui/stylespreview.ui
index 7e1a3c9fe952..45d836da0d02 100644
--- a/svx/uiconfig/ui/stylespreview.ui
+++ b/svx/uiconfig/ui/stylespreview.ui
@@ -1,150 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.2 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="svx">
<requires lib="gtk+" version="3.20"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name expander -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkBox" id="ApplyStyleBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
+ <property name="spacing">6</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="valign">center</property>
- <child>
- <!-- n-columns=1 n-rows=1 -->
- <object class="GtkGrid" id="stylescontainer">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkDrawingArea" id="style4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkDrawingArea" id="style3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkDrawingArea" id="style2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkDrawingArea" id="style1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkDrawingArea" id="style5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkDrawingArea" id="style6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="spacing">3</property>
<child>
- <object class="GtkBox">
+ <object class="GtkScrolledWindow">
+ <property name="width_request">360</property>
+ <property name="height_request">65</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="valign">center</property>
- <property name="orientation">vertical</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">always</property>
+ <property name="shadow_type">in</property>
+ <property name="min_content_width">70</property>
<child>
- <object class="GtkToolbar" id="uptoolbar">
+ <object class="GtkIconView" id="stylesview">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="toolbar_style">icons</property>
- <child>
- <object class="GtkToolButton" id="up">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="stylespreview|up">Previous</property>
- <property name="use_underline">True</property>
- <property name="icon_name">cmd/sc_prevrecord.png</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="margin">0</property>
+ <property name="model">liststore1</property>
+ <property name="columns">3</property>
+ <property name="item_width">70</property>
+ <property name="pixbuf-column">0</property>
+ <property name="text-column">1</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolbar" id="downtoolbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="toolbar_style">icons</property>
- <child>
- <object class="GtkToolButton" id="down">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="stylespreview|down">Next</property>
- <property name="use_underline">True</property>
- <property name="icon_name">cmd/sc_nextrecord.png</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 645b7f25deeb..43a8cf977b0b 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1710,6 +1710,7 @@ private:
DECL_LINK(SelectHdl, SvTreeListBox*, void);
DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
+ DECL_LINK(CommandHdl, const CommandEvent&, bool);
public:
SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index f48004b8279b..61bf38feb4f3 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5016,6 +5016,7 @@ SalInstanceIconView::SalInstanceIconView(::IconView* pIconView, SalInstanceBuild
m_xIconView->SetSelectHdl(LINK(this, SalInstanceIconView, SelectHdl));
m_xIconView->SetDeselectHdl(LINK(this, SalInstanceIconView, DeSelectHdl));
m_xIconView->SetDoubleClickHdl(LINK(this, SalInstanceIconView, DoubleClickHdl));
+ m_xIconView->SetPopupMenuHdl(LINK(this, SalInstanceIconView, CommandHdl));
}
void SalInstanceIconView::freeze()
@@ -5278,6 +5279,11 @@ IMPL_LINK_NOARG(SalInstanceIconView, DoubleClickHdl, SvTreeListBox*, bool)
return !signal_item_activated();
}
+IMPL_LINK(SalInstanceIconView, CommandHdl, const CommandEvent&, rEvent, bool)
+{
+ return m_aCommandHdl.Call(rEvent);
+}
+
double SalInstanceSpinButton::toField(int nValue) const
{
return static_cast<double>(nValue) / Power10(get_digits());
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index fa6220835b75..701a5af9a63e 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12330,10 +12330,21 @@ private:
gint m_nIdCol;
gulong m_nSelectionChangedSignalId;
gulong m_nItemActivatedSignalId;
+ gulong m_nPopupMenu;
ImplSVEvent* m_pSelectionChangeEvent;
DECL_LINK(async_signal_selection_changed, void*, void);
+ bool signal_command(const CommandEvent& rCEvt)
+ {
+ return m_aCommandHdl.Call(rCEvt);
+ }
+
+ virtual bool signal_popup_menu(const CommandEvent& rCEvt) override
+ {
+ return signal_command(rCEvt);
+ }
+
void launch_signal_selection_changed()
{
//tdf#117991 selection change is sent before the focus change, and focus change
@@ -12438,6 +12449,7 @@ public:
, m_nSelectionChangedSignalId(g_signal_connect(pIconView, "selection-changed",
G_CALLBACK(signalSelectionChanged), this))
, m_nItemActivatedSignalId(g_signal_connect(pIconView, "item-activated", G_CALLBACK(signalItemActivated), this))
+ , m_nPopupMenu(g_signal_connect(pIconView, "popup-menu", G_CALLBACK(signalPopupMenu), this))
, m_pSelectionChangeEvent(nullptr)
{
m_nIdCol = m_nTextCol + 1;
@@ -12708,6 +12720,7 @@ public:
g_signal_handler_disconnect(m_pIconView, m_nItemActivatedSignalId);
g_signal_handler_disconnect(m_pIconView, m_nSelectionChangedSignalId);
+ g_signal_handler_disconnect(m_pIconView, m_nPopupMenu);
}
};
commit a3fbca162d786692986218e18fb0994ad850db17
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Feb 12 17:18:51 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 21:55:43 2021 +0200
sidebar: use real height to determine preffered size
There was a bug causing to crop the sidebar in online:
1. open odt file in 2 sessions
2. select image in session A
3. move mouse over sidebar in session B
4. move mouse over sidebar in session A
Result: sidebar A was cropped
PosSizePropertyPanel on context change
did some windows visibility changes in the meantime.
get_preffered_size() returned lower height than real
value in SidebarPanelBase::getHeightForWidth
call queue_resize to invalidate cached optimal size
Change-Id: I8080259ffb12ae3f6613e7749e908d6ef55c1f3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110894
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112092
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index 6865047df252..9ca1d7ccb431 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -171,6 +171,7 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi
else if (isLayoutEnabled(mpControl))
{
// widget layout-based sidebar
+ mpControl->queue_resize();
Size aSize(mpControl->get_preferred_size());
return ui::LayoutSize(aSize.Height(), aSize.Height(), aSize.Height());
}
More information about the Libreoffice-commits
mailing list