[Libreoffice-commits] core.git: 3 commits - include/sfx2 sfx2/source

Thomas Arnhold thomas at arnhold.org
Sun Aug 17 11:49:22 PDT 2014


 include/sfx2/dinfdlg.hxx       |    5 +----
 sfx2/source/dialog/dinfdlg.cxx |   27 ++++++++++++++++-----------
 2 files changed, 17 insertions(+), 15 deletions(-)

New commits:
commit eacc9e6bad22525e99e243b3fbb2405a00503bd3
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Sun Aug 17 20:43:06 2014 +0200

    Customproperties: Correctly size Date
    
    Old behavior:
    
    1) Add a property of type "Date". DateField inside Value column uses
       the full width.
    2) Increase the width of the dialog. Now the size of DateField in
       the Value column only uses the half width.
    
    Solution:
    
    Set a flag if the current type is of Date. So we can correct the size
    after a dialog resize action.
    
    Change-Id: I915a553b2f69aac1aea0ac5b24536db5709abfae

diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 9cf7349..111043d 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -390,6 +390,7 @@ struct CustomPropertyLine
     CustomPropertiesYesNoButton     m_aYesNoButton;
     CustomPropertiesRemoveButton    m_aRemoveButton;
 
+    bool                            m_bIsDate;
     bool                            m_bIsRemoved;
     bool                            m_bTypeLostFocus;
 
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 8e160d04..3f3e9ad 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1377,6 +1377,7 @@ CustomPropertyLine::CustomPropertyLine( Window* pParent ) :
     m_aEditButton(    pParent, SfxResId( SFX_PB_EDIT ), this),
     m_aYesNoButton  ( pParent, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
     m_aRemoveButton ( pParent, SfxResId( SFX_PB_PROPERTY_REMOVE ), this ),
+    m_bIsDate       ( false ),
     m_bIsRemoved    ( false ),
     m_bTypeLostFocus( false )
 
@@ -1471,11 +1472,15 @@ IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox )
 
     //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() );
     }
 
@@ -1711,6 +1716,10 @@ void CustomPropertiesWindow::updateLineWidth()
             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() );
     }
 }
 
commit 61aaf3814c25b229479ede786521786997aa4f0f
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Sun Aug 17 19:57:54 2014 +0200

    Customproperties: Position DateTime correctly
    
    No need to store the position of DateField and TimeField, because this
    will not change if we choose another type. The only thing what changes
    is the size of the DateField, because both "DateTime" and "Date" use
    this field. And for this size we just rely on the size of m_aTimeField,
    because it's the same as m_aDateField (for type DateTime).
    
    Change-Id: Ic590c62d82d8f90576479e10be9d422326032d28

diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index fd6f95b..9cf7349 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -390,10 +390,6 @@ struct CustomPropertyLine
     CustomPropertiesYesNoButton     m_aYesNoButton;
     CustomPropertiesRemoveButton    m_aRemoveButton;
 
-    Point                           m_aDatePos;
-    Point                           m_aTimePos;
-    Size                            m_aDateTimeSize;
-
     bool                            m_bIsRemoved;
     bool                            m_bTypeLostFocus;
 
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 3376d6d..8e160d04 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1468,13 +1468,15 @@ IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox )
     pLine->m_aDurationField.Show( CUSTOM_TYPE_DURATION == nType );
     pLine->m_aEditButton.Show( CUSTOM_TYPE_DURATION == nType );
     pLine->m_aYesNoButton.Show( CUSTOM_TYPE_BOOLEAN == nType );
+
     //adjust positions of date and time controls
     if ( nType == CUSTOM_TYPE_DATE )
-        pLine->m_aDateField.SetPosSizePixel(pLine->m_aValueEdit.GetPosPixel(), pLine->m_aValueEdit.GetSizePixel());
+        pLine->m_aDateField.SetSizePixel( pLine->m_aValueEdit.GetSizePixel() );
     else if ( nType == CUSTOM_TYPE_DATETIME)
     {
-        pLine->m_aDateField.SetPosSizePixel( pLine->m_aDatePos, pLine->m_aDateTimeSize );
-        pLine->m_aTimeField.SetPosSizePixel(pLine->m_aTimePos, pLine->m_aDateTimeSize );
+        // because m_aDateField and m_aTimeField have the same size for type "DateTime",
+        // we just rely on m_aTimeField here.
+        pLine->m_aDateField.SetSizePixel( pLine->m_aTimeField.GetSizePixel() );
     }
 
     return 0;
@@ -1754,10 +1756,6 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
         pNewCurrent++;
     }
 
-    pNewLine->m_aDatePos = pNewLine->m_aDateField.GetPosPixel();
-    pNewLine->m_aTimePos = pNewLine->m_aTimeField.GetPosPixel();
-    pNewLine->m_aDateTimeSize = pNewLine->m_aDateField.GetSizePixel();
-
     double nTmpValue = 0;
     bool bTmpValue = false;
     OUString sTmpValue;
commit dc4b9926ec394d57af41457ea891f590dec05d15
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Sun Aug 17 16:33:02 2014 +0200

    Customproperties: Correct size for value field
    
    Before this patch types "DateTime" and "Yes or No"
    were one pixel too big in height.
    
    Fix this by using the original aSize and aPos values, don't
    depend on m_aYesNoButton size and position.
    
    However there are some glitches with DateTime: If you scroll
    some times up and down the list of "Type" the Date and Time
    fields will get positioned somewhere left.
    This has to be a problem of DateField and TimeField, because
    
    m_aDateField.SetPosSizePixel( aPos, aSize );
    
    and m_aTimeField get the same values as all other fields...
    
    But this positioning error existed before this patch, too.
    
    Change-Id: I793aebf39f5b6cb6e4b290f21a5dbcc7ce6ce964

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 2e05124..3376d6d 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1650,11 +1650,9 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
             m_aDurationField.SetSizePixel(aDurationSize);
             aDurationPos.X() = aPos.X() - m_aEditButton.GetSizePixel().Width() + aSize.Width();
             m_aEditButton.SetPosPixel(aDurationPos);
-            aSize = m_aYesNoButton.GetSizePixel();
-            aPos = m_aYesNoButton.GetPosPixel();
-            aSize.Width() = nWidth;
-            aPos.X() = aRect.getX() + ( nOffset / 2 );
+
             m_aYesNoButton.SetPosSizePixel( aPos, aSize );
+
             aSize.Width() /= 2;
             aSize.Width() -= 2;
             m_aDateField.SetPosSizePixel( aPos, aSize );


More information about the Libreoffice-commits mailing list