Tag: cws_src680_qiq
User: fs      
Date: 06/06/01 06:59:05

Modified:
 /dba/dbaccess/source/ui/dlg/
  sqlmessage.cxx

Log:
 #i51143# slight rearrangements for better look

File Changes:

Directory: /dba/dbaccess/source/ui/dlg/
=======================================

File [changed]: sqlmessage.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/sqlmessage.cxx?r1=1.20.118.7&r2=1.20.118.8
Delta lines:  +28 -3
--------------------
--- sqlmessage.cxx      1 Jun 2006 13:27:00 -0000       1.20.118.7
+++ sqlmessage.cxx      1 Jun 2006 13:59:02 -0000       1.20.118.8
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: sqlmessage.cxx,v $
  *
- *  $Revision: 1.20.118.7 $
+ *  $Revision: 1.20.118.8 $
  *
- *  last change: $Author: fs $ $Date: 2006/06/01 13:27:00 $
+ *  last change: $Author: fs $ $Date: 2006/06/01 13:59:02 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -519,6 +519,8 @@
     m_aTitle.SetText( sPrimary );
        m_aTitle.Show();
 
+    Rectangle aPrimaryRect( m_aTitle.GetPosPixel(), m_aTitle.GetSizePixel() );
+
     // secondary text (if applicable)
        m_aMessage.SetStyle( m_aMessage.GetStyle() | WB_NOLABEL );
     m_aMessage.SetText( sSecondary );
@@ -526,8 +528,10 @@
     lcl_positionInAppFont( *this, m_aMessage, TEXT_POS_X, OUTER_MARGIN + 16 + 
3, DIALOG_WIDTH - TEXT_POS_X - 2 * OUTER_MARGIN, 8 );
     Rectangle aSecondaryRect( m_aMessage.GetPosPixel(), 
m_aMessage.GetSizePixel() );
 
+    bool bHaveSecondaryText = sSecondary.Len() != 0;
+
     // determine which space the secondary text would occupy
-    if ( sSecondary.Len() )
+    if ( bHaveSecondaryText )
            aSecondaryRect = GetTextRect( aSecondaryRect, sSecondary, 
TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE | TEXT_DRAW_LEFT );
     else
         aSecondaryRect.Bottom() = aSecondaryRect.Top() - 1;
@@ -536,10 +540,31 @@
     m_aMessage.SetSizePixel( aSecondaryRect.GetSize() );
        m_aMessage.Show( aSecondaryRect.GetHeight() > 0 );
 
+    // if there's no secondary text ...
+    if ( !bHaveSecondaryText )
+    {   // then give the primary text as much horizontal space as it needs
+        Rectangle aSuggestedRect( GetTextRect( aPrimaryRect, sPrimary, 
TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE | TEXT_DRAW_CENTER ) );
+        aPrimaryRect.Right() = aPrimaryRect.Left() + aSuggestedRect.GetWidth();
+        aPrimaryRect.Bottom() = aPrimaryRect.Top() + 
aSuggestedRect.GetHeight();
+        // and center it horizontally
+        m_aTitle.SetStyle( ( m_aTitle.GetStyle() & ~WB_LEFT ) | WB_CENTER );
+
+        // also, if it's not as high as the image ...
+        if ( aPrimaryRect.GetHeight() < m_aInfoImage.GetSizePixel().Height() )
+        {   // ... make it fit the image height
+            aPrimaryRect.Bottom() += m_aInfoImage.GetSizePixel().Height() - 
aPrimaryRect.GetHeight();
+            // and center it vertically
+            m_aTitle.SetStyle( m_aTitle.GetStyle() | WB_VCENTER );
+        }
+
+        m_aTitle.SetPosSizePixel( aPrimaryRect.TopLeft(), 
aPrimaryRect.GetSize() );
+    }
+
     // adjust dialog size accordingly
     Size aBorderSize = LogicToPixel( Size( OUTER_MARGIN, OUTER_MARGIN ), 
MAP_APPFONT );
     Size aDialogSize( LogicToPixel( Size( DIALOG_WIDTH, 30 ), MAP_APPFONT ) );
     aDialogSize.Height() = aSecondaryRect.Bottom() + aBorderSize.Height();
+    aDialogSize.Width() = aPrimaryRect.Right() + aBorderSize.Width();
 
        SetSizePixel( aDialogSize );
        SetPageSizePixel( aDialogSize );




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to