LibreOffice Module sd (master) 1
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
SdOutliner Class Referencefinal

The main purpose of this class is searching and replacing as well as spelling of impress documents. More...

#include <Outliner.hxx>

Inheritance diagram for SdOutliner:
[legend]
Collaboration diagram for SdOutliner:
[legend]

Classes

class  Implementation
 

Public Member Functions

 SdOutliner (SdDrawDocument *pDoc, OutlinerMode nMode)
 Create a new sd outliner object. More...
 
virtual ~SdOutliner () override
 Nothing spectacular in the destructor. More...
 
 SdOutliner (const Outliner &)=delete
 Forbid copy construction and copy assignment. More...
 
SdOutlineroperator= (const Outliner &)=delete
 
void PrepareSpelling ()
 Despite the name this method is called prior to spell checking and searching and replacing. More...
 
void StartSpelling ()
 Initialize a spell check but do not start it yet. More...
 
bool StartSearchAndReplace (const SvxSearchItem *pSearchItem)
 Initiate a find and/or replace on the next relevant text object. More...
 
svx::SpellPortions GetNextSpellSentence ()
 Iterate over the sentences in all text shapes and stop at the next sentence with spelling errors. More...
 
void EndSpelling ()
 Release all resources that have been created during the find&replace or spell check. More...
 
bool ConvertNextDocument () override
 callback for textconversion More...
 
void StartConversion (LanguageType nSourceLanguage, LanguageType nTargetLanguage, const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive)
 Starts the text conversion (hangul/hanja or Chinese simplified/traditional) for the current viewshell. More...
 
void BeginConversion ()
 This is called internally when text conversion is started. More...
 
void EndConversion ()
 Release all resources that have been created during the conversion. More...
 
int GetIgnoreCurrentPageChangesLevel () const
 
void IncreIgnoreCurrentPageChangesLevel ()
 
void DecreIgnoreCurrentPageChangesLevel ()
 
SdDrawDocumentGetDoc () const
 
- Public Member Functions inherited from SdrOutliner
 SdrOutliner (SfxItemPool *pItemPool, OutlinerMode nMode)
 
virtual ~SdrOutliner () override
 
void SetTextObj (const SdrTextObj *pObj)
 
void SetTextObjNoInit (const SdrTextObj *pObj)
 
const SdrTextObjGetTextObj () const
 
void setVisualizedPage (const SdrPage *pPage)
 
const SdrPagegetVisualizedPage () const
 
virtual OUString CalcFieldValue (const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, std::optional< FontLineStyle > &rpFldLineStyle) override
 
bool hasEditViewCallbacks () const
 
virtual std::optional< bool > GetCompatFlag (SdrCompatibilityFlag eFlag) const override
 

Private Types

enum  mode {
  SEARCH ,
  SPELL ,
  TEXT_CONVERSION
}
 Specifies whether to search and replace, to spell check or to do a text conversion. More...
 

Private Member Functions

OutlinerViewgetOutlinerView ()
 Returns the current outline view. More...
 
void Initialize (bool bDirectionIsForward)
 Initialize the object iterator. More...
 
bool SearchAndReplaceAll ()
 Do search and replace for whole document. More...
 
bool SearchAndReplaceOnce (std::vector<::sd::SearchSelection > *pSelections=nullptr)
 Do search and replace for next match. More...
 
void sendLOKSearchResultCallback (const std::shared_ptr< sd::ViewShell > &pViewShell, const OutlinerView *pOutlinerView, std::vector< sd::SearchSelection > *pSelections)
 
void DetectChange ()
 Detect changes of the document or view and react accordingly. More...
 
bool DetectSelectionChange ()
 Detect whether the selection has changed. More...
 
void RememberStartPosition ()
 Remember the current edited object/caret position/page/view mode when starting to search/spell check so that it can be restored on termination. More...
 
void RestoreStartPosition ()
 Restore the position stored in the last call of <member>RememberStartPositiony</member>. More...
 
void ProvideNextTextObject ()
 Provide next object to search or spell check as text object in edit mode on the current page. More...
 
void EndOfSearch ()
 Handle the situation that the iterator has reached the last object. More...
 
void ShowEndOfSearchDialog ()
 Show a dialog that tells the user that the search has ended either because there are no more matches after finding at least one or that no match has been found at all. More...
 
bool ShowWrapAroundDialog ()
 Show a dialog that asks the user whether to wrap around to the beginning/end of the document and continue with the search/spell check. More...
 
void PutTextIntoOutliner ()
 Put text of current text object into outliner so that the text can be searched/spell checked. More...
 
void PrepareSpellCheck ()
 Prepare to do spell checking on the current text object. More...
 
void PrepareSearchAndReplace ()
 Prepare to search and replace on the current text object. More...
 
void PrepareConversion ()
 Prepare to do a text conversion on the current text object. More...
 
void SetViewMode (PageKind ePageKind)
 Switch to a new view mode. More...
 
void SetPage (EditMode eEditMode, sal_uInt16 nPageIndex)
 Switch to the page or master page specified by the <member>mnPage</member> index. More...
 
void EnterEditMode (bool bGrabFocus)
 Switch on edit mode for the currently selected text object. More...
 
ESelection GetSearchStartPosition () const
 Return the position at which a new search is started with respect to the search direction as specified by the argument. More...
 
bool HasNoPreviousMatch ()
 Detect whether there exists a previous match. More...
 
bool HandleFailedSearch ()
 Handle a failed search (with or without replace) for the outline mode. More...
 
SdrObjectSetObject (const ::sd::outliner::IteratorPosition &rPosition)
 Take a position as returned by an object iterator and switch to the view and page on which the object specified by this position is located. More...
 
void SetViewShell (const std::shared_ptr<::sd::ViewShell > &rpViewShell)
 Use this method when the view shell in which to search has changed. More...
 
void HandleChangedSelection ()
 Activate or deactivate the search in the current selection. More...
 
virtual bool SpellNextDocument () override
 Initiate the spell check of the next relevant text object. More...
 
weld::WindowGetMessageBoxParent ()
 Find the right parent to use for a message. More...
 

Private Attributes

::std::unique_ptr< ImplementationmpImpl
 
enum SdOutliner::mode meMode
 
::sd::ViewmpView
 The view which displays the searched objects. More...
 
std::weak_ptr<::sd::ViewShellmpWeakViewShell
 The view shell containing the view. More...
 
VclPtr<::sd::WindowmpWindow
 This window contains the view. More...
 
SdDrawDocumentmpDrawDocument
 The document on whose objects and pages this class operates. More...
 
LanguageType mnConversionLanguage
 this is the language that is used for current text conversion. More...
 
int mnIgnoreCurrentPageChangesLevel
 While the value of this flag is greater than 0 changes of the current page do not lead to selecting the corresponding text in the outliner. More...
 
bool mbStringFound
 Specifies whether the search string has been found so far. More...
 
bool mbMatchMayExist
 This flag indicates whether there may exist a match of the search string before/after the current position in the document. More...
 
sal_uInt16 mnPageCount
 The number of pages in the current view. More...
 
bool mbEndOfSearch
 A <TRUE> value indicates that the end of the find&replace or spell check has been reached. More...
 
bool mbFoundObject
 Set to <TRUE> when an object has been prepared successfully for searching/spell checking. More...
 
bool mbDirectionIsForward
 This flag indicates whether to search forward or backwards. More...
 
bool mbRestrictSearchToSelection
 This flag indicates that only the selected objects are to be searched. More...
 
::std::vector< unotools::WeakReference< SdrObject > > maMarkListCopy
 When the search is restricted to the current selection then this list contains pointers to all the objects of the selection. More...
 
SdrObjectmpObj
 Current object that may be a text object. More...
 
SdrObjectmpFirstObj
 this stores the first object that is used for text conversion. More...
 
SdrTextObjmpSearchSpellTextObj
 Candidate for being searched/spell checked. More...
 
sal_Int32 mnText
 Current text to be searched/spelled inside the current text object. More...
 
OutlinerParaObjectmpParaObj
 Paragraph object of <member>mpTextObj</member>. More...
 
PageKind meStartViewMode
 The view mode that was active when starting to search/spell check. More...
 
EditMode meStartEditMode
 The master page mode that was active when starting to search/spell check. More...
 
sal_uInt16 mnStartPageIndex
 The current page index on starting to search/spell check. More...
 
SdrObjectmpStartEditedObject
 The object in edit mode when searching /spell checking was started (if any). More...
 
ESelection maStartSelection
 The position of the caret when searching /spell checking was started. More...
 
std::unique_ptr< const SvxSearchItemmpSearchItem
 The search item contains various attributes that define the type of search. More...
 
::sd::outliner::Iterator maObjectIterator
 The actual object iterator. More...
 
::sd::outliner::IteratorPosition maCurrentPosition
 The current position of the object iterator. More...
 
::sd::outliner::Iterator maSearchStartPosition
 The position when the search started. More...
 
::sd::outliner::IteratorPosition maLastValidPosition
 The last valid position describes where the last text object has been found. More...
 
bool mbPrepareSpellingPending
 When this flag is true then a PrepareSpelling() is executed when StartSearchAndReplace() is called the next time. More...
 

Friends

class ::sd::outliner::OutlinerContainer
 

Detailed Description

The main purpose of this class is searching and replacing as well as spelling of impress documents.

The main part of both tasks lies in iterating over the pages and view modes of a document and apply the respective function to all objects containing text on those pages.

Relevant objects: There are two sets of objects to search/spell check. One is the set of all selected objects. The other consists of all objects on all pages in draw-, notes-, and handout view as well as slide- and background view (draw pages and master pages).

Iteration: Search/replace and spelling functions operate on shapes containing text. To cover all relevant objects an order has to be defined on the objects. For the set of all selected objects this order is simply the order in which they can be retrieved from the selection object.
When there is no selection the order is nested. The three modes of the draw view are on the outer level: draw mode, notes mode, handout mode. The inner level switches between draw pages and master pages. This leads to the following order:

  1. draw pages of draw mode
  2. master pages of draw mode
  3. draw pages of notes mode
  4. master pages of notes mode
  5. draw pages of handout mode
  6. master pages of handout mode

Iteration starts at the top of the current page. When reaching the end of the document, i.e. the last master page of the handout mode, it jumps to the first draw page of draw mode. In backward searches this order is reversed. When doing a replace all then the whole document is searched for matches starting at the first page of the draw/slide view (or last page of handout/background view even though search direction).

The start position is restored after finishing spell checking or replacing all matches in a document.

Some related pieces of information: The search dialog (<type>SvxSearchDialog</type>) can be controlled in more than one way:

Definition at line 122 of file Outliner.hxx.

Member Enumeration Documentation

◆ mode

enum SdOutliner::mode
private

Specifies whether to search and replace, to spell check or to do a text conversion.

Enumerator
SEARCH 
SPELL 
TEXT_CONVERSION 

Definition at line 207 of file Outliner.hxx.

Constructor & Destructor Documentation

◆ SdOutliner() [1/2]

SdOutliner::SdOutliner ( SdDrawDocument pDoc,
OutlinerMode  nMode 
)

Create a new sd outliner object.

Parameters
pDocThe draw document from which to take the content.
nModeThe valid values <const>OutlinerMode::DontKnow</const>, <const>OutlinerMode::TextObject</const>, <const>OutlinerMode::TitleObject</const>, <const>OutlinerMode::OutlineObject</const>, and <const>OutlinerMode::OutlineView</const> are defined in editeng/outliner.hxx.

Definition at line 132 of file Outliner.cxx.

References Any, SdDrawDocument::GetDocSh(), SdrModel::GetForbiddenCharsTable(), LinguMgr::GetHyphenator(), SdrModel::GetItemPool(), SdDrawDocument::GetOnlineSpell(), SvtLinguConfig::GetProperty(), Application::GetSettings(), LinguMgr::GetSpellChecker(), SdrModel::GetStyleSheetPool(), LANGUAGE_NONE, LINK, meMode, mpDrawDocument, mpView, mpWindow, SD_MOD, SEARCH, Standard, and UPN_IS_SPELL_AUTO.

◆ ~SdOutliner()

SdOutliner::~SdOutliner ( )
overridevirtual

Nothing spectacular in the destructor.

Definition at line 212 of file Outliner.cxx.

◆ SdOutliner() [2/2]

SdOutliner::SdOutliner ( const Outliner )
delete

Forbid copy construction and copy assignment.

Member Function Documentation

◆ BeginConversion()

void SdOutliner::BeginConversion ( )

This is called internally when text conversion is started.

The position of current view mode/page/object/caret position is remembered and will be restored after conversion.

Definition at line 1845 of file Outliner.cxx.

References sd::ViewShellBase::GetMainViewShell(), HandleChangedSelection(), maObjectIterator, maSearchStartPosition, mbMatchMayExist, mbStringFound, mpImpl, mpWeakViewShell, mpWindow, RememberStartPosition(), SD_MOD, and SetViewShell().

Referenced by StartConversion(), and sd::FuHangulHanjaConversion::StartConversion().

◆ ConvertNextDocument()

bool SdOutliner::ConvertNextDocument ( )
override

◆ DecreIgnoreCurrentPageChangesLevel()

void SdOutliner::DecreIgnoreCurrentPageChangesLevel ( )
inline

Definition at line 195 of file Outliner.hxx.

References mnIgnoreCurrentPageChangesLevel.

◆ DetectChange()

void SdOutliner::DetectChange ( )
private

Detect changes of the document or view and react accordingly.

Try to detect whether the document or the view (shell) has changed since the last time <member>StartSearchAndReplace()</member> has been called.

Such changes may occur because different calls to <member>SearchAndReplace()</member> there usually is user interaction. This is at least the press of the search or replace button but may include any other action some of which affect the search.

Definition at line 967 of file Outliner.cxx.

References sd::outliner::OutlinerContainer::current(), DetectSelectionChange(), getOutlinerView(), SdDrawDocument::GetSdPageCount(), SdrPaintView::GetSdrPageView(), HandleChangedSelection(), maCurrentPosition, maObjectIterator, MasterPage, sd::outliner::IteratorPosition::meEditMode, meMode, sd::outliner::IteratorPosition::mePageKind, mnPageCount, mpDrawDocument, mpView, mpWeakViewShell, Page, RememberStartPosition(), sd::View::SdrEndTextEdit(), OutlinerView::SetOutputArea(), SetPaperSize, SetText(), SPELL, and SdrMarkView::UnmarkAllObj().

Referenced by GetNextSpellSentence(), and SearchAndReplaceOnce().

◆ DetectSelectionChange()

bool SdOutliner::DetectSelectionChange ( )
private

Detect whether the selection has changed.

Returns
Return <TRUE> when the selection has been changed since the last call to this method.

Definition at line 1027 of file Outliner.cxx.

References SdrMarkList::GetMark(), SdrMarkList::GetMarkCount(), SdrMarkView::GetMarkedObjectList(), SdrMark::GetMarkedSdrObj(), mbRestrictSearchToSelection, mpObj, and mpView.

Referenced by DetectChange().

◆ EndConversion()

void SdOutliner::EndConversion ( )

Release all resources that have been created during the conversion.

Definition at line 1874 of file Outliner.cxx.

References EndSpelling().

Referenced by StartConversion(), sd::FuHangulHanjaConversion::StartConversion(), and sd::FuHangulHanjaConversion::~FuHangulHanjaConversion().

◆ EndOfSearch()

void SdOutliner::EndOfSearch ( )
private

Handle the situation that the iterator has reached the last object.

This may result in setting the <member>mbEndOfSearch</member> flag back to </sal_False>. This method may show either the end-of-search dialog or the wrap-around dialog.

Definition at line 1345 of file Outliner.cxx.

References sd::outliner::OutlinerContainer::begin(), getOutlinerView(), GetSearchStartPosition(), maLastValidPosition, maObjectIterator, mbEndOfSearch, mbMatchMayExist, mbRestrictSearchToSelection, meMode, mpWeakViewShell, SetObject(), OutlinerView::SetSelection(), ShowEndOfSearchDialog(), ShowWrapAroundDialog(), and TEXT_CONVERSION.

Referenced by GetNextSpellSentence(), ProvideNextTextObject(), and SpellNextDocument().

◆ EndSpelling()

void SdOutliner::EndSpelling ( )

Release all resources that have been created during the find&replace or spell check.

Free all resources acquired during the search/spell check.

After a spell check the start position is restored here.

Definition at line 281 of file Outliner.cxx.

References sd::ViewShellBase::GetMainViewShell(), getOutlinerView(), SdrPaintView::GetSdrPageView(), SdrModel::IsChanged(), meMode, mnStartPageIndex, mpDrawDocument, mpImpl, mpView, mpWeakViewShell, mpWindow, RestoreStartPosition(), sd::View::SdrEndTextEdit(), SdDrawDocument::SetChanged(), SPELL, TEXT_CONVERSION, and SdrMarkView::UnmarkAllObj().

Referenced by EndConversion(), sd::FuSearch::SearchAndReplace(), StartSearchAndReplace(), and sd::FuSearch::~FuSearch().

◆ EnterEditMode()

void SdOutliner::EnterEditMode ( bool  bGrabFocus)
private

◆ GetDoc()

SdDrawDocument * SdOutliner::GetDoc ( ) const
inline

Definition at line 196 of file Outliner.hxx.

References mpDrawDocument.

◆ GetIgnoreCurrentPageChangesLevel()

int SdOutliner::GetIgnoreCurrentPageChangesLevel ( ) const
inline

Definition at line 193 of file Outliner.hxx.

References mnIgnoreCurrentPageChangesLevel.

◆ GetMessageBoxParent()

weld::Window * SdOutliner::GetMessageBoxParent ( )
private

Find the right parent to use for a message.

This function makes sure that the otherwise non-modal search or spell dialogs, if visible, are locked, too.

Definition at line 1915 of file Outliner.cxx.

References SfxViewFrame::Current(), SfxChildWindow::GetController(), meMode, mpWeakViewShell, SEARCH, SPELL, TEXT_CONVERSION, and xController.

Referenced by ShowEndOfSearchDialog(), ShowWrapAroundDialog(), and StartConversion().

◆ GetNextSpellSentence()

svx::SpellPortions SdOutliner::GetNextSpellSentence ( )

Iterate over the sentences in all text shapes and stop at the next sentence with spelling errors.

check next text object

While doing so the view mode may be changed and text shapes are set into edit mode.

Definition at line 378 of file Outliner.cxx.

References DetectChange(), EndOfSearch(), OutlinerView::GetEditView(), OutlinerView::GetSelection(), maStartSelection, mbMatchMayExist, and SpellNextDocument().

◆ getOutlinerView()

OutlinerView * SdOutliner::getOutlinerView ( )
private

◆ GetSearchStartPosition()

ESelection SdOutliner::GetSearchStartPosition ( ) const
private

Return the position at which a new search is started with respect to the search direction as specified by the argument.

Returns
The position mentioned above in form of a selection with start equals end.

Definition at line 1668 of file Outliner.cxx.

References mbDirectionIsForward.

Referenced by EndOfSearch(), HasNoPreviousMatch(), PrepareSearchAndReplace(), SearchAndReplaceAll(), and SearchAndReplaceOnce().

◆ HandleChangedSelection()

void SdOutliner::HandleChangedSelection ( )
private

Activate or deactivate the search in the current selection.

Call this method whenever the selection has changed. This method creates a copy of the current selection and reassigns the object iterator to the current() iterator.

Definition at line 1770 of file Outliner.cxx.

References SdrMarkView::AreObjectsMarked(), SdrMarkList::GetMark(), SdrMarkList::GetMarkCount(), SdrMarkView::GetMarkedObjectList(), SdrMark::GetMarkedSdrObj(), i, maMarkListCopy, mbRestrictSearchToSelection, mpView, and nCount.

Referenced by BeginConversion(), DetectChange(), and PrepareSpelling().

◆ HandleFailedSearch()

bool SdOutliner::HandleFailedSearch ( )
private

Handle a failed search (with or without replace) for the outline mode.

Show message boxes when the search failed completely, i.e. there is no match in the whole presentation, or when no further match exists.

Returns
The returned value indicates whether another (wrapped around) search shall take place. If that is so, then it is the caller's responsibility to set the cursor position accordingly.

Definition at line 1705 of file Outliner.cxx.

References getOutlinerView(), HasNoPreviousMatch(), mpSearchItem, SvxSearchDialogWrapper::SetSearchLabel(), and ShowWrapAroundDialog().

Referenced by SearchAndReplaceOnce().

◆ HasNoPreviousMatch()

bool SdOutliner::HasNoPreviousMatch ( )
private

Detect whether there exists a previous match.

Note that only the absence of such a match can be detected reliably. An existing match is assumed when the search started not at the beginning/end of the presentation. This does not have to be true. The user can have set the cursor at the middle of the text without a prior search.

Returns
Returns </True> when there is no previous match and </False> when there may be one.

Definition at line 1694 of file Outliner.cxx.

References DBG_ASSERT, getOutlinerView(), GetSearchStartPosition(), and OutlinerView::GetSelection().

Referenced by HandleFailedSearch().

◆ IncreIgnoreCurrentPageChangesLevel()

void SdOutliner::IncreIgnoreCurrentPageChangesLevel ( )
inline

Definition at line 194 of file Outliner.hxx.

References mnIgnoreCurrentPageChangesLevel.

◆ Initialize()

void SdOutliner::Initialize ( bool  bDirectionIsForward)
private

Initialize the object iterator.

Call this method after being invoked from the search or spellcheck dialog. It creates a new iterator pointing at the current object when this has not been done before. It reverses the direction of iteration if the given flag differs from the current direction.

Parameters
bDirectionIsForwardThis flag specifies in which direction to iterator over the objects. If it differs from the current direction the iterator is reversed.

Definition at line 510 of file Outliner.cxx.

References sd::outliner::OutlinerContainer::begin(), sd::outliner::OutlinerContainer::current(), end, getOutlinerView(), OutlinerView::GetSelection(), maCurrentPosition, maLastValidPosition, maObjectIterator, mbDirectionIsForward, mbMatchMayExist, mpWeakViewShell, ESelection::nEndPara, ESelection::nEndPos, ESelection::nStartPara, ESelection::nStartPos, sd::outliner::Iterator::Reverse(), and OutlinerView::SetSelection().

Referenced by ConvertNextDocument(), SpellNextDocument(), and StartSearchAndReplace().

◆ operator=()

SdOutliner & SdOutliner::operator= ( const Outliner )
delete

◆ PrepareConversion()

void SdOutliner::PrepareConversion ( )
private

Prepare to do a text conversion on the current text object.

This includes putting it into edit mode.

Definition at line 1824 of file Outliner.cxx.

References EnterEditMode(), SdDrawDocument::GetDocSh(), mbMatchMayExist, mbStringFound, mnConversionLanguage, and mpDrawDocument.

Referenced by ProvideNextTextObject().

◆ PrepareSearchAndReplace()

void SdOutliner::PrepareSearchAndReplace ( )
private

Prepare to search and replace on the current text object.

This includes putting it into edit mode.

Definition at line 1516 of file Outliner.cxx.

References EnterEditMode(), SdDrawDocument::GetDocSh(), getOutlinerView(), GetSearchStartPosition(), maCurrentPosition, mbMatchMayExist, mbStringFound, mpDrawDocument, mpObj, mpSearchItem, SetObject(), and OutlinerView::SetSelection().

Referenced by ProvideNextTextObject().

◆ PrepareSpellCheck()

void SdOutliner::PrepareSpellCheck ( )
private

Prepare to do spell checking on the current text object.

This includes putting it into edit mode. Under certain conditions this method sets <member>mbEndOfSearch</member> to <TRUE>.

Definition at line 1491 of file Outliner.cxx.

References DBG_ASSERT, EnterEditMode(), maObjectIterator, maSearchStartPosition, mbEndOfSearch, meMode, and SPELL.

Referenced by ProvideNextTextObject().

◆ PrepareSpelling()

void SdOutliner::PrepareSpelling ( )

Despite the name this method is called prior to spell checking and searching and replacing.

Prepare find&replace or spellchecking.

The position of current view mode/page/object/caret position is remembered and, depending on the search mode, may be restored after finishing searching/spell checking.

This distinguishes between three cases:

  1. The current shell is a <type>DrawViewShell</type>: Create a <type>OutlinerView</type> object and search all objects of (i) the current mark list, (ii) of the current view, or (iii) of all the view combinations:

    1. Draw view, slide view
    2. Draw view, background view
    3. Notes view, slide view
    4. Notes view, background view
    5. Handout view, slide view
    6. Handout view, background view

  2. When the current shell is a <type>SdOutlineViewShell</type> then directly operate on it. No switching into other views takes place.

Definition at line 241 of file Outliner.cxx.

References sd::ViewShellBase::GetMainViewShell(), HandleChangedSelection(), maObjectIterator, maSearchStartPosition, mbMatchMayExist, mbPrepareSpellingPending, mbStringFound, mpImpl, mpWeakViewShell, mpWindow, RememberStartPosition(), SD_MOD, and SetViewShell().

Referenced by sd::FuSearch::DoExecute(), sd::FuHangulHanjaConversion::FuHangulHanjaConversion(), sd::FuSearch::SearchAndReplace(), SetViewMode(), and StartSearchAndReplace().

◆ ProvideNextTextObject()

void SdOutliner::ProvideNextTextObject ( )
private

Provide next object to search or spell check as text object in edit mode on the current page.

The main purpose of this method is to iterate over all shape objects of the search area (current selection, current view, or whole document) until a text object has been found that contains at least one match or until no such object can be found anymore.

This skips all objects that do not match or are no text object.

These two conditions are expressed by setting one of the flags <member>mbFoundObject</member> or <member>mbEndOfSearch</member> to <TRUE>.

Definition at line 1191 of file Outliner.cxx.

References DBG_UNHANDLED_EXCEPTION, end, EndOfSearch(), unotools::WeakReference< class interface_type >::get(), SdDrawDocument::GetDocSh(), getOutlinerView(), SdrPaintView::GetSdrPageView(), comphelper::LibreOfficeKit::isActive(), basegfx::Range2D< typename TYPE, typename TRAITS >::isEmpty(), maCurrentPosition, maObjectIterator, SdrMarkView::MarkObj(), mbEndOfSearch, mbFoundObject, VectorGraphicSearchOptions::mbMatchCase, mbMatchMayExist, VectorGraphicSearchOptions::mbMatchWholeWord, mbStringFound, sd::outliner::IteratorPosition::meEditMode, meMode, sd::outliner::IteratorPosition::mePageKind, VectorGraphicSearchOptions::meStartPosition, mpDrawDocument, mpImpl, mpObj, mpParaObj, mpSearchItem, mpSearchSpellTextObj, mpView, mpWeakViewShell, sd::outliner::IteratorPosition::mxObject, Page, PrepareConversion(), PrepareSearchAndReplace(), PrepareSpellCheck(), PutTextIntoOutliner(), sd::View::SdrEndTextEdit(), SEARCH, SetObject(), OutlinerView::SetOutputArea(), SetPaperSize, SetText(), SPELL, Standard, TEXT_CONVERSION, and SdrMarkView::UnmarkAllObj().

Referenced by ConvertNextDocument(), SearchAndReplaceAll(), SearchAndReplaceOnce(), and SpellNextDocument().

◆ PutTextIntoOutliner()

void SdOutliner::PutTextIntoOutliner ( )
private

◆ RememberStartPosition()

void SdOutliner::RememberStartPosition ( )
private

Remember the current edited object/caret position/page/view mode when starting to search/spell check so that it can be restored on termination.

Definition at line 1063 of file Outliner.cxx.

References OutlinerView::GetSelection(), SdrObjEditView::GetTextEditObject(), Outliner::GetView(), Outliner::GetViewCount(), maStartSelection, meStartEditMode, meStartViewMode, mnStartPageIndex, mpStartEditedObject, mpView, and mpWeakViewShell.

Referenced by BeginConversion(), DetectChange(), PrepareSpelling(), SearchAndReplaceAll(), and StartSearchAndReplace().

◆ RestoreStartPosition()

void SdOutliner::RestoreStartPosition ( )
private

Restore the position stored in the last call of <member>RememberStartPositiony</member>.

Definition at line 1116 of file Outliner.cxx.

References EnterEditMode(), getOutlinerView(), maStartSelection, meStartEditMode, meStartViewMode, mnStartPageIndex, mpObj, mpStartEditedObject, mpWeakViewShell, PutTextIntoOutliner(), SetPage(), OutlinerView::SetSelection(), and SetViewMode().

Referenced by EndSpelling(), SearchAndReplaceAll(), and StartSearchAndReplace().

◆ SearchAndReplaceAll()

bool SdOutliner::SearchAndReplaceAll ( )
private

◆ SearchAndReplaceOnce()

bool SdOutliner::SearchAndReplaceOnce ( std::vector<::sd::SearchSelection > *  pSelections = nullptr)
private

◆ sendLOKSearchResultCallback()

void SdOutliner::sendLOKSearchResultCallback ( const std::shared_ptr< sd::ViewShell > &  pViewShell,
const OutlinerView pOutlinerView,
std::vector< sd::SearchSelection > *  pSelections 
)
private

◆ SetObject()

SdrObject * SdOutliner::SetObject ( const ::sd::outliner::IteratorPosition rPosition)
private

Take a position as returned by an object iterator and switch to the view and page on which the object specified by this position is located.

Parameters
rPositionThis position points to a <type>SdrObject</type> object and contains the view and page where it is located.
Returns
Return a pointer to the <type>SdrObject</type>.

Definition at line 1732 of file Outliner.cxx.

References unotools::WeakReference< class interface_type >::get(), sd::outliner::IteratorPosition::meEditMode, sd::outliner::IteratorPosition::mePageKind, sd::outliner::IteratorPosition::mnPageIndex, mnText, sd::outliner::IteratorPosition::mnText, sd::outliner::IteratorPosition::mxObject, SetPage(), and SetViewMode().

Referenced by EndOfSearch(), PrepareSearchAndReplace(), and ProvideNextTextObject().

◆ SetPage()

void SdOutliner::SetPage ( EditMode  eEditMode,
sal_uInt16  nPageIndex 
)
private

Switch to the page or master page specified by the <member>mnPage</member> index.

Master page mode is specified by <member>meEditMode</member>.

Parameters
eEditModeThe new edit mode.
nPageIndexThe new page index.

Definition at line 1610 of file Outliner.cxx.

References mbRestrictSearchToSelection, and mpWeakViewShell.

Referenced by RestoreStartPosition(), and SetObject().

◆ SetViewMode()

void SdOutliner::SetViewMode ( PageKind  ePageKind)
private

◆ SetViewShell()

void SdOutliner::SetViewShell ( const std::shared_ptr<::sd::ViewShell > &  rpViewShell)
private

Use this method when the view shell in which to search has changed.

It handles i.e. registering at the associated view as selection change listener.

Definition at line 1741 of file Outliner.cxx.

References getOutlinerView(), mpImpl, mpView, mpWeakViewShell, mpWindow, and OutlinerView::SetWindow().

Referenced by BeginConversion(), PrepareSpelling(), SetViewMode(), and StartSearchAndReplace().

◆ ShowEndOfSearchDialog()

void SdOutliner::ShowEndOfSearchDialog ( )
private

Show a dialog that tells the user that the search has ended either because there are no more matches after finding at least one or that no match has been found at all.

Definition at line 1395 of file Outliner.cxx.

References SdrMarkView::AreObjectsMarked(), Application::CreateMessageDialog(), GetMessageBoxParent(), SfxViewShell::libreOfficeKitViewCallback(), mbStringFound, meMode, mpSearchItem, mpView, mpWeakViewShell, SdResId(), SEARCH, and SvxSearchDialogWrapper::SetSearchLabel().

Referenced by EndOfSearch().

◆ ShowWrapAroundDialog()

bool SdOutliner::ShowWrapAroundDialog ( )
private

Show a dialog that asks the user whether to wrap around to the beginning/end of the document and continue with the search/spell check.

Definition at line 1427 of file Outliner.cxx.

References Application::CreateMessageDialog(), SdDrawDocument::GetDocumentType(), GetMessageBoxParent(), Impress, mbDirectionIsForward, meMode, mpDrawDocument, mpSearchItem, RET_YES, SdResId(), SvxSearchDialogWrapper::SetSearchLabel(), and SPELL.

Referenced by EndOfSearch(), and HandleFailedSearch().

◆ SpellNextDocument()

bool SdOutliner::SpellNextDocument ( )
overrideprivatevirtual

Initiate the spell check of the next relevant text object.

When the outline view is active then this method is called after a wrap around to continue at the beginning of the document.

Returns
Returns <TRUE> to indicate that another call to this method is required. When all text objects have been processed then <FALSE> is returned.

Definition at line 344 of file Outliner.cxx.

References EndOfSearch(), SdDrawDocument::GetDocSh(), getOutlinerView(), Initialize(), mbEndOfSearch, mpDrawDocument, mpView, mpWeakViewShell, mpWindow, ProvideNextTextObject(), and OutlinerView::SetWindow().

Referenced by GetNextSpellSentence().

◆ StartConversion()

void SdOutliner::StartConversion ( LanguageType  nSourceLanguage,
LanguageType  nTargetLanguage,
const vcl::Font pTargetFont,
sal_Int32  nOptions,
bool  bIsInteractive 
)

Starts the text conversion (hangul/hanja or Chinese simplified/traditional) for the current viewshell.

Definition at line 1792 of file Outliner.cxx.

References BeginConversion(), EndConversion(), GetMessageBoxParent(), getOutlinerView(), mbDirectionIsForward, meMode, mnConversionLanguage, mpSearchItem, mpWeakViewShell, OutlinerView::StartTextConversion(), and TEXT_CONVERSION.

Referenced by sd::FuHangulHanjaConversion::StartConversion().

◆ StartSearchAndReplace()

bool SdOutliner::StartSearchAndReplace ( const SvxSearchItem pSearchItem)

Initiate a find and/or replace on the next relevant text object.

Go to next match.

Returns
Returns </sal_True> when the search/replace is finished (as indicated by user input to the search dialog). A </sal_False> value indicates that another call to this method is required.

Definition at line 420 of file Outliner.cxx.

References SvxSearchItem::Clone(), EndSpelling(), SvxSearchItem::GetCommand(), SdDrawDocument::GetDocSh(), sd::ViewShellBase::GetMainViewShell(), Initialize(), mbFoundObject, mbPrepareSpellingPending, mbStringFound, meMode, mnStartPageIndex, mpDrawDocument, mpSearchItem, mpWeakViewShell, PrepareSpelling(), RememberStartPosition(), RestoreStartPosition(), SEARCH, SearchAndReplaceAll(), SearchAndReplaceOnce(), SvxSearchDialogWrapper::SetSearchLabel(), SetViewShell(), sd::ViewShell::ST_DRAW, sd::ViewShell::ST_HANDOUT, sd::ViewShell::ST_IMPRESS, sd::ViewShell::ST_NOTES, and sd::ViewShell::ST_OUTLINE.

Referenced by sd::FuSearch::SearchAndReplace().

◆ StartSpelling()

void SdOutliner::StartSpelling ( )

Initialize a spell check but do not start it yet.

This method is a better candidate for the name PrepareSpelling.

Definition at line 271 of file Outliner.cxx.

References mbDirectionIsForward, meMode, mpSearchItem, and SPELL.

Friends And Related Function Documentation

◆ ::sd::outliner::OutlinerContainer

friend class ::sd::outliner::OutlinerContainer
friend

Definition at line 125 of file Outliner.hxx.

Member Data Documentation

◆ maCurrentPosition

::sd::outliner::IteratorPosition SdOutliner::maCurrentPosition
private

The current position of the object iterator.

Definition at line 325 of file Outliner.hxx.

Referenced by DetectChange(), Initialize(), PrepareSearchAndReplace(), ProvideNextTextObject(), PutTextIntoOutliner(), SearchAndReplaceOnce(), and sendLOKSearchResultCallback().

◆ maLastValidPosition

::sd::outliner::IteratorPosition SdOutliner::maLastValidPosition
private

The last valid position describes where the last text object has been found.

This position is restored when some dialogs are shown. The position is initially set to the where the search begins.

Definition at line 333 of file Outliner.hxx.

Referenced by EndOfSearch(), Initialize(), and SearchAndReplaceOnce().

◆ maMarkListCopy

::std::vector<unotools::WeakReference<SdrObject> > SdOutliner::maMarkListCopy
private

When the search is restricted to the current selection then this list contains pointers to all the objects of the selection.

This copy is necessary because during the search process the mark list is modified.

Definition at line 275 of file Outliner.hxx.

Referenced by sd::outliner::OutlinerContainer::CreateIterator(), and HandleChangedSelection().

◆ maObjectIterator

::sd::outliner::Iterator SdOutliner::maObjectIterator
private

◆ maSearchStartPosition

::sd::outliner::Iterator SdOutliner::maSearchStartPosition
private

The position when the search started.

Corresponds largely to the m?Start* members.

Definition at line 328 of file Outliner.hxx.

Referenced by BeginConversion(), PrepareSpellCheck(), and PrepareSpelling().

◆ maStartSelection

ESelection SdOutliner::maStartSelection
private

The position of the caret when searching /spell checking was started.

Definition at line 314 of file Outliner.hxx.

Referenced by GetNextSpellSentence(), RememberStartPosition(), and RestoreStartPosition().

◆ mbDirectionIsForward

bool SdOutliner::mbDirectionIsForward
private

This flag indicates whether to search forward or backwards.

Definition at line 263 of file Outliner.hxx.

Referenced by sd::outliner::OutlinerContainer::CreateIterator(), GetSearchStartPosition(), Initialize(), ShowWrapAroundDialog(), StartConversion(), and StartSpelling().

◆ mbEndOfSearch

bool SdOutliner::mbEndOfSearch
private

A <TRUE> value indicates that the end of the find&replace or spell check has been reached.

Definition at line 253 of file Outliner.hxx.

Referenced by ConvertNextDocument(), EndOfSearch(), PrepareSpellCheck(), ProvideNextTextObject(), SearchAndReplaceOnce(), and SpellNextDocument().

◆ mbFoundObject

bool SdOutliner::mbFoundObject
private

Set to <TRUE> when an object has been prepared successfully for searching/spell checking.

This flag directs the internal iteration which stops when set to </sal_True>.

Definition at line 259 of file Outliner.hxx.

Referenced by EnterEditMode(), ProvideNextTextObject(), and StartSearchAndReplace().

◆ mbMatchMayExist

bool SdOutliner::mbMatchMayExist
private

This flag indicates whether there may exist a match of the search string before/after the current position in the document.

It can be set to </sal_False> only when starting from the beginning/end of the document. When reaching the end/beginning with it still be set to </sal_False> then there exists no match and the search can be terminated.

Definition at line 245 of file Outliner.hxx.

Referenced by BeginConversion(), EndOfSearch(), GetNextSpellSentence(), Initialize(), PrepareConversion(), PrepareSearchAndReplace(), PrepareSpelling(), ProvideNextTextObject(), and SetViewMode().

◆ mbPrepareSpellingPending

bool SdOutliner::mbPrepareSpellingPending
private

When this flag is true then a PrepareSpelling() is executed when StartSearchAndReplace() is called the next time.

Definition at line 338 of file Outliner.hxx.

Referenced by PrepareSpelling(), and StartSearchAndReplace().

◆ mbRestrictSearchToSelection

bool SdOutliner::mbRestrictSearchToSelection
private

This flag indicates that only the selected objects are to be searched.

Definition at line 268 of file Outliner.hxx.

Referenced by sd::outliner::OutlinerContainer::CreateIterator(), DetectSelectionChange(), EndOfSearch(), HandleChangedSelection(), and SetPage().

◆ mbStringFound

bool SdOutliner::mbStringFound
private

◆ meMode

enum SdOutliner::mode SdOutliner::meMode
private

◆ meStartEditMode

EditMode SdOutliner::meStartEditMode
private

The master page mode that was active when starting to search/spell check.

Definition at line 304 of file Outliner.hxx.

Referenced by RememberStartPosition(), and RestoreStartPosition().

◆ meStartViewMode

PageKind SdOutliner::meStartViewMode
private

The view mode that was active when starting to search/spell check.

Definition at line 301 of file Outliner.hxx.

Referenced by RememberStartPosition(), and RestoreStartPosition().

◆ mnConversionLanguage

LanguageType SdOutliner::mnConversionLanguage
private

this is the language that is used for current text conversion.

Only valid if meMode is TEXT_CONVERSION.

Definition at line 229 of file Outliner.hxx.

Referenced by PrepareConversion(), and StartConversion().

◆ mnIgnoreCurrentPageChangesLevel

int SdOutliner::mnIgnoreCurrentPageChangesLevel
private

While the value of this flag is greater than 0 changes of the current page do not lead to selecting the corresponding text in the outliner.

Definition at line 234 of file Outliner.hxx.

Referenced by DecreIgnoreCurrentPageChangesLevel(), GetIgnoreCurrentPageChangesLevel(), and IncreIgnoreCurrentPageChangesLevel().

◆ mnPageCount

sal_uInt16 SdOutliner::mnPageCount
private

The number of pages in the current view.

Definition at line 248 of file Outliner.hxx.

Referenced by DetectChange(), and SetViewMode().

◆ mnStartPageIndex

sal_uInt16 SdOutliner::mnStartPageIndex
private

The current page index on starting to search/spell check.

Definition at line 307 of file Outliner.hxx.

Referenced by EndSpelling(), RememberStartPosition(), RestoreStartPosition(), SearchAndReplaceAll(), and StartSearchAndReplace().

◆ mnText

sal_Int32 SdOutliner::mnText
private

Current text to be searched/spelled inside the current text object.

Definition at line 295 of file Outliner.hxx.

Referenced by ConvertNextDocument(), EnterEditMode(), and SetObject().

◆ mpDrawDocument

SdDrawDocument* SdOutliner::mpDrawDocument
private

◆ mpFirstObj

SdrObject* SdOutliner::mpFirstObj
private

this stores the first object that is used for text conversion.

Conversion automatically wraps around the document and stops when it finds this object again.

Definition at line 289 of file Outliner.hxx.

Referenced by ConvertNextDocument().

◆ mpImpl

::std::unique_ptr<Implementation> SdOutliner::mpImpl
private

◆ mpObj

SdrObject* SdOutliner::mpObj
private

Current object that may be a text object.

The object pointer to corresponds to <member>mnObjIndex</member>. While iterating over the objects on a page <member>mpObj</member> will point to every object while <member>mpTextObj</member> will be set only to valid text objects.

Definition at line 283 of file Outliner.hxx.

Referenced by ConvertNextDocument(), DetectSelectionChange(), PrepareSearchAndReplace(), ProvideNextTextObject(), PutTextIntoOutliner(), RestoreStartPosition(), SearchAndReplaceOnce(), and sendLOKSearchResultCallback().

◆ mpParaObj

OutlinerParaObject* SdOutliner::mpParaObj
private

Paragraph object of <member>mpTextObj</member>.

Definition at line 298 of file Outliner.hxx.

Referenced by ProvideNextTextObject(), and PutTextIntoOutliner().

◆ mpSearchItem

std::unique_ptr<const SvxSearchItem> SdOutliner::mpSearchItem
private

The search item contains various attributes that define the type of search.

It is set every time the <member>SearchAndReplaceAll</member> method is called.

Definition at line 320 of file Outliner.hxx.

Referenced by HandleFailedSearch(), PrepareSearchAndReplace(), ProvideNextTextObject(), SearchAndReplaceAll(), SearchAndReplaceOnce(), sendLOKSearchResultCallback(), ShowEndOfSearchDialog(), ShowWrapAroundDialog(), StartConversion(), StartSearchAndReplace(), and StartSpelling().

◆ mpSearchSpellTextObj

SdrTextObj* SdOutliner::mpSearchSpellTextObj
private

Candidate for being searched/spell checked.

Definition at line 292 of file Outliner.hxx.

Referenced by EnterEditMode(), ProvideNextTextObject(), and PutTextIntoOutliner().

◆ mpStartEditedObject

SdrObject* SdOutliner::mpStartEditedObject
private

The object in edit mode when searching /spell checking was started (if any).

Definition at line 311 of file Outliner.hxx.

Referenced by RememberStartPosition(), and RestoreStartPosition().

◆ mpView

::sd::View* SdOutliner::mpView
private

◆ mpWeakViewShell

std::weak_ptr<::sd::ViewShell> SdOutliner::mpWeakViewShell
private

◆ mpWindow

VclPtr<::sd::Window> SdOutliner::mpWindow
private

The documentation for this class was generated from the following files: