LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/dbui - mmaddressblockpage.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 0.0 %
Date: 2012-12-27 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10