[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 4 commits - include/sfx2 sfx2/source solenv/bin vcl/osx

Caolán McNamara caolanm at redhat.com
Thu Nov 23 19:46:26 UTC 2017


 include/sfx2/dinfdlg.hxx                    |   34 +-
 sfx2/source/dialog/dinfdlg.cxx              |  383 ++++++++++------------------
 solenv/bin/modules/installer.pm             |    1 
 solenv/bin/modules/installer/scriptitems.pm |   10 
 vcl/osx/DataFlavorMapping.cxx               |    2 
 5 files changed, 168 insertions(+), 262 deletions(-)

New commits:
commit d7357db1c2b2092913fd33ad58b63ad473fbc9c4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 29 16:27:31 2017 +0100

    Resolves: tdf#95960 improve custom properties page
    
    wrt widget heights and positions and other flakiness
    
    take the natural combobox height as the line height, use a vclgrid
    element for each row to get everything set to the same height
    
    move the positioning code into Resize, etc.
    
    Reviewed-on: https://gerrit.libreoffice.org/41734
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 14afb688d3a24be302867ea614b0e30e01d168be)
    
    Reviewed-on: https://gerrit.libreoffice.org/41749
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 69f19b7d2e538c66bb89f2acaf6e4ad7b0305825)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>
    
    Change-Id: I22de98ef91e39d1e7e45bbe62f68496d55c0c1cb

diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 9ffbb3370e94..7915d7be345b 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -367,6 +367,7 @@ public:
 
 struct CustomPropertyLine
 {
+    ScopedVclPtr<VclGrid>                       m_aLine;
     ScopedVclPtr<ComboBox>                      m_aNameBox;
     ScopedVclPtr<CustomPropertiesTypeBox>       m_aTypeBox;
     ScopedVclPtr<CustomPropertiesEdit>          m_aValueEdit;
@@ -391,20 +392,15 @@ struct CustomPropertyLine
 class CustomPropertiesWindow : public vcl::Window
 {
 private:
+    VclPtr<HeaderBar>                   m_pHeaderBar;
+    VclPtr<ScrollBar>                   m_pScrollBar;
     VclPtr<FixedText>                   m_pHeaderAccName;
     VclPtr<FixedText>                   m_pHeaderAccType;
     VclPtr<FixedText>                   m_pHeaderAccValue;
 
-    VclPtr<ComboBox>                    m_aNameBox;
-    VclPtr<ListBox>                     m_aTypeBox;
-    VclPtr<Edit>                        m_aValueEdit;
-    VclPtr<DateField>                   m_aDateField;
-    VclPtr<TimeField>                   m_aTimeField;
-    VclPtr<Edit>                        m_aDurationField;
-    VclPtr<PushButton>                  m_aEditButton;
-    VclPtr<CustomPropertiesYesNoButton> m_aYesNoButton;
-    VclPtr<ImageButton>                 m_aRemoveButton;
-
+    sal_Int32                           m_nWidgetHeight;
+    sal_Int32                           m_nRemoveButtonWidth;
+    sal_Int32                           m_nTypeBoxWidth;
     sal_Int32                           m_nLineHeight;
     sal_Int32                           m_nScrollPos;
     std::vector< CustomPropertyLine* >  m_aCustomPropertiesLines;
@@ -414,10 +410,10 @@ private:
     Idle                                m_aBoxLoseFocusIdle;
     Link<void*,void>                    m_aRemovedHdl;
 
-    DECL_STATIC_LINK( CustomPropertiesWindow, TypeHdl, ListBox&, void );
-    DECL_LINK(  RemoveHdl, Button*, void );
-    DECL_LINK(  EditLoseFocusHdl, Control&, void );
-    DECL_LINK(  BoxLoseFocusHdl, Control&, void );
+    DECL_LINK(TypeHdl, ListBox&, void);
+    DECL_LINK(RemoveHdl, Button*, void);
+    DECL_LINK(EditLoseFocusHdl, Control&, void);
+    DECL_LINK(BoxLoseFocusHdl, Control&, void);
     //add lose focus handlers of Date/TimeField?
 
     DECL_LINK(EditTimeoutHdl, Idle *, void);
@@ -431,10 +427,18 @@ public:
         FixedText *pHeaderAccName,
         FixedText *pHeaderAccType,
         FixedText *pHeaderAccValue);
+    void Init(HeaderBar* pHeaderBar, ScrollBar* pScrollBar);
     virtual ~CustomPropertiesWindow() override;
     virtual void dispose() override;
 
-    bool                InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
+    virtual void Resize() override;
+    //these consts are unhelpful, this changes the state of the widgets
+    //that belong to CustomPropertyLine, but they are held by VclPtr
+    //and operator-> on a VclPtr is a const method that returns the
+    //non-const contents of the VclPtr, but loplugin:constparams
+    //correctly sees that it could all be set to const, so we end
+    //up with this unhappy situation
+    void SetWidgetWidths(const CustomPropertyLine* pLine) const;
     sal_uInt16          GetVisibleLineCount() const;
     inline sal_Int32    GetLineHeight() const { return m_nLineHeight; }
     void                AddLine( const OUString& sName, css::uno::Any& rAny );
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index f8dc73daedf5..95476788fa0e 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1390,11 +1390,11 @@ void CustomPropertiesYesNoButton::Resize()
 {
     Size aParentSize(GetSizePixel());
     const long nWidth = aParentSize.Width();
-    Size a1Size = LogicToPixel(Size(1, 1), MapUnit::MapAppFont);
+    const long n1Width = LogicToPixel(Size(1, 1), MapUnit::MapAppFont).Width();
     const long n3Width = LogicToPixel(Size(3, 3), MapUnit::MapAppFont).Width();
     const long nNewWidth = (nWidth / 2) - n3Width - 2;
-    Size aSize(nNewWidth, aParentSize.Height() - 2 * a1Size.Height());
-    Point aPos(a1Size.Width(), a1Size.Height());
+    Size aSize(nNewWidth, m_aYesButton->get_preferred_size().Height());
+    Point aPos(n1Width, (aParentSize.Height() - aSize.Height()) / 2);
     m_aYesButton->SetPosSizePixel(aPos, aSize);
     aPos.X() += aSize.Width() + n3Width;
     m_aNoButton->SetPosSizePixel(aPos, aSize);
@@ -1406,11 +1406,10 @@ namespace
     {
         VclPtr<ComboBox> aNameBox(VclPtr<ComboBox>::Create(pParent, WB_TABSTOP|WB_DROPDOWN|
                                                                     WB_AUTOSIZE|WB_AUTOHSCROLL));
-        aNameBox->SetPosSizePixel(aNameBox->LogicToPixel(Point(0, 2), MapUnit::MapAppFont),
-                                  aNameBox->LogicToPixel(Size(60, 72), MapUnit::MapAppFont));
         ResStringArray aStrArr(SfxResId(SFX_CB_PROPERTY_STRINGARRAY));
         for (sal_uInt32 i = 0; i < aStrArr.Count(); ++i)
             aNameBox->InsertEntry(aStrArr.GetString(i));
+        aNameBox->EnableAutoSize(true);
         return aNameBox;
     }
 }
@@ -1419,8 +1418,6 @@ CustomPropertiesTypeBox::CustomPropertiesTypeBox(vcl::Window* pParent, CustomPro
     : ListBox(pParent, WB_BORDER|WB_DROPDOWN)
     , m_pLine(pLine)
 {
-    SetPosSizePixel(LogicToPixel(Point(63, 2), MapUnit::MapAppFont),
-                    LogicToPixel(Size(60, 80), MapUnit::MapAppFont));
     ResStringArray aStrArr(SfxResId(SFX_LB_PROPERTY_STRINGARRAY));
     for (sal_uInt32 i = 0; i < aStrArr.Count(); ++i)
     {
@@ -1428,25 +1425,71 @@ CustomPropertiesTypeBox::CustomPropertiesTypeBox(vcl::Window* pParent, CustomPro
         SetEntryData(i, reinterpret_cast<void*>(aStrArr.GetValue(i)));
     }
     SelectEntryPos(0);
+    EnableAutoSize(true);
 }
 
 // struct CustomPropertyLine ---------------------------------------------
 CustomPropertyLine::CustomPropertyLine( vcl::Window* pParent ) :
-    m_aNameBox      ( makeComboBox(pParent) ),
-    m_aTypeBox      ( VclPtr<CustomPropertiesTypeBox>::Create(pParent, this) ),
-    m_aValueEdit    ( VclPtr<CustomPropertiesEdit>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ) ),
-    m_aDateField    ( VclPtr<CustomPropertiesDateField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
-    m_aTimeField    ( VclPtr<CustomPropertiesTimeField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
+    m_aLine         ( VclPtr<VclGrid>::Create(pParent) ),
+    m_aNameBox      ( makeComboBox(m_aLine) ),
+    m_aTypeBox      ( VclPtr<CustomPropertiesTypeBox>::Create(m_aLine, this) ),
+    m_aValueEdit    ( VclPtr<CustomPropertiesEdit>::Create(m_aLine, WB_BORDER|WB_TABSTOP|WB_LEFT, this ) ),
+    m_aDateField    ( VclPtr<CustomPropertiesDateField>::Create(m_aLine, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
+    m_aTimeField    ( VclPtr<CustomPropertiesTimeField>::Create(m_aLine, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
     m_sDurationFormat( SfxResId( SFX_ST_DURATION_FORMAT ).toString() ),
-    m_aDurationField( VclPtr<CustomPropertiesDurationField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ) ),
-    m_aEditButton   ( VclPtr<CustomPropertiesEditButton>::Create(pParent, WB_TABSTOP, this) ),
-    m_aYesNoButton  ( VclPtr<CustomPropertiesYesNoButton>::Create(pParent) ),
-    m_aRemoveButton ( VclPtr<CustomPropertiesRemoveButton>::Create(pParent, 0, this) ),
+    m_aDurationField( VclPtr<CustomPropertiesDurationField>::Create(m_aLine, WB_BORDER|WB_TABSTOP|WB_READONLY, this ) ),
+    m_aEditButton   ( VclPtr<CustomPropertiesEditButton>::Create(m_aLine, WB_TABSTOP, this) ),
+    m_aYesNoButton  ( VclPtr<CustomPropertiesYesNoButton>::Create(m_aLine) ),
+    m_aRemoveButton ( VclPtr<CustomPropertiesRemoveButton>::Create(m_aLine, 0, this) ),
     m_bIsDate       ( false ),
     m_bIsRemoved    ( false ),
     m_bTypeLostFocus( false )
-
 {
+    m_aLine->set_column_spacing(4);
+
+    m_aNameBox->set_grid_left_attach(0);
+    m_aNameBox->set_grid_top_attach(0);
+    m_aNameBox->set_margin_left(4);
+    m_aNameBox->Show();
+
+    m_aTypeBox->set_grid_left_attach(1);
+    m_aTypeBox->set_grid_top_attach(0);
+    m_aTypeBox->Show();
+
+    m_aValueEdit->set_grid_left_attach(2);
+    m_aValueEdit->set_grid_top_attach(0);
+    m_aValueEdit->set_hexpand(true);
+    m_aValueEdit->Show();
+
+    m_aDateField->set_grid_left_attach(3);
+    m_aDateField->set_grid_top_attach(0);
+    m_aDateField->set_hexpand(true);
+    m_aDateField->Show();
+
+    m_aTimeField->set_grid_left_attach(4);
+    m_aTimeField->set_grid_top_attach(0);
+    m_aTimeField->set_hexpand(true);
+    m_aTimeField->Show();
+
+    m_aDurationField->set_grid_left_attach(5);
+    m_aDurationField->set_grid_top_attach(0);
+    m_aDurationField->set_hexpand(true);
+    m_aDurationField->Show();
+
+    m_aEditButton->set_grid_left_attach(6);
+    m_aEditButton->set_grid_top_attach(0);
+    m_aEditButton->Show();
+
+    m_aYesNoButton->set_grid_left_attach(7);
+    m_aYesNoButton->set_grid_top_attach(0);
+    m_aYesNoButton->set_hexpand(true);
+    m_aYesNoButton->Show();
+
+    m_aRemoveButton->set_grid_left_attach(8);
+    m_aRemoveButton->set_grid_top_attach(0);
+    m_aRemoveButton->set_margin_right(4);
+    m_aRemoveButton->Show();
+
     m_aTimeField->SetExtFormat( ExtTimeFieldFormat::Long24H );
     m_aDateField->SetExtDateFormat( ExtDateFieldFormat::SystemShortYYYY );
 
@@ -1460,77 +1503,41 @@ void CustomPropertyLine::SetRemoved()
 {
     DBG_ASSERT( !m_bIsRemoved, "CustomPropertyLine::SetRemoved(): line already removed" );
     m_bIsRemoved = true;
-    m_aNameBox->Hide();
-    m_aTypeBox->Hide();
-    m_aValueEdit->Hide();
-    m_aDateField->Hide();
-    m_aTimeField->Hide();
-    m_aDurationField->Hide();
-    m_aEditButton->Hide();
-    m_aYesNoButton->Hide();
-    m_aRemoveButton->Hide();
+    m_aLine->Hide();
 }
 
 CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
     FixedText *pHeaderAccName,
     FixedText *pHeaderAccType,
     FixedText *pHeaderAccValue) :
-    Window(pParent, WB_HIDE | WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL),
+    Window(pParent, WB_HIDE | WB_TABSTOP | WB_DIALOGCONTROL),
     m_pHeaderAccName(pHeaderAccName),
     m_pHeaderAccType(pHeaderAccType),
     m_pHeaderAccValue(pHeaderAccValue),
-    m_aNameBox      ( makeComboBox(this) ),
-    m_aTypeBox      ( VclPtr<CustomPropertiesTypeBox>::Create(pParent, nullptr) ),
-    m_aValueEdit    ( VclPtr<Edit>::Create( this, WB_BORDER|WB_TABSTOP|WB_LEFT ) ),
-    m_aDateField    ( VclPtr<DateField>::Create( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
-    m_aTimeField    ( VclPtr<TimeField>::Create( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
-    m_aDurationField( VclPtr<Edit>::Create( this, WB_BORDER|WB_TABSTOP|WB_READONLY ) ),
-    m_aEditButton   ( VclPtr<PushButton>::Create( this, WB_TABSTOP ) ),
-    m_aYesNoButton  ( VclPtr<CustomPropertiesYesNoButton>::Create(this) ),
-    m_aRemoveButton ( VclPtr<ImageButton>::Create( this, 0 ) ),
     m_nScrollPos (0),
     m_pCurrentLine (nullptr),
     m_aNumberFormatter( ::comphelper::getProcessComponentContext(),
                         Application::GetSettings().GetLanguageTag().getLanguageType() )
 {
-    Point aPos(LogicToPixel(Point(159, 2), MapUnit::MapAppFont));
-
-    m_aEditButton->SetPosSizePixel(aPos,
-        LogicToPixel(Size(RSC_CD_TEXTBOX_HEIGHT, RSC_CD_TEXTBOX_HEIGHT), MapUnit::MapAppFont));
+    m_nRemoveButtonWidth = ScopedVclPtrInstance<CustomPropertiesRemoveButton>(pParent, 0, nullptr)->get_preferred_size().Width();
+    Size aSize = ScopedVclPtrInstance<CustomPropertiesTypeBox>(pParent, nullptr)->CalcMinimumSize();
+    m_nTypeBoxWidth = aSize.Width();
+    m_nWidgetHeight = aSize.Height();
 
-    m_aRemoveButton->SetSizePixel(LogicToPixel(Size(RSC_CD_PUSHBUTTON_HEIGHT, RSC_CD_PUSHBUTTON_HEIGHT), MapUnit::MapAppFont));
-
-    Size aSize(LogicToPixel(Size(61, RSC_CD_TEXTBOX_HEIGHT), MapUnit::MapAppFont));
-    m_aValueEdit->SetPosSizePixel(aPos, aSize);
-    m_aDurationField->SetPosSizePixel(aPos, aSize);
-    m_aDateField->SetPosSizePixel(aPos, aSize);
-    m_aTimeField->SetPosSizePixel(aPos, aSize);
-    m_aYesNoButton->SetPosSizePixel(aPos, aSize);
+    Point aPos(LogicToPixel(Point(0, 2), MapUnit::MapAppFont));
 
     m_aEditLoseFocusIdle.SetPriority( SchedulerPriority::LOWEST );
     m_aEditLoseFocusIdle.SetIdleHdl( LINK( this, CustomPropertiesWindow, EditTimeoutHdl ) );
     m_aBoxLoseFocusIdle.SetPriority( SchedulerPriority::LOWEST );
     m_aBoxLoseFocusIdle.SetIdleHdl( LINK( this, CustomPropertiesWindow, BoxTimeoutHdl ) );
 
-    m_aNameBox->add_mnemonic_label(m_pHeaderAccName);
-    m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText());
-    m_aTypeBox->add_mnemonic_label(m_pHeaderAccType);
-    m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText());
-    m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue);
-    m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText());
-
-    m_aNameBox->Hide();
-    m_aTypeBox->Hide();
-    m_aValueEdit->Hide();
-    m_aDateField->Hide();
-    m_aTimeField->Hide();
-    m_aDurationField->Hide();
-    m_aEditButton->Hide();
-    m_aYesNoButton->Hide();
-    m_aRemoveButton->Hide();
+    m_nLineHeight = (aPos.Y() * 2) + m_nWidgetHeight;
+}
 
-    m_nLineHeight =
-        ( m_aRemoveButton->GetPosPixel().Y() * 2 ) + m_aRemoveButton->GetSizePixel().Height();
+void CustomPropertiesWindow::Init(HeaderBar* pHeaderBar, ScrollBar* pScrollBar)
+{
+    m_pHeaderBar = pHeaderBar;
+    m_pScrollBar = pScrollBar;
 }
 
 CustomPropertiesWindow::~CustomPropertiesWindow()
@@ -1543,23 +1550,15 @@ void CustomPropertiesWindow::dispose()
     m_aEditLoseFocusIdle.Stop();
     m_aBoxLoseFocusIdle.Stop();
     ClearAllLines();
-    m_aNameBox.disposeAndClear();
-    m_aTypeBox.disposeAndClear();
-    m_aValueEdit.disposeAndClear();
-    m_aDateField.disposeAndClear();
-    m_aTimeField.disposeAndClear();
-    m_aDurationField.disposeAndClear();
-    m_aEditButton.disposeAndClear();
-    m_aYesNoButton.disposeAndClear();
-    m_aRemoveButton.disposeAndClear();
+    m_pHeaderBar.clear();
+    m_pScrollBar.clear();
     m_pHeaderAccName.clear();
     m_pHeaderAccType.clear();
     m_pHeaderAccValue.clear();
     vcl::Window::dispose();
 }
 
-IMPL_STATIC_LINK(
-    CustomPropertiesWindow, TypeHdl, ListBox&, rListBox, void )
+IMPL_LINK(CustomPropertiesWindow, TypeHdl, ListBox&, rListBox, void)
 {
     CustomPropertiesTypeBox* pBox = static_cast<CustomPropertiesTypeBox*>(&rListBox);
     long nType = reinterpret_cast<long>( pBox->GetSelectEntryData() );
@@ -1573,17 +1572,11 @@ IMPL_STATIC_LINK(
 
     //adjust positions of date and time controls
     if ( nType == CUSTOM_TYPE_DATE )
-    {
         pLine->m_bIsDate = true;
-        pLine->m_aDateField->SetSizePixel( pLine->m_aValueEdit->GetSizePixel() );
-    }
     else if ( nType == CUSTOM_TYPE_DATETIME)
-    {
-        // because m_aDateField and m_aTimeField have the same size for type "DateTime",
-        // we just rely on m_aTimeField here.
         pLine->m_bIsDate = false;
-        pLine->m_aDateField->SetSizePixel( pLine->m_aTimeField->GetSizePixel() );
-    }
+
+    pLine->m_aLine->SetSizePixel(Size(GetSizePixel().Width(), m_nWidgetHeight));
 }
 
 IMPL_LINK( CustomPropertiesWindow, RemoveHdl, Button*, pBtn, void )
@@ -1601,21 +1594,11 @@ IMPL_LINK( CustomPropertiesWindow, RemoveHdl, Button*, pBtn, void )
         for ( ; pIter != m_aCustomPropertiesLines.end(); ++pIter )
         {
             pLine = *pIter;
-            if ( pLine->m_bIsRemoved )
+            if (pLine->m_bIsRemoved)
                 continue;
-
-            vcl::Window* pWindows[] = {  pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(),
-                                    pLine->m_aDateField.get(), pLine->m_aTimeField.get(),
-                                    pLine->m_aDurationField.get(), pLine->m_aEditButton.get(),
-                                    pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), nullptr };
-            vcl::Window** pCurrent = pWindows;
-            while ( *pCurrent )
-            {
-                Point aPos = (*pCurrent)->GetPosPixel();
-                aPos.Y() -= nDelta;
-                (*pCurrent)->SetPosPixel( aPos );
-                pCurrent++;
-            }
+            Point aPos = pLine->m_aLine->GetPosPixel();
+            aPos.Y() -= nDelta;
+            pLine->m_aLine->SetPosPixel(aPos);
         }
     }
 
@@ -1691,74 +1674,51 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr
             pLine->m_bTypeLostFocus = true;
         vcl::Window* pParent = GetParent()->GetParent();
         if (ScopedVclPtrInstance<MessageDialog>(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VclMessageType::Question, VCL_BUTTONS_OK_CANCEL)->Execute() == RET_OK)
-            pLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast<void*>(CUSTOM_TYPE_TEXT) ) );
+            pLine->m_aTypeBox->SelectEntryPos(pLine->m_aTypeBox->GetEntryPos(reinterpret_cast<void*>(CUSTOM_TYPE_TEXT)));
         else
             pLine->m_aValueEdit->GrabFocus();
     }
 }
 
-bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar )
+void CustomPropertiesWindow::SetWidgetWidths(const CustomPropertyLine* pLine) const
 {
-    bool bChanged = false;
+    const long nOffset = 4;
+    long nItemWidth = m_pHeaderBar->GetItemSize(HI_NAME);
+    nItemWidth -= nOffset;
+
+    pLine->m_aNameBox->set_width_request(nItemWidth);
+    pLine->m_aTypeBox->set_width_request(m_nTypeBoxWidth);
+    pLine->m_aValueEdit->set_width_request(nItemWidth);
+
+    long nTimeWidth = nItemWidth;
+    nTimeWidth /= 2;
+    nTimeWidth -= 2;
 
-    DBG_ASSERT( pHeaderBar, "CustomPropertiesWindow::InitControls(): invalid headerbar" );
-    DBG_ASSERT( pScrollBar, "CustomPropertiesWindow::InitControls(): invalid scrollbar" );
+    pLine->m_aDateField->set_width_request(nTimeWidth);
+    pLine->m_aTimeField->set_width_request(nTimeWidth);
 
+    pLine->m_aDurationField->set_width_request(nItemWidth - (pLine->m_aEditButton->get_preferred_size().Width() + nOffset));
+    pLine->m_aYesNoButton->set_width_request(nItemWidth);
+    pLine->m_aRemoveButton->set_width_request(m_nRemoveButtonWidth);
+
+    pLine->m_aLine->SetSizePixel(Size(GetSizePixel().Width(), m_nWidgetHeight));
+}
+
+void CustomPropertiesWindow::Resize()
+{
     const long nOffset = 4;
-    const long nScrollBarWidth = pScrollBar->GetSizePixel().Width();
-    const long nButtonWidth = m_aRemoveButton->GetSizePixel().Width() + nScrollBarWidth + nOffset;
-    long nTypeWidth = m_aTypeBox->CalcMinimumSize().Width() + ( 2 * nOffset );
-    long nFullWidth = pHeaderBar->GetSizePixel().Width();
+    const long nScrollBarWidth = m_pScrollBar->GetSizePixel().Width();
+    long nButtonWidth = m_nRemoveButtonWidth + nScrollBarWidth + nOffset;
+    long nTypeWidth = m_nTypeBoxWidth + (2 * nOffset);
+    long nFullWidth = m_pHeaderBar->GetSizePixel().Width();
     long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2;
-    pHeaderBar->SetItemSize( HI_NAME, nItemWidth );
-    pHeaderBar->SetItemSize( HI_TYPE, nTypeWidth );
-    pHeaderBar->SetItemSize( HI_VALUE, nItemWidth );
-    pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth );
-
-    vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(), m_aRemoveButton.get(), nullptr };
-    vcl::Window** pCurrent = pWindows;
-    sal_uInt16 nPos = 0;
-    while ( *pCurrent )
-    {
-        Rectangle aRect = pHeaderBar->GetItemRect( pHeaderBar->GetItemId( nPos++ ) );
-        Size aOrigSize = (*pCurrent)->GetSizePixel();
-        Point aOrigPos = (*pCurrent)->GetPosPixel();
-        Size aSize(aOrigSize);
-        Point aPos(aOrigPos);
-        long nWidth = aRect.GetWidth() - nOffset;
-        if ( *pCurrent == m_aRemoveButton.get() )
-            nWidth -= pScrollBar->GetSizePixel().Width();
-        aSize.Width() = nWidth;
-        aPos.X() = aRect.getX() + ( nOffset / 2 );
-
-        if (aOrigSize != aSize || aOrigPos != aPos)
-        {
-            (*pCurrent)->SetPosSizePixel(aPos, aSize);
-            bChanged = true;
-        }
-
-        if ( *pCurrent == m_aValueEdit.get() )
-        {
-            Point aDurationPos( aPos );
-            m_aDurationField->SetPosPixel( aDurationPos );
-            Size aDurationSize(aSize);
-            aDurationSize.Width() -= (m_aEditButton->GetSizePixel().Width() + 3 );
-            m_aDurationField->SetSizePixel(aDurationSize);
-            aDurationPos.X() = aPos.X() - m_aEditButton->GetSizePixel().Width() + aSize.Width();
-            m_aEditButton->SetPosPixel(aDurationPos);
-
-            m_aYesNoButton->SetPosSizePixel( aPos, aSize );
-
-            aSize.Width() /= 2;
-            aSize.Width() -= 2;
-            m_aDateField->SetPosSizePixel( aPos, aSize );
-            aPos.X() += aSize.Width() + 4;
-            m_aTimeField->SetPosSizePixel( aPos, aSize );
-        }
+    m_pHeaderBar->SetItemSize( HI_NAME, nItemWidth );
+    m_pHeaderBar->SetItemSize( HI_TYPE, nTypeWidth );
+    m_pHeaderBar->SetItemSize( HI_VALUE, nItemWidth );
+    m_pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth );
 
-        pCurrent++;
-    }
-    return bChanged;
+    for (CustomPropertyLine* pLine : m_aCustomPropertiesLines)
+        SetWidgetWidths(pLine);
 }
 
 sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const
@@ -1775,44 +1735,6 @@ sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const
     return nCount;
 }
 
-void CustomPropertiesWindow::updateLineWidth()
-{
-    vcl::Window* pWindows[] = {  m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(),
-                            m_aDateField.get(), m_aTimeField.get(),
-                            m_aDurationField.get(), m_aEditButton.get(),
-                            m_aYesNoButton.get(), m_aRemoveButton.get(), nullptr };
-
-    for (std::vector< CustomPropertyLine* >::iterator aI =
-        m_aCustomPropertiesLines.begin(), aEnd = m_aCustomPropertiesLines.end();
-        aI != aEnd; ++aI)
-    {
-        CustomPropertyLine* pNewLine = *aI;
-
-        vcl::Window* pNewWindows[] =
-            {   pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(),
-                pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(),
-                pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(),
-                pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), nullptr };
-
-        vcl::Window** pCurrent = pWindows;
-        vcl::Window** pNewCurrent = pNewWindows;
-        while (*pCurrent)
-        {
-            Size aSize = (*pNewCurrent)->GetSizePixel();
-            aSize.Width() = (*pCurrent)->GetSizePixel().Width();
-            Point aPos = (*pNewCurrent)->GetPosPixel();
-            aPos.X() = (*pCurrent)->GetPosPixel().X();
-            (*pNewCurrent)->SetPosSizePixel(aPos, aSize);
-            pCurrent++;
-            pNewCurrent++;
-        }
-
-        // if we have type "Date", we use the full width, not only the half
-        if (pNewLine->m_bIsDate)
-            pNewLine->m_aDateField->SetSizePixel( pNewLine->m_aValueEdit->GetSizePixel() );
-    }
-}
-
 void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
 {
     CustomPropertyLine* pNewLine = new CustomPropertyLine( this );
@@ -1832,28 +1754,10 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
 
     sal_Int32 nPos = GetVisibleLineCount() * GetLineHeight();
     m_aCustomPropertiesLines.push_back( pNewLine );
-    vcl::Window* pWindows[] = {  m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(),
-                            m_aDateField.get(), m_aTimeField.get(),
-                            m_aDurationField.get(), m_aEditButton.get(),
-                            m_aYesNoButton.get(), m_aRemoveButton.get(), nullptr };
-    vcl::Window* pNewWindows[] =
-        {   pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(),
-            pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(),
-            pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(),
-            pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), nullptr };
-    vcl::Window** pCurrent = pWindows;
-    vcl::Window** pNewCurrent = pNewWindows;
-    while ( *pCurrent )
-    {
-        Size aSize = (*pCurrent)->GetSizePixel();
-        Point aPos = (*pCurrent)->GetPosPixel();
-        aPos.Y() += nPos;
-        aPos.Y() += m_nScrollPos;
-        (*pNewCurrent)->SetPosSizePixel( aPos, aSize );
-        (*pNewCurrent)->Show();
-        pCurrent++;
-        pNewCurrent++;
-    }
+
+    SetWidgetWidths(pNewLine);
+    pNewLine->m_aLine->SetPosSizePixel(Point(0, nPos + m_nScrollPos), Size(GetSizePixel().Width(), m_nWidgetHeight));
+    pNewLine->m_aLine->Show();
 
     double nTmpValue = 0;
     bool bTmpValue = false;
@@ -1929,10 +1833,10 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
             else
                 pNewLine->m_aYesNoButton->CheckNo();
         }
-        pNewLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast<void*>(nType) ) );
+        pNewLine->m_aTypeBox->SelectEntryPos(pNewLine->m_aTypeBox->GetEntryPos(reinterpret_cast<void*>(nType)));
     }
 
-    TypeHdl( nullptr, *pNewLine->m_aTypeBox.get() );
+    TypeHdl(*pNewLine->m_aTypeBox.get());
     pNewLine->m_aNameBox->GrabFocus();
 }
 
@@ -1971,24 +1875,13 @@ void CustomPropertiesWindow::ClearAllLines()
 void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
 {
     m_nScrollPos += nNewPos;
-    std::vector< CustomPropertyLine* >::iterator pIter;
-    for ( pIter = m_aCustomPropertiesLines.begin();
-            pIter != m_aCustomPropertiesLines.end(); ++pIter )
+    for (CustomPropertyLine* pLine : m_aCustomPropertiesLines)
     {
-        CustomPropertyLine* pLine = *pIter;
-        if ( pLine->m_bIsRemoved )
+        if (pLine->m_bIsRemoved)
             continue;
-
-        vcl::Window* pWindows[] = {  pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(), pLine->m_aDateField.get(), pLine->m_aTimeField.get(),
-                                pLine->m_aDurationField.get(), pLine->m_aEditButton.get(), pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), nullptr };
-        vcl::Window** pCurrent = pWindows;
-        while ( *pCurrent )
-        {
-            Point aPos = (*pCurrent)->GetPosPixel();
-            aPos.Y() += nNewPos;
-            (*pCurrent)->SetPosPixel( aPos );
-            pCurrent++;
-        }
+        Point aPos = pLine->m_aLine->GetPosPixel();
+        aPos.Y() += nNewPos;
+        pLine->m_aLine->SetPosPixel(aPos);
     }
 }
 
@@ -2082,6 +1975,8 @@ CustomPropertiesControl::CustomPropertiesControl(vcl::Window* pParent)
     , m_pVertScroll(nullptr)
     , m_nThumbPos(0)
 {
+    Size aRequest(LogicToPixel(Size(320, 141), MapUnit::MapAppFont));
+    set_width_request(aRequest.Width());
 }
 
 void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder)
@@ -2097,6 +1992,7 @@ void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder)
     OUString sValue = pValue->GetText();
     m_pPropertiesWin = VclPtr<CustomPropertiesWindow>::Create(m_pBody, pName, pType, pValue);
     m_pVertScroll = VclPtr<ScrollBar>::Create(m_pBody, WB_VERT);
+    m_pPropertiesWin->Init(m_pHeaderBar, m_pVertScroll);
 
     set_hexpand(true);
     set_vexpand(true);
@@ -2147,22 +2043,15 @@ void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder)
 
 void CustomPropertiesControl::Resize()
 {
-    Window::Resize();
-
-    if (!m_pVBox)
-        return;
-
-    m_pVBox->SetSizePixel(GetSizePixel());
-
-    bool bWidgetsResized = m_pPropertiesWin->InitControls( m_pHeaderBar, m_pVertScroll );
-    sal_Int32 nScrollOffset = m_pPropertiesWin->GetLineHeight();
-    sal_Int32 nVisibleEntries = m_pPropertiesWin->GetSizePixel().Height() / nScrollOffset;
-    m_pVertScroll->SetPageSize( nVisibleEntries - 1 );
-    m_pVertScroll->SetVisibleSize( nVisibleEntries );
-    if (bWidgetsResized)
+    if (m_pVBox)
     {
-        m_pPropertiesWin->updateLineWidth();
+        m_pVBox->SetSizePixel(GetSizePixel());
+        sal_Int32 nScrollOffset = m_pPropertiesWin->GetLineHeight();
+        sal_Int32 nVisibleEntries = m_pPropertiesWin->GetSizePixel().Height() / nScrollOffset;
+        m_pVertScroll->SetPageSize( nVisibleEntries - 1 );
+        m_pVertScroll->SetVisibleSize( nVisibleEntries );
     }
+    Window::Resize();
 }
 
 VCL_BUILDER_FACTORY(CustomPropertiesControl)
commit b12fb9eaeb5941cbbecfd79767ced2d88d2842af
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 29 14:01:09 2017 +0100

    Resolves: rhbz#1400287 resizing properties dialog hides widgets
    
    Change-Id: I5d066f53c5bdfb4dd50d60c5cb4b66e425c0293c
    Reviewed-on: https://gerrit.libreoffice.org/41698
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 7040862125fb1d805286771c26f6b51396cfb145)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index b2bcbf23c41d..f8dc73daedf5 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1505,6 +1505,7 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
     m_aDurationField->SetPosSizePixel(aPos, aSize);
     m_aDateField->SetPosSizePixel(aPos, aSize);
     m_aTimeField->SetPosSizePixel(aPos, aSize);
+    m_aYesNoButton->SetPosSizePixel(aPos, aSize);
 
     m_aEditLoseFocusIdle.SetPriority( SchedulerPriority::LOWEST );
     m_aEditLoseFocusIdle.SetIdleHdl( LINK( this, CustomPropertiesWindow, EditTimeoutHdl ) );
@@ -1795,12 +1796,13 @@ void CustomPropertiesWindow::updateLineWidth()
 
         vcl::Window** pCurrent = pWindows;
         vcl::Window** pNewCurrent = pNewWindows;
-        while ( *pCurrent )
+        while (*pCurrent)
         {
-            Size aSize = (*pCurrent)->GetSizePixel();
-            Point aPos = (*pCurrent)->GetPosPixel();
-            aPos.Y() = (*pNewCurrent)->GetPosPixel().Y();
-            (*pNewCurrent)->SetPosSizePixel( aPos, aSize );
+            Size aSize = (*pNewCurrent)->GetSizePixel();
+            aSize.Width() = (*pCurrent)->GetSizePixel().Width();
+            Point aPos = (*pNewCurrent)->GetPosPixel();
+            aPos.X() = (*pCurrent)->GetPosPixel().X();
+            (*pNewCurrent)->SetPosSizePixel(aPos, aSize);
             pCurrent++;
             pNewCurrent++;
         }
commit 4d0a45a091ecfcd9473b3a3a9b810d81cf6bd82e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Mar 19 20:04:40 2017 +0100

    tdf#87075: Filter out unused directories from FILELISTs
    
    ...so that on macOS dictionary extensions don't pollute LibreOffice.app's
    Contents/Resources/extensions/ with empty directories (that would then show up
    as phantom extenions in the Extension Manager).
    
    Change-Id: Iacff73e931885cde0fe507e384de80e9bd38d475
    (cherry picked from commit fbcdca2becb4eee0825697efffba14b5796ade6d)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm
index 485a508ccccf..fc7481c356ef 100644
--- a/solenv/bin/modules/installer.pm
+++ b/solenv/bin/modules/installer.pm
@@ -784,6 +784,7 @@ sub run {
                 $modulesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_modules($modulesinproductlanguageresolvedarrayref);
 
                 $filesinproductlanguageresolvedarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_files($filesinproductlanguageresolvedarrayref);
+                $directoriesforepmarrayref = installer::scriptitems::remove_not_required_spellcheckerlanguage_files($directoriesforepmarrayref);
             }
 
             installer::scriptitems::changing_name_of_language_dependent_keys($modulesinproductlanguageresolvedarrayref);
diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm
index 5f8dfd698d5f..1b8922dfa21c 100644
--- a/solenv/bin/modules/installer/scriptitems.pm
+++ b/solenv/bin/modules/installer/scriptitems.pm
@@ -1595,6 +1595,7 @@ sub collect_directories_from_filesarray
                 $directoryhash{'specificlanguage'} = $onefile->{'specificlanguage'};
                 $directoryhash{'Dir'} = $onefile->{'Dir'};
                 $directoryhash{'modules'} = $onefile->{'modules'}; # NEW, saving modules
+                $directoryhash{'gid'} = $onefile->{'gid'};
 
                 $predefinedprogdir_added ||= $onefile->{'Dir'} eq "PREDEFINED_PROGDIR";
 
@@ -1604,6 +1605,15 @@ sub collect_directories_from_filesarray
             {
                 # Adding the modules to the module list!
                 $alldirectoryhash{$destinationpath}->{'modules'} .= "," . $onefile->{'modules'};
+                # Save file's gid iff this directory appears in only a single
+                # file's FILELIST (so that unused directories will be filtered
+                # out in remove_not_required_spellcheckerlanguage_files, based
+                # on gid):
+                if ($alldirectoryhash{$destinationpath}->{'gid'}
+                    ne $onefile->{'gid'})
+                {
+                    $alldirectoryhash{$destinationpath}->{'gid'} = '';
+                }
             }
         } while ($destinationpath =~ s/(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/$1/);  # as long as the path contains slashes
     }
commit a1a819edfd986b85270c579a768db95019320243
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Wed Oct 18 17:30:57 2017 +0200

    tdf#109343 Fix paste as .RTF on Mac
    
    Change-Id: Ida0433437301ea2803373e534df3d42f67d6aff8
    Reviewed-on: https://gerrit.libreoffice.org/43513
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
    (cherry picked from commit dd0bc7323014c528fefb516cacae0591f270862a)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/vcl/osx/DataFlavorMapping.cxx b/vcl/osx/DataFlavorMapping.cxx
index 2b7b9a001351..1f903b95004e 100644
--- a/vcl/osx/DataFlavorMapping.cxx
+++ b/vcl/osx/DataFlavorMapping.cxx
@@ -110,7 +110,7 @@ namespace
   static const FlavorMap flavorMap[] =
     {
       { NSStringPboardType, "text/plain;charset=utf-16", "Unicode Text (UTF-16)", true },
-      { NSRTFPboardType, "text/richtext", "Rich Text Format", false },
+      { NSRTFPboardType, "text/rtf", "Rich Text Format", false },
       { NSTIFFPboardType, "image/png", "Portable Network Graphics", false },
       { NSHTMLPboardType, "text/html", "Plain Html", false },
       { NSFilenamesPboardType, "application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", false },


More information about the Libreoffice-commits mailing list