summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2023-11-16 19:19:36 -0900
committerJim Raykowski <raykowj@gmail.com>2024-03-11 17:34:27 +0100
commit1447900fc5f0d32d8379a95439f524fda9a664c1 (patch)
treeab2211c579de74b04930ddfb6435f5e89f9a9c63 /sd
parent4e27934fc1ea47e4f3986c7675d94348a9f23a21 (diff)
tdf#122587 Add uno command to set layer of object(s)
Change-Id: Iabdd0f7059953760a69d82a3810eb8ed20c2fd9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159982 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/Library_sd.mk1
-rw-r--r--sd/UIConfig_sdraw.mk1
-rw-r--r--sd/inc/app.hrc2
-rw-r--r--sd/sdi/_drvwsh.sdi5
-rw-r--r--sd/sdi/sdraw.sdi16
-rw-r--r--sd/source/ui/dlg/SelectLayerDlg.cxx45
-rw-r--r--sd/source/ui/inc/SelectLayerDlg.hxx37
-rw-r--r--sd/source/ui/view/drviews2.cxx33
-rw-r--r--sd/source/ui/view/drviewsj.cxx1
-rw-r--r--sd/uiconfig/sdraw/ui/selectlayerdialog.ui152
10 files changed, 292 insertions, 1 deletions
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index bdf7b146da91..f801a77dbc88 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -245,6 +245,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/dlg/navigatr \
sd/source/ui/dlg/sdabstdlg \
sd/source/ui/dlg/sdtreelb \
+ sd/source/ui/dlg/SelectLayerDlg \
sd/source/ui/dlg/titledockwin \
sd/source/ui/dlg/unchss \
sd/source/ui/dlg/UndoThemeChange \
diff --git a/sd/UIConfig_sdraw.mk b/sd/UIConfig_sdraw.mk
index f6d42acba7e2..a84f0f286cae 100644
--- a/sd/UIConfig_sdraw.mk
+++ b/sd/UIConfig_sdraw.mk
@@ -122,6 +122,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/sdraw,\
sd/uiconfig/sdraw/ui/notebookbar_online \
sd/uiconfig/sdraw/ui/paranumberingtab \
sd/uiconfig/sdraw/ui/queryunlinkimagedialog \
+ sd/uiconfig/sdraw/ui/selectlayerdialog \
sd/uiconfig/sdraw/ui/vectorize \
))
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index e275e4688258..004b01c6e93d 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -111,7 +111,7 @@
#define SID_PAGEMODE (SID_SD_START+46)
#define SID_LAYERMODE (SID_SD_START+47)
#define SID_TOGGLELAYERVISIBILITY (SID_SD_START+48)
- // FREE
+#define SID_SETLAYER (SID_SD_START+49)
#define SID_MASTERPAGE (SID_SD_START+50)
// Navigation between slides
#define SID_GO_TO_NEXT_PAGE (SID_SD_START+51)
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index d5e1a5f51e8d..0d4bed12a9a7 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -198,6 +198,11 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
+ SID_SETLAYER
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
SID_NAVIGATOR // ole : no, status : ?
[
ExecMethod = FuTemporary ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 7bb752c687ac..ce0eb521e9ec 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -2623,6 +2623,22 @@ SfxBoolItem ToggleLayerVisibility SID_TOGGLELAYERVISIBILITY
GroupId = SfxGroupId::Modify;
]
+SfxVoidItem SetLayer SID_SETLAYER
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Modify;
+]
+
SfxVoidItem AssignLayout SID_ASSIGN_LAYOUT
(SfxUInt32Item WhatPage ID_VAL_WHATPAGE, SfxUInt32Item WhatLayout ID_VAL_WHATLAYOUT)
[
diff --git a/sd/source/ui/dlg/SelectLayerDlg.cxx b/sd/source/ui/dlg/SelectLayerDlg.cxx
new file mode 100644
index 000000000000..399f9db5d3c0
--- /dev/null
+++ b/sd/source/ui/dlg/SelectLayerDlg.cxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <SelectLayerDlg.hxx>
+#include <vcl/weld.hxx>
+
+SdSelectLayerDlg::SdSelectLayerDlg(weld::Window* pParent)
+ : GenericDialogController(pParent, "modules/sdraw/ui/selectlayerdialog.ui", "SelectLayerDialog")
+ , m_xOk(m_xBuilder->weld_button("ok"))
+ , m_xListLB(m_xBuilder->weld_tree_view("treeview"))
+{
+ m_xListLB->set_size_request(m_xListLB->get_approximate_digit_width() * 32,
+ m_xListLB->get_height_rows(8));
+ m_xListLB->connect_row_activated(LINK(this, SdSelectLayerDlg, DoubleClickHdl));
+ m_xListLB->connect_changed(LINK(this, SdSelectLayerDlg, SelectHdl));
+}
+
+IMPL_LINK_NOARG(SdSelectLayerDlg, DoubleClickHdl, weld::TreeView&, bool)
+{
+ m_xDialog->response(RET_OK);
+ return true;
+}
+
+IMPL_LINK_NOARG(SdSelectLayerDlg, SelectHdl, weld::TreeView&, void)
+{
+ m_xOk->set_sensitive(m_xListLB->get_selected_index() != -1);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/SelectLayerDlg.hxx b/sd/source/ui/inc/SelectLayerDlg.hxx
new file mode 100644
index 000000000000..e8ab6407d76a
--- /dev/null
+++ b/sd/source/ui/inc/SelectLayerDlg.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <vcl/weld.hxx>
+
+class SdSelectLayerDlg : public weld::GenericDialogController
+{
+ std::unique_ptr<weld::Button> m_xOk;
+ std::unique_ptr<weld::TreeView> m_xListLB;
+
+ DECL_LINK(DoubleClickHdl, weld::TreeView&, bool);
+ DECL_LINK(SelectHdl, weld::TreeView&, void);
+
+public:
+ explicit SdSelectLayerDlg(weld::Window* pParent);
+
+ weld::TreeView& GetTreeView() { return *m_xListLB; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 9b2aeb4187fc..93d4cca8cc6e 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -194,6 +194,7 @@
#include <memory>
#include <sfx2/newstyle.hxx>
+#include <SelectLayerDlg.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -2734,6 +2735,38 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
break;
}
+ case SID_SETLAYER:
+ {
+ const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+ const size_t nMarkCount = rMarkList.GetMarkCount();
+ if (nMarkCount >= 1 && mpLayerTabBar)
+ {
+ SdSelectLayerDlg aDlg(GetFrameWeld());
+
+ weld::TreeView& rTreeView = aDlg.GetTreeView();
+ auto nPageCount = mpLayerTabBar->GetPageCount();
+ for (auto i = 0; i < nPageCount; i++)
+ rTreeView.append_text(LayerTabBar::convertToLocalizedName(
+ mpLayerTabBar->GetLayerName(mpLayerTabBar->GetPageId(i))));
+ rTreeView.select(0);
+
+ if (aDlg.run() == RET_OK && rTreeView.get_selected_index() != -1)
+ {
+ SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
+ SdrLayerID aSdrLayerId = rLayerAdmin.GetLayerID(mpLayerTabBar->GetLayerName(
+ mpLayerTabBar->GetPageId(rTreeView.get_selected_index())));
+ for (size_t i = 0; i < nMarkCount; ++i)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ pObj->SetLayer(aSdrLayerId);
+ }
+ }
+ }
+ Cancel();
+ rReq.Ignore();
+ break;
+ }
+
case SID_ENTER_GROUP: // BASIC
{
mpDrawView->EnterMarkedGroup();
diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx
index 55103bf67573..6422747d03e8 100644
--- a/sd/source/ui/view/drviewsj.cxx
+++ b/sd/source/ui/view/drviewsj.cxx
@@ -483,6 +483,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
// select no object
else
{
+ rSet.DisableItem(SID_SETLAYER);
rSet.DisableItem( SID_ENTER_GROUP );
rSet.DisableItem( SID_CUT );
rSet.DisableItem( SID_COPY );
diff --git a/sd/uiconfig/sdraw/ui/selectlayerdialog.ui b/sd/uiconfig/sdraw/ui/selectlayerdialog.ui
new file mode 100644
index 000000000000..074d0c6e9dca
--- /dev/null
+++ b/sd/uiconfig/sdraw/ui/selectlayerdialog.ui
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.40.0 -->
+<interface domain="sd">
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkDialog" id="SelectLayerDialog">
+ <property name="can-focus">False</property>
+ <property name="border-width">6</property>
+ <property name="title" translatable="yes" context="selectlayerdialog|SelectLayerDialog">Select Layer</property>
+ <property name="modal">True</property>
+ <property name="default-width">0</property>
+ <property name="default-height">0</property>
+ <property name="type-hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can-focus">False</property>
+ <property name="layout-style">end</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label" translatable="yes" context="stock">_OK</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="can-default">True</property>
+ <property name="has-default">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label" translatable="yes" context="stock">_Cancel</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label" translatable="yes" context="stock">_Help</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label-xalign">0</property>
+ <property name="shadow-type">none</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="margin-start">12</property>
+ <property name="margin-top">6</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow-type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers-visible">False</property>
+ <property name="headers-clickable">False</property>
+ <property name="search-column">0</property>
+ <property name="show-expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="selectlayerdialog|label1">Layer</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-5">ok</action-widget>
+ <action-widget response="-6">cancel</action-widget>
+ <action-widget response="-11">help</action-widget>
+ </action-widgets>
+ </object>
+</interface>