User: kz      
Date: 2006/12/13 08:54:30

Modified:
   dba/dbaccess/source/ui/querydesign/TableWindow.cxx

Log:
 INTEGRATION: CWS dba22ui (1.33.12); FILE MERGED
 2006/10/12 08:14:27 fs 1.33.12.1: #i69246# display an image indicating the 
type of table/view/query

File Changes:

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

File [changed]: TableWindow.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/TableWindow.cxx?r1=1.33&r2=1.34
Delta lines:  +47 -24
---------------------
--- TableWindow.cxx     17 Sep 2006 07:25:29 -0000      1.33
+++ TableWindow.cxx     13 Dec 2006 16:54:27 -0000      1.34
@@ -50,6 +50,9 @@
 #ifndef DBAUI_TABLEWINDOWDATA_HXX
 #include "TableWindowData.hxx"
 #endif
+#ifndef DBACCESS_IMAGEPROVIDER_HXX
+#include "imageprovider.hxx"
+#endif
 #ifndef _TOOLS_DEBUG_HXX
 #include <tools/debug.hxx>
 #endif
@@ -144,6 +147,7 @@
 
//------------------------------------------------------------------------------
 OTableWindow::OTableWindow( Window* pParent, OTableWindowData* pTabWinData )
                  :Window( pParent, WB_3DLOOK|WB_MOVEABLE )
+          ,m_aTypeImage( this )
                  ,m_aTitle( this )
                  ,m_pListBox(NULL)
                  ,m_pAccessible(NULL)
@@ -343,7 +347,6 @@
 
//------------------------------------------------------------------------------
 void OTableWindow::clearListBox()
 {
-       // da ich defaultmaessig keine USerData an die Items haenge, kann ich 
hier einfach loeschen
        if ( m_pListBox )
        {
                SvLBoxEntry* pEntry = m_pListBox->First();
@@ -360,6 +363,25 @@
 }
 
 
//------------------------------------------------------------------------------
+void OTableWindow::impl_updateImage()
+{
+    ImageProvider aImageProvider( 
getDesignView()->getController()->getConnection() );
+
+    Image aImage( aImageProvider.getImage( GetComposedName(), isQuery() ? 
DatabaseObject::QUERY : DatabaseObject::TABLE, false ) );
+    Image aImageHC( aImageProvider.getImage( GetComposedName(), isQuery() ? 
DatabaseObject::QUERY : DatabaseObject::TABLE, true ) );
+
+    if ( !aImage || !aImageHC )
+    {
+        OSL_ENSURE( false, "OTableWindow::impl_updateImage: no images!" );
+        return;
+    }
+
+    m_aTypeImage.SetModeImage( aImage, BMP_COLOR_NORMAL );
+    m_aTypeImage.SetModeImage( aImageHC, BMP_COLOR_HIGHCONTRAST );
+    m_aTypeImage.Show();
+}
+
+//------------------------------------------------------------------------------
 BOOL OTableWindow::Init()
 {
        bool bSuccess = false;
@@ -449,6 +471,8 @@
                        m_pListBox->SelectAll( FALSE );
        }
 
+    impl_updateImage();
+
        return bSuccess;
 }
 
@@ -633,33 +657,32 @@
        // Das Fenster darf nicht verschwinden, deshalb min. Groesse setzen
        Size    aOutSize = GetOutputSizePixel();
        aOutSize = Size(CalcZoom(aOutSize.Width()),CalcZoom(aOutSize.Height()));
-       Point   aPos = GetPosPixel();
 
-       long nCharHeight = CalcZoom(GetTextHeight())+ CalcZoom(4);
-//     if( aOutSize.Width() < TABWIN_WIDTH_MIN )
-//     {
-//             aOutSize.Width() = TABWIN_WIDTH_MIN;
-//             bChanged = sal_True;
-//     }
-//     if( aOutSize.Height() < TABWIN_HEIGHT_MIN )
-//     {
-//             aOutSize.Height() = TABWIN_HEIGHT_MIN;
-//             nCharHeight = GetTextHeight() + 4;
-//             bChanged = sal_True;
-//     }
-//     if(bChanged)
-//     {
-//             SetPosSizePixel( aPos, aOutSize );
-//             m_pData->SetSize( aOutSize );
-//     }
+       long nTitleHeight = CalcZoom( GetTextHeight() )+ CalcZoom( 4 );
 
        //////////////////////////////////////////////////////////////////////
        // Titel und ListBox anpassen
-       //      long nCharHeight = GetTextHeight() + 4;
        long n5Pos = CalcZoom(5);
-       long n10Pos = CalcZoom(10);
-       m_aTitle.SetPosSizePixel( Point(n5Pos,n5Pos), Size( 
aOutSize.Width()-n10Pos, nCharHeight) );
-       m_pListBox->SetPosSizePixel( Point(n5Pos,nCharHeight+n5Pos), 
Size(aOutSize.Width()-n10Pos,aOutSize.Height()-nCharHeight-n10Pos) );
+    long nPositionX = n5Pos;
+    long nPositionY = n5Pos;
+
+    // position the image which indicates the type
+    m_aTypeImage.SetPosPixel( Point( nPositionX, nPositionY ) );
+    Size aImageSize( m_aTypeImage.GetImage().GetSizePixel() );
+    m_aTypeImage.SetSizePixel( aImageSize );
+
+    if ( nTitleHeight < aImageSize.Height() )
+        nTitleHeight = aImageSize.Height();
+
+    nPositionX += aImageSize.Width() + CalcZoom( 2 );
+       m_aTitle.SetPosSizePixel( Point( nPositionX, nPositionY ), Size( 
aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) );
+
+    long nTitleToList = CalcZoom( 3 );
+
+       m_pListBox->SetPosSizePixel(
+        Point( n5Pos, nPositionY + nTitleHeight + nTitleToList ),
+        Size( aOutSize.Width() - 2 * n5Pos, aOutSize.Height() - ( nPositionY + 
nTitleHeight + nTitleToList ) - n5Pos )
+    );
 
        Window::Invalidate();
 }




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

Reply via email to