35#include <osl/diagnose.h>
68 std::unique_ptr<SwPaM>
93 m_bBodySpelled(false),
94 m_bOtherSpelled(false),
95 m_bStartedInOther(false),
96 m_bStartedInSelection(false),
97 m_bDrawingsSpelled(false),
98 m_pStartDrawing(nullptr),
99 m_bRestartDrawing(false),
102 m_pPointNode(nullptr),
103 m_pMarkNode(nullptr),
106 m_pOutliner(nullptr),
107 m_bTextObjectsCollected(false)
112 { m_bInitialCall =
true;
113 m_bBodySpelled = m_bOtherSpelled = m_bDrawingsSpelled =
false;
114 m_xStartRange =
nullptr;
115 m_pStartDrawing =
nullptr;
116 m_bRestartDrawing =
false;
117 m_bTextObjectsCollected =
false;
118 m_aTextObjects.clear();
119 m_bStartedInOther =
false;
120 pOtherCursor.reset();
129 Point aPt(LONG_MIN, LONG_MIN);
133 rSh.
GetView().AttrChangedNotify(
nullptr);
142 :
svx::SpellDialogChildWindow (
143 _pParent,
nId, pBindings)
144 , m_bIsGrammarCheckingOn(false)
188 bool bOtherText =
false;
193 if(!bDrawText && !bNormalText)
199 bNormalText = !bDrawText;
231 pUnoCursor->Left( 1 );
232 pStart = pUnoCursor->Start();
371 bool bCloseMessage =
true;
376 "not all parts of the document are already spelled");
377 if(
m_pSpellState->m_xStartRange.is() && !bNoDictionaryAvailable )
381 VclMessageType::Question, VclButtonsType::YesNo,
SwResId(STR_QUERY_SPELL_CONTINUE)));
382 sal_uInt16 nRet = xBox->run();
400 bCloseMessage =
false;
403 if( aRet.empty() && bCloseMessage && !bNoDictionaryAvailable )
406 OUString sInfo(
SwResId( bNoDictionaryAvailable ? STR_DICTIONARY_UNAVAILABLE : STR_SPELLING_COMPLETED ) );
409 std::unique_ptr<weld::MessageDialog> xBox(
411 VclMessageType::Info,
418 xSpellController->getDialog()->grab_focus();
427 OSL_ENSURE(!
m_pSpellState->m_bInitialCall,
"ApplyChangedSentence in initial call or after resume");
455 const OUString& rOld,
const OUString& rNew,
LanguageType eLanguage)
458 pACorr->
PutText( rOld, rNew, eLanguage );
501 OSL_ENSURE(pOutliner,
"No Outliner in SwSpellDialogChildWindow::SetGrammarChecking");
513 bool bInvalidate =
false;
550 OSL_ENSURE(pOLV,
"no OutlinerView in SwSpellDialogChildWindow::GetFocus()");
556 default: bInvalidate =
true;
604 OSL_ENSURE(pOutliner && pOLV,
"no Outliner/OutlinerView in SwSpellDialogChildWindow::LoseFocus()");
622 pWrtShell->
SpellEnd(
nullptr,
false);
633 sal_uInt16 nShellIdx = 0;
635 while(
nullptr != (pShell = pDispatch->
GetShell(nShellIdx++)))
636 if(
auto pSwView =
dynamic_cast< SwView *
>( pShell ))
657 OSL_FAIL(
"text already active in SwSpellDialogChildWindow::MakeTextSelection_Impl()");
664 rView.AttrChangedNotify(
nullptr);
673 rView.AttrChangedNotify(
nullptr);
683 rView.AttrChangedNotify(
nullptr);
696 Point aPt(LONG_MIN, LONG_MIN);
702 rView.AttrChangedNotify(
nullptr);
714 bool bNextDoc =
false;
727 pCurrentTextObj = pSdrTextObj;
745 std::list<SdrTextObj*>::iterator aStart =
m_pSpellState->m_aTextObjects.begin();
753 bool bHasSpellError =
false;
756 GetDrawOutliner().GetEmptyItemSet().GetPool(),
757 OutlinerMode::TextObject );
759 MapMode aMapMode (MapUnit::MapTwip);
760 aTmpOutliner.SetRefMapMode(aMapMode);
762 aTmpOutliner.SetSpeller( xSpell );
766 aTmpOutliner.InsertView( &aOutlView );
770 aTmpOutliner.SetText( *pParaObj );
771 aTmpOutliner.ClearModifyFlag();
772 bHasSpellError = EESpellState::Ok != aTmpOutliner.HasSpellErrors();
773 aTmpOutliner.RemoveView( &aOutlView );
786 rView.AttrChangedNotify(
nullptr);
800 OSL_ENSURE(pOutliner,
"No Outliner in SwSpellDialogChildWindow::SpellDrawText_Impl");
824 OSL_ENSURE(
m_pSpellState->m_bLockFocus != bLock,
"invalid locking - no change of state");
static void lcl_LeaveDrawText(SwWrtShell &rSh)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
void SetSelection(const ESelection &)
void SetOutputArea(const tools::Rectangle &rRect)
ESelection GetSelection() const
Outliner * GetOutliner() const
EditView & GetEditView() const
void SetRefDevice(OutputDevice *pRefDev)
SdrHdl * GetFocusHdl() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
const SdrHdlList & GetHdlList() const
SdrObject * GetMarkedSdrObj() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
const OutlinerView * GetTextEditOutlinerView() const
const SdrOutliner * GetTextEditOutliner() const
SdrPageView * GetSdrPageView() const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
virtual const tools::Rectangle & GetLogicRect() const override
SfxDispatcher * GetDispatcher() const
void Invalidate(sal_uInt16 nId)
SfxShell * GetShell(sal_uInt16 nIdx) const
SfxBindings & GetBindings()
SfxViewFrame & GetViewFrame() const
bool HasGrammarChecker() const
css::uno::Any GetProperty(std::u16string_view rPropertyName) const
bool SetProperty(std::u16string_view rPropertyName, const css::uno::Any &rValue)
SvxAutoCorrect * GetAutoCorrect()
static SvxAutoCorrCfg & Get()
bool PutText(const OUString &rShort, const OUString &rLong, LanguageType eLang)
void SetSelection(const SwPaM &rCursor)
void ExpandToSentenceBorders()
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
bool IsStartOfDoc() const
SwDoc * GetDoc()
returns Doc. But be careful!
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
bool IsDictionaryMissing() const
Returns true if no dictionary can be found for any content.
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
void SpellStart(SwDocPositions eStart, SwDocPositions eEnd, SwDocPositions eCurr, SwConversionArgs *pConvArgs=nullptr)
Functions used for spell checking and text conversion.
static void PutSpellingToSentenceStart()
Make SpellIter start with the current sentence when called next time.
void SpellEnd(SwConversionArgs const *pConvArgs=nullptr, bool bRestoreSelection=true)
Restore selections.
void ApplyChangedSentence(const svx::SpellPortions &rNewPortions, bool bRecheck)
Applies a changed sentence.
bool SpellSentence(svx::SpellPortions &rToFill, bool bIsGrammarCheck)
Spells on a sentence basis - the SpellPortions are needed.
static void MoveContinuationPosToEndOfCheckedSentence()
Moves the continuation position to the end of the currently checked sentence.
static bool HasLastSentenceGotGrammarChecked()
Check SwSpellIter data to see if the last sentence got grammar checked.
bool HasOtherCnt() const
Are there frames, footnotes, etc.
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
bool IsDrawCreate() const
bool SelectObj(const Point &rSelPt, sal_uInt8 nFlag=0, SdrObject *pObj=nullptr)
If an object has been given, exactly this object is selected (instead of searching over position).
Base class of the Writer document model elements.
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
SwNode & GetMarkNode() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
Of course Writer needs its own rectangles.
virtual void AddAutoCorrection(const OUString &rOld, const OUString &rNew, LanguageType eLanguage) override
virtual void LoseFocus() override
virtual void SetGrammarChecking(bool bOn) override
virtual svx::SpellPortions GetNextWrongSentence(bool bRecheck) override
virtual bool HasGrammarChecking() override
virtual bool IsGrammarChecking() override
bool FindNextDrawTextError_Impl(SwWrtShell &rSh)
bool m_bIsGrammarCheckingOn
SwSpellDialogChildWindow(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
void LockFocusNotification(bool bLock)
std::unique_ptr< SpellState > m_pSpellState
SwWrtShell * GetWrtShell_Impl()
void MakeTextSelection_Impl(SwWrtShell &rSh, ShellMode eSelMode)
virtual void ApplyChangedSentence(const svx::SpellPortions &rChanged, bool bRecheck) override
virtual ~SwSpellDialogChildWindow() override
virtual bool HasAutoCorrection() override
void InvalidateSpellDialog()
bool SpellDrawText_Impl(SwWrtShell &rSh, svx::SpellPortions &rPortions)
virtual void GetFocus() override
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
void MakeVisible(const SwRect &)
bool BeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false)
SwWrtShell * GetWrtShellPtr() const
SwDrawBase * GetDrawFuncPtr() const
ShellMode GetShellMode() const
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
SelectionType GetSelectionType() const
bool HasSelection() const
const SwView & GetView() const
void InvalidateSpellDialog()
SfxBindings & GetBindings() const
#define FN_SPELL_GRAMMAR_DIALOG
virtual std::shared_ptr< SfxDialogController > GetController() override
constexpr OUStringLiteral UPN_IS_GRAMMAR_INTERACTIVE
SFX_IMPL_CHILDWINDOW_WITHID(SearchResultsDlgWrapper, SID_SEARCH_RESULTS_DIALOG)
std::vector< SpellPortion > SpellPortions
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange, ::sw::TextRangeMode const eMode)
ESelection m_aStartDrawingSelection
const SwNode * m_pPointNode
std::unique_ptr< SwPaM > pOtherCursor
const SwNode * m_pMarkNode
const SdrOutliner * m_pOutliner
std::list< SdrTextObj * > m_aTextObjects
bool m_bStartedInSelection
Reference< XTextRange > m_xStartRange
bool m_bTextObjectsCollected
const SdrObject * m_pStartDrawing
sal_Int32 GetContentIndex() const
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
OUString SwResId(TranslateId aId)
uno::Reference< linguistic2::XSpellChecker1 > GetSpellChecker()