valueset.cxx (2bfcd321) valueset.cxx (ca6f8f21)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 24 unchanged lines hidden (view full) ---

33#ifndef _HELP_HXX
34#include <vcl/help.hxx>
35#endif
36#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
37#include <com/sun/star/accessibility/AccessibleEventId.hpp>
38#include <com/sun/star/accessibility/AccessibleStateType.hpp>
39#include <com/sun/star/lang/XComponent.hpp>
40#include <rtl/ustring.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 24 unchanged lines hidden (view full) ---

33#ifndef _HELP_HXX
34#include <vcl/help.hxx>
35#endif
36#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
37#include <com/sun/star/accessibility/AccessibleEventId.hpp>
38#include <com/sun/star/accessibility/AccessibleStateType.hpp>
39#include <com/sun/star/lang/XComponent.hpp>
40#include <rtl/ustring.hxx>
41
41#include <svtools/accessibilityoptions.hxx>
42#include "valueimp.hxx"
43
44#define _SV_VALUESET_CXX
45#include <svtools/valueset.hxx>
46
47// ------------
48// - ValueSet -
49// ------------

--- 229 unchanged lines hidden (view full) ---

279 }
280 else
281 maVirDev.DrawText( aTxtPos, pItem->maText );
282 }
283 else if ( pItem->meType == VALUESETITEM_COLOR )
284 {
285 maVirDev.SetFillColor( pItem->maColor );
286 maVirDev.DrawRect( aRect );
42#include "valueimp.hxx"
43
44#define _SV_VALUESET_CXX
45#include <svtools/valueset.hxx>
46
47// ------------
48// - ValueSet -
49// ------------

--- 229 unchanged lines hidden (view full) ---

279 }
280 else
281 maVirDev.DrawText( aTxtPos, pItem->maText );
282 }
283 else if ( pItem->meType == VALUESETITEM_COLOR )
284 {
285 maVirDev.SetFillColor( pItem->maColor );
286 maVirDev.DrawRect( aRect );
287
288 const SvtAccessibilityOptions aOptions;
289 const sal_Int16 nEdgeBlendingPercent(aOptions.GetEdgeBlending());
290 static bool bTest(false);
291
292 if(nEdgeBlendingPercent && bTest)
293 {
294 Bitmap aBitmap(maVirDev.GetBitmap(aRect.TopLeft(), aRect.GetSize()));
295
296 if(!aBitmap.IsEmpty())
297 {
298 const Color aTopLeft(COL_WHITE);
299 const Color aBottomRight(COL_BLACK);
300 const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
301
302 aBitmap.DrawBlendFrame(nAlpha, aTopLeft, aBottomRight);
303 maVirDev.DrawBitmap(aRect.TopLeft(), aBitmap);
304 }
305 }
287 }
288 else
289 {
290 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
291 if ( IsColor() )
292 maVirDev.SetFillColor( maColor );
293 else if ( nStyle & WB_MENUSTYLEVALUESET )
294 maVirDev.SetFillColor( rStyleSettings.GetMenuColor() );

--- 905 unchanged lines hidden (view full) ---

1200sal_uInt16 ValueSet::ImplGetVisibleItemCount() const
1201{
1202 sal_uInt16 nRet = 0;
1203
1204 for( sal_Int32 n = 0, nItemCount = mpImpl->mpItemList->Count(); n < nItemCount; n++ )
1205 {
1206 ValueSetItem* pItem = mpImpl->mpItemList->GetObject( n );
1207
306 }
307 else
308 {
309 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
310 if ( IsColor() )
311 maVirDev.SetFillColor( maColor );
312 else if ( nStyle & WB_MENUSTYLEVALUESET )
313 maVirDev.SetFillColor( rStyleSettings.GetMenuColor() );

--- 905 unchanged lines hidden (view full) ---

1219sal_uInt16 ValueSet::ImplGetVisibleItemCount() const
1220{
1221 sal_uInt16 nRet = 0;
1222
1223 for( sal_Int32 n = 0, nItemCount = mpImpl->mpItemList->Count(); n < nItemCount; n++ )
1224 {
1225 ValueSetItem* pItem = mpImpl->mpItemList->GetObject( n );
1226
1208 //IAccessible2 implementation - also count empty rectangles as visible...
1209 // if( pItem->meType != VALUESETITEM_SPACE && !pItem->maRect.IsEmpty() )
1210 if( pItem->meType != VALUESETITEM_SPACE )
1227 if( pItem->meType != VALUESETITEM_SPACE && !pItem->maRect.IsEmpty() )
1211 nRet++;
1212 }
1213
1214 return nRet;
1215}
1216
1217// -----------------------------------------------------------------------
1218

--- 669 unchanged lines hidden (view full) ---

1888 pItem->maText = rText;
1889 mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos );
1890
1891 mbFormat = sal_True;
1892 if ( IsReallyVisible() && IsUpdateMode() )
1893 Invalidate();
1894}
1895
1228 nRet++;
1229 }
1230
1231 return nRet;
1232}
1233
1234// -----------------------------------------------------------------------
1235

--- 669 unchanged lines hidden (view full) ---

1905 pItem->maText = rText;
1906 mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos );
1907
1908 mbFormat = sal_True;
1909 if ( IsReallyVisible() && IsUpdateMode() )
1910 Invalidate();
1911}
1912
1896//IAccessibility2 Implementation 2009-----
1897//method to set accessible when the style is user draw.
1898void ValueSet::InsertItem( sal_uInt16 nItemId, const XubString& rText, sal_uInt16 nPos )
1899{
1900 DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
1901 DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
1902 "ValueSet::InsertItem(): ItemId already exists" );
1903 ValueSetItem* pItem = new ValueSetItem( *this );
1904 pItem->mnId = nItemId;
1905 pItem->meType = VALUESETITEM_USERDRAW;
1906 pItem->maText = rText;
1907 mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos );
1908 mbFormat = sal_True;
1909 if ( IsReallyVisible() && IsUpdateMode() )
1910 Invalidate();
1911}
1912//-----IAccessibility2 Implementation 2009
1913
1914// -----------------------------------------------------------------------
1915
1916void ValueSet::InsertItem( sal_uInt16 nItemId, sal_uInt16 nPos )
1917{
1918 DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
1919 DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
1920 "ValueSet::InsertItem(): ItemId already exists" );
1921

--- 845 unchanged lines hidden (view full) ---

2767
2768const Link& ValueSet::GetHighlightHdl() const
2769{
2770 return mpImpl->maHighlightHdl;
2771}
2772
2773// -----------------------------------------------------------------------
2774
1913// -----------------------------------------------------------------------
1914
1915void ValueSet::InsertItem( sal_uInt16 nItemId, sal_uInt16 nPos )
1916{
1917 DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
1918 DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
1919 "ValueSet::InsertItem(): ItemId already exists" );
1920

--- 845 unchanged lines hidden (view full) ---

2766
2767const Link& ValueSet::GetHighlightHdl() const
2768{
2769 return mpImpl->maHighlightHdl;
2770}
2771
2772// -----------------------------------------------------------------------
2773
2775//IAccessibility2 Implementation 2009-----
2776//For sending out the focused event on the first focused item when this valueset is first focused.
2777// MT: Focus notifications changed in DEV300 meanwhile, so this is not used for now.
2778// Just keeping it here for reference, in case something in out implementation doesn't work as expected...
2779/*
2780void ValueSet::SetFocusedItem(sal_Bool bFocused)
2781{
2782 if( ImplHasAccessibleListeners() )
2783 {
2784 // selection event
2785 ::com::sun::star::uno::Any aSelOldAny, aSelNewAny;
2786 if ( mnSelItemId >= 0)
2787 {
2788 // focus event (select)
2789 sal_uInt16 nPos = GetItemPos( mnSelItemId );
2790
2791 ValueSetItem* pItem;
2792 if ((GetStyle() & WB_NONEFIELD) != 0
2793 && nPos == VALUESET_ITEM_NOTFOUND
2794 && mnSelItemId == 0)
2795 {
2796 // When present the first item is the then allways visible none field.
2797 pItem = ImplGetItem (VALUESET_ITEM_NONEITEM);
2798 }
2799 else
2800 {
2801 if (nPos == VALUESET_ITEM_NOTFOUND)
2802 nPos = 0;
2803 pItem = mpImpl->mpItemList->GetObject(nPos);
2804 }
2805 ValueItemAcc* pItemAcc = NULL;
2806 if (pItem != NULL)
2807 pItemAcc = ValueItemAcc::getImplementation(pItem->GetAccessible(mpImpl->mbIsTransientChildrenDisabled) );
2808 if( pItemAcc )
2809 {
2810 if (bFocused)
2811 aSelNewAny <<= pItem->GetAccessible(mpImpl->mbIsTransientChildrenDisabled);
2812 else
2813 aSelOldAny <<= pItem->GetAccessible(mpImpl->mbIsTransientChildrenDisabled);
2814 }
2815 ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aSelOldAny, aSelNewAny );
2816 if (pItemAcc && bFocused)
2817 {
2818 pItemAcc->FireAccessibleEvent(
2819 ::com::sun::star::accessibility::AccessibleEventId::SELECTION_CHANGED,
2820 ::com::sun::star::uno::Any(),::com::sun::star::uno::Any());
2821 }
2822 }
2823 }
2824}
2825*/
2826//end
2827//-----IAccessibility2 Implementation 2009
2828