[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 2 commits - sfx2/source sw/source sw/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 1 16:26:58 UTC 2019


 sfx2/source/dialog/filedlghelper.cxx   |   20 +++
 sw/source/ui/dbui/mailmergewizard.cxx  |    2 
 sw/source/ui/dbui/mmlayoutpage.cxx     |  167 ++++++++++++++-------------------
 sw/source/ui/dbui/mmlayoutpage.hxx     |   51 ++++------
 sw/uiconfig/swriter/ui/mmlayoutpage.ui |   99 ++++++++-----------
 5 files changed, 156 insertions(+), 183 deletions(-)

New commits:
commit 2e62ca0e7dc4f39d1e4a3e2ca06801f106163fcd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri May 31 12:52:01 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Jun 1 18:26:38 2019 +0200

    weld SwMailMergeLayoutPage
    
    Change-Id: Iae43bcc3c0a94e9eca6d15384afd50d7a9a94c74
    Reviewed-on: https://gerrit.libreoffice.org/73311
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx
index 77535bf54f39..9e5b9ad2fc06 100644
--- a/sw/source/ui/dbui/mailmergewizard.cxx
+++ b/sw/source/ui/dbui/mailmergewizard.cxx
@@ -114,7 +114,7 @@ VclPtr<TabPage> SwMailMergeWizard::createPage(WizardState _nState)
             SetRoadmapHelpId("modules/swriter/ui/mmsalutationpage/MMSalutationPage");
         break;
         case MM_LAYOUTPAGE         :
-            pRet = VclPtr<SwMailMergeLayoutPage>::Create(this);
+            pRet = VclPtr<SwMailMergeLayoutPage>::Create(this, TabPageParent(this));
             SetRoadmapHelpId("modules/swriter/ui/mmlayoutpage/MMLayoutPage");
         break;
     }
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index cf2fcd450ae1..01cdb6b1576c 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -75,28 +75,22 @@ using namespace ::com::sun::star::view;
 #define DEFAULT_ADDRESS_WIDTH  (MM50*15)// 7,5 cm
 #define DEFAULT_ADDRESS_HEIGHT (MM50*7) // 3,5cm
 
-SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
-    svt::OWizardPage(_pParent, "MMLayoutPage",
-        "modules/swriter/ui/mmlayoutpage.ui")
+SwMailMergeLayoutPage::SwMailMergeLayoutPage(SwMailMergeWizard* pWizard, TabPageParent pParent)
+    : svt::OWizardPage(pParent, "modules/swriter/ui/mmlayoutpage.ui", "MMLayoutPage")
     , m_pExampleWrtShell(nullptr)
     , m_pAddressBlockFormat(nullptr)
     , m_bIsGreetingInserted(false)
-    , m_pWizard(_pParent)
+    , m_pWizard(pWizard)
+    , m_xPosition(m_xBuilder->weld_container("addresspos"))
+    , m_xAlignToBodyCB(m_xBuilder->weld_check_button("align"))
+    , m_xLeftFT(m_xBuilder->weld_label("leftft"))
+    , m_xLeftMF(m_xBuilder->weld_metric_spin_button("left", FieldUnit::CM))
+    , m_xTopMF(m_xBuilder->weld_metric_spin_button("top", FieldUnit::CM))
+    , m_xGreetingLine(m_xBuilder->weld_container("greetingspos"))
+    , m_xUpPB(m_xBuilder->weld_button("up"))
+    , m_xDownPB(m_xBuilder->weld_button("down"))
+    , m_xZoomLB(m_xBuilder->weld_combo_box("zoom"))
 {
-    get(m_pPosition, "addresspos");
-    get(m_pGreetingLine, "greetingspos");
-    get(m_pAlignToBodyCB, "align");
-    get(m_pLeftFT, "leftft");
-    get(m_pLeftMF, "left");
-    get(m_pTopMF, "top");
-    get(m_pUpPB, "up");
-    get(m_pDownPB, "down");
-    get(m_pExampleContainerWIN, "example");
-    Size aSize(LogicToPixel(Size(124, 159), MapMode(MapUnit::MapAppFont)));
-    m_pExampleContainerWIN->set_width_request(aSize.Width());
-    m_pExampleContainerWIN->set_height_request(aSize.Height());
-    get(m_pZoomLB, "zoom");
-
     std::shared_ptr<const SfxFilter> pSfxFlt = SwIoSystem::GetFilterOfFormat(
             FILTER_XML,
             SwDocShell::Factory().GetFilterContainer() );
@@ -122,40 +116,39 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
     uno::Reference< frame::XStorable > xStore( pView->GetDocShell()->GetModel(), uno::UNO_QUERY);
     xStore->storeToURL( m_sExampleURL, aValues   );
 
-    Link<SwOneExampleFrame&,void> aLink(LINK(this, SwMailMergeLayoutPage, PreviewLoadedHdl_Impl));
-    m_pExampleFrame.reset( new SwOneExampleFrame( *m_pExampleContainerWIN,
-                                    EX_SHOW_DEFAULT_PAGE, &aLink, &m_sExampleURL ) );
+    Link<OneExampleFrame&,void> aLink(LINK(this, SwMailMergeLayoutPage, PreviewLoadedHdl_Impl));
+    m_xExampleFrame.reset(new OneExampleFrame(EX_SHOW_DEFAULT_PAGE, &aLink, &m_sExampleURL));
+    m_xExampleContainerWIN.reset(new weld::CustomWeld(*m_xBuilder, "example", *m_xExampleFrame));
+
+    Size aSize = m_xExampleFrame->GetDrawingArea()->get_ref_device().LogicToPixel(
+            Size(124, 159), MapMode(MapUnit::MapAppFont));
+    m_xExampleFrame->set_size_request(aSize.Width(), aSize.Height());
 
-    m_pExampleContainerWIN->Show(false);
+    m_xExampleContainerWIN->hide();
 
-    m_pLeftMF->SetValue(m_pLeftMF->Normalize(DEFAULT_LEFT_DISTANCE), FieldUnit::TWIP);
-    m_pTopMF->SetValue(m_pTopMF->Normalize(DEFAULT_TOP_DISTANCE), FieldUnit::TWIP);
+    m_xLeftMF->set_value(m_xLeftMF->normalize(DEFAULT_LEFT_DISTANCE), FieldUnit::TWIP);
+    m_xTopMF->set_value(m_xTopMF->normalize(DEFAULT_TOP_DISTANCE), FieldUnit::TWIP);
 
     const LanguageTag& rLang = Application::GetSettings().GetUILanguageTag();
-    m_pZoomLB->InsertEntry(unicode::formatPercent(50, rLang), 1);
-    m_pZoomLB->InsertEntry(unicode::formatPercent(75, rLang), 2);
-    m_pZoomLB->InsertEntry(unicode::formatPercent(100, rLang), 3);
-    m_pZoomLB->SelectEntryPos(0); //page size
-    m_pZoomLB->SetSelectHdl(LINK(this, SwMailMergeLayoutPage, ZoomHdl_Impl));
-
-    Link<SpinField&,void> aFrameHdl = LINK(this, SwMailMergeLayoutPage, ChangeAddressHdl_Impl);
-    Link<Control&,void> aFocusHdl = LINK(this, SwMailMergeLayoutPage, ChangeAddressLoseFocusHdl_Impl);
-    m_pLeftMF->SetUpHdl(aFrameHdl);
-    m_pLeftMF->SetDownHdl(aFrameHdl);
-    m_pLeftMF->SetLoseFocusHdl(aFocusHdl);
-    m_pTopMF->SetUpHdl(aFrameHdl);
-    m_pTopMF->SetDownHdl(aFrameHdl);
-    m_pTopMF->SetLoseFocusHdl(aFocusHdl);
+    m_xZoomLB->append_text(unicode::formatPercent(50, rLang));
+    m_xZoomLB->append_text(unicode::formatPercent(75, rLang));
+    m_xZoomLB->append_text(unicode::formatPercent(100, rLang));
+    m_xZoomLB->set_active(0); //page size
+    m_xZoomLB->connect_changed(LINK(this, SwMailMergeLayoutPage, ZoomHdl_Impl));
+
+    Link<weld::MetricSpinButton&,void> aFrameHdl = LINK(this, SwMailMergeLayoutPage, ChangeAddressHdl_Impl);
+    m_xLeftMF->connect_value_changed(aFrameHdl);
+    m_xTopMF->connect_value_changed(aFrameHdl);
 
     FieldUnit eFieldUnit = ::GetDfltMetric(false);
-    ::SetFieldUnit( *m_pLeftMF, eFieldUnit );
-    ::SetFieldUnit( *m_pTopMF, eFieldUnit );
-
-    Link<Button*,void> aUpDownHdl = LINK(this, SwMailMergeLayoutPage, GreetingsHdl_Impl );
-    m_pUpPB->SetClickHdl(aUpDownHdl);
-    m_pDownPB->SetClickHdl(aUpDownHdl);
-    m_pAlignToBodyCB->SetClickHdl(LINK(this, SwMailMergeLayoutPage, AlignToTextHdl_Impl));
-    m_pAlignToBodyCB->Check();
+    ::SetFieldUnit( *m_xLeftMF, eFieldUnit );
+    ::SetFieldUnit( *m_xTopMF, eFieldUnit );
+
+    Link<weld::Button&,void> aUpDownHdl = LINK(this, SwMailMergeLayoutPage, GreetingsHdl_Impl );
+    m_xUpPB->connect_clicked(aUpDownHdl);
+    m_xDownPB->connect_clicked(aUpDownHdl);
+    m_xAlignToBodyCB->connect_toggled(LINK(this, SwMailMergeLayoutPage, AlignToTextHdl_Impl));
+    m_xAlignToBodyCB->set_active(true);
 }
 
 SwMailMergeLayoutPage::~SwMailMergeLayoutPage()
@@ -165,18 +158,7 @@ SwMailMergeLayoutPage::~SwMailMergeLayoutPage()
 
 void SwMailMergeLayoutPage::dispose()
 {
-    m_pExampleFrame.reset();
     File::remove( m_sExampleURL );
-    m_pPosition.clear();
-    m_pAlignToBodyCB.clear();
-    m_pLeftFT.clear();
-    m_pLeftMF.clear();
-    m_pTopMF.clear();
-    m_pGreetingLine.clear();
-    m_pUpPB.clear();
-    m_pDownPB.clear();
-    m_pExampleContainerWIN.clear();
-    m_pZoomLB.clear();
     m_pWizard.clear();
     svt::OWizardPage::dispose();
 }
@@ -187,10 +169,10 @@ void SwMailMergeLayoutPage::ActivatePage()
     bool bGreetingLine = rConfigItem.IsGreetingLine(false) && !rConfigItem.IsGreetingInserted();
     bool bAddressBlock = rConfigItem.IsAddressBlock() && !rConfigItem.IsAddressInserted();
 
-    m_pPosition->Enable(bAddressBlock);
-    AlignToTextHdl_Impl(m_pAlignToBodyCB);
+    m_xPosition->set_sensitive(bAddressBlock);
+    AlignToTextHdl_Impl(*m_xAlignToBodyCB);
 
-    m_pGreetingLine->Enable(bGreetingLine);
+    m_xGreetingLine->set_sensitive(bGreetingLine);
 
     //check if greeting and/or address frame have to be inserted/removed
     if(m_pExampleWrtShell) // initially there's nothing to check
@@ -222,15 +204,15 @@ void SwMailMergeLayoutPage::ActivatePage()
             }
             else
             {
-                long nLeft = static_cast< long >(m_pLeftMF->Denormalize(m_pLeftMF->GetValue(FieldUnit::TWIP)));
-                long nTop  = static_cast< long >(m_pTopMF->Denormalize(m_pTopMF->GetValue(FieldUnit::TWIP)));
+                long nLeft = static_cast< long >(m_xLeftMF->denormalize(m_xLeftMF->get_value(FieldUnit::TWIP)));
+                long nTop  = static_cast< long >(m_xTopMF->denormalize(m_xTopMF->get_value(FieldUnit::TWIP)));
                 m_pAddressBlockFormat = InsertAddressFrame(
                         *m_pExampleWrtShell, m_pWizard->GetConfigItem(),
                         Point(nLeft, nTop),
-                        m_pAlignToBodyCB->IsChecked(), true);
+                        m_xAlignToBodyCB->get_active(), true);
             }
         }
-
+        m_xExampleFrame->Invalidate();
     }
 }
 
@@ -240,13 +222,13 @@ bool SwMailMergeLayoutPage::commitPage(::svt::WizardTypes::CommitPageReason eRea
     SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
     if (eReason == ::svt::WizardTypes::eTravelForward || eReason == ::svt::WizardTypes::eFinish)
     {
-        long nLeft = static_cast< long >(m_pLeftMF->Denormalize(m_pLeftMF->GetValue(FieldUnit::TWIP)));
-        long nTop  = static_cast< long >(m_pTopMF->Denormalize(m_pTopMF->GetValue(FieldUnit::TWIP)));
+        long nLeft = static_cast< long >(m_xLeftMF->denormalize(m_xLeftMF->get_value(FieldUnit::TWIP)));
+        long nTop  = static_cast< long >(m_xTopMF->denormalize(m_xTopMF->get_value(FieldUnit::TWIP)));
         InsertAddressAndGreeting(
                     m_pWizard->GetSwView(),
                     rConfigItem,
                     Point(nLeft, nTop),
-                    m_pAlignToBodyCB->IsChecked());
+                    m_xAlignToBodyCB->get_active());
     }
     return true;
 }
@@ -623,11 +605,11 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
     OSL_ENSURE(nullptr == rShell.GetTableFormat(), "What to do with a table here?");
 }
 
-IMPL_LINK_NOARG(SwMailMergeLayoutPage, PreviewLoadedHdl_Impl, SwOneExampleFrame&, void)
+IMPL_LINK_NOARG(SwMailMergeLayoutPage, PreviewLoadedHdl_Impl, OneExampleFrame&, void)
 {
-    m_pExampleContainerWIN->Show();
+    m_xExampleContainerWIN->show();
 
-    Reference< XModel > & xModel = m_pExampleFrame->GetModel();
+    Reference< XModel > & xModel = m_xExampleFrame->GetModel();
     //now the ViewOptions should be set properly
     Reference< XViewSettingsSupplier >  xSettings(xModel->getCurrentController(), UNO_QUERY);
     m_xViewProperties = xSettings->getViewSettings();
@@ -645,7 +627,7 @@ IMPL_LINK_NOARG(SwMailMergeLayoutPage, PreviewLoadedHdl_Impl, SwOneExampleFrame&
         m_pAddressBlockFormat = InsertAddressFrame(
                 *m_pExampleWrtShell, rConfigItem,
                 Point(DEFAULT_LEFT_DISTANCE, DEFAULT_TOP_DISTANCE),
-                m_pAlignToBodyCB->IsChecked(), true);
+                m_xAlignToBodyCB->get_active(), true);
     }
     if(rConfigItem.IsGreetingLine(false))
     {
@@ -653,23 +635,21 @@ IMPL_LINK_NOARG(SwMailMergeLayoutPage, PreviewLoadedHdl_Impl, SwOneExampleFrame&
         m_bIsGreetingInserted = true;
     }
 
-    Any aZoom;
-    aZoom <<= sal_Int16(DocumentZoomType::ENTIRE_PAGE);
-    m_xViewProperties->setPropertyValue(UNO_NAME_ZOOM_TYPE, aZoom);
+    ZoomHdl_Impl(*m_xZoomLB);
 
     const SwFormatFrameSize& rPageSize = m_pExampleWrtShell->GetPageDesc(
                                      m_pExampleWrtShell->GetCurPageDesc()).GetMaster().GetFrameSize();
-    m_pLeftMF->SetMax(rPageSize.GetWidth() - DEFAULT_LEFT_DISTANCE);
-    m_pTopMF->SetMax(rPageSize.GetHeight() - DEFAULT_TOP_DISTANCE);
+    m_xLeftMF->set_max(rPageSize.GetWidth() - DEFAULT_LEFT_DISTANCE, FieldUnit::NONE);
+    m_xTopMF->set_max(rPageSize.GetHeight() - DEFAULT_TOP_DISTANCE, FieldUnit::NONE);
 }
 
-IMPL_LINK(SwMailMergeLayoutPage, ZoomHdl_Impl, ListBox&, rBox, void)
+IMPL_LINK(SwMailMergeLayoutPage, ZoomHdl_Impl, weld::ComboBox&, rBox, void)
 {
-    if(m_pExampleWrtShell)
+    if (m_pExampleWrtShell)
     {
         sal_Int16 eType = DocumentZoomType::BY_VALUE;
         short nZoom = 50;
-        switch(rBox.GetSelectedEntryPos())
+        switch (rBox.get_active())
         {
             case 0 : eType = DocumentZoomType::ENTIRE_PAGE; break;
             case 1 : nZoom = 50; break;
@@ -682,35 +662,33 @@ IMPL_LINK(SwMailMergeLayoutPage, ZoomHdl_Impl, ListBox&, rBox, void)
         aZoom <<= nZoom;
         m_xViewProperties->setPropertyValue(UNO_NAME_ZOOM_VALUE, aZoom);
 
+        m_xExampleFrame->Invalidate();
     }
 }
 
-IMPL_LINK_NOARG(SwMailMergeLayoutPage, ChangeAddressLoseFocusHdl_Impl, Control&, void)
-{
-    ChangeAddressHdl_Impl(*m_pLeftMF);
-}
-IMPL_LINK_NOARG(SwMailMergeLayoutPage, ChangeAddressHdl_Impl, SpinField&, void)
+IMPL_LINK_NOARG(SwMailMergeLayoutPage, ChangeAddressHdl_Impl, weld::MetricSpinButton&, void)
 {
     if(m_pExampleWrtShell && m_pAddressBlockFormat)
     {
-        long nLeft = static_cast< long >(m_pLeftMF->Denormalize(m_pLeftMF->GetValue(FieldUnit::TWIP)));
-        long nTop  = static_cast< long >(m_pTopMF->Denormalize(m_pTopMF->GetValue(FieldUnit::TWIP)));
+        long nLeft = static_cast< long >(m_xLeftMF->denormalize(m_xLeftMF->get_value(FieldUnit::TWIP)));
+        long nTop  = static_cast< long >(m_xTopMF->denormalize(m_xTopMF->get_value(FieldUnit::TWIP)));
 
         SfxItemSet aSet(
             m_pExampleWrtShell->GetAttrPool(),
             svl::Items<RES_VERT_ORIENT, RES_ANCHOR>{});
-        if(m_pAlignToBodyCB->IsChecked())
+        if (m_xAlignToBodyCB->get_active())
             aSet.Put(SwFormatHoriOrient( 0, text::HoriOrientation::NONE, text::RelOrientation::PAGE_PRINT_AREA ));
         else
             aSet.Put(SwFormatHoriOrient( nLeft, text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
         aSet.Put(SwFormatVertOrient( nTop, text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
         m_pExampleWrtShell->GetDoc()->SetFlyFrameAttr( *m_pAddressBlockFormat, aSet );
+        m_xExampleFrame->Invalidate();
     }
 }
 
-IMPL_LINK(SwMailMergeLayoutPage, GreetingsHdl_Impl, Button*, pButton, void)
+IMPL_LINK(SwMailMergeLayoutPage, GreetingsHdl_Impl, weld::Button&, rButton, void)
 {
-    bool bDown = pButton == m_pDownPB;
+    bool bDown = &rButton == m_xDownPB.get();
     bool bMoved = m_pExampleWrtShell->MoveParagraph( bDown ? 1 : -1 );
     if (bMoved || bDown)
         m_pWizard->GetConfigItem().MoveGreeting(bDown ? 1 : -1 );
@@ -719,14 +697,15 @@ IMPL_LINK(SwMailMergeLayoutPage, GreetingsHdl_Impl, Button*, pButton, void)
         //insert a new paragraph before the greeting line
         m_pExampleWrtShell->SplitNode();
     }
+    m_xExampleFrame->Invalidate();
 }
 
-IMPL_LINK(SwMailMergeLayoutPage, AlignToTextHdl_Impl, Button*, pBox, void)
+IMPL_LINK(SwMailMergeLayoutPage, AlignToTextHdl_Impl, weld::ToggleButton&, rBox, void)
 {
-    bool bCheck = static_cast<CheckBox*>(pBox)->IsChecked() && pBox->IsEnabled();
-    m_pLeftFT->Enable(!bCheck);
-    m_pLeftMF->Enable(!bCheck);
-    ChangeAddressHdl_Impl( *m_pLeftMF );
+    bool bCheck = rBox.get_active() && rBox.get_sensitive();
+    m_xLeftFT->set_sensitive(!bCheck);
+    m_xLeftMF->set_sensitive(!bCheck);
+    ChangeAddressHdl_Impl( *m_xLeftMF );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/mmlayoutpage.hxx b/sw/source/ui/dbui/mmlayoutpage.hxx
index 56be9e26f996..4d8c810a4a6d 100644
--- a/sw/source/ui/dbui/mmlayoutpage.hxx
+++ b/sw/source/ui/dbui/mmlayoutpage.hxx
@@ -29,7 +29,7 @@
 
 class SwMailMergeWizard;
 class SwFrameFormat;
-class SwOneExampleFrame;
+class OneExampleFrame;
 class SwWrtShell;
 class SwView;
 
@@ -37,26 +37,10 @@ namespace com{ namespace sun{ namespace star{ namespace beans{ class XPropertySe
 
 class SwMailMergeLayoutPage : public svt::OWizardPage
 {
-    VclPtr<VclContainer>       m_pPosition;
-
-    VclPtr<CheckBox>           m_pAlignToBodyCB;
-    VclPtr<FixedText>          m_pLeftFT;
-    VclPtr<MetricField>        m_pLeftMF;
-    VclPtr<MetricField>        m_pTopMF;
-
-    VclPtr<VclContainer>       m_pGreetingLine;
-    VclPtr<PushButton>         m_pUpPB;
-    VclPtr<PushButton>         m_pDownPB;
-
-    VclPtr<vcl::Window>             m_pExampleContainerWIN;
-
-    VclPtr<ListBox>            m_pZoomLB;
-
-    std::unique_ptr<SwOneExampleFrame> m_pExampleFrame;
     SwWrtShell*         m_pExampleWrtShell;
 
     OUString            m_sExampleURL;
-    SwFrameFormat*           m_pAddressBlockFormat;
+    SwFrameFormat*      m_pAddressBlockFormat;
 
     bool                m_bIsGreetingInserted;
 
@@ -64,14 +48,25 @@ class SwMailMergeLayoutPage : public svt::OWizardPage
 
     css::uno::Reference< css::beans::XPropertySet >  m_xViewProperties;
 
-    DECL_LINK(PreviewLoadedHdl_Impl, SwOneExampleFrame&, void);
-    DECL_LINK(ZoomHdl_Impl, ListBox&, void);
-    DECL_LINK(ChangeAddressHdl_Impl, SpinField&, void);
-    DECL_LINK(ChangeAddressLoseFocusHdl_Impl, Control&, void);
-    DECL_LINK(GreetingsHdl_Impl, Button*, void);
-    DECL_LINK(AlignToTextHdl_Impl, Button*, void);
-
-    static SwFrameFormat*        InsertAddressFrame(
+    std::unique_ptr<weld::Container> m_xPosition;
+    std::unique_ptr<weld::CheckButton> m_xAlignToBodyCB;
+    std::unique_ptr<weld::Label> m_xLeftFT;
+    std::unique_ptr<weld::MetricSpinButton> m_xLeftMF;
+    std::unique_ptr<weld::MetricSpinButton> m_xTopMF;
+    std::unique_ptr<weld::Container> m_xGreetingLine;
+    std::unique_ptr<weld::Button> m_xUpPB;
+    std::unique_ptr<weld::Button> m_xDownPB;
+    std::unique_ptr<weld::ComboBox> m_xZoomLB;
+    std::unique_ptr<OneExampleFrame> m_xExampleFrame;
+    std::unique_ptr<weld::CustomWeld> m_xExampleContainerWIN;
+
+    DECL_LINK(PreviewLoadedHdl_Impl, OneExampleFrame&, void);
+    DECL_LINK(ZoomHdl_Impl, weld::ComboBox&, void);
+    DECL_LINK(ChangeAddressHdl_Impl, weld::MetricSpinButton&, void);
+    DECL_LINK(GreetingsHdl_Impl, weld::Button&, void);
+    DECL_LINK(AlignToTextHdl_Impl, weld::ToggleButton&, void);
+
+    static SwFrameFormat* InsertAddressFrame(
                             SwWrtShell& rShell,
                             SwMailMergeConfigItem const & rConfigItem,
                             const Point& rDestination,
@@ -82,8 +77,8 @@ class SwMailMergeLayoutPage : public svt::OWizardPage
     virtual void        ActivatePage() override;
     virtual bool        commitPage(::svt::WizardTypes::CommitPageReason _eReason) override;
 public:
-        SwMailMergeLayoutPage( SwMailMergeWizard* _pParent);
-        virtual ~SwMailMergeLayoutPage() override;
+    SwMailMergeLayoutPage(SwMailMergeWizard* pWizard, TabPageParent pParent);
+    virtual ~SwMailMergeLayoutPage() override;
     virtual void            dispose() override;
 
     static SwFrameFormat*        InsertAddressAndGreeting(SwView const * pView,
diff --git a/sw/uiconfig/swriter/ui/mmlayoutpage.ui b/sw/uiconfig/swriter/ui/mmlayoutpage.ui
index 90b7485c49de..74fc9bc422b6 100644
--- a/sw/uiconfig/swriter/ui/mmlayoutpage.ui
+++ b/sw/uiconfig/swriter/ui/mmlayoutpage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="adjustment1">
@@ -8,6 +8,11 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">999.99000000000001</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkBox" id="MMLayoutPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -70,22 +75,21 @@
                                       <object class="GtkLabel" id="label6">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
                                         <property name="label" translatable="yes" context="mmlayoutpage|label6">_From top</property>
                                         <property name="use_underline">True</property>
-                                        <property name="mnemonic_widget">top:0.00cm</property>
+                                        <property name="mnemonic_widget">top</property>
+                                        <property name="xalign">0</property>
                                       </object>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">0</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkSpinButton" id="top:0.00cm">
+                                      <object class="GtkSpinButton" id="top">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
+                                        <property name="activates_default">True</property>
                                         <property name="text" translatable="yes" context="mmlayoutpage|top">2.00</property>
                                         <property name="adjustment">adjustment1</property>
                                         <property name="digits">2</property>
@@ -94,16 +98,12 @@
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">0</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -124,8 +124,6 @@
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">0</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -134,19 +132,18 @@
                                         <property name="can_focus">False</property>
                                         <property name="column_spacing">12</property>
                                         <child>
-                                          <object class="GtkSpinButton" id="left:0.00cm">
+                                          <object class="GtkSpinButton" id="left">
                                             <property name="visible">True</property>
                                             <property name="can_focus">True</property>
-                                            <property name="text" translatable="no">2.00</property>
-                                            <property name="adjustment">adjustment1</property>
+                                            <property name="activates_default">True</property>
+                                            <property name="text">2.00</property>
+                                            <property name="adjustment">adjustment2</property>
                                             <property name="digits">2</property>
                                             <property name="value">2</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">1</property>
                                             <property name="top_attach">0</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -159,10 +156,10 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="margin_left">12</property>
-                                                <property name="xalign">0</property>
                                                 <property name="label" translatable="yes" context="mmlayoutpage|leftft">From _left</property>
                                                 <property name="use_underline">True</property>
-                                                <property name="mnemonic_widget">left:0.00cm</property>
+                                                <property name="mnemonic_widget">left</property>
+                                                <property name="xalign">0</property>
                                               </object>
                                               <packing>
                                                 <property name="expand">True</property>
@@ -174,24 +171,18 @@
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">0</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                       </object>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">1</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">1</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                               </object>
@@ -212,8 +203,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -238,32 +227,28 @@
                                   <object class="GtkLabel" id="label4">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="xalign">0</property>
                                     <property name="label" translatable="yes" context="mmlayoutpage|label4">Move</property>
                                     <property name="use_underline">True</property>
                                     <property name="mnemonic_widget">up</property>
+                                    <property name="xalign">0</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
                                   <object class="GtkLabel" id="label5">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="xalign">0</property>
                                     <property name="label" translatable="yes" context="mmlayoutpage|label5">Move</property>
                                     <property name="use_underline">True</property>
                                     <property name="mnemonic_widget">down</property>
+                                    <property name="xalign">0</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">1</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -277,8 +262,6 @@
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -292,8 +275,6 @@
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="top_attach">1</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                               </object>
@@ -314,16 +295,12 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -343,16 +320,14 @@
                           <object class="GtkLabel" id="label7">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="mmlayoutpage|label7">_Zoom</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">zoom</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -366,42 +341,54 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkBox" id="example">
+                      <object class="GtkScrolledWindow">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
                         <property name="vexpand">True</property>
-                        <property name="orientation">vertical</property>
+                        <property name="hscrollbar_policy">never</property>
+                        <property name="vscrollbar_policy">never</property>
+                        <property name="shadow_type">in</property>
                         <child>
-                          <placeholder/>
+                          <object class="GtkViewport">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkDrawingArea" id="example">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
+                                <property name="no_show_all">True</property>
+                                <property name="hexpand">True</property>
+                                <property name="vexpand">True</property>
+                                <child internal-child="accessible">
+                                  <object class="AtkObject" id="example-atkobject">
+                                    <property name="AtkObject::accessible-name" translatable="yes" context="mmlayoutpage|example-atkobject">Preview</property>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
                         </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
               </object>
commit ffc3975ef5dd1f3df35892d2ba2add7f09bd5a0d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri May 31 15:33:00 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Jun 1 18:26:23 2019 +0200

    Resolves: rhbz#1715109 add All files to the graphic import dialog
    
    to pick up things without extensions, for consistency with file->open
    
    Change-Id: Ib119fb0d053d1d288eee7cd17fa4f12dcb9956d7
    Reviewed-on: https://gerrit.libreoffice.org/73304
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 747a3e5cf2b0..dd6cde167da1 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1897,11 +1897,23 @@ void FileDialogHelper_Impl::addGraphicFilter()
 
     try
     {
-        OUString aAllFilterName = SfxResId(STR_SFX_IMPORT_ALL_IMAGES);
-        aAllFilterName = ::sfx2::addExtension( aAllFilterName, aExtensions, bIsInOpenMode, *this );
+        // if the extension is not "All files", insert "All images"
+        if (aExtensions != FILEDIALOG_FILTER_ALL)
+        {
+            OUString aAllFilterName = SfxResId(STR_SFX_IMPORT_ALL_IMAGES);
+            aAllFilterName = ::sfx2::addExtension( aAllFilterName, aExtensions, bIsInOpenMode, *this );
+            xFltMgr->appendFilter( aAllFilterName, aExtensions );
+            maSelectFilter = aAllFilterName; // and make it the default
+        }
+
+        // rhbz#1715109 always include All files *.* or *
+        OUString aAllFilesName = SfxResId( STR_SFX_FILTERNAME_ALL );
+        aAllFilesName = ::sfx2::addExtension( aAllFilesName, FILEDIALOG_FILTER_ALL, bIsInOpenMode, *this );
+        xFltMgr->appendFilter( aAllFilesName, FILEDIALOG_FILTER_ALL );
 
-        xFltMgr->appendFilter( aAllFilterName, aExtensions );
-        maSelectFilter = aAllFilterName;
+        // if the extension is "All files", make that the default
+        if (aExtensions == FILEDIALOG_FILTER_ALL)
+            maSelectFilter = aAllFilesName;
     }
     catch( const IllegalArgumentException& )
     {


More information about the Libreoffice-commits mailing list