19#include <com/sun/star/beans/XPropertySet.hpp>
20#include <com/sun/star/xml/AttributeData.hpp>
22#include <ooo/vba/excel/XlColorIndex.hpp>
23#include <ooo/vba/excel/XlPattern.hpp>
31#include <document.hxx>
36using namespace ::ooo::vba::excel::XlPattern;
43 { xlPatternAutomatic, 0 },
44 { xlPatternChecker, 9 },
45 { xlPatternCrissCross, 16 },
47 { xlPatternGray16, 17 },
48 { xlPatternGray25, 4 },
49 { xlPatternGray50, 2 },
50 { xlPatternGray75, 3 },
51 { xlPatternGray8, 18 },
52 { xlPatternGrid, 15 },
53 { xlPatternHorizontal, 5 },
54 { xlPatternLightDown, 13 },
55 { xlPatternLightHorizontal, 11 },
56 { xlPatternLightUp, 14 },
57 { xlPatternLightVertical, 12 },
59 { xlPatternSemiGray75, 10 },
60 { xlPatternSolid, 0 },
62 { xlPatternVertical, 6 }
71 throw lang::IllegalArgumentException(
"properties", uno::Reference< uno::XInterface >(), 2 );
84 if( _color >>= nColor )
114 aMixedColor =
GetPatternColor( nPatternColor, aBackColor,
static_cast<sal_uInt32
>(nPattern) );
116 aMixedColor =
GetPatternColor( aBackColor, aBackColor,
static_cast<sal_uInt32
>(nPattern) );
121uno::Reference< container::XIndexAccess >
125 throw uno::RuntimeException();
138 if(
nIndex == excel::XlColorIndex::xlColorIndexNone )
153 sal_Int32
nIndex = nColorIndex;
156 if ( !
nIndex || (
nIndex == excel::XlColorIndex::xlColorIndexAutomatic ) || (
nIndex == excel::XlColorIndex::xlColorIndexNone ) )
159 uno::Reference< container::XIndexAccess > xIndex =
getPalette();
160 return xIndex->getByIndex(
nIndex );
166 uno::Reference< container::XIndexAccess > xIndex =
getPalette();
167 sal_Int32 nElems = xIndex->getCount();
171 sal_Int32 nPaletteColor = 0;
172 xIndex->getByIndex(
count ) >>= nPaletteColor;
173 if ( nPaletteColor == nColor )
185 sal_Int32 nColor = 0;
188 if( ( aColor >>= nColor ) && ( nColor == -1 ) )
190 nColor = excel::XlColorIndex::xlColorIndexNone;
209 0x80, 0x00, 0x40, 0x20, 0x60, 0x40, 0x40, 0x40,
210 0x40, 0x40, 0x20, 0x60, 0x60, 0x60, 0x60, 0x48,
214 GetMixedColor( rPattColor, rBackColor, pnRatioTable[ nXclPattern ] ) : rPattColor;
228 sal_uInt32 nTemp = ((
static_cast< sal_Int32
>( nBack ) - nFore) * nTrans) / 0x80 + nFore;
229 return static_cast< sal_uInt8 >( nTemp );
231uno::Reference< container::XNameContainer >
234 return uno::Reference < container::XNameContainer > (
m_xProps->getPropertyValue(
"UserDefinedAttributes"), uno::UNO_QUERY_THROW );
239 xml::AttributeData aDataValue;
240 if( aValue >>= aDataValue )
242 return aDataValue.Value.toInt32();
249 xml::AttributeData aAttributeData;
250 aAttributeData.Type =
"sal_Int32";
251 aAttributeData.Value = OUString::number(
nValue );
257 uno::Reference< container::XNameContainer > xNameContainer(
GetAttributeContainer(), uno::UNO_SET_THROW );
258 if( xNameContainer->hasByName(
sName ) )
260 return xNameContainer->getByName(
sName );
269 uno::Reference< container::XNameContainer > xNameContainer(
GetAttributeContainer(), uno::UNO_SET_THROW );
270 if( xNameContainer->hasByName(
sName ) )
271 xNameContainer->removeByName(
sName );
272 xNameContainer->insertByName(
sName, aValue );
273 m_xProps->setPropertyValue(
"UserDefinedAttributes",
uno::Any( xNameContainer ) );
284 return uno::Any( excel::XlPattern::xlPatternNone );
290 throw uno::RuntimeException(
"Invalid Pattern index" );
299 sal_Int32 nColor = 0;
310 if( aAny >>= nColor )
334 sal_Int32 nPattColor = 0;
335 if( !(_patterncolor >>= nPattColor) )
336 throw uno::RuntimeException(
"Invalid Pattern Color" );
345 sal_Int32 nColor = 0;
353 sal_Int32 nColorIndex = 0;
354 if( !(_patterncolorindex >>= nColorIndex) )
355 throw uno::RuntimeException(
"Invalid Pattern Color" );
357 if( nColorIndex == 0 )
368 return uno::Any(
static_cast<sal_Int32
>(0));
379 return uno::Any(
static_cast<double>(0));
390 return uno::Any(
static_cast<double>(0));
401 return "ScVbaInterior";
404uno::Sequence< OUString >
409 "ooo.vba.excel.Interior"
Color GetRGBColor() const
sal_uInt8 GetBlue() const
sal_uInt8 GetGreen() const
SfxObjectShell * GetDocumentShell() const
virtual void SAL_CALL setColorIndex(const css::uno::Any &_colorindex) override
sal_Int32 GetColorIndex(const sal_Int32 nColor)
static css::uno::Any SetAttributeData(sal_Int32 nValue)
css::uno::Reference< css::container::XIndexAccess > getPalette() const
virtual css::uno::Any SAL_CALL getPatternColorIndex() override
css::uno::Any GetIndexColor(sal_Int32 nColorIndex)
static sal_uInt8 GetMixedColorComp(sal_uInt8 nFore, sal_uInt8 nBack, sal_uInt8 nTrans)
virtual css::uno::Any SAL_CALL getPatternColor() override
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual css::uno::Any SAL_CALL getPattern() override
void SAL_CALL setTintAndShade(const css::uno::Any &rAny) override
virtual void SAL_CALL setPattern(const css::uno::Any &_pattern) override
ScVbaInterior(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, css::uno::Reference< css::beans::XPropertySet > xProps, ScDocument *pScDoc=nullptr)
static sal_Int32 GetAttributeData(css::uno::Any const &aValue)
css::uno::Reference< css::beans::XPropertySet > m_xProps
virtual OUString getServiceImplName() override
virtual void SAL_CALL setColor(const css::uno::Any &_color) override
void SetUserDefinedAttributes(const OUString &sName, const css::uno::Any &aValue)
virtual css::uno::Any SAL_CALL getColorIndex() override
virtual void SAL_CALL setPatternColorIndex(const css::uno::Any &_patterncolorindex) override
css::uno::Any SAL_CALL getThemeColor() override
static Color GetPatternColor(const Color &rPattColor, const Color &rBackColor, sal_uInt32 nXclPattern)
static Color GetMixedColor(const Color &rFore, const Color &rBack, sal_uInt8 nTrans)
virtual void SAL_CALL setPatternColor(const css::uno::Any &_patterncolor) override
void SAL_CALL setThemeColor(const css::uno::Any &rAny) override
css::uno::Any SAL_CALL getTintAndShade() override
css::uno::Reference< css::container::XNameContainer > GetAttributeContainer()
css::uno::Any GetUserDefinedAttributes(const OUString &sName)
css::uno::Any SAL_CALL getPatternTintAndShade() override
void SAL_CALL setPatternTintAndShade(const css::uno::Any &rAny) override
virtual css::uno::Any SAL_CALL getColor() override
css::uno::Reference< css::container::XIndexAccess > getPalette() const
Sequence< OUString > aServiceNames
#define SAL_N_ELEMENTS(arr)
sal_Int32 XLRGBToOORGB(sal_Int32 nCol)
sal_Int32 OORGBToXLRGB(sal_Int32 nCol)
static std::map< sal_Int32, sal_Int32 > aPatternMap
constexpr OUStringLiteral BACKCOLOR
constexpr OUStringLiteral PATTERN
constexpr OUStringLiteral PATTERNCOLOR