weld HangulHanjaEditDictDialog

Change-Id: If0d49a65735b66eaa8db11686099ed29b01711c4
Reviewed-on: https://gerrit.libreoffice.org/67929
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2019-02-16 20:19:12 +00:00
parent 3901a75e4a
commit 1213cfde6b
9 changed files with 260 additions and 270 deletions

View File

@@ -1063,8 +1063,8 @@ namespace svx
DBG_ASSERT( pEntry, "+HangulHanjaEditDictDialog::EditDictHdl(): call of edit should not be possible with no selection!" );
if( pEntry )
{
ScopedVclPtrInstance< HangulHanjaEditDictDialog > aEdDlg(this, m_aDictList, m_pDictsLB->GetSelectedEntryPos());
aEdDlg->Execute();
HangulHanjaEditDictDialog aEdDlg(GetFrameWeld(), m_aDictList, m_pDictsLB->GetSelectedEntryPos());
aEdDlg.run();
}
}
@@ -1324,12 +1324,12 @@ namespace svx
if( _bUp )
{
if( !m_pPrev )
bRet = m_pScrollBar->GetThumbPos() > m_pScrollBar->GetRangeMin();
bRet = m_pScrollBar->vadjustment_get_value() > m_pScrollBar->vadjustment_get_lower();
}
else
{
if( !m_pNext )
bRet = m_pScrollBar->GetThumbPos() < ( m_pScrollBar->GetRangeMax() - 4 );
bRet = m_pScrollBar->vadjustment_get_value() < ( m_pScrollBar->vadjustment_get_upper() - 4 );
}
return bRet;
@@ -1337,92 +1337,71 @@ namespace svx
void SuggestionEdit::DoJump( bool _bUp )
{
const Link<Control&,void>& rLoseFocusHdl = GetLoseFocusHdl();
rLoseFocusHdl.Call( *this );
m_pScrollBar->SetThumbPos( m_pScrollBar->GetThumbPos() + ( _bUp? -1 : 1 ) );
static_cast< HangulHanjaEditDictDialog* >( GetParentDialog() )->UpdateScrollbar();
m_pScrollBar->vadjustment_set_value( m_pScrollBar->vadjustment_get_value() + ( _bUp? -1 : 1 ) );
m_pParent->UpdateScrollbar();
}
SuggestionEdit::SuggestionEdit( vcl::Window* pParent, WinBits nBits )
: Edit(pParent, nBits)
SuggestionEdit::SuggestionEdit(std::unique_ptr<weld::Entry> xEntry, HangulHanjaEditDictDialog* pParent)
: m_pParent(pParent)
, m_pPrev(nullptr)
, m_pNext(nullptr)
, m_pScrollBar(nullptr)
, m_xEntry(std::move(xEntry))
{
m_xEntry->connect_key_press(LINK(this, SuggestionEdit, KeyInputHdl));
}
SuggestionEdit::~SuggestionEdit()
{
disposeOnce();
}
void SuggestionEdit::dispose()
{
m_pPrev.clear();
m_pNext.clear();
m_pScrollBar.clear();
Edit::dispose();
}
bool SuggestionEdit::PreNotify( NotifyEvent& rNEvt )
IMPL_LINK(SuggestionEdit, KeyInputHdl, const KeyEvent&, rKEvt, bool)
{
bool bHandled = false;
if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
sal_uInt16 nMod = rKeyCode.GetModifier();
sal_uInt16 nCode = rKeyCode.GetCode();
if( nCode == KEY_TAB && ( !nMod || KEY_SHIFT == nMod ) )
{
const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
const vcl::KeyCode& rKeyCode = pKEvt->GetKeyCode();
sal_uInt16 nMod = rKeyCode.GetModifier();
sal_uInt16 nCode = rKeyCode.GetCode();
if( nCode == KEY_TAB && ( !nMod || KEY_SHIFT == nMod ) )
bool bUp = KEY_SHIFT == nMod;
if( ShouldScroll( bUp ) )
{
bool bUp = KEY_SHIFT == nMod;
if( ShouldScroll( bUp ) )
DoJump( bUp );
m_xEntry->select_region(0, -1);
// Tab-travel doesn't really happen, so emulate it by setting a selection manually
bHandled = true;
}
}
else if( KEY_UP == nCode || KEY_DOWN == nCode )
{
bool bUp = KEY_UP == nCode;
if( ShouldScroll( bUp ) )
{
DoJump( bUp );
bHandled = true;
}
else if( bUp )
{
if( m_pPrev )
{
DoJump( bUp );
SetSelection( Selection( 0, SELECTION_MAX ) );
// Tab-travel doesn't really happen, so emulate it by setting a selection manually
m_pPrev->grab_focus();
bHandled = true;
}
}
else if( KEY_UP == nCode || KEY_DOWN == nCode )
else if( m_pNext )
{
bool bUp = KEY_UP == nCode;
if( ShouldScroll( bUp ) )
{
DoJump( bUp );
bHandled = true;
}
else if( bUp )
{
if( m_pPrev )
{
m_pPrev->GrabFocus();
bHandled = true;
}
}
else if( m_pNext )
{
m_pNext->GrabFocus();
bHandled = true;
}
m_pNext->grab_focus();
bHandled = true;
}
}
if( !bHandled )
bHandled = Edit::PreNotify( rNEvt );
return bHandled;
}
void SuggestionEdit::init( ScrollBar* pScrollBar, SuggestionEdit* pPrev, SuggestionEdit* pNext)
void SuggestionEdit::init(weld::ScrolledWindow* pScrollBar, SuggestionEdit* pPrev, SuggestionEdit* pNext)
{
m_pScrollBar = pScrollBar;
m_pPrev = pPrev;
m_pNext = pNext;
}
VCL_BUILDER_FACTORY_ARGS(SuggestionEdit, WB_LEFT|WB_VCENTER|WB_BORDER)
namespace
{
bool GetConversions( const Reference< XConversionDictionary >& _xDict,
@@ -1450,47 +1429,46 @@ namespace svx
}
}
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, ScrollHdl, ScrollBar*, void )
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, ScrollHdl, weld::ScrolledWindow&, void )
{
UpdateScrollbar();
}
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, OriginalModifyHdl, Edit&, void )
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, OriginalModifyHdl, weld::ComboBox&, void )
{
m_bModifiedOriginal = true;
m_aOriginal = comphelper::string::stripEnd( m_aOriginalLB->GetText(), ' ' );
m_aOriginal = comphelper::string::stripEnd( m_xOriginalLB->get_active_text(), ' ' );
UpdateSuggestions();
UpdateButtonStates();
}
IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl1, Edit&, rEdit, void )
IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl1, weld::Entry&, rEdit, void )
{
EditModify( &rEdit, 0 );
}
IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl2, Edit&, rEdit, void )
IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl2, weld::Entry&, rEdit, void )
{
EditModify( &rEdit, 1 );
}
IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl3, Edit&, rEdit, void )
IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl3, weld::Entry&, rEdit, void )
{
EditModify( &rEdit, 2 );
}
IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl4, Edit&, rEdit, void )
IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl4, weld::Entry&, rEdit, void )
{
EditModify( &rEdit, 3 );
}
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, BookLBSelectHdl, ListBox&, void )
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, BookLBSelectHdl, weld::ComboBox&, void )
{
InitEditDictDialog( m_aBookLB->GetSelectedEntryPos() );
InitEditDictDialog( m_xBookLB->get_active() );
}
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, NewPBPushHdl, Button*, void )
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, NewPBPushHdl, weld::Button&, void )
{
DBG_ASSERT( m_pSuggestions, "-HangulHanjaEditDictDialog::NewPBPushHdl(): no suggestions... search in hell..." );
Reference< XConversionDictionary > xDict = m_rDictList[ m_nCurrentDict ];
@@ -1558,7 +1536,7 @@ namespace svx
return bRemovedSomething;
}
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, DeletePBPushHdl, Button*, void )
IMPL_LINK_NOARG( HangulHanjaEditDictDialog, DeletePBPushHdl, weld::Button&, void )
{
if( DeleteEntryFromDictionary( m_rDictList[ m_nCurrentDict ] ) )
{
@@ -1568,22 +1546,23 @@ namespace svx
}
}
void HangulHanjaEditDictDialog::InitEditDictDialog( sal_uInt32 _nSelDict )
void HangulHanjaEditDictDialog::InitEditDictDialog( sal_uInt32 nSelDict )
{
if( m_pSuggestions )
m_pSuggestions->Clear();
if( m_nCurrentDict != _nSelDict )
if( m_nCurrentDict != nSelDict )
{
m_nCurrentDict = _nSelDict;
m_nCurrentDict = nSelDict;
m_aOriginal.clear();
m_bModifiedOriginal = true;
}
UpdateOriginalLB();
m_aOriginalLB->SetText( !m_aOriginal.isEmpty() ? m_aOriginal : m_aEditHintText, Selection( 0, SELECTION_MAX ) );
m_aOriginalLB->GrabFocus();
m_xOriginalLB->set_entry_text( !m_aOriginal.isEmpty() ? m_aOriginal : m_aEditHintText);
m_xOriginalLB->select_entry_region(0, -1);
m_xOriginalLB->grab_focus();
UpdateSuggestions();
UpdateButtonStates();
@@ -1591,7 +1570,7 @@ namespace svx
void HangulHanjaEditDictDialog::UpdateOriginalLB()
{
m_aOriginalLB->Clear();
m_xOriginalLB->clear();
Reference< XConversionDictionary > xDict = m_rDictList[ m_nCurrentDict ];
if( xDict.is() )
{
@@ -1600,7 +1579,7 @@ namespace svx
OUString* pEntry = aEntries.getArray();
while( n )
{
m_aOriginalLB->InsertEntry( *pEntry );
m_xOriginalLB->append_text( *pEntry );
++pEntry;
--n;
@@ -1618,8 +1597,8 @@ namespace svx
bool bNew = bHaveValidOriginalString && m_pSuggestions && m_pSuggestions->GetCount() > 0;
bNew = bNew && ( m_bModifiedSuggestions || m_bModifiedOriginal );
m_aNewPB->Enable( bNew );
m_aDeletePB->Enable(!m_bModifiedOriginal && bHaveValidOriginalString);
m_xNewPB->set_sensitive( bNew );
m_xDeletePB->set_sensitive(!m_bModifiedOriginal && bHaveValidOriginalString);
}
void HangulHanjaEditDictDialog::UpdateSuggestions()
@@ -1652,26 +1631,26 @@ namespace svx
m_bModifiedSuggestions = false;
}
m_aScrollSB->SetThumbPos( 0 );
m_xScrollSB->vadjustment_set_value( 0 );
UpdateScrollbar(); // will force edits to be filled new
}
void HangulHanjaEditDictDialog::SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum )
void HangulHanjaEditDictDialog::SetEditText(SuggestionEdit& rEdit, sal_uInt16 nEntryNum)
{
OUString aStr;
if( m_pSuggestions )
{
aStr = m_pSuggestions->Get( _nEntryNum );
aStr = m_pSuggestions->Get(nEntryNum);
}
_rEdit.SetText( aStr );
rEdit.set_text(aStr);
}
void HangulHanjaEditDictDialog::EditModify( Edit const * _pEdit, sal_uInt8 _nEntryOffset )
void HangulHanjaEditDictDialog::EditModify(const weld::Entry* pEdit, sal_uInt8 _nEntryOffset)
{
m_bModifiedSuggestions = true;
OUString aTxt( _pEdit->GetText() );
OUString aTxt( pEdit->get_text() );
sal_uInt16 nEntryNum = m_nTopPos + _nEntryOffset;
if( aTxt.isEmpty() )
{
@@ -1690,54 +1669,55 @@ namespace svx
UpdateButtonStates();
}
HangulHanjaEditDictDialog::HangulHanjaEditDictDialog( vcl::Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict )
:ModalDialog ( _pParent, "HangulHanjaEditDictDialog", "cui/ui/hangulhanjaeditdictdialog.ui" )
,m_aEditHintText ( CuiResId(RID_SVXSTR_EDITHINT) )
,m_rDictList ( _rDictList )
,m_nCurrentDict ( 0xFFFFFFFF )
,m_nTopPos ( 0 )
,m_bModifiedSuggestions ( false )
,m_bModifiedOriginal ( false )
HangulHanjaEditDictDialog::HangulHanjaEditDictDialog(weld::Window* pParent, HHDictList& _rDictList, sal_uInt32 nSelDict)
: GenericDialogController(pParent, "cui/ui/hangulhanjaeditdictdialog.ui", "HangulHanjaEditDictDialog")
, m_aEditHintText ( CuiResId(RID_SVXSTR_EDITHINT) )
, m_rDictList ( _rDictList )
, m_nCurrentDict ( 0xFFFFFFFF )
, m_nTopPos ( 0 )
, m_bModifiedSuggestions ( false )
, m_bModifiedOriginal ( false )
, m_xBookLB(m_xBuilder->weld_combo_box("book"))
, m_xOriginalLB(m_xBuilder->weld_combo_box("original"))
, m_xEdit1(new SuggestionEdit(m_xBuilder->weld_entry("edit1"), this))
, m_xEdit2(new SuggestionEdit(m_xBuilder->weld_entry("edit2"), this))
, m_xEdit3(new SuggestionEdit(m_xBuilder->weld_entry("edit3"), this))
, m_xEdit4(new SuggestionEdit(m_xBuilder->weld_entry("edit4"), this))
, m_xContents(m_xBuilder->weld_widget("box"))
, m_xScrollSB(m_xBuilder->weld_scrolled_window("scrollbar"))
, m_xNewPB(m_xBuilder->weld_button("new"))
, m_xDeletePB(m_xBuilder->weld_button("delete"))
{
get( m_aBookLB, "book" );
get( m_aOriginalLB, "original" );
get( m_aNewPB, "new" );
get( m_aDeletePB, "delete" );
get( m_aScrollSB, "scrollbar" );
get( m_aEdit1, "edit1" );
get( m_aEdit2, "edit2" );
get( m_aEdit3, "edit3" );
get( m_aEdit4, "edit4" );
m_xScrollSB->set_user_managed_scrolling();
m_aEdit1->init( m_aScrollSB, nullptr, m_aEdit2 );
m_aEdit2->init( m_aScrollSB, m_aEdit1, m_aEdit3 );
m_aEdit3->init( m_aScrollSB, m_aEdit2, m_aEdit4 );
m_aEdit4->init( m_aScrollSB, m_aEdit3, nullptr );
Size aSize(m_xContents->get_preferred_size());
m_xScrollSB->set_size_request(-1, aSize.Height());
m_aOriginalLB->SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, OriginalModifyHdl ) );
m_xEdit1->init( m_xScrollSB.get(), nullptr, m_xEdit2.get() );
m_xEdit2->init( m_xScrollSB.get(), m_xEdit1.get(), m_xEdit3.get() );
m_xEdit3->init( m_xScrollSB.get(), m_xEdit2.get(), m_xEdit4.get() );
m_xEdit4->init( m_xScrollSB.get(), m_xEdit3.get(), nullptr );
m_aNewPB->SetClickHdl( LINK( this, HangulHanjaEditDictDialog, NewPBPushHdl ) );
m_aNewPB->Enable( false );
m_xOriginalLB->connect_changed( LINK( this, HangulHanjaEditDictDialog, OriginalModifyHdl ) );
m_aDeletePB->SetClickHdl( LINK( this, HangulHanjaEditDictDialog, DeletePBPushHdl ) );
m_aDeletePB->Enable( false );
m_xNewPB->connect_clicked( LINK( this, HangulHanjaEditDictDialog, NewPBPushHdl ) );
m_xNewPB->set_sensitive( false );
m_xDeletePB->connect_clicked( LINK( this, HangulHanjaEditDictDialog, DeletePBPushHdl ) );
m_xDeletePB->set_sensitive( false );
static_assert(MAXNUM_SUGGESTIONS >= 5, "number of suggestions should not under-run the value of 5");
Link<ScrollBar*,void> aScrLk( LINK( this, HangulHanjaEditDictDialog, ScrollHdl ) );
m_aScrollSB->SetScrollHdl( aScrLk );
m_aScrollSB->SetEndScrollHdl( aScrLk );
m_aScrollSB->SetRangeMin( 0 );
m_aScrollSB->SetRangeMax( MAXNUM_SUGGESTIONS );
m_aScrollSB->SetPageSize( 4 ); // because we have 4 edits / page
m_aScrollSB->SetVisibleSize( 4 );
// 4 here, because we have 4 edits / page
m_xScrollSB->vadjustment_configure(0, 0, MAXNUM_SUGGESTIONS, 1, 4, 4);
m_xScrollSB->connect_vadjustment_changed(LINK(this, HangulHanjaEditDictDialog, ScrollHdl));
m_aEdit1->SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl1 ) );
m_aEdit2->SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl2 ) );
m_aEdit3->SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl3 ) );
m_aEdit4->SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl4 ) );
m_xEdit1->connect_changed( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl1 ) );
m_xEdit2->connect_changed( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl2 ) );
m_xEdit3->connect_changed( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl3 ) );
m_xEdit4->connect_changed( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl4 ) );
m_aBookLB->SetSelectHdl( LINK( this, HangulHanjaEditDictDialog, BookLBSelectHdl ) );
m_xBookLB->connect_changed( LINK( this, HangulHanjaEditDictDialog, BookLBSelectHdl ) );
sal_uInt32 nDictCnt = m_rDictList.size();
for( sal_uInt32 n = 0 ; n < nDictCnt ; ++n )
{
@@ -1745,46 +1725,27 @@ namespace svx
OUString aName;
if( xDic.is() )
aName = xDic->getName();
m_aBookLB->InsertEntry( aName );
m_xBookLB->append_text( aName );
}
m_aBookLB->SelectEntryPos( sal_uInt16( _nSelDict ) );
m_xBookLB->set_active(nSelDict);
InitEditDictDialog( _nSelDict );
InitEditDictDialog(nSelDict);
}
HangulHanjaEditDictDialog::~HangulHanjaEditDictDialog()
{
disposeOnce();
}
void HangulHanjaEditDictDialog::dispose()
{
m_pSuggestions.reset();
m_aBookLB.clear();
m_aOriginalLB.clear();
m_aEdit1.clear();
m_aEdit2.clear();
m_aEdit3.clear();
m_aEdit4.clear();
m_aScrollSB.clear();
m_aNewPB.clear();
m_aDeletePB.clear();
ModalDialog::dispose();
}
void HangulHanjaEditDictDialog::UpdateScrollbar()
{
sal_uInt16 nPos = sal_uInt16( m_aScrollSB->GetThumbPos() );
sal_uInt16 nPos = m_xScrollSB->vadjustment_get_value();
m_nTopPos = nPos;
SetEditText( *m_aEdit1, nPos++ );
SetEditText( *m_aEdit2, nPos++ );
SetEditText( *m_aEdit3, nPos++ );
SetEditText( *m_aEdit4, nPos );
SetEditText( *m_xEdit1, nPos++ );
SetEditText( *m_xEdit2, nPos++ );
SetEditText( *m_xEdit3, nPos++ );
SetEditText( *m_xEdit4, nPos );
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -244,26 +244,31 @@ namespace svx
};
class SuggestionList;
class HangulHanjaEditDictDialog;
class SuggestionEdit : public Edit
class SuggestionEdit
{
private:
VclPtr<SuggestionEdit> m_pPrev;
VclPtr<SuggestionEdit> m_pNext;
VclPtr<ScrollBar> m_pScrollBar;
HangulHanjaEditDictDialog* m_pParent;
SuggestionEdit* m_pPrev;
SuggestionEdit* m_pNext;
weld::ScrolledWindow* m_pScrollBar;
std::unique_ptr<weld::Entry> m_xEntry;
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);
SuggestionEdit(std::unique_ptr<weld::Entry> xEntry, HangulHanjaEditDictDialog* pParent);
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
void init(weld::ScrolledWindow* pScrollBar, SuggestionEdit* pPrev, SuggestionEdit* pNext);
void grab_focus() { m_xEntry->grab_focus(); }
OUString get_text() const { return m_xEntry->get_text(); }
void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
void connect_changed(const Link<weld::Entry&, void>& rLink) { m_xEntry->connect_changed(rLink); }
};
class HangulHanjaEditDictDialog : public ModalDialog
class HangulHanjaEditDictDialog : public weld::GenericDialogController
{
private:
const OUString m_aEditHintText;
@@ -273,53 +278,50 @@ namespace svx
OUString m_aOriginal;
std::unique_ptr<SuggestionList> m_pSuggestions;
VclPtr<ListBox> m_aBookLB;
VclPtr<ComboBox> m_aOriginalLB;
VclPtr<SuggestionEdit> m_aEdit1;
VclPtr<SuggestionEdit> m_aEdit2;
VclPtr<SuggestionEdit> m_aEdit3;
VclPtr<SuggestionEdit> m_aEdit4;
VclPtr<ScrollBar> m_aScrollSB;
VclPtr<PushButton> m_aNewPB;
VclPtr<PushButton> 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 );
std::unique_ptr<weld::ComboBox> m_xBookLB;
std::unique_ptr<weld::ComboBox> m_xOriginalLB;
std::unique_ptr<SuggestionEdit> m_xEdit1;
std::unique_ptr<SuggestionEdit> m_xEdit2;
std::unique_ptr<SuggestionEdit> m_xEdit3;
std::unique_ptr<SuggestionEdit> m_xEdit4;
std::unique_ptr<weld::Widget> m_xContents;
std::unique_ptr<weld::ScrolledWindow> m_xScrollSB;
std::unique_ptr<weld::Button> m_xNewPB;
std::unique_ptr<weld::Button> m_xDeletePB;
DECL_LINK( BookLBSelectHdl, ListBox&, void );
DECL_LINK( NewPBPushHdl, Button*, void );
DECL_LINK( DeletePBPushHdl, Button*, void );
DECL_LINK( OriginalModifyHdl, weld::ComboBox&, void );
DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void );
DECL_LINK( EditModifyHdl1, weld::Entry&, void );
DECL_LINK( EditModifyHdl2, weld::Entry&, void );
DECL_LINK( EditModifyHdl3, weld::Entry&, void );
DECL_LINK( EditModifyHdl4, weld::Entry&, void );
void InitEditDictDialog( sal_uInt32 _nSelDict );
DECL_LINK( BookLBSelectHdl, weld::ComboBox&, void );
DECL_LINK( NewPBPushHdl, weld::Button&, void );
DECL_LINK( DeletePBPushHdl, weld::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 );
void SetEditText( SuggestionEdit& rEdit, sal_uInt16 nEntryNum );
void EditModify( const weld::Entry* 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;
HangulHanjaEditDictDialog(weld::Window* pParent, HHDictList& rDictList, sal_uInt32 nSelDict);
virtual ~HangulHanjaEditDictDialog() override;
void UpdateScrollbar();
};
}
#endif // SVX_HANGUL_HANJA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="HangulHanjaEditDictDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="hangulhanjaeditdictdialog|HangulHanjaEditDictDialog">Edit Custom Dictionary</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -85,7 +90,7 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkComboBox" id="book">
<object class="GtkComboBoxText" id="book">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
@@ -103,10 +108,10 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="hangulhanjaeditdictdialog|label4">Book</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">book</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -138,7 +143,7 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkComboBox" id="original">
<object class="GtkComboBoxText" id="original">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
@@ -147,7 +152,6 @@
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry">
<property name="can_focus">True</property>
<property name="xalign">0.5</property>
<property name="shadow_type">none</property>
<property name="caps_lock_warning">False</property>
</object>
@@ -209,9 +213,9 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="hangulhanjaeditdictdialog|label2">Original</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -228,6 +232,7 @@
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
@@ -237,82 +242,77 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box3">
<object class="GtkScrolledWindow" id="scrollbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="can_focus">True</property>
<property name="valign">start</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkBox" id="box4">
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="cuilo-SuggestionEdit" id="edit1">
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="width_chars">40</property>
<property name="border_width">3</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="edit1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="width_chars">40</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="edit2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="edit3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="edit4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="cuilo-SuggestionEdit" id="edit2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="cuilo-SuggestionEdit" id="edit3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="cuilo-SuggestionEdit" id="edit4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrollbar" id="scrollbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
@@ -322,10 +322,10 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="hangulhanjaeditdictdialog|label3">Suggestions</property>
<property name="use_underline">True</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -348,6 +348,7 @@
</object>
</child>
<action-widgets>
<action-widget response="-7">close</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
</object>

View File

@@ -521,9 +521,6 @@
generic-name="DataTreeListBox" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Suggestion Edit" name="cuilo-SuggestionEdit"
generic-name="SuggestionEdit" parent="GtkEntry"
icon-name="widget-gtk-textentry"/>
<glade-widget-class title="Suggestion Display" name="cuilo-SuggestionDisplay"
generic-name="SuggestionDisplay" parent="GtkTextView"
icon-name="widget-gtk-textview"/>

View File

@@ -217,6 +217,8 @@ public:
virtual int vadjustment_get_upper() const = 0;
virtual void vadjustment_set_upper(int upper) = 0;
virtual int vadjustment_get_page_size() const = 0;
virtual int vadjustment_get_lower() const = 0;
virtual void vadjustment_set_lower(int upper) = 0;
virtual void set_vpolicy(VclPolicyType eVPolicy) = 0;
virtual VclPolicyType get_vpolicy() const = 0;
void connect_vadjustment_changed(const Link<ScrolledWindow&, void>& rLink)

View File

@@ -502,7 +502,6 @@ custom_widgets = [
'StatusBar',
'StructListBox',
'SuggestionDisplay',
'SuggestionEdit',
'SvSimpleTableContainer',
'SvTreeListBox',
'SvtFileView',

View File

@@ -237,6 +237,10 @@ cui/uiconfig/ui/hangulhanjaconversiondialog.ui://GtkLabel[@id='label4'] orphan-l
cui/uiconfig/ui/hangulhanjaconversiondialog.ui://cuilo-SuggestionDisplay[@id='suggestions:border'] no-labelled-by
cui/uiconfig/ui/hangulhanjaconversiondialog.ui://GtkLabel[@id='label5'] orphan-label
cui/uiconfig/ui/hangulhanjaconversiondialog.ui://GtkLabel[@id='label6'] orphan-label
cui/uiconfig/ui/hangulhanjaeditdictdialog.ui://GtkEntry[@id='edit1'] no-labelled-by
cui/uiconfig/ui/hangulhanjaeditdictdialog.ui://GtkEntry[@id='edit2'] no-labelled-by
cui/uiconfig/ui/hangulhanjaeditdictdialog.ui://GtkEntry[@id='edit3'] no-labelled-by
cui/uiconfig/ui/hangulhanjaeditdictdialog.ui://GtkEntry[@id='edit4'] no-labelled-by
cui/uiconfig/ui/hatchpage.ui://GtkLabel[@id='angleft'] orphan-label
cui/uiconfig/ui/hatchpage.ui://GtkScale[@id='angleslider'] no-labelled-by
cui/uiconfig/ui/hatchpage.ui://GtkSpinButton[@id='anglemtr'] no-labelled-by

View File

@@ -1180,6 +1180,18 @@ public:
rVertScrollBar.SetRangeMax(upper);
}
virtual int vadjustment_get_lower() const override
{
ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
return rVertScrollBar.GetRangeMin();
}
virtual void vadjustment_set_lower(int lower) override
{
ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
rVertScrollBar.SetRangeMin(lower);
}
virtual int vadjustment_get_page_size() const override
{
ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();

View File

@@ -3051,6 +3051,18 @@ public:
enable_notify_events();
}
virtual int vadjustment_get_lower() const override
{
return gtk_adjustment_get_lower(m_pVAdjustment);
}
virtual void vadjustment_set_lower(int lower) override
{
disable_notify_events();
gtk_adjustment_set_lower(m_pVAdjustment, lower);
enable_notify_events();
}
virtual int vadjustment_get_page_size() const override
{
return gtk_adjustment_get_page_size(m_pVAdjustment);