Kaydet (Commit) eef849b8 authored tarafından Caolán McNamara's avatar Caolán McNamara

convert hyphenate dialog to .ui

Change-Id: I0025ce0107deaaf6b4698745691c9f0bfddc7c34
üst 3479c1fb
......@@ -66,7 +66,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
cui/source/dialogs/hangulhanjadlg.src \
cui/source/dialogs/hlmarkwn.src \
cui/source/dialogs/hyperdlg.src \
cui/source/dialogs/hyphen.src \
cui/source/dialogs/iconcdlg.src \
cui/source/dialogs/insrc.src \
cui/source/dialogs/multipat.src \
......
......@@ -12,6 +12,7 @@ $(eval $(call gb_UI_UI,cui))
$(eval $(call gb_UI_add_uifiles,cui,\
cui/uiconfig/ui/charnamepage \
cui/uiconfig/ui/effectspage \
cui/uiconfig/ui/hyphenate \
cui/uiconfig/ui/positionpage \
cui/uiconfig/ui/specialcharacters \
cui/uiconfig/ui/thesaurus \
......
......@@ -18,7 +18,6 @@
*/
#include "hyphen.hxx"
#include "hyphen.hrc"
#include "cuires.hrc"
#include "dialmgr.hxx"
......@@ -36,12 +35,15 @@
#define CUR_HYPH_POS_CHAR '-'
HyphenEdit::HyphenEdit( Window* pParent, const ResId& rResId ) :
Edit( pParent, rResId )
HyphenEdit::HyphenEdit(Window* pParent)
: Edit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK)
{
}
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeHyphenEdit(Window *pParent, VclBuilder::stringmap &)
{
return new HyphenEdit(pParent);
}
void HyphenEdit::KeyInput( const KeyEvent& rKEvt )
{
......@@ -75,12 +77,12 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl()
xub_StrLen nLen = aTxt.Len();
xub_StrLen i;
aRightBtn.Disable();
m_pRightBtn->Disable();
for ( i = nOldPos + 2; i < nLen; ++i )
{
if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) )
{
aRightBtn.Enable();
m_pRightBtn->Enable();
break;
}
}
......@@ -88,12 +90,12 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl()
DBG_ASSERT(nOldPos < aTxt.Len(), "nOldPos out of range");
if (nOldPos >= aTxt.Len())
nOldPos = aTxt.Len() - 1;
aLeftBtn.Disable();
m_pLeftBtn->Disable();
for ( i = nOldPos; i-- > 0; )
{
if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) )
{
aLeftBtn.Enable();
m_pLeftBtn->Enable();
break;
}
}
......@@ -211,7 +213,7 @@ void SvxHyphenWordDialog::InitControls_Impl()
if (xPossHyph.is())
aEditWord = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos );
}
aWordEdit.SetText( aEditWord );
m_pWordEdit->SetText( aEditWord );
nOldPos = aEditWord.Len();
SelLeft();
......@@ -277,7 +279,7 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos )
sal_uInt16 SvxHyphenWordDialog::GetHyphIndex_Impl()
{
sal_uInt16 nPos = 0;
String aTxt( aWordEdit.GetText() );
String aTxt( m_pWordEdit->GetText() );
for ( sal_uInt16 i=0 ; i < aTxt.Len(); ++i )
{
......@@ -305,9 +307,9 @@ void SvxHyphenWordDialog::SelLeft()
aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) );
nOldPos = i;
aWordEdit.SetText( aTxt );
aWordEdit.GrabFocus();
aWordEdit.SetSelection( Selection( i, i + 1 ) );
m_pWordEdit->SetText( aTxt );
m_pWordEdit->GrabFocus();
m_pWordEdit->SetSelection( Selection( i, i + 1 ) );
break;
}
}
......@@ -327,9 +329,9 @@ void SvxHyphenWordDialog::SelRight()
aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) );
nOldPos = i;
aWordEdit.SetText( aTxt );
aWordEdit.GrabFocus();
aWordEdit.SetSelection( Selection( i, i + 1 ) );
m_pWordEdit->SetText( aTxt );
m_pWordEdit->GrabFocus();
m_pWordEdit->SetSelection( Selection( i, i + 1 ) );
break;
}
}
......@@ -443,7 +445,7 @@ IMPL_LINK_NOARG(SvxHyphenWordDialog, Right_Impl)
IMPL_LINK_NOARG(SvxHyphenWordDialog, GetFocusHdl_Impl)
{
aWordEdit.SetSelection( Selection( nOldPos, nOldPos + 1 ) );
m_pWordEdit->SetSelection( Selection( nOldPos, nOldPos + 1 ) );
return 0;
}
......@@ -454,37 +456,32 @@ SvxHyphenWordDialog::SvxHyphenWordDialog(
const String &rWord, LanguageType nLang,
Window* pParent,
uno::Reference< linguistic2::XHyphenator > &xHyphen,
SvxSpellWrapper* pWrapper ) :
SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ),
aWordFT ( this, CUI_RES( FT_WORD ) ),
aWordEdit ( this, CUI_RES( ED_WORD ) ),
aLeftBtn ( this, CUI_RES( BTN_LEFT ) ),
aRightBtn ( this, CUI_RES( BTN_RIGHT ) ),
aOkBtn ( this, CUI_RES( BTN_HYPH_CUT ) ),
aContBtn ( this, CUI_RES( BTN_HYPH_CONTINUE ) ),
aDelBtn ( this, CUI_RES( BTN_HYPH_DELETE ) ),
aFLBottom ( this, CUI_RES( FL_BOTTOM ) ),
aHelpBtn ( this, CUI_RES( BTN_HYPH_HELP ) ),
aHyphAll ( this, CUI_RES( BTN_HYPH_ALL ) ),
aCancelBtn ( this, CUI_RES( BTN_HYPH_CANCEL ) ),
aLabel ( GetText() ),
pHyphWrapper ( NULL ),
xHyphenator ( NULL ),
xPossHyph ( NULL ),
aActWord ( ),
nActLanguage ( LANGUAGE_NONE ),
nMaxHyphenationPos ( 0 ),
nHyphPos ( 0 ),
nOldPos ( 0 ),
nHyphenationPositionsOffset( 0 ),
bBusy ( sal_False )
SvxSpellWrapper* pWrapper)
: SfxModalDialog(pParent, "HyphenateDialog", "cui/ui/hyphenate.ui")
, pHyphWrapper(NULL)
, xHyphenator(NULL)
, xPossHyph(NULL)
, nActLanguage(LANGUAGE_NONE)
, nMaxHyphenationPos(0)
, nHyphPos(0)
, nOldPos(0)
, nHyphenationPositionsOffset(0)
, bBusy(sal_False)
{
aActWord = rWord;
nActLanguage = nLang;
xHyphenator = xHyphen;
pHyphWrapper = pWrapper;
get(m_pWordEdit, "worded");
get(m_pLeftBtn, "left");
get(m_pRightBtn, "right");
get(m_pOkBtn, "ok");
get(m_pContBtn, "continue");
get(m_pDelBtn, "delete");
get(m_pHyphAll, "hyphall");
get(m_pCloseBtn, "close");
aLabel = GetText();
aActWord = rWord;
nActLanguage = nLang;
xHyphenator = xHyphen;
pHyphWrapper = pWrapper;
uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper ?
pHyphWrapper->GetLast() : NULL, uno::UNO_QUERY );
......@@ -497,18 +494,16 @@ SvxHyphenWordDialog::SvxHyphenWordDialog(
}
InitControls_Impl();
aWordEdit.GrabFocus();
aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Left_Impl ) );
aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Right_Impl ) );
aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, CutHdl_Impl ) );
aContBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, ContinueHdl_Impl ) );
aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, DeleteHdl_Impl ) );
aHyphAll.SetClickHdl( LINK( this, SvxHyphenWordDialog, HyphenateAllHdl_Impl ) );
aCancelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, CancelHdl_Impl ) );
aWordEdit.SetGetFocusHdl( LINK( this, SvxHyphenWordDialog, GetFocusHdl_Impl ) );
FreeResource();
m_pWordEdit->GrabFocus();
m_pLeftBtn->SetClickHdl( LINK( this, SvxHyphenWordDialog, Left_Impl ) );
m_pRightBtn->SetClickHdl( LINK( this, SvxHyphenWordDialog, Right_Impl ) );
m_pOkBtn->SetClickHdl( LINK( this, SvxHyphenWordDialog, CutHdl_Impl ) );
m_pContBtn->SetClickHdl( LINK( this, SvxHyphenWordDialog, ContinueHdl_Impl ) );
m_pDelBtn->SetClickHdl( LINK( this, SvxHyphenWordDialog, DeleteHdl_Impl ) );
m_pHyphAll->SetClickHdl( LINK( this, SvxHyphenWordDialog, HyphenateAllHdl_Impl ) );
m_pCloseBtn->SetClickHdl( LINK( this, SvxHyphenWordDialog, CancelHdl_Impl ) );
m_pWordEdit->SetGetFocusHdl( LINK( this, SvxHyphenWordDialog, GetFocusHdl_Impl ) );
SetWindowTitle( nLang );
......
/*
* 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 _SVX_HYPHEN_HRC
#define _SVX_HYPHEN_HRC
// defines ------------------------------------------------------------------
#define ED_WORD 10
#define BTN_LEFT 11
#define BTN_RIGHT 12
#define FT_WORD 13
#define FL_BOTTOM 14
#define BTN_HYPH_CONTINUE 20
#define BTN_HYPH_DELETE 21
#define BTN_HYPH_CUT 22
#define BTN_HYPH_CANCEL 23
#define BTN_HYPH_HELP 24
#define BTN_HYPH_ALL 25
#endif
/*
* 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 .
*/
#include "helpid.hrc"
#include "cuires.hrc"
#include "hyphen.hrc"
String RID_SVXSTR_HMERR_CHECKINSTALL
{
Text [ en-US ] = "is not available for spellchecking\nPlease check your installation and install the desired language\n" ;
};
// RID_SVXDLG_HYPHENATE --------------------------------------------------
ModalDialog RID_SVXDLG_HYPHENATE
{
HelpId = HID_HYPHENATE ;
Size = MAP_APPFONT ( 200 , 111 ) ;
OutputSize = TRUE ;
SvLook = TRUE ;
Text [ en-US ] = "Hyphenation" ;
Moveable = TRUE ;
FixedText FT_WORD
{
Pos = MAP_APPFONT ( 5 , 5 ) ;
Size = MAP_APPFONT ( 120 , 8 ) ;
Text [ en-US ] = "~Word" ;
};
Edit ED_WORD
{
HelpID = "cui:Edit:RID_SVXDLG_HYPHENATE:ED_WORD";
BORDER = TRUE ;
Pos = MAP_APPFONT ( 5 , 17 ) ;
Size = MAP_APPFONT ( 132 , 12 ) ;
TABSTOP = TRUE ;
LEFT = TRUE ;
};
ImageButton BTN_LEFT
{
HelpID = "cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_LEFT";
Pos = MAP_APPFONT ( 56 , 33 ) ;
Size = MAP_APPFONT ( 14 , 14 ) ;
TABSTOP = TRUE ;
SYMBOL = IMAGEBUTTON_ARROW_LEFT ;
};
ImageButton BTN_RIGHT
{
HelpID = "cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_RIGHT";
Pos = MAP_APPFONT ( 75 , 33 ) ;
Size = MAP_APPFONT ( 14 , 14 ) ;
TABSTOP = TRUE ;
Symbol = IMAGEBUTTON_ARROW_RIGHT ;
};
OKButton BTN_HYPH_CUT
{
Pos = MAP_APPFONT ( 144 , 17 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "H~yphenate" ;
TABSTOP = TRUE ;
DEFBUTTON = TRUE ;
};
PushButton BTN_HYPH_CONTINUE
{
HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_CONTINUE";
Pos = MAP_APPFONT ( 144 , 35 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Skip" ;
TABSTOP = TRUE ;
};
PushButton BTN_HYPH_DELETE
{
HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_DELETE";
Pos = MAP_APPFONT ( 144 , 52 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Remove" ;
TABSTOP = TRUE ;
};
FixedLine FL_BOTTOM
{
Pos = MAP_APPFONT ( 0 , 81 ) ;
Size = MAP_APPFONT ( 200 , 8 ) ;
};
HelpButton BTN_HYPH_HELP
{
Pos = MAP_APPFONT ( 5 , 93 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TABSTOP = TRUE ;
};
PushButton BTN_HYPH_ALL
{
HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_ALL";
Pos = MAP_APPFONT ( 63 , 93 ) ;
Size = MAP_APPFONT ( 74 , 14 ) ;
Text [ en-US ] = "Hyphenate ~All" ;
TABSTOP = TRUE ;
};
CancelButton BTN_HYPH_CANCEL
{
Pos = MAP_APPFONT ( 144 , 93 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Close";
TABSTOP = TRUE ;
};
};
......@@ -201,8 +201,6 @@
#define RID_SVX_WND_COMMON_LINGU ( RID_SVX_START + 0 )
#define RID_SVX_GRFFILTER_DLG_EMBOSS_TAB (RID_SVX_START + 337)
#define RID_SVXDLG_SEARCHATTR (RID_SVX_START + 22)
#define RID_SVXDLG_HYPHENATE (RID_SVX_START + 30)
#define RID_SVXSTR_HMERR_CHECKINSTALL (RID_SVX_START + 94)
// hyperlink dialog
#define RID_SVXDLG_NEWHYPERLINK (RID_SVX_START + 227)
......
......@@ -342,7 +342,6 @@
#define HID_PAGE_TEXTATTR "CUI_HID_PAGE_TEXTATTR"
#define HID_TEXTATTR_CTL_POSITION "CUI_HID_TEXTATTR_CTL_POSITION"
#define HID_TRANS_POSITION_SIZE "CUI_HID_TRANS_POSITION_SIZE"
#define HID_HYPHENATE "CUI_HID_HYPHENATE"
#define HID_SVXPAGE_CHAR_NAME "CUI_HID_SVXPAGE_CHAR_NAME"
#define HID_HYPERLINK_INTERNET "CUI_HID_HYPERLINK_INTERNET"
#define HID_HYPERLINK_MAIL "CUI_HID_HYPERLINK_MAIL"
......
......@@ -36,27 +36,22 @@ class SvxSpellWrapper;
class HyphenEdit : public Edit
{
public:
HyphenEdit( Window* pParent, const ResId& rResId );
HyphenEdit(Window* pParent);
protected:
virtual void KeyInput( const KeyEvent &rKEvt );
virtual void KeyInput(const KeyEvent &rKEvt);
};
// class SvxHyphenWordDialog ---------------------------------------------
class SvxHyphenWordDialog : public SfxModalDialog
{
FixedText aWordFT;
HyphenEdit aWordEdit;
ImageButton aLeftBtn;
ImageButton aRightBtn;
OKButton aOkBtn;
PushButton aContBtn;
PushButton aDelBtn;
FixedLine aFLBottom;
HelpButton aHelpBtn;
PushButton aHyphAll;
CancelButton aCancelBtn;
HyphenEdit* m_pWordEdit;
PushButton* m_pLeftBtn;
PushButton* m_pRightBtn;
PushButton* m_pOkBtn;
PushButton* m_pContBtn;
PushButton* m_pDelBtn;
PushButton* m_pHyphAll;
PushButton* m_pCloseBtn;
String aLabel;
SvxSpellWrapper* pHyphWrapper;
uno::Reference< linguistic2::XHyphenator > xHyphenator;
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="HyphenateDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Hyphenation</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="hyphall">
<property name="label" translatable="yes">Hyphenate All</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">18</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Word</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="cuilo:HyphenEdit" id="worded">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label" translatable="yes">Hyphenate</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="continue">
<property name="label" translatable="yes">Skip</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete">
<property name="label">gtk-remove</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="left">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="image">image1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="right">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">start</property>
<property name="image">image2</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">button1</action-widget>
<action-widget response="0">hyphall</action-widget>
<action-widget response="0">close</action-widget>
</action-widgets>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-go-back</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-go-forward</property>
</object>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment