25#include <com/sun/star/sdb/XColumn.hpp>
26#include <com/sun/star/sdbc/SQLException.hpp>
27#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
28#include <com/sun/star/container/XNameAccess.hpp>
42 for(
const auto& rEntry : rEntries)
52 OUString* pEntries =
aEntries.getArray();
53 for(sal_Int32 nEntry = 0; nEntry < rBox.
get_count(); ++nEntry)
54 pEntries[nEntry] = rBox.
get_text(nEntry);
61 bool bIndividual = m_xPersonalizedCB->get_sensitive() && m_xPersonalizedCB->get_active();
62 m_xFemaleFT->set_sensitive(bIndividual);
63 m_xFemaleLB->set_sensitive(bIndividual);
64 m_xFemalePB->set_sensitive(bIndividual);
65 m_xMaleFT->set_sensitive(bIndividual);
66 m_xMaleLB->set_sensitive(bIndividual);
67 m_xMalePB->set_sensitive(bIndividual);
68 m_xFemaleFI->set_sensitive(bIndividual);
69 m_xFemaleColumnFT->set_sensitive(bIndividual);
70 m_xFemaleColumnLB->set_sensitive(bIndividual);
71 m_xFemaleFieldFT->set_sensitive(bIndividual);
72 m_xFemaleFieldCB->set_sensitive(bIndividual);
76 m_rConfigItem.SetIndividualGreeting(bIndividual,
false);
77 m_pWizard->UpdateRoadmap();
78 m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(
MM_LAYOUTPAGE));
86 &rButton == m_xMalePB.get() ?
91 weld::ComboBox* pToInsert = &rButton == m_xMalePB.get() ? m_xMaleLB.get() : m_xFemaleLB.get();
96 m_pWizard->UpdateRoadmap();
97 m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(
MM_LAYOUTPAGE));
110 const OUString
sPreview(m_xFemaleLB->get_active_text() +
"\n" + m_xMaleLB->get_active_text());
115 m_pWizard->UpdateRoadmap();
116 m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(
MM_LAYOUTPAGE));
133 bool bFemale =
false;
140 Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() :
nullptr;
141 if(!sFemaleValue.isEmpty() && !sFemaleColumn.isEmpty() &&
143 xColAccess->hasByName(sFemaleColumn))
146 Any aCol = xColAccess->getByName(sFemaleColumn);
147 Reference< sdb::XColumn >
xColumn;
153 bFemale =
xColumn->getString() == sFemaleValue;
156 const OUString sLastNameColumn =
158 if ( xColAccess->hasByName(sLastNameColumn) )
160 aCol = xColAccess->getByName(sLastNameColumn);
162 bNoValue =
xColumn->getString().isEmpty();
165 catch (
const sdbc::SQLException&)
187 m_xMaleFT->set_sensitive(bEnablePersonal);
188 m_xMaleLB->set_sensitive(bEnablePersonal);
189 m_xMalePB->set_sensitive(bEnablePersonal);
200 :
vcl::OWizardPage(pPage, pWizard,
"modules/swriter/ui/mmsalutationpage.ui",
"MMSalutationPage")
202 , m_xPreview(new
SwAddressPreview(m_xBuilder->weld_scrolled_window(
"previewwin", true)))
203 , m_xPreviewFI(m_xBuilder->weld_label(
"previewft"))
204 , m_xAssignPB(m_xBuilder->weld_button(
"assign"))
205 , m_xDocumentIndexFI(m_xBuilder->weld_label(
"documentindex"))
206 , m_xPrevSetIB(m_xBuilder->weld_button(
"prev"))
207 , m_xNextSetIB(m_xBuilder->weld_button(
"next"))
208 , m_xPreviewWIN(new
weld::CustomWeld(*m_xBuilder,
"preview", *m_xPreview))
223 m_xMalePB->connect_clicked(aGreetingLink);
261 Reference < container::XNameAccess> xColAccess = xColsSupp->getColumns();
262 const Sequence< OUString > aColumns = xColAccess->getElementNames();
263 for(
const auto& rColumn : aColumns)
283 if(aAssignment.getLength() <= MM_PART_GENDER)
284 aAssignment.realloc(MM_PART_GENDER + 1);
295 if (nCurrentTextPos == -1)
308 bool bContainsGreeting = rBox.get_active();
310 m_xPreviewFI->set_sensitive(bContainsGreeting);
311 m_xPreviewWIN->set_sensitive(bContainsGreeting);
312 m_xAssignPB->set_sensitive(bContainsGreeting);
313 m_xDocumentIndexFI->set_sensitive(bContainsGreeting);
314 m_xPrevSetIB->set_sensitive(bContainsGreeting);
315 m_xNextSetIB->set_sensitive(bContainsGreeting);
316 m_rConfigItem.SetGreetingLine(m_xGreetingLineCB->get_active(),
false);
317 m_pWizard->UpdateRoadmap();
318 m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(
MM_LAYOUTPAGE));
323 bool bNext = &rButton == m_xNextSetIB.get();
324 sal_Int32
nPos = m_rConfigItem.GetResultSetPosition();
325 m_rConfigItem.MoveResultSet( bNext ? ++
nPos : --
nPos);
326 nPos = m_rConfigItem.GetResultSetPosition();
335 m_xPrevSetIB->set_sensitive(bEnable);
336 m_xNextSetIB->set_sensitive(bEnable);
337 m_xDocumentIndexFI->set_sensitive(bEnable);
338 m_xDocumentIndexFI->set_label(m_sDocument.replaceFirst(
"%1", OUString::number(
nPos)));
344 , m_xBodyMLE(m_xBuilder->weld_text_view(
"bodymle"))
345 , m_xOK(m_xBuilder->weld_button(
"ok"))
355 m_xMalePB->connect_clicked(aGreetingLink);
372 Reference < container::XNameAccess> xColAccess = xColsSupp->getColumns();
373 const Sequence< OUString > aColumns = xColAccess->getElementNames();
374 for(
const auto& rColumn : aColumns)
392 m_rConfigItem.SetGreetingLine(rBox.get_active(),
true);
397 m_rConfigItem.SetGreetingLine(
398 m_xGreetingLineCB->get_active(),
false);
399 m_rConfigItem.SetIndividualGreeting(
400 m_xPersonalizedCB->get_active(),
false);
402 if (m_xFemaleColumnLB->get_value_changed_from_saved())
404 const SwDBData& rDBData = m_rConfigItem.GetCurrentDBData();
405 Sequence< OUString> aAssignment = m_rConfigItem.GetColumnAssignment( rDBData );
406 sal_Int32
nPos = m_xFemaleColumnLB->get_active();
407 if(aAssignment.getLength() < MM_PART_GENDER)
408 aAssignment.realloc(MM_PART_GENDER);
410 aAssignment.getArray()[MM_PART_GENDER] = m_xFemaleColumnLB->get_active_text();
412 aAssignment.getArray()[MM_PART_GENDER].clear();
413 m_rConfigItem.SetColumnAssignment( rDBData, aAssignment );
415 if (m_xFemaleFieldCB->get_value_changed_from_saved())
416 m_rConfigItem.SetFemaleGenderValue(m_xFemaleFieldCB->get_active_text());
constexpr OUStringLiteral sPreview
Reference< XExecutableDialog > m_xDialog
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static OUString FillData(const OUString &rAddress, SwMailMergeConfigItem const &rConfigItem, const css::uno::Sequence< OUString > *pAssignments=nullptr)
std::unique_ptr< weld::ComboBox > m_xNeutralCB
virtual void UpdatePreview()
std::unique_ptr< weld::Label > m_xFemaleColumnFT
std::unique_ptr< weld::Label > m_xFemaleFI
std::unique_ptr< weld::Button > m_xFemalePB
std::unique_ptr< weld::CheckButton > m_xGreetingLineCB
std::unique_ptr< weld::ComboBox > m_xFemaleColumnLB
std::unique_ptr< weld::Label > m_xFemaleFieldFT
std::unique_ptr< weld::CheckButton > m_xPersonalizedCB
std::unique_ptr< weld::ComboBox > m_xFemaleFieldCB
std::unique_ptr< weld::ComboBox > m_xFemaleLB
SwMailMergeConfigItem & m_rConfigItem
The mail merge state, available even when m_pWizard is nullptr.
std::unique_ptr< weld::Label > m_xNeutralFT
std::unique_ptr< weld::Label > m_xMaleFT
std::unique_ptr< weld::Label > m_xFemaleFT
SwMailMergeWizard * m_pWizard
void Contains(bool bContainsGreeting)
std::unique_ptr< weld::ComboBox > m_xMaleLB
std::unique_ptr< weld::Button > m_xMalePB
virtual ~SwMailBodyDialog() override
std::unique_ptr< weld::Button > m_xOK
std::unique_ptr< weld::TextView > m_xBodyMLE
SwMailBodyDialog(weld::Window *pParent)
void SetIndividualGreeting(bool bSet, bool bInEMail)
const SwDBData & GetCurrentDBData() const
css::uno::Sequence< OUString > GetGreetings(Gender eType) const
void SetGreetingLine(bool bSet, bool bInEMail)
void SetGreetings(Gender eType, const css::uno::Sequence< OUString > &rBlocks)
css::uno::Reference< css::sdbcx::XColumnsSupplier > const & GetColumnsSupplier()
void SetFemaleGenderValue(const OUString &rValue)
bool IsGreetingLine(bool bInEMail) const
bool IsIndividualGreeting(bool bInEMail) const
css::uno::Sequence< OUString > GetColumnAssignment(const SwDBData &rDBData) const
sal_Int32 GetCurrentGreeting(Gender eType) const
css::uno::Reference< css::sdbc::XResultSet > const & GetResultSet() const
void SetColumnAssignment(const SwDBData &rDBData, const css::uno::Sequence< OUString > &)
const OUString & GetFemaleGenderValue() const
void SetCurrentGreeting(Gender eType, sal_Int32 nIndex)
OUString GetAssignedColumn(sal_uInt32 nColumn) const
std::unique_ptr< weld::CustomWeld > m_xPreviewWIN
std::unique_ptr< weld::Button > m_xPrevSetIB
virtual ~SwMailMergeGreetingsPage() override
virtual void Activate() override
std::unique_ptr< weld::Button > m_xAssignPB
std::unique_ptr< SwAddressPreview > m_xPreview
std::unique_ptr< weld::Button > m_xNextSetIB
std::unique_ptr< weld::Label > m_xDocumentIndexFI
virtual void UpdatePreview() override
SwMailMergeGreetingsPage(weld::Container *pPage, SwMailMergeWizard *pWizard)
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
bool isStateEnabled(WizardTypes::WizardState nState) const
void enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable)
virtual void set_active(int pos)=0
virtual OUString get_text(int pos) const=0
void append_text(const OUString &rStr)
virtual int get_active() const=0
virtual int get_count() const=0
#define TOOLS_WARN_EXCEPTION(area, stream)
ScXMLEditAttributeMap::Entry const aEntries[]
#define LINK(Instance, Class, Member)
IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, weld::Button &, rButton, void)
static void lcl_StoreGreetingsBox(const weld::ComboBox &rBox, SwMailMergeConfigItem &rConfig, SwMailMergeConfigItem::Gender eType)
static void lcl_FillGreetingsBox(weld::ComboBox &rBox, SwMailMergeConfigItem const &rConfig, SwMailMergeConfigItem::Gender eType)
IMPL_LINK_NOARG(SwGreetingsHandler, IndividualHdl_Impl, weld::Toggleable &, void)