sw/source/ui/dbui/mmaddressblockpage.cxx  |    8 
 sw/source/ui/dbui/mmgreetingspage.cxx     |    2 
 sw/source/ui/dbui/mmresultdialogs.cxx     |    2 
 sw/source/uibase/dbui/mailmergehelper.cxx |  252 ------------------------------
 sw/source/uibase/inc/mailmergehelper.hxx  |   56 ------
 5 files changed, 11 insertions(+), 309 deletions(-)

New commits:
commit 43a394e111a579b1d01ab2703101eabe6abfffbf
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Aug 22 17:26:21 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Aug 22 20:40:25 2019 +0200

    drop newly unused SwAddressPreview
    
    Change-Id: I84cf6570d048df86b4690cb70cc3e7a256303951
    Reviewed-on: https://gerrit.libreoffice.org/77972
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx 
b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 0edb9bddee1f..f4b7359be648 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -246,7 +246,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, 
AddressBlockSelectHdl_Impl, LinkPar
     const sal_uInt16 nSel = m_xSettings->GetSelectedAddress();
     const uno::Sequence< OUString> aBlocks =
                 m_pWizard->GetConfigItem().GetAddressBlocks();
-    m_xPreview->SetAddress(SwAddressPreview::FillData(aBlocks[nSel],
+    m_xPreview->SetAddress(AddressPreview::FillData(aBlocks[nSel],
                                                          
m_pWizard->GetConfigItem()));
     m_pWizard->GetConfigItem().SetCurrentAddressBlockIndex( nSel );
     GetWizard()->UpdateRoadmap();
@@ -291,7 +291,7 @@ void 
SwMailMergeAddressBlockPage::InsertDataHdl(weld::Button* pButton)
             const sal_uInt16 nSel = m_xSettings->GetSelectedAddress();
             const uno::Sequence< OUString> aBlocks =
                         m_pWizard->GetConfigItem().GetAddressBlocks();
-            m_xPreview->SetAddress(SwAddressPreview::FillData(aBlocks[nSel], 
rConfig));
+            m_xPreview->SetAddress(AddressPreview::FillData(aBlocks[nSel], 
rConfig));
         }
     }
     m_xPrevSetIB->set_sensitive(bEnable);
@@ -569,7 +569,7 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, 
ListBoxSelectHdl_Impl, weld::TreeView&,
 
 IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, EditModifyHdl_Impl, 
AddressMultiLineEdit&, void)
 {
-    m_xPreview->SetAddress(SwAddressPreview::FillData(GetAddress(), 
m_rConfigItem));
+    m_xPreview->SetAddress(AddressPreview::FillData(GetAddress(), 
m_rConfigItem));
     UpdateImageButtons_Impl();
 }
 
@@ -1026,7 +1026,7 @@ IMPL_LINK_NOARG(SwAssignFieldsDialog, OkHdl_Impl, 
weld::Button&, void)
 IMPL_LINK_NOARG(SwAssignFieldsDialog, AssignmentModifyHdl_Impl, 
LinkParamNone*, void)
 {
     uno::Sequence< OUString > aAssignments = CreateAssignments();
-    const OUString sPreview = SwAddressPreview::FillData(
+    const OUString sPreview = AddressPreview::FillData(
             m_rPreviewString, m_rConfigItem, &aAssignments);
     m_xPreview->SetAddress(sPreview);
 }
diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx 
b/sw/source/ui/dbui/mmgreetingspage.cxx
index b80cc86480d7..92ae1631111f 100644
--- a/sw/source/ui/dbui/mmgreetingspage.cxx
+++ b/sw/source/ui/dbui/mmgreetingspage.cxx
@@ -173,7 +173,7 @@ void SwMailMergeGreetingsPage::UpdatePreview()
     OUString sPreview = bFemale ? m_xFemaleLB->get_active_text() :
         bNoValue ? m_xNeutralCB->get_active_text() : 
m_xMaleLB->get_active_text();
 
-    sPreview = SwAddressPreview::FillData(sPreview, m_rConfigItem);
+    sPreview = AddressPreview::FillData(sPreview, m_rConfigItem);
     m_xPreview->SetAddress(sPreview);
 }
 
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx 
b/sw/source/ui/dbui/mmresultdialogs.cxx
index f107758feda0..912cb9a3f8cd 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -1134,7 +1134,7 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, 
SendDocumentsHdl_Impl, weld::Button&, voi
                         SwMailMergeConfigItem::FEMALE :
                         SwMailMergeConfigItem::MALE;
 
-                    sGreeting = SwAddressPreview::FillData(
+                    sGreeting = AddressPreview::FillData(
                         xConfigItem->GetGreetings(eGenderType)
                         [xConfigItem->GetCurrentGreeting(eGenderType)],
                             *xConfigItem);
diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx 
b/sw/source/uibase/dbui/mailmergehelper.cxx
index bbf60a49dd63..4d1aa49f3445 100644
--- a/sw/source/uibase/dbui/mailmergehelper.cxx
+++ b/sw/source/uibase/dbui/mailmergehelper.cxx
@@ -180,257 +180,7 @@ struct  SwAddressPreview_Impl
     }
 };
 
-SwAddressPreview::SwAddressPreview(vcl::Window* pParent, WinBits nStyle)
-    : Window( pParent, nStyle )
-    , aVScrollBar(VclPtr<ScrollBar>::Create(this, WB_VSCROLL))
-    , pImpl(new SwAddressPreview_Impl())
-{
-    aVScrollBar->SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl));
-    positionScrollBar();
-    Show();
-}
-
-SwAddressPreview::~SwAddressPreview()
-{
-    disposeOnce();
-}
-
-void SwAddressPreview::dispose()
-{
-    aVScrollBar.disposeAndClear();
-    vcl::Window::dispose();
-}
-
-VCL_BUILDER_FACTORY_CONSTRUCTOR(SwAddressPreview, WB_TABSTOP)
-
-void SwAddressPreview::positionScrollBar()
-{
-    Size aSize(GetOutputSizePixel());
-    Size aScrollSize(aVScrollBar->get_preferred_size().Width(), 
aSize.Height());
-    aVScrollBar->SetSizePixel(aScrollSize);
-    Point aSrollPos(aSize.Width() - aScrollSize.Width(), 0);
-    aVScrollBar->SetPosPixel(aSrollPos);
-}
-
-void SwAddressPreview::Resize()
-{
-    Window::Resize();
-    positionScrollBar();
-}
-
-IMPL_LINK_NOARG(SwAddressPreview, ScrollHdl, ScrollBar*, void)
-{
-    Invalidate();
-}
-
-void SwAddressPreview::AddAddress(const OUString& rAddress)
-{
-    pImpl->aAddresses.push_back(rAddress);
-    UpdateScrollBar();
-}
-
-void SwAddressPreview::SetAddress(const OUString& rAddress)
-{
-    pImpl->aAddresses.clear();
-    pImpl->aAddresses.push_back(rAddress);
-    aVScrollBar->Show(false);
-    Invalidate();
-}
-
-sal_uInt16   SwAddressPreview::GetSelectedAddress()const
-{
-    OSL_ENSURE(pImpl->nSelectedAddress < pImpl->aAddresses.size(), "selection 
invalid");
-    return pImpl->nSelectedAddress;
-}
-
-void SwAddressPreview::SelectAddress(sal_uInt16 nSelect)
-{
-    OSL_ENSURE(pImpl->nSelectedAddress < pImpl->aAddresses.size(), "selection 
invalid");
-    pImpl->nSelectedAddress = nSelect;
-    // now make it visible..
-    sal_uInt16 nSelectRow = nSelect / pImpl->nColumns;
-    sal_uInt16 nStartRow = static_cast<sal_uInt16>(aVScrollBar->GetThumbPos());
-    if( (nSelectRow < nStartRow) || (nSelectRow >= (nStartRow + pImpl->nRows) 
))
-        aVScrollBar->SetThumbPos( nSelectRow );
-}
-
-void SwAddressPreview::Clear()
-{
-    pImpl->aAddresses.clear();
-    pImpl->nSelectedAddress = 0;
-    UpdateScrollBar();
-}
-
-void SwAddressPreview::SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns)
-{
-    pImpl->nRows = nRows;
-    pImpl->nColumns = nColumns;
-    UpdateScrollBar();
-}
-
-void SwAddressPreview::UpdateScrollBar()
-{
-    if(pImpl->nColumns)
-    {
-        aVScrollBar->SetVisibleSize(pImpl->nRows);
-        sal_uInt16 nResultingRows = 
static_cast<sal_uInt16>(pImpl->aAddresses.size() + pImpl->nColumns - 1) / 
pImpl->nColumns;
-        ++nResultingRows;
-        aVScrollBar->Show(pImpl->bEnableScrollBar && nResultingRows > 
pImpl->nRows);
-        aVScrollBar->SetRange(Range(0, nResultingRows));
-        if(aVScrollBar->GetThumbPos() > nResultingRows)
-            aVScrollBar->SetThumbPos(nResultingRows);
-    }
-}
-
-void SwAddressPreview::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle&)
-{
-    const StyleSettings& rSettings = 
rRenderContext.GetSettings().GetStyleSettings();
-    rRenderContext.SetFillColor(rSettings.GetWindowColor());
-    rRenderContext.SetLineColor(COL_TRANSPARENT);
-    rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), 
GetOutputSizePixel()));
-    Color aPaintColor(IsEnabled() ? rSettings.GetWindowTextColor() : 
rSettings.GetDisableColor());
-    rRenderContext.SetLineColor(aPaintColor);
-    vcl::Font aFont(rRenderContext.GetFont());
-    aFont.SetColor(aPaintColor);
-    rRenderContext.SetFont(aFont);
-
-    Size aSize(GetOutputSizePixel());
-    sal_uInt16 nStartRow = 0;
-    if(aVScrollBar->IsVisible())
-    {
-        aSize.AdjustWidth( -(aVScrollBar->GetSizePixel().Width()) );
-        nStartRow = static_cast<sal_uInt16>(aVScrollBar->GetThumbPos());
-    }
-    Size aPartSize(aSize.Width() / pImpl->nColumns,
-                   aSize.Height() / pImpl->nRows);
-    aPartSize.AdjustWidth( -2 );
-    aPartSize.AdjustHeight( -2 );
-
-    sal_uInt16 nAddress = nStartRow * pImpl->nColumns;
-    const sal_uInt16 nNumAddresses = 
static_cast<sal_uInt16>(pImpl->aAddresses.size());
-    for (sal_uInt16 nRow = 0; nRow < pImpl->nRows ; ++nRow)
-    {
-        for (sal_uInt16 nCol = 0; nCol < pImpl->nColumns; ++nCol)
-        {
-            if (nAddress >= nNumAddresses)
-                break;
-            Point aPos(nCol * aPartSize.Width(),
-                       nRow * aPartSize.Height());
-            aPos.Move(1, 1);
-            bool bIsSelected = nAddress == pImpl->nSelectedAddress;
-            if ((pImpl->nColumns * pImpl->nRows) == 1)
-                bIsSelected = false;
-            OUString adr(pImpl->aAddresses[nAddress]);
-            DrawText_Impl(rRenderContext, adr, aPos, aPartSize, bIsSelected);
-            ++nAddress;
-        }
-    }
-    rRenderContext.SetClipRegion();
-}
-
-void SwAddressPreview::MouseButtonDown( const MouseEvent& rMEvt )
-{
-    Window::MouseButtonDown(rMEvt);
-    if (rMEvt.IsLeft() && pImpl->nRows && pImpl->nColumns)
-    {
-        //determine the selected address
-        const Point& rMousePos = rMEvt.GetPosPixel();
-        Size aSize(GetOutputSizePixel());
-        Size aPartSize( aSize.Width()/pImpl->nColumns, 
aSize.Height()/pImpl->nRows );
-        sal_uInt32 nRow = rMousePos.Y() / aPartSize.Height() ;
-        if(aVScrollBar->IsVisible())
-        {
-            nRow += static_cast<sal_uInt16>(aVScrollBar->GetThumbPos());
-        }
-        sal_uInt32 nCol = rMousePos.X() / aPartSize.Width();
-        sal_uInt32 nSelect = nRow * pImpl->nColumns + nCol;
-
-        if( nSelect < pImpl->aAddresses.size() &&
-                pImpl->nSelectedAddress != static_cast<sal_uInt16>(nSelect))
-        {
-            pImpl->nSelectedAddress = static_cast<sal_uInt16>(nSelect);
-            m_aSelectHdl.Call(nullptr);
-        }
-        Invalidate();
-    }
-}
-
-void  SwAddressPreview::KeyInput( const KeyEvent& rKEvt )
-{
-    sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
-    bool bHandled = false;
-    if (pImpl->nRows && pImpl->nColumns)
-    {
-        sal_uInt32 nSelectedRow = pImpl->nSelectedAddress / pImpl->nColumns;
-        sal_uInt32 nSelectedColumn = pImpl->nSelectedAddress - (nSelectedRow * 
pImpl->nColumns);
-        switch(nKey)
-        {
-            case KEY_UP:
-                if(nSelectedRow)
-                    --nSelectedRow;
-                bHandled = true;
-            break;
-            case KEY_DOWN:
-                if(pImpl->aAddresses.size() > 
sal_uInt32(pImpl->nSelectedAddress + pImpl->nColumns))
-                    ++nSelectedRow;
-                bHandled = true;
-            break;
-            case KEY_LEFT:
-                if(nSelectedColumn)
-                    --nSelectedColumn;
-                bHandled = true;
-            break;
-            case KEY_RIGHT:
-                if(nSelectedColumn < sal_uInt32(pImpl->nColumns - 1) &&
-                       pImpl->aAddresses.size() - 1 > pImpl->nSelectedAddress )
-                    ++nSelectedColumn;
-                bHandled = true;
-            break;
-        }
-        sal_uInt32 nSelect = nSelectedRow * pImpl->nColumns + nSelectedColumn;
-        if( nSelect < pImpl->aAddresses.size() &&
-                pImpl->nSelectedAddress != static_cast<sal_uInt16>(nSelect))
-        {
-            pImpl->nSelectedAddress = static_cast<sal_uInt16>(nSelect);
-            m_aSelectHdl.Call(nullptr);
-            Invalidate();
-        }
-    }
-    if (!bHandled)
-        Window::KeyInput(rKEvt);
-}
-
-void SwAddressPreview::StateChanged( StateChangedType nStateChange )
-{
-    if (nStateChange == StateChangedType::Enable)
-        Invalidate();
-    Window::StateChanged(nStateChange);
-}
-
-void SwAddressPreview::DrawText_Impl(vcl::RenderContext& rRenderContext, const 
OUString& rAddress,
-                                     const Point& rTopLeft, const Size& rSize, 
bool bIsSelected)
-{
-    rRenderContext.SetClipRegion(vcl::Region(tools::Rectangle(rTopLeft, 
rSize)));
-    if (bIsSelected)
-    {
-        //selection rectangle
-        rRenderContext.SetFillColor(COL_TRANSPARENT);
-        rRenderContext.DrawRect(tools::Rectangle(rTopLeft, rSize));
-    }
-    sal_Int32 nHeight = GetTextHeight();
-    Point aStart = rTopLeft;
-    //put it away from the border
-    aStart.Move(2, 2);
-    sal_Int32 nPos = 0;
-    do
-    {
-        rRenderContext.DrawText(aStart, rAddress.getToken(0, '\n', nPos));
-        aStart.AdjustY(nHeight );
-    }
-    while (nPos >= 0);
-}
-
-OUString SwAddressPreview::FillData(
+OUString AddressPreview::FillData(
         const OUString& rAddress,
         SwMailMergeConfigItem const & rConfigItem,
         const Sequence< OUString>* pAssignments)
diff --git a/sw/source/uibase/inc/mailmergehelper.hxx 
b/sw/source/uibase/inc/mailmergehelper.hxx
index ae356c0b844d..67948190dfc8 100644
--- a/sw/source/uibase/inc/mailmergehelper.hxx
+++ b/sw/source/uibase/inc/mailmergehelper.hxx
@@ -57,58 +57,6 @@ struct SwAddressPreview_Impl;
 
 // Preview window used to show the possible selection of address blocks
 // and also the resulting address filled with database data
-class SW_DLLPUBLIC SwAddressPreview : public vcl::Window
-{
-    VclPtr<ScrollBar> aVScrollBar;
-    SwAddressPreview_Impl* pImpl;
-    Link<LinkParamNone*,void> m_aSelectHdl;
-
-    void DrawText_Impl(vcl::RenderContext& rRenderContext, const OUString& 
rAddress,
-                       const Point& rTopLeft, const Size& rSize, bool 
bIsSelected);
-
-    virtual void Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle&) override;
-    virtual void Resize() override;
-    virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
-    virtual void KeyInput( const KeyEvent& rKEvt ) override;
-    virtual void StateChanged( StateChangedType nStateChange ) override;
-    void UpdateScrollBar();
-
-    DECL_LINK(ScrollHdl, ScrollBar*,void);
-
-public:
-    SwAddressPreview(vcl::Window* pParent, WinBits nStyle);
-    virtual ~SwAddressPreview() override;
-    virtual void dispose() override;
-
-    void positionScrollBar();
-
-    /** The address string is a list of address elements separated by spaces
-    and breaks. The addresses fit into the given layout. If more addresses then
-    rows/columns should be used a scrollbar will be added.
-
-     AddAddress appends the new address to the already added ones.
-     Initially the first added address will be selected
-    */
-    void AddAddress(const OUString& rAddress);
-    //  for preview mode - replaces the currently used address by the given one
-    void SetAddress(const OUString& rAddress);
-    // removes all addresses
-    void Clear();
-
-    // returns the selected address
-    sal_uInt16 GetSelectedAddress() const;
-    void SelectAddress(sal_uInt16 nSelect);
-
-    // set the number of rows and columns of addresses
-    void SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns);
-
-    // fill the actual data into a string (address block or greeting)
-    static OUString FillData(const OUString& rAddress, SwMailMergeConfigItem 
const & rConfigItem,
-                             const css::uno::Sequence<OUString>* pAssignments 
= nullptr);
-
-    void SetSelectHdl (const Link<LinkParamNone*,void>& rLink) { m_aSelectHdl 
= rLink; }
-};
-
 class SW_DLLPUBLIC AddressPreview : public weld::CustomWidgetController
 {
     std::unique_ptr<SwAddressPreview_Impl> pImpl;
@@ -152,6 +100,10 @@ public:
     void SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns);
     void EnableScrollBar();
 
+    // fill the actual data into a string (address block or greeting)
+    static OUString FillData(const OUString& rAddress, SwMailMergeConfigItem 
const & rConfigItem,
+                             const css::uno::Sequence<OUString>* pAssignments 
= nullptr);
+
     void SetSelectHdl (const Link<LinkParamNone*,void>& rLink) { m_aSelectHdl 
= rLink; }
 };
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to