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

Generated by: LCOV version 1.10