sw/source/ui/dbui/mailmergewizard.cxx | 2 sw/source/ui/dbui/mmgreetingspage.cxx | 445 +++++++++++------------------ sw/source/ui/dbui/mmgreetingspage.hxx | 120 ++++--- sw/source/ui/dbui/mmresultdialogs.cxx | 10 sw/source/uibase/dbui/mailmergehelper.cxx | 331 +++++++++++++++++++++ sw/source/uibase/inc/mailmergehelper.hxx | 53 +++ sw/uiconfig/swriter/ui/mmmailbody.ui | 82 +---- sw/uiconfig/swriter/ui/mmsalutationpage.ui | 117 ++----- 8 files changed, 697 insertions(+), 463 deletions(-)
New commits: commit a4b8df27b956610f6a481f0c25ba8ccc5ee21460 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Oct 17 11:59:14 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Oct 18 10:23:45 2018 +0200 weld SwMailMergeGreetingsPage and SwMailBodyDialog Change-Id: I7ac171654ec0a5095c05d1b54bec423b8eb9247b Reviewed-on: https://gerrit.libreoffice.org/61888 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx index a862e377ce1b..ed43ce86e430 100644 --- a/sw/source/ui/dbui/mailmergewizard.cxx +++ b/sw/source/ui/dbui/mailmergewizard.cxx @@ -110,7 +110,7 @@ VclPtr<TabPage> SwMailMergeWizard::createPage(WizardState _nState) SetRoadmapHelpId("modules/swriter/ui/mmaddressblockpage/MMAddressBlockPage"); break; case MM_GREETINGSPAGE : - pRet = VclPtr<SwMailMergeGreetingsPage>::Create(this); + pRet = VclPtr<SwMailMergeGreetingsPage>::Create(this, TabPageParent(this)); SetRoadmapHelpId("modules/swriter/ui/mmsalutationpage/MMSalutationPage"); break; case MM_LAYOUTPAGE : diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx index 85a395f0671a..2723fb04849e 100644 --- a/sw/source/ui/dbui/mmgreetingspage.cxx +++ b/sw/source/ui/dbui/mmgreetingspage.cxx @@ -34,64 +34,42 @@ using namespace svt; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -static void lcl_FillGreetingsBox(ListBox& rBox, +static void lcl_FillGreetingsBox(weld::ComboBox& rBox, SwMailMergeConfigItem const & rConfig, SwMailMergeConfigItem::Gender eType) { const Sequence< OUString> rEntries = rConfig.GetGreetings(eType); for(sal_Int32 nEntry = 0; nEntry < rEntries.getLength(); ++nEntry) - rBox.InsertEntry(rEntries[nEntry]); - rBox.SelectEntryPos(rConfig.GetCurrentGreeting(eType)); + rBox.append_text(rEntries[nEntry]); + rBox.set_active(rConfig.GetCurrentGreeting(eType)); } -static void lcl_FillGreetingsBox(ComboBox& rBox, - SwMailMergeConfigItem const & rConfig, - SwMailMergeConfigItem::Gender eType) -{ - const Sequence< OUString> rEntries = rConfig.GetGreetings(eType); - for(sal_Int32 nEntry = 0; nEntry < rEntries.getLength(); ++nEntry) - rBox.InsertEntry(rEntries[nEntry]); - rBox.SelectEntryPos(rConfig.GetCurrentGreeting(eType)); -} - -static void lcl_StoreGreetingsBox(ListBox const & rBox, - SwMailMergeConfigItem& rConfig, - SwMailMergeConfigItem::Gender eType) -{ - Sequence< OUString> aEntries(rBox.GetEntryCount()); - OUString* pEntries = aEntries.getArray(); - for(sal_Int32 nEntry = 0; nEntry < rBox.GetEntryCount(); ++nEntry) - pEntries[nEntry] = rBox.GetEntry(nEntry); - rConfig.SetGreetings(eType, aEntries); - rConfig.SetCurrentGreeting(eType, rBox.GetSelectedEntryPos()); -} - -static void lcl_StoreGreetingsBox(ComboBox const & rBox, +static void lcl_StoreGreetingsBox(const weld::ComboBox& rBox, SwMailMergeConfigItem& rConfig, SwMailMergeConfigItem::Gender eType) { - Sequence< OUString> aEntries(rBox.GetEntryCount()); + Sequence< OUString> aEntries(rBox.get_count()); OUString* pEntries = aEntries.getArray(); - for(sal_Int32 nEntry = 0; nEntry < rBox.GetEntryCount(); ++nEntry) - pEntries[nEntry] = rBox.GetEntry(nEntry); + for(sal_Int32 nEntry = 0; nEntry < rBox.get_count(); ++nEntry) + pEntries[nEntry] = rBox.get_text(nEntry); rConfig.SetGreetings(eType, aEntries); - rConfig.SetCurrentGreeting(eType, rBox.GetSelectedEntryPos()); + rConfig.SetCurrentGreeting(eType, rBox.get_active()); } -IMPL_LINK_NOARG(SwGreetingsHandler, IndividualHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SwGreetingsHandler, IndividualHdl_Impl, weld::ToggleButton&, void) { - bool bIndividual = m_pPersonalizedCB->IsEnabled() && m_pPersonalizedCB->IsChecked(); - m_pFemaleFT->Enable(bIndividual); - m_pFemaleLB->Enable(bIndividual); - m_pFemalePB->Enable(bIndividual); - m_pMaleFT->Enable(bIndividual); - m_pMaleLB->Enable(bIndividual); - m_pMalePB->Enable(bIndividual); - m_pFemaleFI->Enable(bIndividual); - m_pFemaleColumnFT->Enable(bIndividual); - m_pFemaleColumnLB->Enable(bIndividual); - m_pFemaleFieldFT->Enable(bIndividual); - m_pFemaleFieldCB->Enable(bIndividual); + bool bIndividual = m_xPersonalizedCB->get_sensitive() && m_xPersonalizedCB->get_active(); + m_xFemaleFT->set_sensitive(bIndividual); + m_xFemaleLB->set_sensitive(bIndividual); + m_xFemalePB->set_sensitive(bIndividual); + m_xMaleFT->set_sensitive(bIndividual); + m_xMaleLB->set_sensitive(bIndividual); + m_xMalePB->set_sensitive(bIndividual); + m_xFemaleFI->set_sensitive(bIndividual); + m_xFemaleColumnFT->set_sensitive(bIndividual); + m_xFemaleColumnLB->set_sensitive(bIndividual); + m_xFemaleFieldFT->set_sensitive(bIndividual); + m_xFemaleFieldCB->set_sensitive(bIndividual); if( m_bIsTabPage ) { @@ -102,17 +80,18 @@ IMPL_LINK_NOARG(SwGreetingsHandler, IndividualHdl_Impl, Button*, void) UpdatePreview(); } -IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, Button*, pButton, void) +IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, weld::Button&, rButton, void) { ScopedVclPtr<SwCustomizeAddressBlockDialog> pDlg( - VclPtr<SwCustomizeAddressBlockDialog>::Create(pButton, m_rConfigItem, - pButton == m_pMalePB ? + VclPtr<SwCustomizeAddressBlockDialog>::Create(nullptr /*TODO*/, m_rConfigItem, + &rButton == m_xMalePB.get() ? SwCustomizeAddressBlockDialog::GREETING_MALE : SwCustomizeAddressBlockDialog::GREETING_FEMALE )); - if(RET_OK == pDlg->Execute()) + if (RET_OK == pDlg->Execute()) { - ListBox* pToInsert = pButton == m_pMalePB ? m_pMaleLB.get() : m_pFemaleLB.get(); - pToInsert->SelectEntryPos(pToInsert->InsertEntry(pDlg->GetAddress())); + weld::ComboBox* pToInsert = &rButton == m_xMalePB.get() ? m_xMaleLB.get() : m_xFemaleLB.get(); + pToInsert->append_text(pDlg->GetAddress()); + pToInsert->set_active(pToInsert->get_count() - 1); if(m_bIsTabPage) { m_pWizard->UpdateRoadmap(); @@ -122,16 +101,16 @@ IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, Button*, pButton, void) } } -void SwGreetingsHandler::UpdatePreview() +void SwGreetingsHandler::UpdatePreview() { //the base class does nothing } -IMPL_LINK(SwMailMergeGreetingsPage, AssignHdl_Impl, Button*, pButton, void) +IMPL_LINK_NOARG(SwMailMergeGreetingsPage, AssignHdl_Impl, weld::Button&, void) { - const OUString sPreview(m_pFemaleLB->GetSelectedEntry() + "\n" + m_pMaleLB->GetSelectedEntry()); + const OUString sPreview(m_xFemaleLB->get_active_text() + "\n" + m_xMaleLB->get_active_text()); ScopedVclPtr<SwAssignFieldsDialog> pDlg( - VclPtr<SwAssignFieldsDialog>::Create(pButton, m_rConfigItem, sPreview, false)); + VclPtr<SwAssignFieldsDialog>::Create(nullptr /*TODO*/, m_rConfigItem, sPreview, false)); if(RET_OK == pDlg->Execute()) { UpdatePreview(); @@ -140,15 +119,12 @@ IMPL_LINK(SwMailMergeGreetingsPage, AssignHdl_Impl, Button*, pButton, void) } } -IMPL_LINK_NOARG(SwMailMergeGreetingsPage, GreetingSelectHdl_Impl, Edit&, void) -{ - UpdatePreview(); -} -IMPL_LINK_NOARG(SwMailMergeGreetingsPage, GreetingSelectListBoxHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SwMailMergeGreetingsPage, GreetingSelectListBoxHdl_Impl, weld::ComboBox&, void) { UpdatePreview(); } -IMPL_LINK_NOARG(SwMailMergeGreetingsPage, GreetingSelectComboBoxHdl_Impl, ComboBox&, void) + +IMPL_LINK_NOARG(SwMailMergeGreetingsPage, GreetingSelectComboBoxHdl_Impl, weld::ComboBox&, void) { UpdatePreview(); } @@ -157,11 +133,11 @@ void SwMailMergeGreetingsPage::UpdatePreview() { //find out which type of greeting should be selected: bool bFemale = false; - bool bNoValue = !m_pFemaleColumnLB->IsEnabled(); + bool bNoValue = !m_xFemaleColumnLB->get_sensitive(); if( !bNoValue ) { - const OUString sFemaleValue = m_pFemaleFieldCB->GetText(); - const OUString sFemaleColumn = m_pFemaleColumnLB->GetSelectedEntry(); + const OUString sFemaleValue = m_xFemaleFieldCB->get_active_text(); + const OUString sFemaleColumn = m_xFemaleColumnLB->get_active_text(); Reference< sdbcx::XColumnsSupplier > xColsSupp( m_rConfigItem.GetResultSet(), UNO_QUERY); Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : nullptr; if(!sFemaleValue.isEmpty() && !sFemaleColumn.isEmpty() && @@ -196,99 +172,79 @@ void SwMailMergeGreetingsPage::UpdatePreview() } } - OUString sPreview = bFemale ? m_pFemaleLB->GetSelectedEntry() : - bNoValue ? m_pNeutralCB->GetText() : m_pMaleLB->GetSelectedEntry(); + OUString sPreview = bFemale ? m_xFemaleLB->get_active_text() : + bNoValue ? m_xNeutralCB->get_active_text() : m_xMaleLB->get_active_text(); sPreview = SwAddressPreview::FillData(sPreview, m_rConfigItem); - m_pPreviewWIN->SetAddress(sPreview); + m_xPreview->SetAddress(sPreview); } -void SwGreetingsHandler::Contains(bool bContainsGreeting) +void SwGreetingsHandler::Contains(bool bContainsGreeting) { - m_pPersonalizedCB->Enable(bContainsGreeting); - bool bEnablePersonal = bContainsGreeting && m_pPersonalizedCB->IsChecked(); - m_pFemaleFT->Enable(bEnablePersonal); - m_pFemaleLB->Enable(bEnablePersonal); - m_pFemalePB->Enable(bEnablePersonal); - m_pMaleFT->Enable(bEnablePersonal); - m_pMaleLB->Enable(bEnablePersonal); - m_pMalePB->Enable(bEnablePersonal); - m_pFemaleFI->Enable(bEnablePersonal); - m_pFemaleColumnFT->Enable(bEnablePersonal); - m_pFemaleColumnLB->Enable(bEnablePersonal); - m_pFemaleFieldFT->Enable(bEnablePersonal); - m_pFemaleFieldCB->Enable(bEnablePersonal); - - m_pNeutralFT->Enable(bContainsGreeting); - m_pNeutralCB->Enable(bContainsGreeting); + m_xPersonalizedCB->set_sensitive(bContainsGreeting); + bool bEnablePersonal = bContainsGreeting && m_xPersonalizedCB->get_active(); + m_xFemaleFT->set_sensitive(bEnablePersonal); + m_xFemaleLB->set_sensitive(bEnablePersonal); + m_xFemalePB->set_sensitive(bEnablePersonal); + m_xMaleFT->set_sensitive(bEnablePersonal); + m_xMaleLB->set_sensitive(bEnablePersonal); + m_xMalePB->set_sensitive(bEnablePersonal); + m_xFemaleFI->set_sensitive(bEnablePersonal); + m_xFemaleColumnFT->set_sensitive(bEnablePersonal); + m_xFemaleColumnLB->set_sensitive(bEnablePersonal); + m_xFemaleFieldFT->set_sensitive(bEnablePersonal); + m_xFemaleFieldCB->set_sensitive(bEnablePersonal); + m_xNeutralFT->set_sensitive(bContainsGreeting); + m_xNeutralCB->set_sensitive(bContainsGreeting); } -SwMailMergeGreetingsPage::SwMailMergeGreetingsPage(SwMailMergeWizard* _pParent) - : svt::OWizardPage(_pParent, "MMSalutationPage", - "modules/swriter/ui/mmsalutationpage.ui"), - SwGreetingsHandler(_pParent->GetConfigItem()) +SwMailMergeGreetingsPage::SwMailMergeGreetingsPage(SwMailMergeWizard* pWizard, TabPageParent pParent) + : svt::OWizardPage(pParent, "modules/swriter/ui/mmsalutationpage.ui", "MMSalutationPage") + , SwGreetingsHandler(pWizard->GetConfigItem(), *m_xBuilder) + , m_xPreview(new AddressPreview(m_xBuilder->weld_scrolled_window("previewwin"))) + , m_xPreviewFI(m_xBuilder->weld_label("previewft")) + , m_xAssignPB(m_xBuilder->weld_button("assign")) + , m_xDocumentIndexFI(m_xBuilder->weld_label("documentindex")) + , m_xPrevSetIB(m_xBuilder->weld_button("prev")) + , m_xNextSetIB(m_xBuilder->weld_button("next")) + , m_xPreviewWIN(new weld::CustomWeld(*m_xBuilder, "preview", *m_xPreview)) { - m_pWizard = _pParent; - - get(m_pGreetingLineCB, "greeting"); - get(m_pPersonalizedCB, "personalized"); - get(m_pFemaleFT, "femaleft"); - get(m_pFemaleLB, "female"); - get(m_pFemalePB, "newfemale"); - get(m_pMaleFT, "maleft"); - get(m_pMaleLB, "male"); - get(m_pMalePB, "newmale"); - get(m_pFemaleFI, "femalefi"); - get(m_pFemaleColumnFT, "femalecolft"); - get(m_pFemaleColumnLB, "femalecol"); - get(m_pFemaleFieldFT, "femalefieldft"); - get(m_pFemaleFieldCB, "femalefield"); - get(m_pNeutralFT, "generalft"); - get(m_pNeutralCB, "general"); - get(m_pPreviewFI, "previewft"); - get(m_pPreviewWIN, "preview"); - Size aSize(LogicToPixel(Size(186, 21), MapMode(MapUnit::MapAppFont))); - m_pPreviewWIN->set_width_request(aSize.Width()); - m_pPreviewWIN->set_height_request(aSize.Height()); - get(m_pAssignPB, "assign"); - get(m_pDocumentIndexFI, "documentindex"); - m_sDocument = m_pDocumentIndexFI->GetText(); - get(m_pPrevSetIB, "prev"); - get(m_pNextSetIB, "next"); + m_pWizard = pWizard; + + Size aSize(m_xPreview->GetDrawingArea()->get_ref_device().LogicToPixel(Size(186, 21), MapMode(MapUnit::MapAppFont))); + m_xPreviewWIN->set_size_request(aSize.Width(), aSize.Height()); + m_sDocument = m_xDocumentIndexFI->get_label(); m_bIsTabPage = true; - m_pGreetingLineCB->SetClickHdl(LINK(this, SwMailMergeGreetingsPage, ContainsHdl_Impl)); - Link<Button*,void> aIndividualLink = LINK(this, SwGreetingsHandler, IndividualHdl_Impl); - m_pPersonalizedCB->SetClickHdl(aIndividualLink); - Link<Button*,void> aGreetingLink = LINK(this, SwGreetingsHandler, GreetingHdl_Impl); - m_pFemalePB->SetClickHdl(aGreetingLink); - m_pMalePB->SetClickHdl(aGreetingLink); - m_pAssignPB->SetClickHdl(LINK(this, SwMailMergeGreetingsPage, AssignHdl_Impl)); - Link<Edit&,void> aLBoxLink = LINK(this, SwMailMergeGreetingsPage, GreetingSelectHdl_Impl); - Link<ListBox&,void> aLBoxLink2 = LINK(this, SwMailMergeGreetingsPage, GreetingSelectListBoxHdl_Impl); - m_pFemaleLB->SetSelectHdl(aLBoxLink2); - m_pMaleLB->SetSelectHdl(aLBoxLink2); - m_pFemaleColumnLB->SetSelectHdl(aLBoxLink2); - m_pFemaleFieldCB->SetSelectHdl(LINK(this, SwMailMergeGreetingsPage, GreetingSelectComboBoxHdl_Impl)); - m_pFemaleFieldCB->SetModifyHdl(aLBoxLink); - m_pNeutralCB->SetSelectHdl(LINK(this, SwMailMergeGreetingsPage, GreetingSelectComboBoxHdl_Impl)); - m_pNeutralCB->SetModifyHdl(aLBoxLink); - - Link<Button*,void> aDataLink = LINK(this, SwMailMergeGreetingsPage, InsertDataHdl_Impl); - m_pPrevSetIB->SetClickHdl(aDataLink); - m_pNextSetIB->SetClickHdl(aDataLink); - - m_pGreetingLineCB->Check(m_rConfigItem.IsGreetingLine(false)); - m_pPersonalizedCB->Check(m_rConfigItem.IsIndividualGreeting(false)); - ContainsHdl_Impl(m_pGreetingLineCB); - aIndividualLink.Call(nullptr); - - lcl_FillGreetingsBox(*m_pFemaleLB, m_rConfigItem, SwMailMergeConfigItem::FEMALE); - lcl_FillGreetingsBox(*m_pMaleLB, m_rConfigItem, SwMailMergeConfigItem::MALE); - lcl_FillGreetingsBox(*m_pNeutralCB, m_rConfigItem, SwMailMergeConfigItem::NEUTRAL); - - m_pDocumentIndexFI->SetText(m_sDocument.replaceFirst("%1", "1")); + m_xGreetingLineCB->connect_toggled(LINK(this, SwMailMergeGreetingsPage, ContainsHdl_Impl)); + Link<weld::ToggleButton&,void> aIndividualLink = LINK(this, SwGreetingsHandler, IndividualHdl_Impl); + m_xPersonalizedCB->connect_toggled(aIndividualLink); + Link<weld::Button&,void> aGreetingLink = LINK(this, SwGreetingsHandler, GreetingHdl_Impl); + m_xFemalePB->connect_clicked(aGreetingLink); + m_xMalePB->connect_clicked(aGreetingLink); + m_xAssignPB->connect_clicked(LINK(this, SwMailMergeGreetingsPage, AssignHdl_Impl)); + Link<weld::ComboBox&,void> aLBoxLink2 = LINK(this, SwMailMergeGreetingsPage, GreetingSelectListBoxHdl_Impl); + m_xFemaleLB->connect_changed(aLBoxLink2); + m_xMaleLB->connect_changed(aLBoxLink2); + m_xFemaleColumnLB->connect_changed(aLBoxLink2); + m_xFemaleFieldCB->connect_changed(LINK(this, SwMailMergeGreetingsPage, GreetingSelectComboBoxHdl_Impl)); + m_xNeutralCB->connect_changed(LINK(this, SwMailMergeGreetingsPage, GreetingSelectComboBoxHdl_Impl)); + + Link<weld::Button&,void> aDataLink = LINK(this, SwMailMergeGreetingsPage, InsertDataHdl_Impl); + m_xPrevSetIB->connect_clicked(aDataLink); + m_xNextSetIB->connect_clicked(aDataLink); + + m_xGreetingLineCB->set_active(m_rConfigItem.IsGreetingLine(false)); + m_xPersonalizedCB->set_active(m_rConfigItem.IsIndividualGreeting(false)); + ContainsHdl_Impl(*m_xGreetingLineCB); + aIndividualLink.Call(*m_xPersonalizedCB); + + lcl_FillGreetingsBox(*m_xFemaleLB, m_rConfigItem, SwMailMergeConfigItem::FEMALE); + lcl_FillGreetingsBox(*m_xMaleLB, m_rConfigItem, SwMailMergeConfigItem::MALE); + lcl_FillGreetingsBox(*m_xNeutralCB, m_rConfigItem, SwMailMergeConfigItem::NEUTRAL); + + m_xDocumentIndexFI->set_label(m_sDocument.replaceFirst("%1", "1")); } SwMailMergeGreetingsPage::~SwMailMergeGreetingsPage() @@ -298,33 +254,29 @@ SwMailMergeGreetingsPage::~SwMailMergeGreetingsPage() void SwMailMergeGreetingsPage::dispose() { - m_pPreviewFI.clear(); - m_pPreviewWIN.clear(); - m_pAssignPB.clear(); - m_pDocumentIndexFI.clear(); - m_pPrevSetIB.clear(); - m_pNextSetIB.clear(); + m_xPreviewWIN.reset(); + m_xPreview.reset(); svt::OWizardPage::dispose(); } void SwMailMergeGreetingsPage::ActivatePage() { //try to find the gender setting - m_pFemaleColumnLB->Clear(); + m_xFemaleColumnLB->clear(); Reference< sdbcx::XColumnsSupplier > xColsSupp = m_rConfigItem.GetColumnsSupplier(); if(xColsSupp.is()) { Reference < container::XNameAccess> xColAccess = xColsSupp->getColumns(); Sequence< OUString > aColumns = xColAccess->getElementNames(); for(sal_Int32 nName = 0; nName < aColumns.getLength(); ++nName) - m_pFemaleColumnLB->InsertEntry(aColumns[nName]); + m_xFemaleColumnLB->append_text(aColumns[nName]); } - m_pFemaleColumnLB->SelectEntry(m_rConfigItem.GetAssignedColumn(MM_PART_GENDER)); - m_pFemaleColumnLB->SaveValue(); + m_xFemaleColumnLB->set_active_text(m_rConfigItem.GetAssignedColumn(MM_PART_GENDER)); + m_xFemaleColumnLB->save_value(); - m_pFemaleFieldCB->SetText(m_rConfigItem.GetFemaleGenderValue()); - m_pFemaleFieldCB->SaveValue(); + m_xFemaleFieldCB->set_entry_text(m_rConfigItem.GetFemaleGenderValue()); + m_xFemaleFieldCB->save_value(); UpdatePreview(); m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(MM_LAYOUTPAGE)); @@ -332,63 +284,54 @@ void SwMailMergeGreetingsPage::ActivatePage() bool SwMailMergeGreetingsPage::commitPage( ::svt::WizardTypes::CommitPageReason ) { - if (m_pFemaleColumnLB->IsValueChangedFromSaved()) + if (m_xFemaleColumnLB->get_value_changed_from_saved()) { const SwDBData& rDBData = m_rConfigItem.GetCurrentDBData(); Sequence< OUString> aAssignment = m_rConfigItem.GetColumnAssignment( rDBData ); if(aAssignment.getLength() <= MM_PART_GENDER) aAssignment.realloc(MM_PART_GENDER + 1); - aAssignment[MM_PART_GENDER] = m_pFemaleColumnLB->GetSelectedEntry(); + aAssignment[MM_PART_GENDER] = m_xFemaleColumnLB->get_active_text(); m_rConfigItem.SetColumnAssignment( rDBData, aAssignment ); } - if (m_pFemaleFieldCB->IsValueChangedFromSaved()) - m_rConfigItem.SetFemaleGenderValue(m_pFemaleFieldCB->GetText()); + if (m_xFemaleFieldCB->get_value_changed_from_saved()) + m_rConfigItem.SetFemaleGenderValue(m_xFemaleFieldCB->get_active_text()); - lcl_StoreGreetingsBox(*m_pFemaleLB, m_rConfigItem, SwMailMergeConfigItem::FEMALE); - lcl_StoreGreetingsBox(*m_pMaleLB, m_rConfigItem, SwMailMergeConfigItem::MALE); + lcl_StoreGreetingsBox(*m_xFemaleLB, m_rConfigItem, SwMailMergeConfigItem::FEMALE); + lcl_StoreGreetingsBox(*m_xMaleLB, m_rConfigItem, SwMailMergeConfigItem::MALE); - sal_Int32 nCurrentTextPos = m_pNeutralCB->GetEntryPos(m_pNeutralCB->GetText()); - if(COMBOBOX_ENTRY_NOTFOUND == nCurrentTextPos) + sal_Int32 nCurrentTextPos = m_xNeutralCB->find_text(m_xNeutralCB->get_active_text()); + if (nCurrentTextPos == -1) { - sal_Int32 nCount = m_pNeutralCB->GetEntryCount(); - m_pNeutralCB->InsertEntry(m_pNeutralCB->GetText(), nCount); - m_pNeutralCB->SelectEntryPos(nCount); + m_xNeutralCB->append_text(m_xNeutralCB->get_active_text()); + m_xNeutralCB->set_active(m_xNeutralCB->get_count() - 1); } - lcl_StoreGreetingsBox(*m_pNeutralCB, m_rConfigItem, SwMailMergeConfigItem::NEUTRAL); - m_rConfigItem.SetGreetingLine(m_pGreetingLineCB->IsChecked(), false); - m_rConfigItem.SetIndividualGreeting(m_pPersonalizedCB->IsChecked(), false); + lcl_StoreGreetingsBox(*m_xNeutralCB, m_rConfigItem, SwMailMergeConfigItem::NEUTRAL); + m_rConfigItem.SetGreetingLine(m_xGreetingLineCB->get_active(), false); + m_rConfigItem.SetIndividualGreeting(m_xPersonalizedCB->get_active(), false); return true; } -IMPL_LINK(SwMailMergeGreetingsPage, ContainsHdl_Impl, Button*, pBox, void) +IMPL_LINK(SwMailMergeGreetingsPage, ContainsHdl_Impl, weld::ToggleButton&, rBox, void) { - bool bContainsGreeting = static_cast<CheckBox*>(pBox)->IsChecked(); + bool bContainsGreeting = rBox.get_active(); SwGreetingsHandler::Contains(bContainsGreeting); - m_pPreviewFI-> Enable(bContainsGreeting); - m_pPreviewWIN->Enable(bContainsGreeting); - m_pAssignPB-> Enable(bContainsGreeting); - m_pDocumentIndexFI-> Enable(bContainsGreeting); - m_pPrevSetIB->Enable(bContainsGreeting); - m_pNextSetIB->Enable(bContainsGreeting); - m_rConfigItem.SetGreetingLine(m_pGreetingLineCB->IsChecked(), false); + m_xPreviewFI->set_sensitive(bContainsGreeting); + m_xPreviewWIN->set_sensitive(bContainsGreeting); + m_xAssignPB->set_sensitive(bContainsGreeting); + m_xDocumentIndexFI->set_sensitive(bContainsGreeting); + m_xPrevSetIB->set_sensitive(bContainsGreeting); + m_xNextSetIB->set_sensitive(bContainsGreeting); + m_rConfigItem.SetGreetingLine(m_xGreetingLineCB->get_active(), false); m_pWizard->UpdateRoadmap(); m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(MM_LAYOUTPAGE)); } -IMPL_LINK(SwMailMergeGreetingsPage, InsertDataHdl_Impl, Button*, pButton, void) +IMPL_LINK(SwMailMergeGreetingsPage, InsertDataHdl_Impl, weld::Button&, rButton, void) { - //if no pButton is given, the first set has to be pre-set - if(!pButton) - { - m_rConfigItem.GetResultSet(); - } - else - { - bool bNext = pButton == m_pNextSetIB; - sal_Int32 nPos = m_rConfigItem.GetResultSetPosition(); - m_rConfigItem.MoveResultSet( bNext ? ++nPos : --nPos); - } + bool bNext = &rButton == m_xNextSetIB.get(); sal_Int32 nPos = m_rConfigItem.GetResultSetPosition(); + m_rConfigItem.MoveResultSet( bNext ? ++nPos : --nPos); + nPos = m_rConfigItem.GetResultSetPosition(); bool bEnable = true; if(nPos < 1) { @@ -397,119 +340,91 @@ IMPL_LINK(SwMailMergeGreetingsPage, InsertDataHdl_Impl, Button*, pButton, void) } else UpdatePreview(); - m_pPrevSetIB->Enable(bEnable); - m_pNextSetIB->Enable(bEnable); - m_pDocumentIndexFI->Enable(bEnable); - m_pDocumentIndexFI->SetText(m_sDocument.replaceFirst("%1", OUString::number(nPos))); + m_xPrevSetIB->set_sensitive(bEnable); + m_xNextSetIB->set_sensitive(bEnable); + m_xDocumentIndexFI->set_sensitive(bEnable); + m_xDocumentIndexFI->set_label(m_sDocument.replaceFirst("%1", OUString::number(nPos))); } -SwMailBodyDialog::SwMailBodyDialog(vcl::Window* pParent) : - SfxModalDialog(pParent, "MailBodyDialog", "modules/swriter/ui/mmmailbody.ui"), - SwGreetingsHandler(*GetActiveView()->GetMailMergeConfigItem()) +SwMailBodyDialog::SwMailBodyDialog(weld::Window* pParent) + : SfxDialogController(pParent, "modules/swriter/ui/mmmailbody.ui", "MailBodyDialog") + , SwGreetingsHandler(*GetActiveView()->GetMailMergeConfigItem(), *m_xBuilder) + , m_xBodyFT(m_xBuilder->weld_label("bodyft")) + , m_xBodyMLE(m_xBuilder->weld_text_view("bodymle")) + , m_xOK(m_xBuilder->weld_button("ok")) { - get(m_pGreetingLineCB, "greeting"); - get(m_pPersonalizedCB, "personalized"); - get(m_pFemaleFT, "femaleft"); - get(m_pFemaleLB, "female"); - get(m_pFemalePB, "newfemale"); - get(m_pMaleFT, "maleft"); - get(m_pMaleLB, "male"); - get(m_pMalePB, "newmale"); - get(m_pFemaleFI, "femalefi"); - get(m_pFemaleColumnFT, "femalecolft"); - get(m_pFemaleColumnLB, "femalecol"); - get(m_pFemaleFieldFT, "femalefieldft"); - get(m_pFemaleFieldCB, "femalefield"); - get(m_pNeutralFT, "generalft"); - get(m_pNeutralCB, "general"); - get(m_pBodyFT, "bodyft"); - get(m_pBodyMLE, "bodymle"); - m_pBodyMLE->SetStyle(m_pBodyMLE->GetStyle() | WB_HSCROLL | WB_VSCROLL | WB_IGNORETAB); - Size aSize(LogicToPixel(Size(180, 50), MapMode(MapUnit::MapAppFont))); - m_pBodyMLE->set_width_request(aSize.Width()); - m_pBodyMLE->set_height_request(aSize.Height()); - get(m_pOK, "ok"); m_bIsTabPage = false; - - m_pGreetingLineCB->SetClickHdl(LINK(this, SwMailBodyDialog, ContainsHdl_Impl)); - Link<Button*,void> aIndividualLink = LINK(this, SwGreetingsHandler, IndividualHdl_Impl); - m_pPersonalizedCB->SetClickHdl(aIndividualLink); - Link<Button*,void> aGreetingLink = LINK(this, SwGreetingsHandler, GreetingHdl_Impl); - m_pFemalePB->SetClickHdl(aGreetingLink); - m_pMalePB->SetClickHdl(aGreetingLink); - m_pOK->SetClickHdl(LINK(this, SwMailBodyDialog, OKHdl)); - - m_pGreetingLineCB->Check(m_rConfigItem.IsGreetingLine(true)); - m_pPersonalizedCB->Check(m_rConfigItem.IsIndividualGreeting(true)); - ContainsHdl_Impl(m_pGreetingLineCB); - aIndividualLink.Call(nullptr); - - lcl_FillGreetingsBox(*m_pFemaleLB, m_rConfigItem, SwMailMergeConfigItem::FEMALE); - lcl_FillGreetingsBox(*m_pMaleLB, m_rConfigItem, SwMailMergeConfigItem::MALE); - lcl_FillGreetingsBox(*m_pNeutralCB, m_rConfigItem, SwMailMergeConfigItem::NEUTRAL); + m_xBodyMLE->set_size_request(m_xBodyMLE->get_approximate_digit_width() * 45, + m_xBodyMLE->get_height_rows(6)); + m_xGreetingLineCB->connect_toggled(LINK(this, SwMailBodyDialog, ContainsHdl_Impl)); + Link<weld::ToggleButton&,void> aIndividualLink = LINK(this, SwGreetingsHandler, IndividualHdl_Impl); + m_xPersonalizedCB->connect_toggled(aIndividualLink); + Link<weld::Button&,void> aGreetingLink = LINK(this, SwGreetingsHandler, GreetingHdl_Impl); + m_xFemalePB->connect_clicked(aGreetingLink); + m_xMalePB->connect_clicked(aGreetingLink); + m_xOK->connect_clicked(LINK(this, SwMailBodyDialog, OKHdl)); + + m_xGreetingLineCB->set_active(m_rConfigItem.IsGreetingLine(true)); + m_xPersonalizedCB->set_active(m_rConfigItem.IsIndividualGreeting(true)); + ContainsHdl_Impl(*m_xGreetingLineCB); + aIndividualLink.Call(*m_xPersonalizedCB); + + lcl_FillGreetingsBox(*m_xFemaleLB, m_rConfigItem, SwMailMergeConfigItem::FEMALE); + lcl_FillGreetingsBox(*m_xMaleLB, m_rConfigItem, SwMailMergeConfigItem::MALE); + lcl_FillGreetingsBox(*m_xNeutralCB, m_rConfigItem, SwMailMergeConfigItem::NEUTRAL); //try to find the gender setting - m_pFemaleColumnLB->Clear(); + m_xFemaleColumnLB->clear(); Reference< sdbcx::XColumnsSupplier > xColsSupp = m_rConfigItem.GetColumnsSupplier(); if(xColsSupp.is()) { Reference < container::XNameAccess> xColAccess = xColsSupp->getColumns(); Sequence< OUString > aColumns = xColAccess->getElementNames(); for(sal_Int32 nName = 0; nName < aColumns.getLength(); ++nName) - m_pFemaleColumnLB->InsertEntry(aColumns[nName]); + m_xFemaleColumnLB->append_text(aColumns[nName]); } - m_pFemaleColumnLB->SelectEntry(m_rConfigItem.GetAssignedColumn(MM_PART_GENDER)); - m_pFemaleColumnLB->SaveValue(); + m_xFemaleColumnLB->set_active_text(m_rConfigItem.GetAssignedColumn(MM_PART_GENDER)); + m_xFemaleColumnLB->save_value(); - m_pFemaleFieldCB->SetText(m_rConfigItem.GetFemaleGenderValue()); - m_pFemaleFieldCB->SaveValue(); + m_xFemaleFieldCB->set_entry_text(m_rConfigItem.GetFemaleGenderValue()); + m_xFemaleFieldCB->save_value(); } SwMailBodyDialog::~SwMailBodyDialog() { - disposeOnce(); -} - -void SwMailBodyDialog::dispose() -{ - m_pBodyFT.clear(); - m_pBodyMLE.clear(); - m_pOK.clear(); - SfxModalDialog::dispose(); } -IMPL_LINK(SwMailBodyDialog, ContainsHdl_Impl, Button*, pButton, void) +IMPL_LINK(SwMailBodyDialog, ContainsHdl_Impl, weld::ToggleButton&, rBox, void) { - CheckBox* pBox = static_cast<CheckBox*>(pButton); - SwGreetingsHandler::Contains(pBox->IsChecked()); - m_rConfigItem.SetGreetingLine(pBox->IsChecked(), true); + SwGreetingsHandler::Contains(rBox.get_active()); + m_rConfigItem.SetGreetingLine(rBox.get_active(), true); } -IMPL_LINK_NOARG(SwMailBodyDialog, OKHdl, Button*, void) +IMPL_LINK_NOARG(SwMailBodyDialog, OKHdl, weld::Button&, void) { m_rConfigItem.SetGreetingLine( - m_pGreetingLineCB->IsChecked(), false); + m_xGreetingLineCB->get_active(), false); m_rConfigItem.SetIndividualGreeting( - m_pPersonalizedCB->IsChecked(), false); + m_xPersonalizedCB->get_active(), false); - if(m_pFemaleColumnLB->IsValueChangedFromSaved()) + if (m_xFemaleColumnLB->get_value_changed_from_saved()) { const SwDBData& rDBData = m_rConfigItem.GetCurrentDBData(); Sequence< OUString> aAssignment = m_rConfigItem.GetColumnAssignment( rDBData ); - sal_Int32 nPos = m_pFemaleColumnLB->GetSelectedEntryPos(); + sal_Int32 nPos = m_xFemaleColumnLB->get_active(); if(aAssignment.getLength() < MM_PART_GENDER) aAssignment.realloc(MM_PART_GENDER); if( nPos > 0 ) - aAssignment[MM_PART_GENDER] = m_pFemaleColumnLB->GetSelectedEntry(); + aAssignment[MM_PART_GENDER] = m_xFemaleColumnLB->get_active_text(); else aAssignment[MM_PART_GENDER].clear(); m_rConfigItem.SetColumnAssignment( rDBData, aAssignment ); } - if(m_pFemaleFieldCB->IsValueChangedFromSaved()) - m_rConfigItem.SetFemaleGenderValue(m_pFemaleFieldCB->GetText()); + if (m_xFemaleFieldCB->get_value_changed_from_saved()) + m_rConfigItem.SetFemaleGenderValue(m_xFemaleFieldCB->get_active_text()); - EndDialog(RET_OK); + m_xDialog->response(RET_OK); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/mmgreetingspage.hxx b/sw/source/ui/dbui/mmgreetingspage.hxx index bfbf365d4bb9..f45cfdcdf20b 100644 --- a/sw/source/ui/dbui/mmgreetingspage.hxx +++ b/sw/source/ui/dbui/mmgreetingspage.hxx @@ -32,93 +32,99 @@ class SwMailMergeWizard; class SwGreetingsHandler { protected: - VclPtr<CheckBox> m_pGreetingLineCB; - - VclPtr<CheckBox> m_pPersonalizedCB; - - VclPtr<FixedText> m_pFemaleFT; - VclPtr<ListBox> m_pFemaleLB; - VclPtr<PushButton> m_pFemalePB; - - VclPtr<FixedText> m_pMaleFT; - VclPtr<ListBox> m_pMaleLB; - VclPtr<PushButton> m_pMalePB; - - VclPtr<FixedText> m_pFemaleFI; - VclPtr<FixedText> m_pFemaleColumnFT; - VclPtr<ListBox> m_pFemaleColumnLB; - VclPtr<FixedText> m_pFemaleFieldFT; - VclPtr<ComboBox> m_pFemaleFieldCB; - - VclPtr<FixedText> m_pNeutralFT; - VclPtr<ComboBox> m_pNeutralCB; - - bool m_bIsTabPage; - VclPtr<SwMailMergeWizard> m_pWizard; /// The mail merge state, available even when m_pWizard is nullptr. SwMailMergeConfigItem& m_rConfigItem; - - SwGreetingsHandler(SwMailMergeConfigItem& rConfigItem) - : m_bIsTabPage(false), - m_rConfigItem(rConfigItem) + bool m_bIsTabPage; + + std::unique_ptr<weld::CheckButton> m_xGreetingLineCB; + std::unique_ptr<weld::CheckButton> m_xPersonalizedCB; + std::unique_ptr<weld::Label> m_xFemaleFT; + std::unique_ptr<weld::ComboBox> m_xFemaleLB; + std::unique_ptr<weld::Button> m_xFemalePB; + std::unique_ptr<weld::Label> m_xMaleFT; + std::unique_ptr<weld::ComboBox> m_xMaleLB; + std::unique_ptr<weld::Button> m_xMalePB; + std::unique_ptr<weld::Label> m_xFemaleFI; + std::unique_ptr<weld::Label> m_xFemaleColumnFT; + std::unique_ptr<weld::ComboBox> m_xFemaleColumnLB; + std::unique_ptr<weld::Label> m_xFemaleFieldFT; + std::unique_ptr<weld::ComboBox> m_xFemaleFieldCB; + std::unique_ptr<weld::Label> m_xNeutralFT; + std::unique_ptr<weld::ComboBox> m_xNeutralCB; + + SwGreetingsHandler(SwMailMergeConfigItem& rConfigItem, weld::Builder& rBuilder) + : m_rConfigItem(rConfigItem) + , m_bIsTabPage(false) + , m_xGreetingLineCB(rBuilder.weld_check_button("greeting")) + , m_xPersonalizedCB(rBuilder.weld_check_button("personalized")) + , m_xFemaleFT(rBuilder.weld_label("femaleft")) + , m_xFemaleLB(rBuilder.weld_combo_box("female")) + , m_xFemalePB(rBuilder.weld_button("newfemale")) + , m_xMaleFT(rBuilder.weld_label("maleft")) + , m_xMaleLB(rBuilder.weld_combo_box("male")) + , m_xMalePB(rBuilder.weld_button("newmale")) + , m_xFemaleFI(rBuilder.weld_label("femalefi")) + , m_xFemaleColumnFT(rBuilder.weld_label("femalecolft")) + , m_xFemaleColumnLB(rBuilder.weld_combo_box("femalecol")) + , m_xFemaleFieldFT(rBuilder.weld_label("femalefieldft")) + , m_xFemaleFieldCB(rBuilder.weld_combo_box("femalefield")) + , m_xNeutralFT(rBuilder.weld_label("generalft")) + , m_xNeutralCB(rBuilder.weld_combo_box("general")) { } ~SwGreetingsHandler() {} - DECL_LINK(IndividualHdl_Impl, Button*, void); - DECL_LINK(GreetingHdl_Impl, Button*, void); + DECL_LINK(IndividualHdl_Impl, weld::ToggleButton&, void); + DECL_LINK(GreetingHdl_Impl, weld::Button&, void); void Contains(bool bContainsGreeting); virtual void UpdatePreview(); }; -class SwMailMergeGreetingsPage : public svt::OWizardPage, - public SwGreetingsHandler +class SwMailMergeGreetingsPage : public svt::OWizardPage + , public SwGreetingsHandler { - VclPtr<FixedText> m_pPreviewFI; - VclPtr<SwAddressPreview> m_pPreviewWIN; - VclPtr<PushButton> m_pAssignPB; - VclPtr<FixedText> m_pDocumentIndexFI; - VclPtr<PushButton> m_pPrevSetIB; - VclPtr<PushButton> m_pNextSetIB; + std::unique_ptr<AddressPreview> m_xPreview; + std::unique_ptr<weld::Label> m_xPreviewFI; + std::unique_ptr<weld::Button> m_xAssignPB; + std::unique_ptr<weld::Label> m_xDocumentIndexFI; + std::unique_ptr<weld::Button> m_xPrevSetIB; + std::unique_ptr<weld::Button> m_xNextSetIB; + std::unique_ptr<weld::CustomWeld> m_xPreviewWIN; OUString m_sDocument; - DECL_LINK(ContainsHdl_Impl, Button*, void); - DECL_LINK(InsertDataHdl_Impl, Button*, void); - DECL_LINK(GreetingSelectHdl_Impl, Edit&, void); - DECL_LINK(GreetingSelectComboBoxHdl_Impl, ComboBox&, void); - DECL_LINK(GreetingSelectListBoxHdl_Impl, ListBox&, void); - DECL_LINK(AssignHdl_Impl, Button*, void); + DECL_LINK(ContainsHdl_Impl, weld::ToggleButton&, void); + DECL_LINK(InsertDataHdl_Impl, weld::Button&, void); + DECL_LINK(GreetingSelectComboBoxHdl_Impl, weld::ComboBox&, void); + DECL_LINK(GreetingSelectListBoxHdl_Impl, weld::ComboBox&, void); + DECL_LINK(AssignHdl_Impl, weld::Button&, void); virtual void UpdatePreview() override; virtual void ActivatePage() override; virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) override; public: - SwMailMergeGreetingsPage( SwMailMergeWizard* _pParent); - virtual ~SwMailMergeGreetingsPage() override; + SwMailMergeGreetingsPage(SwMailMergeWizard* pWizard, TabPageParent pParent); + virtual ~SwMailMergeGreetingsPage() override; virtual void dispose() override; - }; -class SwMailBodyDialog : public SfxModalDialog, public SwGreetingsHandler +class SwMailBodyDialog : public SfxDialogController, public SwGreetingsHandler { - VclPtr<FixedText> m_pBodyFT; - VclPtr<VclMultiLineEdit> m_pBodyMLE; + std::unique_ptr<weld::Label> m_xBodyFT; + std::unique_ptr<weld::TextView> m_xBodyMLE; + std::unique_ptr<weld::Button> m_xOK; - VclPtr<OKButton> m_pOK; - - DECL_LINK(ContainsHdl_Impl, Button*, void); - DECL_LINK(OKHdl, Button*, void); + DECL_LINK(ContainsHdl_Impl, weld::ToggleButton&, void); + DECL_LINK(OKHdl, weld::Button&, void); public: - SwMailBodyDialog(vcl::Window* pParent); + SwMailBodyDialog(weld::Window* pParent); virtual ~SwMailBodyDialog() override; - virtual void dispose() override; - void SetBody(const OUString& rBody ) {m_pBodyMLE->SetText(rBody);} - OUString GetBody() const {return m_pBodyMLE->GetText();} + void SetBody(const OUString& rBody ) { m_xBodyMLE->set_text(rBody); } + OUString GetBody() const { return m_xBodyMLE->get_text(); } }; #endif diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 9de7406d7b09..d4dc1b1932ac 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -849,13 +849,13 @@ IMPL_LINK(SwMMResultEmailDialog, SendTypeHdl_Impl, ListBox&, rBox, void) } } -IMPL_LINK(SwMMResultEmailDialog, SendAsHdl_Impl, Button*, pButton, void) +IMPL_LINK_NOARG(SwMMResultEmailDialog, SendAsHdl_Impl, Button*, void) { - VclPtr<SwMailBodyDialog> pDlg = VclPtr<SwMailBodyDialog>::Create(pButton); - pDlg->SetBody(m_sBody); - if(RET_OK == pDlg->Execute()) + SwMailBodyDialog aDlg(GetFrameWeld()); + aDlg.SetBody(m_sBody); + if (RET_OK == aDlg.run()) { - m_sBody = pDlg->GetBody(); + m_sBody = aDlg.GetBody(); } } diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index c5ccb9a3c16d..26f9489dd346 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -544,6 +544,337 @@ OUString SwAddressPreview::FillData( return sAddress.makeStringAndClear(); } +AddressPreview::AddressPreview(std::unique_ptr<weld::ScrolledWindow> xWindow) + : m_xVScrollBar(std::move(xWindow)) + , pImpl(new SwAddressPreview_Impl()) +{ + m_xVScrollBar->set_user_managed_scrolling(); + m_xVScrollBar->connect_vadjustment_changed(LINK(this, AddressPreview, ScrollHdl)); +} + +AddressPreview::~AddressPreview() +{ +} + +IMPL_LINK_NOARG(AddressPreview, ScrollHdl, weld::ScrolledWindow&, void) +{ + Invalidate(); +} + +void AddressPreview::AddAddress(const OUString& rAddress) +{ + pImpl->aAddresses.push_back(rAddress); + UpdateScrollBar(); +} + +void AddressPreview::SetAddress(const OUString& rAddress) +{ + pImpl->aAddresses.clear(); + pImpl->aAddresses.push_back(rAddress); + m_xVScrollBar->set_vpolicy(VclPolicyType::NEVER); + Invalidate(); +} + +sal_uInt16 AddressPreview::GetSelectedAddress()const +{ + OSL_ENSURE(pImpl->nSelectedAddress < pImpl->aAddresses.size(), "selection invalid"); + return pImpl->nSelectedAddress; +} + +void AddressPreview::SelectAddress(sal_uInt16 nSelect) +{ + OSL_ENSURE(pImpl->nSelectedAddress < pImpl->aAddresses.size(), "selection invalid"); + pImpl->nSelectedAddress = nSelect; + // now make it visible.. + sal_uInt16 nSelectRow = nSelect / pImpl->nColumns; + sal_uInt16 nStartRow = m_xVScrollBar->vadjustment_get_value(); + if( (nSelectRow < nStartRow) || (nSelectRow >= (nStartRow + pImpl->nRows) )) + m_xVScrollBar->vadjustment_set_value(nSelectRow); +} + +void AddressPreview::Clear() +{ + pImpl->aAddresses.clear(); + pImpl->nSelectedAddress = 0; + UpdateScrollBar(); +} + +void AddressPreview::ReplaceSelectedAddress(const OUString& rNew) +{ + pImpl->aAddresses[pImpl->nSelectedAddress] = rNew; + Invalidate(); +} + +void AddressPreview::RemoveSelectedAddress() +{ + pImpl->aAddresses.erase(pImpl->aAddresses.begin() + pImpl->nSelectedAddress); + if(pImpl->nSelectedAddress) + --pImpl->nSelectedAddress; + UpdateScrollBar(); + Invalidate(); +} + +void AddressPreview::SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns) +{ + pImpl->nRows = nRows; + pImpl->nColumns = nColumns; + UpdateScrollBar(); +} + +void AddressPreview::EnableScrollBar() +{ + pImpl->bEnableScrollBar = true; +} + +void AddressPreview::UpdateScrollBar() +{ + if (pImpl->nColumns) + { + sal_uInt16 nResultingRows = static_cast<sal_uInt16>(pImpl->aAddresses.size() + pImpl->nColumns - 1) / pImpl->nColumns; + ++nResultingRows; + auto nValue = m_xVScrollBar->vadjustment_get_value(); + if (nValue > nResultingRows) + nValue = nResultingRows; + m_xVScrollBar->set_vpolicy(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows ? VclPolicyType::ALWAYS : VclPolicyType::NEVER); + m_xVScrollBar->vadjustment_configure(nValue, 0, nResultingRows, 1, 10, pImpl->nRows); + } +} + +void AddressPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) +{ + const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings(); + rRenderContext.SetFillColor(rSettings.GetWindowColor()); + rRenderContext.SetLineColor(COL_TRANSPARENT); + rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), GetOutputSizePixel())); + Color aPaintColor(IsEnabled() ? rSettings.GetWindowTextColor() : rSettings.GetDisableColor()); + rRenderContext.SetLineColor(aPaintColor); + vcl::Font aFont(rRenderContext.GetFont()); + aFont.SetColor(aPaintColor); + rRenderContext.SetFont(aFont); + + Size aSize(GetOutputSizePixel()); + sal_uInt16 nStartRow = 0; + if (m_xVScrollBar->get_vpolicy() != VclPolicyType::NEVER) + { + aSize.AdjustWidth(-m_xVScrollBar->get_vscroll_width()); + nStartRow = m_xVScrollBar->vadjustment_get_value(); + } + Size aPartSize(aSize.Width() / pImpl->nColumns, + aSize.Height() / pImpl->nRows); + aPartSize.AdjustWidth( -2 ); + aPartSize.AdjustHeight( -2 ); + + sal_uInt16 nAddress = nStartRow * pImpl->nColumns; + const sal_uInt16 nNumAddresses = static_cast<sal_uInt16>(pImpl->aAddresses.size()); + for (sal_uInt16 nRow = 0; nRow < pImpl->nRows ; ++nRow) + { + for (sal_uInt16 nCol = 0; nCol < pImpl->nColumns; ++nCol) + { + if (nAddress >= nNumAddresses) + break; + Point aPos(nCol * aPartSize.Width(), + nRow * aPartSize.Height()); + aPos.Move(1, 1); + bool bIsSelected = nAddress == pImpl->nSelectedAddress; + if ((pImpl->nColumns * pImpl->nRows) == 1) + bIsSelected = false; + OUString adr(pImpl->aAddresses[nAddress]); + DrawText_Impl(rRenderContext, adr, aPos, aPartSize, bIsSelected); + ++nAddress; + } + } + rRenderContext.SetClipRegion(); +} + +void AddressPreview::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if (rMEvt.IsLeft() && pImpl->nRows && pImpl->nColumns) + { + //determine the selected address + const Point& rMousePos = rMEvt.GetPosPixel(); + Size aSize(GetOutputSizePixel()); + Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows ); + sal_uInt32 nRow = rMousePos.Y() / aPartSize.Height() ; + if (m_xVScrollBar->get_vpolicy() != VclPolicyType::NEVER) + { + nRow += m_xVScrollBar->vadjustment_get_value(); + } + sal_uInt32 nCol = rMousePos.X() / aPartSize.Width(); + sal_uInt32 nSelect = nRow * pImpl->nColumns + nCol; + + if( nSelect < pImpl->aAddresses.size() && + pImpl->nSelectedAddress != static_cast<sal_uInt16>(nSelect)) + { + pImpl->nSelectedAddress = static_cast<sal_uInt16>(nSelect); + m_aSelectHdl.Call(nullptr); + } + Invalidate(); + } +} + +bool AddressPreview::KeyInput( const KeyEvent& rKEvt ) +{ + sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode(); + bool bHandled = false; + if (pImpl->nRows && pImpl->nColumns) + { + sal_uInt32 nSelectedRow = pImpl->nSelectedAddress / pImpl->nColumns; + sal_uInt32 nSelectedColumn = pImpl->nSelectedAddress - (nSelectedRow * pImpl->nColumns); + switch(nKey) + { + case KEY_UP: + if(nSelectedRow) + --nSelectedRow; + bHandled = true; + break; + case KEY_DOWN: + if(pImpl->aAddresses.size() > sal_uInt32(pImpl->nSelectedAddress + pImpl->nColumns)) + ++nSelectedRow; + bHandled = true; + break; + case KEY_LEFT: + if(nSelectedColumn) + --nSelectedColumn; + bHandled = true; + break; + case KEY_RIGHT: + if(nSelectedColumn < sal_uInt32(pImpl->nColumns - 1) && + pImpl->aAddresses.size() - 1 > pImpl->nSelectedAddress ) + ++nSelectedColumn; + bHandled = true; + break; + } + sal_uInt32 nSelect = nSelectedRow * pImpl->nColumns + nSelectedColumn; + if( nSelect < pImpl->aAddresses.size() && + pImpl->nSelectedAddress != static_cast<sal_uInt16>(nSelect)) + { + pImpl->nSelectedAddress = static_cast<sal_uInt16>(nSelect); + m_aSelectHdl.Call(nullptr); + Invalidate(); + } + } + return bHandled; +} + +void AddressPreview::DrawText_Impl(vcl::RenderContext& rRenderContext, const OUString& rAddress, + const Point& rTopLeft, const Size& rSize, bool bIsSelected) +{ + rRenderContext.SetClipRegion(vcl::Region(tools::Rectangle(rTopLeft, rSize))); + if (bIsSelected) + { + //selection rectangle + rRenderContext.SetFillColor(COL_TRANSPARENT); + rRenderContext.DrawRect(tools::Rectangle(rTopLeft, rSize)); + } + sal_Int32 nHeight = GetTextHeight(); + Point aStart = rTopLeft; + //put it away from the border + aStart.Move(2, 2); + sal_Int32 nPos = 0; + do + { + rRenderContext.DrawText(aStart, rAddress.getToken(0, '\n', nPos)); + aStart.AdjustY(nHeight ); + } + while (nPos >= 0); +} + +OUString AddressPreview::FillData( + const OUString& rAddress, + SwMailMergeConfigItem const & rConfigItem, + const Sequence< OUString>* pAssignments) +{ + //find the column names in the address string (with name assignment!) and + //exchange the placeholder (like <Firstname>) with the database content + //unassigned columns are expanded to <not assigned> + Reference< XColumnsSupplier > xColsSupp( rConfigItem.GetResultSet(), UNO_QUERY); + Reference <XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : nullptr; + Sequence< OUString> aAssignment = pAssignments ? + *pAssignments : + rConfigItem.GetColumnAssignment( + rConfigItem.GetCurrentDBData() ); + const OUString* pAssignment = aAssignment.getConstArray(); + const std::vector<std::pair<OUString, int>>& rDefHeaders = rConfigItem.GetDefaultAddressHeaders(); + OUString sNotAssigned = "<" + SwResId(STR_NOTASSIGNED) + ">"; + + bool bIncludeCountry = rConfigItem.IsIncludeCountry(); + const OUString rExcludeCountry = rConfigItem.GetExcludeCountry(); + bool bSpecialReplacementForCountry = (!bIncludeCountry || !rExcludeCountry.isEmpty()); + OUString sCountryColumn; + if( bSpecialReplacementForCountry ) + { + sCountryColumn = rDefHeaders[MM_PART_COUNTRY].first; + Sequence< OUString> aSpecialAssignment = + rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() ); + if(aSpecialAssignment.getLength() > MM_PART_COUNTRY && aSpecialAssignment[MM_PART_COUNTRY].getLength()) + sCountryColumn = aSpecialAssignment[MM_PART_COUNTRY]; + } + + SwAddressIterator aIter(rAddress); + OUStringBuffer sAddress; + while(aIter.HasMore()) + { + SwMergeAddressItem aItem = aIter.Next(); + if(aItem.bIsColumn) + { + //get the default column name + + //find the appropriate assignment + OUString sConvertedColumn = aItem.sText; + for(sal_uInt32 nColumn = 0; + nColumn < rDefHeaders.size() && nColumn < sal_uInt32(aAssignment.getLength()); + ++nColumn) + { + if (rDefHeaders[nColumn].first == aItem.sText && + !pAssignment[nColumn].isEmpty()) + { + sConvertedColumn = pAssignment[nColumn]; + break; + } + } + if(!sConvertedColumn.isEmpty() && + xColAccess.is() && + xColAccess->hasByName(sConvertedColumn)) + { + //get the content and exchange it in the address string + Any aCol = xColAccess->getByName(sConvertedColumn); + Reference< XColumn > xColumn; + aCol >>= xColumn; + if(xColumn.is()) + { + try + { + OUString sReplace = xColumn->getString(); + + if( bSpecialReplacementForCountry && sCountryColumn == sConvertedColumn ) + { + if( !rExcludeCountry.isEmpty() && sReplace != rExcludeCountry ) + aItem.sText = sReplace; + else + aItem.sText.clear(); + } + else + { + aItem.sText = sReplace; + } + } + catch (const sdbc::SQLException&) + { + OSL_FAIL("SQLException caught"); + } + } + } + else + { + aItem.sText = sNotAssigned; + } + + } + sAddress.append(aItem.sText); + } + return sAddress.makeStringAndClear(); +} + SwMergeAddressItem SwAddressIterator::Next() { //currently the string may either start with a '<' then it's a column diff --git a/sw/source/uibase/inc/mailmergehelper.hxx b/sw/source/uibase/inc/mailmergehelper.hxx index 13929d48e445..3d3a0d199be6 100644 --- a/sw/source/uibase/inc/mailmergehelper.hxx +++ b/sw/source/uibase/inc/mailmergehelper.hxx @@ -30,6 +30,8 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/compbase.hxx> #include <vcl/scrbar.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> #include <rtl/ustring.hxx> #include <swdllapi.h> @@ -111,6 +113,57 @@ public: void SetSelectHdl (const Link<LinkParamNone*,void>& rLink) { m_aSelectHdl = rLink; } }; +class SW_DLLPUBLIC AddressPreview : public weld::CustomWidgetController +{ + std::unique_ptr<weld::ScrolledWindow> m_xVScrollBar; + SwAddressPreview_Impl* pImpl; + Link<LinkParamNone*,void> m_aSelectHdl; + + void DrawText_Impl(vcl::RenderContext& rRenderContext, const OUString& rAddress, + const Point& rTopLeft, const Size& rSize, bool bIsSelected); + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual bool KeyInput( const KeyEvent& rKEvt ) override; + void UpdateScrollBar(); + + DECL_LINK(ScrollHdl, weld::ScrolledWindow&,void); + +public: + AddressPreview(std::unique_ptr<weld::ScrolledWindow> xParent); + virtual ~AddressPreview() override; + + /** 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 + rows/columns should be used a scrollbar will be added. + + AddAddress appends the new address to the already added ones. + Initially the first added address will be selected + */ + void AddAddress(const OUString& rAddress); + // for preview mode - replaces the currently used address by the given one + void SetAddress(const OUString& rAddress); + // removes all addresses + void Clear(); + + // returns the selected address + sal_uInt16 GetSelectedAddress() const; + void SelectAddress(sal_uInt16 nSelect); + void ReplaceSelectedAddress(const OUString&); + void RemoveSelectedAddress(); + + // set the number of rows and columns of addresses + void SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns); + void EnableScrollBar(); + + // fill the actual data into a string (address block or greeting) + static OUString FillData(const OUString& rAddress, SwMailMergeConfigItem const & rConfigItem, + const css::uno::Sequence<OUString>* pAssignments = nullptr); + + void SetSelectHdl (const Link<LinkParamNone*,void>& rLink) { m_aSelectHdl = rLink; } +}; + + // iterate over an address block or a greeting line the iterator returns the // parts either as pure string or as column struct SwMergeAddressItem diff --git a/sw/uiconfig/swriter/ui/mmmailbody.ui b/sw/uiconfig/swriter/ui/mmmailbody.ui index f54e2242d2a1..eb715fc1150f 100644 --- a/sw/uiconfig/swriter/ui/mmmailbody.ui +++ b/sw/uiconfig/swriter/ui/mmmailbody.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="MailBodyDialog"> @@ -7,6 +7,9 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="mmmailbody|MailBodyDialog">E-Mail Message</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -87,38 +90,44 @@ <object class="GtkLabel" id="bodyft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmmailbody|bodyft">Write your message here</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">bodymle:border</property> + <property name="mnemonic_widget">bodymle</property> + <property name="xalign">0</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="GtkTextView" id="bodymle:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="hscrollbar_policy">always</property> + <property name="vscrollbar_policy">always</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTextView" id="bodymle"> + <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> + </child> </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> </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> @@ -130,7 +139,6 @@ <child> <object class="GtkCheckButton" id="greeting"> <property name="label" translatable="yes" context="mmmailbody|greeting">This e-mail should contain a salutation</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -141,8 +149,6 @@ <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> @@ -161,16 +167,14 @@ <object class="GtkLabel" id="generalft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmmailbody|generalft">General salutation</property> <property name="use_underline">True</property> <property name="mnemonic_widget">general</property> + <property name="xalign">0</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> @@ -188,8 +192,6 @@ <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> @@ -216,82 +218,72 @@ <object class="GtkLabel" id="femalefi"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmmailbody|femalefi">Address list field indicating a female recipient</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> <property name="width">3</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="femaleft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmmailbody|femaleft">_Female</property> <property name="use_underline">True</property> <property name="mnemonic_widget">female</property> + <property name="xalign">0</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="GtkLabel" id="maleft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmmailbody|maleft">_Male</property> <property name="use_underline">True</property> <property name="mnemonic_widget">male</property> + <property name="xalign">0</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="GtkLabel" id="femalecolft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmmailbody|femalecolft">Field name</property> <property name="use_underline">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="femalefieldft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmmailbody|femalefieldft">Field value</property> <property name="use_underline">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkButton" id="newfemale"> <property name="label" translatable="yes" context="mmmailbody|newfemale">_New...</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> @@ -301,14 +293,11 @@ <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="GtkButton" id="newmale"> <property name="label" translatable="yes" context="mmmailbody|newmale">N_ew...</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> @@ -318,8 +307,6 @@ <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> @@ -332,8 +319,6 @@ <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> @@ -346,8 +331,6 @@ <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> @@ -360,8 +343,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -380,8 +361,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -396,14 +375,11 @@ <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="GtkCheckButton" id="personalized"> <property name="label" translatable="yes" context="mmmailbody|personalized">Insert personalized salutation</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -414,16 +390,12 @@ <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">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -432,16 +404,12 @@ <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> </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> diff --git a/sw/uiconfig/swriter/ui/mmsalutationpage.ui b/sw/uiconfig/swriter/ui/mmsalutationpage.ui index ee5ff2a47771..d2c33bdfd286 100644 --- a/sw/uiconfig/swriter/ui/mmsalutationpage.ui +++ b/sw/uiconfig/swriter/ui/mmsalutationpage.ui @@ -1,8 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> - <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-media-previous</property> + <property name="icon_size">1</property> + </object> + <object class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-media-next</property> + <property name="icon_size">1</property> + </object> <object class="GtkBox" id="MMSalutationPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -45,16 +56,14 @@ <object class="GtkLabel" id="previewft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmsalutationpage|previewft">Preview</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">preview:border</property> + <property name="mnemonic_widget">preview</property> + <property name="xalign">0</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> @@ -77,22 +86,35 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> <property name="height">2</property> </packing> </child> <child> - <object class="swlo-SwAddressPreview" id="preview:border"> + <object class="GtkScrolledWindow" id="previewwin"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkDrawingArea" id="preview"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + </child> + </object> + </child> </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> @@ -111,8 +133,6 @@ <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> @@ -126,8 +146,6 @@ <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> @@ -135,38 +153,30 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="mmsalutationpage|documentindex">Document: %1</property> + <property name="xalign">1</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">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </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> </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> @@ -188,8 +198,6 @@ <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> @@ -208,16 +216,14 @@ <object class="GtkLabel" id="generalft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmsalutationpage|generalft">General salutation</property> <property name="use_underline">True</property> <property name="mnemonic_widget">general</property> + <property name="xalign">0</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> @@ -235,8 +241,6 @@ <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> @@ -263,78 +267,69 @@ <object class="GtkLabel" id="femalefi"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmsalutationpage|femalefi">Address list field indicating a female recipient</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> <property name="width">3</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="femaleft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmsalutationpage|femaleft">_Female</property> <property name="use_underline">True</property> <property name="mnemonic_widget">female</property> + <property name="xalign">0</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="GtkLabel" id="maleft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmsalutationpage|maleft">_Male</property> <property name="use_underline">True</property> <property name="mnemonic_widget">male</property> + <property name="xalign">0</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="GtkLabel" id="femalecolft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmsalutationpage|femalecolft">Field name</property> <property name="use_underline">True</property> <property name="mnemonic_widget">femalecol</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="femalefieldft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="mmsalutationpage|femalefieldft">Field value</property> <property name="use_underline">True</property> <property name="mnemonic_widget">femalefield</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -349,8 +344,6 @@ <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> @@ -365,8 +358,6 @@ <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> @@ -379,8 +370,6 @@ <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> @@ -393,8 +382,6 @@ <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> @@ -407,8 +394,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -427,8 +412,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -443,8 +426,6 @@ <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> @@ -460,16 +441,12 @@ <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">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -478,16 +455,12 @@ <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> </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> @@ -519,16 +492,4 @@ <widget name="newmale"/> </widgets> </object> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-media-previous</property> - <property name="icon_size">1</property> - </object> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-media-next</property> - <property name="icon_size">1</property> - </object> </interface> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits