sw/qa/extras/odfexport/data/table_styles_2.odt |binary sw/qa/extras/odfexport/odfexport.cxx | 208 +++++++++++++++++++++ sw/source/core/unocore/unomap.cxx | 50 +++++ sw/source/core/unocore/unostyle.cxx | 238 +++++++++++++++++++++++++ xmloff/source/text/txtimp.cxx | 2 xmloff/source/text/txtprmap.cxx | 49 +++++ 6 files changed, 546 insertions(+), 1 deletion(-)
New commits: commit 50a6f3d51f32e7176c3b2d036c60bb48d51d6a1a Author: Jakub Trzebiatowski <ubap....@gmail.com> Date: Mon Jul 11 15:51:37 2016 +0200 GSoC Writer Table Styles export of paragraph and char properties + Export of paragraph and character properties + Tests Change-Id: I689deb2c524fdcd462c69a33ad9bc2865890793d Reviewed-on: https://gerrit.libreoffice.org/27115 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/odfexport/data/table_styles_2.odt b/sw/qa/extras/odfexport/data/table_styles_2.odt new file mode 100644 index 0000000..735ea44 Binary files /dev/null and b/sw/qa/extras/odfexport/data/table_styles_2.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 313d2cf..fc8fd71 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -12,6 +12,7 @@ #include <initializer_list> #if !defined(MACOSX) +#include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/container/XIndexReplace.hpp> #include <com/sun/star/drawing/FillStyle.hpp> @@ -856,6 +857,213 @@ DECLARE_ODFEXPORT_TEST(testTableStyles1, "table_styles_1.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color); } +DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt") +{ + // Table styles paragraph and char tests + // Doesn't cover all attributes. + // Problem: underline for table autoformat doesn't work. + uno::Reference<style::XStyleFamiliesSupplier> XFamiliesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xFamilies(XFamiliesSupplier->getStyleFamilies()); + uno::Reference<container::XNameAccess> xTableFamily(xFamilies->getByName("TableStyles"), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xTableStyle(xTableFamily->getByName("Test style2"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xCell1Style; + + float fFloat = 0.; + bool bBool = true; + sal_Int16 nInt16 = 0xF0; + sal_Int32 nInt32 = 0xF0F0F0; + sal_Int64 nInt64 = 0xF0F0F0; + OUString sString; + awt::FontSlant eCharPosture; + + // cell 1 + xTableStyle->getByName("first-row-start-column") >>= xCell1Style; + xCell1Style->getPropertyValue("ParaAdjust") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32); + xCell1Style->getPropertyValue("CharColor") >>= nInt64; + CPPUNIT_ASSERT_EQUAL(sal_Int64(0xFF6600), nInt64); + xCell1Style->getPropertyValue("CharContoured") >>= bBool; + CPPUNIT_ASSERT_EQUAL(bool(false), bBool); + xCell1Style->getPropertyValue("CharShadowed") >>= bBool; + CPPUNIT_ASSERT_EQUAL(bool(true), bBool); + xCell1Style->getPropertyValue("CharStrikeout") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nInt32); + xCell1Style->getPropertyValue("CharUnderline") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32); + // underline color is not working for table autoformats + // xCell1Style->getPropertyValue("CharUnderlineHasColor") >>= bBool; + // CPPUNIT_ASSERT_EQUAL(bool(false), bBool); + // xCell1Style->getPropertyValue("CharUnderlineColor") >>= nInt64; + // CPPUNIT_ASSERT_EQUAL(sal_Int64(-1), nInt64); + // standard font + xCell1Style->getPropertyValue("CharHeight") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(18.), fFloat); + xCell1Style->getPropertyValue("CharWeight") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(100.), fFloat); + xCell1Style->getPropertyValue("CharPosture") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture); + xCell1Style->getPropertyValue("CharFontName") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString); + xCell1Style->getPropertyValue("CharFontStyleName") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString(""), sString); + xCell1Style->getPropertyValue("CharFontFamily") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); + xCell1Style->getPropertyValue("CharFontPitch") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nInt16); + // cjk font + xCell1Style->getPropertyValue("CharHeightAsian") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(18.), fFloat); + xCell1Style->getPropertyValue("CharWeightAsian") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(100.), fFloat); + xCell1Style->getPropertyValue("CharPostureAsian") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture); + xCell1Style->getPropertyValue("CharFontNameAsian") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString); + xCell1Style->getPropertyValue("CharFontStyleNameAsian") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Regularna"), sString); + xCell1Style->getPropertyValue("CharFontFamilyAsian") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); + xCell1Style->getPropertyValue("CharFontPitchAsian") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nInt16); + // ctl font + xCell1Style->getPropertyValue("CharHeightComplex") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(18.), fFloat); + xCell1Style->getPropertyValue("CharWeightComplex") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(100.), fFloat); + xCell1Style->getPropertyValue("CharPostureComplex") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture); + xCell1Style->getPropertyValue("CharFontNameComplex") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString); + xCell1Style->getPropertyValue("CharFontStyleNameComplex") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Regularna"), sString); + xCell1Style->getPropertyValue("CharFontFamilyComplex") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); + xCell1Style->getPropertyValue("CharFontPitchComplex") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nInt16); + + // cell 2 + xTableStyle->getByName("first-row") >>= xCell1Style; + xCell1Style->getPropertyValue("ParaAdjust") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nInt32); + xCell1Style->getPropertyValue("CharColor") >>= nInt64; + CPPUNIT_ASSERT_EQUAL(sal_Int64(0x9900FF), nInt64); + xCell1Style->getPropertyValue("CharContoured") >>= bBool; + CPPUNIT_ASSERT_EQUAL(bool(true), bBool); + xCell1Style->getPropertyValue("CharShadowed") >>= bBool; + CPPUNIT_ASSERT_EQUAL(bool(false), bBool); + xCell1Style->getPropertyValue("CharStrikeout") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32); + xCell1Style->getPropertyValue("CharUnderline") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), nInt32); + // underline color test place + // standard font + xCell1Style->getPropertyValue("CharHeight") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(12.), fFloat); + xCell1Style->getPropertyValue("CharWeight") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(150.), fFloat); + xCell1Style->getPropertyValue("CharPosture") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture); + xCell1Style->getPropertyValue("CharFontName") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString); + xCell1Style->getPropertyValue("CharFontStyleName") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString(""), sString); + xCell1Style->getPropertyValue("CharFontFamily") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(3), nInt16); + xCell1Style->getPropertyValue("CharFontPitch") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); + // cjk font + xCell1Style->getPropertyValue("CharHeightAsian") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(12.), fFloat); + xCell1Style->getPropertyValue("CharWeightAsian") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(150.), fFloat); + xCell1Style->getPropertyValue("CharPostureAsian") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture); + xCell1Style->getPropertyValue("CharFontNameAsian") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString); + xCell1Style->getPropertyValue("CharFontStyleNameAsian") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Pogrubiona"), sString); + xCell1Style->getPropertyValue("CharFontFamilyAsian") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(3), nInt16); + xCell1Style->getPropertyValue("CharFontPitchAsian") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); + // ctl font + xCell1Style->getPropertyValue("CharHeightComplex") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(12.), fFloat); + xCell1Style->getPropertyValue("CharWeightComplex") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(150.), fFloat); + xCell1Style->getPropertyValue("CharPostureComplex") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture); + xCell1Style->getPropertyValue("CharFontNameComplex") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString); + xCell1Style->getPropertyValue("CharFontStyleNameComplex") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Pogrubiona"), sString); + xCell1Style->getPropertyValue("CharFontFamilyComplex") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(3), nInt16); + xCell1Style->getPropertyValue("CharFontPitchComplex") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); + + // cell 3 + xTableStyle->getByName("first-row-even-column") >>= xCell1Style; + xCell1Style->getPropertyValue("ParaAdjust") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nInt32); + xCell1Style->getPropertyValue("CharColor") >>= nInt64; + CPPUNIT_ASSERT_EQUAL(sal_Int64(0), nInt64); + xCell1Style->getPropertyValue("CharContoured") >>= bBool; + CPPUNIT_ASSERT_EQUAL(bool(true), bBool); + xCell1Style->getPropertyValue("CharShadowed") >>= bBool; + CPPUNIT_ASSERT_EQUAL(bool(true), bBool); + xCell1Style->getPropertyValue("CharStrikeout") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32); + xCell1Style->getPropertyValue("CharUnderline") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), nInt32); + // underline color test place + // standard font + xCell1Style->getPropertyValue("CharHeight") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(12.), fFloat); + xCell1Style->getPropertyValue("CharWeight") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(100.), fFloat); + xCell1Style->getPropertyValue("CharPosture") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_ITALIC), eCharPosture); + xCell1Style->getPropertyValue("CharFontName") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString); + xCell1Style->getPropertyValue("CharFontStyleName") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString(""), sString); + xCell1Style->getPropertyValue("CharFontFamily") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nInt16); + xCell1Style->getPropertyValue("CharFontPitch") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); + // cjk font + xCell1Style->getPropertyValue("CharHeightAsian") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(12.), fFloat); + xCell1Style->getPropertyValue("CharWeightAsian") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(100.), fFloat); + xCell1Style->getPropertyValue("CharPostureAsian") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_ITALIC), eCharPosture); + xCell1Style->getPropertyValue("CharFontNameAsian") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString); + xCell1Style->getPropertyValue("CharFontStyleNameAsian") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Kursywa"), sString); + xCell1Style->getPropertyValue("CharFontFamilyAsian") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nInt16); + xCell1Style->getPropertyValue("CharFontPitchAsian") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); + // ctl font + xCell1Style->getPropertyValue("CharHeightComplex") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(12.), fFloat); + xCell1Style->getPropertyValue("CharWeightComplex") >>= fFloat; + CPPUNIT_ASSERT_EQUAL(float(100.), fFloat); + xCell1Style->getPropertyValue("CharPostureComplex") >>= eCharPosture; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_ITALIC), eCharPosture); + xCell1Style->getPropertyValue("CharFontNameComplex") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString); + xCell1Style->getPropertyValue("CharFontStyleNameComplex") >>= sString; + CPPUNIT_ASSERT_EQUAL(OUString("Kursywa"), sString); + xCell1Style->getPropertyValue("CharFontFamilyComplex") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nInt16); + xCell1Style->getPropertyValue("CharFontPitchComplex") >>= nInt16; + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nInt16); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 7fe145d..aa98dbb 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -1505,7 +1505,9 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { static SfxItemPropertyMapEntry const aCellStyleMap[] = { + // SvxBrushItem { OUString(UNO_NAME_BACK_COLOR), RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, 0 }, + // SvxBoxItem { OUString(UNO_NAME_LEFT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, LEFT_BORDER|CONVERT_TWIPS }, { OUString(UNO_NAME_RIGHT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, RIGHT_BORDER|CONVERT_TWIPS }, { OUString(UNO_NAME_TOP_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, TOP_BORDER|CONVERT_TWIPS }, @@ -1515,9 +1517,57 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { OUString(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, { OUString(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, { OUString(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + // SwFormatVertOrient { OUString(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_VERTORIENT_ORIENT }, + // SvxFrameDirectionItem { OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 }, + // SvNumberformat { OUString(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, cppu::UnoType<sal_Int32>::get(),PropertyAttribute::MAYBEVOID, 0 }, + // SvxAdjustItem + { OUString(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST, cppu::UnoType<sal_Int16>::get(),PropertyAttribute::MAYBEVOID, MID_PARA_ADJUST }, + // SvxColorItem + { OUString(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, 0 }, + // SvxShadowedItem + { OUString(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, + // SvxContouredItem + { OUString(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, + // SvxCrossedOutItem + { OUString(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, cppu::UnoType<sal_Int16>::get(),PropertyAttribute::MAYBEVOID, MID_CROSS_OUT }, + // SvxUnderlineItem + { OUString(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_TL_STYLE }, + { OUString(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE,cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_TL_COLOR }, + { OUString(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_TL_HASCOLOR }, + // standard font + // SvxFontHeightItem + { OUString(UNO_NAME_CHAR_HEIGHT), RES_CHRATR_FONTSIZE, cppu::UnoType<float>::get(),PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS }, + // SvxWeightItem + { OUString(UNO_NAME_CHAR_WEIGHT), RES_CHRATR_WEIGHT, cppu::UnoType<float>::get(),PropertyAttribute::MAYBEVOID, MID_WEIGHT }, + // SvxPostureItem + { OUString(UNO_NAME_CHAR_POSTURE), RES_CHRATR_POSTURE, cppu::UnoType<css::awt::FontSlant>::get(),PropertyAttribute::MAYBEVOID, MID_POSTURE }, + // SvxFontItem + { OUString(UNO_NAME_CHAR_FONT_NAME), RES_CHRATR_FONT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, + { OUString(UNO_NAME_CHAR_FONT_STYLE_NAME), RES_CHRATR_FONT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, + { OUString(UNO_NAME_CHAR_FONT_FAMILY), RES_CHRATR_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, + { OUString(UNO_NAME_CHAR_FONT_CHAR_SET), RES_CHRATR_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, + { OUString(UNO_NAME_CHAR_FONT_PITCH), RES_CHRATR_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, + // cjk font + { OUString(UNO_NAME_CHAR_HEIGHT_ASIAN), RES_CHRATR_CJK_FONTSIZE, cppu::UnoType<float>::get(), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS }, + { OUString(UNO_NAME_CHAR_WEIGHT_ASIAN), RES_CHRATR_CJK_WEIGHT, cppu::UnoType<float>::get(), PropertyAttribute::MAYBEVOID, MID_WEIGHT }, + { OUString(UNO_NAME_CHAR_POSTURE_ASIAN), RES_CHRATR_CJK_POSTURE, cppu::UnoType<css::awt::FontSlant>::get(), PropertyAttribute::MAYBEVOID, MID_POSTURE }, + { OUString(UNO_NAME_CHAR_FONT_NAME_ASIAN), RES_CHRATR_CJK_FONT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, + { OUString(UNO_NAME_CHAR_FONT_STYLE_NAME_ASIAN), RES_CHRATR_CJK_FONT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, + { OUString(UNO_NAME_CHAR_FONT_FAMILY_ASIAN), RES_CHRATR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, + { OUString(UNO_NAME_CHAR_FONT_CHAR_SET_ASIAN), RES_CHRATR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, + { OUString(UNO_NAME_CHAR_FONT_PITCH_ASIAN), RES_CHRATR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, + // ctl font + { OUString(UNO_NAME_CHAR_HEIGHT_COMPLEX), RES_CHRATR_CTL_FONTSIZE, cppu::UnoType<float>::get(), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS }, + { OUString(UNO_NAME_CHAR_WEIGHT_COMPLEX), RES_CHRATR_CTL_WEIGHT, cppu::UnoType<float>::get(), PropertyAttribute::MAYBEVOID, MID_WEIGHT }, + { OUString(UNO_NAME_CHAR_POSTURE_COMPLEX), RES_CHRATR_CTL_POSTURE, cppu::UnoType<css::awt::FontSlant>::get(), PropertyAttribute::MAYBEVOID, MID_POSTURE }, + { OUString(UNO_NAME_CHAR_FONT_NAME_COMPLEX), RES_CHRATR_CTL_FONT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, + { OUString(UNO_NAME_CHAR_FONT_STYLE_NAME_COMPLEX), RES_CHRATR_CTL_FONT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, + { OUString(UNO_NAME_CHAR_FONT_FAMILY_COMPLEX), RES_CHRATR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, + { OUString(UNO_NAME_CHAR_FONT_CHAR_SET_COMPLEX), RES_CHRATR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, + { OUString(UNO_NAME_CHAR_FONT_PITCH_COMPLEX), RES_CHRATR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, { OUString(), 0, css::uno::Type(), 0, 0 } }; m_aMapEntriesArr[nPropertyId] = aCellStyleMap; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 30449ed..98070d5 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -4967,6 +4967,135 @@ void SAL_CALL SwXTextCellStyle::setPropertyValue(const OUString& rPropertyName, } return; } + // Paragraph attributes + case RES_PARATR_ADJUST: + { + SvxAdjustItem rAdjustItem = m_pBoxAutoFormat->GetAdjust(); + rAdjustItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetAdjust(rAdjustItem); + return; + } + case RES_CHRATR_COLOR: + { + SvxColorItem rColorItem = m_pBoxAutoFormat->GetColor(); + rColorItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetColor(rColorItem); + return; + } + case RES_CHRATR_SHADOWED: + { + SvxShadowedItem rShadowedItem = m_pBoxAutoFormat->GetShadowed(); + bool bValue; aValue >>= bValue; + rShadowedItem.SetValue(bValue); + m_pBoxAutoFormat->SetShadowed(rShadowedItem); + return; + } + case RES_CHRATR_CONTOUR: + { + SvxContourItem rContourItem = m_pBoxAutoFormat->GetContour(); + bool bValue; aValue >>= bValue; + rContourItem.SetValue(bValue); + m_pBoxAutoFormat->SetContour(rContourItem); + return; + } + case RES_CHRATR_CROSSEDOUT: + { + SvxCrossedOutItem rCrossedOutItem = m_pBoxAutoFormat->GetCrossedOut(); + rCrossedOutItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCrossedOut(rCrossedOutItem); + return; + } + case RES_CHRATR_UNDERLINE: + { + SvxUnderlineItem rUnderlineItem = m_pBoxAutoFormat->GetUnderline(); + rUnderlineItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetUnderline(rUnderlineItem); + return; + } + case RES_CHRATR_FONTSIZE: + { + SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetHeight(); + rFontHeightItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetHeight(rFontHeightItem); + return; + } + case RES_CHRATR_WEIGHT: + { + SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetWeight(); + rWeightItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetWeight(rWeightItem); + return; + } + case RES_CHRATR_POSTURE: + { + SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetPosture(); + rPostureItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetPosture(rPostureItem); + return; + } + case RES_CHRATR_FONT: + { + SvxFontItem rFontItem = m_pBoxAutoFormat->GetFont(); + rFontItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetFont(rFontItem); + return; + } + case RES_CHRATR_CJK_FONTSIZE: + { + SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCJKHeight(); + rFontHeightItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCJKHeight(rFontHeightItem); + return; + } + case RES_CHRATR_CJK_WEIGHT: + { + SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetCJKWeight(); + rWeightItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCJKWeight(rWeightItem); + return; + } + case RES_CHRATR_CJK_POSTURE: + { + SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetCJKPosture(); + rPostureItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCJKPosture(rPostureItem); + return; + } + case RES_CHRATR_CJK_FONT: + { + SvxFontItem rFontItem = m_pBoxAutoFormat->GetCJKFont(); + rFontItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCJKFont(rFontItem); + return; + } + case RES_CHRATR_CTL_FONTSIZE: + { + SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCTLHeight(); + rFontHeightItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCTLHeight(rFontHeightItem); + return; + } + case RES_CHRATR_CTL_WEIGHT: + { + SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetCTLWeight(); + rWeightItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCTLWeight(rWeightItem); + return; + } + case RES_CHRATR_CTL_POSTURE: + { + SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetCTLPosture(); + rPostureItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCTLPosture(rPostureItem); + return; + } + case RES_CHRATR_CTL_FONT: + { + SvxFontItem rFontItem = m_pBoxAutoFormat->GetCTLFont(); + rFontItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetCTLFont(rFontItem); + return; + } default: SAL_WARN("sw.uno", "SwXTextCellStyle unknown nWID"); throw css::uno::RuntimeException(); @@ -5022,6 +5151,115 @@ css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyValue(const OUString& rPrope } return aRet; } + // Paragraph attributes + case RES_PARATR_ADJUST: + { + const SvxAdjustItem& rAdjustItem = m_pBoxAutoFormat->GetAdjust(); + rAdjustItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_COLOR: + { + const SvxColorItem& rColorItem = m_pBoxAutoFormat->GetColor(); + rColorItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_SHADOWED: + { + const SvxShadowedItem& rShadowedItem = m_pBoxAutoFormat->GetShadowed(); + aRet <<= rShadowedItem.GetValue(); + return aRet; + } + case RES_CHRATR_CONTOUR: + { + const SvxContourItem& rContourItem = m_pBoxAutoFormat->GetContour(); + aRet <<= rContourItem.GetValue(); + return aRet; + } + case RES_CHRATR_CROSSEDOUT: + { + const SvxCrossedOutItem& rCrossedOutItem = m_pBoxAutoFormat->GetCrossedOut(); + rCrossedOutItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_UNDERLINE: + { + const SvxUnderlineItem& rUnderlineItem = m_pBoxAutoFormat->GetUnderline(); + rUnderlineItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_FONTSIZE: + { + const SvxFontHeightItem& rFontHeightItem = m_pBoxAutoFormat->GetHeight(); + rFontHeightItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_WEIGHT: + { + const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetWeight(); + rWeightItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_POSTURE: + { + const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetPosture(); + rPostureItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_FONT: + { + const SvxFontItem rFontItem = m_pBoxAutoFormat->GetFont(); + rFontItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_CJK_FONTSIZE: + { + const SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCJKHeight(); + rFontHeightItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_CJK_WEIGHT: + { + const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetCJKWeight(); + rWeightItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_CJK_POSTURE: + { + const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetCJKPosture(); + rPostureItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_CJK_FONT: + { + const SvxFontItem rFontItem = m_pBoxAutoFormat->GetCJKFont(); + rFontItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_CTL_FONTSIZE: + { + const SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCTLHeight(); + rFontHeightItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_CTL_WEIGHT: + { + const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetCTLWeight(); + rWeightItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_CTL_POSTURE: + { + const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetCTLPosture(); + rPostureItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } + case RES_CHRATR_CTL_FONT: + { + const SvxFontItem rFontItem = m_pBoxAutoFormat->GetCTLFont(); + rFontItem.QueryValue(aRet, pEntry->nMemberId); + return aRet; + } default: SAL_WARN("sw.uno", "SwXTextCellStyle unknown nWID"); throw css::uno::RuntimeException(); diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index dd96833..4b15681 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1080,7 +1080,7 @@ SvXMLImportPropertyMapper* { XMLPropertySetMapper *pPropMapper = new XMLTextPropertySetMapper( TextPropMap::CELL, false ); - return new SvXMLImportPropertyMapper( pPropMapper, rImport ); + return new XMLTextImportPropertyMapper( pPropMapper, rImport ); } void XMLTextImportHelper::SetCursor( const Reference < XTextCursor > & rCursor ) diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index b6c8a02..04e004c 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -1011,6 +1011,55 @@ XMLPropertyMapEntry aXMLCellPropMap[] = MC_E( "VertOrient", STYLE, VERTICAL_ALIGN, XML_TYPE_TEXT_VERTICAL_POS, 0 ), MC_E( "WritingMode", STYLE, WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ), MC_E( "NumberFormat", STYLE, DATA_STYLE_NAME, XML_TYPE_NUMBER, 0 ), + // paragraph properties + MP_E( "ParaAdjust", FO, TEXT_ALIGN, XML_TYPE_TEXT_ADJUST, 0 ), + // text properties + MT_ED( "CharColor", FO, COLOR, XML_TYPE_COLORAUTO|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_ED( "CharColor", STYLE, USE_WINDOW_FONT_COLOR, XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_E( "CharShadowed", FO, TEXT_SHADOW, XML_TYPE_TEXT_SHADOWED, 0 ), + MT_E( "CharContoured", STYLE, TEXT_OUTLINE, XML_TYPE_BOOL, 0 ), + MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_STYLE, XML_TYPE_TEXT_CROSSEDOUT_STYLE|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_TYPE, XML_TYPE_TEXT_CROSSEDOUT_TYPE|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_WIDTH, XML_TYPE_TEXT_CROSSEDOUT_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_E( "CharStrikeout", STYLE, TEXT_LINE_THROUGH_TEXT, XML_TYPE_TEXT_CROSSEDOUT_TEXT|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_STYLE, XML_TYPE_TEXT_UNDERLINE_STYLE|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_TYPE, XML_TYPE_TEXT_UNDERLINE_TYPE|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_E( "CharUnderline", STYLE, TEXT_UNDERLINE_WIDTH, XML_TYPE_TEXT_UNDERLINE_WIDTH|MID_FLAG_MERGE_PROPERTY, 0 ), + MT_E( "CharUnderlineColor", STYLE, TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ), + MT_E( "CharUnderlineHasColor",STYLE, TEXT_UNDERLINE_COLOR, XML_TYPE_TEXT_UNDERLINE_HASCOLOR|MID_FLAG_MERGE_ATTRIBUTE, 0 ), + // STANDARD FONT + MT_ED( "CharHeight", FO, FONT_SIZE, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, 0 ), + MT_E( "CharWeight", FO, FONT_WEIGHT, XML_TYPE_TEXT_WEIGHT, 0 ), + MT_E( "CharPosture", FO, FONT_STYLE, XML_TYPE_TEXT_POSTURE, 0 ), + // RES_CHRATR_FONT + MT_ED( "CharFontName", STYLE, FONT_NAME, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME ), + MT_ED( "CharFontName", FO, FONT_FAMILY, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME ), + MT_ED( "CharFontStyleName", STYLE, FONT_STYLE_NAME, XML_TYPE_STRING, CTF_FONTSTYLENAME ), + MT_ED( "CharFontFamily", STYLE, FONT_FAMILY_GENERIC,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY ), + MT_ED( "CharFontPitch", STYLE, FONT_PITCH, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH ), + MT_ED( "CharFontCharSet", STYLE, FONT_CHARSET, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET ), + // CJK FONT + MT_ED( "CharHeightAsian", STYLE, FONT_SIZE_ASIAN, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, 0 ), + MT_E( "CharWeightAsian", STYLE, FONT_WEIGHT_ASIAN, XML_TYPE_TEXT_WEIGHT, 0 ), + MT_E( "CharPostureAsian", STYLE, FONT_STYLE_ASIAN, XML_TYPE_TEXT_POSTURE, 0 ), + // RES_CHRATR_CJK_FONT + MT_ED( "CharFontNameAsian", STYLE, FONT_NAME_ASIAN, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CJK ), + MT_ED( "CharFontNameAsian", STYLE, FONT_FAMILY_ASIAN, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CJK ), + MT_ED( "CharFontStyleNameAsian", STYLE, FONT_STYLE_NAME_ASIAN, XML_TYPE_STRING, CTF_FONTSTYLENAME_CJK ), + MT_ED( "CharFontFamilyAsian", STYLE, FONT_FAMILY_GENERIC_ASIAN, XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CJK ), + MT_ED( "CharFontPitchAsian", STYLE, FONT_PITCH_ASIAN, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CJK ), + MT_ED( "CharFontCharSetAsian", STYLE, FONT_CHARSET_ASIAN, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET_CJK ), + // CTL FONT + MT_ED( "CharHeightComplex", STYLE, FONT_SIZE_COMPLEX, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, 0 ), + MT_E( "CharWeightComplex", STYLE, FONT_WEIGHT_COMPLEX, XML_TYPE_TEXT_WEIGHT, 0 ), + MT_E( "CharPostureComplex", STYLE, FONT_STYLE_COMPLEX, XML_TYPE_TEXT_POSTURE, 0 ), + // RES_CHRATR_CTL_FONT + MT_ED( "CharFontNameComplex", STYLE, FONT_NAME_COMPLEX, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CTL ), + MT_ED( "CharFontNameComplex", STYLE, FONT_FAMILY_COMPLEX, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CTL ), + MT_ED( "CharFontStyleNameComplex",STYLE, FONT_STYLE_NAME_COMPLEX, XML_TYPE_STRING, CTF_FONTSTYLENAME_CTL ), + MT_ED( "CharFontFamilyComplex", STYLE, FONT_FAMILY_GENERIC_COMPLEX,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CTL ), + MT_ED( "CharFontPitchComplex", STYLE, FONT_PITCH_COMPLEX, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CTL ), + MT_ED( "CharFontCharSetComplex", STYLE, FONT_CHARSET_COMPLEX, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET_CTL ), M_END() }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits