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 10cdf0e10cSrcweir * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _MMCONFIGITEM_HXX 24cdf0e10cSrcweir #define _MMCONFIGITEM_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 27cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 28cdf0e10cSrcweir #include <tools/resary.hxx> 29cdf0e10cSrcweir #include <swdbdata.hxx> 30cdf0e10cSrcweir #include "swdllapi.h" 31cdf0e10cSrcweir #include "sharedconnection.hxx" 32cdf0e10cSrcweir 33cdf0e10cSrcweir namespace com{namespace sun{namespace star{ 34cdf0e10cSrcweir namespace sdbc{ 35cdf0e10cSrcweir class XDataSource; 36cdf0e10cSrcweir class XConnection; 37cdf0e10cSrcweir class XResultSet; 38cdf0e10cSrcweir } 39cdf0e10cSrcweir namespace sdbcx{ 40cdf0e10cSrcweir class XColumnsSupplier; 41cdf0e10cSrcweir } 42cdf0e10cSrcweir }}} 43cdf0e10cSrcweir class SwMailMergeConfigItem_Impl; 44cdf0e10cSrcweir class SwView; 45cdf0e10cSrcweir 46cdf0e10cSrcweir /*-- 06.04.2004 10:43:35--------------------------------------------------- 47cdf0e10cSrcweir 48cdf0e10cSrcweir -----------------------------------------------------------------------*/ 49cdf0e10cSrcweir struct SwDocMergeInfo 50cdf0e10cSrcweir { 51cdf0e10cSrcweir long nStartPageInTarget; 52cdf0e10cSrcweir long nEndPageInTarget; 53cdf0e10cSrcweir long nDBRow; 54cdf0e10cSrcweir }; 55cdf0e10cSrcweir class SW_DLLPUBLIC SwMailMergeConfigItem 56cdf0e10cSrcweir { 57cdf0e10cSrcweir // com::sun::star::uno::Sequence< ::rtl::OUString> m_aSavedDocuments; 58cdf0e10cSrcweir SwMailMergeConfigItem_Impl* m_pImpl; 59cdf0e10cSrcweir //session information - not stored in configuration 60cdf0e10cSrcweir bool m_bAddressInserted; 61cdf0e10cSrcweir bool m_bMergeDone; 62cdf0e10cSrcweir bool m_bGreetingInserted; 63cdf0e10cSrcweir sal_Int32 m_nGreetingMoves; 64cdf0e10cSrcweir ::rtl::OUString m_rAddressBlockFrame; 65cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> m_aSelection; 66cdf0e10cSrcweir 67cdf0e10cSrcweir sal_uInt16 m_nStartPrint; 68cdf0e10cSrcweir sal_uInt16 m_nEndPrint; 69cdf0e10cSrcweir 70cdf0e10cSrcweir ::rtl::OUString m_sSelectedPrinter; 71cdf0e10cSrcweir 72cdf0e10cSrcweir SwView* m_pSourceView; 73cdf0e10cSrcweir SwView* m_pTargetView; 74cdf0e10cSrcweir public: 75cdf0e10cSrcweir SwMailMergeConfigItem(); 76cdf0e10cSrcweir ~SwMailMergeConfigItem(); 77cdf0e10cSrcweir 78cdf0e10cSrcweir enum Gender 79cdf0e10cSrcweir { 80cdf0e10cSrcweir FEMALE, 81cdf0e10cSrcweir MALE, 82cdf0e10cSrcweir NEUTRAL 83cdf0e10cSrcweir }; 84cdf0e10cSrcweir 85cdf0e10cSrcweir void Commit(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir const ResStringArray& GetDefaultAddressHeaders() const; 88cdf0e10cSrcweir 89cdf0e10cSrcweir void SetCurrentConnection( 90cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> xSource, 91cdf0e10cSrcweir SharedConnection xConnection, 92cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xColumnsSupplier, 93cdf0e10cSrcweir const SwDBData& rDBData); 94cdf0e10cSrcweir 95cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> 96cdf0e10cSrcweir GetSource(); 97cdf0e10cSrcweir 98cdf0e10cSrcweir SharedConnection GetConnection(); 99cdf0e10cSrcweir 100cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> 101cdf0e10cSrcweir GetColumnsSupplier(); 102cdf0e10cSrcweir 103cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> 104cdf0e10cSrcweir GetResultSet() const; 105cdf0e10cSrcweir 106cdf0e10cSrcweir void DisposeResultSet(); 107cdf0e10cSrcweir 108cdf0e10cSrcweir ::rtl::OUString& GetFilter() const; 109cdf0e10cSrcweir void SetFilter(::rtl::OUString&); 110cdf0e10cSrcweir 111cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> 112cdf0e10cSrcweir GetSelection()const; 113cdf0e10cSrcweir void SetSelection(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > rSelection); 114cdf0e10cSrcweir 115cdf0e10cSrcweir void SetCurrentDBData( const SwDBData& rDBData); 116cdf0e10cSrcweir const SwDBData& GetCurrentDBData() const; 117cdf0e10cSrcweir 118cdf0e10cSrcweir // move absolute, nTarget == -1 -> goto last record 119cdf0e10cSrcweir sal_Int32 MoveResultSet(sal_Int32 nTarget); 120cdf0e10cSrcweir sal_Int32 GetResultSetPosition()const; 121cdf0e10cSrcweir bool IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast); 122cdf0e10cSrcweir 123cdf0e10cSrcweir bool IsRecordExcluded(sal_Int32 nRecord); 124cdf0e10cSrcweir void ExcludeRecord(sal_Int32 nRecord, bool bExclude); 125cdf0e10cSrcweir 126cdf0e10cSrcweir const com::sun::star::uno::Sequence< ::rtl::OUString>& 127cdf0e10cSrcweir GetSavedDocuments() const; 128cdf0e10cSrcweir void AddSavedDocument(::rtl::OUString rName); 129cdf0e10cSrcweir 130cdf0e10cSrcweir sal_Bool IsOutputToLetter()const; 131cdf0e10cSrcweir void SetOutputToLetter(sal_Bool bSet); 132cdf0e10cSrcweir 133cdf0e10cSrcweir sal_Bool IsAddressBlock()const; 134cdf0e10cSrcweir void SetAddressBlock(sal_Bool bSet); 135cdf0e10cSrcweir 136cdf0e10cSrcweir sal_Bool IsHideEmptyParagraphs() const; 137cdf0e10cSrcweir void SetHideEmptyParagraphs(sal_Bool bSet); 138cdf0e10cSrcweir 139cdf0e10cSrcweir const com::sun::star::uno::Sequence< ::rtl::OUString> 140cdf0e10cSrcweir GetAddressBlocks() const; 141cdf0e10cSrcweir void SetAddressBlocks(const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks); 142cdf0e10cSrcweir 143cdf0e10cSrcweir void SetCurrentAddressBlockIndex( sal_Int32 nSet ); 144cdf0e10cSrcweir sal_Int32 GetCurrentAddressBlockIndex() const; 145cdf0e10cSrcweir 146cdf0e10cSrcweir sal_Bool IsIncludeCountry() const; 147cdf0e10cSrcweir rtl::OUString& GetExcludeCountry() const; 148cdf0e10cSrcweir void SetCountrySettings(sal_Bool bSet, const rtl::OUString& sCountry); 149cdf0e10cSrcweir 150cdf0e10cSrcweir sal_Bool IsIndividualGreeting(sal_Bool bInEMail) const; 151cdf0e10cSrcweir void SetIndividualGreeting(sal_Bool bSet, sal_Bool bInEMail); 152cdf0e10cSrcweir 153cdf0e10cSrcweir sal_Bool IsGreetingLine(sal_Bool bInEMail) const; 154cdf0e10cSrcweir void SetGreetingLine(sal_Bool bSet, sal_Bool bInEMail); 155cdf0e10cSrcweir 156cdf0e10cSrcweir const com::sun::star::uno::Sequence< ::rtl::OUString> 157cdf0e10cSrcweir GetGreetings(Gender eType) const; 158cdf0e10cSrcweir void SetGreetings(Gender eType, const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks); 159cdf0e10cSrcweir 160cdf0e10cSrcweir sal_Int32 GetCurrentGreeting(Gender eType) const; 161cdf0e10cSrcweir void SetCurrentGreeting(Gender eType, sal_Int32 nIndex); 162cdf0e10cSrcweir 163cdf0e10cSrcweir //the content of the gender column that marks it as female 164cdf0e10cSrcweir const ::rtl::OUString& GetFemaleGenderValue() const; 165cdf0e10cSrcweir void SetFemaleGenderValue(const ::rtl::OUString rValue); 166cdf0e10cSrcweir 167cdf0e10cSrcweir //returns the assignment in the order of the default headers (GetDefaultAddressHeaders()) 168cdf0e10cSrcweir com::sun::star::uno::Sequence< ::rtl::OUString > 169cdf0e10cSrcweir GetColumnAssignment( const SwDBData& rDBData ) const; 170cdf0e10cSrcweir void SetColumnAssignment( 171cdf0e10cSrcweir const SwDBData& rDBData, 172cdf0e10cSrcweir const com::sun::star::uno::Sequence< ::rtl::OUString>& ); 173cdf0e10cSrcweir 174cdf0e10cSrcweir bool IsAddressFieldsAssigned() const; 175cdf0e10cSrcweir bool IsGreetingFieldsAssigned() const; 176cdf0e10cSrcweir 177cdf0e10cSrcweir //e-Mail settings: 178cdf0e10cSrcweir ::rtl::OUString GetMailDisplayName() const; 179cdf0e10cSrcweir void SetMailDisplayName(const ::rtl::OUString& rName); 180cdf0e10cSrcweir 181cdf0e10cSrcweir ::rtl::OUString GetMailAddress() const; 182cdf0e10cSrcweir void SetMailAddress(const ::rtl::OUString& rAddress); 183cdf0e10cSrcweir 184cdf0e10cSrcweir sal_Bool IsMailReplyTo() const; 185cdf0e10cSrcweir void SetMailReplyTo(sal_Bool bSet); 186cdf0e10cSrcweir 187cdf0e10cSrcweir ::rtl::OUString GetMailReplyTo() const; 188cdf0e10cSrcweir void SetMailReplyTo(const ::rtl::OUString& rReplyTo); 189cdf0e10cSrcweir 190cdf0e10cSrcweir ::rtl::OUString GetMailServer() const; 191cdf0e10cSrcweir void SetMailServer(const ::rtl::OUString& rAddress); 192cdf0e10cSrcweir 193cdf0e10cSrcweir sal_Int16 GetMailPort() const; 194cdf0e10cSrcweir void SetMailPort(sal_Int16 nSet); 195cdf0e10cSrcweir 196cdf0e10cSrcweir sal_Bool IsSecureConnection() const; 197cdf0e10cSrcweir void SetSecureConnection(sal_Bool bSet); 198cdf0e10cSrcweir 199cdf0e10cSrcweir sal_Bool IsAuthentication() const; 200cdf0e10cSrcweir void SetAuthentication(sal_Bool bSet); 201cdf0e10cSrcweir 202cdf0e10cSrcweir ::rtl::OUString GetMailUserName() const; 203cdf0e10cSrcweir void SetMailUserName(const ::rtl::OUString& rName); 204cdf0e10cSrcweir 205cdf0e10cSrcweir ::rtl::OUString GetMailPassword() const; 206cdf0e10cSrcweir void SetMailPassword(const ::rtl::OUString& rPassword); 207cdf0e10cSrcweir 208cdf0e10cSrcweir sal_Bool IsSMTPAfterPOP() const; 209cdf0e10cSrcweir void SetSMTPAfterPOP(sal_Bool bSet); 210cdf0e10cSrcweir 211cdf0e10cSrcweir ::rtl::OUString GetInServerName() const; 212cdf0e10cSrcweir void SetInServerName(const ::rtl::OUString& rServer); 213cdf0e10cSrcweir 214cdf0e10cSrcweir sal_Int16 GetInServerPort() const; 215cdf0e10cSrcweir void SetInServerPort(sal_Int16 nSet); 216cdf0e10cSrcweir 217cdf0e10cSrcweir sal_Bool IsInServerPOP() const; 218cdf0e10cSrcweir void SetInServerPOP(sal_Bool bSet); 219cdf0e10cSrcweir 220cdf0e10cSrcweir ::rtl::OUString GetInServerUserName() const; 221cdf0e10cSrcweir void SetInServerUserName(const ::rtl::OUString& rName); 222cdf0e10cSrcweir 223cdf0e10cSrcweir ::rtl::OUString GetInServerPassword() const; 224cdf0e10cSrcweir void SetInServerPassword(const ::rtl::OUString& rPassword); 225cdf0e10cSrcweir 226cdf0e10cSrcweir //session information IsAddressInserted() const227cdf0e10cSrcweir bool IsAddressInserted() const { return m_bAddressInserted; } SetAddressInserted(const::rtl::OUString & rFrameName)228cdf0e10cSrcweir void SetAddressInserted(const ::rtl::OUString& rFrameName) 229cdf0e10cSrcweir { m_bAddressInserted = true; 230cdf0e10cSrcweir m_rAddressBlockFrame = rFrameName; 231cdf0e10cSrcweir } 232cdf0e10cSrcweir IsGreetingInserted() const233cdf0e10cSrcweir bool IsGreetingInserted() const { return m_bGreetingInserted; } SetGreetingInserted()234cdf0e10cSrcweir void SetGreetingInserted() 235cdf0e10cSrcweir { m_bGreetingInserted = true; } 236cdf0e10cSrcweir 237cdf0e10cSrcweir // counts the moves in the layout page MoveGreeting(sal_Int32 nMove)238cdf0e10cSrcweir void MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;} GetGreetingMoves() const239cdf0e10cSrcweir sal_Int32 GetGreetingMoves() const { return m_nGreetingMoves;} 240cdf0e10cSrcweir IsMergeDone() const241cdf0e10cSrcweir bool IsMergeDone() const { return m_bMergeDone;} SetMergeDone()242cdf0e10cSrcweir void SetMergeDone( ) { m_bMergeDone = true; } 243cdf0e10cSrcweir 244cdf0e10cSrcweir // new source document - reset some flags 245cdf0e10cSrcweir void DocumentReloaded(); 246cdf0e10cSrcweir 247cdf0e10cSrcweir bool IsMailAvailable() const; 248cdf0e10cSrcweir 249cdf0e10cSrcweir // notify a completed merge, provid the appropriate e-Mail address if available 250cdf0e10cSrcweir void AddMergedDocument(SwDocMergeInfo& rInfo); 251cdf0e10cSrcweir //returns the page and database cursor information of each merged document 252cdf0e10cSrcweir SwDocMergeInfo& GetDocumentMergeInfo(sal_uInt32 nDocument); 253cdf0e10cSrcweir sal_uInt32 GetMergedDocumentCount() const; 254cdf0e10cSrcweir SetPrintRange(sal_uInt16 nStartDocument,sal_uInt16 nEndDocument)255cdf0e10cSrcweir void SetPrintRange( sal_uInt16 nStartDocument, sal_uInt16 nEndDocument) 256cdf0e10cSrcweir {m_nStartPrint = nStartDocument; m_nEndPrint = nEndDocument;} GetPrintRangeStart() const257cdf0e10cSrcweir sal_uInt16 GetPrintRangeStart() const {return m_nStartPrint;} GetPrintRangeEnd() const258cdf0e10cSrcweir sal_uInt16 GetPrintRangeEnd() const {return m_nEndPrint;} 259cdf0e10cSrcweir GetSelectedPrinter() const260cdf0e10cSrcweir const ::rtl::OUString& GetSelectedPrinter() const {return m_sSelectedPrinter;} SetSelectedPrinter(const::rtl::OUString & rSet)261cdf0e10cSrcweir void SetSelectedPrinter(const ::rtl::OUString& rSet ) 262cdf0e10cSrcweir {m_sSelectedPrinter = rSet;} 263cdf0e10cSrcweir 264cdf0e10cSrcweir 265cdf0e10cSrcweir SwView* GetTargetView(); 266cdf0e10cSrcweir void SetTargetView(SwView* pView); 267cdf0e10cSrcweir 268cdf0e10cSrcweir SwView* GetSourceView(); 269cdf0e10cSrcweir void SetSourceView(SwView* pView); 270cdf0e10cSrcweir 271cdf0e10cSrcweir //helper methods 272cdf0e10cSrcweir ::rtl::OUString GetAssignedColumn(sal_uInt32 nColumn)const; 273cdf0e10cSrcweir }; 274cdf0e10cSrcweir #endif 275cdf0e10cSrcweir 276