summaryrefslogtreecommitdiff
path: root/sd/source/ui/func/fuoltext.cxx
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/func/fuoltext.cxx
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/func/fuoltext.cxx')
-rw-r--r--sd/source/ui/func/fuoltext.cxx141
1 files changed, 86 insertions, 55 deletions
diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx
index fe64cac47dfb..0068f77d4053 100644
--- a/sd/source/ui/func/fuoltext.cxx
+++ b/sd/source/ui/func/fuoltext.cxx
@@ -82,25 +82,85 @@ const sal_uInt16 SidArray[] = {
SID_SUMMARY_PAGE,
0 };
+void FuOutlineText::UpdateForKeyPress (const KeyEvent& rEvent)
+{
+ FuSimpleOutlinerText::UpdateForKeyPress(rEvent);
+
+ bool bUpdatePreview = true;
+ switch (rEvent.GetKeyCode().GetCode())
+ {
+ // When just the cursor has been moved the preview only changes when
+ // it moved to entries of another page. To prevent unnecessary
+ // updates we check this here. This is an early rejection test, so
+ // missing a key is not a problem.
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_HOME:
+ case KEY_END:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN:
+ {
+ SdPage* pCurrentPage = pOutlineViewShell->GetActualPage();
+ bUpdatePreview = (pCurrentPage != pOutlineViewShell->GetActualPage());
+ }
+ break;
+ }
+ if (bUpdatePreview)
+ pOutlineViewShell->UpdatePreview (pOutlineViewShell->GetActualPage());
+}
+
+/**
+ * Process keyboard input
+ * @returns sal_True if a KeyEvent is being processed, sal_False otherwise
+ */
+bool FuOutlineText::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_uInt16 nKeyGroup = rKEvt.GetKeyCode().GetGroup();
+ if( !mpDocSh->IsReadOnly() || nKeyGroup == KEYGROUP_CURSOR )
+ {
+ std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
+ if( (nKeyGroup != KEYGROUP_CURSOR) && (nKeyGroup != KEYGROUP_FKEYS) )
+ aGuard.reset( new OutlineViewModelChangeGuard( *static_cast<OutlineView*>(mpSimpleOutlinerView) ) );
+
+ return FuSimpleOutlinerText::KeyInput(rKEvt);
+ }
+
+ return false;
+}
+
+rtl::Reference<FuPoor> FuOutlineText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::SimpleOutlinerView* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ rtl::Reference<FuPoor> xFunc( new FuOutlineText( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute( rReq );
+ return xFunc;
+}
FuOutlineText::FuOutlineText(ViewShell* pViewShell, ::sd::Window* pWindow,
- ::sd::View* pView, SdDrawDocument* pDoc,
+ ::sd::SimpleOutlinerView* pView, SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuSimpleOutlinerText(pViewShell, pWindow, pView, pDoc, rReq)
+{}
+
+FuSimpleOutlinerText::FuSimpleOutlinerText(ViewShell* pViewShell, ::sd::Window* pWindow,
+ ::sd::SimpleOutlinerView* pView, SdDrawDocument* pDoc,
SfxRequest& rReq)
: FuPoor(pViewShell, pWindow, pView, pDoc, rReq),
- pOutlineViewShell (static_cast<OutlineViewShell*>(pViewShell)),
- pOutlineView (static_cast<OutlineView*>(pView))
+ pOutlineViewShell (pViewShell),
+ mpSimpleOutlinerView (pView)
{
}
/**
* forward to OutlinerView
*/
-bool FuOutlineText::Command(const CommandEvent& rCEvt)
+bool FuSimpleOutlinerText::Command(const CommandEvent& rCEvt)
{
bool bResult = false;
- OutlinerView* pOlView =
- static_cast<OutlineView*>(mpView)->GetViewByWindow(mpWindow);
+ OutlinerView* pOlView = mpSimpleOutlinerView->GetViewByWindow(mpWindow);
+
DBG_ASSERT (pOlView, "no OutlineView found");
if (pOlView)
@@ -112,18 +172,18 @@ bool FuOutlineText::Command(const CommandEvent& rCEvt)
}
-rtl::Reference<FuPoor> FuOutlineText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+rtl::Reference<FuPoor> FuSimpleOutlinerText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::SimpleOutlinerView* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
{
- rtl::Reference<FuPoor> xFunc( new FuOutlineText( pViewSh, pWin, pView, pDoc, rReq ) );
+ rtl::Reference<FuPoor> xFunc( new FuSimpleOutlinerText( pViewSh, pWin, pView, pDoc, rReq ) );
xFunc->DoExecute( rReq );
return xFunc;
}
-bool FuOutlineText::MouseButtonDown(const MouseEvent& rMEvt)
+bool FuSimpleOutlinerText::MouseButtonDown(const MouseEvent& rMEvt)
{
mpWindow->GrabFocus();
- bool bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseButtonDown(rMEvt);
+ bool bReturn = mpSimpleOutlinerView->GetViewByWindow(mpWindow)->MouseButtonDown(rMEvt);
if (bReturn)
{
@@ -138,9 +198,9 @@ bool FuOutlineText::MouseButtonDown(const MouseEvent& rMEvt)
return bReturn;
}
-bool FuOutlineText::MouseMove(const MouseEvent& rMEvt)
+bool FuSimpleOutlinerText::MouseMove(const MouseEvent& rMEvt)
{
- bool bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseMove(rMEvt);
+ bool bReturn = mpSimpleOutlinerView->GetViewByWindow(mpWindow)->MouseMove(rMEvt);
if (!bReturn)
{
@@ -150,9 +210,9 @@ bool FuOutlineText::MouseMove(const MouseEvent& rMEvt)
return bReturn;
}
-bool FuOutlineText::MouseButtonUp(const MouseEvent& rMEvt)
+bool FuSimpleOutlinerText::MouseButtonUp(const MouseEvent& rMEvt)
{
- bool bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseButtonUp(rMEvt);
+ bool bReturn = mpSimpleOutlinerView->GetViewByWindow(mpWindow)->MouseButtonUp(rMEvt);
if (bReturn)
{
@@ -161,7 +221,7 @@ bool FuOutlineText::MouseButtonUp(const MouseEvent& rMEvt)
}
else
{
- const SvxFieldItem* pFieldItem = pOutlineView->GetViewByWindow( mpWindow )->GetFieldUnderMousePointer();
+ const SvxFieldItem* pFieldItem = mpSimpleOutlinerView->GetViewByWindow( mpWindow )->GetFieldUnderMousePointer();
if( pFieldItem )
{
const SvxFieldData* pField = pFieldItem->GetField();
@@ -204,7 +264,7 @@ bool FuOutlineText::MouseButtonUp(const MouseEvent& rMEvt)
* Process keyboard input
* @returns sal_True if a KeyEvent is being processed, sal_False otherwise
*/
-bool FuOutlineText::KeyInput(const KeyEvent& rKEvt)
+bool FuSimpleOutlinerText::KeyInput(const KeyEvent& rKEvt)
{
bool bReturn = false;
@@ -213,11 +273,7 @@ bool FuOutlineText::KeyInput(const KeyEvent& rKEvt)
{
mpWindow->GrabFocus();
- std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
- if( (nKeyGroup != KEYGROUP_CURSOR) && (nKeyGroup != KEYGROUP_FKEYS) )
- aGuard.reset( new OutlineViewModelChangeGuard( *pOutlineView ) );
-
- bReturn = pOutlineView->GetViewByWindow(mpWindow)->PostKeyEvent(rKEvt);
+ bReturn = mpSimpleOutlinerView->GetViewByWindow(mpWindow)->PostKeyEvent(rKEvt);
if (bReturn)
{
@@ -232,74 +288,49 @@ bool FuOutlineText::KeyInput(const KeyEvent& rKEvt)
return bReturn;
}
-void FuOutlineText::UpdateForKeyPress (const KeyEvent& rEvent)
+void FuSimpleOutlinerText::UpdateForKeyPress (const KeyEvent& /*rEvent*/)
{
// Attributes at the current text position may have changed.
mpViewShell->GetViewFrame()->GetBindings().Invalidate(SidArray);
-
- bool bUpdatePreview = true;
- switch (rEvent.GetKeyCode().GetCode())
- {
- // When just the cursor has been moved the preview only changes when
- // it moved to entries of another page. To prevent unnecessary
- // updates we check this here. This is an early rejection test, so
- // missing a key is not a problem.
- case KEY_UP:
- case KEY_DOWN:
- case KEY_LEFT:
- case KEY_RIGHT:
- case KEY_HOME:
- case KEY_END:
- case KEY_PAGEUP:
- case KEY_PAGEDOWN:
- {
- SdPage* pCurrentPage = pOutlineViewShell->GetActualPage();
- bUpdatePreview = (pCurrentPage != pOutlineViewShell->GetActualPage());
- }
- break;
- }
- if (bUpdatePreview)
- pOutlineViewShell->UpdatePreview (pOutlineViewShell->GetActualPage());
}
/**
* Cut object to clipboard
*/
-void FuOutlineText::DoCut()
+void FuSimpleOutlinerText::DoCut()
{
- pOutlineView->GetViewByWindow(mpWindow)->Cut();
+ mpSimpleOutlinerView->GetViewByWindow(mpWindow)->Cut();
}
/**
* Copy object to clipboard
*/
-void FuOutlineText::DoCopy()
+void FuSimpleOutlinerText::DoCopy()
{
- pOutlineView->GetViewByWindow(mpWindow)->Copy();
+ mpSimpleOutlinerView->GetViewByWindow(mpWindow)->Copy();
}
/**
* Paste object from clipboard
*/
-void FuOutlineText::DoPaste()
+void FuSimpleOutlinerText::DoPaste()
{
- pOutlineView->GetViewByWindow(mpWindow)->PasteSpecial();
+ mpSimpleOutlinerView->GetViewByWindow(mpWindow)->PasteSpecial();
}
/**
* Paste object as unformatted text from clipboard
*/
-void FuOutlineText::DoPasteUnformatted()
+void FuSimpleOutlinerText::DoPasteUnformatted()
{
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mpViewShell->GetActiveWindow() ) );
if (aDataHelper.GetTransferable().is())
{
OUString aText;
if (aDataHelper.GetString(SotClipboardFormatId::STRING, aText))
- pOutlineView->GetViewByWindow(mpWindow)->InsertText(aText);
+ mpSimpleOutlinerView->GetViewByWindow(mpWindow)->InsertText(aText);
}
}
} // end of namespace sd
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */