Kaydet (Commit) eacc9e6b authored tarafından Thomas Arnhold's avatar Thomas Arnhold

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
üst 61aaf381
...@@ -390,6 +390,7 @@ struct CustomPropertyLine ...@@ -390,6 +390,7 @@ struct CustomPropertyLine
CustomPropertiesYesNoButton m_aYesNoButton; CustomPropertiesYesNoButton m_aYesNoButton;
CustomPropertiesRemoveButton m_aRemoveButton; CustomPropertiesRemoveButton m_aRemoveButton;
bool m_bIsDate;
bool m_bIsRemoved; bool m_bIsRemoved;
bool m_bTypeLostFocus; bool m_bTypeLostFocus;
......
...@@ -1377,6 +1377,7 @@ CustomPropertyLine::CustomPropertyLine( Window* pParent ) : ...@@ -1377,6 +1377,7 @@ CustomPropertyLine::CustomPropertyLine( Window* pParent ) :
m_aEditButton( pParent, SfxResId( SFX_PB_EDIT ), this), m_aEditButton( pParent, SfxResId( SFX_PB_EDIT ), this),
m_aYesNoButton ( pParent, SfxResId( SFX_WIN_PROPERTY_YESNO ) ), m_aYesNoButton ( pParent, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
m_aRemoveButton ( pParent, SfxResId( SFX_PB_PROPERTY_REMOVE ), this ), m_aRemoveButton ( pParent, SfxResId( SFX_PB_PROPERTY_REMOVE ), this ),
m_bIsDate ( false ),
m_bIsRemoved ( false ), m_bIsRemoved ( false ),
m_bTypeLostFocus( false ) m_bTypeLostFocus( false )
...@@ -1471,11 +1472,15 @@ IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox ) ...@@ -1471,11 +1472,15 @@ IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox )
//adjust positions of date and time controls //adjust positions of date and time controls
if ( nType == CUSTOM_TYPE_DATE ) if ( nType == CUSTOM_TYPE_DATE )
{
pLine->m_bIsDate = true;
pLine->m_aDateField.SetSizePixel( pLine->m_aValueEdit.GetSizePixel() ); pLine->m_aDateField.SetSizePixel( pLine->m_aValueEdit.GetSizePixel() );
}
else if ( nType == CUSTOM_TYPE_DATETIME) else if ( nType == CUSTOM_TYPE_DATETIME)
{ {
// because m_aDateField and m_aTimeField have the same size for type "DateTime", // because m_aDateField and m_aTimeField have the same size for type "DateTime",
// we just rely on m_aTimeField here. // we just rely on m_aTimeField here.
pLine->m_bIsDate = false;
pLine->m_aDateField.SetSizePixel( pLine->m_aTimeField.GetSizePixel() ); pLine->m_aDateField.SetSizePixel( pLine->m_aTimeField.GetSizePixel() );
} }
...@@ -1711,6 +1716,10 @@ void CustomPropertiesWindow::updateLineWidth() ...@@ -1711,6 +1716,10 @@ void CustomPropertiesWindow::updateLineWidth()
pCurrent++; pCurrent++;
pNewCurrent++; 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() );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment