diff options
Diffstat (limited to 'editeng/source/items/borderline.cxx')
-rw-r--r-- | editeng/source/items/borderline.cxx | 87 |
1 files changed, 53 insertions, 34 deletions
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 9037eeba9015..05742eb95131 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -30,7 +30,11 @@ #include <editeng/eerdll.hxx> #include <tools/bigint.hxx> +#include <docmodel/uno/UnoComplexColor.hxx> +#include <com/sun/star/util/XComplexColor.hpp> + using namespace ::com::sun::star::table::BorderLineStyle; +using namespace css; // class SvxBorderLine -------------------------------------------------- @@ -57,7 +61,22 @@ namespace { } } // Anonymous namespace -namespace editeng { +namespace editeng +{ + +bool SvxBorderLine::setComplexColorFromAny(css::uno::Any const& rValue) +{ + css::uno::Reference<css::util::XComplexColor> xComplexColor; + if (!(rValue >>= xComplexColor)) + return false; + + if (xComplexColor.is()) + { + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + setComplexColor(aComplexColor); + } + return true; +} Color SvxBorderLine::darkColor( Color aMain ) { @@ -98,22 +117,21 @@ Color SvxBorderLine::threeDMediumColor( Color aMain ) SvxBorderLine::SvxBorderLine( const Color *pCol, tools::Long nWidth, SvxBorderLineStyle nStyle, Color (*pColorOutFn)( Color ), Color (*pColorInFn)( Color ) ) -: m_nWidth( nWidth ) -, m_bMirrorWidths( false ) -, m_aWidthImpl( SvxBorderLine::getWidthImpl( nStyle ) ) -, m_nMult( 1 ) -, m_nDiv( 1 ) -, m_nStyle( nStyle ) -, m_bUseLeftTop( false ) -, m_pColorOutFn( pColorOutFn ) -, m_pColorInFn( pColorInFn ) -, m_pColorGapFn( nullptr ) + : m_nWidth(nWidth) + , m_nMult(1) + , m_nDiv(1) + , m_pColorOutFn(pColorOutFn) + , m_pColorInFn(pColorInFn) + , m_pColorGapFn(nullptr) + , m_aWidthImpl(SvxBorderLine::getWidthImpl(nStyle)) + , m_nStyle(nStyle) + , m_bMirrorWidths(false) + , m_bUseLeftTop(false) { - if ( pCol ) - aColor = *pCol; + if (pCol) + m_aColor = *pCol; } - SvxBorderLineStyle ConvertBorderStyleFromWord(int const nWordLineStyle) { @@ -519,15 +537,16 @@ sal_uInt16 SvxBorderLine::GetDistance() const bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const { - return ( ( aColor == rCmp.aColor ) && - ( m_nWidth == rCmp.m_nWidth ) && - ( m_bMirrorWidths == rCmp.m_bMirrorWidths ) && - ( m_aWidthImpl == rCmp.m_aWidthImpl ) && - ( m_nStyle == rCmp.GetBorderLineStyle()) && - ( m_bUseLeftTop == rCmp.m_bUseLeftTop ) && - ( m_pColorOutFn == rCmp.m_pColorOutFn ) && - ( m_pColorInFn == rCmp.m_pColorInFn ) && - ( m_pColorGapFn == rCmp.m_pColorGapFn ) ); + return (m_aColor == rCmp.m_aColor && + m_aComplexColor == rCmp.m_aComplexColor && + m_nWidth == rCmp.m_nWidth && + m_bMirrorWidths == rCmp.m_bMirrorWidths && + m_aWidthImpl == rCmp.m_aWidthImpl && + m_nStyle == rCmp.GetBorderLineStyle() && + m_bUseLeftTop == rCmp.m_bUseLeftTop && + m_pColorOutFn == rCmp.m_pColorOutFn && + m_pColorInFn == rCmp.m_pColorInFn && + m_pColorGapFn == rCmp.m_pColorGapFn); } void SvxBorderLine::SetBorderLineStyle( SvxBorderLineStyle nNew ) @@ -572,14 +591,14 @@ void SvxBorderLine::SetBorderLineStyle( SvxBorderLineStyle nNew ) Color SvxBorderLine::GetColorOut( bool bLeftOrTop ) const { - Color aResult = aColor; + Color aResult = m_aColor; if ( m_aWidthImpl.IsDouble() && m_pColorOutFn != nullptr ) { if ( !bLeftOrTop && m_bUseLeftTop ) - aResult = (*m_pColorInFn)( aColor ); + aResult = (*m_pColorInFn)(m_aColor); else - aResult = (*m_pColorOutFn)( aColor ); + aResult = (*m_pColorOutFn)(m_aColor); } return aResult; @@ -587,14 +606,14 @@ Color SvxBorderLine::GetColorOut( bool bLeftOrTop ) const Color SvxBorderLine::GetColorIn( bool bLeftOrTop ) const { - Color aResult = aColor; + Color aResult = m_aColor; if ( m_aWidthImpl.IsDouble() && m_pColorInFn != nullptr ) { if ( !bLeftOrTop && m_bUseLeftTop ) - aResult = (*m_pColorOutFn)( aColor ); + aResult = (*m_pColorOutFn)(m_aColor); else - aResult = (*m_pColorInFn)( aColor ); + aResult = (*m_pColorInFn)(m_aColor); } return aResult; @@ -602,11 +621,11 @@ Color SvxBorderLine::GetColorIn( bool bLeftOrTop ) const Color SvxBorderLine::GetColorGap( ) const { - Color aResult = aColor; + Color aResult = m_aColor; if ( m_aWidthImpl.IsDouble() && m_pColorGapFn != nullptr ) { - aResult = (*m_pColorGapFn)( aColor ); + aResult = (*m_pColorGapFn)(m_aColor); } return aResult; @@ -622,7 +641,7 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit, const IntlWrapper* pIntl, bool bMetricStr) const { - static const char* aStyleIds[] = + static TranslateId aStyleIds[] = { RID_SOLID, RID_DOTTED, @@ -643,11 +662,11 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit, RID_DASH_DOT, RID_DASH_DOT_DOT }; - OUString aStr = "(" + ::GetColorString( aColor ) + cpDelim; + OUString aStr = "(" + ::GetColorString(m_aColor) + cpDelim; if ( static_cast<int>(m_nStyle) < int(SAL_N_ELEMENTS(aStyleIds)) ) { - const char* pResId = aStyleIds[static_cast<int>(m_nStyle)]; + TranslateId pResId = aStyleIds[static_cast<int>(m_nStyle)]; aStr += EditResId(pResId); } else |