diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-12 15:03:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-13 12:10:25 +0100 |
commit | 9ae66a0d996311fa7c53274b31fc5159f9422701 (patch) | |
tree | 2b75aec2446b2e5c3621c7bfc46de6c46afff569 | |
parent | e8fb216a99f6061dcb63557a1ae8de5f8b589344 (diff) |
convert edit address block dialog to .ui
this one nearly killed me
Change-Id: I51f14017940a275cca33dacf6f42438da43f46bc
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 14 | ||||
-rw-r--r-- | sw/UIConfig_swriter.mk | 1 | ||||
-rw-r--r-- | sw/inc/dbui.hrc | 16 | ||||
-rw-r--r-- | sw/inc/helpid.h | 1 | ||||
-rw-r--r-- | sw/source/ui/dbui/mailmergehelper.cxx | 41 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.cxx | 338 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.hrc | 27 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.hxx | 59 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.src | 288 | ||||
-rw-r--r-- | sw/source/ui/inc/mailmergehelper.hxx | 8 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/addressblockdialog.ui | 426 |
11 files changed, 745 insertions, 474 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index e07917fb1e0f..e171e8784780 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -266,6 +266,9 @@ <glade-widget-class title="MultiLine Edit" name="svtlo-MultiLineEditSyntaxHighlight" generic-name="MultiLineEdit" parent="GtkTextView" icon-name="widget-gtk-textview"/> + <glade-widget-class title="Address MultiLine Edit" name="swuilo-AddressMultiLineEdit" + generic-name="AddressMultiLineEdit" parent="GtkTextView" + icon-name="widget-gtk-textview"/> <glade-widget-class title="ValueSet" name="svtlo-ValueSet" generic-name="Set of Value Options" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> @@ -338,6 +341,9 @@ <glade-widget-class title="Presentation Preview" name="sduilo-PresLayoutPreview" generic-name="Presentation Preview" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> + <glade-widget-class title="Address Preview" name="swlo-SwAddressPreview" + generic-name="Address Preview" parent="GtkDrawingArea" + icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="Rectangle Control" name="svxlo-SvxRectCtl" generic-name="Rectangle Control" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> @@ -354,7 +360,10 @@ generic-name="CategoryComboBox" parent="GtkComboBox" icon-name="widget-gtk-combobox"/> <glade-widget-class title="Bookmark Combo" name="swuilo-BookmarkCombo" - generic-name="BookmarkComboBox" parent="GtkTreeView" + generic-name="BookmarkComboBox" parent="GtkComboBox" + icon-name="widget-gtk-combobox"/> + <glade-widget-class title="Restricted ComboBox" name="swuilo-SwRestrictedComboBox" + generic-name="Restricted ComboBox" parent="GtkComboBox" icon-name="widget-gtk-combobox"/> <glade-widget-class title="Category Edit" name="swuilo-FEdit" generic-name="CategoryEdit" parent="GtkEntry" @@ -380,6 +389,9 @@ <glade-widget-class title="Tree List" name="svtlo-SvTreeListBox" generic-name="Tree List" parent="GtkTreeView" icon-name="widget-gtk-treeview"/> + <glade-widget-class title="DD ListBox" name="swuilo-DDListBox" + generic-name="DD ListBox" parent="svtlo-SvTreeListBox" + icon-name="widget-gtk-treeview"/> <glade-widget-class title="Tab List" name="svtlo-SvTabListBox" generic-name="Tab List" parent="svtlo-SvTreeListBox" icon-name="widget-gtk-treeview"/> diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index f903b9b2b3c1..7993a080ba44 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -61,6 +61,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/swriter,\ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/abstractdialog \ sw/uiconfig/swriter/ui/addentrydialog \ + sw/uiconfig/swriter/ui/addressblockdialog \ sw/uiconfig/swriter/ui/alreadyexistsdialog \ sw/uiconfig/swriter/ui/asciifilterdialog \ sw/uiconfig/swriter/ui/assignstylesdialog \ diff --git a/sw/inc/dbui.hrc b/sw/inc/dbui.hrc index 1bb029f0dc9c..7e240858c00f 100644 --- a/sw/inc/dbui.hrc +++ b/sw/inc/dbui.hrc @@ -37,7 +37,7 @@ #define DLG_MM_DBTABLEPREVIEWDIALOG (RC_DBUI_BEGIN + 13) #define DLG_MM_CREATEADDRESSLIST (RC_DBUI_BEGIN + 14) #define DLG_MM_CUSTOMIZE_ADDRESS_LIST (RC_DBUI_BEGIN + 17) -#define DLG_MM_CUSTOMIZEADDRESSBLOCK (RC_DBUI_BEGIN + 18) + #define DLG_MM_SELECTADDRESSBLOCK (RC_DBUI_BEGIN + 19) #define DLG_MM_ASSIGNFIELDS (RC_DBUI_BEGIN + 20) @@ -63,6 +63,20 @@ #define STR_FILTER_ALL_DATA (RC_DBUI_BEGIN + 10) #define STR_FILTER_MDB (RC_DBUI_BEGIN + 11) #define STR_FILTER_ACCDB (RC_DBUI_BEGIN + 12) +#define ST_SALUTATION (RC_DBUI_BEGIN + 13) +#define ST_PUNCTUATION (RC_DBUI_BEGIN + 14) +#define ST_TEXT (RC_DBUI_BEGIN + 15) +#define RA_SALUTATION_MALE (RC_DBUI_BEGIN + 16) +#define RA_SALUTATION_FEMALE (RC_DBUI_BEGIN + 17) +#define RA_PUNCTUATION (RC_DBUI_BEGIN + 18) +#define ST_TITLE_MALE (RC_DBUI_BEGIN + 19) +#define ST_TITLE_FEMALE (RC_DBUI_BEGIN + 20) +#define ST_SALUTATIONELEMENTS (RC_DBUI_BEGIN + 21) +#define ST_INSERTSALUTATIONFIELD (RC_DBUI_BEGIN + 22) +#define ST_REMOVESALUTATIONFIELD (RC_DBUI_BEGIN + 23) +#define ST_DRAGSALUTATION (RC_DBUI_BEGIN + 24) +#define ST_TITLE_EDIT (RC_DBUI_BEGIN + 25) + // Elements ----------------------------------------------------------------- diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 23142704b0ae..bec986e2296f 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -379,7 +379,6 @@ #define HID_MM_SELECTDBTABLEDDIALOG_LISTBOX "SW_HID_MM_SELECTDBTABLEDDIALOG_LISTBOX" #define HID_MM_DBTABLEPREVIEWDIALOG "SW_HID_MM_DBTABLEPREVIEWDIALOG" #define HID_MM_CREATEADDRESSLIST "SW_HID_MM_CREATEADDRESSLIST" -#define HID_MM_CUSTOMIZEADDRESSBLOCK "SW_HID_MM_CUSTOMIZEADDRESSBLOCK" #define HID_MM_SELECTADDRESSBLOCK "SW_HID_MM_SELECTADDRESSBLOCK" #define HID_MM_ASSIGNFIELDS "SW_HID_MM_ASSIGNFIELDS" #define HID_MM_LAYOUT_PAGE "SW_HID_MM_LAYOUT_PAGE" diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx index b5d75e07d961..14cbf1a3495c 100644 --- a/sw/source/ui/dbui/mailmergehelper.cxx +++ b/sw/source/ui/dbui/mailmergehelper.cxx @@ -200,23 +200,48 @@ struct SwAddressPreview_Impl } }; -SwAddressPreview::SwAddressPreview(Window* pParent, const ResId rResId) : - Window( pParent, rResId ), - aVScrollBar(this, WB_VSCROLL), - pImpl(new SwAddressPreview_Impl()) +SwAddressPreview::SwAddressPreview(Window* pParent, const ResId& rResId) + : Window( pParent, rResId ) + , aVScrollBar(this, WB_VSCROLL) + , pImpl(new SwAddressPreview_Impl()) { aVScrollBar.SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl)); + positionScrollBar(); + Show(); +} + +SwAddressPreview::SwAddressPreview(Window* pParent, WinBits nStyle) + : Window( pParent, nStyle ) + , aVScrollBar(this, WB_VSCROLL) + , pImpl(new SwAddressPreview_Impl()) +{ + aVScrollBar.SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl)); + positionScrollBar(); + Show(); +} + +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwAddressPreview(Window *pParent, VclBuilder::stringmap &rMap) +{ + WinBits nWinStyle = WB_NOTABSTOP; + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + return new SwAddressPreview(pParent, nWinStyle); +} + +void SwAddressPreview::positionScrollBar() +{ Size aSize(GetOutputSizePixel()); - Size aScrollSize(aVScrollBar.GetSizePixel()); - aScrollSize.Height() = aSize.Height(); + Size aScrollSize(aVScrollBar.get_preferred_size().Width(), aSize.Height()); aVScrollBar.SetSizePixel(aScrollSize); Point aSrollPos(aSize.Width() - aScrollSize.Width(), 0); aVScrollBar.SetPosPixel(aSrollPos); - Show(); } -SwAddressPreview::~SwAddressPreview() +void SwAddressPreview::Resize() { + Window::Resize(); + positionScrollBar(); } IMPL_LINK_NOARG(SwAddressPreview, ScrollHdl) diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index e2dc89fff863..c99b1f3b8e95 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -498,8 +498,18 @@ IMPL_LINK(SwSelectAddressBlockDialog, IncludeHdl_Impl, RadioButton*, pButton) return 0; } -SwRestrictedComboBox::~SwRestrictedComboBox() +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwRestrictedComboBox(Window *pParent, VclBuilder::stringmap &rMap) { + WinBits nBits = WB_LEFT|WB_VCENTER|WB_3DLOOK; + + bool bDropdown = VclBuilder::extractDropdown(rMap); + + if (bDropdown) + nBits |= WB_DROPDOWN; + + SwRestrictedComboBox* pComboBox = new SwRestrictedComboBox(pParent, nBits); + pComboBox->EnableAutoSize(true); + return pComboBox; } void SwRestrictedComboBox::KeyInput(const KeyEvent& rEvt) @@ -541,46 +551,39 @@ void SwRestrictedComboBox::Modify() #define USER_DATA_NONE -4 SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog( - Window* pParent, SwMailMergeConfigItem& rConfig, DialogType eType) : - SfxModalDialog(pParent, SW_RES(DLG_MM_CUSTOMIZEADDRESSBLOCK)), -#ifdef _MSC_VER -#pragma warning (disable : 4355) -#endif - m_aAddressElementsFT( this, SW_RES( FT_ADDRESSELEMENTS )), - m_aAddressElementsLB( this, SW_RES( LB_ADDRESSELEMENTS )), - m_aInsertFieldIB( this, SW_RES( IB_INSERTFIELD )), - m_aRemoveFieldIB( this, SW_RES( IB_REMOVEFIELD )), - m_aDragFT( this, SW_RES( FT_DRAG )), - m_aDragED( this, SW_RES( ED_DRAG )), - m_aUpIB( this, SW_RES( IB_UP )), - m_aLeftIB( this, SW_RES( IB_LEFT )), - m_aRightIB( this, SW_RES( IB_RIGHT )), - m_aDownIB( this, SW_RES( IB_DOWN )), - m_aFieldFT( this, SW_RES( FT_FIELD )), - m_aFieldCB( this, SW_RES( CB_FIELD )), - m_aPreviewFI( this, SW_RES( FI_PREVIEW )), - m_aPreviewWIN( this, SW_RES( WIN_PREVIEW )), - m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )), - m_aOK( this, SW_RES( PB_OK )), - m_aCancel( this, SW_RES( PB_CANCEL )), - m_aHelp( this, SW_RES( PB_HELP )), -#ifdef _MSC_VER -#pragma warning (default : 4355) -#endif - m_rConfigItem(rConfig), - m_eType(eType) -{ - m_aFieldCB.SetForbiddenChars( OUString("<>")); - m_aDragED.SetStyle(m_aDragED.GetStyle() |WB_NOHIDESELECTION); + Window* pParent, SwMailMergeConfigItem& rConfig, DialogType eType) + : SfxModalDialog(pParent, "AddressBlockDialog", + "modules/swriter/ui/addressblockdialog.ui") + , m_rConfigItem(rConfig) + , m_eType(eType) +{ + get(m_pOK, "ok"); + get(m_pPreviewWIN, "addrpreview"); + get(m_pFieldCB, "custom"); + get(m_pFieldFT, "customft"); + get(m_pDownIB, "down"); + get(m_pRightIB, "right"); + get(m_pLeftIB, "left"); + get(m_pUpIB, "up"); + get(m_pDragED, "addressdest"); + m_pDragED->SetAddressDialog(this); + get(m_pDragFT, "addressdestft"); + get(m_pRemoveFieldIB, "fromaddr"); + get(m_pInsertFieldIB, "toaddr"); + get(m_pAddressElementsLB, "addresses"); + m_pAddressElementsLB->set_height_request(16 * m_pAddressElementsLB->GetTextHeight()); + m_pAddressElementsLB->SetAddressDialog(this); + get(m_pAddressElementsFT, "addressesft"); + if( eType >= GREETING_FEMALE ) { - m_aFieldFT.Show(); - m_aFieldCB.Show(); - SvTreeListEntry* pEntry = m_aAddressElementsLB.InsertEntry(String(SW_RES(ST_SALUTATION ))); + m_pFieldFT->Show(); + m_pFieldCB->Show(); + SvTreeListEntry* pEntry = m_pAddressElementsLB->InsertEntry(String(SW_RES(ST_SALUTATION ))); pEntry->SetUserData((void*)(sal_Int32)USER_DATA_SALUTATION ); - pEntry = m_aAddressElementsLB.InsertEntry(String(SW_RES(ST_PUNCTUATION))); + pEntry = m_pAddressElementsLB->InsertEntry(String(SW_RES(ST_PUNCTUATION))); pEntry->SetUserData((void*)(sal_Int32)USER_DATA_PUNCTUATION ); - pEntry = m_aAddressElementsLB.InsertEntry(String(SW_RES(ST_TEXT ))); + pEntry = m_pAddressElementsLB->InsertEntry(String(SW_RES(ST_TEXT ))); pEntry->SetUserData((void*)(sal_Int32)USER_DATA_TEXT ); ResStringArray aSalutArr(SW_RES( eType == GREETING_MALE ? RA_SALUTATION_MALE : RA_SALUTATION_FEMALE)); @@ -590,50 +593,41 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog( ResStringArray aPunctArr(SW_RES(RA_PUNCTUATION)); for(i = 0; i < aPunctArr.Count(); ++i) m_aPunctuations.push_back(aPunctArr.GetString(i)); - m_aDragED.SetText(OUString(" ")); + m_pDragED->SetText(OUString(" ")); SetText( String( SW_RES( eType == GREETING_MALE ? ST_TITLE_MALE : ST_TITLE_FEMALE))); - m_aAddressElementsFT.SetText(String(SW_RES(ST_SALUTATIONELEMENTS))); - m_aInsertFieldIB.SetQuickHelpText(String(SW_RES(ST_INSERTSALUTATIONFIELD))); - m_aRemoveFieldIB.SetQuickHelpText(String(SW_RES(ST_REMOVESALUTATIONFIELD))); - m_aDragFT.SetText(String(SW_RES(ST_DRAGSALUTATION))); + m_pAddressElementsFT->SetText(String(SW_RES(ST_SALUTATIONELEMENTS))); + m_pInsertFieldIB->SetQuickHelpText(String(SW_RES(ST_INSERTSALUTATIONFIELD))); + m_pRemoveFieldIB->SetQuickHelpText(String(SW_RES(ST_REMOVESALUTATIONFIELD))); + m_pDragFT->SetText(String(SW_RES(ST_DRAGSALUTATION))); } else { if(eType == ADDRESSBLOCK_EDIT) SetText(String(SW_RES(ST_TITLE_EDIT))); - - //resize the preview - Point aFieldPos(m_aFieldFT.GetPosPixel()); - long nDiff = m_aPreviewFI.GetPosPixel().Y() - aFieldPos.Y(); - m_aPreviewFI.SetPosPixel(aFieldPos); - Size aPreviewSize = m_aPreviewWIN.GetSizePixel(); - aPreviewSize.Height() += nDiff; - m_aPreviewWIN.SetSizePixel(aPreviewSize); - m_aPreviewWIN.SetPosPixel(m_aFieldCB.GetPosPixel()); - m_aDragED.SetText(OUString("\n\n\n\n\n")); + m_pDragED->SetText(OUString("\n\n\n\n\n")); } - FreeResource(); + const ResStringArray& rHeaders = m_rConfigItem.GetDefaultAddressHeaders(); for(sal_uInt16 i = 0; i < rHeaders.Count(); ++i) { const OUString rHeader = rHeaders.GetString( i ); - SvTreeListEntry* pEntry = m_aAddressElementsLB.InsertEntry(rHeader); + SvTreeListEntry* pEntry = m_pAddressElementsLB->InsertEntry(rHeader); pEntry->SetUserData((void*)(sal_IntPtr)i); } - m_aOK.SetClickHdl(LINK(this, SwCustomizeAddressBlockDialog, OKHdl_Impl)); - m_aAddressElementsLB.SetSelectHdl(LINK(this, SwCustomizeAddressBlockDialog, ListBoxSelectHdl_Impl )); - m_aDragED.SetModifyHdl(LINK(this, SwCustomizeAddressBlockDialog, EditModifyHdl_Impl)); - m_aDragED.SetSelectionChangedHdl( LINK( this, SwCustomizeAddressBlockDialog, SelectionChangedHdl_Impl)); + m_pOK->SetClickHdl(LINK(this, SwCustomizeAddressBlockDialog, OKHdl_Impl)); + m_pAddressElementsLB->SetSelectHdl(LINK(this, SwCustomizeAddressBlockDialog, ListBoxSelectHdl_Impl )); + m_pDragED->SetModifyHdl(LINK(this, SwCustomizeAddressBlockDialog, EditModifyHdl_Impl)); + m_pDragED->SetSelectionChangedHdl( LINK( this, SwCustomizeAddressBlockDialog, SelectionChangedHdl_Impl)); Link aFieldsLink = LINK(this, SwCustomizeAddressBlockDialog, FieldChangeHdl_Impl); - m_aFieldCB.SetModifyHdl(aFieldsLink); - m_aFieldCB.SetSelectHdl(aFieldsLink); + m_pFieldCB->SetModifyHdl(aFieldsLink); + m_pFieldCB->SetSelectHdl(aFieldsLink); Link aImgButtonHdl = LINK(this, SwCustomizeAddressBlockDialog, ImageButtonHdl_Impl); - m_aInsertFieldIB.SetClickHdl(aImgButtonHdl); - m_aRemoveFieldIB.SetClickHdl(aImgButtonHdl); - m_aUpIB.SetClickHdl(aImgButtonHdl); - m_aLeftIB.SetClickHdl(aImgButtonHdl); - m_aRightIB.SetClickHdl(aImgButtonHdl); - m_aDownIB.SetClickHdl(aImgButtonHdl); + m_pInsertFieldIB->SetClickHdl(aImgButtonHdl); + m_pRemoveFieldIB->SetClickHdl(aImgButtonHdl); + m_pUpIB->SetClickHdl(aImgButtonHdl); + m_pLeftIB->SetClickHdl(aImgButtonHdl); + m_pRightIB->SetClickHdl(aImgButtonHdl); + m_pDownIB->SetClickHdl(aImgButtonHdl); UpdateImageButtons_Impl(); } @@ -651,7 +645,7 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, ListBoxSelectHdl_Impl, DDListBox*, pBox { sal_Int32 nUserData = (sal_Int32)(sal_IntPtr)pBox->FirstSelected()->GetUserData(); // Check if the selected entry is already in the address and then forbid inserting - m_aInsertFieldIB.Enable(nUserData >= 0 || !HasItem_Impl(nUserData)); + m_pInsertFieldIB->Enable(nUserData >= 0 || !HasItem_Impl(nUserData)); return 0; } @@ -660,38 +654,38 @@ IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, EditModifyHdl_Impl) String sAddress = SwAddressPreview::FillData( GetAddress(), m_rConfigItem); - m_aPreviewWIN.SetAddress(sAddress); + m_pPreviewWIN->SetAddress(sAddress); UpdateImageButtons_Impl(); return 0; } IMPL_LINK(SwCustomizeAddressBlockDialog, ImageButtonHdl_Impl, ImageButton*, pButton) { - if(&m_aInsertFieldIB == pButton) + if (m_pInsertFieldIB == pButton) { - SvTreeListEntry* pEntry = m_aAddressElementsLB.GetCurEntry(); + SvTreeListEntry* pEntry = m_pAddressElementsLB->GetCurEntry(); if(pEntry) { - String sEntry = m_aAddressElementsLB.GetEntryText(pEntry); + String sEntry = m_pAddressElementsLB->GetEntryText(pEntry); sEntry.Insert('<', 0); sEntry += '>'; - m_aDragED.InsertNewEntry(sEntry); + m_pDragED->InsertNewEntry(sEntry); } } - else if(&m_aRemoveFieldIB == pButton) + else if (m_pRemoveFieldIB == pButton) { - m_aDragED.RemoveCurrentEntry(); + m_pDragED->RemoveCurrentEntry(); } else { sal_uInt16 nMove = MOVE_ITEM_DOWN; - if(&m_aUpIB == pButton) + if (m_pUpIB == pButton) nMove = MOVE_ITEM_UP; - else if(&m_aLeftIB == pButton) + else if (m_pLeftIB == pButton) nMove = MOVE_ITEM_LEFT; - else if(&m_aRightIB == pButton) + else if (m_pRightIB == pButton) nMove = MOVE_ITEM_RIGHT; - m_aDragED.MoveCurrentItem(nMove); + m_pDragED->MoveCurrentItem(nMove); } UpdateImageButtons_Impl(); return 0; @@ -700,12 +694,12 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, ImageButtonHdl_Impl, ImageButton*, pBut sal_Int32 SwCustomizeAddressBlockDialog::GetSelectedItem_Impl() { sal_Int32 nRet = USER_DATA_NONE; - String sSelected = m_aDragED.GetCurrentItem(); + String sSelected = m_pDragED->GetCurrentItem(); if(sSelected.Len()) - for(sal_uLong i = 0; i < m_aAddressElementsLB.GetEntryCount(); ++i) + for(sal_uLong i = 0; i < m_pAddressElementsLB->GetEntryCount(); ++i) { - SvTreeListEntry* pEntry = m_aAddressElementsLB.GetEntry(i); - String sEntry = m_aAddressElementsLB.GetEntryText(pEntry); + SvTreeListEntry* pEntry = m_pAddressElementsLB->GetEntry(i); + String sEntry = m_pAddressElementsLB->GetEntryText(pEntry); if( sSelected.Equals( sEntry, 1, sSelected.Len() - 2 ) ) { nRet = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); @@ -719,12 +713,12 @@ bool SwCustomizeAddressBlockDialog::HasItem_Impl(sal_Int32 nUserData) { //get the entry from the ListBox String sEntry; - for(sal_uLong i = 0; i < m_aAddressElementsLB.GetEntryCount(); ++i) + for(sal_uLong i = 0; i < m_pAddressElementsLB->GetEntryCount(); ++i) { - SvTreeListEntry* pEntry = m_aAddressElementsLB.GetEntry(i); + SvTreeListEntry* pEntry = m_pAddressElementsLB->GetEntry(i); if((sal_Int32)(sal_IntPtr)pEntry->GetUserData() == nUserData) { - sEntry = m_aAddressElementsLB.GetEntryText(pEntry); + sEntry = m_pAddressElementsLB->GetEntryText(pEntry); break; } } @@ -732,7 +726,7 @@ bool SwCustomizeAddressBlockDialog::HasItem_Impl(sal_Int32 nUserData) sEntry += '>'; sEntry.Insert( '<', 0); //search for this entry in the content - String sText = m_aDragED.GetText(); + String sText = m_pDragED->GetText(); bool bRet = sText.Search(sEntry) != STRING_NOTFOUND; return bRet; } @@ -751,7 +745,7 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, SelectionChangedHdl_Impl, AddressMultiL if(USER_DATA_NONE != nSelected) pEdit->SelectCurrentItem(); - if(m_aFieldCB.IsVisible() && (USER_DATA_NONE != nSelected) && (nSelected < 0)) + if(m_pFieldCB->IsVisible() && (USER_DATA_NONE != nSelected) && (nSelected < 0)) { //search in ListBox if it's one of the first entries String sSelect; @@ -769,20 +763,20 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, SelectionChangedHdl_Impl, AddressMultiL sSelect = m_sCurrentText; break; } - m_aFieldCB.Clear(); + m_pFieldCB->Clear(); if(pVector) { ::std::vector<String>::iterator aIterator; for( aIterator = pVector->begin(); aIterator != pVector->end(); ++aIterator) - m_aFieldCB.InsertEntry(*aIterator); + m_pFieldCB->InsertEntry(*aIterator); } - m_aFieldCB.SetText(sSelect); - m_aFieldCB.Enable(sal_True); - m_aFieldFT.Enable(sal_True); + m_pFieldCB->SetText(sSelect); + m_pFieldCB->Enable(sal_True); + m_pFieldFT->Enable(sal_True); } else { - m_aFieldCB.Enable(sal_False); - m_aFieldFT.Enable(sal_False); + m_pFieldCB->Enable(sal_False); + m_pFieldFT->Enable(sal_False); } UpdateImageButtons_Impl(); @@ -794,7 +788,7 @@ IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, FieldChangeHdl_Impl) { //changing the field content changes the related members, too sal_Int32 nSelected = GetSelectedItem_Impl(); - String sContent = m_aFieldCB.GetText(); + String sContent = m_pFieldCB->GetText(); switch(nSelected) { case USER_DATA_SALUTATION: m_sCurrentSalutation = sContent; @@ -807,41 +801,41 @@ IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, FieldChangeHdl_Impl) break; } UpdateImageButtons_Impl(); - m_aPreviewWIN.SetAddress(GetAddress()); - m_aDragED.Modify(); + m_pPreviewWIN->SetAddress(GetAddress()); + m_pDragED->Modify(); return 0; } void SwCustomizeAddressBlockDialog::UpdateImageButtons_Impl() { - sal_uInt16 nMove = m_aDragED.IsCurrentItemMoveable(); - m_aUpIB.Enable(nMove & MOVE_ITEM_UP ); - m_aLeftIB.Enable(nMove & MOVE_ITEM_LEFT ); - m_aRightIB.Enable(nMove & MOVE_ITEM_RIGHT ); - m_aDownIB.Enable(nMove & MOVE_ITEM_DOWN); - m_aRemoveFieldIB.Enable(m_aDragED.HasCurrentItem() ? sal_True : sal_False); - SvTreeListEntry* pEntry = m_aAddressElementsLB.GetCurEntry(); - m_aInsertFieldIB.Enable( pEntry && - (0 < (sal_Int32)(sal_IntPtr)pEntry->GetUserData() || !m_aFieldCB.GetText().isEmpty())); + sal_uInt16 nMove = m_pDragED->IsCurrentItemMoveable(); + m_pUpIB->Enable(nMove & MOVE_ITEM_UP ); + m_pLeftIB->Enable(nMove & MOVE_ITEM_LEFT ); + m_pRightIB->Enable(nMove & MOVE_ITEM_RIGHT ); + m_pDownIB->Enable(nMove & MOVE_ITEM_DOWN); + m_pRemoveFieldIB->Enable(m_pDragED->HasCurrentItem() ? sal_True : sal_False); + SvTreeListEntry* pEntry = m_pAddressElementsLB->GetCurEntry(); + m_pInsertFieldIB->Enable( pEntry && + (0 < (sal_Int32)(sal_IntPtr)pEntry->GetUserData() || !m_pFieldCB->GetText().isEmpty())); } void SwCustomizeAddressBlockDialog::SetAddress(const OUString& rAddress) { - m_aDragED.SetText( rAddress ); + m_pDragED->SetText( rAddress ); UpdateImageButtons_Impl(); - m_aDragED.Modify(); + m_pDragED->Modify(); } OUString SwCustomizeAddressBlockDialog::GetAddress() { - String sAddress(m_aDragED.GetAddress()); + String sAddress(m_pDragED->GetAddress()); //remove placeholders by the actual content - if(m_aFieldFT.IsVisible()) + if(m_pFieldFT->IsVisible()) { - for(sal_uLong i = 0; i < m_aAddressElementsLB.GetEntryCount(); ++i) + for(sal_uLong i = 0; i < m_pAddressElementsLB->GetEntryCount(); ++i) { - SvTreeListEntry* pEntry = m_aAddressElementsLB.GetEntry(i); - String sEntry = m_aAddressElementsLB.GetEntryText(pEntry); + SvTreeListEntry* pEntry = m_pAddressElementsLB->GetEntry(i); + String sEntry = m_pAddressElementsLB->GetEntryText(pEntry); sEntry += '>'; sEntry.Insert('<', 0); sal_Int32 nUserData = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); @@ -856,70 +850,6 @@ OUString SwCustomizeAddressBlockDialog::GetAddress() return sAddress; } -void SwCustomizeAddressBlockDialog::MoveFocus( Window* pMember, bool bNext ) -{ - ::std::vector< Window* > aControls; - - aControls.push_back(&m_aAddressElementsLB); - aControls.push_back(&m_aInsertFieldIB); - aControls.push_back(&m_aRemoveFieldIB); - aControls.push_back(&m_aDragED); - aControls.push_back(&m_aUpIB); - aControls.push_back(&m_aLeftIB); - aControls.push_back(&m_aRightIB); - aControls.push_back(&m_aDownIB); - aControls.push_back(&m_aFieldCB); - aControls.push_back(&m_aOK); - aControls.push_back(&m_aCancel); - aControls.push_back(&m_aHelp); - - ::std::vector< Window* >::iterator aMemberIter = aControls.begin(); - for( ; aMemberIter != aControls.end(); ++aMemberIter) - { - if(*aMemberIter == pMember) - break; - } - if( aMemberIter == aControls.end() ) - { - OSL_FAIL("Window not found?" ); - return; - } - - if( bNext ) - { - ::std::vector< Window* >::iterator aSearch = aMemberIter; - ++aSearch; - while( true ) - { - if( aSearch == aControls.end()) - aSearch = aControls.begin(); - else if( (*aSearch)->IsEnabled() ) - { - (*aSearch)->GrabFocus(); - break; - } - else - ++aSearch; - } - } - else - { - ::std::vector< Window* >::iterator aSearch = aMemberIter; - while( true ) - { - if(aSearch == aControls.begin()) - aSearch = aControls.end(); - --aSearch; - if( (*aSearch)->IsEnabled() ) - { - (*aSearch)->GrabFocus(); - break; - } - } - } - -} - class SwAssignFieldsControl : public Control { friend class SwAssignFieldsDialog; @@ -1319,9 +1249,9 @@ IMPL_LINK_NOARG(SwAssignFieldsDialog, AssignmentModifyHdl_Impl) return 0; } -DDListBox::DDListBox(SwCustomizeAddressBlockDialog* pParent, const ResId rResId) : - SvTreeListBox(pParent, rResId), - m_pParentDialog(pParent) +DDListBox::DDListBox(Window* pParent, WinBits nStyle) + : SvTreeListBox(pParent, nStyle) + , m_pParentDialog(NULL) { SetStyle( GetStyle() | /*WB_HASBUTTONS|WB_HASBUTTONSATROOT|*/ WB_CLIPCHILDREN ); @@ -1335,8 +1265,18 @@ DDListBox::DDListBox(SwCustomizeAddressBlockDialog* pParent, const ResId rResId) } -DDListBox::~DDListBox() +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeDDListBox(Window *pParent, VclBuilder::stringmap &rMap) { + WinBits nWinStyle = WB_TABSTOP; + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + return new DDListBox(pParent, nWinStyle); +} + +void DDListBox::SetAddressDialog(SwCustomizeAddressBlockDialog *pParent) +{ + m_pParentDialog = pParent; } void DDListBox::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ ) @@ -1367,16 +1307,34 @@ void DDListBox::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ ) } } -AddressMultiLineEdit::AddressMultiLineEdit(SwCustomizeAddressBlockDialog* pParent, const ResId& rResId) : - MultiLineEdit(pParent, rResId), - m_pParentDialog(pParent) - +AddressMultiLineEdit::AddressMultiLineEdit(Window* pParent, WinBits nBits) + : VclMultiLineEdit(pParent, nBits) + , m_pParentDialog(NULL) { GetTextView()->SupportProtectAttribute(sal_True); StartListening(*GetTextEngine()); EnableFocusSelectionHide(sal_False); } +Size AddressMultiLineEdit::GetOptimalSize() const +{ + return LogicToPixel(Size(160, 60), MapMode(MAP_APPFONT)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeAddressMultiLineEdit(Window *pParent, VclBuilder::stringmap &rMap) +{ + WinBits nWinStyle = WB_LEFT|WB_TABSTOP; + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + return new AddressMultiLineEdit(pParent, nWinStyle); +} + +void AddressMultiLineEdit::SetAddressDialog(SwCustomizeAddressBlockDialog *pParent) +{ + m_pParentDialog = pParent; +} + AddressMultiLineEdit::~AddressMultiLineEdit() { EndListening(*GetTextEngine()); @@ -1398,12 +1356,6 @@ long AddressMultiLineEdit::PreNotify( NotifyEvent& rNEvt ) if( EVENT_KEYINPUT == rNEvt.GetType() && rNEvt.GetKeyEvent()->GetCharCode()) { - const KeyEvent* pKEvent = rNEvt.GetKeyEvent(); - if('\t' == pKEvent->GetCharCode() && - 0 == (pKEvent->GetKeyCode().GetModifier() & (KEY_MOD1|KEY_MOD2))) - { - m_pParentDialog->MoveFocus(this, !pKEvent->GetKeyCode().IsShift()); - } nHandled = 1; } else if(EVENT_MOUSEBUTTONDOWN == rNEvt.GetType()) { @@ -1412,14 +1364,14 @@ long AddressMultiLineEdit::PreNotify( NotifyEvent& rNEvt ) nHandled = 1; } if(!nHandled) - nHandled = MultiLineEdit::PreNotify( rNEvt ); + nHandled = VclMultiLineEdit::PreNotify( rNEvt ); return nHandled; } void AddressMultiLineEdit::SetText( const OUString& rStr ) { - MultiLineEdit::SetText(rStr); + VclMultiLineEdit::SetText(rStr); //set attributes to all address tokens ExtTextEngine* pTextEngine = GetTextEngine(); diff --git a/sw/source/ui/dbui/mmaddressblockpage.hrc b/sw/source/ui/dbui/mmaddressblockpage.hrc index 2634acedbf23..17e42099469e 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.hrc +++ b/sw/source/ui/dbui/mmaddressblockpage.hrc @@ -53,33 +53,6 @@ #define PB_CANCEL 31 #define PB_HELP 32 -#define FT_ADDRESSELEMENTS 40 -#define LB_ADDRESSELEMENTS 41 -#define IB_INSERTFIELD 42 -#define IB_REMOVEFIELD 43 -#define FT_DRAG 48 -#define ED_DRAG 49 -#define IB_UP 50 -#define IB_LEFT 51 -#define IB_RIGHT 52 -#define IB_DOWN 53 -#define FT_FIELD 54 -#define CB_FIELD 55 -#define ST_SALUTATION 56 -#define ST_PUNCTUATION 57 -#define ST_TEXT 58 -#define RA_SALUTATION_MALE 59 -#define RA_SALUTATION_FEMALE 60 -#define RA_PUNCTUATION 61 -#define ST_TITLE_MALE 62 -#define ST_TITLE_FEMALE 63 -#define ST_SALUTATIONELEMENTS 64 -#define ST_INSERTSALUTATIONFIELD 65 -#define ST_REMOVESALUTATIONFIELD 66 -#define ST_DRAGSALUTATION 67 -#define ST_TITLE_EDIT 68 - - #define FI_MATCHING 70 #define CT_FIELDS 71 #define ST_SALUTATIONPREVIEW 72 diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx index 57e409711159..6e32c7d954f5 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.hxx +++ b/sw/source/ui/dbui/mmaddressblockpage.hxx @@ -143,8 +143,9 @@ class DDListBox : public SvTreeListBox { SwCustomizeAddressBlockDialog* m_pParentDialog; public: - DDListBox(SwCustomizeAddressBlockDialog* pParent, const ResId rResId); - ~DDListBox(); + DDListBox(Window* pParent, const WinBits nStyle); + + void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent); virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); }; @@ -154,23 +155,27 @@ public: #define MOVE_ITEM_UP 4 #define MOVE_ITEM_DOWN 8 -class AddressMultiLineEdit : public MultiLineEdit, public SfxListener +class AddressMultiLineEdit : public VclMultiLineEdit, public SfxListener { Link m_aSelectionLink; SwCustomizeAddressBlockDialog* m_pParentDialog; - using MultiLineEdit::Notify; + using VclMultiLineEdit::Notify; - using MultiLineEdit::SetText; + using VclMultiLineEdit::SetText; protected: long PreNotify( NotifyEvent& rNEvt ); public: - AddressMultiLineEdit(SwCustomizeAddressBlockDialog* pParent, const ResId& rResId); + AddressMultiLineEdit(Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER); ~AddressMultiLineEdit(); + void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual Size GetOptimalSize() const; + void SetSelectionChangedHdl( const Link& rLink ) {m_aSelectionLink = rLink;} void SetText( const OUString& rStr ); @@ -196,10 +201,10 @@ protected: virtual void KeyInput( const KeyEvent& ); virtual void Modify(); public: - SwRestrictedComboBox(Window* pParent, const ResId& rResId): - ComboBox( pParent, rResId ){} - - ~SwRestrictedComboBox(); + SwRestrictedComboBox(Window* pParent, WinBits nStyle = 0) + : ComboBox( pParent, nStyle ) + { + } void SetForbiddenChars(const String& rSet){sForbiddenChars = rSet;} @@ -217,30 +222,25 @@ public: GREETING_MALE }; private: - FixedText m_aAddressElementsFT; - DDListBox m_aAddressElementsLB; - - ImageButton m_aInsertFieldIB; - ImageButton m_aRemoveFieldIB; + FixedText* m_pAddressElementsFT; + DDListBox* m_pAddressElementsLB; - FixedText m_aDragFT; - AddressMultiLineEdit m_aDragED; - ImageButton m_aUpIB; - ImageButton m_aLeftIB; - ImageButton m_aRightIB; - ImageButton m_aDownIB; + PushButton* m_pInsertFieldIB; + PushButton* m_pRemoveFieldIB; - FixedText m_aFieldFT; - SwRestrictedComboBox m_aFieldCB; + FixedText* m_pDragFT; + AddressMultiLineEdit* m_pDragED; + PushButton* m_pUpIB; + PushButton* m_pLeftIB; + PushButton* m_pRightIB; + PushButton* m_pDownIB; - FixedInfo m_aPreviewFI; - SwAddressPreview m_aPreviewWIN; + FixedText* m_pFieldFT; + SwRestrictedComboBox* m_pFieldCB; - FixedLine m_aSeparatorFL; + SwAddressPreview* m_pPreviewWIN; - OKButton m_aOK; - CancelButton m_aCancel; - HelpButton m_aHelp; + OKButton* m_pOK; ::std::vector<String> m_aSalutations; ::std::vector<String> m_aPunctuations; @@ -262,7 +262,6 @@ private: bool HasItem_Impl(sal_Int32 nUserData); sal_Int32 GetSelectedItem_Impl(); void UpdateImageButtons_Impl(); - void MoveFocus( Window* pMember, bool bNext ); public: SwCustomizeAddressBlockDialog(Window* pParent, SwMailMergeConfigItem& rConfig, DialogType); diff --git a/sw/source/ui/dbui/mmaddressblockpage.src b/sw/source/ui/dbui/mmaddressblockpage.src index 69f4538a8ad6..6b39d3a389bb 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.src +++ b/sw/source/ui/dbui/mmaddressblockpage.src @@ -293,230 +293,96 @@ ModalDialog DLG_MM_SELECTADDRESSBLOCK #define WORKAROUND\ Text [ en-US ] = "New Address Block"; - -ModalDialog DLG_MM_CUSTOMIZEADDRESSBLOCK +String ST_TITLE_EDIT { - OutputSize = TRUE ; - SVLook = TRUE ; - HelpID = HID_MM_CUSTOMIZEADDRESSBLOCK; - Size = MAP_APPFONT ( 320 , 176 ) ; - Moveable = TRUE ; - - WORKAROUND - - String ST_TITLE_EDIT - { - Text [ en-US ] = "Edit Address Block"; - }; + Text [ en-US ] = "Edit Address Block"; +}; - String ST_TITLE_MALE - { - Text [ en-US ] = "Custom Salutation (Male Recipients)"; - }; - String ST_TITLE_FEMALE - { - Text [ en-US ] = "Custom Salutation (Female Recipients)"; - }; - FixedText FT_ADDRESSELEMENTS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text[ en-US ] = "Address ~elements" ; - }; - String ST_SALUTATIONELEMENTS - { - Text[ en-US ] = "Salutation e~lements" ; - }; - Control LB_ADDRESSELEMENTS - { - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 68 , 121 ) ; - TabStop = TRUE; - Border = TRUE; - }; - ImageButton IB_INSERTFIELD - { - HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_INSERTFIELD"; - Pos = MAP_APPFONT ( 80 , 29 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_RIGHT; - QuickHelpText[ en-US ] = "Add to address"; - }; - String ST_INSERTSALUTATIONFIELD - { - Text[ en-US ] = "Add to salutation"; - }; - ImageButton IB_REMOVEFIELD - { - HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_REMOVEFIELD"; - Pos = MAP_APPFONT ( 80 , 46 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_LEFT; - QuickHelpText[ en-US ] = "Remove from address"; - }; - String ST_REMOVESALUTATIONFIELD - { - Text[ en-US ] = "Remove from salutation"; - }; - FixedText FT_DRAG - { - Pos = MAP_APPFONT ( 100 , 3 ) ; - Size = MAP_APPFONT ( 210 , 8 ) ; - Text[ en-US ] = "1. Drag address elements here" ; - }; - String ST_DRAGSALUTATION - { - Text[ en-US ] = "1. ~Drag salutation elements into the box below" ; - }; - MultiLineEdit ED_DRAG - { - HelpID = "sw:MultiLineEdit:DLG_MM_CUSTOMIZEADDRESSBLOCK:ED_DRAG"; - Pos = MAP_APPFONT ( 106 , 14 ) ; - Size = MAP_APPFONT ( 160 , 60 ) ; - Border = TRUE; - }; - ImageButton IB_UP - { - HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_UP"; - Pos = MAP_APPFONT ( 285 , 14 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_UP; - QuickHelpText[ en-US ] = "Move up"; - }; - ImageButton IB_LEFT - { - HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_LEFT"; - Pos = MAP_APPFONT ( 270 , 29 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_LEFT; - QuickHelpText[ en-US ] = "Move left"; - }; - ImageButton IB_RIGHT - { - HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_RIGHT"; - Pos = MAP_APPFONT ( 300 , 29 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_RIGHT; - QuickHelpText[ en-US ] = "Move right"; - }; - ImageButton IB_DOWN - { - HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_DOWN"; - Pos = MAP_APPFONT ( 285 , 48 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_DOWN; - QuickHelpText[ en-US ] = "Move down"; - }; - FixedText FT_FIELD - { - Pos = MAP_APPFONT ( 100 , 78 ) ; - Size = MAP_APPFONT ( 160 , 8 ) ; - Hide = TRUE; - Text[ en-US ] = "2. Customi~ze salutation"; - }; - ComboBox CB_FIELD - { - HelpID = "sw:ComboBox:DLG_MM_CUSTOMIZEADDRESSBLOCK:CB_FIELD"; - Pos = MAP_APPFONT ( 106 , 89 ) ; - Size = MAP_APPFONT ( 160 , 50 ) ; - Border = TRUE; - DropDown = TRUE; - Hide = TRUE; - }; - FixedText FI_PREVIEW - { - Pos = MAP_APPFONT ( 106 , 105 ) ; - Size = MAP_APPFONT ( 160 , 8 ) ; - Text[ en-US ] = "Preview"; - }; - Window WIN_PREVIEW - { - Pos = MAP_APPFONT ( 106 , 116 ) ; - Size = MAP_APPFONT ( 160 , 19 ) ; - Border = TRUE; - }; - FixedLine FL_SEPARATOR - { - Pos = MAP_APPFONT ( 0 , 145 ) ; - Size = MAP_APPFONT ( 320 , 8 ) ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 155 , 156 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 208 , 156 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 264 , 156 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - String ST_SALUTATION +String ST_TITLE_MALE +{ + Text [ en-US ] = "Custom Salutation (Male Recipients)"; +}; +String ST_TITLE_FEMALE +{ + Text [ en-US ] = "Custom Salutation (Female Recipients)"; +}; +String ST_SALUTATIONELEMENTS +{ + Text[ en-US ] = "Salutation e~lements" ; +}; +String ST_INSERTSALUTATIONFIELD +{ + Text[ en-US ] = "Add to salutation"; +}; +String ST_REMOVESALUTATIONFIELD +{ + Text[ en-US ] = "Remove from salutation"; +}; +String ST_DRAGSALUTATION +{ + Text[ en-US ] = "1. ~Drag salutation elements into the box below" ; +}; +String ST_SALUTATION +{ + Text[ en-US ] = "Salutation"; +}; +String ST_PUNCTUATION +{ + Text[ en-US ] = "Punctuation Mark"; +}; +String ST_TEXT +{ + Text[ en-US ] = "Text"; +}; +StringArray RA_SALUTATION_MALE +{ + ItemList = { - Text[ en-US ] = "Salutation"; + < "Sehr geehrter Herr <2>," ; > ; + < "Lieber Herr <2>," ; > ; + < "Hallo Herr <2>," ; > ; + < "Hallo <1>," ; > ; }; - String ST_PUNCTUATION + ItemList [en-US]= { - Text[ en-US ] = "Punctuation Mark"; + < "Dear Mr. <2>," ; > ; + < "Mr. <2>," ; > ; + < "Dear <1>," ; > ; + < "Hello <1>," ; > ; }; - String ST_TEXT +}; +StringArray RA_SALUTATION_FEMALE +{ + ItemList = { - Text[ en-US ] = "Text"; + < "Sehr geehrte Frau <2>," ; > ; + < "Liebe Frau <2>," ; > ; + < "Hallo Frau <2>," ; > ; + < "Hallo <1>," ; > ; }; - StringArray RA_SALUTATION_MALE + ItemList [en-US]= { - ItemList = - { - < "Sehr geehrter Herr <2>," ; > ; - < "Lieber Herr <2>," ; > ; - < "Hallo Herr <2>," ; > ; - < "Hallo <1>," ; > ; - }; - ItemList [en-US]= - { - < "Dear Mr. <2>," ; > ; - < "Mr. <2>," ; > ; - < "Dear <1>," ; > ; - < "Hello <1>," ; > ; - }; + < "Dear Mrs. <2>," ; > ; + < "Ms. <2>," ; > ; + < "Dear <1>," ; > ; + < "Hello <1>," ; > ; }; - StringArray RA_SALUTATION_FEMALE +}; +StringArray RA_PUNCTUATION +{ + ItemList = { - ItemList = - { - < "Sehr geehrte Frau <2>," ; > ; - < "Liebe Frau <2>," ; > ; - < "Hallo Frau <2>," ; > ; - < "Hallo <1>," ; > ; - }; - ItemList [en-US]= - { - < "Dear Mrs. <2>," ; > ; - < "Ms. <2>," ; > ; - < "Dear <1>," ; > ; - < "Hello <1>," ; > ; - }; + < "," ; > ; + < ":" ; > ; + < "!" ; > ; + < "(kein)" ; > ; }; - StringArray RA_PUNCTUATION + ItemList [en-US]= { - ItemList = - { - < "," ; > ; - < ":" ; > ; - < "!" ; > ; - < "(kein)" ; > ; - }; - ItemList [en-US]= - { - < "," ; > ; - < ":" ; > ; - < "!" ; > ; - < "(none)" ; > ; - }; + < "," ; > ; + < ":" ; > ; + < "!" ; > ; + < "(none)" ; > ; }; }; diff --git a/sw/source/ui/inc/mailmergehelper.hxx b/sw/source/ui/inc/mailmergehelper.hxx index aa73d7ead564..7c6bb043afe8 100644 --- a/sw/source/ui/inc/mailmergehelper.hxx +++ b/sw/source/ui/inc/mailmergehelper.hxx @@ -74,6 +74,7 @@ class SW_DLLPUBLIC SwAddressPreview : public Window void DrawText_Impl( const OUString& rAddress, const Point& rTopLeft, const Size& rSize, bool bIsSelected); virtual void Paint(const Rectangle&); + virtual void Resize(); virtual void MouseButtonDown( const MouseEvent& rMEvt ); virtual void KeyInput( const KeyEvent& rKEvt ); virtual void StateChanged( StateChangedType nStateChange ); @@ -82,8 +83,11 @@ class SW_DLLPUBLIC SwAddressPreview : public Window DECL_LINK(ScrollHdl, void*); public: - SwAddressPreview(Window* pParent, const ResId rResId); - ~SwAddressPreview(); + SwAddressPreview(Window* pParent, const ResId& rResId); + + SwAddressPreview(Window* pParent, WinBits nStyle=WB_BORDER); + + void positionScrollBar(); /** The address string is a list of address elements separated by spaces and breaks. The addresses fit into the given layout. If more addresses then diff --git a/sw/uiconfig/swriter/ui/addressblockdialog.ui b/sw/uiconfig/swriter/ui/addressblockdialog.ui new file mode 100644 index 000000000000..ff07d1630731 --- /dev/null +++ b/sw/uiconfig/swriter/ui/addressblockdialog.ui @@ -0,0 +1,426 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires LibreOffice 1.0 --> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="AddressBlockDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">New Address Block</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="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_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="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">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <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">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="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="addressesft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Address _elements</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">addresses:border</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="swuilo-DDListBox" id="addresses:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="addressdestft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">1. Drag address elements here</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">addressdest:border</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="valign">center</property> + <property name="row_homogeneous">True</property> + <property name="column_homogeneous">True</property> + <child> + <object class="GtkButton" id="up"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Move up</property> + <property name="image">image3</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</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="tooltip_text" translatable="yes">Move left</property> + <property name="image">image2</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</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="tooltip_text" translatable="yes">Move right</property> + <property name="image">image1</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="down"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Move down</property> + <property name="image">image4</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> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <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">Preview</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">addrpreview:border</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="customft"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">2. Customi_ze salutation</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">custom</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="swuilo-SwRestrictedComboBox" id="custom"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="has_entry">True</property> + <property name="entry_text_column">0</property> + <property name="id_column">1</property> + <child internal-child="entry"> + <object class="GtkEntry" id="comboboxtext-entry"> + <property name="can_focus">False</property> + </object> + </child> + </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="swuilo-AddressMultiLineEdit" id="addressdest:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="accepts_tab">False</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="swlo-SwAddressPreview" id="addrpreview:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">5</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkButton" id="fromaddr"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Remove from address</property> + <property name="tooltip_text" translatable="yes">Remove from address</property> + <property name="image">image6</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="toaddr"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image5</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </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">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</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-forward</property> + </object> + <object class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-go-back</property> + </object> + <object class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-go-up</property> + </object> + <object class="GtkImage" id="image4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-go-down</property> + </object> + <object class="GtkImage" id="image5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Add to address</property> + <property name="stock">gtk-go-forward</property> + </object> + <object class="GtkImage" id="image6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-go-back</property> + </object> + <object class="GtkSizeGroup" id="sizegroup1"> + <property name="mode">both</property> + <widgets> + <widget name="addressdest:border"/> + <widget name="addrpreview:border"/> + </widgets> + </object> +</interface> |