summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/basegfx/utils/gradienttools.hxx49
-rw-r--r--include/oox/export/drawingml.hxx27
2 files changed, 70 insertions, 6 deletions
diff --git a/include/basegfx/utils/gradienttools.hxx b/include/basegfx/utils/gradienttools.hxx
index f438fdf3bd4a..4e78ad2ff960 100644
--- a/include/basegfx/utils/gradienttools.hxx
+++ b/include/basegfx/utils/gradienttools.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/awt/ColorStopSequence.hdl>
namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
+namespace com { namespace sun { namespace star { namespace awt { struct Gradient2; } } } }
namespace basegfx { class B2DRange; }
namespace basegfx
@@ -213,6 +214,48 @@ namespace basegfx
namespace utils
{
+ /* Tooling method to extract data from given awt::Gradient2
+ to ColorStops, doing some corrections, partitally based
+ on given SingleColor.
+ This will do quite some preparations for the gradient
+ as follows:
+ - It will check for single color (resetting rSingleColor when
+ this is the case) and return with empty ColorStops
+ - It will blend ColorStops to Intensity if StartIntensity/
+ EndIntensity != 100 is set in awt::Gradient2, so applying
+ that value(s) to the gadient directly
+ - It will adapt to Border if Border != 0 is set at the
+ given awt::Gradient2, so applying that value to the gadient
+ directly
+ */
+ BASEGFX_DLLPUBLIC void prepareColorStops(
+ const com::sun::star::awt::Gradient2& rGradient,
+ ColorStops& rColorStops,
+ BColor& rSingleColor);
+
+ /* Tooling method to synchronize the given ColorStops.
+ The intention is that a color GradientStops and an
+ alpha/transparence GradientStops gets synchronized
+ for export.
+ Fo the corrections the single values for color and
+ alpha may be used, e.g. when ColorStops is given
+ and not empty, but AlphaStops is empty, it will get
+ sycronized so that it will have the same number and
+ offsets in AlphaStops as in ColorStops, but with
+ the given SingleAlpha as value.
+ At return it guarantees that both have the same
+ number of entries with the same StopOffsets, so
+ that synchonized pair of ColorStops can e.g. be used
+ to export a Gradient with defined/adapted alpha
+ being 'coupled' indirectly using the
+ 'FillTransparenceGradient' method (at import time).
+ */
+ BASEGFX_DLLPUBLIC void synchronizeColorStops(
+ ColorStops& rColorStops,
+ ColorStops& rAlphaStops,
+ const BColor& rSingleColor,
+ const BColor& rSingleAlpha);
+
/* Tooling method to linearly blend the Colors contained in
a given ColorStop vector against a given Color using the
given intensity values.
@@ -244,6 +287,12 @@ namespace basegfx
/* Tooling method to convert UNO API data to ColorStops.
This will try to extract ColorStop data from the given
+ awt::Gradient2.
+ */
+ BASEGFX_DLLPUBLIC void fillColorStopsFromGradient2(ColorStops& rColorStops, const com::sun::star::awt::Gradient2& rGradient);
+
+ /* Tooling method to convert UNO API data to ColorStops.
+ This will try to extract ColorStop data from the given
Any, so if it's of type awt::Gradient2 that data will be
extracted, converted and copied into the given ColorStops.
*/
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 9179625bd6b7..bfab16f12aff 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -58,7 +58,7 @@ enum class SvxTimeFormat;
namespace com::sun::star {
namespace awt {
struct FontDescriptor;
- struct Gradient;
+ struct Gradient2;
}
namespace beans {
struct PropertyValue;
@@ -107,6 +107,11 @@ namespace core {
namespace drawingml {
+/// Tooling method to fill awt::Gradient2 from data contained in the given Any
+bool fillGradient2FromAny(
+ css::awt::Gradient2& rGradient,
+ const css::uno::Any& rVal);
+
class OOX_DLLPUBLIC URLTransformer
{
public:
@@ -198,7 +203,7 @@ protected:
const char* GetComponentDir() const;
const char* GetRelationCompPrefix() const;
- static bool EqualGradients( css::awt::Gradient aGradient1, css::awt::Gradient aGradient2 );
+ static bool EqualGradients( const css::awt::Gradient2& rGradient1, const css::awt::Gradient2& rGradient2 );
bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet);
void WriteGlowEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
@@ -244,10 +249,20 @@ public:
void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
void WriteGradientFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
- void WriteGradientFill( css::awt::Gradient rGradient, css::awt::Gradient rTransparenceGradient,
- const css::uno::Reference<css::beans::XPropertySet>& rXPropSet = css::uno::Reference<css::beans::XPropertySet>());
-
- void WriteGrabBagGradientFill( const css::uno::Sequence< css::beans::PropertyValue >& aGradientStops, css::awt::Gradient rGradient);
+ /* New API for WriteGradientFill:
+ If a awt::Gradient2 is given, it will be used. Else, the 'Fix' entry will be used for
+ Color or Transparency. That way, less Pseudo(Color|Transparency)Gradients have to be
+ created at caller side.
+ NOTE: Giving no Gradient at all (both nullptr) is an error.
+ */
+ void WriteGradientFill(
+ const css::awt::Gradient2* pColorGradient, sal_Int32 nFixColor,
+ const css::awt::Gradient2* pTransparenceGradient, sal_Int32 nFixTransparence);
+ void WriteGradientFill2(
+ const css::awt::Gradient2* pColorGradient, sal_Int32 nFixColor,
+ const css::awt::Gradient2* pTransparenceGradient, sal_Int32 nFixTransparence);
+
+ void WriteGrabBagGradientFill( const css::uno::Sequence< css::beans::PropertyValue >& aGradientStops, const css::awt::Gradient2& rGradient);
void WriteBlipOrNormalFill(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
const OUString& rURLPropName, const css::awt::Size& rSize = {});