LCOV - code coverage report
Current view: top level - cui/source/inc - SpellDialog.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 9 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_CUI_SOURCE_INC_SPELLDIALOG_HXX
      20             : #define INCLUDED_CUI_SOURCE_INC_SPELLDIALOG_HXX
      21             : 
      22             : #include <sfx2/basedlgs.hxx>
      23             : #include <vcl/fixed.hxx>
      24             : #include <vcl/edit.hxx>
      25             : #include <vcl/lstbox.hxx>
      26             : #include <svtools/stdctrl.hxx>
      27             : #include <vcl/button.hxx>
      28             : #include <vcl/menubtn.hxx>
      29             : #include <vcl/group.hxx>
      30             : #include <vcl/decoview.hxx>
      31             : #include <vcl/image.hxx>
      32             : #include <com/sun/star/uno/Reference.hxx>
      33             : 
      34             : 
      35             : #include <svx/langbox.hxx>
      36             : #include <memory>
      37             : #include <svtools/svmedit.hxx>
      38             : #include <svl/lstner.hxx>
      39             : #include <vcl/fixedhyper.hxx>
      40             : #include <vcl/xtextedt.hxx>
      41             : #include <editeng/SpellPortions.hxx>
      42             : 
      43             : #include <set>
      44             : 
      45             : namespace svx{ class SpellUndoAction_Impl;}
      46             : 
      47             : // forward ---------------------------------------------------------------
      48             : 
      49             : struct SpellDialog_Impl;
      50             : 
      51             : namespace com{namespace sun{namespace star{
      52             : namespace linguistic2{
      53             :     class XSpellChecker1;
      54             : }}}}
      55             : namespace svx{
      56             : class SpellDialog;
      57             : struct SpellErrorDescription;
      58             : 
      59           0 : class SentenceEditWindow_Impl : public VclMultiLineEdit
      60             : {
      61             :     using VclMultiLineEdit::SetText;
      62             : 
      63             : private:
      64             :     std::set< sal_uInt16 >      m_aIgnoreErrorsAt;
      65             :     sal_uInt16          m_nErrorStart;
      66             :     sal_uInt16          m_nErrorEnd;
      67             :     bool            m_bIsUndoEditMode;
      68             : 
      69             :     Link<>          m_aModifyLink;
      70             : 
      71           0 :     void            CallModifyLink() {m_aModifyLink.Call(this);}
      72             : 
      73             :     inline SpellDialog* GetSpellDialog() const;
      74             : protected:
      75             :     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
      76             : 
      77             : public:
      78             :     SentenceEditWindow_Impl(vcl::Window* pParent, WinBits nBits);
      79             : 
      80           0 :     void            SetModifyHdl(const Link<>& rLink) SAL_OVERRIDE { m_aModifyLink = rLink;}
      81             : 
      82             :     void            SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
      83             :     void            SetText( const OUString& rStr ) SAL_OVERRIDE;
      84             : 
      85             :     bool            MarkNextError( bool bIgnoreCurrentError, com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellChecker1> );
      86             :     void            ChangeMarkedWord(const OUString& rNewWord, LanguageType eLanguage);
      87             :     void            MoveErrorMarkTo(sal_uInt16 nErrorStart, sal_uInt16 nErrorEnd, bool bGrammar);
      88             :     OUString        GetErrorText() const;
      89             :     void            RestoreCurrentError();
      90             : 
      91             :     void            SetAlternatives(
      92             :                         com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> );
      93             : 
      94             :     const SpellErrorDescription* GetAlternatives();
      95             : 
      96             : 
      97           0 :     void            ResetModified()   { GetTextEngine()->SetModified(false); m_bIsUndoEditMode = false;}
      98           0 :     virtual bool    IsModified() const SAL_OVERRIDE { return GetTextEngine()->IsModified(); }
      99             : 
     100           0 :     bool            IsUndoEditMode() const { return m_bIsUndoEditMode;}
     101             :     void            SetUndoEditMode(bool bSet);
     102             : 
     103             :     svx::SpellPortions  CreateSpellPortions( bool bSetIgnoreFlag ) const;
     104             : 
     105             :     void            ResetUndo();
     106             :     void            Undo();
     107             :     void            AddUndoAction( SfxUndoAction *pAction, bool bTryMerg=false );
     108             :     sal_uInt16      GetUndoActionCount();
     109             :     void            UndoActionStart( sal_uInt16 nId );
     110             :     void            UndoActionEnd();
     111             : 
     112             :     void            MoveErrorEnd(long nOffset);
     113             : 
     114           0 :     void            ResetIgnoreErrorsAt()   { m_aIgnoreErrorsAt.clear(); }
     115             : };
     116             : 
     117             : // class SvxSpellDialog ---------------------------------------------
     118             : class SpellDialogChildWindow;
     119             : 
     120             : class SpellDialog : public SfxModelessDialog
     121             : {
     122             :     using Window::Invalidate;
     123             : 
     124             :     friend class SentenceEditWindow_Impl;
     125             : private:
     126             : 
     127             :     VclPtr<FixedText>      m_pLanguageFT;
     128             :     VclPtr<SvxLanguageBox> m_pLanguageLB;
     129             : 
     130             :     VclPtr<FixedText>      m_pExplainFT;
     131             :     VclPtr<FixedHyperlink> m_pExplainLink;
     132             : 
     133             :     VclPtr<FixedText>      m_pNotInDictFT;
     134             :     VclPtr<SentenceEditWindow_Impl> m_pSentenceED;
     135             : 
     136             :     VclPtr<FixedText>      m_pSuggestionFT;
     137             :     VclPtr<ListBox>        m_pSuggestionLB;
     138             : 
     139             :     VclPtr<PushButton>     m_pIgnorePB;
     140             :     VclPtr<PushButton>     m_pIgnoreAllPB;
     141             :     VclPtr<PushButton>     m_pIgnoreRulePB;
     142             :     VclPtr<PushButton>     m_pAddToDictPB;
     143             :     VclPtr<MenuButton>     m_pAddToDictMB;
     144             : 
     145             :     VclPtr<PushButton>     m_pChangePB;
     146             :     VclPtr<PushButton>     m_pChangeAllPB;
     147             :     VclPtr<PushButton>     m_pAutoCorrPB;
     148             : 
     149             :     VclPtr<CheckBox>       m_pCheckGrammarCB;
     150             : 
     151             :     VclPtr<PushButton>     m_pOptionsPB;
     152             :     VclPtr<PushButton>     m_pUndoPB;
     153             :     VclPtr<CloseButton>    m_pClosePB;
     154             : 
     155             :     OUString        m_sResumeST;
     156             :     OUString        m_sIgnoreOnceST;
     157             :     OUString        m_sNoSuggestionsST;
     158             : 
     159             :     OUString        m_sTitleSpelling;
     160             :     OUString        m_sTitleSpellingGrammar;
     161             : 
     162             :     Link<>          aDialogUndoLink;
     163             : 
     164             :     bool            bModified;
     165             :     bool            bFocusLocked;
     166             : 
     167             :     svx::SpellDialogChildWindow& rParent;
     168             :     svx::SpellPortions           m_aSavedSentence;
     169             : 
     170             :     SpellDialog_Impl* pImpl;
     171             :     ::com::sun::star::uno::Reference<
     172             :         ::com::sun::star::linguistic2::XSpellChecker1 >     xSpell;
     173             : 
     174             :     DECL_LINK(ChangeHdl, void *);
     175             :     DECL_LINK(ChangeAllHdl, void *);
     176             :     DECL_LINK( IgnoreAllHdl, Button * );
     177             :     DECL_LINK(IgnoreHdl, void *);
     178             :     DECL_LINK( CheckGrammarHdl, CheckBox* );
     179             :     DECL_LINK( ExtClickHdl, Button * );
     180             :     DECL_LINK(CancelHdl, void *);
     181             :     DECL_LINK( ModifyHdl, SentenceEditWindow_Impl *);
     182             :     DECL_LINK(UndoHdl, void *);
     183             :     DECL_LINK_TYPED( AddToDictSelectHdl, MenuButton*, void );
     184             :     DECL_LINK( AddToDictClickHdl, PushButton* );
     185             :     DECL_LINK( LanguageSelectHdl, SvxLanguageBox* );
     186             :     DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* );
     187             :     DECL_LINK( HandleHyperlink, FixedHyperlink * );
     188             : 
     189             :     DECL_LINK( InitHdl, SpellDialog * );
     190             : 
     191             :     int             AddToDictionaryExecute( sal_uInt16 ItemId, PopupMenu *pMenu );
     192             :     void            StartSpellOptDlg_Impl();
     193             :     int             InitUserDicts();
     194             :     void            UpdateBoxes_Impl();
     195             :     void            Init_Impl();
     196             :     void            SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false );
     197           0 :     void            LockFocusChanges( bool bLock ) {bFocusLocked = bLock;}
     198             :     void            Impl_Restore();
     199             : 
     200             :     void            SetSelectedLang_Impl( LanguageType nLang );
     201             :     LanguageType    GetSelectedLang_Impl() const;
     202             : 
     203             :     /** Retrieves the next sentence.
     204             :      */
     205             :     bool            GetNextSentence_Impl(bool bUseSavedSentence, bool bRechek /*for rechecking the current sentence*/);
     206             :     /** Corrects all errors that have been selected to be changed always
     207             :      */
     208             :     static bool     ApplyChangeAllList_Impl(SpellPortions& rSentence, bool& bHasReplaced);
     209             :     void            SetTitle_Impl(LanguageType nLang);
     210             : 
     211             : protected:
     212             :     virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     213             : 
     214             :     OUString getReplacementString() const;
     215             : 
     216             : public:
     217             :     SpellDialog(
     218             :         svx::SpellDialogChildWindow* pChildWindow,
     219             :         vcl::Window * pParent,
     220             :         SfxBindings* pBindings);
     221             :     virtual ~SpellDialog();
     222             :     virtual void dispose() SAL_OVERRIDE;
     223             : 
     224             :     void            SetLanguage( sal_uInt16 nLang );
     225             :     virtual bool    Close() SAL_OVERRIDE;
     226             : 
     227             :     void            InvalidateDialog();
     228             : };
     229             : 
     230           0 : SpellDialog* SentenceEditWindow_Impl::GetSpellDialog() const {return static_cast<SpellDialog*>(GetParentDialog());}
     231             : 
     232             : } //namespace svx
     233             : 
     234             : #endif
     235             : 
     236             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11