[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/source svx/sdi
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 30 14:10:43 UTC 2020
sc/source/ui/view/formatsh.cxx | 59 ++++++++++++++++++++++-------------------
svx/sdi/svx.sdi | 2 -
2 files changed, 33 insertions(+), 28 deletions(-)
New commits:
commit 204df13a29a9742e2c1a5c5d4e18a63e7616a347
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Mar 30 11:26:50 2020 +0100
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Mar 30 16:10:13 2020 +0200
FrameLineColor - add Color parameter, and share code for color params.
Change-Id: I50483228221e817eb1a1d049d3c1ddf55a9c91d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91364
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index f6808252314a..f662bc8c3fce 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1642,6 +1642,27 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
}
+namespace
+{
+ bool lcl_getColorFromStr(const SfxItemSet *pArgs, Color &rColor)
+ {
+ const SfxPoolItem* pColorStringItem = nullptr;
+
+ if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem) && pColorStringItem)
+ {
+ OUString sColor;
+ sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
+
+ if (sColor == "transparent")
+ rColor = COL_TRANSPARENT;
+ else
+ rColor = Color(sColor.toInt32(16));
+ return true;
+ }
+ return false;
+ }
+}
+
void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
{
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
@@ -1785,16 +1806,9 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
case SID_ATTR_CHAR_COLOR:
case SID_SCATTR_PROTECTION :
{
- const SfxPoolItem* pColorStringItem = nullptr;
- if ( SfxItemState::SET == pNewAttrs->GetItemState( SID_ATTR_COLOR_STR, false, &pColorStringItem ) )
+ Color aColor;
+ if (lcl_getColorFromStr(pNewAttrs, aColor))
{
- Color aColor;
- OUString sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
- if ( sColor == "transparent" )
- aColor = Color( COL_TRANSPARENT );
- else
- aColor = Color( sColor.toInt32( 16 ) );
-
SvxColorItem aColorItem(pTabViewShell->GetSelectionPattern()->
GetItem( ATTR_FONT_COLOR ) );
aColorItem.SetValue(aColor);
@@ -1870,18 +1884,20 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
case SID_FRAME_LINECOLOR:
{
::editeng::SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine();
- const Color& rColor = pNewAttrs->Get( SID_FRAME_LINECOLOR ).GetValue();
+
+ Color aColor;
+ if (!lcl_getColorFromStr(pNewAttrs, aColor))
+ aColor = pNewAttrs->Get( SID_FRAME_LINECOLOR ).GetValue();
// Update default line
if ( pDefLine )
{
- pDefLine->SetColor( rColor );
+ pDefLine->SetColor( aColor );
pTabViewShell->SetSelectionFrameLines( pDefLine, true );
}
else
{
- ::editeng::SvxBorderLine aDefLine( &rColor, 20,
- SvxBorderLineStyle::SOLID );
+ ::editeng::SvxBorderLine aDefLine( &aColor, 20, SvxBorderLineStyle::SOLID );
pTabViewShell->SetDefaultFrameLine( &aDefLine );
pTabViewShell->SetSelectionFrameLines( &aDefLine, false );
}
@@ -1993,27 +2009,16 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
// ATTR_BACKGROUND (=SID_ATTR_BRUSH) has to be set to two IDs:
case SID_BACKGROUND_COLOR:
{
- const SfxPoolItem* pColorStringItem = nullptr;
Color aColor;
- if ( SfxItemState::SET == pNewAttrs->GetItemState( SID_ATTR_COLOR_STR, false, &pColorStringItem ) )
- {
- OUString sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
- if ( sColor == "transparent" )
- aColor = Color( COL_TRANSPARENT );
- else
- aColor = Color( sColor.toInt32( 16 ) );
- }
- else
+ if (!lcl_getColorFromStr(pNewAttrs, aColor))
{
const SvxColorItem& rNewColorItem = pNewAttrs->Get( SID_BACKGROUND_COLOR );
aColor = rNewColorItem.GetValue();
}
- SvxBrushItem aBrushItem(
- pTabViewShell->GetSelectionPattern()->
- GetItem( ATTR_BACKGROUND ) );
-
+ SvxBrushItem aBrushItem(
+ pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) );
aBrushItem.SetColor( aColor );
pTabViewShell->ApplyAttr( aBrushItem, false );
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 4774f61fa44e..6f85de054c85 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -5468,7 +5468,7 @@ SfxVoidItem ArrowsToolbox SID_DRAWTBX_ARROWS
]
SvxColorItem FrameLineColor SID_FRAME_LINECOLOR
-
+(SfxStringItem Color SID_ATTR_COLOR_STR, SvxColorItem FrameLineColor SID_FRAME_LINECOLOR)
[
AutoUpdate = TRUE,
FastCall = FALSE,
More information about the Libreoffice-commits
mailing list