Tag: cws_dev300_odbmacros3
User: fs      
Date: 2008-05-13 11:46:33+0000
Modified:
   dba/dbaccess/source/ext/macromigration/macromigrationpages.cxx

Log:
 ResultPage: cope with labels with more than one line of text

File Changes:

Directory: /dba/dbaccess/source/ext/macromigration/
===================================================

File [changed]: macromigrationpages.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ext/macromigration/macromigrationpages.cxx?r1=1.3.2.3&r2=1.3.2.4
Delta lines:  +21 -2
--------------------
--- macromigrationpages.cxx     2008-05-08 10:10:10+0000        1.3.2.3
+++ macromigrationpages.cxx     2008-05-13 11:46:30+0000        1.3.2.4
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: macromigrationpages.cxx,v $
- * $Revision: 1.3.2.3 $
+ * $Revision: 1.3.2.4 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -43,6 +43,7 @@
 
 #include <tools/urlobj.hxx>
 #include <tools/diagnose_ex.h>
+#include <vcl/metric.hxx>
 
 //........................................................................
 namespace dbmm
@@ -334,7 +335,25 @@
         m_aChangesLabel.SetText( _bSuccessful ? m_aSuccessful : 
m_aUnsuccessful );
         m_aChanges.SetText( _rSummary );
 
-        // TODO: resize m_aChangesLabel and m_aChances as needed for the label 
text to fit 
+        // resize m_aChangesLabel and m_aChances as needed for the label text 
to fit 
+        Rectangle aOriginalLabelSize( m_aChangesLabel.GetPosPixel(), 
m_aChangesLabel.GetSizePixel() );
+        // assume 3 lines, at most
+        Rectangle aNewLabelSize( aOriginalLabelSize );
+        aNewLabelSize.Bottom() = aNewLabelSize.Top() + 
m_aChangesLabel.LogicToPixel( Size( 0, 3*8 ), MAP_APPFONT ).Height();
+        TextRectInfo aInfo;
+        aNewLabelSize = m_aChangesLabel.GetTextRect( aNewLabelSize, 
m_aChangesLabel.GetText(), TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK, &aInfo );
+        aNewLabelSize.Bottom() = aNewLabelSize.Top() + 
m_aChangesLabel.LogicToPixel( Size( 0, aInfo.GetLineCount() * 8 ), MAP_APPFONT 
).Height();
+
+        m_aChangesLabel.SetSizePixel( aNewLabelSize.GetSize() );
+
+        long nChangesDiff = aNewLabelSize.GetHeight() - 
aOriginalLabelSize.GetHeight();
+        Size aChangesSize( m_aChanges.GetSizePixel() );
+        aChangesSize.Height() -= nChangesDiff;
+        m_aChanges.SetSizePixel( aChangesSize );
+
+        Point aChangesPos( m_aChanges.GetPosPixel() );
+        aChangesPos.Y() += nChangesDiff;
+        m_aChanges.SetPosPixel( aChangesPos );
     }
 
 //........................................................................




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

Reply via email to