summaryrefslogtreecommitdiff
path: root/sd/source/ui/inc
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir.extern@allotropia.de>2024-04-04 07:18:38 +0300
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2024-04-11 11:02:01 +0200
commit291919476294f62d7af9b8b7060d138728897ee7 (patch)
treefbefb7f2bf02ec5c2f9a333818af3bc918d1b60b /sd/source/ui/inc
parent8d85da5616bab28c1df226bcbf4fe777b14b363e (diff)
tdf#33603: sd: rework notes panel
To be able to support various dispatch commands, sidebar, proper user configuration, and more - reworked the previous notes panel implementation as a sd::View/sd::ViewShell pair that plays nice with Impress framework. To be able to support TextObjectBar(Shell) functionality, without having TextObjectBar as a SubShell (In the current sd::framework implementation AFAICS, SubShells are only possible for the MainViewShell - this doesn't work for notes panel which is never used as the MainViewShell.). A workaround is implemented where NotesPanel inherits dispatching slots from TextObjectBar, and for these inherited slots forwards the calls to TextObjectBar's implementation. This workaround could be removed if/when, SubShell support outside of MainViewShell is implemented. Known issues/TODO: - Drag & Drop crashes / doesn't work. - Some notes placeholder syncing problems on page change, edit mode change. - A rendering issue related to resizing when ArrangeGUIElements isn't called on resize. Change-Id: I588a4854fbedf6556e001fee1693b32410cbc23f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165770 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sd/source/ui/inc')
-rw-r--r--sd/source/ui/inc/NotesPanelView.hxx96
-rw-r--r--sd/source/ui/inc/NotesPanelViewShell.hxx101
-rw-r--r--sd/source/ui/inc/OutlineView.hxx18
-rw-r--r--sd/source/ui/inc/PaneChildWindows.hxx13
-rw-r--r--sd/source/ui/inc/PaneShells.hxx17
-rw-r--r--sd/source/ui/inc/TextObjectBar.hxx3
-rw-r--r--sd/source/ui/inc/ViewShell.hxx3
-rw-r--r--sd/source/ui/inc/framework/FrameworkHelper.hxx2
-rw-r--r--sd/source/ui/inc/fuoltext.hxx51
9 files changed, 282 insertions, 22 deletions
diff --git a/sd/source/ui/inc/NotesPanelView.hxx b/sd/source/ui/inc/NotesPanelView.hxx
new file mode 100644
index 000000000000..4bb94590acbb
--- /dev/null
+++ b/sd/source/ui/inc/NotesPanelView.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include "OutlineView.hxx"
+#include <Outliner.hxx>
+
+class SdrTextObj;
+
+namespace sd::tools
+{
+class EventMultiplexerEvent;
+}
+
+namespace sd
+{
+class DrawDocShell;
+class NotesPanelViewShell;
+
+/**
+ * Derivative of ::sd::SimpleOutlinerView for the notes panel
+|*
+\************************************************************************/
+
+class NotesPanelView final : public ::sd::SimpleOutlinerView
+{
+ NotesPanelViewShell& mrNotesPanelViewShell;
+ SdOutliner maOutliner;
+ OutlinerView maOutlinerView;
+
+ Idle aModifyIdle;
+
+ SdrTextObj* mpTextObj = nullptr;
+ bool mbFirstPaint = true;
+ bool mbIgnoreNotifications = false;
+
+ /** stores the last used document color.
+ this is changed in onUpdateStyleSettings()
+ */
+ Color maDocColor = COL_WHITE;
+
+ void removeListener();
+ void addListener();
+
+ void setListenerIgnored(bool bIgnore);
+ bool isListenerIgnored();
+
+ void getNotesFromDoc();
+ void setNotesToDoc();
+
+public:
+ NotesPanelView(DrawDocShell& rDocSh, vcl::Window* pWindow,
+ NotesPanelViewShell& rNotesPanelViewSh);
+ virtual ~NotesPanelView() override;
+
+ void Paint(const ::tools::Rectangle& rRect, ::sd::Window const* pWin);
+ void onResize();
+
+ OutlinerView* GetOutlinerView();
+ OutlinerView* GetViewByWindow(vcl::Window const* pWin) const override;
+
+ SdOutliner& GetOutliner() { return maOutliner; }
+
+ void FillOutliner();
+ void onUpdateStyleSettings(bool bForceUpdate);
+ virtual SvtScriptType GetScriptType() const override;
+
+ void SetLinks();
+ void ResetLinks();
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+
+ virtual void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr = false) const override;
+ virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false,
+ bool bSlide = false, bool bMaster = false) override;
+
+ // SdrObjEditView's Outliner access overrides to use TextObjectBar implementations.
+ virtual const SdrOutliner* GetTextEditOutliner() const override { return &maOutliner; }
+ virtual SdrOutliner* GetTextEditOutliner() override { return &maOutliner; }
+ virtual const OutlinerView* GetTextEditOutlinerView() const override { return &maOutlinerView; }
+ virtual OutlinerView* GetTextEditOutlinerView() override { return &maOutlinerView; }
+
+ DECL_LINK(StatusEventHdl, EditStatus&, void);
+ DECL_LINK(EditModifiedHdl, LinkParamNone*, void);
+ DECL_LINK(ModifyTimerHdl, Timer*, void);
+ DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent&, void);
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sd/source/ui/inc/NotesPanelViewShell.hxx b/sd/source/ui/inc/NotesPanelViewShell.hxx
new file mode 100644
index 000000000000..e79ac899fe30
--- /dev/null
+++ b/sd/source/ui/inc/NotesPanelViewShell.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include "ViewShell.hxx"
+#include <glob.hxx>
+
+class SdPage;
+
+namespace sd
+{
+class NotesPanelView;
+
+class NotesPanelViewShell final : public ViewShell
+{
+public:
+ SFX_DECL_VIEWFACTORY(NotesPanelViewShell);
+ SFX_DECL_INTERFACE(SD_IF_SDNOTESPANELVIEWSHELL)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+ /** Create a new view shell for the notes panel.
+ @param rViewShellBase
+ The new object will be stacked on this view shell base.
+ @param pFrameView
+ The frame view that makes it possible to pass information from
+ one view shell to the next.
+ */
+ NotesPanelViewShell(SfxViewFrame* pFrame, ViewShellBase& rViewShellBase,
+ vcl::Window* pParentWindow, FrameView* pFrameView);
+
+ virtual ~NotesPanelViewShell() override;
+
+ virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override;
+ virtual bool PrepareClose(bool bUI = true) override;
+ virtual void UpdateScrollBars() override;
+ virtual void VirtHScrollHdl(ScrollAdaptor* pHScroll) override;
+ virtual void VirtVScrollHdl(ScrollAdaptor* pVScroll) override;
+ virtual void Activate(bool IsMDIActivate) override;
+ /** this method is called when the visible area of the view from this viewshell is changed */
+ virtual void VisAreaChanged(const ::tools::Rectangle& rRect) override;
+
+ virtual void ArrangeGUIElements() override;
+ virtual SdPage* GetActualPage() override;
+ virtual SdPage* getCurrentPage() const override;
+ virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() override;
+
+ void ExecCtrl(SfxRequest& rReq);
+ void GetCtrlState(SfxItemSet& rSet);
+ void GetAttrState(SfxItemSet& rSet);
+ void GetState(SfxItemSet& rSet);
+ void GetCharState(SfxItemSet& rSet);
+
+ static void ExecStatusBar(SfxRequest& rReq);
+ void GetStatusBarState(SfxItemSet& rSet);
+
+ void FuTemporary(SfxRequest& rReq);
+ void FuTemporaryModify(SfxRequest& rReq);
+ void FuPermanent(SfxRequest& rReq);
+ void FuSupport(SfxRequest& rReq);
+ void Execute(SfxRequest& rReq);
+ void ExecChar(SfxRequest& rReq);
+
+ virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin) override;
+ virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) override;
+ virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
+
+ virtual void SetZoom(::tools::Long nZoom) override;
+ virtual void SetZoomRect(const ::tools::Rectangle& rZoomRect) override;
+
+ virtual void ReadFrameViewData(FrameView* pView) override;
+ virtual void WriteFrameViewData() override;
+ virtual css::uno::Reference<css::accessibility::XAccessible>
+ CreateAccessibleDocumentView(::sd::Window* /*pWindow*/) override
+ {
+ // TODO
+ return {};
+ }
+
+private:
+ std::unique_ptr<NotesPanelView> mpNotesPanelView;
+ bool mbInitialized = false;
+
+ /** Initiates the shell with it's NotesPanelView instance
+ */
+ void Construct();
+};
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx
index 43dadf038664..75550bfe5f9f 100644
--- a/sd/source/ui/inc/OutlineView.hxx
+++ b/sd/source/ui/inc/OutlineView.hxx
@@ -46,12 +46,24 @@ class OutlineViewModelChangeGuard;
const int MAX_OUTLINERVIEWS = 4;
/**
- * Derivative of ::sd::View for the outline mode
+ * Common base for OutlineView and NotesPanelView that only have a single Outliner in the view.
+|*
+\************************************************************************/
+class SimpleOutlinerView : public ::sd::View
+{
+public:
+ SimpleOutlinerView(SdDrawDocument& rDrawDoc, OutputDevice* pOutDev, ViewShell* pViewSh)
+ : View(rDrawDoc, pOutDev, pViewSh) {}
+ virtual OutlinerView* GetViewByWindow(vcl::Window const* pWin) const = 0;
+};
+
+/**
+ * Derivative of ::sd::SimpleOutlinerView for the outline mode
|*
\************************************************************************/
class OutlineView final
- : public ::sd::View
+ : public SimpleOutlinerView
{
friend class OutlineViewModelChangeGuard;
public:
@@ -78,7 +90,7 @@ public:
virtual void AddDeviceToPaintView(OutputDevice& rDev, vcl::Window* pWindow) override;
virtual void DeleteDeviceFromPaintView(OutputDevice& rDev) override;
- OutlinerView* GetViewByWindow(vcl::Window const * pWin) const;
+ OutlinerView* GetViewByWindow(vcl::Window const * pWin) const override;
SdOutliner& GetOutliner() { return mrOutliner; }
Paragraph* GetPrevTitle(const Paragraph* pPara);
diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx
index f96ede468bac..68989f3c01ce 100644
--- a/sd/source/ui/inc/PaneChildWindows.hxx
+++ b/sd/source/ui/inc/PaneChildWindows.hxx
@@ -34,7 +34,8 @@ public:
sal_uInt16 nId,
SfxBindings* pBindings,
SfxChildWinInfo* pInfo,
- TranslateId pTitleBarResId);
+ TranslateId pTitleBarResId,
+ SfxChildAlignment eAlignment);
virtual ~PaneChildWindow() override;
};
@@ -49,6 +50,16 @@ public:
SFX_DECL_CHILDWINDOW_WITHID(LeftPaneImpressChildWindow);
};
+/// The notes panel (on the bottom) in Impress.
+class BottomPaneImpressChildWindow final : public PaneChildWindow
+{
+public:
+ BottomPaneImpressChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo);
+
+ SFX_DECL_CHILDWINDOW_WITHID(BottomPaneImpressChildWindow);
+};
+
/// The pages sidebar (on the left) in Draw.
class LeftPaneDrawChildWindow final
: public PaneChildWindow
diff --git a/sd/source/ui/inc/PaneShells.hxx b/sd/source/ui/inc/PaneShells.hxx
index 73f24909c2fd..e15ce2dd3d41 100644
--- a/sd/source/ui/inc/PaneShells.hxx
+++ b/sd/source/ui/inc/PaneShells.hxx
@@ -41,6 +41,23 @@ public:
virtual ~LeftImpressPaneShell() override;
};
+/** Shell that displays the bottom pane for Impress. The shell does not do
+ anything else and has especially no slots.
+*/
+class BottomImpressPaneShell final : public SfxShell
+{
+public:
+ SFX_DECL_INTERFACE(SD_IF_SDBOTTOMIMPRESSPANESHELL)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+ BottomImpressPaneShell();
+ virtual ~BottomImpressPaneShell() override;
+};
+
/** Shell that displays the left pane for Draw. The shell does not do
anything else and has especially no slots.
*/
diff --git a/sd/source/ui/inc/TextObjectBar.hxx b/sd/source/ui/inc/TextObjectBar.hxx
index 61394834fbc2..aaa008f04f93 100644
--- a/sd/source/ui/inc/TextObjectBar.hxx
+++ b/sd/source/ui/inc/TextObjectBar.hxx
@@ -45,8 +45,11 @@ public:
virtual ~TextObjectBar() override;
void GetAttrState( SfxItemSet& rSet );
+ static void GetAttrStateImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxItemSet& rSet, SfxShell* pTextObjectBar);
void GetCharState( SfxItemSet& rSet );
+ static void GetCharStateImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxItemSet& rSet);
void Execute( SfxRequest &rReq );
+ static void ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxRequest& rReq, SfxShell* pTextObjectBar);
private:
ViewShell* mpViewShell;
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 89332537e94c..85bc43e86c09 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -100,7 +100,8 @@ public:
ST_OUTLINE,
ST_SLIDE_SORTER,
ST_PRESENTATION,
- ST_SIDEBAR
+ ST_SIDEBAR,
+ ST_NOTESPANEL
};
static const int MAX_HSPLIT_CNT = 1;
static const int MAX_VSPLIT_CNT = 1;
diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx
index e5fe6f78cdc0..f25e5886ff9f 100644
--- a/sd/source/ui/inc/framework/FrameworkHelper.hxx
+++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -60,6 +60,7 @@ public:
static const OUString msCenterPaneURL;
static const OUString msFullScreenPaneURL;
static const OUString msLeftImpressPaneURL;
+ static const OUString msBottomImpressPaneURL;
static const OUString msLeftDrawPaneURL;
// URLs of frequently used views.
@@ -72,6 +73,7 @@ public:
static const OUString msSlideSorterURL;
static const OUString msPresentationViewURL;
static const OUString msSidebarViewURL;
+ static const OUString msNotesPanelViewURL;
// URLs of frequently used tool bars.
static constexpr OUString msToolBarURLPrefix = u"private:resource/toolbar/"_ustr;
diff --git a/sd/source/ui/inc/fuoltext.hxx b/sd/source/ui/inc/fuoltext.hxx
index 288bcf190cb4..ddbada52734b 100644
--- a/sd/source/ui/inc/fuoltext.hxx
+++ b/sd/source/ui/inc/fuoltext.hxx
@@ -24,22 +24,19 @@
class SdDrawDocument;
class SfxRequest;
-namespace sd {
+namespace sd
+{
-class View;
-class ViewShell;
-class OutlineView;
-class OutlineViewShell;
+class SimpleOutlinerView;
/**
- * text functions in outline mode
+ * Functions class for shells that host only an Outliner e.g. NotesPanel
+ *
*/
-class FuOutlineText final
- : public FuPoor
+class FuSimpleOutlinerText : public FuPoor
{
public:
-
- static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+ static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::SimpleOutlinerView* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
virtual bool Command(const CommandEvent& rCEvt) override;
@@ -53,22 +50,42 @@ public:
virtual void DoPaste() override;
virtual void DoPasteUnformatted() override;
- /** Call this method when the text in the outliner (may) has changed.
+ /** Call this method when the text in the outliner (may) have changed.
+ It will invalidate some slots of the view frame.
+ */
+ virtual void UpdateForKeyPress (const KeyEvent& rEvent);
+
+protected:
+ FuSimpleOutlinerText(
+ ViewShell* pViewShell,
+ ::sd::Window* pWin,
+ ::sd::SimpleOutlinerView* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+
+ ViewShell* pOutlineViewShell;
+ SimpleOutlinerView* mpSimpleOutlinerView;
+};
+
+class FuOutlineText final : public FuSimpleOutlinerText
+{
+public:
+ static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::SimpleOutlinerView* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+ /** Call this method when the text in the outliner (may) have changed.
It will invalidate some slots of the view frame and update the
preview in the slide sorter.
*/
- void UpdateForKeyPress (const KeyEvent& rEvent);
+ virtual void UpdateForKeyPress(const KeyEvent& rEvent) override;
private:
- FuOutlineText (
+ FuOutlineText(
ViewShell* pViewShell,
::sd::Window* pWin,
- ::sd::View* pView,
+ ::sd::SimpleOutlinerView* pView,
SdDrawDocument* pDoc,
SfxRequest& rReq);
-
- OutlineViewShell* pOutlineViewShell;
- OutlineView* pOutlineView;
};
} // end of namespace sd