class SdrObject; class SdrTextObj; class SdDrawDocument;
namespace weld
{ class Window;
}
namespace sd
{ class View; class ViewShell; class Window;
/// Describes a single search hit: a set of rectangles on a given page. struct SearchSelection
{ /// 0-based index of the page that has the selection. int m_nPage;
/** The main purpose of this class is searching and replacing as well as spellingofimpressdocuments.Themainpartofbothtasksliesin iteratingoverthepagesandviewmodesofadocumentandapplythe respectivefunctiontoallobjectscontainingtextonthosepages.
<p>Somerelatedpiecesofinformation: Thesearchdialog(<type>SvxSearchDialog</type>)canbecontrolledin morethanoneway: <ul><li>Asetofoptionflagsreturnedbytheslotcall SID_SEARCH_OPTIONShandledbythe <member>SdDrawDocument::GetState()</member>method.</li> <li>Thecontentsofthesearchitemoftype <type>SvxSearchItem</type>.</li> <li>The<member>HasSelection()</member>viewshellmethodthatreturns whetherornotaselectionexists.However,itiscalledfromthe searchdialogwithanargumentsothatonlytextselectionsare queried.Thisisonlysufficientforsearchingtheoutlineview. </p>
*/ class SdOutliner final : public SdrOutliner
{ public: friendclass ::sd::outliner::OutlinerContainer;
/** Create a new sd outliner object. @paramrDoc Thedrawdocumentfromwhichtotakethecontent. @paramnMode Thevalidvalues<const>OutlinerMode::DontKnow</const>, <const>OutlinerMode::TextObject</const>, <const>OutlinerMode::TitleObject</const>, <const>OutlinerMode::OutlineObject</const>,and <const>OutlinerMode::OutlineView</const>aredefinedin editeng/outliner.hxx.
*/
SdOutliner(SdDrawDocument& rDoc, OutlinerMode nMode); virtual ~SdOutliner() override; /// Forbid copy construction and copy assignment
SdOutliner(const Outliner&) = delete;
SdOutliner& operator=(const Outliner&) = delete;
/** Despite the name this method is called prior to spell checking *and* searchingandreplacing.Thepositionofcurrentview mode/page/object/caretpositionisrememberedand,dependingonthe searchmode,mayberestoredafterfinishingsearching/spell checking.
*/ void PrepareSpelling();
/** Initialize a spell check but do not start it yet. This method isabettercandidateforthenamePrepareSpelling.
*/ void StartSpelling();
/** Initiate a find and/or replace on the next relevant text object. @return Returns</sal_True>whenthesearch/replaceisfinished(as indicatedbyuserinputtothesearchdialog).A</sal_False>value indicatesthatanothercalltothismethodisrequired.
*/ bool StartSearchAndReplace(const SvxSearchItem* pSearchItem);
/** Iterate over the sentences in all text shapes and stop at the nextsentencewithspellingerrors.Whiledoingsotheview modemaybechangedandtextshapesaresetintoeditmode.
*/
svx::SpellPortions GetNextSpellSentence();
/** Release all resources that have been created during the find&replace orspellcheck.
*/ void EndSpelling();
/** callback for textconversion */ bool ConvertNextDocument() override;
/** Starts the text conversion (hangul/hanja or Chinese simplified/traditional)
for the current viewshell */ void StartConversion(LanguageType nSourceLanguage, LanguageType nTargetLanguage, const vcl::Font* pTargetFont, sal_Int32 nOptions, bool bIsInteractive);
/** This is called internally when text conversion is started. Thepositionofcurrentviewmode/page/object/caretposition isrememberedandwillberestoredafterconversion.
*/ void BeginConversion();
/** Release all resources that have been created during the conversion */ void EndConversion();
private: class Implementation;
::std::unique_ptr<Implementation> mpImpl;
/// Returns the current outline view
OutlinerView* getOutlinerView();
/// Specifies whether to search and replace, to spell check or to do a /// text conversion. enum mode
{
SEARCH,
SPELL,
TEXT_CONVERSION
} meMode;
/// The view which displays the searched objects.
::sd::View* mpView; /** The view shell containing the view. It is held as weak pointertoavoidkeepingitalivewhentheviewischanged duringsearching.
*/
std::weak_ptr<::sd::ViewShell> mpWeakViewShell; /// This window contains the view.
VclPtr<::sd::Window> mpWindow; /// The document on whose objects and pages this class operates.
SdDrawDocument& mrDrawDocument;
/** this is the language that is used for current text conversion. OnlyvalidifmeModeisTEXT_CONVERSION.
*/
LanguageType mnConversionLanguage;
/** While the value of this flag is greater than 0 changes of the current page donotleadtoselectingthecorrespondingtextintheoutliner.
*/ int mnIgnoreCurrentPageChangesLevel;
/// Specifies whether the search string has been found so far. bool mbStringFound;
/** This flag indicates whether there may exist a match of the search stringbefore/afterthecurrentpositioninthedocument.Itcanbe setto</sal_False>onlywhenstartingfromthebeginning/endofthe document.Whenreachingtheend/beginningwithitstillbesetto </sal_False>thenthereexistsnomatchandthesearchcanbeterminated.
*/ bool mbMatchMayExist;
/// The number of pages in the current view.
sal_uInt16 mnPageCount;
/** A <TRUE/> value indicates that the end of the find&replace or spell checkhasbeenreached.
*/ bool mbEndOfSearch;
/** Set to <TRUE/> when an object has been prepared successfully for searching/spellchecking.Thisflagdirectstheinternaliteration whichstopswhensetto</sal_True>.
*/ bool mbFoundObject;
/** This flag indicates whether to search forward or backwards.
*/ bool mbDirectionIsForward;
/** This flag indicates that only the selected objects are to be searched.
*/ bool mbRestrictSearchToSelection;
/** When the search is restricted to the current selection then thislistcontainspointerstoalltheobjectsofthe selection.Thiscopyisnecessarybecauseduringthesearch processthemarklistismodified.
*/
::std::vector<unotools::WeakReference<SdrObject>> maMarkListCopy;
/** Current object that may be a text object. The object pointer to correspondsto<member>mnObjIndex</member>.Whileiteratingoverthe objectsonapage<member>mpObj</member>willpointtoeveryobject while<member>mpTextObj</member>willbesetonlytovalidtext objects.
*/
SdrObject* mpObj;
/** this stores the first object that is used for text conversion. Conversionautomaticallywrapsaroundthedocumentandstopswhenit findsthisobjectagain.
*/
SdrObject* mpFirstObj;
/// Candidate for being searched/spell checked.
SdrTextObj* mpSearchSpellTextObj;
/// Current text to be searched/spelled inside the current text object
sal_Int32 mnText;
/// Paragraph object of <member>mpTextObj</member>.
OutlinerParaObject* mpParaObj;
/// The view mode that was active when starting to search/spell check.
PageKind meStartViewMode;
/// The master page mode that was active when starting to search/spell check.
EditMode meStartEditMode;
/// The current page index on starting to search/spell check.
sal_uInt16 mnStartPageIndex;
/// The object in edit mode when searching /spell checking was started /// (if any).
SdrObject* mpStartEditedObject;
/// The position of the caret when searching /spell checking was started.
ESelection maStartSelection;
/** The search item contains various attributes that define the type of search.Itisseteverytimethe <member>SearchAndReplaceAll</member>methodiscalled.
*/
std::unique_ptr<const SvxSearchItem> mpSearchItem;
/// The actual object iterator.
::sd::outliner::Iterator maObjectIterator; /// The current position of the object iterator.
::sd::outliner::IteratorPosition maCurrentPosition; /// The position when the search started. Corresponds largely to the /// m?Start* members.
::sd::outliner::Iterator maSearchStartPosition; /** The last valid position describes where the last text object has been found.Thispositionisrestoredwhensomedialogsareshown.The positionisinitiallysettothewherethesearchbegins.
*/
::sd::outliner::IteratorPosition maLastValidPosition;
/** When this flag is true then a PrepareSpelling() is executed when StartSearchAndReplace()iscalledthenexttime.
*/ bool mbPrepareSpellingPending;
/** Initialize the object iterator. Call this method after being invokedfromthesearchorspellcheckdialog.Itcreatesanew iteratorpointingatthecurrentobjectwhenthishasnotbeendone before.Itreversesthedirectionofiterationifthegivenflag differsfromthecurrentdirection. @parambDirectionIsForward Thisflagspecifiesinwhichdirectiontoiteratoroverthe objects.Ifitdiffersfromthecurrentdirectiontheiterator isreversed.
*/ void Initialize(bool bDirectionIsForward);
/** Do search and replace for whole document.
*/ bool SearchAndReplaceAll();
/** Do search and replace for next match. @parampSelections Whentiledrenderingandnot0,thendon'temitLOKevents,instead assumethecallerwilldoso. @return Thereturnvaluespecifieswhetherthesearchended(</sal_True>)or anothercalltothismethodisrequired(</sal_False>).
*/ bool SearchAndReplaceOnce(std::vector<::sd::SearchSelection>* pSelections = nullptr);
/** Detect changes of the document or view and react accordingly. Such changesmayoccurbecausedifferentcallsto <member>SearchAndReplace()</member>thereusuallyisuser interaction.Thisisatleastthepressofthesearchorreplace buttonbutmayincludeanyotheractionsomeofwhichaffectthe search.
*/ void DetectChange();
/** Detect whether the selection has changed. @return Return<TRUE/>whentheselectionhasbeenchangedsincethe lastcalltothismethod.
*/ bool DetectSelectionChange();
/** Remember the current edited object/caret position/page/view mode whenstartingtosearch/spellchecksothatitcanberestoredon termination.
*/ void RememberStartPosition();
/** Restore the position stored in the last call of <member>RememberStartPositiony</member>.
*/ void RestoreStartPosition();
/** Provide next object to search or spell check as text object in edit modeonthecurrentpage.Thisskipsallobjectsthatdonot matchorarenotextobject.
*/ void ProvideNextTextObject();
/** Handle the situation that the iterator has reached the last object. Thismayresultinsettingthe<member>mbEndOfSearch</member>flag backto</sal_False>.Thismethodmayshoweithertheend-of-search dialogorthewrap-arounddialog.
*/ void EndOfSearch();
/** Show a dialog that tells the user that the search has ended either becausetherearenomorematchesafterfindingatleastoneorthat nomatchhasbeenfoundatall.
*/ void ShowEndOfSearchDialog();
/** Show a dialog that asks the user whether to wrap around to the beginning/endofthedocumentandcontinuewiththesearch/spell check.
*/ bool ShowWrapAroundDialog();
/** Put text of current text object into outliner so that the text can besearched/spellchecked.
*/ void PutTextIntoOutliner();
/** Prepare to do spell checking on the current text object. This includesputtingitintoeditmode.Undercertainconditionsthis methodsets<member>mbEndOfSearch</member>to<TRUE/>.
*/ void PrepareSpellCheck();
/** Prepare to search and replace on the current text object. This includesputtingitintoeditmode.
*/ void PrepareSearchAndReplace();
/** Prepare to do a text conversion on the current text object.Thisincludesputtingitintoeditmode.
*/ void PrepareConversion();
/** Switch to a new view mode. Try to restore the original edit mode beforedoingso. @paramePageKind Specifiesthenewviewmode.
*/ void SetViewMode(PageKind ePageKind);
/** Switch to the page or master page specified by the <member>mnPage</member>index.Masterpagemodeisspecifiedby <member>meEditMode</member>. @parameEditMode Theneweditmode. @paramnPageIndex Thenewpageindex.
*/ void SetPage(EditMode eEditMode, sal_uInt16 nPageIndex);
/** Switch on edit mode for the currently selected text object.
*/ void EnterEditMode(bool bGrabFocus);
/** Return the position at which a new search is started with respect to thesearchdirectionasspecifiedbytheargument. @return Thepositionmentionedaboveinformofaselectionwithstart equalsend.
*/
ESelection GetSearchStartPosition() const;
/** Detect whether there exists a previous match. Note that only the absenceofsuchamatchcanbedetectedreliably.Anexistingmatch isassumedwhenthesearchstartednotatthebeginning/endofthe presentation.Thisdoesnothavetobetrue.Theusercanhaveset thecursoratthemiddleofthetextwithoutapriorsearch. @return Returns</True>whenthereisnopreviousmatchand</False> whentheremaybeone.
*/ bool HasNoPreviousMatch();
/** Handle a failed search (with or without replace) for the outline mode.Showmessageboxeswhenthesearchfailedcompletely, i.e.thereisnomatchinthewholepresentation,orwhennofurther matchexists. @return Thereturnedvalueindicateswhetheranother(wrappedaround) searchshalltakeplace.Ifthatisso,thenitisthecaller's responsibilitytosetthecursorpositionaccordingly.
*/ bool HandleFailedSearch();
/** Take a position as returned by an object iterator and switch to the viewandpageonwhichtheobjectspecifiedbythispositionis located. @paramrPosition Thispositionpointstoa<type>SdrObject</type>objectand containstheviewandpagewhereitislocated. @return Returnapointertothe<type>SdrObject</type>.
*/
SdrObject* SetObject(const ::sd::outliner::IteratorPosition& rPosition);
/** Use this method when the view shell in which to search has changed. Ithandlesi.e.registeringattheassociatedviewasselection changelistener.
*/ void SetViewShell(const std::shared_ptr<::sd::ViewShell>& rpViewShell);
/** Activate or deactivate the search in the current selection. Call thismethodwhenevertheselectionhaschanged.Thismethodcreates acopyofthecurrentselectionandreassignstheobjectiteratorto thecurrent()iterator.
*/ void HandleChangedSelection();
/** Initiate the spell check of the next relevant text object. Whentheoutlineviewisactivethenthismethodiscalled afterawraparoundtocontinueatthebeginningofthedocument. @return Returns<TRUE/>toindicatethatanothercalltothismethodis required.Whenalltextobjectshavebeenprocessedthen <FALSE/>isreturned.
*/ virtualbool SpellNextDocument() override;
/** Find the right parent to use for a message. This function makes sure thattheotherwisenon-modalsearchorspelldialogs,ifvisible,are locked,too.
*/
weld::Window* GetMessageBoxParent();
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.