[Libreoffice-commits] .: dbaccess/inc dbaccess/source

Sebastian Spaeth spaetz at kemper.freedesktop.org
Tue Nov 16 09:46:47 PST 2010


 dbaccess/inc/ToolBoxHelper.hxx                 |    6 +++
 dbaccess/source/ui/app/AppDetailPageHelper.cxx |   31 +++++++++---------
 dbaccess/source/ui/app/AppDetailPageHelper.hxx |    5 ++-
 dbaccess/source/ui/browser/dsEntriesNoExp.cxx  |   12 ++++---
 dbaccess/source/ui/browser/unodatbr.cxx        |   18 +++++++---
 dbaccess/source/ui/control/dbtreelistbox.cxx   |    4 +-
 dbaccess/source/ui/control/tabletree.cxx       |   17 ++++++----
 dbaccess/source/ui/dlg/adtabdlg.cxx            |    2 -
 dbaccess/source/ui/dlg/indexdialog.cxx         |    8 ++--
 dbaccess/source/ui/dlg/sqlmessage.cxx          |   29 ++++++++++++-----
 dbaccess/source/ui/imagelists/dbimagelists.src |    7 ++++
 dbaccess/source/ui/inc/UITools.hxx             |    8 ++++
 dbaccess/source/ui/inc/dbu_resource.hrc        |    1 
 dbaccess/source/ui/inc/imageprovider.hxx       |   41 +++++++++++++++++++++----
 dbaccess/source/ui/inc/indexdialog.hxx         |    4 +-
 dbaccess/source/ui/inc/unodatbr.hxx            |    3 +
 dbaccess/source/ui/misc/ToolBoxHelper.cxx      |   11 ++++--
 dbaccess/source/ui/misc/UITools.cxx            |   15 +++++++++
 dbaccess/source/ui/misc/WTypeSelect.cxx        |    2 -
 dbaccess/source/ui/misc/imageprovider.cxx      |   38 +++++++++++++++--------
 dbaccess/source/ui/querydesign/TableWindow.cxx |    8 ++--
 dbaccess/source/ui/querydesign/query.src       |   14 ++++++++
 22 files changed, 211 insertions(+), 73 deletions(-)

New commits:
commit 4345ada3ebbdc0f25c54194155caf6b8ff074db7
Author: Sebastian Spaeth <Sebastian at SSpaeth.de>
Date:   Tue Nov 16 18:43:28 2010 +0100

    Remove _HC occurences

diff --git a/dbaccess/inc/ToolBoxHelper.hxx b/dbaccess/inc/ToolBoxHelper.hxx
index 3784ff1..49d41b7 100644
--- a/dbaccess/inc/ToolBoxHelper.hxx
+++ b/dbaccess/inc/ToolBoxHelper.hxx
@@ -43,6 +43,7 @@ namespace dbaui
 {
     class DBACCESS_DLLPUBLIC OToolBoxHelper
     {
+        sal_Bool		m_bIsHiContrast;// true when the toolbox is in hi contrast mode
         sal_Int16		m_nSymbolsSize;	// shows the toolbox large or small bitmaps
         ToolBox*		m_pToolBox;		// our toolbox (may be NULL)
     public:
@@ -58,8 +59,10 @@ namespace dbaui
         /** will be called when the image list is needed.
             @param	_eSymbolsSize
                 <svtools/imgdef.hxx>
+            @param	_bHiContast
+                <TRUE/> when in high contrast mode.
         */
-        virtual ImageList getImageList(sal_Int16 _eSymbolsSize) const = 0;
+        virtual ImageList getImageList(sal_Int16 _eSymbolsSize,sal_Bool _bHiContast) const = 0;
 
         /** only the member will be set, derived classes can overload this function and do what need to be done.
             @param	_pTB
@@ -75,6 +78,7 @@ namespace dbaui
         */
         void checkImageList();
         
+        inline sal_Bool isToolBoxHiContrast() const { return m_bIsHiContrast; }
     protected:
         DECL_LINK(ConfigOptionsChanged, SvtMiscOptions*);
         DECL_LINK(SettingsChanged, VclWindowEvent* );
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 2d3d55b..1cc79b7 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -623,7 +623,7 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon
 
         ImageProvider aImageProvider( _xConnection );
         createTree( pTreeView,
-            aImageProvider.getDefaultImage( DatabaseObject::TABLE )
+            aImageProvider.getDefaultImage( DatabaseObject::TABLE, false )
         );
 
         pTreeView->notifyHiContrastChanged();
@@ -643,10 +643,10 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon
 }
 
 // -----------------------------------------------------------------------------
-void OAppDetailPageHelper::getElementIcons( ElementType _eType, USHORT& _rImageId )
+void OAppDetailPageHelper::getElementIcons( ElementType _eType, USHORT& _rImageId, USHORT& _rHighContrastImageId )
 {
     ImageProvider aImageProvider;
-    _rImageId = 0;
+    _rImageId = _rHighContrastImageId = 0;
 
     sal_Int32 nDatabaseObjectType( 0 );
     switch(_eType )
@@ -658,7 +658,8 @@ void OAppDetailPageHelper::getElementIcons( ElementType _eType, USHORT& _rImageI
             OSL_ENSURE( sal_False, "OAppDetailPageHelper::GetElementIcons: invalid element type!" );
             return;
     }
-    _rImageId = aImageProvider.getDefaultImageResourceID( nDatabaseObjectType );
+    _rImageId = aImageProvider.getDefaultImageResourceID( nDatabaseObjectType, false );
+    _rHighContrastImageId = aImageProvider.getDefaultImageResourceID( nDatabaseObjectType, true );
 }
 
 // -----------------------------------------------------------------------------
@@ -666,27 +667,27 @@ void OAppDetailPageHelper::createPage(ElementType _eType,const Reference< XNameA
 {
     OSL_ENSURE(E_TABLE != _eType,"E_TABLE isn't allowed.");
 
-    USHORT nHelpId = 0, nImageId = 0;
+    USHORT nHelpId = 0, nImageId = 0, nImageIdH = 0;
     ImageProvider aImageProvider;
     Image aFolderImage;
     switch( _eType )
     {
         case E_FORM:
             nHelpId = HID_APP_FORM_TREE;
-            aFolderImage = aImageProvider.getFolderImage( DatabaseObject::FORM );
+            aFolderImage = aImageProvider.getFolderImage( DatabaseObject::FORM, false );
             break;
         case E_REPORT:
             nHelpId = HID_APP_REPORT_TREE;
-            aFolderImage = aImageProvider.getFolderImage( DatabaseObject::REPORT );
+            aFolderImage = aImageProvider.getFolderImage( DatabaseObject::REPORT, false );
             break;
         case E_QUERY:
             nHelpId = HID_APP_QUERY_TREE;
-            aFolderImage = aImageProvider.getFolderImage( DatabaseObject::QUERY );
+            aFolderImage = aImageProvider.getFolderImage( DatabaseObject::QUERY, false );
             break;
         default:
             OSL_ENSURE(0,"Illegal call!");
     }
-    getElementIcons( _eType, nImageId );
+    getElementIcons( _eType, nImageId, nImageIdH );
 
     if ( !m_pLists[_eType] )
     {
@@ -697,7 +698,7 @@ void OAppDetailPageHelper::createPage(ElementType _eType,const Reference< XNameA
     {
         if ( !m_pLists[_eType]->GetEntryCount() && _xContainer.is() )
         {
-            fillNames( _xContainer, _eType, nImageId, NULL );
+            fillNames( _xContainer, _eType, nImageId, nImageIdH, NULL );
 
             m_pLists[_eType]->SelectAll(FALSE);
         }
@@ -745,7 +746,7 @@ namespace
 
 // -----------------------------------------------------------------------------
 void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContainer, const ElementType _eType,
-                                      const USHORT _nImageId, SvLBoxEntry* _pParent )
+                                      const USHORT _nImageId, const USHORT _nHighContrastImageId, SvLBoxEntry* _pParent )
 {
     OSL_ENSURE(_xContainer.is(),"Data source is NULL! -> GPF");
     OSL_ENSURE( ( _eType >= E_TABLE ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OAppDetailPageHelper::fillNames: invalid type!" );
@@ -770,7 +771,7 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine
             {
                 pEntry = pList->InsertEntry( *pIter, _pParent, FALSE, LIST_APPEND, reinterpret_cast< void* >( nFolderIndicator ) );
                 getBorderWin().getView()->getAppController().containerFound( Reference< XContainer >( xSubElements, UNO_QUERY ) );
-                fillNames( xSubElements, _eType, _nImageId, pEntry );
+                fillNames( xSubElements, _eType, _nImageId, _nHighContrastImageId, pEntry );
             }
             else
             {
@@ -894,14 +895,14 @@ SvLBoxEntry* OAppDetailPageHelper::elementAdded(ElementType _eType,const ::rtl::
             }
         }
 
-        USHORT nImageId = 0;
-        getElementIcons( _eType, nImageId );
+        USHORT nImageId = 0, nImageIdH = 0;
+        getElementIcons( _eType, nImageId, nImageIdH );
         Reference<XNameAccess> xContainer(_rObject,UNO_QUERY);
         if ( xContainer.is() )
         {
             const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
             pRet = pTreeView->InsertEntry( _rName, pEntry, FALSE, LIST_APPEND, reinterpret_cast< void* >( nFolderIndicator ) );
-            fillNames( xContainer, _eType, nImageId, pRet );
+            fillNames( xContainer, _eType, nImageId, nImageIdH, pRet );
         }
         else
         {
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index f52dc7b..e799d79 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -119,7 +119,7 @@ namespace dbaui
 
         /** retrieves the resource ids of the images representing elements of the given type
         */
-        void getElementIcons( ElementType _eType, USHORT& _rImageId );
+        void getElementIcons( ElementType _eType, USHORT& _rImageId, USHORT& _rHighContrastImageId );
 
         /** fills the names in the listbox
             @param	_xContainer
@@ -128,12 +128,15 @@ namespace dbaui
                 the type of elements which are being filled
             @param _nImageId
                 the resource id of the image to use for non-container entries
+            @param _nHighContrastImageId
+                the resource id of the high contrast image to use for non-container entries
             @param	_pParent
                 The parent of the entries to be inserted.
         */
         void fillNames( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xContainer,
                         const ElementType _eType,
                         const USHORT _nImageId,
+                        const USHORT _nHighContrastImageId,
                         SvLBoxEntry* _pParent );
 
         /** sets the detail page
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index ef2d668..d5f1510 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -224,21 +224,25 @@ void SbaTableQueryBrowser::notifyHiContrastChanged()
             ::std::auto_ptr< ImageProvider > pImageProvider( getImageProviderFor( pEntryLoop ) );
 
             // the images for this entry
-            Image aImage;
+            Image aImage, aImageHC;
             if ( pData->eType == etDatasource )
-                aImage = pImageProvider->getDatabaseImage();
+            {
+                aImage = pImageProvider->getDatabaseImage( false );
+                aImageHC = pImageProvider->getDatabaseImage( true );
+            }
             else
             {
                 bool bIsFolder = !isObject( pData->eType );
                 if ( bIsFolder )
                 {
                     sal_Int32 nObjectType( getDatabaseObjectType( pData->eType ) );
-                    aImage = pImageProvider->getFolderImage( nObjectType );
+                    aImage = pImageProvider->getFolderImage( nObjectType, false );
+                    aImageHC = pImageProvider->getFolderImage( nObjectType, true );
                 }
                 else
                 {
                     sal_Int32 nObjectType( getDatabaseObjectType( pData->eType ) );
-                    pImageProvider->getImages( GetEntryText( pEntryLoop ), nObjectType, aImage );
+                    pImageProvider->getImages( GetEntryText( pEntryLoop ), nObjectType, aImage, aImageHC );
                 }
             }
 
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 7a2c16f..648c213 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1980,12 +1980,12 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb
 
     ImageProvider aImageProvider;
     if (!_rQueryImage)
-        _rQueryImage = aImageProvider.getFolderImage( DatabaseObject::QUERY );
+        _rQueryImage = aImageProvider.getFolderImage( DatabaseObject::QUERY, isHiContrast() );
     if (!_rTableImage)
-        _rTableImage = aImageProvider.getFolderImage( DatabaseObject::TABLE );
+        _rTableImage = aImageProvider.getFolderImage( DatabaseObject::TABLE, isHiContrast() );
 
     if (!_rDbImage)
-        _rDbImage = aImageProvider.getDatabaseImage();
+        _rDbImage = aImageProvider.getDatabaseImage( isHiContrast() );
 
     // add the entry for the data source
     // special handling for data sources denoted by URLs - we do not want to display this ugly URL, do we?
@@ -2077,8 +2077,8 @@ SvLBoxEntry* SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const
 {
     ::std::auto_ptr< ImageProvider > pImageProvider( getImageProviderFor( _pParent ) );
 
-    Image aImage;
-    pImageProvider->getImages( _rName, getDatabaseObjectType( _eEntryType ), aImage );
+    Image aImage, aImageHC;
+    pImageProvider->getImages( _rName, getDatabaseObjectType( _eEntryType ), aImage, aImageHC );
 
     SvLBoxEntry* pNewEntry = m_pTreeView->getListBox().InsertEntry( _rName, _pParent, _eEntryType == etQueryContainer , LIST_APPEND, _pUserData );
 
@@ -3568,6 +3568,14 @@ void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _
     }
 }
 // -----------------------------------------------------------------------------
+sal_Bool SbaTableQueryBrowser::isHiContrast() const
+{
+    sal_Bool bRet = sal_False;
+    if ( m_pTreeView )
+        bRet = m_pTreeView->getListBox().GetSettings().GetStyleSettings().GetHighContrastMode();
+    return bRet;
+}
+// -----------------------------------------------------------------------------
 void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame)
 {
     if ( m_bShowMenu )
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index e763517..c2d0570 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -533,6 +533,8 @@ namespace
     }
     void lcl_insertMenuItemImages( Menu& _rMenu, IController& _rCommandController )
     {
+        const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+        const BOOL bHiContrast = rSettings.GetHighContrastMode();
         uno::Reference< frame::XController > xController = _rCommandController.getXController();
         uno::Reference< frame::XFrame> xFrame;
         if ( xController.is() )
@@ -554,7 +556,7 @@ namespace
             } // if ( pPopup )
 
             if ( xFrame.is() )
-                _rMenu.SetItemImage(nId,framework::GetImageFromURL(xFrame,aCommand,FALSE));
+                _rMenu.SetItemImage(nId,framework::GetImageFromURL(xFrame,aCommand,FALSE,bHiContrast));
         }
     }
     // =========================================================================
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index eb7a695..7ef87bb 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -105,8 +105,8 @@ OTableTreeListBox::~OTableTreeListBox()
 void OTableTreeListBox::implSetDefaultImages()
 {
     ImageProvider aImageProvider;
-    SetDefaultExpandedEntryBmp(  aImageProvider.getFolderImage( DatabaseObject::TABLE ) );
-    SetDefaultCollapsedEntryBmp( aImageProvider.getFolderImage( DatabaseObject::TABLE ) );
+    SetDefaultExpandedEntryBmp(  aImageProvider.getFolderImage( DatabaseObject::TABLE, false ) );
+    SetDefaultCollapsedEntryBmp( aImageProvider.getFolderImage( DatabaseObject::TABLE, false ) );
 }
 
 // -----------------------------------------------------------------------------
@@ -137,13 +137,16 @@ void OTableTreeListBox::notifyHiContrastChanged()
             {
                 SvLBoxContextBmp* pContextBitmapItem = static_cast< SvLBoxContextBmp* >( pItem );
 
-                Image aImage;
+                Image aImage, aImageHC;
                 if ( isFolderEntry( pEntryLoop ) )
-                    aImage = m_pImageProvider->getFolderImage( DatabaseObject::TABLE );
+                {
+                    aImage = m_pImageProvider->getFolderImage( DatabaseObject::TABLE, false );
+                    aImageHC = m_pImageProvider->getFolderImage( DatabaseObject::TABLE, true );
+                }
                 else
                 {
                     String sCompleteName( getQualifiedTableName( pEntryLoop ) );
-                    m_pImageProvider->getImages( sCompleteName, DatabaseObject::TABLE, aImage );
+                    m_pImageProvider->getImages( sCompleteName, DatabaseObject::TABLE, aImage, aImageHC );
                 }
 
                 pContextBitmapItem->SetBitmap1( aImage );
@@ -497,8 +500,8 @@ SvLBoxEntry* OTableTreeListBox::implAddEntry(
     {
         pRet = InsertEntry( sName, pParentEntry, FALSE, LIST_APPEND );
 
-        Image aImage;
-        m_pImageProvider->getImages( _rTableName, DatabaseObject::TABLE, aImage );
+        Image aImage, aImageHC;
+        m_pImageProvider->getImages( _rTableName, DatabaseObject::TABLE, aImage, aImageHC );
 
         SetExpandedEntryBmp( pRet, aImage );
         SetCollapsedEntryBmp( pRet, aImage );
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx
index 2386674..114a52a 100644
--- a/dbaccess/source/ui/dlg/adtabdlg.cxx
+++ b/dbaccess/source/ui/dlg/adtabdlg.cxx
@@ -298,7 +298,7 @@ void QueryListFacade::updateTableObjectList( bool /*_bAllowViews*/ )
     try
     {
         ImageProvider aImageProvider( m_xConnection );
-        Image aQueryImage( aImageProvider.getDefaultImage( DatabaseObject::QUERY ) );
+        Image aQueryImage( aImageProvider.getDefaultImage( DatabaseObject::QUERY, false ) );
 
         m_rQueryList.SetDefaultExpandedEntryBmp( aQueryImage );
         m_rQueryList.SetDefaultCollapsedEntryBmp( aQueryImage );
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index 17fcc6e..b4a1848 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -888,14 +888,14 @@ DBG_NAME(DbaIndexDialog)
         }
     }
     //------------------------------------------------------------------
-    ImageList DbaIndexDialog::getImageList(sal_Int16 _eBitmapSet) const
+    ImageList DbaIndexDialog::getImageList(sal_Int16 _eBitmapSet,sal_Bool /*_bHiContast*/) const
     {
         sal_Int16 nN = IMG_INDEX_DLG_SC;
-        if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE )
+        if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE )	 	 
         {
             nN = IMG_INDEX_DLG_LC;
-        } // if ( _eBitmapSet == SFX_SYMBOLS_LARGE )
-        return ImageList(ModuleRes( nN ));
+        }
+        return ImageList( nN );
     }
     //------------------------------------------------------------------
     void DbaIndexDialog::resizeControls(const Size& _rDiff)
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index 22bb460..4edc878 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -70,7 +70,7 @@ namespace
     class IImageProvider
     {
     public:
-        virtual Image   getImage() const = 0;
+        virtual Image   getImage( bool _highContrast ) const = 0;
 
         virtual ~IImageProvider() { }
     };
@@ -89,17 +89,27 @@ namespace
     {
     private:
         USHORT  m_defaultImageID;
+        USHORT  m_highContrastImageID;
 
         mutable Image   m_defaultImage;
+        mutable Image   m_highContrastImage;
 
     public:
-        ImageProvider( USHORT _defaultImageID )
+        ImageProvider( USHORT _defaultImageID, USHORT _highContrastImageID )
             :m_defaultImageID( _defaultImageID )
+            ,m_highContrastImageID( _highContrastImageID )
         {
         }
 
-        virtual Image getImage() const
+        virtual Image getImage( bool _highContrast ) const
         {
+            if ( _highContrast )
+            {
+                if ( !m_highContrastImage )
+                    m_highContrastImage = Image( ModuleRes( m_highContrastImageID ) );
+                return m_highContrastImage;
+            }
+
             if ( !m_defaultImage )
                 m_defaultImage = Image( ModuleRes( m_defaultImageID ) );
             return m_defaultImage;
@@ -161,7 +171,9 @@ namespace
             }
 
             if ( !ppProvider->get() )
-                ppProvider->reset( new ImageProvider( nNormalImageID ) );
+                // FIXME: remove second arg from ImageProvider.
+                // FIXME: It used to be high contrast
+                ppProvider->reset( new ImageProvider( nNormalImageID, nNormalImageID ) );
             return *ppProvider;
         }
 
@@ -301,9 +313,9 @@ namespace
     }
 
     //------------------------------------------------------------------------------
-    void lcl_insertExceptionEntry( SvTreeListBox& _rList, size_t _nElementPos, const ExceptionDisplayInfo& _rEntry )
+    void lcl_insertExceptionEntry( SvTreeListBox& _rList, bool _bHiContrast, size_t _nElementPos, const ExceptionDisplayInfo& _rEntry )
     {
-        Image aEntryImage( _rEntry.pImageProvider->getImage() );
+        Image aEntryImage( _rEntry.pImageProvider->getImage( _bHiContrast ) );
         SvLBoxEntry* pListEntry =
             _rList.InsertEntry( _rEntry.pLabelProvider->getLabel(), aEntryImage, aEntryImage );
         pListEntry->SetUserData( reinterpret_cast< void* >( _nElementPos ) );
@@ -362,6 +374,7 @@ OExceptionChainDialog::OExceptionChainDialog( Window* pParent, const ExceptionDi
     m_aExceptionText.SetReadOnly(sal_True);
 
     bool bHave22018 = false;
+    bool bHiContrast = isHiContrast( this );
     size_t elementPos = 0;
 
     for (   ExceptionDisplayChain::const_iterator loop = m_aExceptions.begin();
@@ -369,7 +382,7 @@ OExceptionChainDialog::OExceptionChainDialog( Window* pParent, const ExceptionDi
             ++loop, ++elementPos
         )
     {
-        lcl_insertExceptionEntry( m_aExceptionList, elementPos, *loop );
+        lcl_insertExceptionEntry( m_aExceptionList, bHiContrast, elementPos, *loop );
         bHave22018 = loop->sSQLState.EqualsAscii( "22018" );
     }
 
@@ -385,7 +398,7 @@ OExceptionChainDialog::OExceptionChainDialog( Window* pParent, const ExceptionDi
         aInfo22018.pImageProvider = aProviderFactory.getImageProvider( SQLExceptionInfo::SQL_CONTEXT );
         m_aExceptions.push_back( aInfo22018 );
 
-        lcl_insertExceptionEntry( m_aExceptionList, m_aExceptions.size() - 1, aInfo22018 );
+        lcl_insertExceptionEntry( m_aExceptionList, bHiContrast, m_aExceptions.size() - 1, aInfo22018 );
     }
 }
 
diff --git a/dbaccess/source/ui/imagelists/dbimagelists.src b/dbaccess/source/ui/imagelists/dbimagelists.src
index e296c6d..91bda09 100644
--- a/dbaccess/source/ui/imagelists/dbimagelists.src
+++ b/dbaccess/source/ui/imagelists/dbimagelists.src
@@ -63,6 +63,13 @@ ImageList IMG_INDEX_DLG_LC
     IL_TOOL_2 ;
 };
 
+ImageList IMG_INDEX_DLG_LCH
+{
+    MASKCOLOR;
+    prefix = "lch";
+    IL_TOOL_2 ;
+};
+
 Image IMG_FORMFOLDER_TREE_L
 {
     ImageBitmap = Bitmap { File = "forms_32"; };
diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx
index 3b573f1..6ecab05 100644
--- a/dbaccess/source/ui/inc/UITools.hxx
+++ b/dbaccess/source/ui/inc/UITools.hxx
@@ -266,6 +266,14 @@ namespace dbaui
     */
     void adjustToolBoxSize(ToolBox* _pToolBox);
 
+    /** isHiContrast check if we are in hi contrast mode.
+        @param	_pWindow
+            The window we have to check on.
+        @return
+            <TRUE/> if so, otherwise <FALSE/>
+    */
+    sal_Bool isHiContrast(Window* _pWindow);
+
     void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId );
 
     /** check if SQL92 name checking is enabled
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index af22fc4..7686d3d 100644
--- a/dbaccess/source/ui/inc/dbu_resource.hrc
+++ b/dbaccess/source/ui/inc/dbu_resource.hrc
@@ -256,6 +256,7 @@
 //  ...
 // free
 #define REPORTFOLDER_TREE_ICON          RID_IMAGE_START + 24
+#define	IMG_JOINS_H				RID_IMAGE_START + 32
 #define	IMG_FORMFOLDER_TREE_L			RID_IMAGE_START + 39
 #define	IMG_REPORTFOLDER_TREE_L			RID_IMAGE_START + 40
 #define	IMG_QUERYFOLDER_TREE_L			RID_IMAGE_START + 41
diff --git a/dbaccess/source/ui/inc/imageprovider.hxx b/dbaccess/source/ui/inc/imageprovider.hxx
index b1a2c6c..1ad4678 100644
--- a/dbaccess/source/ui/inc/imageprovider.hxx
+++ b/dbaccess/source/ui/inc/imageprovider.hxx
@@ -87,13 +87,16 @@ namespace dbaui
                 the name of the object
             @param  _out_rImage
                 the normal image to use for the object
+            @param  _out_rImageHC
+                the high-contrast version of the image to use for the object
             @return
                 the image to be used for the object.
         */
         void getImages(
             const String& _rName,
             const sal_Int32 _nDatabaseObjectType,
-            Image& _out_rImage
+            Image& _out_rImage,
+            Image& _out_rImageHC
         );
 
         /** returns the default image to be used for a database object
@@ -105,11 +108,19 @@ namespace dbaui
             @param  _nDatabaseObjectType
                 the type of the object. Must be one of the css.sdb.application.DatabaseObject
                 constants.
+            @param  _bHighContrast
+                indicates whether High-Contrast icons should be used.
+                Note that normally, this would be some application-wide setting. However,
+                in current OOo, HC support is decided on a per-control basis, means every
+                control decides itself whether its images must be HC versions or not.
+                Thus callers need to specify this flag.
             @return
                 the image to be used for the object type.
         */
         Image getDefaultImage(
-            sal_Int32 _nDatabaseObjectType);
+            sal_Int32 _nDatabaseObjectType,
+            bool _bHighContrast
+        );
 
         /** returns the resource ID for the default image to be used for a database object
 
@@ -120,12 +131,19 @@ namespace dbaui
             @param  _nDatabaseObjectType
                 the type of the object. Must be one of the css.sdb.application.DatabaseObject
                 constants.
+            @param  _bHighContrast
+                indicates whether High-Contrast icons should be used.
+                Note that normally, this would be some application-wide setting. However,
+                in current OOo, HC support is decided on a per-control basis, means every
+                control decides itself whether its images must be HC versions or not.
+                Thus callers need to specify this flag.
             @return
                 the resource ID image to be used for the object type. Must be fed into a
                 ModuleRes instance to actually load the image.
         */
         USHORT getDefaultImageResourceID(
-            sal_Int32 _nDatabaseObjectType
+            sal_Int32 _nDatabaseObjectType,
+            bool _bHighContrast
         );
 
         /** retrieves the image to be used for folders of database objects
@@ -134,18 +152,31 @@ namespace dbaui
                 constants.
             @param  _rName
                 the name of the object
+            @param  _bHighContrast
+                indicates whether High-Contrast icons should be used.
+                Note that normally, this would be some application-wide setting. However,
+                in current OOo, HC support is decided on a per-control basis, means every
+                control decides itself whether its images must be HC versions or not.
+                Thus callers need to specify this flag.
             @return
                 the image to be used for folders of the given type
         */
         Image getFolderImage(
-            sal_Int32 _nDatabaseObjectType
+            sal_Int32 _nDatabaseObjectType,
+            bool _bHighContrast
         );
 
         /** retrieves the image to be used for a database as a whole.
+            @param  _bHighContrast
+                indicates whether High-Contrast icons should be used.
+                Note that normally, this would be some application-wide setting. However,
+                in current OOo, HC support is decided on a per-control basis, means every
+                control decides itself whether its images must be HC versions or not.
+                Thus callers need to specify this flag.
             @return
                 the image to be used for folders of this type
         */
-        Image getDatabaseImage();
+        Image getDatabaseImage( bool _bHighContrast );
     };
 
 //........................................................................
diff --git a/dbaccess/source/ui/inc/indexdialog.hxx b/dbaccess/source/ui/inc/indexdialog.hxx
index 88f7d21..965407e 100644
--- a/dbaccess/source/ui/inc/indexdialog.hxx
+++ b/dbaccess/source/ui/inc/indexdialog.hxx
@@ -133,8 +133,10 @@ namespace dbaui
         /** will be called whenthe id of the image list is needed.
             @param	_eBitmapSet
                 <svtools/imgdef.hxx>
+            @param	_bHiContast
+                <TRUE/> when in high contrast mode.
         */
-        virtual ImageList getImageList(sal_Int16 _eBitmapSet) const;
+        virtual ImageList getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const;
 
         /** will be called when the controls need to be resized.
         */
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 507003f..0d6ef5d 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -471,6 +471,9 @@ namespace dbaui
         // remove all grid columns and dispose them
         void clearGridColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _xColContainer);
 
+        sal_Bool isHiContrast() const;
+
+
         /** checks if the currently displayed entry changed
             @param	_sName
                     Name of the changed entry
diff --git a/dbaccess/source/ui/misc/ToolBoxHelper.cxx b/dbaccess/source/ui/misc/ToolBoxHelper.cxx
index e3c664c..78b4fb7 100644
--- a/dbaccess/source/ui/misc/ToolBoxHelper.cxx
+++ b/dbaccess/source/ui/misc/ToolBoxHelper.cxx
@@ -40,7 +40,8 @@ namespace dbaui
 {
     DBG_NAME(OToolBoxHelper)
     OToolBoxHelper::OToolBoxHelper()
-        :m_nSymbolsSize(-1 )
+        : m_bIsHiContrast(sal_False)
+        ,m_nSymbolsSize(-1 )
         ,m_pToolBox(NULL)
     {
         DBG_CTOR(OToolBoxHelper,NULL);
@@ -63,11 +64,14 @@ namespace dbaui
         if ( m_pToolBox )
         {
             sal_Int16 nCurSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize();
-            if ( nCurSymbolsSize != m_nSymbolsSize )
+            if ( nCurSymbolsSize != m_nSymbolsSize || 
+                m_bIsHiContrast != m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode() )
             {
                 m_nSymbolsSize	= nCurSymbolsSize;
+                m_bIsHiContrast = m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode();
+
                 
-                m_pToolBox->SetImageList( getImageList(m_nSymbolsSize) );
+                m_pToolBox->SetImageList( getImageList(m_nSymbolsSize,m_bIsHiContrast) );
                 Size aTbOldSize = m_pToolBox->GetSizePixel();
                 adjustToolBoxSize(m_pToolBox);
                 Size aTbNewSize = m_pToolBox->GetSizePixel();
@@ -113,6 +117,7 @@ namespace dbaui
         m_pToolBox = _pTB;
         if ( m_pToolBox )
         {
+            //	m_bIsHiContrast = m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode();
             ConfigOptionsChanged(NULL);
             if ( bFirstTime )
                 adjustToolBoxSize(m_pToolBox);
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 52a9f5f..5ab191e 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -1149,6 +1149,21 @@ void adjustToolBoxSize(ToolBox* _pToolBox)
         _pToolBox->Invalidate();
     }
 }
+// -----------------------------------------------------------------------------
+sal_Bool isHiContrast(Window* _pWindow)
+{
+    OSL_ENSURE(_pWindow,"Window must be not null!");
+    Window* pIter = _pWindow;
+    //	while( pIter &&  pIter->GetBackground().GetColor().GetColor() == COL_TRANSPARENT )
+    while( pIter )
+    {
+        if ( pIter->GetBackground().GetColor().GetColor() == COL_TRANSPARENT )
+            pIter = pIter->GetParent();
+        else
+            break;
+    }
+    return pIter && pIter->GetSettings().GetStyleSettings().GetHighContrastMode();
+}
 
 // -----------------------------------------------------------------------------
 void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId )
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index f7a02e3..ea928c9 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -246,7 +246,7 @@ OWizTypeSelect::OWizTypeSelect( Window* pParent, SvStream* _pStream )
     DBG_CTOR(OWizTypeSelect,NULL);
     m_lbColumnNames.SetSelectHdl(LINK(this,OWizTypeSelect,ColumnSelectHdl));
 
-    ModuleRes aModuleRes(IMG_JOINS);
+    ModuleRes aModuleRes(isHiContrast(&m_lbColumnNames) ? IMG_JOINS_H : IMG_JOINS);
     ImageList aImageList(aModuleRes);
     m_imgPKey = aImageList.GetImage(IMG_PRIMARY_KEY);
 
diff --git a/dbaccess/source/ui/misc/imageprovider.cxx b/dbaccess/source/ui/misc/imageprovider.cxx
index 568fb98..9c05862 100644
--- a/dbaccess/source/ui/misc/imageprovider.cxx
+++ b/dbaccess/source/ui/misc/imageprovider.cxx
@@ -82,12 +82,15 @@ namespace dbaui
     {
         //................................................................
         static void lcl_getConnectionProvidedTableIcon_nothrow(  const ImageProvider_Data& _rData,
-            const ::rtl::OUString& _rName, Reference< XGraphic >& _out_rxGraphic )
+            const ::rtl::OUString& _rName, Reference< XGraphic >& _out_rxGraphic, Reference< XGraphic >& _out_rxGraphicHC )
         {
             try
             {
                 if ( _rData.xTableUI.is() )
+                {
                     _out_rxGraphic = _rData.xTableUI->getTableIcon( _rName, GraphicColorMode::NORMAL );
+                    _out_rxGraphicHC = _rData.xTableUI->getTableIcon( _rName, GraphicColorMode::HIGH_CONTRAST );
+                }
             }
             catch( const Exception& )
             {
@@ -97,16 +100,20 @@ namespace dbaui
 
         //................................................................
         static void lcl_getTableImageResourceID_nothrow( const ImageProvider_Data& _rData, const ::rtl::OUString& _rName,
-            USHORT& _out_rResourceID )
+            USHORT& _out_rResourceID, USHORT& _out_rResourceID_HC )
         {
             _out_rResourceID = 0;
             try
             {
                 bool bIsView = _rData.xViews.is() && _rData.xViews->hasByName( _rName );
                 if ( bIsView )
+                {
                     _out_rResourceID = VIEW_TREE_ICON;
+                }
                 else
+                {
                     _out_rResourceID = TABLE_TREE_ICON;
+                }
             }
             catch( const Exception& )
             {
@@ -143,45 +150,52 @@ namespace dbaui
     }
 
     //--------------------------------------------------------------------
-    void ImageProvider::getImages( const String& _rName, const sal_Int32 _nDatabaseObjectType, Image& _out_rImage )
+    void ImageProvider::getImages( const String& _rName, const sal_Int32 _nDatabaseObjectType, Image& _out_rImage, Image& _out_rImageHC )
     {
         if ( _nDatabaseObjectType != DatabaseObject::TABLE )
         {
             // for types other than tables, the icon does not depend on the concrete object
-            _out_rImage = getDefaultImage( _nDatabaseObjectType );
+            _out_rImage = getDefaultImage( _nDatabaseObjectType, false );
+            _out_rImageHC = getDefaultImage( _nDatabaseObjectType, true );
         }
         else
         {
             // check whether the connection can give us an icon
             Reference< XGraphic > xGraphic;
-            lcl_getConnectionProvidedTableIcon_nothrow( *m_pData, _rName, xGraphic );
+            Reference< XGraphic > xGraphicHC;
+            lcl_getConnectionProvidedTableIcon_nothrow( *m_pData, _rName, xGraphic, xGraphicHC );
             if ( xGraphic.is() )
                 _out_rImage = Image( xGraphic );
+            if ( xGraphicHC.is() )
+                _out_rImageHC = Image( xGraphicHC );
 
-            if ( !_out_rImage )
+            if ( !_out_rImage || !_out_rImageHC )
             {
                 // no -> determine by type
                 USHORT nImageResourceID = 0;
-                lcl_getTableImageResourceID_nothrow( *m_pData, _rName, nImageResourceID );
+                USHORT nImageResourceID_HC = 0;
+                lcl_getTableImageResourceID_nothrow( *m_pData, _rName, nImageResourceID, nImageResourceID_HC );
 
                 if ( nImageResourceID && !_out_rImage )
                     _out_rImage = Image( ModuleRes( nImageResourceID ) );
+                if ( nImageResourceID_HC && !_out_rImageHC )
+                    _out_rImageHC = Image( ModuleRes( nImageResourceID_HC ) );
             }
         }
     }
 
     //--------------------------------------------------------------------
-    Image ImageProvider::getDefaultImage( sal_Int32 _nDatabaseObjectType )
+    Image ImageProvider::getDefaultImage( sal_Int32 _nDatabaseObjectType, bool _bHighContrast )
     {
         Image aObjectImage;
-        USHORT nImageResourceID( getDefaultImageResourceID( _nDatabaseObjectType ) );
+        USHORT nImageResourceID( getDefaultImageResourceID( _nDatabaseObjectType, _bHighContrast ) );
         if ( nImageResourceID )
             aObjectImage = Image( ModuleRes( nImageResourceID ) );
         return aObjectImage;
     }
 
     //--------------------------------------------------------------------
-    USHORT ImageProvider::getDefaultImageResourceID( sal_Int32 _nDatabaseObjectType )
+    USHORT ImageProvider::getDefaultImageResourceID( sal_Int32 _nDatabaseObjectType, bool /*_bHighContrast*/ )
     {
         USHORT nImageResourceID( 0 );
         switch ( _nDatabaseObjectType )
@@ -206,7 +220,7 @@ namespace dbaui
     }
 
     //--------------------------------------------------------------------
-    Image ImageProvider::getFolderImage( sal_Int32 _nDatabaseObjectType )
+    Image ImageProvider::getFolderImage( sal_Int32 _nDatabaseObjectType, bool _/*bHighContrast*/ )
     {
         USHORT nImageResourceID( 0 );
         switch ( _nDatabaseObjectType )
@@ -235,7 +249,7 @@ namespace dbaui
     }
 
     //--------------------------------------------------------------------
-    Image ImageProvider::getDatabaseImage()
+    Image ImageProvider::getDatabaseImage( bool /*_bHighContrast*/ )
     {
         return Image( ModuleRes( DATABASE_TREE_ICON ) );
     }
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 0c7562a..c3f56de 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -188,7 +188,7 @@ BOOL OTableWindow::FillListBox()
             m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
     }
     // mark all primary keys with special image
-    ModuleRes TmpRes(IMG_JOINS);
+    ModuleRes TmpRes(isHiContrast(m_pListBox) ? IMG_JOINS_H : IMG_JOINS);
     ImageList aImageList(TmpRes);
     Image aPrimKeyImage = aImageList.GetImage(IMG_PRIMARY_KEY);
 
@@ -273,10 +273,10 @@ void OTableWindow::impl_updateImage()
 {
     ImageProvider aImageProvider( getDesignView()->getController().getConnection() );
 
-    Image aImage;
-    aImageProvider.getImages( GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE, aImage );
+    Image aImage, aImageHC;
+    aImageProvider.getImages( GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE, aImage, aImageHC );
 
-    if ( !aImage )
+    if ( !aImage || !aImageHC )
     {
         OSL_ENSURE( false, "OTableWindow::impl_updateImage: no images!" );
         return;
diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src
index ea8ff40..3dd1180 100644
--- a/dbaccess/source/ui/querydesign/query.src
+++ b/dbaccess/source/ui/querydesign/query.src
@@ -110,6 +110,20 @@ ImageList IMG_JOINS
     };
     IdCount = { 2; };
 };
+ImageList IMG_JOINS_H
+{
+    Prefix = "joh";
+    MaskColor   = Color {
+            Red   = 0xffff;
+            Green = 0x0000;
+            Blue  = 0xffff;
+    };
+    IdList = {
+        IMG_PRIMARY_KEY; IMG_FOREIGN_KEY;
+    };
+    IdCount = { 2; };
+};
+
 String STR_QUERY_UNDO_TABWINSHOW
 {
     Text [ en-US ] = "Add Table Window" ;


More information about the Libreoffice-commits mailing list