summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
Diffstat (limited to 'sd')
-rw-r--r--sd/sdi/NotesPanelView.sdi8
-rw-r--r--sd/sdi/drviewsh.sdi6
-rw-r--r--sd/source/ui/inc/OutlinerIteratorImpl.hxx61
-rw-r--r--sd/source/ui/view/NotesPanelViewShell.cxx46
-rw-r--r--sd/source/ui/view/Outliner.cxx150
-rw-r--r--sd/source/ui/view/OutlinerIterator.cxx318
-rw-r--r--sd/source/ui/view/drviews7.cxx7
7 files changed, 365 insertions, 231 deletions
diff --git a/sd/sdi/NotesPanelView.sdi b/sd/sdi/NotesPanelView.sdi
index 2fca90c56fdc..933ef9922401 100644
--- a/sd/sdi/NotesPanelView.sdi
+++ b/sd/sdi/NotesPanelView.sdi
@@ -492,10 +492,14 @@ interface NotesPanelView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
+ FID_SEARCH_NOW // ole : ?, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = SfxGroupId::Document ;
+ ]
}
-include "drtxtob.sdi"
-
shell NotesPanelViewShell
{
import NotesPanelView;
diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi
index 84fa9bfa8471..ac7e44ab1a37 100644
--- a/sd/sdi/drviewsh.sdi
+++ b/sd/sdi/drviewsh.sdi
@@ -203,6 +203,12 @@ interface ImpressEditView : DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
+ FID_SEARCH_NOW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ GroupId = SfxGroupId::Document ;
+ ]
}
shell DrawViewShell
diff --git a/sd/source/ui/inc/OutlinerIteratorImpl.hxx b/sd/source/ui/inc/OutlinerIteratorImpl.hxx
index 84b11e47b636..485f2b89eaec 100644
--- a/sd/source/ui/inc/OutlinerIteratorImpl.hxx
+++ b/sd/source/ui/inc/OutlinerIteratorImpl.hxx
@@ -155,36 +155,35 @@ private:
IteratorImplBase& operator= (const IteratorImplBase& rIterator);
};
-/** Iterator for iteration over all objects in a single view. On reaching
- the last object on the last page (or the first object on the first page)
- the view is *not* switched. Further calls to the
- <member>GotoNextObject()</member> method will be ignored.
+/** Iterator for iteration over all objects in all views. It switches views when
+ appropriate.
+
+ Iterates in the following pattern
+ 1-) Alternating Normal View and Notes View for each page
+ 2-) Master Pages
+ 3-) Notes Masters
+ 4-) The Handout Master
<p>For documentation of the methods please refer to the base class
<type>IteratorImplBase</type>.</p>
*/
-class ViewIteratorImpl : public IteratorImplBase
+class DocumentIteratorImpl final : public IteratorImplBase
{
public:
- ViewIteratorImpl (
+ DocumentIteratorImpl (
sal_Int32 nPageIndex,
+ PageKind ePageKind,
+ EditMode eEditMode,
SdDrawDocument* pDocument,
const std::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
- ViewIteratorImpl (
- sal_Int32 nPageIndex,
- SdDrawDocument* pDocument,
- const std::weak_ptr<ViewShell>& rpViewShellWeak,
- bool bDirectionIsForward,
- PageKind ePageKind,
- EditMode eEditMode);
- virtual ~ViewIteratorImpl() override;
+ virtual ~DocumentIteratorImpl() override;
virtual void GotoNextText() override;
virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override;
virtual void Reverse() override;
-protected:
+private:
/** Set up page pointer and object list iterator for the specified
page.
@param nPageIndex
@@ -193,40 +192,12 @@ protected:
*/
void SetPage (sal_Int32 nPageIndex);
-private:
- /// Indicates whether a page changed occurred on switching to current page.
- bool mbPageChangeOccurred;
- /// Pointer to the page associated with the current page index. May be NULL.
- SdPage* mpPage;
/// Iterator of all objects on the current page.
std::optional<SdrObjListIter> moObjectIterator;
- // Don't use this operator.
- ViewIteratorImpl& operator= (const ViewIteratorImpl&) = delete;
-};
-
-/** Iterator for iteration over all objects in all views. It automatically
- switches views when reaching the end/beginning of a view.
-
- <p>For documentation of the methods please refer to the base class
- <type>IteratorImplBase</type>.</p>
-*/
-class DocumentIteratorImpl final : public ViewIteratorImpl
-{
-public:
- DocumentIteratorImpl (
- sal_Int32 nPageIndex,
- PageKind ePageKind,
- EditMode eEditMode,
- SdDrawDocument* pDocument,
- const std::weak_ptr<ViewShell>& rpViewShellWeak,
- bool bDirectionIsForward);
- virtual ~DocumentIteratorImpl() override;
-
- virtual void GotoNextText() override;
- virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override;
+ /// Pointer to the page associated with the current page index. May be NULL.
+ SdPage* mpPage;
-private:
/// Number of pages in the view that is specified by <member>maPosition</member>.
sal_Int32 mnPageCount;
diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx b/sd/source/ui/view/NotesPanelViewShell.cxx
index a13daeb9f6f0..5a5c9ec1407b 100644
--- a/sd/source/ui/view/NotesPanelViewShell.cxx
+++ b/sd/source/ui/view/NotesPanelViewShell.cxx
@@ -44,6 +44,7 @@
#include <futhes.hxx>
#include <memory>
#include <sdabstdlg.hxx>
+#include <sdmod.hxx>
#include <sdpage.hxx>
#include <sdresid.hxx>
#include <sfx2/bindings.hxx>
@@ -568,6 +569,7 @@ void NotesPanelViewShell::GetState(SfxItemSet& rSet)
{
switch (nWhich)
{
+ case FID_SEARCH_NOW:
case SID_SEARCH_ITEM:
case SID_SEARCH_OPTIONS:
// Call common (old) implementation in the document shell.
@@ -1331,15 +1333,49 @@ void NotesPanelViewShell::FuSupport(SfxRequest& rReq)
void NotesPanelViewShell::Execute(SfxRequest& rReq)
{
- bool bForwardCall = true;
-
switch (rReq.GetSlot())
{
+ case FID_SEARCH_NOW:
+ {
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+
+ sd::View* pView = nullptr;
+ if (auto pMainViewSh = GetViewShellBase().GetMainViewShell())
+ pView = pMainViewSh->GetView();
+
+ if (pReqArgs)
+ {
+ if (pView)
+ {
+ rtl::Reference<FuSearch>& xFuSearch
+ = pView->getSearchContext().getFunctionSearch();
+
+ if (!xFuSearch.is())
+ {
+ xFuSearch = rtl::Reference<FuSearch>(FuSearch::createPtr(
+ this, this->GetActiveWindow(), pView, GetDoc(), rReq));
+
+ pView->getSearchContext().setSearchFunction(xFuSearch);
+ }
+
+ if (xFuSearch.is())
+ {
+ const SvxSearchItem& rSearchItem = pReqArgs->Get(SID_SEARCH_ITEM);
+
+ SD_MOD()->SetSearchItem(
+ std::unique_ptr<SvxSearchItem>(rSearchItem.Clone()));
+ xFuSearch->SearchAndReplace(&rSearchItem);
+ }
+ }
+ }
+ rReq.Done();
+ }
+ break;
+
case SID_SEARCH_ITEM:
// Forward this request to the common (old) code of the
// document shell.
GetDocSh()->Execute(rReq);
- bForwardCall = false;
break;
case SID_SPELL_DIALOG:
@@ -1355,16 +1391,12 @@ void NotesPanelViewShell::Execute(SfxRequest& rReq)
pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
rReq.Done();
- bForwardCall = false;
}
break;
default:
break;
}
-
- if (bForwardCall)
- TextObjectBar::ExecuteImpl(this, mpView, rReq, nullptr);
}
void NotesPanelViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 4d00939fc53e..ed0045b3c8a2 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -49,10 +49,12 @@
#include <DrawViewShell.hxx>
#include <OutlineView.hxx>
#include <OutlineViewShell.hxx>
+#include <NotesPanelView.hxx>
#include <drawdoc.hxx>
#include <DrawDocShell.hxx>
#include <drawview.hxx>
#include <ViewShellBase.hxx>
+#include <ViewShellManager.hxx>
#include <SpellDialogChildWindow.hxx>
#include <framework/FrameworkHelper.hxx>
#include <svx/svxids.hrc>
@@ -62,6 +64,7 @@
#include <comphelper/scopeguard.hxx>
#include <VectorGraphicSearchContext.hxx>
#include <fusearch.hxx>
+#include <sdpage.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -127,6 +130,30 @@ sd::ViewShellBase* getViewShellBase()
return dynamic_cast<sd::ViewShellBase*>(SfxViewShell::Current());
}
+OutlinerView* lclGetNotesPaneOutliner(const std::shared_ptr<sd::ViewShell>& pViewShell)
+{
+ if (!pViewShell)
+ return nullptr;
+
+ // request the notes pane
+ sd::ViewShellBase& rBase = pViewShell->GetViewShellBase();
+
+ sd::framework::FrameworkHelper::Instance(rBase)->RequestView(
+ sd::framework::FrameworkHelper::msNotesPanelViewURL,
+ sd::framework::FrameworkHelper::msBottomImpressPaneURL);
+
+ auto pInstance = sd::framework::FrameworkHelper::Instance(rBase);
+ pInstance->RequestSynchronousUpdate();
+
+ std::shared_ptr<sd::ViewShell> pNotesPaneShell(
+ pInstance->GetViewShell(sd::framework::FrameworkHelper::msBottomImpressPaneURL));
+
+ if (!pNotesPaneShell)
+ return nullptr;
+
+ return static_cast<sd::NotesPanelView*>(pNotesPaneShell->GetView())->GetOutlinerView();
+}
+
} // end anonymous namespace
SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode )
@@ -896,6 +923,14 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
if (mpSearchItem->GetCommand() != SvxSearchCmd::REPLACE_ALL)
{
nMatchCount = getOutlinerView()->StartSearchAndReplace(*mpSearchItem);
+ if (nMatchCount && maCurrentPosition.meEditMode == EditMode::Page
+ && maCurrentPosition.mePageKind == PageKind::Notes)
+ {
+ if(auto pNotesPaneOutliner = lclGetNotesPaneOutliner(pViewShell))
+ {
+ pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection());
+ }
+ }
}
}
@@ -917,14 +952,25 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
// necessary anymore.
DBG_ASSERT(GetEditEngine().HasView(&getOutlinerView()->GetEditView() ),
"SearchAndReplace without valid view!" );
- if ( ! GetEditEngine().HasView( &getOutlinerView()->GetEditView() ) )
+ if ( ! GetEditEngine().HasView( &getOutlinerView()->GetEditView() )
+ && maCurrentPosition.mePageKind != PageKind::Notes )
{
mpDrawDocument->GetDocSh()->SetWaitCursor( false );
return true;
}
if (meMode == SEARCH)
- getOutlinerView()->StartSearchAndReplace(*mpSearchItem);
+ {
+ auto nMatch = getOutlinerView()->StartSearchAndReplace(*mpSearchItem);
+ if (nMatch && maCurrentPosition.meEditMode == EditMode::Page
+ && maCurrentPosition.mePageKind == PageKind::Notes)
+ {
+ if(auto pNotesPaneOutliner = lclGetNotesPaneOutliner(pViewShell))
+ {
+ pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection());
+ }
+ }
+ }
}
}
}
@@ -972,10 +1018,30 @@ void SdOutliner::DetectChange()
std::shared_ptr<sd::DrawViewShell> pDrawViewShell (
std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell));
+ std::shared_ptr<sd::ViewShell> pOverridingViewShell{};
+ if(sd::ViewShellBase* pBase = getViewShellBase())
+ {
+ if (const std::shared_ptr<sd::ViewShellManager>& pViewShellManager = pBase->GetViewShellManager())
+ pOverridingViewShell = pViewShellManager->GetOverridingMainShell();
+ }
+
+ bool bViewChanged = false;
+
+ if( pDrawViewShell )
+ {
+ if( !pOverridingViewShell )
+ bViewChanged = (aPosition.meEditMode != pDrawViewShell->GetEditMode() || aPosition.mePageKind != pDrawViewShell->GetPageKind());
+ else
+ {
+ auto pPage = pOverridingViewShell->getCurrentPage();
+ auto ePageKind = pPage ? pPage->GetPageKind() : PageKind::Standard;
+ auto eEditMode = EditMode::Page;
+ bViewChanged = (aPosition.meEditMode != eEditMode || aPosition.mePageKind != ePageKind);
+ }
+ }
+
// Detect whether the view has been switched from the outside.
- if (pDrawViewShell != nullptr
- && (aPosition.meEditMode != pDrawViewShell->GetEditMode()
- || aPosition.mePageKind != pDrawViewShell->GetPageKind()))
+ if( bViewChanged )
{
// Either the edit mode or the page kind has changed.
SetStatusEventHdl(Link<EditStatus&,void>());
@@ -1527,12 +1593,20 @@ void SdOutliner::PrepareSearchAndReplace()
EnterEditMode(false);
- mpDrawDocument->GetDocSh()->SetWaitCursor( false );
- // Start search at the right end of the current object's text
- // depending on the search direction.
+ mpDrawDocument->GetDocSh()->SetWaitCursor(false);
+
OutlinerView* pOutlinerView = getOutlinerView();
if (pOutlinerView != nullptr)
+ {
pOutlinerView->SetSelection (GetSearchStartPosition ());
+ if (lclIsValidTextObject(maCurrentPosition) && maCurrentPosition.mePageKind == PageKind::Notes)
+ {
+ if (auto pNotesPaneOutliner = lclGetNotesPaneOutliner(mpWeakViewShell.lock()))
+ {
+ pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection());
+ }
+ }
+ }
}
void SdOutliner::SetViewMode (PageKind ePageKind)
@@ -1660,8 +1734,43 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
// Turn on the edit mode for the text object.
SetUpdateLayout(true);
- mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this,
- pOutlinerView, true, true, bGrabFocus);
+
+ if(maCurrentPosition.mePageKind == PageKind::Notes
+ && maCurrentPosition.meEditMode == EditMode::Page)
+ {
+ sd::ViewShellBase& rBase = pViewShell->GetViewShellBase();
+
+ sd::framework::FrameworkHelper::Instance(rBase)->RequestView(
+ sd::framework::FrameworkHelper::msNotesPanelViewURL,
+ sd::framework::FrameworkHelper::msBottomImpressPaneURL);
+
+ auto pInstance = sd::framework::FrameworkHelper::Instance(rBase);
+ pInstance->RequestSynchronousUpdate();
+
+ std::shared_ptr<sd::ViewShell> pNotesPaneShell(pInstance->GetViewShell(sd::framework::FrameworkHelper::msBottomImpressPaneURL));
+ if(pNotesPaneShell)
+ {
+ pNotesPaneShell->GetParentWindow()->GrabFocus();
+ pNotesPaneShell->GetContentWindow()->GrabFocus();
+ }
+ }
+ else
+ {
+ std::shared_ptr<sd::ViewShell> pOverridingViewShell{};
+ sd::ViewShellBase* pBase = getViewShellBase();
+ if (auto pViewShellManager = pBase->GetViewShellManager())
+ pOverridingViewShell = pViewShellManager->GetOverridingMainShell();
+
+ if (pOverridingViewShell)
+ {
+ getViewShellBase()->GetMainViewShell()->GetParentWindow()->GrabFocus();
+ getViewShellBase()->GetMainViewShell()->GetContentWindow()->GrabFocus();
+ bGrabFocus = true;
+ }
+
+ mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this, pOutlinerView,
+ true, true, bGrabFocus);
+ }
mbFoundObject = true;
}
@@ -1733,8 +1842,25 @@ bool SdOutliner::HandleFailedSearch()
SdrObject* SdOutliner::SetObject (
const sd::outliner::IteratorPosition& rPosition)
{
- SetViewMode (rPosition.mePageKind);
- SetPage (rPosition.meEditMode, static_cast<sal_uInt16>(rPosition.mnPageIndex));
+ if(rPosition.meEditMode == EditMode::Page && rPosition.mePageKind == PageKind::Notes)
+ {
+ std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
+ std::shared_ptr<sd::DrawViewShell> pDrawViewShell(
+ std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell));
+
+ if (pDrawViewShell->GetEditMode() != EditMode::Page
+ || pDrawViewShell->GetCurPagePos() != rPosition.mnPageIndex)
+ SetPage(EditMode::Page, static_cast<sal_uInt16>(rPosition.mnPageIndex));
+
+ mnText = rPosition.mnText;
+ return rPosition.mxObject.get().get();
+ }
+ else
+ {
+ SetViewMode(rPosition.mePageKind);
+ SetPage(rPosition.meEditMode, static_cast<sal_uInt16>(rPosition.mnPageIndex));
+ }
+
mnText = rPosition.mnText;
return rPosition.mxObject.get().get();
}
diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx
index a7cd6cf66bf2..492880e9bf7c 100644
--- a/sd/source/ui/view/OutlinerIterator.cxx
+++ b/sd/source/ui/view/OutlinerIterator.cxx
@@ -28,6 +28,8 @@
#include <DrawViewShell.hxx>
#include <sdpage.hxx>
#include <utility>
+#include <ViewShellBase.hxx>
+#include <ViewShellManager.hxx>
namespace sd::outliner {
@@ -149,6 +151,11 @@ Iterator OutlinerContainer::current()
Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation)
{
+ std::shared_ptr<sd::ViewShell> pOverridingShell{};
+ if (auto pBase = dynamic_cast<sd::ViewShellBase*>(SfxViewShell::Current()))
+ if (auto pViewShellManager = pBase->GetViewShellManager())
+ pOverridingShell = pViewShellManager->GetOverridingMainShell();
+
// Decide on certain features of the outliner which kind of iterator to
// use.
if (mpOutliner->mbRestrictSearchToSelection)
@@ -156,6 +163,7 @@ Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation)
return CreateSelectionIterator (
mpOutliner->maMarkListCopy,
mpOutliner->mpDrawDocument,
+ pOverridingShell ? pOverridingShell :
mpOutliner->mpWeakViewShell.lock(),
mpOutliner->mbDirectionIsForward,
aLocation);
@@ -163,6 +171,7 @@ Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation)
// Search in the whole document.
return CreateDocumentIterator (
mpOutliner->mpDrawDocument,
+ pOverridingShell ? pOverridingShell :
mpOutliner->mpWeakViewShell.lock(),
mpOutliner->mbDirectionIsForward,
aLocation);
@@ -258,7 +267,8 @@ Iterator OutlinerContainer::CreateDocumentIterator (
}
else
{
- ePageKind = PageKind::Standard;
+ auto pPage = rpViewShell->getCurrentPage();
+ ePageKind = pPage ? pPage->GetPageKind() : PageKind::Standard;
eEditMode = EditMode::Page;
}
break;
@@ -502,144 +512,35 @@ bool SelectionIteratorImpl::IsEqualSelection(const IteratorImplBase& rIterator)
&& mnObjectIndex == pSelectionIterator->mnObjectIndex;
}
-//===== ViewIteratorImpl ================================================
-
-ViewIteratorImpl::ViewIteratorImpl (
- sal_Int32 nPageIndex,
- SdDrawDocument* pDocument,
- const std::weak_ptr<ViewShell>& rpViewShellWeak,
- bool bDirectionIsForward)
- : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward),
- mbPageChangeOccurred(false),
- mpPage(nullptr)
-{
- SetPage (nPageIndex);
-}
-
-ViewIteratorImpl::ViewIteratorImpl (
- sal_Int32 nPageIndex,
- SdDrawDocument* pDocument,
- const std::weak_ptr<ViewShell>& rpViewShellWeak,
- bool bDirectionIsForward,
- PageKind ePageKind,
- EditMode eEditMode)
- : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, ePageKind, eEditMode),
- mbPageChangeOccurred(false),
- mpPage(nullptr)
-{
- SetPage (nPageIndex);
-}
-
-ViewIteratorImpl::~ViewIteratorImpl()
-{
-}
-
-IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const
+void DocumentIteratorImpl::SetPage(sal_Int32 nPageIndex)
{
+ maPosition.mnPageIndex = nPageIndex;
- ViewIteratorImpl* pIterator = static_cast<ViewIteratorImpl*>(pObject);
- if (pIterator == nullptr)
- pIterator = new ViewIteratorImpl (
- maPosition.mnPageIndex, mpDocument, mpViewShellWeak, mbDirectionIsForward);
-
- IteratorImplBase::Clone (pObject);
-
- if (moObjectIterator)
- {
- pIterator->moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward);
-
- // No direct way to set the object iterator to the current object.
- pIterator->maPosition.mxObject = nullptr;
- while (pIterator->moObjectIterator->IsMore() && pIterator->maPosition.mxObject.get()!=maPosition.mxObject.get())
- pIterator->maPosition.mxObject = pIterator->moObjectIterator->Next();
- }
- else
- pIterator->moObjectIterator.reset();
-
- return pIterator;
-}
-
-void ViewIteratorImpl::GotoNextText()
-{
- SdrTextObj* pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() );
- if( pTextObj )
- {
- if (mbDirectionIsForward)
- {
- ++maPosition.mnText;
- if( maPosition.mnText < pTextObj->getTextCount() )
- return;
- }
- else
- {
- --maPosition.mnText;
- if( maPosition.mnText >= 0 )
- return;
- }
- }
-
- if (moObjectIterator && moObjectIterator->IsMore())
- maPosition.mxObject = moObjectIterator->Next();
+ sal_Int32 nPageCount;
+ if (maPosition.meEditMode == EditMode::Page)
+ nPageCount = mpDocument->GetSdPageCount(maPosition.mePageKind);
else
- maPosition.mxObject = nullptr;
-
- if (!maPosition.mxObject.get().is() )
+ nPageCount = mpDocument->GetMasterSdPageCount(
+ maPosition.mePageKind);
+
+ // Get page pointer. Here we have three cases: regular pages,
+ // master pages and invalid page indices. The later ones are not
+ // errors but the effect of the iterator advancing to the next page
+ // and going past the last one. This dropping of the rim at the far
+ // side is detected here and has to be reacted to by the caller.
+ if (nPageIndex>=0 && nPageIndex < nPageCount)
{
- if (mbDirectionIsForward)
- SetPage (maPosition.mnPageIndex+1);
- else
- SetPage (maPosition.mnPageIndex-1);
-
- if (mpPage != nullptr)
- moObjectIterator.emplace( mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward );
- if (moObjectIterator && moObjectIterator->IsMore())
- maPosition.mxObject = moObjectIterator->Next();
- else
- maPosition.mxObject = nullptr;
- }
-
- maPosition.mnText = 0;
- if( !mbDirectionIsForward && maPosition.mxObject.get().is() )
- {
- pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() );
- if( pTextObj )
- maPosition.mnText = pTextObj->getTextCount() - 1;
- }
-}
-
-void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex)
-{
- mbPageChangeOccurred = (maPosition.mnPageIndex!=nPageIndex);
- if (mbPageChangeOccurred)
- {
- maPosition.mnPageIndex = nPageIndex;
-
- sal_Int32 nPageCount;
if (maPosition.meEditMode == EditMode::Page)
- nPageCount = mpDocument->GetSdPageCount(maPosition.mePageKind);
- else
- nPageCount = mpDocument->GetMasterSdPageCount(
+ mpPage = mpDocument->GetSdPage (
+ static_cast<sal_uInt16>(nPageIndex),
maPosition.mePageKind);
-
- // Get page pointer. Here we have three cases: regular pages,
- // master pages and invalid page indices. The later ones are not
- // errors but the effect of the iterator advancing to the next page
- // and going past the last one. This dropping of the rim at the far
- // side is detected here and has to be reacted to by the caller.
- if (nPageIndex>=0 && nPageIndex < nPageCount)
- {
- if (maPosition.meEditMode == EditMode::Page)
- mpPage = mpDocument->GetSdPage (
- static_cast<sal_uInt16>(nPageIndex),
- maPosition.mePageKind);
- else
- mpPage = mpDocument->GetMasterSdPage (
- static_cast<sal_uInt16>(nPageIndex),
- maPosition.mePageKind);
- }
else
- mpPage = nullptr;
+ mpPage = mpDocument->GetMasterSdPage (
+ static_cast<sal_uInt16>(nPageIndex),
+ maPosition.mePageKind);
}
+ else
+ mpPage = nullptr;
// Set up object list iterator.
if (mpPage != nullptr)
@@ -663,7 +564,7 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex)
}
-void ViewIteratorImpl::Reverse()
+void DocumentIteratorImpl::Reverse()
{
IteratorImplBase::Reverse ();
@@ -692,13 +593,14 @@ DocumentIteratorImpl::DocumentIteratorImpl (
SdDrawDocument* pDocument,
const std::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward)
- : ViewIteratorImpl (nPageIndex, pDocument, rpViewShellWeak, bDirectionIsForward,
- ePageKind, eEditMode)
+ : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, ePageKind, eEditMode)
+ , mpPage(nullptr)
{
if (eEditMode == EditMode::Page)
mnPageCount = pDocument->GetSdPageCount (ePageKind);
else
mnPageCount = pDocument->GetMasterSdPageCount(ePageKind);
+ SetPage(nPageIndex);
}
DocumentIteratorImpl::~DocumentIteratorImpl()
@@ -712,7 +614,21 @@ IteratorImplBase* DocumentIteratorImpl::Clone (IteratorImplBase* pObject) const
maPosition.mnPageIndex, maPosition.mePageKind, maPosition.meEditMode,
mpDocument, mpViewShellWeak, mbDirectionIsForward);
// Finish the cloning.
- return ViewIteratorImpl::Clone (pIterator);
+ IteratorImplBase::Clone (pObject);
+
+ if (moObjectIterator)
+ {
+ pIterator->moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward);
+
+ // No direct way to set the object iterator to the current object.
+ pIterator->maPosition.mxObject = nullptr;
+ while (pIterator->moObjectIterator->IsMore() && pIterator->maPosition.mxObject.get()!=maPosition.mxObject.get())
+ pIterator->maPosition.mxObject = pIterator->moObjectIterator->Next();
+ }
+ else
+ pIterator->moObjectIterator.reset();
+
+ return pIterator;
}
void DocumentIteratorImpl::GotoNextText()
@@ -720,7 +636,72 @@ void DocumentIteratorImpl::GotoNextText()
bool bSetToOnePastLastPage = false;
bool bViewChanged = false;
- ViewIteratorImpl::GotoNextText();
+ SdrTextObj* pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() );
+ if( pTextObj )
+ {
+ if (mbDirectionIsForward)
+ {
+ ++maPosition.mnText;
+ if( maPosition.mnText < pTextObj->getTextCount() )
+ return;
+ }
+ else
+ {
+ --maPosition.mnText;
+ if( maPosition.mnText >= 0 )
+ return;
+ }
+ }
+
+ if (moObjectIterator && moObjectIterator->IsMore())
+ maPosition.mxObject = moObjectIterator->Next();
+ else
+ maPosition.mxObject = nullptr;
+
+ if (!maPosition.mxObject.get().is() )
+ {
+ if (maPosition.meEditMode == EditMode::Page
+ && maPosition.mePageKind == PageKind::Standard)
+ {
+ maPosition.mePageKind = PageKind::Notes;
+ if (mbDirectionIsForward)
+ SetPage(maPosition.mnPageIndex);
+ else
+ SetPage(maPosition.mnPageIndex - 1);
+ }
+ else if (maPosition.meEditMode == EditMode::Page
+ && maPosition.mePageKind == PageKind::Notes)
+ {
+ maPosition.mePageKind = PageKind::Standard;
+ if (mbDirectionIsForward)
+ SetPage(maPosition.mnPageIndex + 1);
+ else
+ SetPage(maPosition.mnPageIndex);
+ }
+ else
+ {
+ if (mbDirectionIsForward)
+ SetPage(maPosition.mnPageIndex + 1);
+ else
+ SetPage(maPosition.mnPageIndex - 1);
+ }
+
+ if (mpPage != nullptr)
+ moObjectIterator.emplace( mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward );
+ if (moObjectIterator && moObjectIterator->IsMore())
+ maPosition.mxObject = moObjectIterator->Next();
+ else
+ maPosition.mxObject = nullptr;
+ }
+
+ maPosition.mnText = 0;
+ if( !mbDirectionIsForward && maPosition.mxObject.get().is() )
+ {
+ pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() );
+ if( pTextObj )
+ maPosition.mnText = pTextObj->getTextCount() - 1;
+ }
+
if (mbDirectionIsForward)
{
@@ -732,67 +713,74 @@ void DocumentIteratorImpl::GotoNextText()
maPosition.meEditMode = EditMode::MasterPage;
SetPage (0);
}
-
// Switch to next view mode.
else
{
if (maPosition.mePageKind == PageKind::Handout)
- // Not really necessary but makes things more clear.
+ {
+ // search wrapped
bSetToOnePastLastPage = true;
- else
+ }
+ else if (maPosition.mePageKind == PageKind::Standard)
{
- maPosition.meEditMode = EditMode::Page;
- if (maPosition.mePageKind == PageKind::Standard)
- maPosition.mePageKind = PageKind::Notes;
- else if (maPosition.mePageKind == PageKind::Notes)
- maPosition.mePageKind = PageKind::Handout;
- SetPage (0);
+ // switch to master notes
+ maPosition.mePageKind = PageKind::Notes;
+ SetPage(0);
+ }
+ else if (maPosition.mePageKind == PageKind::Notes)
+ {
+ // switch to master handout
+ maPosition.mePageKind = PageKind::Handout;
+ SetPage(0);
}
}
bViewChanged = true;
}
}
else
+ {
if (maPosition.mnPageIndex < 0)
{
- // Switch from master pages to draw pages.
if (maPosition.meEditMode == EditMode::MasterPage)
{
- maPosition.meEditMode = EditMode::Page;
- bSetToOnePastLastPage = true;
- }
-
- // Switch to previous view mode.
- else
- {
if (maPosition.mePageKind == PageKind::Standard)
- SetPage (-1);
- else
{
- maPosition.meEditMode = EditMode::MasterPage;
- if (maPosition.mePageKind == PageKind::Handout)
- maPosition.mePageKind = PageKind::Notes;
- else if (maPosition.mePageKind == PageKind::Notes)
- maPosition.mePageKind = PageKind::Standard;
+ maPosition.meEditMode = EditMode::Page;
+ maPosition.mePageKind = PageKind::Notes;
+ bSetToOnePastLastPage = true;
+ }
+ else if (maPosition.mePageKind == PageKind::Handout)
+ {
+ maPosition.mePageKind = PageKind::Notes;
+ bSetToOnePastLastPage = true;
+ }
+ else if (maPosition.mePageKind == PageKind::Notes)
+ {
+ maPosition.mePageKind = PageKind::Standard;
bSetToOnePastLastPage = true;
}
}
- bViewChanged = true;
+ else
+ {
+ // search wrapped
+ SetPage(-1);
+ }
}
+ bViewChanged = true;
+ }
if (!bViewChanged)
return;
// Get new page count;
- sal_Int32 nPageCount;
if (maPosition.meEditMode == EditMode::Page)
- nPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind);
+ mnPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind);
else
- nPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind);
+ mnPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind);
// Now that we know the number of pages we can set the current page index.
if (bSetToOnePastLastPage)
- SetPage (nPageCount);
+ SetPage (mnPageCount);
}
} // end of namespace ::sd::outliner
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 9e1e676427a5..5d6cd9d55aed 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1924,6 +1924,7 @@ void DrawViewShell::GetState (SfxItemSet& rSet)
{
switch (nWhich)
{
+ case FID_SEARCH_NOW:
case SID_SEARCH_ITEM:
case SID_SEARCH_OPTIONS:
// Forward this request to the common (old) code of the
@@ -1949,6 +1950,12 @@ void DrawViewShell::Execute (SfxRequest& rReq)
switch (rReq.GetSlot())
{
+ case FID_SEARCH_NOW:
+ // Forward this request to the common (old) code of the
+ // document shell.
+ GetDocSh()->Execute(rReq);
+ break;
+
case SID_SEARCH_ITEM:
// Forward this request to the common (old) code of the
// document shell.