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

convert new/move menu to .ui

Change-Id: I77e46382cae6da03c3a972c9838afb3f8698c9a3
üst 94a569c2
......@@ -54,6 +54,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/linestyletabpage \
cui/uiconfig/ui/macroselectordialog \
cui/uiconfig/ui/messbox \
cui/uiconfig/ui/movemenu \
cui/uiconfig/ui/namedialog \
cui/uiconfig/ui/newtabledialog \
cui/uiconfig/ui/newtoolbardialog \
......
......@@ -1611,8 +1611,6 @@ SvxConfigPage::SvxConfigPage(
aDescriptionField.SetAutoScroll( sal_True );
aDescriptionField.EnableCursor( sal_False );
aMoveUpButton.SetAccessibleName(CUI_RES(BUTTON_STR_UP));
aMoveDownButton.SetAccessibleName(CUI_RES(BUTTON_STR_DOWN));
aMoveUpButton.SetAccessibleRelationMemberOf(&aContentsSeparator);
aMoveDownButton.SetAccessibleRelationMemberOf(&aContentsSeparator);
aNewTopLevelButton.SetAccessibleRelationMemberOf(&aTopLevelSeparator);
......@@ -2741,20 +2739,15 @@ SaveInData* SvxMenuConfigPage::CreateSaveInData(
SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
Window* pParent, SvxEntries* entries,
SvxConfigEntry* selection, bool bCreateMenu )
:
ModalDialog( pParent, CUI_RES( MD_MENU_ORGANISER ) ),
aMenuNameText( this, CUI_RES( TXT_MENU_NAME ) ),
aMenuNameEdit( this, CUI_RES( EDIT_MENU_NAME ) ),
aMenuListText( this, CUI_RES( TXT_MENU ) ),
aMenuListBox( this, CUI_RES( BOX_MAIN_MENUS ) ),
aMoveUpButton( this, CUI_RES( BTN_MENU_UP ) ),
aMoveDownButton( this, CUI_RES( BTN_MENU_DOWN ) ),
aOKButton( this, CUI_RES( BTN_MENU_ADD ) ),
aCloseButton( this, CUI_RES( BTN_MENU_CLOSE ) ),
aHelpButton( this, CUI_RES( BTN_MENU_HELP ) ),
bModified( sal_False )
: ModalDialog(pParent, "MoveMenuDialog", "cui/ui/movemenu.ui")
, bModified(false)
{
FreeResource();
get(m_pMenuBox, "namebox");
get(m_pMenuNameEdit, "menuname");
get(m_pMoveUpButton, "up");
get(m_pMoveDownButton, "down");
get(m_pMenuListBox, "menulist");
m_pMenuListBox->set_height_request(m_pMenuListBox->GetTextHeight() * 12);
// Copy the entries list passed in
if ( entries != NULL )
......@@ -2769,13 +2762,13 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
{
pEntry = *iter;
pLBEntry =
aMenuListBox.InsertEntry( stripHotKey( pEntry->GetName() ) );
m_pMenuListBox->InsertEntry( stripHotKey( pEntry->GetName() ) );
pLBEntry->SetUserData( pEntry );
pEntries->push_back( pEntry );
if ( pEntry == selection )
{
aMenuListBox.Select( pLBEntry );
m_pMenuListBox->Select( pLBEntry );
}
++iter;
}
......@@ -2795,63 +2788,32 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
pNewEntryData->SetMain( sal_True );
pNewMenuEntry =
aMenuListBox.InsertEntry( stripHotKey( pNewEntryData->GetName() ) );
aMenuListBox.Select( pNewMenuEntry );
m_pMenuListBox->InsertEntry( stripHotKey( pNewEntryData->GetName() ) );
m_pMenuListBox->Select( pNewMenuEntry );
pNewMenuEntry->SetUserData( pNewEntryData );
pEntries->push_back( pNewEntryData );
aMenuNameEdit.SetText( newname );
aMenuNameEdit.SetModifyHdl(
m_pMenuNameEdit->SetText( newname );
m_pMenuNameEdit->SetModifyHdl(
LINK( this, SvxMainMenuOrganizerDialog, ModifyHdl ) );
}
else
{
Point p, newp;
Size s, news;
// get offset to bottom of name textfield from top of dialog
p = aMenuNameEdit.GetPosPixel();
s = aMenuNameEdit.GetSizePixel();
long offset = p.Y() + s.Height();
// reposition menu list and label
aMenuListText.SetPosPixel( aMenuNameText.GetPosPixel() );
aMenuListBox.SetPosPixel( aMenuNameEdit.GetPosPixel() );
// reposition up and down buttons
p = aMoveUpButton.GetPosPixel();
newp = Point( p.X(), p.Y() - offset );
aMoveUpButton.SetPosPixel( newp );
p = aMoveDownButton.GetPosPixel();
newp = Point( p.X(), p.Y() - offset );
aMoveDownButton.SetPosPixel( newp );
// change size of dialog
s = GetSizePixel();
news = Size( s.Width(), s.Height() - offset );
SetSizePixel( news );
// hide name label and textfield
aMenuNameText.Hide();
aMenuNameEdit.Hide();
m_pMenuBox->Hide();
// change the title
SetText( CUI_RES( RID_SVXSTR_MOVE_MENU ) );
}
aMenuListBox.SetSelectHdl(
m_pMenuListBox->SetSelectHdl(
LINK( this, SvxMainMenuOrganizerDialog, SelectHdl ) );
aMoveUpButton.SetClickHdl (
m_pMoveUpButton->SetClickHdl (
LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) );
aMoveDownButton.SetClickHdl (
m_pMoveDownButton->SetClickHdl (
LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) );
aMoveUpButton.SetAccessibleName(CUI_RES(BUTTON_STR_UP));
aMoveDownButton.SetAccessibleName(CUI_RES(BUTTON_STR_DOWN));
}
IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
......@@ -2859,7 +2821,7 @@ IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
(void)pEdit;
// if the Edit control is empty do not change the name
if ( aMenuNameEdit.GetText() == "" )
if (m_pMenuNameEdit->GetText().isEmpty())
{
return 0;
}
......@@ -2867,9 +2829,9 @@ IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
SvxConfigEntry* pNewEntryData =
(SvxConfigEntry*) pNewMenuEntry->GetUserData();
pNewEntryData->SetName( aMenuNameEdit.GetText() );
pNewEntryData->SetName(m_pMenuNameEdit->GetText());
aMenuListBox.SetEntryText( pNewMenuEntry, pNewEntryData->GetName() );
m_pMenuListBox->SetEntryText( pNewMenuEntry, pNewEntryData->GetName() );
return 0;
}
......@@ -2888,17 +2850,17 @@ IMPL_LINK( SvxMainMenuOrganizerDialog, SelectHdl, Control*, pCtrl )
void SvxMainMenuOrganizerDialog::UpdateButtonStates()
{
// Disable Up and Down buttons depending on current selection
SvTreeListEntry* selection = aMenuListBox.GetCurEntry();
SvTreeListEntry* first = aMenuListBox.First();
SvTreeListEntry* last = aMenuListBox.Last();
SvTreeListEntry* selection = m_pMenuListBox->GetCurEntry();
SvTreeListEntry* first = m_pMenuListBox->First();
SvTreeListEntry* last = m_pMenuListBox->Last();
aMoveUpButton.Enable( selection != first );
aMoveDownButton.Enable( selection != last );
m_pMoveUpButton->Enable( selection != first );
m_pMoveDownButton->Enable( selection != last );
}
IMPL_LINK( SvxMainMenuOrganizerDialog, MoveHdl, Button *, pButton )
{
SvTreeListEntry *pSourceEntry = aMenuListBox.FirstSelected();
SvTreeListEntry *pSourceEntry = m_pMenuListBox->FirstSelected();
SvTreeListEntry *pTargetEntry = NULL;
if ( !pSourceEntry )
......@@ -2906,15 +2868,15 @@ IMPL_LINK( SvxMainMenuOrganizerDialog, MoveHdl, Button *, pButton )
return 0;
}
if ( pButton == &aMoveDownButton )
if (pButton == m_pMoveDownButton)
{
pTargetEntry = aMenuListBox.NextSibling( pSourceEntry );
pTargetEntry = m_pMenuListBox->NextSibling( pSourceEntry );
}
else if ( pButton == &aMoveUpButton )
else if (pButton == m_pMoveUpButton)
{
// Move Up is just a Move Down with the source and target reversed
pTargetEntry = pSourceEntry;
pSourceEntry = aMenuListBox.PrevSibling( pTargetEntry );
pSourceEntry = m_pMenuListBox->PrevSibling( pTargetEntry );
}
if ( pSourceEntry != NULL && pTargetEntry != NULL )
......@@ -2936,8 +2898,8 @@ IMPL_LINK( SvxMainMenuOrganizerDialog, MoveHdl, Button *, pButton )
if ( iter1 != end && iter2 != end )
{
std::swap( *iter1, *iter2 );
aMenuListBox.GetModel()->Move( pSourceEntry, pTargetEntry );
aMenuListBox.MakeVisible( pSourceEntry );
m_pMenuListBox->GetModel()->Move( pSourceEntry, pTargetEntry );
m_pMenuListBox->MakeVisible( pSourceEntry );
bModified = sal_True;
}
......@@ -2958,7 +2920,7 @@ SvxEntries* SvxMainMenuOrganizerDialog::GetEntries()
SvxConfigEntry* SvxMainMenuOrganizerDialog::GetSelectedEntry()
{
return (SvxConfigEntry*)aMenuListBox.FirstSelected()->GetUserData();
return (SvxConfigEntry*)m_pMenuListBox->FirstSelected()->GetUserData();
}
const OUString&
......
......@@ -62,7 +62,6 @@
#define QBX_CONFIRM_RESTORE_DEFAULT (66 + CFG_OFFSET)
#define QBX_CONFIRM_DELETE_TOOLBAR (67 + CFG_OFFSET)
#define MD_MENU_ORGANISER (79 + CFG_OFFSET)
#define TXT_MENU (80 + CFG_OFFSET)
#define BOX_MAIN_MENUS (81 + CFG_OFFSET)
#define BTN_MENU_UP (82 + CFG_OFFSET)
......@@ -93,7 +92,4 @@
#define MD_BTN_OK (122 + CFG_OFFSET)
#define FI_INFO (123 + CFG_OFFSET)
#define BUTTON_STR_UP (130 + CFG_OFFSET)
#define BUTTON_STR_DOWN (131 + CFG_OFFSET)
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -410,80 +410,6 @@ String RID_SVXSTR_MENU_ADDCOMMANDS_DESCRIPTION
Text [ en-US ] = "To add a command to a menu, select the category and then the command. You can also drag the command to the Commands list of the Menus tab page in the Customize dialog.";
};
ModalDialog MD_MENU_ORGANISER
{
OutputSize = TRUE ;
Size = MAP_APPFONT ( 172 , 154 ) ;
Text [ en-US ] = "New Menu" ;
SvLook = TRUE ;
Moveable = TRUE ;
HelpId = HID_SVX_CONFIG_MENU_ORGANIZER;
FixedText TXT_MENU_NAME
{
Pos = MAP_APPFONT ( 6 , 8 ) ;
Size = MAP_APPFONT ( 93 , 8 ) ;
Group = TRUE ;
Left = TRUE ;
Text [ en-US ] = "Menu name" ;
};
Edit EDIT_MENU_NAME
{
HelpID = "cui:Edit:MD_MENU_ORGANISER:EDIT_MENU_NAME";
Border = TRUE ;
Pos = MAP_APPFONT ( 6 , 19 ) ;
Size = MAP_APPFONT ( 93 , 12 ) ;
TabStop = TRUE ;
};
FixedText TXT_MENU
{
Pos = MAP_APPFONT ( 6 , 37 ) ;
Size = MAP_APPFONT ( 93 , 8 ) ;
Group = TRUE ;
Left = TRUE ;
Text [ en-US ] = "Menu position" ;
};
Control BOX_MAIN_MENUS
{
HelpId = HID_SVX_CONFIG_MENU_LISTBOX ;
Border = TRUE ;
Pos = MAP_APPFONT ( 6 , 48 ) ;
Size = MAP_APPFONT ( 93 , 100 ) ;
TabStop = TRUE ;
};
ImageButton BTN_MENU_UP
{
HelpID = "cui:ImageButton:MD_MENU_ORGANISER:BTN_MENU_UP";
Pos = MAP_APPFONT ( 102 , 80 ) ;
Size = MAP_APPFONT ( 14 , 14 ) ;
TabStop = TRUE ;
Symbol = IMAGEBUTTON_ARROW_UP ;
};
ImageButton BTN_MENU_DOWN
{
HelpID = "cui:ImageButton:MD_MENU_ORGANISER:BTN_MENU_DOWN";
Pos = MAP_APPFONT ( 102 , 97 ) ;
Size = MAP_APPFONT ( 14 , 14 ) ;
TabStop = TRUE ;
Symbol = IMAGEBUTTON_ARROW_DOWN ;
};
OKButton BTN_MENU_ADD
{
DefButton = TRUE;
Pos = MAP_APPFONT ( 119 , 6 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
CancelButton BTN_MENU_CLOSE
{
Pos = MAP_APPFONT ( 119 , 23 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
HelpButton BTN_MENU_HELP
{
Pos = MAP_APPFONT ( 119 , 40 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
};
#ifndef IMAGE_STDBTN_COLOR
#define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }
#endif
......@@ -732,13 +658,4 @@ String RID_SVXSTR_RENAME_TOOLBAR
Text [ en-US ] = "Rename Toolbar";
};
String BUTTON_STR_UP
{
Text [ en-US ] = "Up";
};
String BUTTON_STR_DOWN
{
Text [ en-US ] = "Down";
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -19,9 +19,10 @@
#ifndef INCLUDED_CUI_SOURCE_INC_CFG_HXX
#define INCLUDED_CUI_SOURCE_INC_CFG_HXX
#include <vcl/lstbox.hxx>
#include <vcl/fixed.hxx>
#include <vcl/group.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/menubtn.hxx>
#include <vcl/toolbox.hxx>
#include <svtools/treelistbox.hxx>
......@@ -510,15 +511,11 @@ public:
class SvxMainMenuOrganizerDialog : public ModalDialog
{
FixedText aMenuNameText;
Edit aMenuNameEdit;
FixedText aMenuListText;
SvTreeListBox aMenuListBox;
ImageButton aMoveUpButton;
ImageButton aMoveDownButton;
OKButton aOKButton;
CancelButton aCloseButton;
HelpButton aHelpButton;
VclContainer* m_pMenuBox;
Edit* m_pMenuNameEdit;
SvTreeListBox* m_pMenuListBox;
PushButton* m_pMoveUpButton;
PushButton* m_pMoveDownButton;
SvxEntries* pEntries;
SvTreeListEntry* pNewMenuEntry;
......
......@@ -154,7 +154,6 @@
#define HID_HANGULDLG_SUGGESTIONS "CUI_HID_HANGULDLG_SUGGESTIONS"
#define HID_HANGULDLG_SUGGESTIONS_GRID "CUI_HID_HANGULDLG_SUGGESTIONS_GRID"
#define HID_HANGULDLG_SUGGESTIONS_LIST "CUI_HID_HANGULDLG_SUGGESTIONS_LIST"
#define HID_SVX_CONFIG_MENU_ORGANIZER "CUI_HID_SVX_CONFIG_MENU_ORGANIZER"
#define HID_SVX_CONFIG_ICON_SELECTOR "CUI_HID_SVX_CONFIG_ICON_SELECTOR"
#define HID_SVX_CONFIG_NAME_SUBMENU "CUI_HID_SVX_CONFIG_NAME_SUBMENU"
#define HID_SVX_CONFIG_RENAME_MENU "CUI_HID_SVX_CONFIG_RENAME_MENU"
......@@ -164,7 +163,6 @@
#define HID_SVX_NEW_TOOLBAR "CUI_HID_SVX_NEW_TOOLBAR"
#define HID_SVX_MODIFY_TOOLBAR "CUI_HID_SVX_MODIFY_TOOLBAR"
#define HID_SVX_NEW_TOOLBAR_ITEM "CUI_HID_SVX_NEW_TOOLBAR_ITEM"
#define HID_SVX_CONFIG_MENU_LISTBOX "CUI_HID_SVX_CONFIG_MENU_LISTBOX"
#define HID_SVX_MODIFY_TOOLBAR_ITEM "CUI_HID_SVX_MODIFY_TOOLBAR_ITEM"
#define HID_SVX_SAVE_IN "CUI_HID_SVX_SAVE_IN"
#define HID_OPTIONS_MULTIPATH_LIST "CUI_HID_OPTIONS_MULTIPATH_LIST"
......
This diff is collapsed.
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