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