21#include <com/sun/star/awt/FontUnderline.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/container/XIndexAccess.hpp>
24#include <ooo/vba/word/WdUnderline.hpp>
26#include <unordered_map>
46 { word::WdUnderline::wdUnderlineSingle, css::awt::FontUnderline::SINGLE },
47 { word::WdUnderline::wdUnderlineWords, css::awt::FontUnderline::SINGLE },
48 { word::WdUnderline::wdUnderlineDouble, css::awt::FontUnderline::DOUBLE },
49 { word::WdUnderline::wdUnderlineDotted, css::awt::FontUnderline::DOTTED },
50 { word::WdUnderline::wdUnderlineThick, css::awt::FontUnderline::BOLDDASH },
51 { word::WdUnderline::wdUnderlineDash, css::awt::FontUnderline::DASH },
52 { word::WdUnderline::wdUnderlineDotDash, css::awt::FontUnderline::DASHDOT },
53 { word::WdUnderline::wdUnderlineDotDotDash, css::awt::FontUnderline::DASHDOTDOT },
54 { word::WdUnderline::wdUnderlineWavy, css::awt::FontUnderline::WAVE },
55 { word::WdUnderline::wdUnderlineDottedHeavy, css::awt::FontUnderline::BOLDDOTTED },
56 { word::WdUnderline::wdUnderlineDashHeavy, css::awt::FontUnderline::BOLDDASH },
57 { word::WdUnderline::wdUnderlineDotDashHeavy, css::awt::FontUnderline::BOLDDASHDOT },
58 { word::WdUnderline::wdUnderlineDotDotDashHeavy, css::awt::FontUnderline::BOLDDASHDOTDOT },
59 { word::WdUnderline::wdUnderlineWavyHeavy, css::awt::FontUnderline::BOLDWAVE },
60 { word::WdUnderline::wdUnderlineDashLong, css::awt::FontUnderline::LONGDASH },
61 { word::WdUnderline::wdUnderlineWavyDouble, css::awt::FontUnderline::DOUBLEWAVE },
62 { word::WdUnderline::wdUnderlineDashLongHeavy, css::awt::FontUnderline::BOLDLONGDASH },
78 m_MSO2OOO[
index.nMSOConst ] =
index.nOOOConst;
79 m_OOO2MSO[
index.nOOOConst ] =
index.nMSOConst;
83 static OUString propName()
85 return "CharUnderline";
88 static UnderLineMapper& instance()
90 static UnderLineMapper theMapper;
95 sal_Int32 getOOOFromMSO( sal_Int32 nMSOConst )
97 ConstToConst::iterator it = m_MSO2OOO.find( nMSOConst );
98 if ( it == m_MSO2OOO.end() )
99 throw lang::IllegalArgumentException();
103 sal_Int32 getMSOFromOOO( sal_Int32 nOOOConst )
105 ConstToConst::iterator it = m_OOO2MSO.find( nOOOConst );
106 if ( it == m_OOO2MSO.end() )
107 throw lang::IllegalArgumentException();
114SwVbaFont::SwVbaFont(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< container::XIndexAccess >& xPalette, uno::Reference< css::beans::XPropertySet >
const & xPropertySet )
122 sal_Int32 nOOVal = 0;
123 mxFont->getPropertyValue( UnderLineMapper::propName() ) >>= nOOVal;
124 return uno::Any( UnderLineMapper::instance().getMSOFromOOO( nOOVal ) );
130 sal_Int32 nMSOVal = 0;
132 if ( _underline >>= nMSOVal )
134 sal_Int32 nOOVal = UnderLineMapper::instance().getOOOFromMSO( nMSOVal );
135 mxFont->setPropertyValue( UnderLineMapper::propName(),
uno::Any( nOOVal ) );
148 sal_Int32 nColor = 0;
150 getColor() >>= nColor;
151 sal_Int32 nElems = mxPalette->getCount();
155 sal_Int32 nPaletteColor = 0;
156 mxPalette->getByIndex(
count ) >>= nPaletteColor;
157 if ( nPaletteColor == nColor )
169 SwVbaFont_BASE::getSubscript() >>= bRes;
179 SwVbaFont_BASE::getSuperscript() >>= bRes;
189 SwVbaFont_BASE::getBold() >>= bRes;
199 SwVbaFont_BASE::getItalic() >>= bRes;
209 SwVbaFont_BASE::getStrikethrough() >>= bRes;
219 SwVbaFont_BASE::getShadow() >>= bRes;
225uno::Sequence< OUString >
virtual css::uno::Any SAL_CALL getBold() override
virtual void SAL_CALL setUnderline(const css::uno::Any &_underline) override
virtual css::uno::Any SAL_CALL getColorIndex() override
virtual css::uno::Any SAL_CALL getUnderline() override
virtual css::uno::Any SAL_CALL getSubscript() override
virtual css::uno::Any SAL_CALL getStrikethrough() override
virtual OUString getServiceImplName() override
virtual css::uno::Any SAL_CALL getShadow() override
virtual css::uno::Any SAL_CALL getItalic() override
SwVbaFont(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::container::XIndexAccess > &xPalette, css::uno::Reference< css::beans::XPropertySet > const &xPropertySet)
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual css::uno::Any SAL_CALL getSuperscript() override
Sequence< OUString > aServiceNames
uno::Reference< rendering::XCanvasFont > mxFont
::std::pair< MetaAction *, int > Component
std::unordered_map< sal_Int32, sal_Int32 > ConstToConst
const uno::Any aLongAnyTrue(sal_Int16(-1))
MapPair const UnderLineTable[]
const uno::Any aLongAnyFalse(sal_Int16(0))
cppu::ImplInheritanceHelper< VbaFontBase, ov::word::XFont > SwVbaFont_BASE