LCOV - code coverage report
Current view: top level - sw/source/ui/dbui - mmaddressblockpage.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 9 0.0 %
Date: 2014-04-14 Functions: 0 10 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 INCLUDED_SW_SOURCE_UI_DBUI_MMADDRESSBLOCKPAGE_HXX
      20             : #define INCLUDED_SW_SOURCE_UI_DBUI_MMADDRESSBLOCKPAGE_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/layout.hxx>
      29             : #include <vcl/lstbox.hxx>
      30             : #include <svtools/svmedit.hxx>
      31             : #include <svtools/headbar.hxx>
      32             : #include <svtools/treelistbox.hxx>
      33             : #include <vcl/combobox.hxx>
      34             : #include <svl/lstner.hxx>
      35             : class SwMailMergeWizard;
      36             : class SwMailMergeConfigItem;
      37             : 
      38           0 : class SwMailMergeAddressBlockPage : public svt::OWizardPage
      39             : {
      40             :     PushButton*         m_pAddressListPB;
      41             :     FixedText*          m_pCurrentAddressFI;
      42             : 
      43             :     VclContainer*       m_pStep2;
      44             :     VclContainer*       m_pStep3;
      45             :     VclContainer*       m_pStep4;
      46             : 
      47             :     FixedText*          m_pSettingsFI;
      48             :     CheckBox*           m_pAddressCB;
      49             :     SwAddressPreview*   m_pSettingsWIN;
      50             :     PushButton*         m_pSettingsPB;
      51             :     CheckBox*           m_pHideEmptyParagraphsCB;
      52             : 
      53             :     PushButton*         m_pAssignPB;
      54             : 
      55             :     SwAddressPreview*   m_pPreviewWIN;
      56             :     FixedText*          m_pDocumentIndexFI;
      57             :     PushButton*         m_pPrevSetIB;
      58             :     PushButton*         m_pNextSetIB;
      59             : 
      60             :     OUString            m_sDocument;
      61             :     OUString            m_sCurrentAddress;
      62             :     OUString            m_sChangeAddress;
      63             : 
      64             :     SwMailMergeWizard*  m_pWizard;
      65             : 
      66             :     DECL_LINK(AddressListHdl_Impl, void *);
      67             :     DECL_LINK(SettingsHdl_Impl, PushButton*);
      68             :     DECL_LINK(AssignHdl_Impl, PushButton*);
      69             :     DECL_LINK(AddressBlockHdl_Impl, CheckBox*);
      70             :     DECL_LINK(InsertDataHdl_Impl, ImageButton*);
      71             :     DECL_LINK(AddressBlockSelectHdl_Impl, void *);
      72             :     DECL_LINK(HideParagraphsHdl_Impl, CheckBox*);
      73             : 
      74             :     void                EnableAddressBlock(sal_Bool bAll, sal_Bool bSelective);
      75             : 
      76             :     virtual void        ActivatePage() SAL_OVERRIDE;
      77             :     virtual bool        commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) SAL_OVERRIDE;
      78             :     virtual bool        canAdvance() const SAL_OVERRIDE;
      79             : 
      80             : public:
      81             :     SwMailMergeAddressBlockPage(SwMailMergeWizard* _pParent);
      82           0 :     SwMailMergeWizard* GetWizard() { return m_pWizard; }
      83             : };
      84             : 
      85             : class SwSelectAddressBlockDialog : public SfxModalDialog
      86             : {
      87             :     SwAddressPreview*   m_pPreview;
      88             :     PushButton*         m_pNewPB;
      89             :     PushButton*         m_pCustomizePB;
      90             :     PushButton*         m_pDeletePB;
      91             : 
      92             :     RadioButton*        m_pNeverRB;
      93             :     RadioButton*        m_pAlwaysRB;
      94             :     RadioButton*        m_pDependentRB;
      95             :     Edit*               m_pCountryED;
      96             : 
      97             :     com::sun::star::uno::Sequence< OUString>    m_aAddressBlocks;
      98             :     SwMailMergeConfigItem& m_rConfig;
      99             : 
     100             :     DECL_LINK(NewCustomizeHdl_Impl, PushButton*);
     101             :     DECL_LINK(DeleteHdl_Impl, PushButton*);
     102             :     DECL_LINK(IncludeHdl_Impl, RadioButton*);
     103             : 
     104             :     using Window::SetSettings;
     105             : 
     106             : public:
     107             :     SwSelectAddressBlockDialog(Window* pParent, SwMailMergeConfigItem& rConfig);
     108             :     virtual ~SwSelectAddressBlockDialog();
     109             : 
     110             :     void    SetAddressBlocks(const com::sun::star::uno::Sequence< OUString>& rBlocks,
     111             :                                 sal_uInt16 nSelected);
     112             :     const com::sun::star::uno::Sequence< OUString>&    GetAddressBlocks();
     113             : 
     114             :     void                SetSettings(sal_Bool bIsCountry, const OUString& sCountry);
     115           0 :     sal_Bool            IsIncludeCountry() const {return !m_pNeverRB->IsChecked();}
     116             :     OUString     GetCountry() const;
     117             : };
     118             : 
     119             : class SwCustomizeAddressBlockDialog;
     120           0 : class DDListBox : public SvTreeListBox
     121             : {
     122             :     SwCustomizeAddressBlockDialog*   m_pParentDialog;
     123             : public:
     124             :     DDListBox(Window* pParent, const WinBits nStyle);
     125             : 
     126             :     void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent);
     127             : 
     128             :     virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
     129             : };
     130             : 
     131             : #define MOVE_ITEM_LEFT           1
     132             : #define MOVE_ITEM_RIGHT          2
     133             : #define MOVE_ITEM_UP             4
     134             : #define MOVE_ITEM_DOWN           8
     135             : 
     136             : class AddressMultiLineEdit : public VclMultiLineEdit, public SfxListener
     137             : {
     138             :     Link                            m_aSelectionLink;
     139             :     SwCustomizeAddressBlockDialog*  m_pParentDialog;
     140             : 
     141             :     using VclMultiLineEdit::Notify;
     142             : 
     143             :     using VclMultiLineEdit::SetText;
     144             : 
     145             : protected:
     146             :     bool            PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     147             : public:
     148             :     AddressMultiLineEdit(Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER);
     149             :     virtual ~AddressMultiLineEdit();
     150             : 
     151             :     void            SetAddressDialog(SwCustomizeAddressBlockDialog *pParent);
     152             : 
     153             :     virtual void    Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     154             : 
     155             :     virtual Size    GetOptimalSize() const SAL_OVERRIDE;
     156             : 
     157           0 :     void            SetSelectionChangedHdl( const Link& rLink ) {m_aSelectionLink = rLink;}
     158             : 
     159             :     void            SetText( const OUString& rStr ) SAL_OVERRIDE;
     160             :     OUString        GetAddress();
     161             : 
     162             :     void            InsertNewEntry( const OUString& rStr );
     163             :     void            InsertNewEntryAtPosition( const OUString& rStr, sal_uLong nPara, sal_uInt16 nIndex );
     164             :     void            RemoveCurrentEntry();
     165             : 
     166             :     void            MoveCurrentItem(sal_uInt16 nMove);
     167             :     sal_uInt16      IsCurrentItemMoveable();
     168             :     bool            HasCurrentItem();
     169             :     OUString        GetCurrentItem();
     170             :     void            SelectCurrentItem();
     171             : };
     172             : 
     173             : // Dialog is used to create custom address blocks as well as custom greeting lines
     174           0 : class SwRestrictedComboBox : public ComboBox
     175             : {
     176             :     OUString sForbiddenChars;
     177             : 
     178             : protected:
     179             :     virtual void KeyInput( const KeyEvent& ) SAL_OVERRIDE;
     180             :     virtual void        Modify() SAL_OVERRIDE;
     181             : public:
     182           0 :     SwRestrictedComboBox(Window* pParent, WinBits nStyle = 0)
     183           0 :         : ComboBox( pParent, nStyle )
     184             :     {
     185           0 :     }
     186             : 
     187             :     void SetForbiddenChars(const OUString& rSet){sForbiddenChars = rSet;}
     188             : 
     189             : };
     190             : class SwCustomizeAddressBlockDialog : public SfxModalDialog
     191             : {
     192             :     friend class DDListBox;
     193             :     friend class AddressMultiLineEdit;
     194             : public:
     195             :     enum DialogType
     196             :     {
     197             :         ADDRESSBLOCK_NEW,
     198             :         ADDRESSBLOCK_EDIT,
     199             :         GREETING_FEMALE,
     200             :         GREETING_MALE
     201             :     };
     202             : private:
     203             :     FixedText*              m_pAddressElementsFT;
     204             :     DDListBox*              m_pAddressElementsLB;
     205             : 
     206             :     PushButton*             m_pInsertFieldIB;
     207             :     PushButton*             m_pRemoveFieldIB;
     208             : 
     209             :     FixedText*              m_pDragFT;
     210             :     AddressMultiLineEdit*   m_pDragED;
     211             :     PushButton*             m_pUpIB;
     212             :     PushButton*             m_pLeftIB;
     213             :     PushButton*             m_pRightIB;
     214             :     PushButton*             m_pDownIB;
     215             : 
     216             :     FixedText*              m_pFieldFT;
     217             :     SwRestrictedComboBox*   m_pFieldCB;
     218             : 
     219             :     SwAddressPreview*       m_pPreviewWIN;
     220             : 
     221             :     OKButton*               m_pOK;
     222             : 
     223             :     ::std::vector<OUString>   m_aSalutations;
     224             :     ::std::vector<OUString>   m_aPunctuations;
     225             : 
     226             :     OUString                m_sCurrentSalutation;
     227             :     OUString                m_sCurrentPunctuation;
     228             :     OUString                m_sCurrentText;
     229             : 
     230             :     SwMailMergeConfigItem&  m_rConfigItem;
     231             :     DialogType              m_eType;
     232             : 
     233             :     DECL_LINK(OKHdl_Impl, void *);
     234             :     DECL_LINK(ListBoxSelectHdl_Impl, DDListBox*);
     235             :     DECL_LINK(EditModifyHdl_Impl, void *);
     236             :     DECL_LINK(ImageButtonHdl_Impl, ImageButton*);
     237             :     DECL_LINK(SelectionChangedHdl_Impl, AddressMultiLineEdit*);
     238             :     DECL_LINK(FieldChangeHdl_Impl, void *);
     239             : 
     240             :     bool            HasItem_Impl(sal_Int32 nUserData);
     241             :     sal_Int32       GetSelectedItem_Impl();
     242             :     void            UpdateImageButtons_Impl();
     243             : 
     244             : public:
     245             :     SwCustomizeAddressBlockDialog(Window* pParent, SwMailMergeConfigItem& rConfig, DialogType);
     246             :     virtual ~SwCustomizeAddressBlockDialog();
     247             : 
     248             :     void            SetAddress(const OUString& rAddress);
     249             :     OUString GetAddress();
     250             : };
     251             : 
     252             : class SwAssignFieldsControl;
     253             : class SwAssignFieldsDialog : public SfxModalDialog
     254             : {
     255             :     FixedInfo               m_aMatchingFI;
     256             :     SwAssignFieldsControl*  m_pFieldsControl;
     257             : 
     258             :     FixedInfo               m_aPreviewFI;
     259             :     SwAddressPreview        m_aPreviewWIN;
     260             : 
     261             :     FixedLine               m_aSeparatorFL;
     262             : 
     263             :     OKButton                m_aOK;
     264             :     CancelButton            m_aCancel;
     265             :     HelpButton              m_aHelp;
     266             : 
     267             :     OUString                m_sNone;
     268             :     OUString                m_rPreviewString;
     269             : 
     270             :     SwMailMergeConfigItem&  m_rConfigItem;
     271             : 
     272             :     ::com::sun::star::uno::Sequence< OUString > CreateAssignments();
     273             :     DECL_LINK(OkHdl_Impl, void *);
     274             :     DECL_LINK(AssignmentModifyHdl_Impl, void*);
     275             : 
     276             : public:
     277             :     SwAssignFieldsDialog(Window* pParent,
     278             :                 SwMailMergeConfigItem& rConfigItem,
     279             :                 const OUString& rPreview,
     280             :                 bool bIsAddressBlock);
     281             :     virtual ~SwAssignFieldsDialog();
     282             : };
     283             : #endif
     284             : 
     285             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10