summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShivam Kumar Singh <shivamhere247@gmail.com>2020-06-06 18:57:13 +0530
committerTomaž Vajngerl <quikee@gmail.com>2020-06-13 01:09:59 +0200
commitc98affa44e3f61279ae9fe052dbcfbda0c58838e (patch)
tree3b896cb3442c38060e2cbd2ecd999bf91b523b66
parentd400009e7c74d13f01fda923d7399eac11b83b66 (diff)
Changed the source code location for Inspector
The Inspector has been instead of defining in svx now defined such that the main implementation is in sw folder whereas there is a common interface in svx. This change has been done as a progressive step towards cleaner code. Change-Id: I49af862f87b4315385c2e275b1079394c326b119 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95657 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--include/svx/sidebar/InspectorTextPanel.hxx (renamed from svx/source/sidebar/inspector/InspectorTextPanel.hxx)13
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu2
-rw-r--r--svx/source/sidebar/PanelFactory.cxx5
-rw-r--r--svx/source/sidebar/inspector/InspectorTextPanel.cxx20
-rw-r--r--svx/uiconfig/ui/inspectortextpanel.ui2
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/source/uibase/sidebar/SwPanelFactory.cxx10
-rw-r--r--sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx51
-rw-r--r--sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx42
9 files changed, 118 insertions, 28 deletions
diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.hxx b/include/svx/sidebar/InspectorTextPanel.hxx
index 0d6160dfe75e..74c0b90fcd64 100644
--- a/svx/source/sidebar/inspector/InspectorTextPanel.hxx
+++ b/include/svx/sidebar/InspectorTextPanel.hxx
@@ -18,16 +18,14 @@
*/
#pragma once
-#include <sfx2/sidebar/IContextChangeReceiver.hxx>
-#include <sfx2/weldutils.hxx>
-#include <vcl/EnumContext.hxx>
#include <sfx2/sidebar/PanelLayout.hxx>
+#include <svx/svxdllapi.h>
namespace svx
{
namespace sidebar
{
-class InspectorTextPanel : public PanelLayout, public ::sfx2::sidebar::IContextChangeReceiver
+class SVX_DLLPUBLIC InspectorTextPanel : public PanelLayout
{
public:
virtual ~InspectorTextPanel() override;
@@ -36,15 +34,12 @@ public:
static VclPtr<vcl::Window> Create(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- virtual void HandleContextChange(const vcl::EnumContext& rContext) override;
-
InspectorTextPanel(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ virtual void updateEntries(std::vector<OUString> store);
private:
- std::unique_ptr<weld::TreeView> mxListBoxStyles; // To dump all the properties
-
- vcl::EnumContext maContext;
+ std::unique_ptr<weld::TreeView> mxListBoxStyles;
};
}
} // end of namespace svx::sidebar
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index fae993013b49..5e31fd73689d 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -411,7 +411,7 @@
</value>
</prop>
<prop oor:name="ImplementationURL" oor:type="xs:string">
- <value>private:resource/toolpanel/SvxPanelFactory/InspectorTextPanel</value>
+ <value>private:resource/toolpanel/SwPanelFactory/WriterInspectorTextPanel</value>
</prop>
<prop oor:name="OrderIndex" oor:type="xs:int">
<value>120</value>
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index 6b8ed657351e..e37648b38c25 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -20,7 +20,6 @@
#include <config_features.h>
#include "text/TextPropertyPanel.hxx"
-#include "inspector/InspectorTextPanel.hxx"
#include "styles/StylesPropertyPanel.hxx"
#include "paragraph/ParaPropertyPanel.hxx"
#include "lists/ListsPropertyPanel.hxx"
@@ -125,10 +124,6 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
{
pControl = TextPropertyPanel::Create(pParentWindow, xFrame);
}
- else if (rsResourceURL.endsWith("/InspectorTextPanel"))
- {
- pControl = InspectorTextPanel::Create(pParentWindow, xFrame);
- }
else if (rsResourceURL.endsWith("/StylesPropertyPanel"))
{
pControl = StylesPropertyPanel::Create(pParentWindow, xFrame);
diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
index 6eaa6f992573..68ac911a6408 100644
--- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx
+++ b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
@@ -17,11 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "InspectorTextPanel.hxx"
+#include <svx/sidebar/InspectorTextPanel.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <comphelper/lok.hxx>
-#include <sfx2/lokhelper.hxx>
using namespace css;
@@ -44,11 +42,17 @@ InspectorTextPanel::Create(vcl::Window* pParent,
InspectorTextPanel::InspectorTextPanel(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame)
: PanelLayout(pParent, "InspectorTextPanel", "svx/ui/inspectortextpanel.ui", rxFrame)
- , mxListBoxStyles(m_xBuilder->weld_tree_view("liststore"))
+ , mxListBoxStyles(m_xBuilder->weld_tree_view("listbox_fonts"))
{
mxListBoxStyles->set_size_request(-1, mxListBoxStyles->get_height_rows(10));
}
+void InspectorTextPanel::updateEntries(std::vector<OUString> store)
+{
+ for (OUString& str : store)
+ mxListBoxStyles->append_text(str);
+}
+
InspectorTextPanel::~InspectorTextPanel() { disposeOnce(); }
void InspectorTextPanel::dispose()
@@ -58,14 +62,6 @@ void InspectorTextPanel::dispose()
PanelLayout::dispose();
}
-void InspectorTextPanel::HandleContextChange(const vcl::EnumContext& rContext)
-{
- if (maContext == rContext)
- return;
-
- maContext = rContext;
-}
-
} // end of namespace svx::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/inspectortextpanel.ui b/svx/uiconfig/ui/inspectortextpanel.ui
index 1ebd98403eb5..726a3d840dc6 100644
--- a/svx/uiconfig/ui/inspectortextpanel.ui
+++ b/svx/uiconfig/ui/inspectortextpanel.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
-<interface domain="sw">
+<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
<object class="GtkTreeStore" id="liststore">
<columns>
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index fcb8786d704f..0707fb93e9c4 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -707,6 +707,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/uibase/sidebar/TableEditPanel \
sw/source/uibase/sidebar/ThemePanel \
sw/source/uibase/sidebar/SwPanelFactory \
+ sw/source/uibase/sidebar/WriterInspectorTextPanel \
sw/source/uibase/table/chartins \
sw/source/uibase/table/swtablerep \
sw/source/uibase/table/tablemgr \
diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx
index 37b6694e467d..b073b2801733 100644
--- a/sw/source/uibase/sidebar/SwPanelFactory.cxx
+++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx
@@ -26,6 +26,7 @@
#include "PageHeaderPanel.hxx"
#include "PageFooterPanel.hxx"
#include "WrapPropertyPanel.hxx"
+#include "WriterInspectorTextPanel.hxx"
#include "TableEditPanel.hxx"
#include <navipi.hxx>
#include <redlndlg.hxx>
@@ -169,6 +170,15 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
pPanel,
ui::LayoutSize(-1,-1,-1));
}
+ else if (rsResourceURL.endsWith("/WriterInspectorTextPanel"))
+ {
+ VclPtr<vcl::Window> pPanel = sw::sidebar::WriterInspectorTextPanel::Create( pParentWindow, xFrame);
+ xElement = sfx2::sidebar::SidebarPanelBase::Create(
+ rsResourceURL,
+ xFrame,
+ pPanel,
+ ui::LayoutSize(-1,-1,-1));
+ }
else if (rsResourceURL.endsWith("/StylePresetsPanel"))
{
VclPtr<vcl::Window> pPanel = sw::sidebar::StylePresetsPanel::Create(pParentWindow, xFrame);
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
new file mode 100644
index 000000000000..c0fc42be0ac4
--- /dev/null
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -0,0 +1,51 @@
+/* -*- 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 "WriterInspectorTextPanel.hxx"
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+using namespace css;
+
+namespace sw::sidebar
+{
+VclPtr<vcl::Window>
+WriterInspectorTextPanel::Create(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame)
+{
+ if (pParent == nullptr)
+ throw lang::IllegalArgumentException(
+ "no parent Window given to WriterInspectorTextPanel::Create", nullptr, 0);
+ if (!rxFrame.is())
+ throw lang::IllegalArgumentException("no XFrame given to WriterInspectorTextPanel::Create",
+ nullptr, 1);
+
+ return VclPtr<WriterInspectorTextPanel>::Create(pParent, rxFrame);
+}
+WriterInspectorTextPanel::WriterInspectorTextPanel(
+ vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame)
+ : InspectorTextPanel(pParent, rxFrame)
+{
+ std::vector<OUString> store;
+ InspectorTextPanel::updateEntries(store);
+}
+
+} // end of namespace svx::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
new file mode 100644
index 000000000000..85b8dc7a9f2f
--- /dev/null
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
@@ -0,0 +1,42 @@
+/* -*- 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 <sfx2/weldutils.hxx>
+#include <svx/sidebar/InspectorTextPanel.hxx>
+
+namespace sw
+{
+namespace sidebar
+{
+class WriterInspectorTextPanel final : public svx::sidebar::InspectorTextPanel
+{
+public:
+ static VclPtr<vcl::Window> Create(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ WriterInspectorTextPanel(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ // virtual ~WriterInspectorTextPanel();
+};
+}
+} // end of namespace svx::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */