summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-06 13:27:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-07 07:57:08 +0100
commit9476ecb71b1acc66506a768a5fe0c123afd46b93 (patch)
treec2fff27010c7e409e4f7f38a7c41e5c34335df4a /sd
parent83241dba8fbf2004c48d87cb7221fd354589b28c (diff)
loplugin:collapseif in sd
Change-Id: I0751c9d3f379a3621bdc7ccce6a0d58c701a0261 Reviewed-on: https://gerrit.libreoffice.org/62955 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/sdpage.cxx11
-rw-r--r--sd/source/filter/ppt/pptinanimations.cxx29
-rw-r--r--sd/source/ui/animations/motionpathtag.cxx35
-rw-r--r--sd/source/ui/func/fusel.cxx16
-rw-r--r--sd/source/ui/func/futext.cxx11
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx7
-rw-r--r--sd/source/ui/unoidl/unopage.cxx7
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx7
-rw-r--r--sd/source/ui/view/drviews2.cxx50
-rw-r--r--sd/source/ui/view/drviews9.cxx753
10 files changed, 441 insertions, 485 deletions
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 841ac6868884..55edc022eb73 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2104,15 +2104,12 @@ static SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourc
OUString aName( rPage.GetLayoutName() + " " + OUString::number( nLevel ) );
SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( rModel.GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page) );
- if (pSheet)
+ if (pSheet && nLevel == 1)
{
- if (nLevel == 1)
- {
- SfxStyleSheet* pSubtitleSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
+ SfxStyleSheet* pSubtitleSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
- if (pSubtitleSheet)
- pOutlParaObj->ChangeStyleSheetName(SfxStyleFamily::Page, pSubtitleSheet->GetName(), pSheet->GetName());
- }
+ if (pSubtitleSheet)
+ pOutlParaObj->ChangeStyleSheetName(SfxStyleFamily::Page, pSubtitleSheet->GetName(), pSheet->GetName());
}
}
diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx
index d40d7f7f9512..e90087c343bc 100644
--- a/sd/source/filter/ppt/pptinanimations.cxx
+++ b/sd/source/filter/ppt/pptinanimations.cxx
@@ -1207,27 +1207,24 @@ void AnimationImporter::importAnimateAttributeTargetContainer( const Atom* pAtom
// nAccumulate 0 = none, 1 = always
// nTransformType 0: "property" else "image"
- if( nBits & 3 )
+ if( nBits & 3 && xAnimate.is() )
{
- if( xAnimate.is() )
+ if( nBits & 1 )
{
- if( nBits & 1 )
+ sal_Int16 nTemp = AnimationAdditiveMode::BASE;
+ switch( nAdditive )
{
- sal_Int16 nTemp = AnimationAdditiveMode::BASE;
- switch( nAdditive )
- {
- case 1: nTemp = AnimationAdditiveMode::SUM; break;
- case 2: nTemp = AnimationAdditiveMode::REPLACE; break;
- case 3: nTemp = AnimationAdditiveMode::MULTIPLY; break;
- case 4: nTemp = AnimationAdditiveMode::NONE; break;
- }
- xAnimate->setAdditive( nTemp );
+ case 1: nTemp = AnimationAdditiveMode::SUM; break;
+ case 2: nTemp = AnimationAdditiveMode::REPLACE; break;
+ case 3: nTemp = AnimationAdditiveMode::MULTIPLY; break;
+ case 4: nTemp = AnimationAdditiveMode::NONE; break;
}
+ xAnimate->setAdditive( nTemp );
+ }
- if( nBits & 2 )
- {
- xAnimate->setAccumulate( nAccumulate == 0 );
- }
+ if( nBits & 2 )
+ {
+ xAnimate->setAccumulate( nAccumulate == 0 );
}
}
#ifdef DBG_ANIM_LOG
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index 130775dfea49..47e2f5d98f1d 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -837,27 +837,24 @@ bool MotionPathTag::getContext( SdrViewContext& rContext )
void MotionPathTag::CheckPossibilities()
{
- if( mpPathObj )
+ if( mpPathObj && isSelected() )
{
- if( isSelected() )
- {
- mrView.SetMoveAllowed( true );
- mrView.SetMoveProtected( false );
- mrView.SetResizeFreeAllowed( true );
- mrView.SetResizePropAllowed( true );
- mrView.SetResizeProtected( false );
+ mrView.SetMoveAllowed( true );
+ mrView.SetMoveProtected( false );
+ mrView.SetResizeFreeAllowed( true );
+ mrView.SetResizePropAllowed( true );
+ mrView.SetResizeProtected( false );
- if( !mrView.IsFrameDragSingles() )
- {
- bool b1stSmooth(true);
- bool b1stSegm(true);
- bool bCurve(false);
- bool bSmoothFuz(false);
- bool bSegmFuz(false);
- basegfx::B2VectorContinuity eSmooth = basegfx::B2VectorContinuity::NONE;
-
- mrView.CheckPolyPossibilitiesHelper( mpMark.get(), b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
- }
+ if( !mrView.IsFrameDragSingles() )
+ {
+ bool b1stSmooth(true);
+ bool b1stSegm(true);
+ bool bCurve(false);
+ bool bSmoothFuz(false);
+ bool bSegmFuz(false);
+ basegfx::B2VectorContinuity eSmooth = basegfx::B2VectorContinuity::NONE;
+
+ mrView.CheckPolyPossibilitiesHelper( mpMark.get(), b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
}
}
}
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 02cc7b941b7f..6ac2999d630e 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -522,9 +522,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
// Point IS marked and NO shift is pressed. Start
// dragging of selected point(s)
pHdl = mpView->PickHandle(aMDPos);
- if(pHdl)
- if ( ! rMEvt.IsRight())
- mpView->BegDragObj(aMDPos, nullptr, pHdl, nDrgLog);
+ if(pHdl && ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, nullptr, pHdl, nDrgLog);
}
}
else
@@ -683,14 +682,11 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
**************************************************************/
SdrPageView* pPV;
SdrObject* pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK);
- if (pObj)
+ if (pObj && pPV->IsObjMarkable(pObj))
{
- if (pPV->IsObjMarkable(pObj))
- {
- mpView->UnmarkAllObj();
- mpView->MarkObj(pObj,pPV);
- return true;
- }
+ mpView->UnmarkAllObj();
+ mpView->MarkObj(pObj,pPV);
+ return true;
}
/**************************************************************
* Toggle between selection and rotation
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 437f0ccee25f..d68d55e09ec4 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -669,14 +669,11 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
**************************************************************/
SdrPageView* pPV;
SdrObject* pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK);
- if (pObj)
+ if (pObj && pPV->IsObjMarkable(pObj))
{
- if (pPV->IsObjMarkable(pObj))
- {
- mpView->UnmarkAllObj();
- mpView->MarkObj(pObj,pPV);
- return bReturn;
- }
+ mpView->UnmarkAllObj();
+ mpView->MarkObj(pObj,pPV);
+ return bReturn;
}
}
}
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
index 5534a57164ed..4a1dafead1dd 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -191,11 +191,8 @@ void InsertAnimator::Implementation::SetInsertPosition (
// When the new insert position is in a different run then move the page
// objects in the old run to their default positions.
- if (pOldRun != pCurrentRun)
- {
- if (pOldRun)
- pOldRun->ResetOffsets(eMode);
- }
+ if (pOldRun != pCurrentRun && pOldRun)
+ pOldRun->ResetOffsets(eMode);
if (pCurrentRun)
{
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 7760e132519b..b301c8bf1775 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -3041,11 +3041,8 @@ void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape )
if( pShape )
{
SdrObject* pObj = pShape->GetSdrObject();
- if( pObj )
- {
- if( GetPage()->IsPresObj( pObj ) )
- GetPage()->RemovePresObj(pObj);
- }
+ if( pObj && GetPage()->IsPresObj( pObj ) )
+ GetPage()->RemovePresObj(pObj);
}
SdGenericDrawPage::remove( xShape );
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 80d25dc1f3de..09a227c0a854 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1196,11 +1196,8 @@ public:
}
}
- if (bIsValueChanged)
- {
- if ( ! mpOptions )
- mpOptions.reset(new PrintOptions(*this, maSlidesPerPage));
- }
+ if (bIsValueChanged && ! mpOptions )
+ mpOptions.reset(new PrintOptions(*this, maSlidesPerPage));
if( bIsValueChanged || bIsPaperChanged )
PreparePages();
}
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 37690eac773f..a4863b8aca00 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -842,19 +842,18 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
const SfxItemSet *pArgs = rReq.GetArgs ();
- if (pArgs)
- if (pArgs->Count () == 3)
- {
- const SfxUInt32Item* pWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEWIDTH);
- const SfxUInt32Item* pHeight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEHEIGHT);
- const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
+ if (pArgs && pArgs->Count () == 3)
+ {
+ const SfxUInt32Item* pWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEWIDTH);
+ const SfxUInt32Item* pHeight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEHEIGHT);
+ const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
- Size aSize (pWidth->GetValue (), pHeight->GetValue ());
+ Size aSize (pWidth->GetValue (), pHeight->GetValue ());
- SetupPage (aSize, 0, 0, 0, 0, true, false, pScaleAll->GetValue ());
- rReq.Ignore ();
- break;
- }
+ SetupPage (aSize, 0, 0, 0, 0, true, false, pScaleAll->GetValue ());
+ rReq.Ignore ();
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
@@ -866,23 +865,22 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
const SfxItemSet *pArgs = rReq.GetArgs ();
- if (pArgs)
- if (pArgs->Count () == 5)
- {
- const SfxUInt32Item* pLeft = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGELEFT);
- const SfxUInt32Item* pRight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGERIGHT);
- const SfxUInt32Item* pUpper = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGETOP);
- const SfxUInt32Item* pLower = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEBOTTOM);
- const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
+ if (pArgs && pArgs->Count () == 5)
+ {
+ const SfxUInt32Item* pLeft = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGELEFT);
+ const SfxUInt32Item* pRight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGERIGHT);
+ const SfxUInt32Item* pUpper = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGETOP);
+ const SfxUInt32Item* pLower = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEBOTTOM);
+ const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
- Size aEmptySize (0, 0);
+ Size aEmptySize (0, 0);
- SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
- pUpper->GetValue (), pLower->GetValue (),
- false, true, pScaleAll->GetValue ());
- rReq.Ignore ();
- break;
- }
+ SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
+ pUpper->GetValue (), pLower->GetValue (),
+ false, true, pScaleAll->GetValue ());
+ rReq.Ignore ();
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index c6db972461c7..809bfdebc041 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -217,24 +217,23 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
{
// set new fill-style
case SID_SETFILLSTYLE :
- if (pArgs)
- if (pArgs->Count () == 1)
+ if (pArgs && pArgs->Count () == 1)
+ {
+ const SfxUInt32Item* pFillStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
+ if (CHECK_RANGE (drawing::FillStyle_NONE, static_cast<drawing::FillStyle>(pFillStyle->GetValue ()), drawing::FillStyle_BITMAP))
{
- const SfxUInt32Item* pFillStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
- if (CHECK_RANGE (drawing::FillStyle_NONE, static_cast<drawing::FillStyle>(pFillStyle->GetValue ()), drawing::FillStyle_BITMAP))
- {
- pAttr->ClearItem (XATTR_FILLSTYLE);
- XFillStyleItem aStyleItem(static_cast<drawing::FillStyle>(pFillStyle->GetValue ()));
- aStyleItem.SetWhich(XATTR_FILLSTYLE);
- pAttr->Put (aStyleItem);
- rBindings.Invalidate (SID_ATTR_FILL_STYLE);
- rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
- }
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+ XFillStyleItem aStyleItem(static_cast<drawing::FillStyle>(pFillStyle->GetValue ()));
+ aStyleItem.SetWhich(XATTR_FILLSTYLE);
+ pAttr->Put (aStyleItem);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
+ }
#if HAVE_FEATURE_SCRIPTING
- else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
+ else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
#endif
- break;
- }
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
@@ -242,23 +241,22 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
// determine new line style
case SID_SETLINESTYLE :
- if (pArgs)
- if (pArgs->Count () == 1)
+ if (pArgs && pArgs->Count () == 1)
+ {
+ const SfxUInt32Item* pLineStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
+ if (CHECK_RANGE (sal_Int32(drawing::LineStyle_NONE), static_cast<sal_Int32>(pLineStyle->GetValue()), sal_Int32(drawing::LineStyle_DASH)))
{
- const SfxUInt32Item* pLineStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
- if (CHECK_RANGE (sal_Int32(drawing::LineStyle_NONE), static_cast<sal_Int32>(pLineStyle->GetValue()), sal_Int32(drawing::LineStyle_DASH)))
- {
- pAttr->ClearItem (XATTR_LINESTYLE);
- XLineStyleItem aStyleItem(static_cast<drawing::LineStyle>(pLineStyle->GetValue()));
- aStyleItem.SetWhich(XATTR_LINESTYLE);
- pAttr->Put(aStyleItem);
- rBindings.Invalidate (SID_ATTR_LINE_STYLE);
- }
+ pAttr->ClearItem (XATTR_LINESTYLE);
+ XLineStyleItem aStyleItem(static_cast<drawing::LineStyle>(pLineStyle->GetValue()));
+ aStyleItem.SetWhich(XATTR_LINESTYLE);
+ pAttr->Put(aStyleItem);
+ rBindings.Invalidate (SID_ATTR_LINE_STYLE);
+ }
#if HAVE_FEATURE_SCRIPTING
- else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
+ else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
#endif
- break;
- }
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
@@ -266,91 +264,283 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
// set line width
case SID_SETLINEWIDTH :
- if (pArgs)
- if (pArgs->Count () == 1)
- {
- const SfxUInt32Item* pLineWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_WIDTH);
- pAttr->ClearItem (XATTR_LINEWIDTH);
- XLineWidthItem aWidthItem(pLineWidth->GetValue());
- aWidthItem.SetWhich(XATTR_LINEWIDTH);
- pAttr->Put(aWidthItem);
- rBindings.Invalidate (SID_ATTR_LINE_WIDTH);
- break;
- }
+ if (pArgs && pArgs->Count () == 1)
+ {
+ const SfxUInt32Item* pLineWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_WIDTH);
+ pAttr->ClearItem (XATTR_LINEWIDTH);
+ XLineWidthItem aWidthItem(pLineWidth->GetValue());
+ aWidthItem.SetWhich(XATTR_LINEWIDTH);
+ pAttr->Put(aWidthItem);
+ rBindings.Invalidate (SID_ATTR_LINE_WIDTH);
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
break;
case SID_SETFILLCOLOR :
- if (pArgs)
- if (pArgs->Count () == 3)
+ if (pArgs && pArgs->Count () == 3)
+ {
+ const SfxUInt32Item* pRed = rReq.GetArg<SfxUInt32Item>(ID_VAL_RED);
+ const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
+ const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
+
+ pAttr->ClearItem (XATTR_FILLCOLOR);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+ XFillColorItem aColorItem(-1, Color (static_cast<sal_uInt8>(pRed->GetValue ()),
+ static_cast<sal_uInt8>(pGreen->GetValue ()),
+ static_cast<sal_uInt8>(pBlue->GetValue ())));
+ aColorItem.SetWhich(XATTR_FILLCOLOR);
+ pAttr->Put(aColorItem);
+ rBindings.Invalidate (SID_ATTR_FILL_COLOR);
+ rBindings.Invalidate (SID_ATTR_PAGE_COLOR);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
+ break;
+ }
+#if HAVE_FEATURE_SCRIPTING
+ StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
+#endif
+ break;
+
+ case SID_SETLINECOLOR :
+ if (pArgs && pArgs->Count () == 3)
+ {
+ const SfxUInt32Item* pRed = rReq.GetArg<SfxUInt32Item>(ID_VAL_RED);
+ const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
+ const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
+
+ pAttr->ClearItem (XATTR_LINECOLOR);
+ XLineColorItem aColorItem(-1, Color(static_cast<sal_uInt8>(pRed->GetValue()),
+ static_cast<sal_uInt8>(pGreen->GetValue()),
+ static_cast<sal_uInt8>(pBlue->GetValue())));
+ aColorItem.SetWhich(XATTR_LINECOLOR);
+ pAttr->Put(aColorItem);
+ rBindings.Invalidate (SID_ATTR_LINE_COLOR);
+ break;
+ }
+#if HAVE_FEATURE_SCRIPTING
+ StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
+#endif
+ break;
+
+ case SID_SETGRADSTARTCOLOR :
+ case SID_SETGRADENDCOLOR :
+ if (pArgs && pArgs->Count () == 4)
+ {
+ const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
+ const SfxUInt32Item* pRed = rReq.GetArg<SfxUInt32Item>(ID_VAL_RED);
+ const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
+ const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
+
+ XGradientListRef pGradientList = GetDoc()->GetGradientList ();
+ long nCounts = pGradientList->Count ();
+ Color aColor (static_cast<sal_uInt8>(pRed->GetValue ()),
+ static_cast<sal_uInt8>(pGreen->GetValue ()),
+ static_cast<sal_uInt8>(pBlue->GetValue ()));
+ long i;
+
+ pAttr->ClearItem (XATTR_FILLGRADIENT);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+
+ for ( i = 0; i < nCounts; i ++)
{
- const SfxUInt32Item* pRed = rReq.GetArg<SfxUInt32Item>(ID_VAL_RED);
- const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
- const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
+ const XGradientEntry* pEntry = pGradientList->GetGradient(i);
- pAttr->ClearItem (XATTR_FILLCOLOR);
- pAttr->ClearItem (XATTR_FILLSTYLE);
- XFillColorItem aColorItem(-1, Color (static_cast<sal_uInt8>(pRed->GetValue ()),
- static_cast<sal_uInt8>(pGreen->GetValue ()),
- static_cast<sal_uInt8>(pBlue->GetValue ())));
- aColorItem.SetWhich(XATTR_FILLCOLOR);
- pAttr->Put(aColorItem);
- rBindings.Invalidate (SID_ATTR_FILL_COLOR);
- rBindings.Invalidate (SID_ATTR_PAGE_COLOR);
- rBindings.Invalidate (SID_ATTR_FILL_STYLE);
- rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
- break;
+ if (pEntry->GetName () == pName->GetValue ())
+ {
+ XGradient aGradient(pEntry->GetGradient());
+
+ if (rReq.GetSlot () == SID_SETGRADSTARTCOLOR) aGradient.SetStartColor (aColor);
+ else aGradient.SetEndColor (aColor);
+
+ XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
+ aStyleItem.SetWhich(XATTR_FILLSTYLE);
+ pAttr->Put(aStyleItem);
+ XFillGradientItem aGradientItem(pName->GetValue (), aGradient);
+ aGradientItem.SetWhich(XATTR_FILLGRADIENT);
+ pAttr->Put(aGradientItem);
+ break;
+ }
}
+
+ if (i >= nCounts)
+ {
+ Color aBlack (0, 0, 0);
+ XGradient aGradient ((rReq.GetSlot () == SID_SETGRADSTARTCOLOR)
+ ? aColor
+ : aBlack,
+ (rReq.GetSlot () == SID_SETGRADENDCOLOR)
+ ? aColor
+ : aBlack);
+
+ GetDoc()->GetGradientList()->Insert(o3tl::make_unique<XGradientEntry>(aGradient, pName->GetValue()));
+
+ XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
+ aStyleItem.SetWhich(XATTR_FILLSTYLE);
+ pAttr->Put(aStyleItem);
+ XFillGradientItem aGradientItem(pName->GetValue(), aGradient);
+ aGradientItem.SetWhich(XATTR_FILLGRADIENT);
+ pAttr->Put(aGradientItem);
+ }
+
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
+ rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
+ rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT);
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
break;
- case SID_SETLINECOLOR :
- if (pArgs)
- if (pArgs->Count () == 3)
+ case SID_SETHATCHCOLOR :
+ if (pArgs && pArgs->Count () == 4)
+ {
+ const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
+ const SfxUInt32Item* pRed = rReq.GetArg<SfxUInt32Item>(ID_VAL_RED);
+ const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
+ const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
+
+ XHatchListRef pHatchList = GetDoc()->GetHatchList ();
+ long nCounts = pHatchList->Count ();
+ Color aColor (static_cast<sal_uInt8>(pRed->GetValue ()),
+ static_cast<sal_uInt8>(pGreen->GetValue ()),
+ static_cast<sal_uInt8>(pBlue->GetValue ()));
+ long i;
+
+ pAttr->ClearItem (XATTR_FILLHATCH);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
+
+ for ( i = 0; i < nCounts; i ++)
{
- const SfxUInt32Item* pRed = rReq.GetArg<SfxUInt32Item>(ID_VAL_RED);
- const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
- const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
-
- pAttr->ClearItem (XATTR_LINECOLOR);
- XLineColorItem aColorItem(-1, Color(static_cast<sal_uInt8>(pRed->GetValue()),
- static_cast<sal_uInt8>(pGreen->GetValue()),
- static_cast<sal_uInt8>(pBlue->GetValue())));
- aColorItem.SetWhich(XATTR_LINECOLOR);
- pAttr->Put(aColorItem);
- rBindings.Invalidate (SID_ATTR_LINE_COLOR);
- break;
+ const XHatchEntry* pEntry = pHatchList->GetHatch(i);
+
+ if (pEntry->GetName () == pName->GetValue ())
+ {
+ XHatch aHatch(pEntry->GetHatch());
+
+ aHatch.SetColor (aColor);
+
+ XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
+ aStyleItem.SetWhich(XATTR_FILLSTYLE);
+ pAttr->Put(aStyleItem);
+ XFillHatchItem aHatchItem(pName->GetValue(), aHatch);
+ aHatchItem.SetWhich(XATTR_FILLHATCH);
+ pAttr->Put(aHatchItem);
+ break;
+ }
+ }
+
+ if (i >= nCounts)
+ {
+ XHatch aHatch (aColor);
+
+ GetDoc()->GetHatchList()->Insert(o3tl::make_unique<XHatchEntry>(aHatch, pName->GetValue()));
+
+ XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
+ aStyleItem.SetWhich(XATTR_FILLSTYLE);
+ pAttr->Put(aStyleItem);
+ XFillHatchItem aHatchItem(pName->GetValue (), aHatch);
+ aHatchItem.SetWhich(XATTR_FILLHATCH);
+ pAttr->Put(aHatchItem);
}
+
+ rBindings.Invalidate (SID_ATTR_FILL_HATCH);
+ rBindings.Invalidate (SID_ATTR_PAGE_HATCH);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
break;
- case SID_SETGRADSTARTCOLOR :
- case SID_SETGRADENDCOLOR :
- if (pArgs)
- if (pArgs->Count () == 4)
+ // configuration for line-dash
+ case SID_DASH :
+ if (pArgs && pArgs->Count () == 7)
+ {
+ const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
+ const SfxUInt32Item* pStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
+ const SfxUInt32Item* pDots = rReq.GetArg<SfxUInt32Item>(ID_VAL_DOTS);
+ const SfxUInt32Item* pDotLen = rReq.GetArg<SfxUInt32Item>(ID_VAL_DOTLEN);
+ const SfxUInt32Item* pDashes = rReq.GetArg<SfxUInt32Item>(ID_VAL_DASHES);
+ const SfxUInt32Item* pDashLen = rReq.GetArg<SfxUInt32Item>(ID_VAL_DASHLEN);
+ const SfxUInt32Item* pDistance = rReq.GetArg<SfxUInt32Item>(ID_VAL_DISTANCE);
+
+ if (CHECK_RANGE (sal_Int32(css::drawing::DashStyle_RECT), static_cast<sal_Int32>(pStyle->GetValue()), sal_Int32(css::drawing::DashStyle_ROUNDRELATIVE)))
{
- const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
- const SfxUInt32Item* pRed = rReq.GetArg<SfxUInt32Item>(ID_VAL_RED);
- const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
- const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
+ XDash aNewDash (static_cast<css::drawing::DashStyle>(pStyle->GetValue ()), static_cast<short>(pDots->GetValue ()), pDotLen->GetValue (),
+ static_cast<short>(pDashes->GetValue ()), pDashLen->GetValue (), pDistance->GetValue ());
- XGradientListRef pGradientList = GetDoc()->GetGradientList ();
- long nCounts = pGradientList->Count ();
- Color aColor (static_cast<sal_uInt8>(pRed->GetValue ()),
- static_cast<sal_uInt8>(pGreen->GetValue ()),
- static_cast<sal_uInt8>(pBlue->GetValue ()));
+ pAttr->ClearItem (XATTR_LINEDASH);
+ pAttr->ClearItem (XATTR_LINESTYLE);
+
+ XDashListRef pDashList = GetDoc()->GetDashList();
+ long nCounts = pDashList->Count ();
+ std::unique_ptr<XDashEntry> pEntry = o3tl::make_unique<XDashEntry>(aNewDash, pName->GetValue());
long i;
+ for ( i = 0; i < nCounts; i++ )
+ if (pDashList->GetDash (i)->GetName () == pName->GetValue ())
+ break;
+
+ if (i < nCounts)
+ pDashList->Replace(std::move(pEntry), i);
+ else
+ pDashList->Insert(std::move(pEntry));
+
+ XLineDashItem aDashItem(pName->GetValue(), aNewDash);
+ aDashItem.SetWhich(XATTR_LINEDASH);
+ pAttr->Put(aDashItem);
+ XLineStyleItem aStyleItem(drawing::LineStyle_DASH);
+ aStyleItem.SetWhich(XATTR_LINESTYLE);
+ pAttr->Put(aStyleItem);
+ rBindings.Invalidate (SID_ATTR_LINE_DASH);
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ }
+#if HAVE_FEATURE_SCRIPTING
+ else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
+#endif
+ break;
+ }
+#if HAVE_FEATURE_SCRIPTING
+ StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
+#endif
+ break;
+
+ // configuration for gradients
+ case SID_GRADIENT :
+ if (pArgs && pArgs->Count () == 8)
+ {
+ const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
+ const SfxUInt32Item* pStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
+ const SfxUInt32Item* pAngle = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLE);
+ const SfxUInt32Item* pBorder = rReq.GetArg<SfxUInt32Item>(ID_VAL_BORDER);
+ const SfxUInt32Item* pCenterX = rReq.GetArg<SfxUInt32Item>(ID_VAL_CENTER_X);
+ const SfxUInt32Item* pCenterY = rReq.GetArg<SfxUInt32Item>(ID_VAL_CENTER_Y);
+ const SfxUInt32Item* pStart = rReq.GetArg<SfxUInt32Item>(ID_VAL_STARTINTENS);
+ const SfxUInt32Item* pEnd = rReq.GetArg<SfxUInt32Item>(ID_VAL_ENDINTENS);
+
+ if (CHECK_RANGE (sal_Int32(css::awt::GradientStyle_LINEAR), static_cast<sal_Int32>(pStyle->GetValue()), sal_Int32(css::awt::GradientStyle_RECT)) &&
+ CHECK_RANGE (0, static_cast<sal_Int32>(pAngle->GetValue ()), 360) &&
+ CHECK_RANGE (0, static_cast<sal_Int32>(pBorder->GetValue ()), 100) &&
+ CHECK_RANGE (0, static_cast<sal_Int32>(pCenterX->GetValue ()), 100) &&
+ CHECK_RANGE (0, static_cast<sal_Int32>(pCenterY->GetValue ()), 100) &&
+ CHECK_RANGE (0, static_cast<sal_Int32>(pStart->GetValue ()), 100) &&
+ CHECK_RANGE (0, static_cast<sal_Int32>(pEnd->GetValue ()), 100))
+ {
pAttr->ClearItem (XATTR_FILLGRADIENT);
pAttr->ClearItem (XATTR_FILLSTYLE);
- for ( i = 0; i < nCounts; i ++)
+ XGradientListRef pGradientList = GetDoc()->GetGradientList ();
+ long nCounts = pGradientList->Count ();
+ long i;
+
+ for ( i = 0; i < nCounts; i++ )
{
const XGradientEntry* pEntry = pGradientList->GetGradient(i);
@@ -358,8 +548,13 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
{
XGradient aGradient(pEntry->GetGradient());
- if (rReq.GetSlot () == SID_SETGRADSTARTCOLOR) aGradient.SetStartColor (aColor);
- else aGradient.SetEndColor (aColor);
+ aGradient.SetGradientStyle (static_cast<css::awt::GradientStyle>(pStyle->GetValue ()));
+ aGradient.SetAngle (pAngle->GetValue () * 10);
+ aGradient.SetBorder (static_cast<short>(pBorder->GetValue ()));
+ aGradient.SetXOffset (static_cast<short>(pCenterX->GetValue ()));
+ aGradient.SetYOffset (static_cast<short>(pCenterY->GetValue ()));
+ aGradient.SetStartIntens (static_cast<short>(pStart->GetValue ()));
+ aGradient.SetEndIntens (static_cast<short>(pEnd->GetValue ()));
XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
aStyleItem.SetWhich(XATTR_FILLSTYLE);
@@ -374,54 +569,55 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
if (i >= nCounts)
{
Color aBlack (0, 0, 0);
- XGradient aGradient ((rReq.GetSlot () == SID_SETGRADSTARTCOLOR)
- ? aColor
- : aBlack,
- (rReq.GetSlot () == SID_SETGRADENDCOLOR)
- ? aColor
- : aBlack);
-
- GetDoc()->GetGradientList()->Insert(o3tl::make_unique<XGradientEntry>(aGradient, pName->GetValue()));
+ XGradient aGradient (aBlack, aBlack, static_cast<css::awt::GradientStyle>(pStyle->GetValue ()),
+ pAngle->GetValue () * 10, static_cast<short>(pCenterX->GetValue ()),
+ static_cast<short>(pCenterY->GetValue ()), static_cast<short>(pBorder->GetValue ()),
+ static_cast<short>(pStart->GetValue ()), static_cast<short>(pEnd->GetValue ()));
+ pGradientList->Insert(o3tl::make_unique<XGradientEntry>(aGradient, pName->GetValue()));
XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
aStyleItem.SetWhich(XATTR_FILLSTYLE);
pAttr->Put(aStyleItem);
- XFillGradientItem aGradientItem(pName->GetValue(), aGradient);
+ XFillGradientItem aGradientItem(pName->GetValue (), aGradient);
aGradientItem.SetWhich(XATTR_FILLGRADIENT);
pAttr->Put(aGradientItem);
}
- rBindings.Invalidate (SID_ATTR_FILL_STYLE);
- rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT);
- break;
+ rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
}
#if HAVE_FEATURE_SCRIPTING
+ else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
+#endif
+ break;
+ }
+#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
break;
- case SID_SETHATCHCOLOR :
- if (pArgs)
- if (pArgs->Count () == 4)
+ // configuration for hatch
+ case SID_HATCH :
+ if (pArgs && pArgs->Count () == 4)
+ {
+ const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
+ const SfxUInt32Item* pStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
+ const SfxUInt32Item* pDistance = rReq.GetArg<SfxUInt32Item>(ID_VAL_DISTANCE);
+ const SfxUInt32Item* pAngle = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLE);
+
+ if (CHECK_RANGE (sal_Int32(css::drawing::HatchStyle_SINGLE), static_cast<sal_Int32>(pStyle->GetValue()), sal_Int32(css::drawing::HatchStyle_TRIPLE)) &&
+ CHECK_RANGE (0, static_cast<sal_Int32>(pAngle->GetValue ()), 360))
{
- const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
- const SfxUInt32Item* pRed = rReq.GetArg<SfxUInt32Item>(ID_VAL_RED);
- const SfxUInt32Item* pGreen = rReq.GetArg<SfxUInt32Item>(ID_VAL_GREEN);
- const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE);
+ pAttr->ClearItem (XATTR_FILLHATCH);
+ pAttr->ClearItem (XATTR_FILLSTYLE);
XHatchListRef pHatchList = GetDoc()->GetHatchList ();
long nCounts = pHatchList->Count ();
- Color aColor (static_cast<sal_uInt8>(pRed->GetValue ()),
- static_cast<sal_uInt8>(pGreen->GetValue ()),
- static_cast<sal_uInt8>(pBlue->GetValue ()));
long i;
- pAttr->ClearItem (XATTR_FILLHATCH);
- pAttr->ClearItem (XATTR_FILLSTYLE);
-
- for ( i = 0; i < nCounts; i ++)
+ for ( i = 0; i < nCounts; i++ )
{
const XHatchEntry* pEntry = pHatchList->GetHatch(i);
@@ -429,12 +625,14 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
{
XHatch aHatch(pEntry->GetHatch());
- aHatch.SetColor (aColor);
+ aHatch.SetHatchStyle (static_cast<css::drawing::HatchStyle>(pStyle->GetValue ()));
+ aHatch.SetDistance (pDistance->GetValue ());
+ aHatch.SetAngle (pAngle->GetValue () * 10);
XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
aStyleItem.SetWhich(XATTR_FILLSTYLE);
pAttr->Put(aStyleItem);
- XFillHatchItem aHatchItem(pName->GetValue(), aHatch);
+ XFillHatchItem aHatchItem(pName->GetValue (), aHatch);
aHatchItem.SetWhich(XATTR_FILLHATCH);
pAttr->Put(aHatchItem);
break;
@@ -443,10 +641,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
if (i >= nCounts)
{
- XHatch aHatch (aColor);
-
- GetDoc()->GetHatchList()->Insert(o3tl::make_unique<XHatchEntry>(aHatch, pName->GetValue()));
+ XHatch aHatch (Color(0), static_cast<css::drawing::HatchStyle>(pStyle->GetValue ()), pDistance->GetValue (),
+ pAngle->GetValue () * 10);
+ pHatchList->Insert(o3tl::make_unique<XHatchEntry>(aHatch, pName->GetValue()));
XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
aStyleItem.SetWhich(XATTR_FILLSTYLE);
pAttr->Put(aStyleItem);
@@ -456,302 +654,88 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
}
rBindings.Invalidate (SID_ATTR_FILL_HATCH);
- rBindings.Invalidate (SID_ATTR_PAGE_HATCH);
rBindings.Invalidate (SID_ATTR_FILL_STYLE);
- rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
- break;
}
#if HAVE_FEATURE_SCRIPTING
- StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
-#endif
- break;
-
- // configuration for line-dash
- case SID_DASH :
- if (pArgs)
- if (pArgs->Count () == 7)
- {
- const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
- const SfxUInt32Item* pStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
- const SfxUInt32Item* pDots = rReq.GetArg<SfxUInt32Item>(ID_VAL_DOTS);
- const SfxUInt32Item* pDotLen = rReq.GetArg<SfxUInt32Item>(ID_VAL_DOTLEN);
- const SfxUInt32Item* pDashes = rReq.GetArg<SfxUInt32Item>(ID_VAL_DASHES);
- const SfxUInt32Item* pDashLen = rReq.GetArg<SfxUInt32Item>(ID_VAL_DASHLEN);
- const SfxUInt32Item* pDistance = rReq.GetArg<SfxUInt32Item>(ID_VAL_DISTANCE);
-
- if (CHECK_RANGE (sal_Int32(css::drawing::DashStyle_RECT), static_cast<sal_Int32>(pStyle->GetValue()), sal_Int32(css::drawing::DashStyle_ROUNDRELATIVE)))
- {
- XDash aNewDash (static_cast<css::drawing::DashStyle>(pStyle->GetValue ()), static_cast<short>(pDots->GetValue ()), pDotLen->GetValue (),
- static_cast<short>(pDashes->GetValue ()), pDashLen->GetValue (), pDistance->GetValue ());
-
- pAttr->ClearItem (XATTR_LINEDASH);
- pAttr->ClearItem (XATTR_LINESTYLE);
-
- XDashListRef pDashList = GetDoc()->GetDashList();
- long nCounts = pDashList->Count ();
- std::unique_ptr<XDashEntry> pEntry = o3tl::make_unique<XDashEntry>(aNewDash, pName->GetValue());
- long i;
-
- for ( i = 0; i < nCounts; i++ )
- if (pDashList->GetDash (i)->GetName () == pName->GetValue ())
- break;
-
- if (i < nCounts)
- pDashList->Replace(std::move(pEntry), i);
- else
- pDashList->Insert(std::move(pEntry));
-
- XLineDashItem aDashItem(pName->GetValue(), aNewDash);
- aDashItem.SetWhich(XATTR_LINEDASH);
- pAttr->Put(aDashItem);
- XLineStyleItem aStyleItem(drawing::LineStyle_DASH);
- aStyleItem.SetWhich(XATTR_LINESTYLE);
- pAttr->Put(aStyleItem);
- rBindings.Invalidate (SID_ATTR_LINE_DASH);
- rBindings.Invalidate (SID_ATTR_FILL_STYLE);
- }
-#if HAVE_FEATURE_SCRIPTING
- else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
+ else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
#endif
- break;
- }
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
break;
- // configuration for gradients
- case SID_GRADIENT :
- if (pArgs)
- if (pArgs->Count () == 8)
+ case SID_SELECTGRADIENT :
+ if (pArgs && (pArgs->Count () == 1))
+ {
+ const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
+
+ XGradientListRef pGradientList = GetDoc()->GetGradientList ();
+ long nCounts = pGradientList->Count ();
+
+ for (long i = 0; i < nCounts; i ++)
{
- const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
- const SfxUInt32Item* pStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
- const SfxUInt32Item* pAngle = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLE);
- const SfxUInt32Item* pBorder = rReq.GetArg<SfxUInt32Item>(ID_VAL_BORDER);
- const SfxUInt32Item* pCenterX = rReq.GetArg<SfxUInt32Item>(ID_VAL_CENTER_X);
- const SfxUInt32Item* pCenterY = rReq.GetArg<SfxUInt32Item>(ID_VAL_CENTER_Y);
- const SfxUInt32Item* pStart = rReq.GetArg<SfxUInt32Item>(ID_VAL_STARTINTENS);
- const SfxUInt32Item* pEnd = rReq.GetArg<SfxUInt32Item>(ID_VAL_ENDINTENS);
-
- if (CHECK_RANGE (sal_Int32(css::awt::GradientStyle_LINEAR), static_cast<sal_Int32>(pStyle->GetValue()), sal_Int32(css::awt::GradientStyle_RECT)) &&
- CHECK_RANGE (0, static_cast<sal_Int32>(pAngle->GetValue ()), 360) &&
- CHECK_RANGE (0, static_cast<sal_Int32>(pBorder->GetValue ()), 100) &&
- CHECK_RANGE (0, static_cast<sal_Int32>(pCenterX->GetValue ()), 100) &&
- CHECK_RANGE (0, static_cast<sal_Int32>(pCenterY->GetValue ()), 100) &&
- CHECK_RANGE (0, static_cast<sal_Int32>(pStart->GetValue ()), 100) &&
- CHECK_RANGE (0, static_cast<sal_Int32>(pEnd->GetValue ()), 100))
+ const XGradientEntry* pEntry = pGradientList->GetGradient(i);
+
+ if (pEntry->GetName () == pName->GetValue ())
{
pAttr->ClearItem (XATTR_FILLGRADIENT);
pAttr->ClearItem (XATTR_FILLSTYLE);
-
- XGradientListRef pGradientList = GetDoc()->GetGradientList ();
- long nCounts = pGradientList->Count ();
- long i;
-
- for ( i = 0; i < nCounts; i++ )
- {
- const XGradientEntry* pEntry = pGradientList->GetGradient(i);
-
- if (pEntry->GetName () == pName->GetValue ())
- {
- XGradient aGradient(pEntry->GetGradient());
-
- aGradient.SetGradientStyle (static_cast<css::awt::GradientStyle>(pStyle->GetValue ()));
- aGradient.SetAngle (pAngle->GetValue () * 10);
- aGradient.SetBorder (static_cast<short>(pBorder->GetValue ()));
- aGradient.SetXOffset (static_cast<short>(pCenterX->GetValue ()));
- aGradient.SetYOffset (static_cast<short>(pCenterY->GetValue ()));
- aGradient.SetStartIntens (static_cast<short>(pStart->GetValue ()));
- aGradient.SetEndIntens (static_cast<short>(pEnd->GetValue ()));
-
- XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
- aStyleItem.SetWhich(XATTR_FILLSTYLE);
- pAttr->Put(aStyleItem);
- XFillGradientItem aGradientItem(pName->GetValue (), aGradient);
- aGradientItem.SetWhich(XATTR_FILLGRADIENT);
- pAttr->Put(aGradientItem);
- break;
- }
- }
-
- if (i >= nCounts)
- {
- Color aBlack (0, 0, 0);
- XGradient aGradient (aBlack, aBlack, static_cast<css::awt::GradientStyle>(pStyle->GetValue ()),
- pAngle->GetValue () * 10, static_cast<short>(pCenterX->GetValue ()),
- static_cast<short>(pCenterY->GetValue ()), static_cast<short>(pBorder->GetValue ()),
- static_cast<short>(pStart->GetValue ()), static_cast<short>(pEnd->GetValue ()));
-
- pGradientList->Insert(o3tl::make_unique<XGradientEntry>(aGradient, pName->GetValue()));
- XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
- aStyleItem.SetWhich(XATTR_FILLSTYLE);
- pAttr->Put(aStyleItem);
- XFillGradientItem aGradientItem(pName->GetValue (), aGradient);
- aGradientItem.SetWhich(XATTR_FILLGRADIENT);
- pAttr->Put(aGradientItem);
- }
-
+ XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
+ aStyleItem.SetWhich(XATTR_FILLSTYLE);
+ pAttr->Put(aStyleItem);
+ XFillGradientItem aGradientItem(pName->GetValue (), pEntry->GetGradient ());
+ aGradientItem.SetWhich(XATTR_FILLGRADIENT);
+ pAttr->Put(aGradientItem);
rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT);
rBindings.Invalidate (SID_ATTR_FILL_STYLE);
rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
+ break;
}
-#if HAVE_FEATURE_SCRIPTING
- else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
-#endif
- break;
}
+
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
break;
- // configuration for hatch
- case SID_HATCH :
- if (pArgs)
- if (pArgs->Count () == 4)
+ case SID_SELECTHATCH :
+ if (pArgs && pArgs->Count () == 1)
+ {
+ const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
+
+ XHatchListRef pHatchList = GetDoc()->GetHatchList ();
+ long nCounts = pHatchList->Count ();
+
+ for (long i = 0; i < nCounts; i ++)
{
- const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
- const SfxUInt32Item* pStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE);
- const SfxUInt32Item* pDistance = rReq.GetArg<SfxUInt32Item>(ID_VAL_DISTANCE);
- const SfxUInt32Item* pAngle = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLE);
+ const XHatchEntry* pEntry = pHatchList->GetHatch(i);
- if (CHECK_RANGE (sal_Int32(css::drawing::HatchStyle_SINGLE), static_cast<sal_Int32>(pStyle->GetValue()), sal_Int32(css::drawing::HatchStyle_TRIPLE)) &&
- CHECK_RANGE (0, static_cast<sal_Int32>(pAngle->GetValue ()), 360))
+ if (pEntry->GetName () == pName->GetValue ())
{
pAttr->ClearItem (XATTR_FILLHATCH);
pAttr->ClearItem (XATTR_FILLSTYLE);
-
- XHatchListRef pHatchList = GetDoc()->GetHatchList ();
- long nCounts = pHatchList->Count ();
- long i;
-
- for ( i = 0; i < nCounts; i++ )
- {
- const XHatchEntry* pEntry = pHatchList->GetHatch(i);
-
- if (pEntry->GetName () == pName->GetValue ())
- {
- XHatch aHatch(pEntry->GetHatch());
-
- aHatch.SetHatchStyle (static_cast<css::drawing::HatchStyle>(pStyle->GetValue ()));
- aHatch.SetDistance (pDistance->GetValue ());
- aHatch.SetAngle (pAngle->GetValue () * 10);
-
- XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
- aStyleItem.SetWhich(XATTR_FILLSTYLE);
- pAttr->Put(aStyleItem);
- XFillHatchItem aHatchItem(pName->GetValue (), aHatch);
- aHatchItem.SetWhich(XATTR_FILLHATCH);
- pAttr->Put(aHatchItem);
- break;
- }
- }
-
- if (i >= nCounts)
- {
- XHatch aHatch (Color(0), static_cast<css::drawing::HatchStyle>(pStyle->GetValue ()), pDistance->GetValue (),
- pAngle->GetValue () * 10);
-
- pHatchList->Insert(o3tl::make_unique<XHatchEntry>(aHatch, pName->GetValue()));
- XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
- aStyleItem.SetWhich(XATTR_FILLSTYLE);
- pAttr->Put(aStyleItem);
- XFillHatchItem aHatchItem(pName->GetValue (), aHatch);
- aHatchItem.SetWhich(XATTR_FILLHATCH);
- pAttr->Put(aHatchItem);
- }
+ XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
+ aStyleItem.SetWhich(XATTR_FILLSTYLE);
+ pAttr->Put(aStyleItem);
+ XFillHatchItem aHatchItem(pName->GetValue (), pEntry->GetHatch ());
+ aHatchItem.SetWhich(XATTR_FILLHATCH);
+ pAttr->Put(aHatchItem);
rBindings.Invalidate (SID_ATTR_FILL_HATCH);
+ rBindings.Invalidate (SID_ATTR_PAGE_HATCH);
rBindings.Invalidate (SID_ATTR_FILL_STYLE);
+ rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
+ break;
}
-#if HAVE_FEATURE_SCRIPTING
- else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
-#endif
- break;
- }
-#if HAVE_FEATURE_SCRIPTING
- StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
-#endif
- break;
-
- case SID_SELECTGRADIENT :
- if (pArgs)
- if (pArgs->Count () == 1)
- {
- const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
-
- XGradientListRef pGradientList = GetDoc()->GetGradientList ();
- long nCounts = pGradientList->Count ();
-
- for (long i = 0;
- i < nCounts;
- i ++)
- {
- const XGradientEntry* pEntry = pGradientList->GetGradient(i);
-
- if (pEntry->GetName () == pName->GetValue ())
- {
- pAttr->ClearItem (XATTR_FILLGRADIENT);
- pAttr->ClearItem (XATTR_FILLSTYLE);
- XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
- aStyleItem.SetWhich(XATTR_FILLSTYLE);
- pAttr->Put(aStyleItem);
- XFillGradientItem aGradientItem(pName->GetValue (), pEntry->GetGradient ());
- aGradientItem.SetWhich(XATTR_FILLGRADIENT);
- pAttr->Put(aGradientItem);
- rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
- rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT);
- rBindings.Invalidate (SID_ATTR_FILL_STYLE);
- rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
- break;
- }
- }
-
- break;
}
-#if HAVE_FEATURE_SCRIPTING
- StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
-#endif
- break;
-
- case SID_SELECTHATCH :
- if (pArgs)
- if (pArgs->Count () == 1)
- {
- const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(ID_VAL_INDEX);
-
- XHatchListRef pHatchList = GetDoc()->GetHatchList ();
- long nCounts = pHatchList->Count ();
-
- for (long i = 0;
- i < nCounts;
- i ++)
- {
- const XHatchEntry* pEntry = pHatchList->GetHatch(i);
-
- if (pEntry->GetName () == pName->GetValue ())
- {
- pAttr->ClearItem (XATTR_FILLHATCH);
- pAttr->ClearItem (XATTR_FILLSTYLE);
- XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
- aStyleItem.SetWhich(XATTR_FILLSTYLE);
- pAttr->Put(aStyleItem);
- XFillHatchItem aHatchItem(pName->GetValue (), pEntry->GetHatch ());
- aHatchItem.SetWhich(XATTR_FILLHATCH);
- pAttr->Put(aHatchItem);
-
- rBindings.Invalidate (SID_ATTR_FILL_HATCH);
- rBindings.Invalidate (SID_ATTR_PAGE_HATCH);
- rBindings.Invalidate (SID_ATTR_FILL_STYLE);
- rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE);
- break;
- }
- }
- break;
- }
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
@@ -762,11 +746,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
break;
case SID_GETRED :
- if (pArgs)
- if (pArgs->Count () == 1)
- {
- break;
- }
+ if (pArgs && pArgs->Count () == 1)
+ {
+ break;
+ }
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif