Kaydet (Commit) e10667a4 authored tarafından Faisal M. Al-Otaibi's avatar Faisal M. Al-Otaibi

Convert java class path dialog to .ui

Change-Id: I358651b9104b1fd274e70c090d5d16215cd9fd10
üst 7d3778e0
......@@ -42,6 +42,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/insertoleobject \
cui/uiconfig/ui/insertplugin \
cui/uiconfig/ui/insertrowcolumn \
cui/uiconfig/ui/javaclasspathdialog \
cui/uiconfig/ui/linedialog \
cui/uiconfig/ui/linetabpage \
cui/uiconfig/ui/lineendstabpage \
......
......@@ -34,7 +34,6 @@
#define HID_EDIT_MODULES "CUI_HID_EDIT_MODULES"
#define HID_OPTIONS_COLORCONFIG_SAVE_SCHEME "CUI_HID_OPTIONS_COLORCONFIG_SAVE_SCHEME"
#define HID_OPTIONS_JAVA_PARAMETER "CUI_HID_OPTIONS_JAVA_PARAMETER"
#define HID_OPTIONS_JAVA_CLASSPATH "CUI_HID_OPTIONS_JAVA_CLASSPATH"
#define HID_OFADLG_OPTIONS_TREE "CUI_HID_OFADLG_OPTIONS_TREE"
#define HID_OFA_CONNPOOL_DRIVERLIST "CUI_HID_OFA_CONNPOOL_DRIVERLIST"
#define UID_OFA_CONNPOOL_DRIVERLIST_BACK "CUI_UID_OFA_CONNPOOL_DRIVERLIST_BACK"
......
......@@ -921,61 +921,54 @@ void SvxJavaParameterDlg::SetParameters( Sequence< OUString >& rParams )
SvxJavaClassPathDlg::SvxJavaClassPathDlg( Window* pParent ) :
ModalDialog( pParent, CUI_RES( RID_SVXDLG_JAVA_CLASSPATH ) ),
m_aPathLabel ( this, CUI_RES( FT_PATH ) ),
m_aPathList ( this, CUI_RES( LB_PATH ) ),
m_aAddArchiveBtn ( this, CUI_RES( PB_ADDARCHIVE ) ),
m_aAddPathBtn ( this, CUI_RES( PB_ADDPATH ) ),
m_aRemoveBtn ( this, CUI_RES( PB_REMOVE_PATH ) ),
m_aButtonsLine ( this, CUI_RES( FL_PATH_BUTTONS ) ),
m_aOKBtn ( this, CUI_RES( PB_PATH_OK ) ),
m_aCancelBtn ( this, CUI_RES( PB_PATH_ESC ) ),
m_aHelpBtn ( this, CUI_RES( PB_PATH_HLP ) )
ModalDialog( pParent, "JavaClassPath", "cui/ui/javaclasspathdialog.ui" )
{
FreeResource();
m_aAddArchiveBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddArchiveHdl_Impl ) );
m_aAddPathBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddPathHdl_Impl ) );
m_aRemoveBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, RemoveHdl_Impl ) );
m_aPathList.SetSelectHdl( LINK( this, SvxJavaClassPathDlg, SelectHdl_Impl ) );
get( m_pPathList, "paths");
get( m_pAddArchiveBtn, "archive");
get( m_pAddPathBtn, "folder");
get( m_pRemoveBtn, "remove");
m_pAddArchiveBtn->SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddArchiveHdl_Impl ) );
m_pAddPathBtn->SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddPathHdl_Impl ) );
m_pRemoveBtn->SetClickHdl( LINK( this, SvxJavaClassPathDlg, RemoveHdl_Impl ) );
m_pPathList->SetSelectHdl( LINK( this, SvxJavaClassPathDlg, SelectHdl_Impl ) );
// check if the buttons text are not too wide otherwise we have to stretch the buttons
// and shrink the listbox
long nTxtWidth1 = m_aAddArchiveBtn.GetTextWidth( m_aAddArchiveBtn.GetText() );
long nTxtWidth2 = m_aAddPathBtn.GetTextWidth( m_aAddPathBtn.GetText() );
Size aBtnSz = m_aAddArchiveBtn.GetSizePixel();
long nTxtWidth1 = m_pAddArchiveBtn->GetTextWidth( m_pAddArchiveBtn->GetText() );
long nTxtWidth2 = m_pAddPathBtn->GetTextWidth( m_pAddPathBtn->GetText() );
Size aBtnSz = m_pAddArchiveBtn->GetSizePixel();
if ( nTxtWidth1 > aBtnSz.Width() || nTxtWidth2 > aBtnSz.Width() )
{
long nW = ( nTxtWidth1 > aBtnSz.Width() ) ? nTxtWidth1 : nTxtWidth2;
long nDelta = nW - aBtnSz.Width() + 2 * BUTTON_BORDER;
aBtnSz.Width() += nDelta;
Point aBtnPnt = m_aAddArchiveBtn.GetPosPixel();
Point aBtnPnt = m_pAddArchiveBtn->GetPosPixel();
aBtnPnt.X() -= nDelta;
m_aAddArchiveBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
aBtnPnt = m_aAddPathBtn.GetPosPixel();
m_pAddArchiveBtn->SetPosSizePixel( aBtnPnt, aBtnSz );
aBtnPnt = m_pAddPathBtn->GetPosPixel();
aBtnPnt.X() -= nDelta;
m_aAddPathBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
aBtnPnt = m_aRemoveBtn.GetPosPixel();
m_pAddPathBtn->SetPosSizePixel( aBtnPnt, aBtnSz );
aBtnPnt = m_pRemoveBtn->GetPosPixel();
aBtnPnt.X() -= nDelta;
m_aRemoveBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
Size aBoxSz = m_aPathList.GetSizePixel();
m_pRemoveBtn->SetPosSizePixel( aBtnPnt, aBtnSz );
Size aBoxSz = m_pPathList->GetSizePixel();
aBoxSz.Width() -= nDelta;
m_aPathList.SetSizePixel( aBoxSz );
m_pPathList->SetSizePixel( aBoxSz );
}
// set initial focus to path list
m_aPathList.GrabFocus();
m_pPathList->GrabFocus();
}
// -----------------------------------------------------------------------
SvxJavaClassPathDlg::~SvxJavaClassPathDlg()
{
sal_uInt16 i, nCount = m_aPathList.GetEntryCount();
sal_uInt16 i, nCount = m_pPathList->GetEntryCount();
for ( i = 0; i < nCount; ++i )
delete static_cast< String* >( m_aPathList.GetEntryData(i) );
delete static_cast< String* >( m_pPathList->GetEntryData(i) );
}
// -----------------------------------------------------------------------
......@@ -986,9 +979,9 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl)
aDlg.SetTitle( CUI_RES( RID_SVXSTR_ARCHIVE_TITLE ) );
aDlg.AddFilter( CUI_RES( RID_SVXSTR_ARCHIVE_HEADLINE ), OUString("*.jar;*.zip") );
String sFolder;
if ( m_aPathList.GetSelectEntryCount() > 0 )
if ( m_pPathList->GetSelectEntryCount() > 0 )
{
INetURLObject aObj( m_aPathList.GetSelectEntry(), INetURLObject::FSYS_DETECT );
INetURLObject aObj( m_pPathList->GetSelectEntry(), INetURLObject::FSYS_DETECT );
sFolder = aObj.GetMainURL( INetURLObject::NO_DECODE );
}
else
......@@ -1001,8 +994,8 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl)
String sFile = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
if ( !IsPathDuplicate( sURL ) )
{
sal_uInt16 nPos = m_aPathList.InsertEntry( sFile, SvFileInformationManager::GetImage( aURL, false ) );
m_aPathList.SelectEntryPos( nPos );
sal_uInt16 nPos = m_pPathList->InsertEntry( sFile, SvFileInformationManager::GetImage( aURL, false ) );
m_pPathList->SelectEntryPos( nPos );
}
else
{
......@@ -1023,9 +1016,9 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl)
Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);;
String sOldFolder;
if ( m_aPathList.GetSelectEntryCount() > 0 )
if ( m_pPathList->GetSelectEntryCount() > 0 )
{
INetURLObject aObj( m_aPathList.GetSelectEntry(), INetURLObject::FSYS_DETECT );
INetURLObject aObj( m_pPathList->GetSelectEntry(), INetURLObject::FSYS_DETECT );
sOldFolder = aObj.GetMainURL( INetURLObject::NO_DECODE );
}
else
......@@ -1038,8 +1031,8 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl)
String sNewFolder = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
if ( !IsPathDuplicate( sFolderURL ) )
{
sal_uInt16 nPos = m_aPathList.InsertEntry( sNewFolder, SvFileInformationManager::GetImage( aURL, false ) );
m_aPathList.SelectEntryPos( nPos );
sal_uInt16 nPos = m_pPathList->InsertEntry( sNewFolder, SvFileInformationManager::GetImage( aURL, false ) );
m_pPathList->SelectEntryPos( nPos );
}
else
{
......@@ -1056,16 +1049,16 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl)
IMPL_LINK_NOARG(SvxJavaClassPathDlg, RemoveHdl_Impl)
{
sal_uInt16 nPos = m_aPathList.GetSelectEntryPos();
sal_uInt16 nPos = m_pPathList->GetSelectEntryPos();
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
m_aPathList.RemoveEntry( nPos );
sal_uInt16 nCount = m_aPathList.GetEntryCount();
m_pPathList->RemoveEntry( nPos );
sal_uInt16 nCount = m_pPathList->GetEntryCount();
if ( nCount )
{
if ( nPos >= nCount )
nPos = ( nCount - 1 );
m_aPathList.SelectEntryPos( nPos );
m_pPathList->SelectEntryPos( nPos );
}
}
......@@ -1087,10 +1080,10 @@ bool SvxJavaClassPathDlg::IsPathDuplicate( const String& _rPath )
{
bool bRet = false;
INetURLObject aFileObj( _rPath );
sal_uInt16 nCount = m_aPathList.GetEntryCount();
sal_uInt16 nCount = m_pPathList->GetEntryCount();
for ( sal_uInt16 i = 0; i < nCount; ++i )
{
INetURLObject aOtherObj( m_aPathList.GetEntry(i), INetURLObject::FSYS_DETECT );
INetURLObject aOtherObj( m_pPathList->GetEntry(i), INetURLObject::FSYS_DETECT );
if ( aOtherObj == aFileObj )
{
bRet = true;
......@@ -1106,16 +1099,16 @@ bool SvxJavaClassPathDlg::IsPathDuplicate( const String& _rPath )
String SvxJavaClassPathDlg::GetClassPath() const
{
String sPath;
sal_uInt16 nCount = m_aPathList.GetEntryCount();
sal_uInt16 nCount = m_pPathList->GetEntryCount();
for ( sal_uInt16 i = 0; i < nCount; ++i )
{
if ( sPath.Len() > 0 )
sPath += CLASSPATH_DELIMITER;
String* pFullPath = static_cast< String* >( m_aPathList.GetEntryData(i) );
String* pFullPath = static_cast< String* >( m_pPathList->GetEntryData(i) );
if ( pFullPath )
sPath += *pFullPath;
else
sPath += m_aPathList.GetEntry(i);
sPath += m_pPathList->GetEntry(i);
}
return sPath;
}
......@@ -1126,7 +1119,7 @@ void SvxJavaClassPathDlg::SetClassPath( const String& _rPath )
{
if ( m_sOldPath.Len() == 0 )
m_sOldPath = _rPath;
m_aPathList.Clear();
m_pPathList->Clear();
xub_StrLen i;
sal_Int32 nIdx = 0;
xub_StrLen nCount = comphelper::string::getTokenCount(_rPath, CLASSPATH_DELIMITER);
......@@ -1135,10 +1128,10 @@ void SvxJavaClassPathDlg::SetClassPath( const String& _rPath )
String sToken = _rPath.GetToken( 0, CLASSPATH_DELIMITER, nIdx );
INetURLObject aURL( sToken, INetURLObject::FSYS_DETECT );
String sPath = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
m_aPathList.InsertEntry( sPath, SvFileInformationManager::GetImage( aURL, false ) );
m_pPathList->InsertEntry( sPath, SvFileInformationManager::GetImage( aURL, false ) );
}
// select first entry
m_aPathList.SelectEntryPos(0);
m_pPathList->SelectEntryPos(0);
SelectHdl_Impl( NULL );
}
......
......@@ -37,20 +37,6 @@
#define PB_PARAMETER_ESC 32
#define PB_PARAMETER_HLP 33
// class SvxJavaClassPathDlg ---------------------------------------------
#define FT_PATH 10
#define LB_PATH 11
#define PB_ADDARCHIVE 20
#define PB_ADDPATH 21
#define PB_REMOVE_PATH 22
#define FL_PATH_BUTTONS 30
#define PB_PATH_OK 31
#define PB_PATH_ESC 32
#define PB_PATH_HLP 33
#endif // #ifndef _SVX_OPTJAVA_HRC
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -158,16 +158,10 @@ public:
class SvxJavaClassPathDlg : public ModalDialog
{
private:
FixedText m_aPathLabel;
ListBox m_aPathList;
PushButton m_aAddArchiveBtn;
PushButton m_aAddPathBtn;
PushButton m_aRemoveBtn;
FixedLine m_aButtonsLine;
OKButton m_aOKBtn;
CancelButton m_aCancelBtn;
HelpButton m_aHelpBtn;
ListBox* m_pPathList;
PushButton* m_pAddArchiveBtn;
PushButton* m_pAddPathBtn;
PushButton* m_pRemoveBtn;
String m_sOldPath;
......@@ -178,15 +172,15 @@ private:
bool IsPathDuplicate( const String& _rPath );
inline void EnableRemoveButton()
{ m_aRemoveBtn.Enable(
m_aPathList.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); }
{ m_pRemoveBtn->Enable(
m_pPathList->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); }
public:
SvxJavaClassPathDlg( Window* pParent );
~SvxJavaClassPathDlg();
inline const String& GetOldPath() const { return m_sOldPath; }
inline void SetFocus() { m_aPathList.GrabFocus(); }
inline void SetFocus() { m_pPathList->GrabFocus(); }
String GetClassPath() const;
void SetClassPath( const String& _rPath );
......
......@@ -101,74 +101,6 @@ ModalDialog RID_SVXDLG_JAVA_PARAMETER
};
};
// RID_SVXDLG_JAVA_CLASSPATH ---------------------------------------------
ModalDialog RID_SVXDLG_JAVA_CLASSPATH
{
HelpId = HID_OPTIONS_JAVA_CLASSPATH ;
OutputSize = TRUE ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 240 , 120 ) ;
Text [ en-US ] = "Class Path" ;
Moveable = TRUE ;
FixedText FT_PATH
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 172 , 8 ) ;
Text [ en-US ] = "A~ssigned folders and archives" ;
};
ListBox LB_PATH
{
HelpID = "cui:ListBox:RID_SVXDLG_JAVA_CLASSPATH:LB_PATH";
Pos = MAP_APPFONT ( 6 , 14 ) ;
Size = MAP_APPFONT ( 172 , 72 ) ;
Border = TRUE ;
AutoHScroll = TRUE ;
};
PushButton PB_ADDARCHIVE
{
HelpID = "cui:PushButton:RID_SVXDLG_JAVA_CLASSPATH:PB_ADDARCHIVE";
Pos = MAP_APPFONT ( 184 , 14 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Add Archive..." ;
};
PushButton PB_ADDPATH
{
HelpID = "cui:PushButton:RID_SVXDLG_JAVA_CLASSPATH:PB_ADDPATH";
Pos = MAP_APPFONT ( 184 , 31 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "Add ~Folder" ;
};
PushButton PB_REMOVE_PATH
{
HelpID = "cui:PushButton:RID_SVXDLG_JAVA_CLASSPATH:PB_REMOVE_PATH";
Pos = MAP_APPFONT ( 184 , 48 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Remove" ;
};
FixedLine FL_PATH_BUTTONS
{
Pos = MAP_APPFONT ( 3 , 89 ) ;
Size = MAP_APPFONT ( 236 , 8 ) ;
};
OKButton PB_PATH_OK
{
Pos = MAP_APPFONT ( 75 , 100 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
DefButton = TRUE ;
};
CancelButton PB_PATH_ESC
{
Pos = MAP_APPFONT ( 128 , 100 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
HelpButton PB_PATH_HLP
{
Pos = MAP_APPFONT ( 186 , 100 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
};
ErrorBox RID_SVXERR_JRE_NOT_RECOGNIZED
{
BUTTONS = WB_OK ;
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="JavaClassPath">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Class Path</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">12</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="ok">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</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="cancel">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">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="help">
<property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</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="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</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">A_ssigned folders and archives</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="width_request">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="paths:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection4"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkButton" id="archive">
<property name="label" translatable="yes">_Add Archive...</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">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="folder">
<property name="label" translatable="yes">Add _Folder</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">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="remove">
<property name="label" translatable="yes">_Remove</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">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="position">1</property>
</packing>
</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">ok</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">help</action-widget>
</action-widgets>
</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