diff options
author | Armin Le Grand <alg@apache.org> | 2013-04-22 15:38:05 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-20 11:33:18 +0100 |
commit | 60285fdc868635f99644ef1d8a195a2be87074c7 (patch) | |
tree | dbd69b9d424b527357c2ba33c2256e99edca3d91 | |
parent | 3af7ae5ef74756b33d35a67b7a6cee44acf79737 (diff) |
Related: #i122041# More unifications for FillStyles
better defaults and better preview visualizations
(cherry picked from commit 35c9acfc98fc98399005815e0464b1944f327d4e)
Conflicts:
officecfg/registry/schema/org/openoffice/Office/Common.xcs
svtools/inc/svtools/accessibilityoptions.hxx
svtools/inc/svtools/valueset.hxx
svtools/source/config/accessibilityoptions.cxx
svtools/source/control/ctrlbox.cxx
svtools/source/control/valueset.cxx
svtools/source/inc/configitems/accessibilityoptions_const.hxx
svx/inc/svx/dlgctrl.hxx
svx/inc/svx/xtable.hxx
svx/source/dialog/dlgctrl.cxx
svx/source/tbxctrls/SvxColorValueSet.cxx
svx/source/xoutdev/xtabdash.cxx
svx/source/xoutdev/xtable.cxx
vcl/inc/ilstbox.hxx
vcl/inc/vcl/combobox.hxx
vcl/inc/vcl/lstbox.hxx
vcl/inc/vcl/settings.hxx
vcl/source/app/settings.cxx
vcl/source/control/combobox.cxx
vcl/source/control/ilstbox.cxx
vcl/source/control/lstbox.cxx
Change-Id: I905b6814cb796a35aa23fedb9ce716f77e2bfda0
27 files changed, 705 insertions, 707 deletions
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 4d3576d27731..c052931a708d 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -555,8 +555,8 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl) if( pEntry ) { pBitmapList->Insert( pEntry ); - const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight()); - aLbBitmaps.Append(aUiSize, *pEntry ); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + aLbBitmaps.Append(rStyleSettings.GetListBoxPreviewDefaultPixelSize(), *pEntry ); aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); #ifdef WNT @@ -657,8 +657,8 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl) XBitmapEntry* pEntry = new XBitmapEntry( aGraphic, aName ); pBitmapList->Insert( pEntry ); - const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight()); - aLbBitmaps.Append(aUiSize, *pEntry ); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + aLbBitmaps.Append(rStyleSettings.GetListBoxPreviewDefaultPixelSize(), *pEntry ); aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); #ifdef WNT @@ -706,7 +706,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl) long nCount = pBitmapList->Count(); sal_Bool bDifferent = sal_False; sal_Bool bLoop = sal_True; - const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight()); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); while( bLoop && pDlg->Execute() == RET_OK ) { @@ -731,7 +731,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl) pEntry->SetGraphicObject(Graphic(aBitmapEx)); - aLbBitmaps.Modify( aUiSize, *pEntry, nPos ); + aLbBitmaps.Modify( rStyleSettings.GetListBoxPreviewDefaultPixelSize(), *pEntry, nPos ); aLbBitmaps.SelectEntryPos( nPos ); *pnBitmapListState |= CT_MODIFIED; diff --git a/include/svtools/accessibilityoptions.hxx b/include/svtools/accessibilityoptions.hxx index 52b12b9b60b4..87604393d550 100644 --- a/include/svtools/accessibilityoptions.hxx +++ b/include/svtools/accessibilityoptions.hxx @@ -49,15 +49,14 @@ public: sal_Bool IsSelectionInReadonly() const; sal_Bool GetAutoDetectSystemHC() const; - // options for configuring the look and feel for the ColorValueSet (color selector) - sal_Int16 GetColorValueSetMaximumRowCount() const; - sal_Int16 GetColorValueSetEntryEdgeLength() const; - sal_Int16 GetColorValueSetColumnCount() const; - // option to activate EdgeBlending for previews in the UI (ColorValueSet, ColorDropDown, // FillStyle/LineStyle previews, etc...). 0 == off, 100% == full paint, in-between == alpha sal_Int16 GetEdgeBlending() const; + // option to set a maximum line count for ListBoxes; when less or equal than this count + // is in a ListBox, all will be shown, else a ScrollBar will be used + sal_Int16 GetListBoxMaximumLineCount() const; + void SetIsForPagePreviews(sal_Bool bSet); void SetIsHelpTipsDisappear(sal_Bool bSet); void SetIsAllowAnimatedGraphics(sal_Bool bSet); @@ -68,10 +67,8 @@ public: void SetSelectionInReadonly(sal_Bool bSet); void SetAutoDetectSystemHC(sal_Bool bSet); - void SetColorValueSetMaximumRowCount(sal_Int16 nSet); - void SetColorValueSetEntryEdgeLength(sal_Int16 nSet); - void SetColorValueSetColumnCount(sal_Int16 nSet); void SetEdgeBlending(sal_Int16 nSet); + void SetListBoxMaximumLineCount(sal_Int16 nSet); sal_Bool IsModified() const; void Commit(); diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 70fcd008c363..d26705a3324d 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -214,15 +214,21 @@ private: long mnLines; long mnUserItemWidth; long mnUserItemHeight; - sal_uInt16 mnSelItemId; - sal_uInt16 mnHighItemId; - sal_uInt16 mnCols; - sal_uInt16 mnCurCol; - sal_uInt16 mnUserCols; - sal_uInt16 mnUserVisLines; - sal_uInt16 mnFirstLine; - sal_uInt16 mnSpacing; - sal_uInt16 mnFrameStyle; + sal_uInt16 mnSelItemId; + sal_uInt16 mnHighItemId; + sal_uInt16 mnCols; + sal_uInt16 mnCurCol; + sal_uInt16 mnUserCols; + sal_uInt16 mnUserVisLines; + sal_uInt16 mnFirstLine; + sal_uInt16 mnSpacing; + sal_uInt16 mnFrameStyle; + Color maColor; + Link maDoubleClickHdl; + Link maSelectHdl; + Link maHighlightHdl; + + // bitfield bool mbFormat : 1; bool mbHighlight : 1; bool mbSelection : 1; @@ -232,12 +238,9 @@ private: bool mbDoubleSel : 1; bool mbScroll : 1; bool mbFullMode : 1; + bool mbEdgeBlending : 1; bool mbIsTransientChildrenDisabled : 1; bool mbHasVisibleItems : 1; - Color maColor; - Link maDoubleClickHdl; - Link maSelectHdl; - Link maHighlightHdl; friend class ValueSetAcc; friend class ValueItemAcc; @@ -380,6 +383,9 @@ public: const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } void SetHighlightHdl( const Link& rLink ); + + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew); }; #endif // _VALUESET_HXX diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 549b27356d88..a3c56cec39ec 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -218,12 +218,10 @@ public: class SVX_DLLPUBLIC HatchingLB : public ListBox { XHatchListRef mpList; - sal_Bool mbUserDraw; public: - HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True ); + explicit HatchingLB(Window* pParent, ResId Id); virtual void Fill( const XHatchListRef &pList ); - virtual void UserDraw( const UserDrawEvent& rUDEvt ); void Append( XHatchEntry* pEntry, Bitmap* pBmp = NULL ); void Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); @@ -234,13 +232,11 @@ public: class SVX_DLLPUBLIC GradientLB : public ListBox { XGradientListRef mpList; - sal_Bool mbUserDraw; public: - GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True ); - GradientLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw = sal_True ); + explicit GradientLB(Window* pParent, ResId Id); + explicit GradientLB(Window* pParent, WinBits aWB); virtual void Fill( const XGradientListRef &pList ); - virtual void UserDraw( const UserDrawEvent& rUDEvt ); void Append( XGradientEntry* pEntry, Bitmap* pBmp = NULL ); void Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); @@ -253,23 +249,18 @@ public: class SVX_DLLPUBLIC BitmapLB : public ListBox { public: - BitmapLB(Window* pParent, ResId Id, bool bUserDraw = true); + explicit BitmapLB(Window* pParent, ResId Id); virtual void Fill(const XBitmapListRef &pList); - virtual void UserDraw(const UserDrawEvent& rUDEvt); void Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx = 0); void Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = 0); void SelectEntryByList(const XBitmapList* pList, const String& rStr); private: - VirtualDevice maVD; BitmapEx maBitmapEx; XBitmapListRef mpList; - bool mbUserDraw; - - SVX_DLLPRIVATE void SetVirtualDevice(const Size& rSize); }; /************************************************************************/ @@ -277,11 +268,8 @@ private: class FillAttrLB : public ColorListBox { private: - VirtualDevice maVD; BitmapEx maBitmapEx; - void SetVirtualDevice(const Size& rSize); - public: FillAttrLB( Window* pParent, WinBits aWB ); diff --git a/include/svx/xtable.hxx b/include/svx/xtable.hxx index 4ceca46904da..9ac5b2e75287 100644 --- a/include/svx/xtable.hxx +++ b/include/svx/xtable.hxx @@ -282,10 +282,6 @@ public: inline XBitmapListRef AsBitmapList(); inline XLineEndListRef AsLineEndList(); inline XGradientListRef AsGradientList(); - - sal_uInt32 getUiBitmapWidth() const; - sal_uInt32 getUiBitmapHeight() const; - sal_uInt32 getUiBitmapLineWidth() const; }; // ------------------ diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index 63518749a494..1fcfe314ee08 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -116,6 +116,7 @@ public: Rectangle GetDropDownPosSizePixel() const; + void AdaptDropDownLineCountToMaximum(); void SetDropDownLineCount( sal_uInt16 nLines ); sal_uInt16 GetDropDownLineCount() const; diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index b66223328cbe..61f8b24b5f0d 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -41,13 +41,16 @@ private: ImplListBoxFloatingWindow* mpFloatWin; ImplWin* mpImplWin; ImplBtn* mpBtn; - sal_uInt16 mnDDHeight; - sal_uInt16 mnSaveValue; - sal_Bool mbDDAutoSize; + sal_uInt16 mnDDHeight; + sal_uInt16 mnSaveValue; sal_Int32 m_nMaxWidthChars; Link maSelectHdl; Link maDoubleClickHdl; - sal_uInt16 mnLineCount; + sal_uInt16 mnLineCount; + + /// bitfield + bool mbDDAutoSize : 1; + bool mbEdgeBlending : 1; private: SAL_DLLPRIVATE void ImplInitListBoxData(); @@ -102,11 +105,12 @@ public: Rectangle GetDropDownPosSizePixel() const; + void AdaptDropDownLineCountToMaximum(); void SetDropDownLineCount( sal_uInt16 nLines ); sal_uInt16 GetDropDownLineCount() const; - void EnableAutoSize( sal_Bool bAuto ); - sal_Bool IsAutoSizeEnabled() const { return mbDDAutoSize; } + void EnableAutoSize( bool bAuto ); + bool IsAutoSizeEnabled() const { return mbDDAutoSize; } void EnableDDAutoWidth( sal_Bool b ); @@ -199,6 +203,9 @@ public: void EnableMirroring(); + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew); + /** checks whether a certain point lies within the bounds of a listbox item and returns the item as well as the character position the point is at. diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 19dc20f3ba12..2c861cdb356c 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -318,29 +318,29 @@ private: long mnIconHorzSpace; long mnIconVertSpace; long mnAntialiasedMin; - sal_uLong mnCursorBlinkTime; - sal_uLong mnDragFullOptions; - sal_uLong mnAnimationOptions; - sal_uLong mnSelectionOptions; - sal_uLong mnLogoDisplayTime; - sal_uLong mnDisplayOptions; - sal_uLong mnToolbarIconSize; - sal_uLong mnUseFlatMenus; - sal_uLong mnOptions; - sal_uInt16 mnScreenZoom; - sal_uInt16 mnScreenFontZoom; - sal_uInt16 mnHighContrast; - sal_uInt16 mnUseSystemUIFonts; - sal_uInt16 mnAutoMnemonic; - sal_uInt16 mnUseImagesInMenus; - sal_uLong mnUseFlatBorders; - sal_Bool mbPreferredUseImagesInMenus; + sal_uLong mnCursorBlinkTime; + sal_uLong mnDragFullOptions; + sal_uLong mnAnimationOptions; + sal_uLong mnSelectionOptions; + sal_uLong mnLogoDisplayTime; + sal_uLong mnDisplayOptions; + sal_uLong mnToolbarIconSize; + sal_uLong mnUseFlatMenus; + sal_uLong mnOptions; + sal_uInt16 mnScreenZoom; + sal_uInt16 mnScreenFontZoom; + sal_uInt16 mnHighContrast; + sal_uInt16 mnUseSystemUIFonts; + sal_uInt16 mnAutoMnemonic; + sal_uInt16 mnUseImagesInMenus; + sal_uLong mnUseFlatBorders; + sal_Bool mbPreferredUseImagesInMenus; long mnMinThumbSize; - sal_uLong mnSymbolsStyle; - sal_uLong mnPreferredSymbolsStyle; - sal_uInt16 mnSkipDisabledInMenus; - sal_Bool mbHideDisabledMenuItems; - sal_Bool mbAcceleratorsInContextMenus; + sal_uLong mnSymbolsStyle; + sal_uLong mnPreferredSymbolsStyle; + sal_uInt16 mnSkipDisabledInMenus; + sal_Bool mbHideDisabledMenuItems; + sal_Bool mbAcceleratorsInContextMenus; //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise //primary means scroll by single page. Secondary button takes the alternative behaviour sal_Bool mbPrimaryButtonWarpsSlider; @@ -349,6 +349,16 @@ private: FrameStyle maFrameStyle; const void* mpFontOptions; + sal_uInt16 mnEdgeBlending; + Color maEdgeBlendingTopLeftColor; + Color maEdgeBlendingBottomRightColor; + sal_uInt16 mnListBoxMaximumLineCount; + sal_uInt16 mnColorValueSetColumnCount; + sal_uInt16 mnColorValueSetMaximumRowCount; + Size maListBoxPreviewDefaultLogicSize; + Size maListBoxPreviewDefaultPixelSize; + sal_uInt16 mnListBoxPreviewDefaultLineWidth; + OUString maPersonaHeaderFooter; ///< Cache the settings to detect changes. BitmapEx maPersonaHeaderBitmap; ///< Cache the header bitmap. @@ -868,6 +878,49 @@ public: const BitmapEx GetPersonaHeader() const; + // global switch to allow EdgeBlenging; currently possible for ValueSet and ListBox + // when activated there using Get/SetEdgeBlending; default is true + void SetEdgeBlending(sal_uInt16 nCount) { CopyData(); mpData->mnEdgeBlending = nCount; } + sal_uInt16 GetEdgeBlending() const { return mpData->mnEdgeBlending; } + + // TopLeft (default RGB_COLORDATA(0xC0, 0xC0, 0xC0)) and BottomRight (default RGB_COLORDATA(0x40, 0x40, 0x40)) + // default colors for EdgeBlending + void SetEdgeBlendingTopLeftColor(const Color& rTopLeft) { CopyData(); mpData->maEdgeBlendingTopLeftColor = rTopLeft; } + const Color& GetEdgeBlendingTopLeftColor() const { return mpData->maEdgeBlendingTopLeftColor; } + void SetEdgeBlendingBottomRightColor(const Color& rBottomRight) { CopyData(); mpData->maEdgeBlendingBottomRightColor = rBottomRight; } + const Color& GetEdgeBlendingBottomRightColor() const { return mpData->maEdgeBlendingBottomRightColor; } + + // maximum line count for ListBox control; to use this, call AdaptDropDownLineCountToMaximum() at the + // ListBox after it's ItemCount has changed/got filled. Default is 25. If more Items exist, a scrollbar + // will be used + void SetListBoxMaximumLineCount(sal_uInt16 nCount) { CopyData(); mpData->mnListBoxMaximumLineCount = nCount; } + sal_uInt16 GetListBoxMaximumLineCount() const { return mpData->mnListBoxMaximumLineCount; } + + // maximum column count for the ColorValueSet control. Default is 12 and this is optimized for the + // color scheme which has 12-color alogned layout for the part taken over from Symphony. Do + // only change this if you know what you are doing. + void SetColorValueSetColumnCount(sal_uInt16 nCount) { CopyData(); mpData->mnColorValueSetColumnCount = nCount; } + sal_uInt16 GetColorValueSetColumnCount() const { return mpData->mnColorValueSetColumnCount; } + + // maximum row/line count for the ColorValueSet control. If more lines would be needed, a scrollbar will + // be used. Default is 40. + void SetColorValueSetMaximumRowCount(sal_uInt16 nCount) { CopyData(); mpData->mnColorValueSetMaximumRowCount = nCount; } + sal_uInt16 GetColorValueSetMaximumRowCount() const { return mpData->mnColorValueSetMaximumRowCount; } + + // the logical size for preview graphics in the ListBoxes (e.g. FillColor, FillGradient, FillHatch, FillGraphic, ..). The + // default defines a UI-Scale independent setting which will be scaled using MAP_APPFONT. This ensures that the size will + // fit independent from the used SystemFont (as all the ressources for UI elements). The default is Size(15, 7) which gives + // the correct height and a decent width. Do not change the height, but you may adapt the width to change the preview width. + // GetListBoxPreviewDefaultPixelSize() is for convenience so that not everyone has to do the scaling itself and contains + // the logical size scaled by MAP_APPFONT. + void SetListBoxPreviewDefaultLogicSize(const Size& rSize) { CopyData(); mpData->maListBoxPreviewDefaultLogicSize = rSize; mpData->maListBoxPreviewDefaultPixelSize = Size(0, 0);} + const Size& GetListBoxPreviewDefaultLogicSize() const { return mpData->maListBoxPreviewDefaultLogicSize; } + const Size& GetListBoxPreviewDefaultPixelSize() const; + + // the default LineWidth for ListBox UI previews (LineStyle, LineDash, LineStartEnd). Default is 1. + void SetListBoxPreviewDefaultLineWidth(sal_uInt16 nWidth) { CopyData(); mpData->mnListBoxPreviewDefaultLineWidth = nWidth; } + sal_uInt16 GetListBoxPreviewDefaultLineWidth() const { return mpData->mnListBoxPreviewDefaultLineWidth; } + void SetStandardStyles(); const StyleSettings& operator =( const StyleSettings& rSet ); diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 31b8a1bd895c..000df4a3aa02 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -6209,46 +6209,14 @@ </info> <value>false</value> </prop> - <prop oor:name="ColorValueSetMaximumRowCount" oor:type="xs:short"> - <info> - <author>ALG</author> - <desc> - Defines the maximum row count for ColorValueSets. If more rows are needed, a Scrollbar will be used. - </desc> - <label>A Scrollbar will be used when more rows are needed.</label> - </info> - <value>40</value> - </prop> - <prop oor:name="ColorValueSetEntryEdgeLength" oor:type="xs:short"> - <info> - <author>ALG</author> - <desc> - Defines the EdgeLength in Pixels for Entries generated inside of ColorValueSets. The Entries are quadratic for Colors. - </desc> - <label>Entries in ColorValueSets will have this quadratic size in Pixels.</label> - </info> - <value>14</value> - </prop> - <prop oor:name="ColorValueSetColumnCount" oor:type="xs:short"> - <info> - <author>ALG</author> - <desc> - Defines how many colums are to be used in ColorValueSets. The idea is to use this defined count to have a - good visualisation in ColorValueSets which offers the used ColorTable Schema nicely layouted to the User. - This Schema is layouted to a width of twelve colums, though this value should not be changed. - </desc> - <label>The ColumnCount used in ColorValueSets.</label> - </info> - <value>12</value> - </prop> <prop oor:name="EdgeBlending" oor:type="xs:short"> <info> <author>ALG</author> <desc> - Option to use EdgeBlending for previews in the UI (for ColorValueSet, ColorDropDown, FillStyle/LineStyle + Option to use EdgeBlending for previews in the UI (for ColorValueSet, ColorDropDown, FillStyle/LineStyle previews, etc...). EdgeBlending will visualize a one pixel border on the preview object with interpolated - colors (default: TopLeft White, BottomRight Black) so that a nice 3D effect is shown. It is a percent - value describing how strong the effect shall be. The value 0% switches it off, while the value 100% will + colors (default: TopLeft White, BottomRight Black) so that a nice 3D effect is shown. It is a percent + value describing how strong the effect shall be. The value 0% switches it off, while the value 100% will cover the preview object's border completely with one pixel. Values in-between vill be alpha-blended with the original preview image. </desc> @@ -6256,6 +6224,20 @@ </info> <value>35</value> </prop> + <prop oor:name="ListBoxMaximumLineCount" oor:type="xs:short"> + <info> + <author>ALG</author> + <desc> + This option controls how many lines of a ListBox will be shown as a maximum. If the ListBox has less lines, + all lines will be shown when opening the drop down content. If it has more lines, the visible number of + lines will be limited to this number. The value 0 disables this feature, negative values are not allowed. + This feature may not be used automatically by all ListBox implementations, + but it gives a central hint value to use if an implementation wants to adapt to something useful. + </desc> + <label>Defines the maximum number of lines visible in a ListBox.</label> + </info> + <value>25</value> + </prop> </group> <group oor:name="ExternalApps" oor:extensible="true"> <info> diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index a830a9998c82..35e612e720b4 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -58,6 +58,7 @@ namespace const char s_sColorValueSetEntryEdgeLength[] = "ColorValueSetEntryEdgeLength"; const char s_sColorValueSetColumnCount[] = "ColorValueSetColumnCount"; const char s_sEdgeBlending[] = "EdgeBlending"; + const char s_sListBoxMaximumLineCount[] = "ListBoxMaximumLineCount"; } // class SvtAccessibilityOptions_Impl --------------------------------------------- @@ -82,10 +83,8 @@ public: sal_Bool GetIsSystemFont() const; sal_Int16 GetHelpTipSeconds() const; sal_Bool IsSelectionInReadonly() const; - sal_Int16 GetColorValueSetMaximumRowCount() const; - sal_Int16 GetColorValueSetEntryEdgeLength() const; - sal_Int16 GetColorValueSetColumnCount() const; sal_Int16 GetEdgeBlending() const; + sal_Int16 GetListBoxMaximumLineCount() const; void SetAutoDetectSystemHC(sal_Bool bSet); void SetIsForPagePreviews(sal_Bool bSet); @@ -96,10 +95,8 @@ public: void SetIsSystemFont(sal_Bool bSet); void SetHelpTipSeconds(sal_Int16 nSet); void SetSelectionInReadonly(sal_Bool bSet); - void SetColorValueSetMaximumRowCount(sal_Int16 nSet); - void SetColorValueSetEntryEdgeLength(sal_Int16 nSet); - void SetColorValueSetColumnCount(sal_Int16 nSet); void SetEdgeBlending(sal_Int16 nSet); + void SetListBoxMaximumLineCount(sal_Int16 nSet); sal_Bool IsModified() const { return bIsModified; }; }; @@ -304,51 +301,15 @@ sal_Bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const return bRet; } -sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetMaximumRowCount() const -{ - css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); - sal_Int16 nRet = 40; - - try - { - if(xNode.is()) - xNode->getPropertyValue(s_sColorValueSetMaximumRowCount) >>= nRet; - } - catch(const css::uno::Exception& ex) - { - SAL_WARN("svtools", "Caught unexpected: " << ex.Message); - } - - return nRet; -} - -sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetEntryEdgeLength() const -{ - css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); - sal_Int16 nRet = 14; - - try - { - if(xNode.is()) - xNode->getPropertyValue(s_sColorValueSetEntryEdgeLength) >>= nRet; - } - catch(const css::uno::Exception& ex) - { - SAL_WARN("svtools", "Caught unexpected: " << ex.Message); - } - - return nRet; -} - -sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const +sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const { css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); - sal_Int16 nRet = 12; + sal_Int16 nRet = 35; try { if(xNode.is()) - xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet; + xNode->getPropertyValue(s_sEdgeBlending) >>= nRet; } catch(const css::uno::Exception& ex) { @@ -358,15 +319,15 @@ sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const return nRet; } -sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const +sal_Int16 SvtAccessibilityOptions_Impl::GetListBoxMaximumLineCount() const { css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); - sal_Int16 nRet = 35; + sal_Int16 nRet = 25; try { if(xNode.is()) - xNode->getPropertyValue(s_sEdgeBlending) >>= nRet; + xNode->getPropertyValue(s_sListBoxMaximumLineCount) >>= nRet; } catch(const css::uno::Exception& ex) { @@ -558,70 +519,58 @@ void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(sal_Bool bSet) void SvtAccessibilityOptions_Impl::SetVCLSettings() { - AllSettings aAllSettings = Application::GetSettings(); - HelpSettings aHelpSettings = aAllSettings.GetHelpSettings(); + AllSettings aAllSettings(Application::GetSettings()); + StyleSettings aStyleSettings(aAllSettings.GetStyleSettings()); + HelpSettings aHelpSettings(aAllSettings.GetHelpSettings()); + bool StyleSettingsChanged(false); + aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT); aAllSettings.SetHelpSettings(aHelpSettings); - if(aAllSettings.GetStyleSettings().GetUseSystemUIFonts() != GetIsSystemFont() ) + + if(aStyleSettings.GetUseSystemUIFonts() != GetIsSystemFont()) { - StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - aStyleSettings.SetUseSystemUIFonts( GetIsSystemFont() ); - aAllSettings.SetStyleSettings(aStyleSettings); - Application::MergeSystemSettings( aAllSettings ); + aStyleSettings.SetUseSystemUIFonts(GetIsSystemFont()); + StyleSettingsChanged = true; } - Application::SetSettings(aAllSettings); -} - -void SvtAccessibilityOptions_Impl::SetColorValueSetMaximumRowCount(sal_Int16 nSet) -{ - css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + const sal_Int16 nEdgeBlendingCountA(GetEdgeBlending()); + OSL_ENSURE(nEdgeBlendingCountA >= 0, "OOps, negative values for EdgeBlending are not allowed (!)"); + const sal_uInt16 nEdgeBlendingCountB(static_cast< sal_uInt16 >(nEdgeBlendingCountA >= 0 ? nEdgeBlendingCountA : 0)); - try + if(aStyleSettings.GetEdgeBlending() != nEdgeBlendingCountB) { - if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetMaximumRowCount)!=nSet) - { - xNode->setPropertyValue(s_sColorValueSetMaximumRowCount, css::uno::makeAny(nSet)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - - bIsModified = sal_True; - } - } - catch(const css::uno::Exception& ex) - { - SAL_WARN("svtools", "Caught unexpected: " << ex.Message); + aStyleSettings.SetEdgeBlending(nEdgeBlendingCountB); + StyleSettingsChanged = true; } -} -void SvtAccessibilityOptions_Impl::SetColorValueSetEntryEdgeLength(sal_Int16 nSet) -{ - css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + const sal_Int16 nMaxLineCountA(GetListBoxMaximumLineCount()); + OSL_ENSURE(nMaxLineCountA >= 0, "OOps, negative values for ListBoxMaximumLineCount are not allowed (!)"); + const sal_uInt16 nMaxLineCountB(static_cast< sal_uInt16 >(nMaxLineCountA >= 0 ? nMaxLineCountA : 0)); - try + if(aStyleSettings.GetListBoxMaximumLineCount() != nMaxLineCountB) { - if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetEntryEdgeLength)!=nSet) - { - xNode->setPropertyValue(s_sColorValueSetEntryEdgeLength, css::uno::makeAny(nSet)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - - bIsModified = sal_True; - } + aStyleSettings.SetListBoxMaximumLineCount(nMaxLineCountB); + StyleSettingsChanged = true; } - catch(const css::uno::Exception& ex) + + if(StyleSettingsChanged) { - SAL_WARN("svtools", "Caught unexpected: " << ex.Message); + aAllSettings.SetStyleSettings(aStyleSettings); + Application::MergeSystemSettings(aAllSettings); } + + Application::SetSettings(aAllSettings); } -void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet) +void SvtAccessibilityOptions_Impl::SetEdgeBlending(sal_Int16 nSet) { css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); try { - if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetColumnCount)!=nSet) + if(xNode.is() && xNode->getPropertyValue(s_sEdgeBlending)!=nSet) { - xNode->setPropertyValue(s_sColorValueSetColumnCount, css::uno::makeAny(nSet)); + xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet)); ::comphelper::ConfigurationHelper::flush(m_xCfg); bIsModified = sal_True; @@ -633,15 +582,15 @@ void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet) } } -void SvtAccessibilityOptions_Impl::SetEdgeBlending(sal_Int16 nSet) +void SvtAccessibilityOptions_Impl::SetListBoxMaximumLineCount(sal_Int16 nSet) { css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); try { - if(xNode.is() && xNode->getPropertyValue(s_sEdgeBlending)!=nSet) + if(xNode.is() && xNode->getPropertyValue(s_sListBoxMaximumLineCount)!=nSet) { - xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet)); + xNode->setPropertyValue(s_sListBoxMaximumLineCount, css::uno::makeAny(nSet)); ::comphelper::ConfigurationHelper::flush(m_xCfg); bIsModified = sal_True; @@ -745,26 +694,14 @@ sal_Bool SvtAccessibilityOptions::IsSelectionInReadonly() const { return sm_pSingleImplConfig->IsSelectionInReadonly(); } - -sal_Int16 SvtAccessibilityOptions::GetColorValueSetMaximumRowCount() const -{ - return sm_pSingleImplConfig->GetColorValueSetMaximumRowCount(); -} - -sal_Int16 SvtAccessibilityOptions::GetColorValueSetEntryEdgeLength() const -{ - return sm_pSingleImplConfig->GetColorValueSetEntryEdgeLength(); -} - -sal_Int16 SvtAccessibilityOptions::GetColorValueSetColumnCount() const -{ - return sm_pSingleImplConfig->GetColorValueSetColumnCount(); -} - sal_Int16 SvtAccessibilityOptions::GetEdgeBlending() const { return sm_pSingleImplConfig->GetEdgeBlending(); } +sal_Int16 SvtAccessibilityOptions::GetListBoxMaximumLineCount() const +{ + return sm_pSingleImplConfig->GetListBoxMaximumLineCount(); +} // ----------------------------------------------------------------------- void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet) @@ -807,22 +744,14 @@ void SvtAccessibilityOptions::SetVCLSettings() { sm_pSingleImplConfig->SetVCLSettings(); } -void SvtAccessibilityOptions::SetColorValueSetMaximumRowCount(sal_Int16 nSet) -{ - sm_pSingleImplConfig->SetColorValueSetMaximumRowCount(nSet); -} -void SvtAccessibilityOptions::SetColorValueSetEntryEdgeLength(sal_Int16 nSet) -{ - sm_pSingleImplConfig->SetColorValueSetEntryEdgeLength(nSet); -} -void SvtAccessibilityOptions::SetColorValueSetColumnCount(sal_Int16 nSet) -{ - sm_pSingleImplConfig->SetColorValueSetColumnCount(nSet); -} void SvtAccessibilityOptions::SetEdgeBlending(sal_Int16 nSet) { sm_pSingleImplConfig->SetEdgeBlending(nSet); } +void SvtAccessibilityOptions::SetListBoxMaximumLineCount(sal_Int16 nSet) +{ + sm_pSingleImplConfig->SetListBoxMaximumLineCount(nSet); +} // ----------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 603165d52596..37cf88741fac 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -80,10 +80,9 @@ public: void ColorListBox::ImplInit() { pColorList = new ImpColorList(); - aImageSize.Width() = GetTextWidth( OUString("xxx") ); - aImageSize.Height() = GetTextHeight(); - aImageSize.Height() -= 2; + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + aImageSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); EnableUserDraw( sal_True ); SetUserItemSize( aImageSize ); } @@ -103,6 +102,7 @@ ColorListBox::ColorListBox( Window* pParent, WinBits nWinStyle ) : ListBox( pParent, nWinStyle ) { ImplInit(); + SetEdgeBlending(true); } // ----------------------------------------------------------------------- @@ -111,6 +111,7 @@ ColorListBox::ColorListBox( Window* pParent, const ResId& rResId ) : ListBox( pParent, rResId ) { ImplInit(); + SetEdgeBlending(true); } namespace @@ -289,13 +290,36 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt ) if ( pData->bColor ) { Point aPos( rUDEvt.GetRect().TopLeft() ); + aPos.X() += 2; aPos.Y() += ( rUDEvt.GetRect().GetHeight() - aImageSize.Height() ) / 2; + + const Rectangle aRect(aPos, aImageSize); + rUDEvt.GetDevice()->Push(); rUDEvt.GetDevice()->SetFillColor( pData->aColor ); rUDEvt.GetDevice()->SetLineColor( rUDEvt.GetDevice()->GetTextColor() ); - rUDEvt.GetDevice()->DrawRect( Rectangle( aPos, aImageSize ) ); + rUDEvt.GetDevice()->DrawRect(aRect); rUDEvt.GetDevice()->Pop(); + + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0); + + if(nEdgeBlendingPercent) + { + Bitmap aBitmap(rUDEvt.GetDevice()->GetBitmap(aRect.TopLeft(), aRect.GetSize())); + + if(!aBitmap.IsEmpty()) + { + const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); + const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); + const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); + + aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight); + rUDEvt.GetDevice()->DrawBitmap(aRect.TopLeft(), aBitmap); + } + } + ListBox::DrawEntry( rUDEvt, sal_False, sal_True, sal_False ); } else diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 1006bf0d6800..9623b29f4d50 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -28,7 +28,6 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <rtl/ustring.hxx> -#include <svtools/accessibilityoptions.hxx> #include "valueimp.hxx" #include <svtools/valueset.hxx> @@ -82,6 +81,7 @@ void ValueSet::ImplInit() mbDoubleSel = false; mbScroll = false; mbFullMode = true; + mbEdgeBlending = false; mbHasVisibleItems = false; // #106446#, #106601# force mirroring of virtual device @@ -266,9 +266,10 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect ) if ( (aRect.GetHeight() > 0) && (aRect.GetWidth() > 0) ) { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + if ( pItem == mpNoneItem ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); maVirDev.SetFont( GetFont() ); maVirDev.SetTextColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor() ); maVirDev.SetTextFillColor(); @@ -294,29 +295,9 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect ) { maVirDev.SetFillColor( pItem->maColor ); maVirDev.DrawRect( aRect ); - - const SvtAccessibilityOptions aOptions; - const sal_Int16 nEdgeBlendingPercent(aOptions.GetEdgeBlending()); - static bool bTest(false); - - if(nEdgeBlendingPercent && bTest) - { - Bitmap aBitmap(maVirDev.GetBitmap(aRect.TopLeft(), aRect.GetSize())); - - if(!aBitmap.IsEmpty()) - { - const Color aTopLeft(COL_WHITE); - const Color aBottomRight(COL_BLACK); - const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); - - aBitmap.DrawBlendFrame(nAlpha, aTopLeft, aBottomRight); - maVirDev.DrawBitmap(aRect.TopLeft(), aBitmap); - } - } } else { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if ( IsColor() ) maVirDev.SetFillColor( maColor ); else if ( nStyle & WB_MENUSTYLEVALUESET ) @@ -355,6 +336,23 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect ) maVirDev.DrawImage( aPos, pItem->maImage, nImageStyle ); } } + + const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0); + + if(nEdgeBlendingPercent) + { + Bitmap aBitmap(maVirDev.GetBitmap(aRect.TopLeft(), aRect.GetSize())); + + if(!aBitmap.IsEmpty()) + { + const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); + const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); + const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); + + aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight); + maVirDev.DrawBitmap(aRect.TopLeft(), aBitmap); + } + } } } @@ -2466,4 +2464,20 @@ Size ValueSet::GetOptimalSize() const return CalcWindowSizePixel(aLargestItemSize); } +// ----------------------------------------------------------------------- + +void ValueSet::SetEdgeBlending(bool bNew) +{ + if(mbEdgeBlending != bNew) + { + mbEdgeBlending = bNew; + mbFormat = true; + + if(IsReallyVisible() && IsUpdateMode()) + { + Invalidate(); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index b863c34573ee..832c17129eca 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -927,6 +927,8 @@ void ColorLB::Fill( const XColorListRef &pColorTab ) pEntry = pColorTab->GetColor( i ); InsertEntry( pEntry->GetColor(), pEntry->GetName() ); } + + AdaptDropDownLineCountToMaximum(); SetUpdateMode( sal_True ); } @@ -935,6 +937,7 @@ void ColorLB::Fill( const XColorListRef &pColorTab ) void ColorLB::Append( XColorEntry* pEntry, Bitmap* ) { InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + AdaptDropDownLineCountToMaximum(); } /************************************************************************/ @@ -958,17 +961,18 @@ void FillAttrLB::Fill( const XColorListRef &pColorTab ) pEntry = pColorTab->GetColor( i ); InsertEntry( pEntry->GetColor(), pEntry->GetName() ); } + + AdaptDropDownLineCountToMaximum(); SetUpdateMode( sal_True ); } // Fills the listbox (provisional) with strings -HatchingLB::HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ ) +HatchingLB::HatchingLB( Window* pParent, ResId Id) : ListBox( pParent, Id ), - mpList ( NULL ), - mbUserDraw( bUserDraw ) + mpList ( NULL ) { - EnableUserDraw( mbUserDraw ); + SetEdgeBlending(true); } void HatchingLB::Fill( const XHatchListRef &pList ) @@ -982,65 +986,20 @@ void HatchingLB::Fill( const XHatchListRef &pList ) SetUpdateMode( sal_False ); - if( mbUserDraw ) - { - for( long i = 0; i < nCount; i++ ) - InsertEntry( pList->GetHatch( i )->GetName() ); - } - else + for( long i = 0; i < nCount; i++ ) { - for( long i = 0; i < nCount; i++ ) - { - pEntry = pList->GetHatch( i ); - const Bitmap aBitmap = pList->GetUiBitmap( i ); - if( !aBitmap.IsEmpty() ) - InsertEntry( pEntry->GetName(), aBitmap ); - else - InsertEntry( pEntry->GetName() ); - } + pEntry = pList->GetHatch( i ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + InsertEntry( pEntry->GetName(), aBitmap ); + else + InsertEntry( pEntry->GetName() ); } + AdaptDropDownLineCountToMaximum(); SetUpdateMode( sal_True ); } -void HatchingLB::UserDraw( const UserDrawEvent& rUDEvt ) -{ - if( mpList != NULL ) - { - // Draw gradient with borderrectangle - const Rectangle& rDrawRect = rUDEvt.GetRect(); - Rectangle aRect( rDrawRect.Left()+1, rDrawRect.Top()+1, rDrawRect.Left()+33, rDrawRect.Bottom()-1 ); - - sal_Int32 nId = rUDEvt.GetItemId(); - if( nId >= 0 && nId <= mpList->Count() ) - { - OutputDevice* pDevice = rUDEvt.GetDevice(); - - sal_uIntPtr nOldDrawMode = pDevice->GetDrawMode(); - pDevice->SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); - - const XHatch& rXHatch = mpList->GetHatch( rUDEvt.GetItemId() )->GetHatch(); - MapMode aMode( MAP_100TH_MM ); - Hatch aHatch( (HatchStyle) rXHatch.GetHatchStyle(), - rXHatch.GetColor(), - rUDEvt.GetDevice()->LogicToPixel( Point( rXHatch.GetDistance(), 0 ), aMode ).X(), - (sal_uInt16)rXHatch.GetAngle() ); - const Polygon aPolygon( aRect ); - const PolyPolygon aPolypoly( aPolygon ); - pDevice->DrawHatch( aPolypoly, aHatch ); - - pDevice->SetLineColor( COL_BLACK ); - pDevice->SetFillColor(); - pDevice->DrawRect( aRect ); - - pDevice->SetDrawMode( nOldDrawMode ); - - // Draw name - pDevice->DrawText( Point( aRect.Right()+7, aRect.Top()-1 ), mpList->GetHatch( rUDEvt.GetItemId() )->GetName() ); - } - } -} - /************************************************************************/ void HatchingLB::Append( XHatchEntry* pEntry, Bitmap* pBmp ) @@ -1049,6 +1008,7 @@ void HatchingLB::Append( XHatchEntry* pEntry, Bitmap* pBmp ) InsertEntry( pEntry->GetName(), *pBmp ); else InsertEntry( pEntry->GetName() ); + AdaptDropDownLineCountToMaximum(); } /************************************************************************/ @@ -1080,25 +1040,25 @@ void FillAttrLB::Fill( const XHatchListRef &pList ) else InsertEntry( pEntry->GetName() ); } + + AdaptDropDownLineCountToMaximum(); ListBox::SetUpdateMode( sal_True ); } // Fills the listbox (provisional) with strings -GradientLB::GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ ) +GradientLB::GradientLB( Window* pParent, ResId Id) : ListBox( pParent, Id ), - mpList(NULL), - mbUserDraw( bUserDraw ) + mpList(NULL) { - EnableUserDraw( mbUserDraw); + SetEdgeBlending(true); } -GradientLB::GradientLB( Window* pParent, WinBits nWinStyle, sal_Bool bUserDraw /*= sal_True*/ ) -: ListBox( pParent, nWinStyle ), - mpList(NULL), - mbUserDraw( bUserDraw ) +GradientLB::GradientLB( Window* pParent, WinBits aWB) +: ListBox( pParent, aWB ), + mpList(NULL) { - EnableUserDraw( mbUserDraw); + SetEdgeBlending(true); } extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeGradientLB(Window *pParent, VclBuilder::stringmap &rMap) @@ -1123,78 +1083,20 @@ void GradientLB::Fill( const XGradientListRef &pList ) SetUpdateMode( sal_False ); - if( mbUserDraw ) - { - for( long i = 0; i < nCount; i++ ) - InsertEntry( pList->GetGradient( i )->GetName() ); - } - else + for( long i = 0; i < nCount; i++ ) { - for( long i = 0; i < nCount; i++ ) - { - pEntry = pList->GetGradient( i ); - const Bitmap aBitmap = pList->GetUiBitmap( i ); - if( !aBitmap.IsEmpty() ) - InsertEntry( pEntry->GetName(), aBitmap ); - else - InsertEntry( pEntry->GetName() ); - } + pEntry = pList->GetGradient( i ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + InsertEntry( pEntry->GetName(), aBitmap ); + else + InsertEntry( pEntry->GetName() ); } + AdaptDropDownLineCountToMaximum(); SetUpdateMode( sal_True ); } -void GradientLB::UserDraw( const UserDrawEvent& rUDEvt ) -{ - if( mpList != NULL ) - { - // Draw gradient with borderrectangle - const Rectangle& rDrawRect = rUDEvt.GetRect(); - Rectangle aRect( rDrawRect.Left()+1, rDrawRect.Top()+1, rDrawRect.Left()+33, rDrawRect.Bottom()-1 ); - - sal_Int32 nId = rUDEvt.GetItemId(); - if( nId >= 0 && nId <= mpList->Count() ) - { - OutputDevice* pDevice = rUDEvt.GetDevice(); - - const XGradient& rXGrad = mpList->GetGradient( rUDEvt.GetItemId() )->GetGradient(); - Gradient aGradient( (GradientStyle) rXGrad.GetGradientStyle(), rXGrad.GetStartColor(), rXGrad.GetEndColor() ); - aGradient.SetAngle( (sal_uInt16)rXGrad.GetAngle() ); - aGradient.SetBorder( rXGrad.GetBorder() ); - aGradient.SetOfsX( rXGrad.GetXOffset() ); - aGradient.SetOfsY( rXGrad.GetYOffset() ); - aGradient.SetStartIntensity( rXGrad.GetStartIntens() ); - aGradient.SetEndIntensity( rXGrad.GetEndIntens() ); - aGradient.SetSteps( 255 ); - - // #i76307# always paint the preview in LTR, because this is what the document does - Window* pWin = dynamic_cast<Window*>(pDevice); - if( pWin && pWin->IsRTLEnabled() && Application::GetSettings().GetLayoutRTL()) - { - long nWidth = pDevice->GetOutputSize().Width(); - - pWin->EnableRTL( sal_False ); - - Rectangle aMirrorRect( Point( nWidth - aRect.Left() - aRect.GetWidth(), aRect.Top() ), - aRect.GetSize() ); - - pDevice->DrawGradient( aMirrorRect, aGradient ); - - pWin->EnableRTL( sal_True ); - } - else - pDevice->DrawGradient( aRect, aGradient ); - - pDevice->SetLineColor( COL_BLACK ); - pDevice->SetFillColor(); - pDevice->DrawRect( aRect ); - - // Draw name - pDevice->DrawText( Point( aRect.Right()+7, aRect.Top()-1 ), mpList->GetGradient( rUDEvt.GetItemId() )->GetName() ); - } - } -} - /************************************************************************/ void GradientLB::Append( XGradientEntry* pEntry, Bitmap* pBmp ) @@ -1203,6 +1105,7 @@ void GradientLB::Append( XGradientEntry* pEntry, Bitmap* pBmp ) InsertEntry( pEntry->GetName(), *pBmp ); else InsertEntry( pEntry->GetName() ); + AdaptDropDownLineCountToMaximum(); } /************************************************************************/ @@ -1258,46 +1161,66 @@ void FillAttrLB::Fill( const XGradientListRef &pList ) else InsertEntry( pEntry->GetName() ); } + + AdaptDropDownLineCountToMaximum(); ListBox::SetUpdateMode( sal_True ); } // BitmapLB Constructor -BitmapLB::BitmapLB(Window* pParent, ResId Id, bool bUserDraw /*= false*/ ) +BitmapLB::BitmapLB(Window* pParent, ResId Id) : ListBox(pParent, Id), - maVD(), maBitmapEx(), - mpList(NULL), - mbUserDraw(bUserDraw) + mpList(NULL) { - EnableUserDraw(mbUserDraw); + SetEdgeBlending(true); } /************************************************************************/ -void BitmapLB::SetVirtualDevice(const Size& rSize) +namespace { - maVD.SetOutputSizePixel(rSize); - - if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) - { - maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx); - } - else + void formatBitmapExToSize(BitmapEx& rBitmapEx, const Size& rSize) { - const Size aBitmapSize(maBitmapEx.GetSizePixel()); - - for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) + if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0) { - for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) + VirtualDevice aVirtualDevice; + aVirtualDevice.SetOutputSizePixel(rSize); + + if(rBitmapEx.IsTransparent()) + { + const Point aNull(0, 0); + static const sal_uInt32 nLen(8); + static const Color aW(COL_WHITE); + static const Color aG(0xef, 0xef, 0xef); + + aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG); + } + + if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height()) + { + rBitmapEx.Scale(rSize, BMP_SCALE_DEFAULT); + aVirtualDevice.DrawBitmapEx(Point(0, 0), rBitmapEx); + } + else { - maVD.DrawBitmapEx( - Point(x, y), - maBitmapEx); + const Size aBitmapSize(rBitmapEx.GetSizePixel()); + + for(sal_Int32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) + { + for(sal_Int32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) + { + aVirtualDevice.DrawBitmapEx( + Point(x, y), + rBitmapEx); + } + } } + + rBitmapEx = aVirtualDevice.GetBitmap(Point(0, 0), rSize); } } -} +} // end of anonymous namespace /************************************************************************/ @@ -1309,76 +1232,23 @@ void BitmapLB::Fill( const XBitmapListRef &pList ) mpList = pList; XBitmapEntry* pEntry; const long nCount(pList->Count()); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize()); SetUpdateMode(false); - if(mbUserDraw) - { - for(long i(0); i < nCount; i++) - { - InsertEntry(pList->GetBitmap(i)->GetName()); - } - } - else + for(long i(0); i < nCount; i++) { - for(long i(0); i < nCount; i++) - { - pEntry = pList->GetBitmap(i); - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight()); - SetVirtualDevice(aSize); - InsertEntry( - pEntry->GetName(), - maVD.GetBitmap(Point(0, 0), - aSize)); - } + pEntry = pList->GetBitmap(i); + maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); + formatBitmapExToSize(maBitmapEx, aSize); + InsertEntry(pEntry->GetName(), maBitmapEx); } + AdaptDropDownLineCountToMaximum(); SetUpdateMode(true); } -void BitmapLB::UserDraw(const UserDrawEvent& rUDEvt) -{ - if (mpList != NULL) - { - // Draw bitmap - const Rectangle& rDrawRect = rUDEvt.GetRect(); - const Rectangle aRect(rDrawRect.Left() + 1, rDrawRect.Top() + 1, rDrawRect.Left() + 33, rDrawRect.Bottom() - 1); - const sal_Int32 nId(rUDEvt.GetItemId()); - - if(nId >= 0 && nId <= mpList->Count()) - { - const Rectangle aClipRect(rDrawRect.Left() + 1, rDrawRect.Top() + 1, rDrawRect.Right() - 1, rDrawRect.Bottom() - 1); - OutputDevice* pDevice = rUDEvt.GetDevice(); - pDevice->SetClipRegion(Region(aClipRect)); - maBitmapEx = mpList->GetBitmap(nId)->GetGraphicObject().GetGraphic().GetBitmapEx(); - long nPosBaseX = aRect.Left(); - long nPosBaseY = aRect.Top(); - - if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) - { - pDevice->DrawBitmapEx(Point(nPosBaseX, nPosBaseY), Size(32, 16), maBitmapEx); - } - else - { - pDevice->DrawBitmapEx(Point(nPosBaseX+ 0, nPosBaseY+0 ), maBitmapEx); - pDevice->DrawBitmapEx(Point(nPosBaseX+ 8, nPosBaseY+0 ), maBitmapEx); - pDevice->DrawBitmapEx(Point(nPosBaseX+16, nPosBaseY+0 ), maBitmapEx); - pDevice->DrawBitmapEx(Point(nPosBaseX+24, nPosBaseY+0 ), maBitmapEx); - pDevice->DrawBitmapEx(Point(nPosBaseX+ 0, nPosBaseY+8 ), maBitmapEx); - pDevice->DrawBitmapEx(Point(nPosBaseX+ 8, nPosBaseY+8 ), maBitmapEx); - pDevice->DrawBitmapEx(Point(nPosBaseX+16, nPosBaseY+8 ), maBitmapEx); - pDevice->DrawBitmapEx(Point(nPosBaseX+24, nPosBaseY+8 ), maBitmapEx); - } - - pDevice->SetClipRegion(); - - // Draw name - pDevice->DrawText(Point(aRect.Right() + 7, aRect.Top() - 1), mpList->GetBitmap(nId)->GetName()); - } - } -} - /************************************************************************/ void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx) @@ -1386,16 +1256,15 @@ void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* p if(pBmpEx) { maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(rSize); - InsertEntry( - rEntry.GetName(), - maVD.GetBitmap(Point(0, 0), - rSize)); + formatBitmapExToSize(maBitmapEx, rSize); + InsertEntry(rEntry.GetName(), maBitmapEx); } else { InsertEntry(rEntry.GetName()); } + + AdaptDropDownLineCountToMaximum(); } /************************************************************************/ @@ -1407,11 +1276,8 @@ void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 if(pBmpEx) { maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(rSize); - InsertEntry( - rEntry.GetName(), - maVD.GetBitmap(Point(0, 0), rSize), - nPos); + formatBitmapExToSize(maBitmapEx, rSize); + InsertEntry(rEntry.GetName(), maBitmapEx, nPos); } else { @@ -1426,37 +1292,12 @@ FillAttrLB::FillAttrLB(Window* pParent, WinBits aWB) /************************************************************************/ -void FillAttrLB::SetVirtualDevice(const Size& rSize) -{ - maVD.SetOutputSizePixel(rSize); - maVD.Erase(); - - if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) - { - maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx); - } - else - { - const Size aBitmapSize(maBitmapEx.GetSizePixel()); - - for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) - { - for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) - { - maVD.DrawBitmapEx( - Point(x, y), - maBitmapEx); - } - } - } -} - -/************************************************************************/ - void FillAttrLB::Fill( const XBitmapListRef &pList ) { const long nCount(pList->Count()); XBitmapEntry* pEntry; + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize()); ListBox::SetUpdateMode(false); @@ -1464,25 +1305,25 @@ void FillAttrLB::Fill( const XBitmapListRef &pList ) { pEntry = pList->GetBitmap( i ); maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight()); - SetVirtualDevice(aSize); - ListBox::InsertEntry( - pEntry->GetName(), - maVD.GetBitmap(Point(0, 0), - aSize)); + formatBitmapExToSize(maBitmapEx, aSize); + ListBox::InsertEntry(pEntry->GetName(), maBitmapEx); } + AdaptDropDownLineCountToMaximum(); ListBox::SetUpdateMode(true); } void FillTypeLB::Fill() { SetUpdateMode( sal_False ); + InsertEntry( String( SVX_RES( RID_SVXSTR_INVISIBLE ) ) ); InsertEntry( String( SVX_RES( RID_SVXSTR_COLOR ) ) ); InsertEntry( String( SVX_RES( RID_SVXSTR_GRADIENT ) ) ); InsertEntry( String( SVX_RES( RID_SVXSTR_HATCH ) ) ); InsertEntry( String( SVX_RES( RID_SVXSTR_BITMAP ) ) ); + + AdaptDropDownLineCountToMaximum(); SetUpdateMode( sal_True ); } @@ -1490,12 +1331,14 @@ LineLB::LineLB(Window* pParent, ResId Id) : ListBox(pParent, Id), mbAddStandardFields(true) { + // No EdgeBlending for LineStyle/Dash SetEdgeBlending(true); } LineLB::LineLB(Window* pParent, WinBits aWB) : ListBox(pParent, aWB), mbAddStandardFields(true) { + // No EdgeBlending for LineStyle/Dash SetEdgeBlending(true); } LineLB::~LineLB() @@ -1545,6 +1388,8 @@ void LineLB::Fill( const XDashListRef &pList ) else InsertEntry( pEntry->GetName() ); } + + AdaptDropDownLineCountToMaximum(); SetUpdateMode( sal_True ); } @@ -1556,6 +1401,7 @@ void LineLB::Append( XDashEntry* pEntry, const Bitmap* pBmp ) InsertEntry( pEntry->GetName(), *pBmp ); else InsertEntry( pEntry->GetName() ); + AdaptDropDownLineCountToMaximum(); } /************************************************************************/ @@ -1575,11 +1421,13 @@ void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp ) LineEndLB::LineEndLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) { + // No EdgeBlending for LineEnds SetEdgeBlending(true); } LineEndLB::LineEndLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) { + // No EdgeBlending for LineEnds SetEdgeBlending(true); } LineEndLB::~LineEndLB(void) @@ -1613,6 +1461,8 @@ void LineEndLB::Fill( const XLineEndListRef &pList, sal_Bool bStart ) else InsertEntry( pEntry->GetName() ); } + + AdaptDropDownLineCountToMaximum(); SetUpdateMode( sal_True ); } @@ -1633,6 +1483,7 @@ void LineEndLB::Append( XLineEndEntry* pEntry, const Bitmap* pBmp, sal_Bool bSta } else InsertEntry( pEntry->GetName() ); + AdaptDropDownLineCountToMaximum(); } /************************************************************************/ diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx index ee8d0cc2192d..f4166fa34efb 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -318,7 +318,7 @@ IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox ) mpLbFillAttr->Fill( aItem.GetGradientList() ); } - mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + mpLbFillAttr->AdaptDropDownLineCountToMaximum(); if ( mnLastPosGradient != LISTBOX_ENTRY_NOTFOUND) { @@ -353,7 +353,7 @@ IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox ) mpLbFillAttr->Fill( aItem.GetHatchList() ); } - mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + mpLbFillAttr->AdaptDropDownLineCountToMaximum(); if ( mnLastPosHatch != LISTBOX_ENTRY_NOTFOUND ) { @@ -388,7 +388,7 @@ IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox ) mpLbFillAttr->Fill( aItem.GetBitmapList() ); } - mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + mpLbFillAttr->AdaptDropDownLineCountToMaximum(); if ( mnLastPosBitmap != LISTBOX_ENTRY_NOTFOUND ) { diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index 4f39c5b6ab2c..c6da70028826 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -287,7 +287,7 @@ void LinePropertyPanel::Initialize() aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl ); mpLBStyle->SetSelectHdl( aLink ); mpLBStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style"))); - mpLBStyle->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStyle->GetEntryCount())); + mpLBStyle->AdaptDropDownLineCountToMaximum(); mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]); aTbxSize = mpTBWidth->CalcWindowSizePixel() ; @@ -306,11 +306,11 @@ void LinePropertyPanel::Initialize() aLink = LINK( this, LinePropertyPanel, ChangeStartHdl ); mpLBStart->SetSelectHdl( aLink ); mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style"))); //wj acc - mpLBStart->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStart->GetEntryCount())); + mpLBStart->AdaptDropDownLineCountToMaximum(); aLink = LINK( this, LinePropertyPanel, ChangeEndHdl ); mpLBEnd->SetSelectHdl( aLink ); mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style"))); //wj acc - mpLBEnd->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBEnd->GetEntryCount())); + mpLBEnd->AdaptDropDownLineCountToMaximum(); aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl); mpMFTransparent->SetModifyHdl(aLink); diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index ff95a4da66bb..97abed54aecf 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -201,7 +201,7 @@ void PosSizePropertyPanel::Initialize() mpMtrAngle->InsertValue(22500, FUNIT_CUSTOM); mpMtrAngle->InsertValue(27000, FUNIT_CUSTOM); mpMtrAngle->InsertValue(31500, FUNIT_CUSTOM); - mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount()); + mpMtrAngle->AdaptDropDownLineCountToMaximum(); SfxViewShell* pCurSh = SfxViewShell::Current(); if ( pCurSh ) diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx index 4363fa0da1fd..d990fab0d260 100644 --- a/svx/source/tbxctrls/SvxColorValueSet.cxx +++ b/svx/source/tbxctrls/SvxColorValueSet.cxx @@ -18,14 +18,15 @@ #include <svx/SvxColorValueSet.hxx> #include <svx/xtable.hxx> -#include <svtools/accessibilityoptions.hxx> #include <vcl/builder.hxx> +#include <vcl/svapp.hxx> ////////////////////////////////////////////////////////////////////////////// SvxColorValueSet::SvxColorValueSet(Window* _pParent, WinBits nWinStyle) : ValueSet(_pParent, nWinStyle) { + SetEdgeBlending(true); } extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxColorValueSet(Window *pParent, VclBuilder::stringmap &rMap) @@ -46,27 +47,28 @@ extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxColorValueSet(Window *pP SvxColorValueSet::SvxColorValueSet(Window* _pParent, const ResId& rResId) : ValueSet(_pParent, rResId) { + SetEdgeBlending(true); } sal_uInt32 SvxColorValueSet::getMaxRowCount() const { - const SvtAccessibilityOptions aOptions; + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - return aOptions.GetColorValueSetMaximumRowCount(); + return rStyleSettings.GetColorValueSetMaximumRowCount(); } sal_uInt32 SvxColorValueSet::getEntryEdgeLength() const { - const SvtAccessibilityOptions aOptions; + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - return aOptions.GetColorValueSetEntryEdgeLength(); + return rStyleSettings.GetListBoxPreviewDefaultPixelSize().Height() + 1; } sal_uInt32 SvxColorValueSet::getColumnCount() const { - const SvtAccessibilityOptions aOptions; + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - return aOptions.GetColorValueSetColumnCount(); + return rStyleSettings.GetColorValueSetColumnCount(); } void SvxColorValueSet::addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex) diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index 40eac343d2c9..bf5deff7cc96 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -82,7 +82,8 @@ void XDashList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth() * 2, getUiBitmapHeight()))); + const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); + const Size aSize(pVirDev->PixelToLogic(Size(rSize.Width() * 2, rSize.Height()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT @@ -111,7 +112,7 @@ void XDashList::impCreate() pLineObject->SetModel(pSdrModel); pLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH)); pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor())); - const Size aLineWidth(pVirDev->PixelToLogic(Size(getUiBitmapLineWidth(), 0))); + const Size aLineWidth(pVirDev->PixelToLogic(Size(rStyleSettings.GetListBoxPreviewDefaultLineWidth(), 0))); pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth())); mpData = new impXDashList(pVirDev, pSdrModel, pBackgroundObject, pLineObject); OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" ); diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index c753e6e0a33c..5815678dacac 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -73,7 +73,8 @@ void XGradientList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XGradientList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth(), getUiBitmapHeight()))); + const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); + const Size aSize(pVirDev->PixelToLogic(rSize)); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT @@ -92,7 +93,7 @@ void XGradientList::impCreate() pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT)); pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID)); pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK))); - pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((getUiBitmapWidth() + getUiBitmapHeight()) / 3))); + pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((rSize.Width() + rSize.Height()) / 3))); mpData = new impXGradientList(pVirDev, pSdrModel, pBackgroundObject); OSL_ENSURE(0 != mpData, "XGradientList: data creation went wrong!" ); diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index da88b3271179..027953a3d742 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -79,7 +79,7 @@ void XHatchList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth(), getUiBitmapHeight()))); + const Size aSize(pVirDev->PixelToLogic(rStyleSettings.GetListBoxPreviewDefaultPixelSize())); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 3999ba25721f..eb21b4d328ca 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -299,25 +299,4 @@ OUString XPropertyList::GetDefaultExtFilter( XPropertyListType t ) return aFilter + GetDefaultExt( t ); } -sal_uInt32 XPropertyList::getUiBitmapWidth() const -{ - static sal_uInt32 nWidth = 32; // alternative: 42; - - return nWidth; -} - -sal_uInt32 XPropertyList::getUiBitmapHeight() const -{ - static sal_uInt32 nHeight = 12; // alternative: 16; - - return nHeight; -} - -sal_uInt32 XPropertyList::getUiBitmapLineWidth() const -{ - static sal_uInt32 nLineWidth = 3; - - return nLineWidth; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index 1003c1d70847..30ce2a4cb1b6 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -88,7 +88,8 @@ void XLineEndList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XLineEndList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth() * 2, getUiBitmapHeight()))); + const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); + const Size aSize(pVirDev->PixelToLogic(Size(rSize.Width() * 2, rSize.Height()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT @@ -115,7 +116,7 @@ void XLineEndList::impCreate() SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon)); OSL_ENSURE(0 != pLineObject, "XLineEndList: no LineObject created!" ); pLineObject->SetModel(pSdrModel); - const Size aLineWidth(pVirDev->PixelToLogic(Size(getUiBitmapLineWidth(), 0))); + const Size aLineWidth(pVirDev->PixelToLogic(Size(rStyleSettings.GetListBoxPreviewDefaultLineWidth(), 0))); pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth())); const sal_uInt32 nArrowHeight((aSize.Height() * 8) / 10); pLineObject->SetMergedItem(XLineStartWidthItem(nArrowHeight)); diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index a18b2931709c..8962c1d79ee0 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -64,33 +64,33 @@ struct ImplEntryType long mnFlags; long mnHeight; - ImplEntryType( const OUString& rStr, const Image& rImage ) : - maStr( rStr ), - maImage( rImage ), - mnFlags( 0 ), - mnHeight( 0 ) - { - mbIsSelected = sal_False; - mpUserData = NULL; - } - - ImplEntryType( const OUString& rStr ) : - maStr( rStr ), - mnFlags( 0 ), - mnHeight( 0 ) - { - mbIsSelected = sal_False; - mpUserData = NULL; - } - - ImplEntryType( const Image& rImage ) : - maImage( rImage ), - mnFlags( 0 ), - mnHeight( 0 ) - { - mbIsSelected = sal_False; - mpUserData = NULL; - } + ImplEntryType( const OUString& rStr, const Image& rImage ) : + maStr( rStr ), + maImage( rImage ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = sal_False; + mpUserData = NULL; + } + + ImplEntryType( const OUString& rStr ) : + maStr( rStr ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = sal_False; + mpUserData = NULL; + } + + ImplEntryType( const Image& rImage ) : + maImage( rImage ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = sal_False; + mpUserData = NULL; + } }; // ----------------- @@ -226,24 +226,26 @@ private: sal_uInt16 mnSelectModifier; // Modifiers - sal_Bool mbHasFocusRect: 1, - mbSort: 1, // ListBox sorted - mbTrack: 1, // Tracking - mbMulti: 1, // MultiListBox - mbStackMode: 1, // StackSelection - mbSimpleMode: 1, // SimpleMode for MultiListBox - mbImgsDiffSz: 1, // Images have different sizes - mbTravelSelect: 1, // TravelSelect - mbTrackingSelect: 1, // Selected at a MouseMove - mbSelectionChanged: 1, // Do not call Select() too often ... - mbMouseMoveSelect: 1, // Select at MouseMove - mbGrabFocus: 1, // Grab focus at MBDown - mbUserDrawEnabled: 1, // UserDraw possible - mbInUserDraw: 1, // In UserDraw - mbReadOnly: 1, // ReadOnly - mbMirroring: 1, // pb: #106948# explicit mirroring for calc - mbRight: 1, // right align Text output - mbCenter: 1; // center Text output + /// bitfield + bool mbHasFocusRect : 1; + bool mbSort : 1; // ListBox sorted + bool mbTrack : 1; // Tracking + bool mbMulti : 1; // MultiListBox + bool mbStackMode : 1; // StackSelection + bool mbSimpleMode : 1; // SimpleMode for MultiListBox + bool mbImgsDiffSz : 1; // Images have different sizes + bool mbTravelSelect : 1; // TravelSelect + bool mbTrackingSelect : 1; // Selected at a MouseMove + bool mbSelectionChanged : 1; // Do not call Select() too often ... + bool mbMouseMoveSelect : 1; // Select at MouseMove + bool mbGrabFocus : 1; // Grab focus at MBDown + bool mbUserDrawEnabled : 1; // UserDraw possible + bool mbInUserDraw : 1; // In UserDraw + bool mbReadOnly : 1; // ReadOnly + bool mbMirroring : 1; // pb: #106948# explicit mirroring for calc + bool mbRight : 1; // right align Text output + bool mbCenter : 1; // center Text output + bool mbEdgeBlending : 1; Link maScrollHdl; Link maSelectHdl; @@ -252,8 +254,7 @@ private: Link maUserDrawHdl; Link maMRUChangedHdl; - ::vcl::QuickSelectionEngine - maQuickSelectionEngine; + ::vcl::QuickSelectionEngine maQuickSelectionEngine; protected: virtual void KeyInput( const KeyEvent& rKEvt ); @@ -318,31 +319,31 @@ public: void SetLeftIndent( long n ); void ScrollHorz( long nDiff ); - void AllowGrabFocus( sal_Bool b ) { mbGrabFocus = b; } - sal_Bool IsGrabFocusAllowed() const { return mbGrabFocus; } + void AllowGrabFocus( bool b ) { mbGrabFocus = b; } + bool IsGrabFocusAllowed() const { return mbGrabFocus; } void SetSeparatorPos( sal_uInt16 n ) { mnSeparatorPos = n; } sal_uInt16 GetSeparatorPos() const { return mnSeparatorPos; } - void SetTravelSelect( sal_Bool bTravelSelect ) { mbTravelSelect = bTravelSelect; } - sal_Bool IsTravelSelect() const { return mbTravelSelect; } - sal_Bool IsTrackingSelect() const { return mbTrackingSelect; } + void SetTravelSelect( bool bTravelSelect ) { mbTravelSelect = bTravelSelect; } + bool IsTravelSelect() const { return mbTravelSelect; } + bool IsTrackingSelect() const { return mbTrackingSelect; } void SetUserItemSize( const Size& rSz ); const Size& GetUserItemSize() const { return maUserItemSize; } - void EnableUserDraw( sal_Bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; } - sal_Bool IsUserDrawEnabled() const { return mbUserDrawEnabled; } + void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; } + bool IsUserDrawEnabled() const { return mbUserDrawEnabled; } - void EnableMultiSelection( sal_Bool bMulti, sal_Bool bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; } - sal_Bool IsMultiSelectionEnabled() const { return mbMulti; } + void EnableMultiSelection( bool bMulti, bool bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; } + bool IsMultiSelectionEnabled() const { return mbMulti; } - void SetMultiSelectionSimpleMode( sal_Bool bSimple ) { mbSimpleMode = bSimple; } - sal_Bool IsMultiSelectionSimpleMode() const { return mbSimpleMode; } + void SetMultiSelectionSimpleMode( bool bSimple ) { mbSimpleMode = bSimple; } + bool IsMultiSelectionSimpleMode() const { return mbSimpleMode; } - void EnableMouseMoveSelect( sal_Bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; } - sal_Bool IsMouseMoveSelectEnabled() const { return mbMouseMoveSelect; } - sal_Bool IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; } + void EnableMouseMoveSelect( bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; } + bool IsMouseMoveSelectEnabled() const { return mbMouseMoveSelect; } + bool IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; } Size CalcSize( sal_uInt16 nMaxLines ) const; Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const; @@ -363,21 +364,24 @@ public: void SetMRUChangedHdl( const Link& rLink ) { maMRUChangedHdl = rLink; } const Link& GetMRUChangedHdl() const { return maMRUChangedHdl; } - sal_Bool IsSelectionChanged() const { return mbSelectionChanged; } + bool IsSelectionChanged() const { return mbSelectionChanged; } sal_uInt16 GetSelectModifier() const { return mnSelectModifier; } - void EnableSort( sal_Bool b ) { mbSort = b; } + void EnableSort( bool b ) { mbSort = b; } - void SetReadOnly( sal_Bool bReadOnly ) { mbReadOnly = bReadOnly; } - sal_Bool IsReadOnly() const { return mbReadOnly; } + void SetReadOnly( bool bReadOnly ) { mbReadOnly = bReadOnly; } + bool IsReadOnly() const { return mbReadOnly; } using Control::ImplInitSettings; void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); sal_uInt16 ImplGetTextStyle() const; // pb: #106948# explicit mirroring for calc - inline void EnableMirroring() { mbMirroring = sal_True; } - inline sal_Bool IsMirroring() const { return mbMirroring; } + inline void EnableMirroring() { mbMirroring = true; } + inline bool IsMirroring() const { return mbMirroring; } + + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; } protected: // ISearchableStringList @@ -397,9 +401,13 @@ private: ScrollBar* mpHScrollBar; ScrollBar* mpVScrollBar; ScrollBarBox* mpScrollBarBox; - sal_Bool mbVScroll : 1, // VScroll an oder aus - mbHScroll : 1, // HScroll an oder aus - mbAutoHScroll : 1; // AutoHScroll an oder aus + + /// bitfield + bool mbVScroll : 1; // VScroll an oder aus + bool mbHScroll : 1; // HScroll an oder aus + bool mbAutoHScroll : 1; // AutoHScroll an oder aus + bool mbEdgeBlending : 1; + Link maScrollHdl; // Weil der vom ImplListBoxWindow selbst benoetigt wird. ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; @@ -503,6 +511,9 @@ public: sal_uInt16 GetDisplayLineCount() const { return maLBWindow.GetDisplayLineCount(); } + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew); + // pb: #106948# explicit mirroring for calc inline void EnableMirroring() { maLBWindow.EnableMirroring(); } inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; } @@ -569,9 +580,10 @@ private: Link maMBDownHdl; Link maUserDrawHdl; - sal_Bool mbUserDrawEnabled : 1, - mbInUserDraw : 1; - + /// bitfield + bool mbUserDrawEnabled : 1; + bool mbInUserDraw : 1; + bool mbEdgeBlending : 1; void ImplDraw( bool bLayout = false ); protected: @@ -607,10 +619,13 @@ public: void SetUserItemSize( const Size& rSz ) { maUserItemSize = rSz; } const Size& GetUserItemSize() const { return maUserItemSize; } - void EnableUserDraw( sal_Bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; } - sal_Bool IsUserDrawEnabled() const { return mbUserDrawEnabled; } + void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; } + bool IsUserDrawEnabled() const { return mbUserDrawEnabled; } void DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos = sal_False, bool bLayout = false ); + + bool GetEdgeBlending() const { return mbEdgeBlending; } + void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; } }; // ----------- diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 638d27f725e2..94f17520d5e6 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -34,6 +34,7 @@ #include "vcl/i18nhelp.hxx" #include "vcl/configsettings.hxx" #include "vcl/gradient.hxx" +#include "vcl/outdev.hxx" #include "unotools/fontcfg.hxx" #include "unotools/localedatawrapper.hxx" @@ -233,6 +234,15 @@ ImplStyleData::ImplStyleData() : mnUseImagesInMenus = STYLE_MENUIMAGES_AUTO; mnPreferredSymbolsStyle = STYLE_SYMBOLS_AUTO; mpFontOptions = NULL; + mnEdgeBlending = 35; + maEdgeBlendingTopLeftColor = RGB_COLORDATA(0xC0, 0xC0, 0xC0); + maEdgeBlendingBottomRightColor = RGB_COLORDATA(0x40, 0x40, 0x40); + mnListBoxMaximumLineCount = 25; + mnColorValueSetColumnCount = 12; + mnColorValueSetMaximumRowCount = 40; + maListBoxPreviewDefaultLogicSize = Size(15, 7); + maListBoxPreviewDefaultPixelSize = Size(0, 0); // on-demand calculated in GetListBoxPreviewDefaultPixelSize() + mnListBoxPreviewDefaultLineWidth = 1; SetStandardStyles(); } @@ -345,6 +355,15 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : mnSymbolsStyle = rData.mnSymbolsStyle; mnPreferredSymbolsStyle = rData.mnPreferredSymbolsStyle; mpFontOptions = rData.mpFontOptions; + mnEdgeBlending = rData.mnEdgeBlending; + maEdgeBlendingTopLeftColor = rData.maEdgeBlendingTopLeftColor; + maEdgeBlendingBottomRightColor = rData.maEdgeBlendingBottomRightColor; + mnListBoxMaximumLineCount = rData.mnListBoxMaximumLineCount; + mnColorValueSetColumnCount = rData.mnColorValueSetColumnCount; + mnColorValueSetMaximumRowCount = rData.mnColorValueSetMaximumRowCount; + maListBoxPreviewDefaultLogicSize = rData.maListBoxPreviewDefaultLogicSize; + maListBoxPreviewDefaultPixelSize = rData.maListBoxPreviewDefaultPixelSize; + mnListBoxPreviewDefaultLineWidth = rData.mnListBoxPreviewDefaultLineWidth; } // ----------------------------------------------------------------------- @@ -466,6 +485,17 @@ StyleSettings::~StyleSettings() mpData->mnRefCount--; } +const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const +{ + if(0 == mpData->maListBoxPreviewDefaultPixelSize.Width() || 0 == mpData->maListBoxPreviewDefaultPixelSize.Height()) + { + const_cast< StyleSettings* >(this)->mpData->maListBoxPreviewDefaultPixelSize = + Application::GetDefaultDevice()->LogicToPixel(mpData->maListBoxPreviewDefaultLogicSize, MAP_APPFONT); + } + + return mpData->maListBoxPreviewDefaultPixelSize; +} + // ----------------------------------------------------------------------- void StyleSettings::Set3DColors( const Color& rColor ) @@ -934,7 +964,16 @@ sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->mbHideDisabledMenuItems == rSet.mpData->mbHideDisabledMenuItems) && (mpData->mbAcceleratorsInContextMenus == rSet.mpData->mbAcceleratorsInContextMenus)&& (mpData->mbPrimaryButtonWarpsSlider == rSet.mpData->mbPrimaryButtonWarpsSlider) && - (mpData->maFontColor == rSet.mpData->maFontColor )) + (mpData->maFontColor == rSet.mpData->maFontColor) && + (mpData->mnEdgeBlending == rSet.mpData->mnEdgeBlending) && + (mpData->maEdgeBlendingTopLeftColor == rSet.mpData->maEdgeBlendingTopLeftColor) && + (mpData->maEdgeBlendingBottomRightColor == rSet.mpData->maEdgeBlendingBottomRightColor) && + (mpData->mnListBoxMaximumLineCount == rSet.mpData->mnListBoxMaximumLineCount) && + (mpData->mnColorValueSetColumnCount == rSet.mpData->mnColorValueSetColumnCount) && + (mpData->mnColorValueSetMaximumRowCount == rSet.mpData->mnColorValueSetMaximumRowCount) && + (mpData->maListBoxPreviewDefaultLogicSize == rSet.mpData->maListBoxPreviewDefaultLogicSize) && + (mpData->maListBoxPreviewDefaultPixelSize == rSet.mpData->maListBoxPreviewDefaultPixelSize) && + (mpData->mnListBoxPreviewDefaultLineWidth == rSet.mpData->mnListBoxPreviewDefaultLineWidth)) return sal_True; else return sal_False; diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 6c2387a23293..425bd5e29d83 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -537,9 +537,14 @@ void ComboBox::EnableAutoSize( sal_Bool bAuto ) if ( mpFloatWin ) { if ( bAuto && !mpFloatWin->GetDropDownLineCount() ) - mpFloatWin->SetDropDownLineCount( 16 ); + { + // Adapt to GetListBoxMaximumLineCount here; was on fixed number of five before + AdaptDropDownLineCountToMaximum(); + } else if ( !bAuto ) + { mpFloatWin->SetDropDownLineCount( 0 ); + } } } @@ -561,6 +566,14 @@ void ComboBox::SetDropDownLineCount( sal_uInt16 nLines ) // ----------------------------------------------------------------------- +void ComboBox::AdaptDropDownLineCountToMaximum() +{ + // adapt to maximum allowed number + SetDropDownLineCount(std::min(GetEntryCount(), GetSettings().GetStyleSettings().GetListBoxMaximumLineCount())); +} + +// ----------------------------------------------------------------------- + sal_uInt16 ComboBox::GetDropDownLineCount() const { sal_uInt16 nLines = 0; diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 2fc66bb5fd55..b15bfc3b37fe 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -544,26 +544,27 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) : mnBorder = 1; mnSelectModifier = 0; mnUserDrawEntry = LISTBOX_ENTRY_NOTFOUND; - mbTrack = sal_False; - mbImgsDiffSz = sal_False; - mbTravelSelect = sal_False; - mbTrackingSelect = sal_False; - mbSelectionChanged = sal_False; - mbMouseMoveSelect = sal_False; - mbMulti = sal_False; - mbStackMode = sal_False; - mbGrabFocus = sal_False; - mbUserDrawEnabled = sal_False; - mbInUserDraw = sal_False; - mbReadOnly = sal_False; - mbHasFocusRect = sal_False; - mbRight = ( nWinStyle & WB_RIGHT ) ? sal_True : sal_False; - mbCenter = ( nWinStyle & WB_CENTER ) ? sal_True : sal_False; - mbSimpleMode = ( nWinStyle & WB_SIMPLEMODE ) ? sal_True : sal_False; - mbSort = ( nWinStyle & WB_SORT ) ? sal_True : sal_False; + mbTrack = false; + mbImgsDiffSz = false; + mbTravelSelect = false; + mbTrackingSelect = false; + mbSelectionChanged = false; + mbMouseMoveSelect = false; + mbMulti = false; + mbStackMode = false; + mbGrabFocus = false; + mbUserDrawEnabled = false; + mbInUserDraw = false; + mbReadOnly = false; + mbHasFocusRect = false; + mbRight = ( nWinStyle & WB_RIGHT ); + mbCenter = ( nWinStyle & WB_CENTER ); + mbSimpleMode = ( nWinStyle & WB_SIMPLEMODE ); + mbSort = ( nWinStyle & WB_SORT ); + mbEdgeBlending = false; // pb: #106948# explicit mirroring for calc - mbMirroring = sal_False; + mbMirroring = false; mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND; @@ -638,7 +639,7 @@ void ImplListBoxWindow::Clear() mnMaxImgHeight = 0; mnTop = 0; mnLeft = 0; - mbImgsDiffSz = sal_False; + mbImgsDiffSz = false; ImplClearLayoutData(); mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; @@ -714,9 +715,9 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) aMetrics.nImgHeight = (sal_uInt16) CalcZoom( aImgSz.Height() ); if( mnMaxImgWidth && ( aMetrics.nImgWidth != mnMaxImgWidth ) ) - mbImgsDiffSz = sal_True; + mbImgsDiffSz = true; else if ( mnMaxImgHeight && ( aMetrics.nImgHeight != mnMaxImgHeight ) ) - mbImgsDiffSz = sal_True; + mbImgsDiffSz = true; if( aMetrics.nImgWidth > mnMaxImgWidth ) mnMaxImgWidth = aMetrics.nImgWidth; @@ -791,7 +792,7 @@ void ImplListBoxWindow::ImplCallSelect() } maSelectHdl.Call( NULL ); - mbSelectionChanged = sal_False; + mbSelectionChanged = false; } // ----------------------------------------------------------------------- @@ -836,7 +837,7 @@ void ImplListBoxWindow::ImplShowFocusRect() if ( mbHasFocusRect ) HideFocus(); ShowFocus( maFocusRect ); - mbHasFocusRect = sal_True; + mbHasFocusRect = true; } // ----------------------------------------------------------------------- @@ -846,7 +847,7 @@ void ImplListBoxWindow::ImplHideFocusRect() if ( mbHasFocusRect ) { HideFocus(); - mbHasFocusRect = sal_False; + mbHasFocusRect = false; } } @@ -912,7 +913,7 @@ sal_uInt16 ImplListBoxWindow::GetLastVisibleEntry() const void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt ) { - mbMouseMoveSelect = sal_False; // only till the first MouseButtonDown + mbMouseMoveSelect = false; // only till the first MouseButtonDown maQuickSelectionEngine.Reset(); if ( !IsReadOnly() ) @@ -928,9 +929,9 @@ void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt ) mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND; mnCurrentPos = nSelect; - mbTrackingSelect = sal_True; + mbTrackingSelect = true; SelectEntries( nSelect, LET_MBDOWN, rMEvt.IsShift(), rMEvt.IsMod1() ); - mbTrackingSelect = sal_False; + mbTrackingSelect = false; if ( mbGrabFocus ) GrabFocus(); @@ -963,10 +964,10 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt ) SetTopEntry( 0 ); if ( mbStackMode ) // #87072#, #92323# { - mbTravelSelect = sal_True; + mbTravelSelect = true; mnSelectModifier = rMEvt.GetModifier(); ImplCallSelect(); - mbTravelSelect = sal_False; + mbTravelSelect = false; } } @@ -990,18 +991,18 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt ) mpEntryList->IsEntrySelectable( nSelect ) && ( ( nSelect != mnCurrentPos ) || !GetEntryList()->GetSelectEntryCount() || ( nSelect != GetEntryList()->GetSelectEntryPos( 0 ) ) ) ) { - mbTrackingSelect = sal_True; + mbTrackingSelect = true; if ( SelectEntries( nSelect, LET_TRACKING, sal_False, sal_False ) ) { if ( mbStackMode ) // #87072# { - mbTravelSelect = sal_True; + mbTravelSelect = true; mnSelectModifier = rMEvt.GetModifier(); ImplCallSelect(); - mbTravelSelect = sal_False; + mbTravelSelect = false; } } - mbTrackingSelect = sal_False; + mbTrackingSelect = false; } } @@ -1081,7 +1082,7 @@ void ImplListBoxWindow::SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ) mpEntryList->SelectEntry( nPos, sal_False ); ImplPaint( nPos, sal_True ); } - mbSelectionChanged = sal_True; + mbSelectionChanged = true; } } @@ -1221,7 +1222,7 @@ sal_Bool ImplListBoxWindow::SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLE } if( bSelectionChanged ) - mbSelectionChanged = sal_True; + mbSelectionChanged = true; if( bFocusChanged ) { @@ -1258,9 +1259,9 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) maCancelHdl.Call( NULL ); if ( !mbMulti ) { - mbTrackingSelect = sal_True; + mbTrackingSelect = true; SelectEntry( mnTrackingSaveSelection, sal_True ); - mbTrackingSelect = sal_False; + mbTrackingSelect = false; if ( mnTrackingSaveSelection != LISTBOX_ENTRY_NOTFOUND ) { long nHeightDiff = mpEntryList->GetAddedHeight( mnCurrentPos, mnTop, 0 ); @@ -1273,7 +1274,7 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) } } - mbTrack = sal_False; + mbTrack = false; } else { @@ -1282,14 +1283,14 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) { if ( bInside ) { - mbTrack = sal_True; + mbTrack = true; } // this case only happens, if the mouse button is pressed very briefly if( rTEvt.IsTrackingEnded() && mbTrack ) { bTrackOrQuickClick = sal_True; - mbTrack = sal_False; + mbTrack = false; } } @@ -1330,27 +1331,27 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) { if ( ( nSelect != mnCurrentPos ) || !GetEntryList()->GetSelectEntryCount() ) { - mbTrackingSelect = sal_True; + mbTrackingSelect = true; if ( SelectEntries( nSelect, LET_TRACKING, bShift, bCtrl ) ) { if ( mbStackMode ) // #87734# (#87072#) { - mbTravelSelect = sal_True; + mbTravelSelect = true; mnSelectModifier = rTEvt.GetMouseEvent().GetModifier(); ImplCallSelect(); - mbTravelSelect = sal_False; + mbTravelSelect = false; } } - mbTrackingSelect = sal_False; + mbTrackingSelect = false; } } else { if ( !mbMulti && GetEntryList()->GetSelectEntryCount() ) { - mbTrackingSelect = sal_True; + mbTrackingSelect = true; SelectEntry( GetEntryList()->GetSelectEntryPos( 0 ), sal_False ); - mbTrackingSelect = sal_False; + mbTrackingSelect = false; } else if ( mbStackMode ) { @@ -1372,18 +1373,18 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) } else { - mbTrackingSelect = sal_True; + mbTrackingSelect = true; bSelectionChanged = SelectEntries( nSelect, LET_TRACKING, bShift, bCtrl ); - mbTrackingSelect = sal_False; + mbTrackingSelect = false; } if ( bSelectionChanged ) { - mbSelectionChanged = sal_True; - mbTravelSelect = sal_True; + mbSelectionChanged = true; + mbTravelSelect = true; mnSelectModifier = rTEvt.GetMouseEvent().GetModifier(); ImplCallSelect(); - mbTravelSelect = sal_False; + mbTravelSelect = false; } } } @@ -1693,10 +1694,10 @@ sal_Bool ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) mnCurrentPos = nSelect; if ( SelectEntries( nSelect, eLET, bShift, bCtrl ) ) { - mbTravelSelect = sal_True; + mbTravelSelect = true; mnSelectModifier = rKEvt.GetKeyCode().GetModifier(); ImplCallSelect(); - mbTravelSelect = sal_False; + mbTravelSelect = false; } } @@ -1762,10 +1763,10 @@ void ImplListBoxWindow::SelectEntry( ::vcl::StringEntryIdentifier _entry ) mnCurrentPos = nSelect; if ( SelectEntries( nSelect, LET_KEYMOVE, sal_False, sal_False ) ) { - mbTravelSelect = sal_True; + mbTravelSelect = true; mnSelectModifier = 0; ImplCallSelect(); - mbTravelSelect = sal_False; + mbTravelSelect = false; } } @@ -1805,7 +1806,7 @@ void ImplListBoxWindow::ImplPaint( sal_uInt16 nPos, sal_Bool bErase, bool bLayou if ( IsUserDrawEnabled() ) { - mbInUserDraw = sal_True; + mbInUserDraw = true; mnUserDrawEntry = nPos; aRect.Left() -= mnLeft; if ( nPos < GetEntryList()->GetMRUCount() ) @@ -1818,7 +1819,7 @@ void ImplListBoxWindow::ImplPaint( sal_uInt16 nPos, sal_Bool bErase, bool bLayou UserDrawEvent aUDEvt( this, aRect, nPos, nCurr ); maUserDrawHdl.Call( &aUDEvt ); - mbInUserDraw = sal_False; + mbInUserDraw = false; } else { @@ -1865,6 +1866,25 @@ void ImplListBoxWindow::DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Boo aImgSz.Height() = CalcZoom( aImgSz.Height() ); DrawImage( aPtImg, aImgSz, aImage ); } + + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0); + + if(nEdgeBlendingPercent) + { + const Rectangle aRect(aPtImg, aImgSz); + Bitmap aBitmap(GetBitmap(aRect.TopLeft(), aRect.GetSize())); + + if(!aBitmap.IsEmpty()) + { + const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); + const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); + const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); + + aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight); + DrawBitmap(aRect.TopLeft(), aBitmap); + } + } } } @@ -2238,12 +2258,14 @@ ImplListBox::ImplListBox( Window* pParent, WinBits nWinStyle ) : mpVScrollBar->SetScrollHdl( aLink ); mpHScrollBar->SetScrollHdl( aLink ); - mbVScroll = sal_False; - mbHScroll = sal_False; - mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL ) ? sal_True : sal_False; + mbVScroll = false; + mbHScroll = false; + mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL ); + mbEdgeBlending = false; maLBWindow.SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) ); maLBWindow.SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) ); + maLBWindow.SetEdgeBlending(GetEdgeBlending()); maLBWindow.Show(); } @@ -2406,7 +2428,7 @@ void ImplListBox::ImplCheckScrollBars() { if( !mbVScroll ) bArrange = true; - mbVScroll = sal_True; + mbVScroll = true; // check of the scrolled-out region if( GetEntryList()->GetSelectEntryCount() == 1 && @@ -2419,7 +2441,7 @@ void ImplListBox::ImplCheckScrollBars() { if( mbVScroll ) bArrange = true; - mbVScroll = sal_False; + mbVScroll = false; SetTopEntry( 0 ); } @@ -2435,7 +2457,7 @@ void ImplListBox::ImplCheckScrollBars() { if( !mbHScroll ) bArrange = true; - mbHScroll = sal_True; + mbHScroll = true; if ( !mbVScroll ) // maybe we do need one now { @@ -2443,7 +2465,7 @@ void ImplListBox::ImplCheckScrollBars() if( nEntries > nMaxVisEntries ) { bArrange = true; - mbVScroll = sal_True; + mbVScroll = true; // check of the scrolled-out region if( GetEntryList()->GetSelectEntryCount() == 1 && @@ -2463,7 +2485,7 @@ void ImplListBox::ImplCheckScrollBars() { if( mbHScroll ) bArrange = true; - mbHScroll = sal_False; + mbHScroll = false; SetLeftIndent( 0 ); } } @@ -2712,6 +2734,17 @@ OUString ImplListBox::GetMRUEntries( sal_Unicode cSep ) const return aEntries.makeStringAndClear(); } +// ----------------------------------------------------------------------- + +void ImplListBox::SetEdgeBlending(bool bNew) +{ + if(mbEdgeBlending != bNew) + { + mbEdgeBlending = bNew; + maLBWindow.SetEdgeBlending(GetEdgeBlending()); + } +} + // ======================================================================= ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) : @@ -2723,8 +2756,9 @@ ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) : else SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); - mbInUserDraw = sal_False; - mbUserDrawEnabled = sal_False; + mbInUserDraw = false; + mbUserDrawEnabled = false; + mbEdgeBlending = false; mnItemPos = LISTBOX_ENTRY_NOTFOUND; } @@ -2878,10 +2912,10 @@ void ImplWin::ImplDraw( bool bLayout ) if ( IsUserDrawEnabled() ) { - mbInUserDraw = sal_True; + mbInUserDraw = true; UserDrawEvent aUDEvt( this, maFocusRect, mnItemPos, 0 ); maUserDrawHdl.Call( &aUDEvt ); - mbInUserDraw = sal_False; + mbInUserDraw = false; } else { @@ -2909,6 +2943,7 @@ void ImplWin::DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDraw sal_uInt16 nStyle = 0; Size aImgSz = maImage.GetSizePixel(); Point aPtImg( nBorder, ( ( aOutSz.Height() - aImgSz.Height() ) / 2 ) ); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); // check for HC mode Image *pImage = &maImage; @@ -2923,6 +2958,24 @@ void ImplWin::DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDraw aImgSz.Height() = CalcZoom( aImgSz.Height() ); DrawImage( aPtImg, aImgSz, *pImage, nStyle ); } + + const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0); + + if(nEdgeBlendingPercent) + { + const Rectangle aRect(aPtImg, aImgSz); + Bitmap aBitmap(GetBitmap(aRect.TopLeft(), aRect.GetSize())); + + if(!aBitmap.IsEmpty()) + { + const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); + const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); + const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); + + aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight); + DrawBitmap(aRect.TopLeft(), aBitmap); + } + } } if( bDrawText && !maString.isEmpty() ) diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 6278f8e66f78..741558e2fd2d 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -87,12 +87,12 @@ void ListBox::ImplInitListBoxData() mpFloatWin = NULL; mpImplWin = NULL; mpBtn = NULL; - mnDDHeight = 0; - mbDDAutoSize = sal_True; mnSaveValue = LISTBOX_ENTRY_NOTFOUND; mnLineCount = 0; m_nMaxWidthChars = -1; + mbDDAutoSize = true; + mbEdgeBlending = false; } @@ -140,13 +140,13 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle ) mpImplWin->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) ); mpImplWin->Show(); mpImplWin->GetDropTarget()->addDropTargetListener(xDrop); + mpImplWin->SetEdgeBlending(GetEdgeBlending()); mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE ); ImplInitDropDownButton( mpBtn ); mpBtn->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) ); mpBtn->Show(); mpBtn->GetDropTarget()->addDropTargetListener(xDrop); - } Window* pLBParent = this; @@ -159,6 +159,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle ) mpImplLB->SetDoubleClickHdl( LINK( this, ListBox, ImplDoubleClickHdl ) ); mpImplLB->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) ); mpImplLB->SetPosPixel( Point() ); + mpImplLB->SetEdgeBlending(GetEdgeBlending()); mpImplLB->Show(); mpImplLB->GetDropTarget()->addDropTargetListener(xDrop); @@ -556,15 +557,20 @@ void ListBox::DataChanged( const DataChangedEvent& rDCEvt ) } -void ListBox::EnableAutoSize( sal_Bool bAuto ) +void ListBox::EnableAutoSize( bool bAuto ) { mbDDAutoSize = bAuto; if ( mpFloatWin ) { if ( bAuto && !mpFloatWin->GetDropDownLineCount() ) - mpFloatWin->SetDropDownLineCount( 16 ); + { + // use GetListBoxMaximumLineCount here; before, was on fixed number of five + AdaptDropDownLineCountToMaximum(); + } else if ( !bAuto ) + { mpFloatWin->SetDropDownLineCount( 0 ); + } } } @@ -584,6 +590,14 @@ void ListBox::SetDropDownLineCount( sal_uInt16 nLines ) } +void ListBox::AdaptDropDownLineCountToMaximum() +{ + // adapt to maximum allowed number + SetDropDownLineCount(std::min(GetEntryCount(), GetSettings().GetStyleSettings().GetListBoxMaximumLineCount())); +} + +// ----------------------------------------------------------------------- + sal_uInt16 ListBox::GetDropDownLineCount() const { if ( mpFloatWin ) @@ -1498,6 +1512,38 @@ bool ListBox::set_property(const OString &rKey, const OString &rValue) return true; } +// ----------------------------------------------------------------------- + +void ListBox::SetEdgeBlending(bool bNew) +{ + if(mbEdgeBlending != bNew) + { + mbEdgeBlending = bNew; + + if(IsDropDownBox()) + { + mpImplWin->Invalidate(); + } + else + { + mpImplLB->Invalidate(); + } + + if(mpImplWin) + { + mpImplWin->SetEdgeBlending(GetEdgeBlending()); + } + + if(mpImplLB) + { + mpImplLB->SetEdgeBlending(GetEdgeBlending()); + } + + Invalidate(); + } +} + +// ======================================================================= MultiListBox::MultiListBox( Window* pParent, WinBits nStyle ) : ListBox( WINDOW_MULTILISTBOX ) { |