Kaydet (Commit) 2aec78c0 authored tarafından Miklos Vajna's avatar Miklos Vajna

SvxBrushItem: extend this with a vcl Gradient and drawing::FillStyle

So Writer fly frames can have gradient info as well.

Change-Id: If59ae9092fedabbe112f034e13fbe801815ebaaf
üst 8e9675d2
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <vcl/wall.hxx> #include <vcl/wall.hxx>
#include <tools/link.hxx> #include <tools/link.hxx>
#include <editeng/editengdllapi.h> #include <editeng/editengdllapi.h>
#include <com/sun/star/drawing/FillStyle.hpp>
// class SvxBrushItem ---------------------------------------------------- // class SvxBrushItem ----------------------------------------------------
...@@ -33,6 +34,7 @@ namespace rtl ...@@ -33,6 +34,7 @@ namespace rtl
{ {
class OUString; class OUString;
} }
class Gradient;
#define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001) #define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001)
...@@ -111,12 +113,16 @@ public: ...@@ -111,12 +113,16 @@ public:
const GraphicObject* GetGraphicObject() const; const GraphicObject* GetGraphicObject() const;
const String* GetGraphicLink() const { return pStrLink; } const String* GetGraphicLink() const { return pStrLink; }
const String* GetGraphicFilter() const { return pStrFilter; } const String* GetGraphicFilter() const { return pStrFilter; }
com::sun::star::drawing::FillStyle GetFillStyle() const;
const Gradient& GetGradient() const;
void SetGraphicPos( SvxGraphicPosition eNew ); void SetGraphicPos( SvxGraphicPosition eNew );
void SetGraphic( const Graphic& rNew ); void SetGraphic( const Graphic& rNew );
void SetGraphicObject( const GraphicObject& rNewObj ); void SetGraphicObject( const GraphicObject& rNewObj );
void SetGraphicLink( const String& rNew ); void SetGraphicLink( const String& rNew );
void SetGraphicFilter( const String& rNew ); void SetGraphicFilter( const String& rNew );
void SetFillStyle(com::sun::star::drawing::FillStyle eNew);
void SetGradient(Gradient& rNew);
SvxBrushItem& operator=( const SvxBrushItem& rItem); SvxBrushItem& operator=( const SvxBrushItem& rItem);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <com/sun/star/awt/Size.hpp> #include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/frame/status/UpperLowerMarginScale.hpp> #include <com/sun/star/frame/status/UpperLowerMarginScale.hpp>
#include <com/sun/star/awt/Gradient.hpp>
#include <unotools/ucbstreamhelper.hxx> #include <unotools/ucbstreamhelper.hxx>
#include <limits.h> #include <limits.h>
...@@ -55,6 +56,7 @@ ...@@ -55,6 +56,7 @@
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <vcl/graphicfilter.hxx> #include <vcl/graphicfilter.hxx>
#include <vcl/gradient.hxx>
#include <editeng/editids.hrc> #include <editeng/editids.hrc>
#include <editeng/editrids.hrc> #include <editeng/editrids.hrc>
#include <editeng/pbinitem.hxx> #include <editeng/pbinitem.hxx>
...@@ -3325,8 +3327,10 @@ public: ...@@ -3325,8 +3327,10 @@ public:
//copied to the GraphicObject when necessary //copied to the GraphicObject when necessary
Link aDoneLink; Link aDoneLink;
SvStream* pStream; SvStream* pStream;
Gradient aGradient;
drawing::FillStyle eFillStyle;
SvxBrushItem_Impl( GraphicObject* p ) : pGraphicObject( p ), nGraphicTransparency(0), pStream(0) {} SvxBrushItem_Impl( GraphicObject* p ) : pGraphicObject( p ), nGraphicTransparency(0), pStream(0), eFillStyle(drawing::FillStyle_NONE) {}
}; };
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -3639,6 +3643,25 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const ...@@ -3639,6 +3643,25 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
case MID_GRAPHIC_TRANSPARENCY : case MID_GRAPHIC_TRANSPARENCY :
rVal <<= pImpl->nGraphicTransparency; rVal <<= pImpl->nGraphicTransparency;
break; break;
case MID_FILL_STYLE:
rVal <<= pImpl->eFillStyle;
break;
case MID_FILL_GRADIENT:
{
awt::Gradient aGradient;
aGradient.Style = (awt::GradientStyle)pImpl->aGradient.GetStyle();
aGradient.StartColor = pImpl->aGradient.GetStartColor().GetColor();
aGradient.EndColor = pImpl->aGradient.GetEndColor().GetColor();
aGradient.Angle = pImpl->aGradient.GetAngle();
aGradient.Border = pImpl->aGradient.GetBorder();
aGradient.XOffset = pImpl->aGradient.GetOfsX();
aGradient.YOffset = pImpl->aGradient.GetOfsY();
aGradient.StartIntensity = pImpl->aGradient.GetStartIntensity();
aGradient.EndIntensity = pImpl->aGradient.GetEndIntensity();
aGradient.StepCount = pImpl->aGradient.GetSteps();
rVal <<= aGradient;
}
break;
} }
return true; return true;
...@@ -3754,6 +3777,26 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) ...@@ -3754,6 +3777,26 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
} }
} }
break; break;
case MID_FILL_STYLE:
rVal >>= pImpl->eFillStyle;
break;
case MID_FILL_GRADIENT:
{
awt::Gradient aGradient;
if (!(rVal >>= aGradient))
return false;
pImpl->aGradient.SetStyle((GradientStyle)aGradient.Style);
pImpl->aGradient.SetStartColor(aGradient.StartColor);
pImpl->aGradient.SetEndColor(aGradient.EndColor);
pImpl->aGradient.SetAngle(aGradient.Angle);
pImpl->aGradient.SetBorder(aGradient.Border);
pImpl->aGradient.SetOfsX(aGradient.XOffset);
pImpl->aGradient.SetOfsY(aGradient.YOffset);
pImpl->aGradient.SetStartIntensity(aGradient.StartIntensity);
pImpl->aGradient.SetEndIntensity(aGradient.EndIntensity);
pImpl->aGradient.SetSteps(aGradient.StepCount);
}
break;
} }
return true; return true;
...@@ -3824,6 +3867,8 @@ SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem ) ...@@ -3824,6 +3867,8 @@ SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
} }
} }
pImpl->nGraphicTransparency = rItem.pImpl->nGraphicTransparency; pImpl->nGraphicTransparency = rItem.pImpl->nGraphicTransparency;
pImpl->eFillStyle = rItem.pImpl->eFillStyle;
pImpl->aGradient = rItem.pImpl->aGradient;
return *this; return *this;
} }
...@@ -3835,7 +3880,9 @@ int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const ...@@ -3835,7 +3880,9 @@ int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
SvxBrushItem& rCmp = (SvxBrushItem&)rAttr; SvxBrushItem& rCmp = (SvxBrushItem&)rAttr;
sal_Bool bEqual = ( aColor == rCmp.aColor && eGraphicPos == rCmp.eGraphicPos && sal_Bool bEqual = ( aColor == rCmp.aColor && eGraphicPos == rCmp.eGraphicPos &&
pImpl->nGraphicTransparency == rCmp.pImpl->nGraphicTransparency); pImpl->nGraphicTransparency == rCmp.pImpl->nGraphicTransparency &&
pImpl->eFillStyle == rCmp.pImpl->eFillStyle &&
pImpl->aGradient == rCmp.pImpl->aGradient);
if ( bEqual ) if ( bEqual )
{ {
...@@ -4146,6 +4193,27 @@ void SvxBrushItem::ApplyGraphicTransparency_Impl() ...@@ -4146,6 +4193,27 @@ void SvxBrushItem::ApplyGraphicTransparency_Impl()
pImpl->pGraphicObject->SetAttr(aAttr); pImpl->pGraphicObject->SetAttr(aAttr);
} }
} }
drawing::FillStyle SvxBrushItem::GetFillStyle() const
{
return pImpl->eFillStyle;
}
const Gradient& SvxBrushItem::GetGradient() const
{
return pImpl->aGradient;
}
void SvxBrushItem::SetFillStyle(drawing::FillStyle eNew)
{
pImpl->eFillStyle = eNew;
}
void SvxBrushItem::SetGradient(Gradient& rNew)
{
pImpl->aGradient = rNew;
}
// class SvxFrameDirectionItem ---------------------------------------------- // class SvxFrameDirectionItem ----------------------------------------------
SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue , SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue ,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment