/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_CUI_SOURCE_INC_HANGULHANJADLG_HXX #define INCLUDED_CUI_SOURCE_INC_HANGULHANJADLG_HXX #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace svx { class SuggestionSet : public ValueSet { public: SuggestionSet( vcl::Window* pParent ); virtual ~SuggestionSet() override; virtual void dispose() override; virtual void UserDraw( const UserDrawEvent& rUDEvt ) override; void ClearSet(); }; class SuggestionDisplay : public Control { public: SuggestionDisplay( vcl::Window* pParent, WinBits nBits ); virtual ~SuggestionDisplay() override; virtual void dispose() override; void DisplayListBox( bool bDisplayListBox ); void SetSelectHdl( const Link& rLink ); void Clear(); void InsertEntry( const OUString& rStr ); void SelectEntryPos( sal_uInt16 nPos ); sal_uInt16 GetEntryCount() const; OUString GetEntry( sal_uInt16 nPos ) const; OUString GetSelectedEntry() const; virtual void StateChanged( StateChangedType nStateChange ) override; virtual void KeyInput( const KeyEvent& rKEvt ) override; virtual void KeyUp( const KeyEvent& rKEvt ) override; virtual void Activate() override; virtual void Deactivate() override; virtual void GetFocus() override; virtual void LoseFocus() override; virtual void Command( const CommandEvent& rCEvt ) override; DECL_LINK( SelectSuggestionListBoxHdl, ListBox&, void ); DECL_LINK( SelectSuggestionValueSetHdl, ValueSet*, void ); void SelectSuggestionHdl(Control const *); void SetHelpIds(); private: void implUpdateDisplay(); bool hasCurrentControl(); Control& implGetCurrentControl(); private: bool m_bDisplayListBox;//otherwise ValueSet VclPtr m_aValueSet; VclPtr m_aListBox; Link m_aSelectLink; bool m_bInSelectionUpdate; }; class RubyRadioButton; class HangulHanjaConversionDialog : public ModalDialog { private: VclPtr m_pFind; VclPtr m_pIgnore; VclPtr m_pIgnoreAll; VclPtr m_pReplace; VclPtr m_pReplaceAll; VclPtr m_pOptions; VclPtr m_pSuggestions; VclPtr m_pSimpleConversion; VclPtr m_pHangulBracketed; VclPtr m_pHanjaBracketed; VclPtr m_pWordInput; VclPtr m_pOriginalWord; VclPtr m_pHanjaAbove; VclPtr m_pHanjaBelow; VclPtr m_pHangulAbove; VclPtr m_pHangulBelow; VclPtr m_pHangulOnly; VclPtr m_pHanjaOnly; VclPtr m_pReplaceByChar; VclPtr m_pIgnoreNonPrimary; /** are we working for a document? This is normally true, but in case the user uses the "find" functionality, we switch to working with what the user entered, which then does not have any relation to the document anymore. Some functionality must be disabled then */ bool m_bDocumentMode; Link m_aOptionsChangedLink; Link m_aClickByCharacterLink; public: HangulHanjaConversionDialog( vcl::Window* _pParent, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ); virtual ~HangulHanjaConversionDialog() override; virtual void dispose() override; public: void SetOptionsChangedHdl( const Link& _rHdl ); void SetIgnoreHdl( const Link& _rHdl ); void SetIgnoreAllHdl( const Link& _rHdl ); void SetChangeHdl( const Link& _rHdl ); void SetChangeAllHdl( const Link& _rHdl ); void SetClickByCharacterHdl( const Link& _rHdl ); void SetConversionFormatChangedHdl( const Link& _rHdl ); void SetFindHdl( const Link& _rHdl ); OUString GetCurrentString( ) const; void SetCurrentString( const OUString& _rNewString, const css::uno::Sequence< OUString >& _rSuggestions, bool _bOriginatesFromDocument ); void FocusSuggestion( ); /// retrieves the current suggestion OUString GetCurrentSuggestion( ) const; void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ); editeng::HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const; void SetByCharacter( bool _bByCharacter ); void SetConversionDirectionState( bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ); /// should text which does not match the primary conversion direction be ignored? bool GetUseBothDirections( ) const; /** get current conversion direction to use (return argument if GetUseBothDirections is true) */ editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection eDefaultDirection ) const; /// enables or disables the checkboxes for ruby formatted replacements void EnableRubySupport( bool bVal ); private: DECL_LINK( OnOption, Button*, void ); DECL_LINK( OnSuggestionModified, Edit&, void ); DECL_LINK( OnSuggestionSelected, SuggestionDisplay&, void ); DECL_LINK( OnConversionDirectionClicked, Button*, void ); DECL_LINK( ClickByCharacterHdl, Button*, void ); /// fill the suggestion list box with suggestions for the actual input void FillSuggestions( const css::uno::Sequence< OUString >& _rSuggestions ); }; typedef std::vector< css::uno::Reference< css::linguistic2::XConversionDictionary > > HHDictList; class HangulHanjaOptionsDialog : public ModalDialog { private: VclPtr m_pDictsLB; VclPtr m_pIgnorepostCB; VclPtr m_pShowrecentlyfirstCB; VclPtr m_pAutoreplaceuniqueCB; VclPtr m_pNewPB; VclPtr m_pEditPB; VclPtr m_pDeletePB; VclPtr m_pOkPB; HHDictList m_aDictList; css::uno::Reference< css::linguistic2::XConversionDictionaryList > m_xConversionDictionaryList; DECL_LINK( OkHdl, Button*, void ); DECL_LINK( DictsLB_SelectHdl, SvTreeListBox*, void ); DECL_LINK( NewDictHdl, Button*, void ); DECL_LINK( EditDictHdl, Button*, void ); DECL_LINK( DeleteDictHdl, Button*, void ); void Init(); ///< reads settings from core and init controls public: HangulHanjaOptionsDialog( vcl::Window* _pParent ); virtual ~HangulHanjaOptionsDialog() override; virtual void dispose() override; void AddDict( const OUString& _rName, bool _bChecked ); }; class HangulHanjaNewDictDialog : public weld::GenericDialogController { private: bool m_bEntered; std::unique_ptr m_xOkBtn; std::unique_ptr m_xDictNameED; DECL_LINK(OKHdl, weld::Button&, void); DECL_LINK(ModifyHdl, weld::Entry&, void); public: HangulHanjaNewDictDialog(weld::Window* pParent); virtual ~HangulHanjaNewDictDialog() override; bool GetName( OUString& _rRetName ) const; }; class SuggestionList; class SuggestionEdit : public Edit { private: VclPtr m_pPrev; VclPtr m_pNext; VclPtr m_pScrollBar; bool ShouldScroll( bool _bUp ) const; void DoJump( bool _bUp ); public: SuggestionEdit( vcl::Window* pParent, WinBits nBits ); virtual ~SuggestionEdit() override; virtual void dispose() override; virtual bool PreNotify( NotifyEvent& rNEvt ) override; void init( ScrollBar* pScrollBar, SuggestionEdit* pPrev, SuggestionEdit* pNext); }; class HangulHanjaEditDictDialog : public ModalDialog { private: const OUString m_aEditHintText; HHDictList& m_rDictList; sal_uInt32 m_nCurrentDict; OUString m_aOriginal; std::unique_ptr m_pSuggestions; VclPtr m_aBookLB; VclPtr m_aOriginalLB; VclPtr m_aEdit1; VclPtr m_aEdit2; VclPtr m_aEdit3; VclPtr m_aEdit4; VclPtr m_aScrollSB; VclPtr m_aNewPB; VclPtr m_aDeletePB; sal_uInt16 m_nTopPos; bool m_bModifiedSuggestions; bool m_bModifiedOriginal; DECL_LINK( OriginalModifyHdl, Edit&, void ); DECL_LINK( ScrollHdl, ScrollBar*, void ); DECL_LINK( EditModifyHdl1, Edit&, void ); DECL_LINK( EditModifyHdl2, Edit&, void ); DECL_LINK( EditModifyHdl3, Edit&, void ); DECL_LINK( EditModifyHdl4, Edit&, void ); DECL_LINK( BookLBSelectHdl, ListBox&, void ); DECL_LINK( NewPBPushHdl, Button*, void ); DECL_LINK( DeletePBPushHdl, Button*, void ); void InitEditDictDialog( sal_uInt32 _nSelDict ); void UpdateOriginalLB(); void UpdateSuggestions(); void UpdateButtonStates(); void SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum ); void EditModify( Edit const * _pEdit, sal_uInt8 _nEntryOffset ); bool DeleteEntryFromDictionary( const css::uno::Reference< css::linguistic2::XConversionDictionary >& xDict ); public: HangulHanjaEditDictDialog( vcl::Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict ); virtual ~HangulHanjaEditDictDialog() override; virtual void dispose() override; void UpdateScrollbar(); }; } #endif // SVX_HANGUL_HANJA_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */