LCOV - code coverage report
Current view: top level - cui/source/inc - SpellDialog.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 9 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _SVX_SPELLDDIALOG_HXX
      29                 :            : #define _SVX_SPELLDDIALOG_HXX
      30                 :            : 
      31                 :            : #include <sfx2/basedlgs.hxx>
      32                 :            : #include <vcl/fixed.hxx>
      33                 :            : #include <vcl/edit.hxx>
      34                 :            : #include <vcl/lstbox.hxx>
      35                 :            : #include <svtools/stdctrl.hxx>
      36                 :            : #include <vcl/button.hxx>
      37                 :            : #include <vcl/menubtn.hxx>
      38                 :            : #include <vcl/group.hxx>
      39                 :            : #include <vcl/decoview.hxx>
      40                 :            : #include <vcl/image.hxx>
      41                 :            : #include <com/sun/star/uno/Reference.hxx>
      42                 :            : 
      43                 :            : 
      44                 :            : #include <svx/langbox.hxx>
      45                 :            : #include <memory>
      46                 :            : #include <svtools/svmedit.hxx>
      47                 :            : #include <svl/lstner.hxx>
      48                 :            : #include <svtools/fixedhyper.hxx>
      49                 :            : #include <vcl/xtextedt.hxx>
      50                 :            : #include <editeng/SpellPortions.hxx>
      51                 :            : 
      52                 :            : #include <set>
      53                 :            : 
      54                 :            : namespace svx{ class SpellUndoAction_Impl;}
      55                 :            : 
      56                 :            : // forward ---------------------------------------------------------------
      57                 :            : 
      58                 :            : struct SpellDialog_Impl;
      59                 :            : 
      60                 :            : namespace com{namespace sun{namespace star{
      61                 :            : namespace linguistic2{
      62                 :            :     class XSpellChecker1;
      63                 :            : }}}}
      64                 :            : namespace svx{
      65                 :            : class SpellDialog;
      66                 :            : struct SpellErrorDescription;
      67                 :            : // ------------------------------------------------------------------
      68                 :            : class SentenceEditWindow_Impl : public MultiLineEdit
      69                 :            : {
      70                 :            :     using MultiLineEdit::SetText;
      71                 :            : 
      72                 :            : private:
      73                 :            :     std::set< sal_uInt16 >      m_aIgnoreErrorsAt;
      74                 :            :     sal_uInt16          m_nErrorStart;
      75                 :            :     sal_uInt16          m_nErrorEnd;
      76                 :            :     bool            m_bIsUndoEditMode;
      77                 :            : 
      78                 :            :     Link            m_aModifyLink;
      79                 :            : 
      80                 :          0 :     void            CallModifyLink() {m_aModifyLink.Call(this);}
      81                 :            : 
      82                 :          0 :     SpellDialog*    GetSpellDialog() const {return (SpellDialog*)GetParent();}
      83                 :            : protected:
      84                 :            :     virtual long    PreNotify( NotifyEvent& rNEvt );
      85                 :            : 
      86                 :            : public:
      87                 :            :                     SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId );
      88                 :            :                     ~SentenceEditWindow_Impl();
      89                 :            : 
      90                 :          0 :     void            SetModifyHdl(const Link& rLink) { m_aModifyLink = rLink;}
      91                 :            : 
      92                 :            :     void            SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
      93                 :            :     void            SetText( const String& rStr );
      94                 :            : 
      95                 :            :     bool            MarkNextError( bool bIgnoreCurrentError );
      96                 :            :     void            ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage);
      97                 :            :     void            MoveErrorMarkTo(sal_uInt16 nErrorStart, sal_uInt16 nErrorEnd, bool bGrammar);
      98                 :            :     String          GetErrorText() const;
      99                 :            :     void            RestoreCurrentError();
     100                 :            : 
     101                 :            :     void            SetAlternatives(
     102                 :            :                         com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> );
     103                 :            : 
     104                 :            :     const SpellErrorDescription* GetAlternatives();
     105                 :            : 
     106                 :            : 
     107                 :          0 :     void            ResetModified()   { GetTextEngine()->SetModified(sal_False); m_bIsUndoEditMode = false;}
     108                 :          0 :     sal_Bool            IsModified() const              { return GetTextEngine()->IsModified(); }
     109                 :            : 
     110                 :          0 :     bool            IsUndoEditMode() const { return m_bIsUndoEditMode;}
     111                 :            :     void            SetUndoEditMode(bool bSet);
     112                 :            : 
     113                 :            :     svx::SpellPortions  CreateSpellPortions( bool bSetIgnoreFlag ) const;
     114                 :            : 
     115                 :            :     void            ResetUndo();
     116                 :            :     void            Undo();
     117                 :            :     void            AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg=sal_False );
     118                 :            :     sal_uInt16      GetUndoActionCount();
     119                 :            :     void            UndoActionStart( sal_uInt16 nId );
     120                 :            :     void            UndoActionEnd();
     121                 :            : 
     122                 :            :     void            MoveErrorEnd(long nOffset);
     123                 :            : 
     124                 :          0 :     void            ResetIgnoreErrorsAt()   { m_aIgnoreErrorsAt.clear(); }
     125                 :            : };
     126                 :            : 
     127         [ #  # ]:          0 : class HelpFixedText : public FixedText
     128                 :            : {
     129                 :            :     public:
     130                 :            :         HelpFixedText( Window* pParent, const ResId& rResId );
     131                 :            : 
     132                 :            :         virtual void Paint( const Rectangle& rRect );
     133                 :            :         long GetActualHeight( );
     134                 :            : };
     135                 :            : 
     136                 :            : // class SvxSpellDialog ---------------------------------------------
     137                 :            : class SpellDialogChildWindow;
     138                 :            : 
     139                 :            : class SpellDialog : public SfxModelessDialog
     140                 :            : {
     141                 :            :     using Window::Invalidate;
     142                 :            : 
     143                 :            :     friend class SentenceEditWindow_Impl;
     144                 :            : private:
     145                 :            : 
     146                 :            :     FixedText       aLanguageFT;
     147                 :            :     SvxLanguageBox  aLanguageLB;
     148                 :            : 
     149                 :            :     HelpFixedText       aExplainFT;
     150                 :            :     svt::FixedHyperlink aExplainLink;
     151                 :            : 
     152                 :            :     FixedText           aNotInDictFT;
     153                 :            :     SentenceEditWindow_Impl  aSentenceED;
     154                 :            : 
     155                 :            :     FixedText       aSuggestionFT;
     156                 :            :     ListBox         aSuggestionLB;
     157                 :            : 
     158                 :            :     PushButton      aIgnorePB;
     159                 :            :     PushButton      aIgnoreAllPB;
     160                 :            :     PushButton      aIgnoreRulePB;
     161                 :            :     MenuButton      aAddToDictMB;
     162                 :            :     PushButton      aAddToDictPB;
     163                 :            : 
     164                 :            :     PushButton      aChangePB;
     165                 :            :     PushButton      aChangeAllPB;
     166                 :            :     PushButton      aAutoCorrPB;
     167                 :            : 
     168                 :            :     CheckBox        aCheckGrammarCB;
     169                 :            : 
     170                 :            :     HelpButton      aHelpPB;
     171                 :            :     PushButton      aOptionsPB;
     172                 :            :     PushButton      aUndoPB;
     173                 :            :     PushButton      aClosePB;
     174                 :            : 
     175                 :            :     GroupBox        aBackgroundGB;
     176                 :            : 
     177                 :            :     Image           aVendorImage;
     178                 :            : 
     179                 :            :     String          aResumeST;
     180                 :            :     String          aIgnoreOnceST;
     181                 :            :     String          aNoSuggestionsST;
     182                 :            : 
     183                 :            :     const String    m_sTitleSpelling;
     184                 :            :     const String    m_sTitleSpellingGrammar;
     185                 :            :     const String    m_sTitleSpellingGrammarVendor;
     186                 :            : 
     187                 :            :     Size            aOldWordEDSize;
     188                 :            :     Link            aDialogUndoLink;
     189                 :            : 
     190                 :            :     bool            bModified;
     191                 :            :     bool            bFocusLocked;
     192                 :            : 
     193                 :            :     svx::SpellDialogChildWindow& rParent;
     194                 :            :     svx::SpellPortions           m_aSavedSentence;
     195                 :            : 
     196                 :            :     SpellDialog_Impl* pImpl;
     197                 :            :     ::com::sun::star::uno::Reference<
     198                 :            :         ::com::sun::star::linguistic2::XSpellChecker1 >     xSpell;
     199                 :            :     LanguageType        nOldLang;
     200                 :            : 
     201                 :            :     DECL_LINK(ChangeHdl, void *);
     202                 :            :     DECL_LINK(ChangeAllHdl, void *);
     203                 :            :     DECL_LINK( IgnoreAllHdl, Button * );
     204                 :            :     DECL_LINK(IgnoreHdl, void *);
     205                 :            :     DECL_LINK( CheckGrammarHdl, CheckBox* );
     206                 :            :     DECL_LINK( ExtClickHdl, Button * );
     207                 :            :     DECL_LINK(CancelHdl, void *);
     208                 :            :     DECL_LINK( ModifyHdl, SentenceEditWindow_Impl *);
     209                 :            :     DECL_LINK(UndoHdl, void *);
     210                 :            :     DECL_LINK( AddToDictSelectHdl, MenuButton* );
     211                 :            :     DECL_LINK( AddToDictClickHdl, PushButton* );
     212                 :            :     DECL_LINK( LanguageSelectHdl, SvxLanguageBox* );
     213                 :            :     DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* );
     214                 :            :     DECL_LINK( HandleHyperlink, svt::FixedHyperlink * );
     215                 :            : 
     216                 :            :     DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * );
     217                 :            : 
     218                 :            :     int             AddToDictionaryExecute( sal_uInt16 ItemId, PopupMenu *pMenu );
     219                 :            :     void            StartSpellOptDlg_Impl();
     220                 :            :     int             InitUserDicts();
     221                 :            :     void            UpdateBoxes_Impl();
     222                 :            :     void            Init_Impl();
     223                 :            :     void            SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false );
     224                 :          0 :     void            LockFocusChanges( bool bLock ) {bFocusLocked = bLock;}
     225                 :            :     void            Impl_Restore();
     226                 :            : 
     227                 :            :     void            SetSelectedLang_Impl( LanguageType nLang );
     228                 :            :     LanguageType    GetSelectedLang_Impl() const;
     229                 :            : 
     230                 :            :     /** Retrieves the next sentence.
     231                 :            :      */
     232                 :            :     bool            GetNextSentence_Impl(bool bUseSavedSentence, bool bRechek /*for rechecking the current sentence*/);
     233                 :            :     /** Corrects all errors that have been selected to be changed always
     234                 :            :      */
     235                 :            :     bool            ApplyChangeAllList_Impl(SpellPortions& rSentence, bool& bHasReplaced);
     236                 :            :     void            SetTitle_Impl(LanguageType nLang);
     237                 :            : 
     238                 :            : protected:
     239                 :            :     virtual void    Paint( const Rectangle& rRect );
     240                 :            :     virtual long    Notify( NotifyEvent& rNEvt );
     241                 :            : 
     242                 :            :     String getReplacementString() const;
     243                 :            : 
     244                 :            : public:
     245                 :            :     SpellDialog(
     246                 :            :         svx::SpellDialogChildWindow* pChildWindow,
     247                 :            :         Window * pParent,
     248                 :            :         SfxBindings* pBindings);
     249                 :            :     ~SpellDialog();
     250                 :            : 
     251                 :            :     void            SetLanguage( sal_uInt16 nLang );
     252                 :            :     virtual sal_Bool    Close();
     253                 :            : 
     254                 :            :     void            InvalidateDialog();
     255                 :            : };
     256                 :            : } //namespace svx
     257                 :            : 
     258                 :            : #endif
     259                 :            : 
     260                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10