diff options
-rw-r--r-- | cui/source/tabpages/backgrnd.cxx | 4 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 84 | ||||
-rw-r--r-- | sc/source/ui/inc/tabbgcolordlg.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/tabbgcolordlg.cxx | 93 | ||||
-rw-r--r-- | sc/source/ui/src/miscdlgs.src | 102 | ||||
-rw-r--r-- | svtools/inc/svtools/accessibilityoptions.hxx | 14 | ||||
-rw-r--r-- | svtools/source/config/accessibilityoptions.cxx | 197 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 21 | ||||
-rw-r--r-- | svtools/source/inc/configitems/accessibilityoptions_const.hxx | 5 | ||||
-rwxr-xr-x | svx/inc/svx/SvxColorChildWindow.hxx | 47 | ||||
-rwxr-xr-x | svx/inc/svx/SvxColorValueSet.hxx | 55 | ||||
-rwxr-xr-x | svx/source/tbxctrls/SvxColorChildWindow.cxx | 55 | ||||
-rwxr-xr-x | svx/source/tbxctrls/SvxColorValueSet.cxx | 158 | ||||
-rw-r--r-- | vcl/inc/vcl/bitmap.hxx | 31 | ||||
-rw-r--r-- | vcl/source/gdi/bitmap4.cxx | 197 |
15 files changed, 932 insertions, 135 deletions
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 1995b94540c2..ba5d7a30f6fb 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -1236,11 +1236,13 @@ void SvxBackgroundTabPage::FillColorValueSets_Impl() const Size aCurrentSizeContainer(aBorderWin.GetOutputSizePixel()); const Size aCurrentSizeContent(aBackgroundColorSet.GetOutputSizePixel()); const Size aNewSizeContent(aBackgroundColorSet.layoutToGivenHeight(aCurrentSizeContent.Height() - 4, nColorCount)); - const Size aNewSizeContainer(aNewSizeContent.Width() + 4, aNewSizeContent.Height() + 4); + static sal_Int32 nAdd = 4; + const Size aNewSizeContainer(aNewSizeContent.Width() + nAdd, aNewSizeContent.Height() + nAdd); const Point aNewPos((aCurrentPosContainer.X() + aCurrentSizeContainer.Width()) - aNewSizeContainer.Width(), aCurrentPosContainer.Y()); aBorderWin.SetOutputSizePixel(aNewSizeContainer); aBackgroundColorSet.SetOutputSizePixel(aNewSizeContent); + aBackgroundColorSet.SetPosSizePixel(Point(nAdd/2, nAdd/2), aNewSizeContent); aBorderWin.SetPosSizePixel(aNewPos, aNewSizeContainer); } diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 38742421161f..3847abdb02eb 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -6156,7 +6156,89 @@ </info> <value>false</value> </prop> - </group> + + <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> + <constraints> + <minInclusive oor:value="10"> + <info> + <desc>Specifies the minimum number of rows before a Scrollbar will be used.</desc> + </info> + </minInclusive> + <maxInclusive oor:value="99"> + <info> + <desc>Specifies the maximum number of rows before a Scrollbar will be used.</desc> + </info> + </maxInclusive> + </constraints> + <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> + <constraints> + <minInclusive oor:value="8"> + <info> + <desc>Specifies the minimum EdgeLength for Entries in ColorValueSets.</desc> + </info> + </minInclusive> + <maxInclusive oor:value="18"> + <info> + <desc>Specifies the minimum EdgeLength for Entries in ColorValueSets.</desc> + </info> + </maxInclusive> + </constraints> + <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.</desc> + <label>The ColumnCount used in ColorValueSets.</label> + </info> + <constraints> + <minInclusive oor:value="12"> + <info> + <desc>Specifies the perfect number of columns for ColorValueSet layout.</desc> + </info> + </minInclusive> + <maxInclusive oor:value="24"> + <info> + <desc>Specifies a maximum number of columns for ColorValueSet layout.</desc> + </info> + </maxInclusive> + </constraints> + <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 previews, etc...). EdgeBlending will visualize a one pixel border on the preview object so that a noce 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 completely on it's borders.</desc> + <label>Defines the EdgeBlending for Previews in percent.</label> + </info> + <constraints> + <minInclusive oor:value="0"> + <info> + <desc>Specifies that no EdgeBlending shall happen.</desc> + </info> + </minInclusive> + <maxInclusive oor:value="99"> + <info> + <desc>Specifies that EdgeBlending will cover the edges of Previews completely.</desc> + </info> + </maxInclusive> + </constraints> + <value>35</value> + </prop> + + </group> <set oor:name="OfficeObjects" oor:node-type="ObjectNames"> <info> <deprecated>Replaced by org.openoffice.Office.Embedding/ObjectNames.</deprecated> diff --git a/sc/source/ui/inc/tabbgcolordlg.hxx b/sc/source/ui/inc/tabbgcolordlg.hxx index e9b41353e7b9..0aa7d86d817e 100644 --- a/sc/source/ui/inc/tabbgcolordlg.hxx +++ b/sc/source/ui/inc/tabbgcolordlg.hxx @@ -27,7 +27,7 @@ #include <vcl/dialog.hxx> #include <vcl/fixed.hxx> #include <vcl/button.hxx> -#include <svtools/valueset.hxx> +#include <svx/SvxColorValueSet.hxx> //------------------------------------------------------------------------ @@ -44,7 +44,7 @@ public: void GetSelectedColor( Color& rColor ) const; private: - class ScTabBgColorValueSet : public ValueSet + class ScTabBgColorValueSet : public SvxColorValueSet { public: ScTabBgColorValueSet(Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg); diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx index f92a8b916e3e..10b5327e4c03 100644 --- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx +++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx @@ -100,45 +100,84 @@ void ScTabBgColorDlg::FillColorValueSets_Impl() DBG_ASSERT( pDocSh, "DocShell not found!" ); if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) ) ) + { pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); + } + if ( !pColorTable ) { pOwnColorTable.reset(new XColorList(SvtPathOptions().GetPalettePath())); pColorTable = pOwnColorTable.get(); } + + long nColorCount(0); + if ( pColorTable ) { - sal_uInt16 i = 0; - long nCount = pColorTable->Count(); + nColorCount = pColorTable->Count(); XColorEntry* pEntry = NULL; Color aColWhite( COL_WHITE ); String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) ); - WinBits nBits = ( aTabBgColorSet.GetStyle() | WB_NAMEFIELD | WB_ITEMBORDER | WB_NONEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_NOPOINTERFOCUS); - aTabBgColorSet.SetText( aTabBgColorNoColorText ); - aTabBgColorSet.SetStyle( nBits ); - for ( i = 0; i < nCount; i++ ) - { - pEntry = pColorTable->GetColor(i); - aTabBgColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() ); - if (pEntry->GetColor() == aTabBgColor) - nSelectedItem = (i + 1); - } - while ( i < 80 ) - { - aTabBgColorSet.InsertItem( i + 1, aColWhite, aStrWhite ); - i++; - } + aTabBgColorSet.addEntriesForXColorList(*pColorTable); + } - if ( nCount > 80 ) - { - aTabBgColorSet.SetStyle( nBits | WB_VSCROLL ); - } + if(nColorCount) + { + const WinBits nBits(aTabBgColorSet.GetStyle() | WB_NAMEFIELD | WB_ITEMBORDER | WB_NONEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_NOPOINTERFOCUS); + aTabBgColorSet.SetText( aTabBgColorNoColorText ); + aTabBgColorSet.SetStyle( nBits ); + static sal_Int32 nAdd = 4; + + // calculate new size of color control as base, derive size of border win + const Size aNewSize(aTabBgColorSet.layoutAllVisible(nColorCount)); + const Size aNewSizeBorderWin(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd); + + // from that, calculate a new dialog size + const Size aCurrentSizeDialog(GetOutputSizePixel()); + const Size aCurrentSizeBorderWin(aBorderWin.GetOutputSizePixel()); + const long nOffsetX(aCurrentSizeDialog.Width() - aCurrentSizeBorderWin.Width()); + const long nOffsetY(aCurrentSizeDialog.Height() - aCurrentSizeBorderWin.Height()); + const Size aNewSizeDialog(aNewSizeBorderWin.Width() + nOffsetX, aNewSizeBorderWin.Height() + nOffsetY); + + // also need to adapt pos and size for the three buttons; as a base, take their original + // distance from the dialog bottom and get new Y-Pos + const long aButtonOffsetFromBottom(aCurrentSizeDialog.Height() - aBtnOk.GetPosPixel().Y()); + const long aNewButtonY(aNewSizeDialog.Height() - aButtonOffsetFromBottom); + + // for each button, scale width and x-pos by old/new dialog sizes and re-layout + // for Okay-Button + const long aNewWidthOkay((aBtnOk.GetSizePixel().Width() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width()); + const long aNewPosOkay((aBtnOk.GetPosPixel().X() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width()); + const Size aNewSizeOkay(aNewWidthOkay, aBtnOk.GetOutputSizePixel().Height()); + aBtnOk.SetOutputSizePixel(aNewSizeOkay); + aBtnOk.SetPosSizePixel(Point(aNewPosOkay, aNewButtonY), aNewSizeOkay); + + // for Cancel-Button + const long aNewWidthCancel((aBtnCancel.GetSizePixel().Width() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width()); + const long aNewPosCancel((aBtnCancel.GetPosPixel().X() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width()); + const Size aNewSizeCancel(aNewWidthCancel, aBtnCancel.GetOutputSizePixel().Height()); + aBtnCancel.SetOutputSizePixel(aNewSizeCancel); + aBtnCancel.SetPosSizePixel(Point(aNewPosCancel, aNewButtonY), aNewSizeCancel); + + // for Help-Button + const long aNewWidthHelp((aBtnHelp.GetSizePixel().Width() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width()); + const long aNewPosHelp((aBtnHelp.GetPosPixel().X() * aNewSizeDialog.Width()) / aCurrentSizeDialog.Width()); + const Size aNewSizeHelp(aNewWidthHelp, aBtnHelp.GetOutputSizePixel().Height()); + aBtnHelp.SetOutputSizePixel(aNewSizeHelp); + aBtnHelp.SetPosSizePixel(Point(aNewPosHelp, aNewButtonY), aNewSizeHelp); + + // set new sizes for color control + aTabBgColorSet.SetOutputSizePixel(aNewSize); + aTabBgColorSet.SetPosSizePixel(Point(nAdd/2, nAdd/2), aNewSize); + + // set new size for border win + aBorderWin.SetOutputSizePixel(aNewSizeBorderWin); + + // set new size for dialog itself + SetOutputSizePixel(aNewSizeDialog); } - aTabBgColorSet.SetColCount( 10 ); - aTabBgColorSet.SetLineCount( 10 ); - aTabBgColorSet.CalcWindowSizePixel( aSize15x15 ); - aTabBgColorSet.Format(); + aTabBgColorSet.SelectItem(nSelectedItem); aTabBgColorSet.Resize(); } @@ -168,7 +207,7 @@ IMPL_LINK( ScTabBgColorDlg, TabBgColorOKHdl_Impl, OKButton*, EMPTYARG ) } ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet( Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg ) : - ValueSet(pParent, rResId) + SvxColorValueSet(pParent, rResId) { aTabBgColorDlg = pTabBgColorDlg; } @@ -187,5 +226,5 @@ void ScTabBgColorDlg::ScTabBgColorValueSet::KeyInput( const KeyEvent& rKEvt ) } break; } - ValueSet::KeyInput(rKEvt); + SvxColorValueSet::KeyInput(rKEvt); } diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src index e1f295049c45..9e0a31b6292e 100644 --- a/sc/source/ui/src/miscdlgs.src +++ b/sc/source/ui/src/miscdlgs.src @@ -619,108 +619,6 @@ ModalDialog RID_SCDLG_TAB_BG_COLOR DefButton = FALSE ; }; }; -/* -ModalDialog RID_SCDLG_TAB_BG_COLOR -{ - HelpID = "sc:ModalDialog:RID_SCDLG_TAB_BG_COLOR"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 180 , 150 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Control TAB_BG_COLOR_CT_BORDER - { - Border = TRUE ; - Pos = MAP_APPFONT ( 1 , 1 ) ; //12, 32 - Size = MAP_APPFONT ( 116+2 , 145+2 ) ; - DialogControl = TRUE; - }; - Control TAB_BG_COLOR_SET_BGDCOLOR - { - // * HelpId = HID_BACKGROUND_CTL_BGDCOLORSET ; - Hide = FALSE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 116 , 145 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 125 , 50 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 125 , 67 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = FALSE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 125 , 84 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = FALSE ; - }; -}; -*/ -/* -ModalDialog RID_SCDLG_MTRINPUT -{ - HelpID = "sc:ModalDialog:RID_SCDLG_MTRINPUT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 190 , 63 ) ; - Moveable = TRUE ; - Closeable = FALSE ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 136 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 136 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 136 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_LABEL - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - }; - MetricField ED_VALUE - { - // HelpID, weil die generierten aus den Ableitungen nicht in die hid.lst kommen - HelpId = HID_SC_MTRIN_VAL ; - Border = TRUE ; - Pos = MAP_APPFONT ( 70 , 6 ) ; - Size = MAP_APPFONT ( 60 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - }; - CheckBox BTN_DEFVAL - { - HelpID = "sc:CheckBox:RID_SCDLG_MTRINPUT:BTN_DEFVAL"; - // HelpID, weil die generierten aus den Ableitungen nicht in die hid.lst kommen - TabStop = TRUE ; - Pos = MAP_APPFONT ( 70 , 24 ) ; - Size = MAP_APPFONT ( 58 , 10 ) ; - Text [ en-US ] = "~Default value" ; - }; -}; -*/ ModalDialog RID_SCDLG_COL_MAN { diff --git a/svtools/inc/svtools/accessibilityoptions.hxx b/svtools/inc/svtools/accessibilityoptions.hxx index 23fc46fea460..e66ce253eec6 100644 --- a/svtools/inc/svtools/accessibilityoptions.hxx +++ b/svtools/inc/svtools/accessibilityoptions.hxx @@ -56,6 +56,15 @@ 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; + void SetIsForPagePreviews(sal_Bool bSet); void SetIsHelpTipsDisappear(sal_Bool bSet); void SetIsAllowAnimatedGraphics(sal_Bool bSet); @@ -66,6 +75,11 @@ 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); + sal_Bool IsModified() const; void Commit(); diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index b91b9d498513..8ca72433ef87 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -86,6 +86,10 @@ 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; void SetAutoDetectSystemHC(sal_Bool bSet); void SetIsForPagePreviews(sal_Bool bSet); @@ -96,6 +100,10 @@ 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); sal_Bool IsModified() const { return bIsModified; }; }; @@ -300,6 +308,78 @@ 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) + { + LogHelper::logIt(ex); + } + + 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) + { + LogHelper::logIt(ex); + } + + return nRet; +} + +sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Int16 nRet = 12; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return nRet; +} + +sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Int16 nRet = 35; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sEdgeBlending) >>= nRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return nRet; +} + void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet) { css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); @@ -497,6 +577,86 @@ void SvtAccessibilityOptions_Impl::SetVCLSettings() Application::SetSettings(aAllSettings); } +void SvtAccessibilityOptions_Impl::SetColorValueSetMaximumRowCount(sal_Int16 nSet) +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try + { + 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) + { + LogHelper::logIt(ex); + } +} + +void SvtAccessibilityOptions_Impl::SetColorValueSetEntryEdgeLength(sal_Int16 nSet) +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try + { + if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetEntryEdgeLength)!=nSet) + { + xNode->setPropertyValue(s_sColorValueSetEntryEdgeLength, css::uno::makeAny(nSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(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) + { + xNode->setPropertyValue(s_sColorValueSetColumnCount, css::uno::makeAny(nSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +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_sEdgeBlending)!=nSet) + { + xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + // ----------------------------------------------------------------------- // class SvtAccessibilityOptions -------------------------------------------------- @@ -600,6 +760,26 @@ 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(); +} + // ----------------------------------------------------------------------- void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet) { @@ -637,9 +817,24 @@ void SvtAccessibilityOptions::SetSelectionInReadonly(sal_Bool bSet) { sm_pSingleImplConfig->SetSelectionInReadonly(bSet); } - 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); +} // ----------------------------------------------------------------------- diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 6767cf2aeb53..85f5ee93ee9e 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -38,7 +38,7 @@ #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" #define _SV_VALUESET_CXX @@ -284,6 +284,25 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem ) { 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 { diff --git a/svtools/source/inc/configitems/accessibilityoptions_const.hxx b/svtools/source/inc/configitems/accessibilityoptions_const.hxx index fbc2dc3b01af..82818bec297c 100644 --- a/svtools/source/inc/configitems/accessibilityoptions_const.hxx +++ b/svtools/source/inc/configitems/accessibilityoptions_const.hxx @@ -41,6 +41,11 @@ namespace static const ::rtl::OUString s_sIsAutomaticFontColor = ::rtl::OUString::createFromAscii("IsAutomaticFontColor"); static const ::rtl::OUString s_sIsSystemFont = ::rtl::OUString::createFromAscii("IsSystemFont"); static const ::rtl::OUString s_sIsSelectionInReadonly = ::rtl::OUString::createFromAscii("IsSelectionInReadonly"); + + static const ::rtl::OUString s_sColorValueSetMaximumRowCount = ::rtl::OUString::createFromAscii("ColorValueSetMaximumRowCount"); + static const ::rtl::OUString s_sColorValueSetEntryEdgeLength = ::rtl::OUString::createFromAscii("ColorValueSetEntryEdgeLength"); + static const ::rtl::OUString s_sColorValueSetColumnCount = ::rtl::OUString::createFromAscii("ColorValueSetColumnCount"); + static const ::rtl::OUString s_sEdgeBlending = ::rtl::OUString::createFromAscii("EdgeBlending"); } #endif // INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX diff --git a/svx/inc/svx/SvxColorChildWindow.hxx b/svx/inc/svx/SvxColorChildWindow.hxx new file mode 100755 index 000000000000..11ef56c9fcdd --- /dev/null +++ b/svx/inc/svx/SvxColorChildWindow.hxx @@ -0,0 +1,47 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + + +#ifndef _SVX_COLORCHILDWINDOW_HXX +#define _SVX_COLORCHILDWINDOW_HXX + +#include <sfx2/childwin.hxx> +#include "svx/svxdllapi.h" + +/************************************************************************* +|* +|* Ableitung vom SfxChildWindow als "Behaelter" fuer Controller +|* +\************************************************************************/ + +class SVX_DLLPUBLIC SvxColorChildWindow : public SfxChildWindow +{ + public: + SvxColorChildWindow( Window*, sal_uInt16, SfxBindings*, + SfxChildWinInfo* ); + + SFX_DECL_CHILDWINDOW(SvxColorChildWindow); +}; + + +#endif // _SVX_COLORCHILDWINDOW_HXX + +// eof diff --git a/svx/inc/svx/SvxColorValueSet.hxx b/svx/inc/svx/SvxColorValueSet.hxx new file mode 100755 index 000000000000..dbdd2c8ac3e9 --- /dev/null +++ b/svx/inc/svx/SvxColorValueSet.hxx @@ -0,0 +1,55 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_COLORVALUESET_HXX +#define _SVX_COLORVALUESET_HXX + +#include <svtools/valueset.hxx> +#include "svx/svxdllapi.h" + +////////////////////////////////////////////////////////////////////////////// + +class XColorList; + +////////////////////////////////////////////////////////////////////////////// + +class SVX_DLLPUBLIC SvxColorValueSet : public ValueSet +{ +private: +protected: +public: + SvxColorValueSet(Window* pParent, WinBits nWinStyle = WB_ITEMBORDER); + SvxColorValueSet(Window* pParent, const ResId& rResId); + + sal_uInt32 getMaxRowCount() const; + sal_uInt32 getEntryEdgeLength() const; + sal_uInt32 getColumnCount() const; + + void addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex = 1); + Size layoutAllVisible(sal_uInt32 nEntryCount); + Size layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount); +}; + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SVX_COLORVALUESET_HXX + +// eof diff --git a/svx/source/tbxctrls/SvxColorChildWindow.cxx b/svx/source/tbxctrls/SvxColorChildWindow.cxx new file mode 100755 index 000000000000..b9b14ca12d8c --- /dev/null +++ b/svx/source/tbxctrls/SvxColorChildWindow.cxx @@ -0,0 +1,55 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include <svx/SvxColorChildWindow.hxx> +#include <sfx2/dockwin.hxx> +#include <svx/svxids.hrc> +#include <svx/dialogs.hrc> +#include <svx/colrctrl.hxx> +#include <svx/dialmgr.hxx> + +SFX_IMPL_DOCKINGWINDOW( SvxColorChildWindow, SID_COLOR_CONTROL ) + +/************************************************************************* +|* +|* Ableitung vom SfxChildWindow als "Behaelter" fuer Animator +|* +\************************************************************************/ + +SvxColorChildWindow::SvxColorChildWindow( Window* _pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo ) : + SfxChildWindow( _pParent, nId ) +{ + SvxColorDockingWindow* pWin = new SvxColorDockingWindow( pBindings, this, + _pParent, SVX_RES( RID_SVXCTRL_COLOR ) ); + pWindow = pWin; + + eChildAlignment = SFX_ALIGN_BOTTOM; + + pWin->Initialize( pInfo ); +} + +// eof diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx new file mode 100755 index 000000000000..ac8bcd6f0c96 --- /dev/null +++ b/svx/source/tbxctrls/SvxColorValueSet.cxx @@ -0,0 +1,158 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include <svx/SvxColorValueSet.hxx> +#include <svx/xtable.hxx> +#include <svtools/accessibilityoptions.hxx> + +////////////////////////////////////////////////////////////////////////////// + +SvxColorValueSet::SvxColorValueSet(Window* _pParent, WinBits nWinStyle) +: ValueSet(_pParent, nWinStyle) +{ +} + +SvxColorValueSet::SvxColorValueSet(Window* _pParent, const ResId& rResId) +: ValueSet(_pParent, rResId) +{ +} + +sal_uInt32 SvxColorValueSet::getMaxRowCount() const +{ + const SvtAccessibilityOptions aOptions; + + return aOptions.GetColorValueSetMaximumRowCount(); +} + +sal_uInt32 SvxColorValueSet::getEntryEdgeLength() const +{ + const SvtAccessibilityOptions aOptions; + + return aOptions.GetColorValueSetEntryEdgeLength(); +} + +sal_uInt32 SvxColorValueSet::getColumnCount() const +{ + const SvtAccessibilityOptions aOptions; + + return aOptions.GetColorValueSetColumnCount(); +} + +void SvxColorValueSet::addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex) +{ + const sal_uInt32 nColorCount(rXColorList.Count()); + + for(sal_uInt32 nIndex(0); nIndex < nColorCount; nIndex++, nStartIndex++) + { + const XColorEntry* pEntry = rXColorList.GetColor(nIndex); + + if(pEntry) + { + InsertItem(nStartIndex, pEntry->GetColor(), pEntry->GetName()); + } + else + { + OSL_ENSURE(false, "OOps, XColorList with empty entries (!)"); + } + } +} + +Size SvxColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount) +{ + if(!nEntryCount) + { + nEntryCount++; + } + + const sal_uInt32 nRowCount(ceil(double(nEntryCount)/getColumnCount())); + const Size aItemSize(getEntryEdgeLength() - 2, getEntryEdgeLength() - 2); + const WinBits aWinBits(GetStyle() & ~WB_VSCROLL); + + if(nRowCount > getMaxRowCount()) + { + SetStyle(aWinBits|WB_VSCROLL); + } + else + { + SetStyle(aWinBits); + } + + SetColCount(getColumnCount()); + SetLineCount(std::min(nRowCount, getMaxRowCount())); + SetItemWidth(aItemSize.Width()); + SetItemHeight(aItemSize.Height()); + + return CalcWindowSizePixel(aItemSize); +} + +Size SvxColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount) +{ + if(!nEntryCount) + { + nEntryCount++; + } + + const sal_uInt32 nRowCount(ceil(double(nEntryCount)/getColumnCount())); + const Size aItemSize(getEntryEdgeLength(), getEntryEdgeLength()); + const WinBits aWinBits(GetStyle() & ~WB_VSCROLL); + + // get size whith all fields disabled + const WinBits aWinBitsNoScrollNoFields(GetStyle() & ~(WB_VSCROLL|WB_NAMEFIELD|WB_NONEFIELD)); + SetStyle(aWinBitsNoScrollNoFields); + const Size aSizeNoScrollNoFields(CalcWindowSizePixel(aItemSize, getColumnCount())); + + // get size with all needed fields + SetStyle(aWinBits); + Size aNewSize(CalcWindowSizePixel(aItemSize, getColumnCount())); + + // evtl. activate vertical scroll + const bool bAdaptHeight(aNewSize.Height() > nHeight); + + if(bAdaptHeight) + { + SetStyle(aWinBits|WB_VSCROLL); + aNewSize = CalcWindowSizePixel(aItemSize, getColumnCount()); + } + + // calculate field height and available height for requested height + const sal_uInt32 nFieldHeight(aNewSize.Height() - aSizeNoScrollNoFields.Height()); + const sal_uInt32 nAvailableHeight(nHeight >= nFieldHeight ? nHeight - nFieldHeight : 0); + + // calculate how many lines can be shown there + const Size aItemSizePixel(CalcItemSizePixel(aItemSize)); + const sal_uInt32 nLineCount((nAvailableHeight + aItemSizePixel.Height() - 1) / aItemSizePixel.Height()); + + // set height to wanted height + aNewSize.Height() = nHeight; + + SetItemWidth(aItemSize.Width()); + SetItemHeight(aItemSize.Height()); + SetColCount(getColumnCount()); + SetLineCount(nLineCount); + + return aNewSize; +} + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx index e81a47d05549..855d107a035b 100644 --- a/vcl/inc/vcl/bitmap.hxx +++ b/vcl/inc/vcl/bitmap.hxx @@ -29,6 +29,7 @@ #include <vcl/mapmod.hxx> #include <tools/rc.hxx> #include <vcl/region.hxx> +#include <tools/color.hxx> #ifdef WNT #define _STLP_HAS_NATIVE_FLOAT_ABS @@ -883,6 +884,36 @@ public: const BmpFilterParam* pFilterParam = NULL, const Link* pProgress = NULL ); + /** Draw a blend frame to the Bitmap + + @param nAlpha + The blend value defines how strong the frame will be blended with the + existing content, 255 == full coverage, 0 == no frame will be drawn + + @param aColorTopLeft, aColorBottomRight, aColorTopRight, aColorBottomLeft + The colors defining the frame. If the version without aColorTopRight and + aColorBottomLeft is used, these colors are linearly interpolated from + aColorTopLeft and aColorBottomRight using the width and height of the area + + @param rTopLeft + The start point of the frame in pixels + + @param rSize + The size of the frame in pixels + */ + void DrawBlendFrame( + sal_uInt8 nAlpha = 128, + Color aColorTopLeft = Color(COL_WHITE), + Color aColorBottomRight = Color(COL_BLACK)); + void DrawBlendFrame( + const Point& rTopLeft, + const Size& rSize, + sal_uInt8 nAlpha = 128, + Color aColorTopLeft = Color(COL_WHITE), + Color aColorTopRight = Color(COL_GRAY), + Color aColorBottomRight = Color(COL_BLACK), + Color aColorBottomLeft = Color(COL_GRAY)); + BitmapReadAccess* AcquireReadAccess(); BitmapWriteAccess* AcquireWriteAccess(); void ReleaseAccess( BitmapReadAccess* pAccess ); diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index da2f23d1aa4b..34238caf305a 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -1003,3 +1003,200 @@ sal_Bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* return bRet; } + +// ----------------------------------------------------------------------------- + +void impMixPixel(BitmapWriteAccess& rAcc, long y, long x, const Color& rColor, sal_uInt8 nAlpha) +{ + const BitmapColor aBitmapColor(rColor); + + if(nAlpha) + { + if(255 != nAlpha) + { + BitmapColor aTarget(rAcc.GetColor(y, x)); + + aTarget.Merge(aBitmapColor, nAlpha); + rAcc.SetPixel(y, x, aTarget); + } + } + else + { + rAcc.SetPixel(y, x, aBitmapColor); + } +} + +inline bool impVisibleX(long x, const Size& rSizePixel) +{ + return x >= 0 && x < rSizePixel.Width(); +} + +inline bool impVisibleY(long y, const Size& rSizePixel) +{ + return y >= 0 && y < rSizePixel.Width(); +} + +inline bool impVisibleXY(long y, long x, const Size& rSizePixel) +{ + return impVisibleX(x, rSizePixel) && impVisibleY(y, rSizePixel); +} + +void Bitmap::DrawBlendFrame( + const Point& rTopLeft, + const Size& rSize, + sal_uInt8 nAlpha, + Color aColorTopLeft, + Color aColorTopRight, + Color aColorBottomRight, + Color aColorBottomLeft) +{ + if(!IsEmpty()) + { + const Size aSizePixel(GetSizePixel()); + + if(aSizePixel.Width() && aSizePixel.Height()) + { + const long nW(rSize.Width()); + const long nH(rSize.Height()); + + if(nW || nH) + { + BitmapWriteAccess* pAcc = AcquireWriteAccess(); + const long nStartX(rTopLeft.X()); + const long nStartY(rTopLeft.X()); + const long nEndX(rTopLeft.X() + nW); + const long nEndY(rTopLeft.X() + nH); + long x(nStartX); + long y(nStartY); + + if(pAcc) + { + if(impVisibleXY(y, x, aSizePixel)) + { + // x == nStartX, y == nStartY + impMixPixel(*pAcc, y, x, aColorTopLeft, nAlpha); + } + + if(impVisibleY(y, aSizePixel)) + { + for(x = 1; x < nEndX - 1; x++) // y == nStartY + { + if(impVisibleX(x, aSizePixel)) + { + Color aMix(aColorTopLeft); + aMix.Merge(aColorTopRight, 255 - sal_uInt8(((x - nStartX) * 255) / nW)); + impMixPixel(*pAcc, y, x, aMix, nAlpha); + } + } + } + else + { + x = nEndX - 1; + } + + if(impVisibleXY(y, x, aSizePixel)) + { + // x == nEndX - 1, y == nStartY + impMixPixel(*pAcc, y, x, aColorTopRight, nAlpha); + } + + const bool bLeftVisible(impVisibleX(nStartX, aSizePixel)); + const bool bRightVisible(impVisibleX(x, aSizePixel)); + + if(bLeftVisible || bRightVisible) + { + if(bLeftVisible) + { + for(y = 1; y < nEndY - 1; y++) // x == nStartX and nEndX-1 + { + if(impVisibleY(y, aSizePixel)) + { + Color aMix(aColorTopLeft); + aMix.Merge(aColorBottomLeft, 255 - sal_uInt8(((y - nStartY) * 255) / nH)); + impMixPixel(*pAcc, y, nStartX, aMix, nAlpha); + } + } + } + + if(bRightVisible) + { + for(y = 1; y < nEndY - 1; y++) // x == nStartX and nEndX-1 + { + if(impVisibleY(y, aSizePixel)) + { + Color aMix(aColorTopRight); + aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((y -nStartY) * 255) / nH)); + impMixPixel(*pAcc, y, x, aMix, nAlpha); + } + } + } + } + else + { + y = nEndY - 1; + } + + if(impVisibleXY(y, x, aSizePixel)) + { + x = nStartX; // x == nStartX, y == nEndY-1 + impMixPixel(*pAcc, y, x, aColorBottomLeft, nAlpha); + } + + if(impVisibleY(y, aSizePixel)) + { + for(x = 1; x < nEndX - 1; x++) // y == nEndY-1 + { + if(impVisibleX(x, aSizePixel)) + { + Color aMix(aColorBottomLeft); + aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - nStartX)* 255) / nW)); + impMixPixel(*pAcc, y, x, aMix, nAlpha); + } + } + } + else + { + x = nEndX - 1; + } + + if(impVisibleXY(y, x, aSizePixel)) + { + // x == nEndX - 1, y == nEndY - 1 + impMixPixel(*pAcc, y, x, aColorBottomRight, nAlpha); + } + + ReleaseAccess(pAcc); + } + } + } + } +} + +void Bitmap::DrawBlendFrame( + sal_uInt8 nAlpha, + Color aColorTopLeft, + Color aColorBottomRight) +{ + if(!IsEmpty()) + { + const Point aTopLeft(0, 0); + const Size aSize(GetSizePixel()); + const sal_uInt32 nW(aSize.Width()); + const sal_uInt32 nH(aSize.Height()); + + if(nW || nH) + { + Color aColTopRight(aColorTopLeft); + Color aColBottomLeft(aColorTopLeft); + const sal_uInt32 nDE(nW + nH); + + aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE)); + aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE)); + + DrawBlendFrame(aTopLeft, aSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft); + } + } +} + +// ----------------------------------------------------------------------------- +// eof |