1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _MAILMERGEADDRESSBLOCKPAGE_HXX 28*cdf0e10cSrcweir #define _MAILMERGEADDRESSBLOCKPAGE_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <svtools/wizardmachine.hxx> 31*cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX 32*cdf0e10cSrcweir #include <vcl/button.hxx> 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #include <svtools/stdctrl.hxx> 35*cdf0e10cSrcweir #include <mailmergehelper.hxx> 36*cdf0e10cSrcweir #include <sfx2/basedlgs.hxx> 37*cdf0e10cSrcweir #include <vcl/edit.hxx> 38*cdf0e10cSrcweir #include <vcl/lstbox.hxx> 39*cdf0e10cSrcweir #include <svtools/svmedit.hxx> 40*cdf0e10cSrcweir #include <svtools/headbar.hxx> 41*cdf0e10cSrcweir #include <svtools/svtreebx.hxx> 42*cdf0e10cSrcweir #include <vcl/combobox.hxx> 43*cdf0e10cSrcweir #include <svl/lstner.hxx> 44*cdf0e10cSrcweir class SwMailMergeWizard; 45*cdf0e10cSrcweir class SwMailMergeConfigItem; 46*cdf0e10cSrcweir /*-- 13.04.2004 15:50:37--------------------------------------------------- 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 49*cdf0e10cSrcweir class SwMailMergeAddressBlockPage : public svt::OWizardPage 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir SwBoldFixedInfo m_aHeaderFI; 52*cdf0e10cSrcweir FixedInfo m_aFirstFI; 53*cdf0e10cSrcweir FixedInfo m_aAddressListFI; 54*cdf0e10cSrcweir PushButton m_aAddressListPB; 55*cdf0e10cSrcweir FixedInfo m_aCurrentAddressFI; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir FixedLine m_aFirstFL; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir FixedInfo m_aSecondFI; 60*cdf0e10cSrcweir FixedInfo m_aSettingsFI; 61*cdf0e10cSrcweir CheckBox m_aAddressCB; 62*cdf0e10cSrcweir SwAddressPreview m_aSettingsWIN; 63*cdf0e10cSrcweir PushButton m_aSettingsPB; 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir CheckBox m_aHideEmptyParagraphsCB; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir FixedLine m_aSecondFL; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir FixedInfo m_aThirdFI; 70*cdf0e10cSrcweir FixedInfo m_aMatchFieldsFI; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir PushButton m_aAssignPB; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir FixedLine m_aThirdFL; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir FixedInfo m_aFourthFI; 77*cdf0e10cSrcweir FixedInfo m_aPreviewFI; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir SwAddressPreview m_aPreviewWIN; 80*cdf0e10cSrcweir FixedInfo m_aDocumentIndexFI; 81*cdf0e10cSrcweir ImageButton m_aPrevSetIB; 82*cdf0e10cSrcweir ImageButton m_aNextSetIB; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir String m_sDocument; 85*cdf0e10cSrcweir String m_sCurrentAddress; 86*cdf0e10cSrcweir String m_sChangeAddress; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir SwMailMergeWizard* m_pWizard; 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir DECL_LINK(AddressListHdl_Impl, PushButton*); 91*cdf0e10cSrcweir DECL_LINK(SettingsHdl_Impl, PushButton*); 92*cdf0e10cSrcweir DECL_LINK(AssignHdl_Impl, PushButton*); 93*cdf0e10cSrcweir DECL_LINK(AddressBlockHdl_Impl, CheckBox*); 94*cdf0e10cSrcweir DECL_LINK(InsertDataHdl_Impl, ImageButton*); 95*cdf0e10cSrcweir DECL_LINK(AddressBlockSelectHdl_Impl, SwAddressPreview*); 96*cdf0e10cSrcweir DECL_LINK(HideParagraphsHdl_Impl, CheckBox*); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir void EnableAddressBlock(sal_Bool bAll, sal_Bool bSelective); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir virtual void ActivatePage(); 101*cdf0e10cSrcweir virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); 102*cdf0e10cSrcweir virtual bool canAdvance() const; 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir public: 105*cdf0e10cSrcweir SwMailMergeAddressBlockPage( SwMailMergeWizard* _pParent); 106*cdf0e10cSrcweir ~SwMailMergeAddressBlockPage(); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir SwMailMergeWizard* GetWizard() { return m_pWizard;} 109*cdf0e10cSrcweir }; 110*cdf0e10cSrcweir /*-- 13.04.2004 15:45:31--------------------------------------------------- 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 113*cdf0e10cSrcweir class SwSelectAddressBlockDialog : public SfxModalDialog 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir FixedText m_aSelectFT; 116*cdf0e10cSrcweir SwAddressPreview m_aPreview; 117*cdf0e10cSrcweir PushButton m_aNewPB; 118*cdf0e10cSrcweir PushButton m_aCustomizePB; 119*cdf0e10cSrcweir PushButton m_aDeletePB; 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir FixedInfo m_aSettingsFI; 122*cdf0e10cSrcweir RadioButton m_aNeverRB; 123*cdf0e10cSrcweir RadioButton m_aAlwaysRB; 124*cdf0e10cSrcweir RadioButton m_aDependentRB; 125*cdf0e10cSrcweir Edit m_aCountryED; 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir FixedLine m_aSeparatorFL; 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir OKButton m_aOK; 130*cdf0e10cSrcweir CancelButton m_aCancel; 131*cdf0e10cSrcweir HelpButton m_aHelp; 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir com::sun::star::uno::Sequence< ::rtl::OUString> m_aAddressBlocks; 134*cdf0e10cSrcweir SwMailMergeConfigItem& m_rConfig; 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir DECL_LINK(NewCustomizeHdl_Impl, PushButton*); 137*cdf0e10cSrcweir DECL_LINK(DeleteHdl_Impl, PushButton*); 138*cdf0e10cSrcweir DECL_LINK(IncludeHdl_Impl, RadioButton*); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir using Window::SetSettings; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir public: 143*cdf0e10cSrcweir SwSelectAddressBlockDialog(Window* pParent, SwMailMergeConfigItem& rConfig); 144*cdf0e10cSrcweir ~SwSelectAddressBlockDialog(); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir void SetAddressBlocks(const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks, 147*cdf0e10cSrcweir sal_uInt16 nSelected); 148*cdf0e10cSrcweir const com::sun::star::uno::Sequence< ::rtl::OUString>& GetAddressBlocks(); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir void SetSettings(sal_Bool bIsCountry, ::rtl::OUString sCountry); 151*cdf0e10cSrcweir sal_Bool IsIncludeCountry() const {return !m_aNeverRB.IsChecked();} 152*cdf0e10cSrcweir ::rtl::OUString GetCountry() const; 153*cdf0e10cSrcweir }; 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir /*-- 26.05.2004 11:16:25--------------------------------------------------- 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 159*cdf0e10cSrcweir class SwCustomizeAddressBlockDialog; 160*cdf0e10cSrcweir class DDListBox : public SvTreeListBox 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir SwCustomizeAddressBlockDialog* m_pParentDialog; 163*cdf0e10cSrcweir public: 164*cdf0e10cSrcweir DDListBox(SwCustomizeAddressBlockDialog* pParent, const ResId rResId); 165*cdf0e10cSrcweir ~DDListBox(); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 168*cdf0e10cSrcweir }; 169*cdf0e10cSrcweir /*-- 26.05.2004 11:16:25--------------------------------------------------- 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 172*cdf0e10cSrcweir #define MOVE_ITEM_LEFT 1 173*cdf0e10cSrcweir #define MOVE_ITEM_RIGHT 2 174*cdf0e10cSrcweir #define MOVE_ITEM_UP 4 175*cdf0e10cSrcweir #define MOVE_ITEM_DOWN 8 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir class AddressMultiLineEdit : public MultiLineEdit, public SfxListener 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir Link m_aSelectionLink; 180*cdf0e10cSrcweir SwCustomizeAddressBlockDialog* m_pParentDialog; 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir using Window::Notify; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir using MultiLineEdit::SetText; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir protected: 187*cdf0e10cSrcweir long PreNotify( NotifyEvent& rNEvt ); 188*cdf0e10cSrcweir public: 189*cdf0e10cSrcweir AddressMultiLineEdit(SwCustomizeAddressBlockDialog* pParent, const ResId& rResId); 190*cdf0e10cSrcweir ~AddressMultiLineEdit(); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir void SetSelectionChangedHdl( const Link& rLink ) {m_aSelectionLink = rLink;} 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir void SetText( const String& rStr ); 197*cdf0e10cSrcweir String GetAddress(); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir void InsertNewEntry( const String& rStr ); 200*cdf0e10cSrcweir void InsertNewEntryAtPosition( const String& rStr, sal_uLong nPara, sal_uInt16 nIndex ); 201*cdf0e10cSrcweir void RemoveCurrentEntry(); 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir void MoveCurrentItem(sal_uInt16 nMove); 204*cdf0e10cSrcweir sal_uInt16 IsCurrentItemMoveable(); 205*cdf0e10cSrcweir bool HasCurrentItem(); 206*cdf0e10cSrcweir String GetCurrentItem(); 207*cdf0e10cSrcweir void SelectCurrentItem(); 208*cdf0e10cSrcweir }; 209*cdf0e10cSrcweir /*-- 13.04.2004 15:45:31--------------------------------------------------- 210*cdf0e10cSrcweir Dialog is used to create custom address blocks as well as 211*cdf0e10cSrcweir custom greeting lines 212*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 213*cdf0e10cSrcweir class SwRestrictedComboBox : public ComboBox 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir String sForbiddenChars; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir protected: 218*cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& ); 219*cdf0e10cSrcweir virtual void Modify(); 220*cdf0e10cSrcweir public: 221*cdf0e10cSrcweir SwRestrictedComboBox(Window* pParent, const ResId& rResId): 222*cdf0e10cSrcweir ComboBox( pParent, rResId ){} 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir ~SwRestrictedComboBox(); 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir void SetForbiddenChars(const String& rSet){sForbiddenChars = rSet;} 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir }; 229*cdf0e10cSrcweir class SwCustomizeAddressBlockDialog : public SfxModalDialog 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir friend class DDListBox; 232*cdf0e10cSrcweir friend class AddressMultiLineEdit; 233*cdf0e10cSrcweir public: 234*cdf0e10cSrcweir enum DialogType 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir ADDRESSBLOCK_NEW, 237*cdf0e10cSrcweir ADDRESSBLOCK_EDIT, 238*cdf0e10cSrcweir GREETING_FEMALE, 239*cdf0e10cSrcweir GREETING_MALE 240*cdf0e10cSrcweir }; 241*cdf0e10cSrcweir private: 242*cdf0e10cSrcweir FixedText m_aAddressElementsFT; 243*cdf0e10cSrcweir DDListBox m_aAddressElementsLB; 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir ImageButton m_aInsertFieldIB; 246*cdf0e10cSrcweir ImageButton m_aRemoveFieldIB; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir FixedText m_aDragFT; 249*cdf0e10cSrcweir AddressMultiLineEdit m_aDragED; 250*cdf0e10cSrcweir ImageButton m_aUpIB; 251*cdf0e10cSrcweir ImageButton m_aLeftIB; 252*cdf0e10cSrcweir ImageButton m_aRightIB; 253*cdf0e10cSrcweir ImageButton m_aDownIB; 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir FixedText m_aFieldFT; 256*cdf0e10cSrcweir SwRestrictedComboBox m_aFieldCB; 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir FixedInfo m_aPreviewFI; 259*cdf0e10cSrcweir SwAddressPreview m_aPreviewWIN; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir FixedLine m_aSeparatorFL; 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir OKButton m_aOK; 264*cdf0e10cSrcweir CancelButton m_aCancel; 265*cdf0e10cSrcweir HelpButton m_aHelp; 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir ::std::vector<String> m_aSalutations; 268*cdf0e10cSrcweir ::std::vector<String> m_aPunctuations; 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir String m_sCurrentSalutation; 271*cdf0e10cSrcweir String m_sCurrentPunctuation; 272*cdf0e10cSrcweir String m_sCurrentText; 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir SwMailMergeConfigItem& m_rConfigItem; 275*cdf0e10cSrcweir DialogType m_eType; 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir DECL_LINK(OKHdl_Impl, OKButton*); 278*cdf0e10cSrcweir DECL_LINK(ListBoxSelectHdl_Impl, DDListBox*); 279*cdf0e10cSrcweir DECL_LINK(EditModifyHdl_Impl, AddressMultiLineEdit*); 280*cdf0e10cSrcweir DECL_LINK(ImageButtonHdl_Impl, ImageButton*); 281*cdf0e10cSrcweir DECL_LINK(SelectionChangedHdl_Impl, AddressMultiLineEdit*); 282*cdf0e10cSrcweir DECL_LINK(FieldChangeHdl_Impl, ComboBox*); 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir bool HasItem_Impl(sal_Int32 nUserData); 285*cdf0e10cSrcweir sal_Int32 GetSelectedItem_Impl(); 286*cdf0e10cSrcweir void UpdateImageButtons_Impl(); 287*cdf0e10cSrcweir void MoveFocus( Window* pMember, bool bNext ); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir public: 290*cdf0e10cSrcweir SwCustomizeAddressBlockDialog(Window* pParent, SwMailMergeConfigItem& rConfig, DialogType); 291*cdf0e10cSrcweir ~SwCustomizeAddressBlockDialog(); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir void SetAddress(const ::rtl::OUString& rAddress); 294*cdf0e10cSrcweir ::rtl::OUString GetAddress(); 295*cdf0e10cSrcweir }; 296*cdf0e10cSrcweir /*-- 13.04.2004 17:41:11--------------------------------------------------- 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 299*cdf0e10cSrcweir class SwAssignFieldsControl; 300*cdf0e10cSrcweir class SwAssignFieldsDialog : public SfxModalDialog 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir FixedInfo m_aMatchingFI; 303*cdf0e10cSrcweir SwAssignFieldsControl* m_pFieldsControl; 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir FixedInfo m_aPreviewFI; 306*cdf0e10cSrcweir SwAddressPreview m_aPreviewWIN; 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir FixedLine m_aSeparatorFL; 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir OKButton m_aOK; 311*cdf0e10cSrcweir CancelButton m_aCancel; 312*cdf0e10cSrcweir HelpButton m_aHelp; 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir String m_sNone; 315*cdf0e10cSrcweir ::rtl::OUString m_rPreviewString; 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir SwMailMergeConfigItem& m_rConfigItem; 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > CreateAssignments(); 320*cdf0e10cSrcweir DECL_LINK(OkHdl_Impl, PushButton*); 321*cdf0e10cSrcweir DECL_LINK(AssignmentModifyHdl_Impl, void*); 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir public: 324*cdf0e10cSrcweir SwAssignFieldsDialog(Window* pParent, 325*cdf0e10cSrcweir SwMailMergeConfigItem& rConfigItem, 326*cdf0e10cSrcweir const ::rtl::OUString& rPreview, 327*cdf0e10cSrcweir bool bIsAddressBlock); 328*cdf0e10cSrcweir ~SwAssignFieldsDialog(); 329*cdf0e10cSrcweir }; 330*cdf0e10cSrcweir #endif 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir 333