LCOV - code coverage report
Current view: top level - cui/source/inc - hangulhanjadlg.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 2 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_HANGULHANJADLG_HXX
      20             : #define INCLUDED_CUI_SOURCE_INC_HANGULHANJADLG_HXX
      21             : 
      22             : #include <vcl/dialog.hxx>
      23             : #include <vcl/button.hxx>
      24             : #include <vcl/lstbox.hxx>
      25             : #include <vcl/combobox.hxx>
      26             : #include <vcl/fixed.hxx>
      27             : #include <vcl/scrbar.hxx>
      28             : #include <svx/checklbx.hxx>
      29             : #include <editeng/hangulhanja.hxx>
      30             : #include <com/sun/star/uno/Sequence.hxx>
      31             : #include <editeng/unolingu.hxx>
      32             : #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
      33             : #include <svtools/valueset.hxx>
      34             : 
      35             : #include <vector>
      36             : #include <memory>
      37             : 
      38             : class SvxCommonLinguisticControl;
      39             : 
      40             : namespace svx
      41             : {
      42             : 
      43             : 
      44             : 
      45             :     //= HangulHanjaConversionDialog
      46             : 
      47             : 
      48             :     class SuggestionSet : public ValueSet
      49             :     {
      50             :     public:
      51             :         SuggestionSet( Window* pParent );
      52             :         virtual ~SuggestionSet();
      53             : 
      54             :         virtual void    UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
      55             :         void            ClearSet();
      56             :     };
      57             : 
      58             :     class SuggestionDisplay : public Control
      59             :     {
      60             :     public:
      61             :         SuggestionDisplay( Window* pParent, const ResId& rResId );
      62             :         virtual ~SuggestionDisplay();
      63             : 
      64             :         void DisplayListBox( bool bDisplayListBox );
      65             : 
      66             :         void SetSelectHdl( const Link& rLink );
      67             : 
      68             :         void Clear();
      69             :         void InsertEntry( const OUString& rStr );
      70             :         void SelectEntryPos( sal_uInt16 nPos );
      71             : 
      72             :         sal_uInt16 GetEntryCount() const;
      73             : 
      74             :         OUString GetEntry( sal_uInt16 nPos ) const;
      75             :         OUString GetSelectEntry() const;
      76             : 
      77             :         virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
      78             : 
      79             :         virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
      80             :         virtual void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
      81             :         virtual void Activate() SAL_OVERRIDE;
      82             :         virtual void Deactivate() SAL_OVERRIDE;
      83             :         virtual void GetFocus() SAL_OVERRIDE;
      84             :         virtual void LoseFocus() SAL_OVERRIDE;
      85             :         virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
      86             : 
      87             :         DECL_LINK( SelectSuggestionHdl, Control* );
      88             : 
      89             :         void SetHelpIds();
      90             : 
      91             :     private:
      92             :         void implUpdateDisplay();
      93             :         Control& implGetCurrentControl();
      94             : 
      95             :     private:
      96             :         bool          m_bDisplayListBox;//otherwise ValueSet
      97             :         SuggestionSet m_aValueSet;
      98             :         ListBox       m_aListBox;
      99             : 
     100             :         Link          m_aSelectLink;
     101             :         bool          m_bInSelectionUpdate;
     102             :     };
     103             : 
     104             :     class HangulHanjaConversionDialog : public  ModalDialog
     105             :     {
     106             :     private:
     107             :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     108             :         ::std::auto_ptr< SvxCommonLinguisticControl >
     109             :                     m_pPlayground;                  // order matters: before all other controls!
     110             :         SAL_WNODEPRECATED_DECLARATIONS_POP
     111             : 
     112             :         PushButton      m_aFind;
     113             :         SuggestionDisplay   m_aSuggestions;
     114             :         FixedText       m_aFormat;
     115             :         RadioButton     m_aSimpleConversion;
     116             :         RadioButton     m_aHangulBracketed;
     117             :         RadioButton     m_aHanjaBracketed;
     118             :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     119             :         ::std::auto_ptr< RadioButton >  m_pHanjaAbove;
     120             :         ::std::auto_ptr< RadioButton >  m_pHanjaBelow;
     121             :         ::std::auto_ptr< RadioButton >  m_pHangulAbove;
     122             :         ::std::auto_ptr< RadioButton >  m_pHangulBelow;
     123             :         SAL_WNODEPRECATED_DECLARATIONS_POP
     124             :         FixedText       m_aConversion;
     125             :         CheckBox        m_aHangulOnly;
     126             :         CheckBox        m_aHanjaOnly;
     127             :         CheckBox        m_aReplaceByChar;
     128             : 
     129             :         CheckBox*       m_pIgnoreNonPrimary;
     130             :         /** are we working for a document? This is normally true, but in case
     131             :             the user uses the "find" functionality, we switch to working
     132             :             with what the user entered, which then does not have any relation to
     133             :             the document anymore. Some functionality must be disabled then */
     134             :         bool            m_bDocumentMode;
     135             : 
     136             :         Link            m_aOptionsChangedLink;
     137             :         Link            m_aClickByCharacterLink;
     138             : 
     139             :     public:
     140             :         HangulHanjaConversionDialog(
     141             :                 Window* _pParent,
     142             :                 editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection );
     143             :         virtual ~HangulHanjaConversionDialog( );
     144             : 
     145             :     public:
     146             :         void    SetOptionsChangedHdl( const Link& _rHdl );
     147             :         void    SetIgnoreHdl( const Link& _rHdl );
     148             :         void    SetIgnoreAllHdl( const Link& _rHdl );
     149             :         void    SetChangeHdl( const Link& _rHdl );
     150             :         void    SetChangeAllHdl( const Link& _rHdl );
     151             : 
     152             :         void    SetClickByCharacterHdl( const Link& _rHdl );
     153             :         void    SetConversionFormatChangedHdl( const Link& _rHdl );
     154             :         void    SetFindHdl( const Link& _rHdl );
     155             : 
     156             :         OUString  GetCurrentString( ) const;
     157             :         void    SetCurrentString(
     158             :                     const OUString& _rNewString,
     159             :                     const ::com::sun::star::uno::Sequence< OUString >& _rSuggestions,
     160             :                     bool _bOriginatesFromDocument = true
     161             :                 );
     162             : 
     163             :         void    FocusSuggestion( );
     164             : 
     165             :         /// retrieves the current suggestion
     166             :         OUString  GetCurrentSuggestion( ) const;
     167             : 
     168             :         void        SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType );
     169             :         editeng::HangulHanjaConversion::ConversionFormat    GetConversionFormat( ) const;
     170             : 
     171             :         void            SetByCharacter( bool _bByCharacter );
     172             :         void            SetConversionDirectionState( bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection );
     173             : 
     174             :         /// should text which does not match the primary conversion direction be ignored?
     175             :         bool            GetUseBothDirections( ) const;
     176             : 
     177             :         /** get current conversion direction to use
     178             :             (return argument if GetUseBothDirections is true) */
     179             :         editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection eDefaultDirection ) const;
     180             : 
     181             :         /// enables or disbales the checkboxes for ruby formatted replacements
     182             :         void            EnableRubySupport( bool bVal );
     183             : 
     184             :     private:
     185             :         DECL_LINK( OnClose, void* );
     186             :         DECL_LINK( OnOption, void* );
     187             :         DECL_LINK( OnSuggestionModified, void* );
     188             :         DECL_LINK( OnSuggestionSelected, void* );
     189             :         DECL_LINK( OnConversionDirectionClicked, CheckBox* );
     190             :         DECL_LINK( ClickByCharacterHdl, CheckBox* );
     191             : 
     192             :         /// fill the suggestion list box with suggestions for the actual input
     193             :         void FillSuggestions( const ::com::sun::star::uno::Sequence< OUString >& _rSuggestions );
     194             :     };
     195             : 
     196             : 
     197             :     typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary > > HHDictList;
     198             : 
     199             :     class HangulHanjaOptionsDialog : public ModalDialog
     200             :     {
     201             :     private:
     202             :         SvxCheckListBox*    m_pDictsLB;
     203             :         CheckBox*           m_pIgnorepostCB;
     204             :         CheckBox*           m_pShowrecentlyfirstCB;
     205             :         CheckBox*           m_pAutoreplaceuniqueCB;
     206             :         PushButton*         m_pNewPB;
     207             :         PushButton*         m_pEditPB;
     208             :         PushButton*         m_pDeletePB;
     209             :         OKButton*           m_pOkPB;
     210             : 
     211             :         SvLBoxButtonData*   m_pCheckButtonData;
     212             : 
     213             :         HHDictList          m_aDictList;
     214             :         ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionaryList > m_xConversionDictionaryList;
     215             : 
     216             :         DECL_LINK( OkHdl, void* );
     217             :         DECL_LINK( OnNew, void* );
     218             :         DECL_LINK( OnEdit, void* );
     219             :         DECL_LINK( OnDelete, void* );
     220             :         DECL_LINK( DictsLB_SelectHdl, void* );
     221             :         DECL_LINK( NewDictHdl, void* );
     222             :         DECL_LINK( EditDictHdl, void* );
     223             :         DECL_LINK( DeleteDictHdl, void* );
     224             : 
     225             :         void                Init( void );       ///< reads settings from core and init controls
     226             :     public:
     227             :                             HangulHanjaOptionsDialog( Window* _pParent );
     228             :         virtual             ~HangulHanjaOptionsDialog();
     229             : 
     230             :         void                AddDict( const OUString& _rName, bool _bChecked );
     231             :     };
     232             : 
     233             : 
     234           0 :     class HangulHanjaNewDictDialog : public ModalDialog
     235             :     {
     236             :     private:
     237             :         Edit* m_pDictNameED;
     238             :         OKButton* m_pOkBtn;
     239             : 
     240             :         bool m_bEntered;
     241             : 
     242             :         DECL_LINK( OKHdl, void* );
     243             :         DECL_LINK( ModifyHdl, void* );
     244             :     public:
     245             :         HangulHanjaNewDictDialog( Window* _pParent );
     246             : 
     247             :         bool GetName( OUString& _rRetName ) const;
     248             :     };
     249             : 
     250             : 
     251             :     class SuggestionList;
     252             : 
     253             :     class SuggestionEdit : public Edit
     254             :     {
     255             :     private:
     256             :         SuggestionEdit*     m_pPrev;
     257             :         SuggestionEdit*     m_pNext;
     258             :         ScrollBar&          m_rScrollBar;
     259             : 
     260             :         bool                ShouldScroll( bool _bUp ) const;
     261             :         void                DoJump( bool _bUp );
     262             :     public:
     263             :                             SuggestionEdit( Window* pParent, const ResId& rResId,
     264             :                                     ScrollBar& _rScrollBar,
     265             :                                     SuggestionEdit* _pPrev, SuggestionEdit* _pNext );
     266             :         virtual             ~SuggestionEdit();
     267             :         virtual bool        PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     268             :     };
     269             : 
     270             : 
     271             :     class HangulHanjaEditDictDialog : public ModalDialog
     272             :     {
     273             :     private:
     274             :         const OUString  m_aEditHintText;
     275             :         HHDictList&     m_rDictList;
     276             :         sal_uInt32      m_nCurrentDict;
     277             : 
     278             :         OUString        m_aOriginal;
     279             :         SuggestionList* m_pSuggestions;
     280             : 
     281             :         FixedText       m_aBookFT;
     282             :         ListBox         m_aBookLB;
     283             :         FixedText       m_aOriginalFT;
     284             :         ComboBox        m_aOriginalLB;
     285             :         FixedText       m_aSuggestionsFT;
     286             :         SuggestionEdit  m_aEdit1;
     287             :         SuggestionEdit  m_aEdit2;
     288             :         SuggestionEdit  m_aEdit3;
     289             :         SuggestionEdit  m_aEdit4;
     290             :         ScrollBar       m_aScrollSB;
     291             :         PushButton      m_aNewPB;
     292             :         PushButton      m_aDeletePB;
     293             :         HelpButton      m_aHelpPB;
     294             :         CancelButton    m_aClosePB;
     295             : 
     296             :         sal_uInt16      m_nTopPos;
     297             :         bool            m_bModifiedSuggestions;
     298             :         bool            m_bModifiedOriginal;
     299             : 
     300             :         DECL_LINK( OriginalModifyHdl, void* );
     301             :         DECL_LINK( ScrollHdl, void* );
     302             :         DECL_LINK( EditModifyHdl1, Edit* );
     303             :         DECL_LINK( EditModifyHdl2, Edit* );
     304             :         DECL_LINK( EditModifyHdl3, Edit* );
     305             :         DECL_LINK( EditModifyHdl4, Edit* );
     306             : 
     307             :         DECL_LINK( BookLBSelectHdl, void* );
     308             :         DECL_LINK( NewPBPushHdl, void* );
     309             :         DECL_LINK( DeletePBPushHdl, void* );
     310             : 
     311             :         void            InitEditDictDialog( sal_uInt32 _nSelDict );
     312             :         void            UpdateOriginalLB( void );
     313             :         void            UpdateSuggestions( void );
     314             :         void            UpdateButtonStates();
     315             : 
     316             :         void            SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum );
     317             :         void            EditModify( Edit* _pEdit, sal_uInt8 _nEntryOffset );
     318             :         void            EditFocusLost( Edit* _pEdit, sal_uInt8 _nEntryOffset );
     319             : 
     320             :         bool            DeleteEntryFromDictionary( const OUString& rEntry, const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary >& xDict );
     321             : 
     322             :     public:
     323             :                         HangulHanjaEditDictDialog( Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict );
     324             :                         virtual ~HangulHanjaEditDictDialog();
     325             : 
     326             :         void            UpdateScrollbar( void );
     327             :     };
     328             : 
     329             : 
     330             : }   // namespace svx
     331             : 
     332             : 
     333             : #endif // SVX_HANGUL_HANJA_HXX
     334             : 
     335             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10