Rebased ref, commits from common ancestor: commit 42fafd1cb63a63714d6f088201b06c7d5c10e0e1 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Apr 2 00:21:34 2021 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:18 2021 +0900
Unit test (with the content disabled so far) for the theming. Change-Id: Ie9e003df38e1bc766fb5323936138d3e0e664321 diff --git a/sw/qa/extras/ooxmlexport/data/themeOrange.docx b/sw/qa/extras/ooxmlexport/data/themeOrange.docx new file mode 100644 index 000000000000..e350c2676d41 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/themeOrange.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index b550e62ef6a2..7af07caa58d8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -518,6 +518,12 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_ShadowDirection, "tdf142361ShadowDirect "rotWithShape", "0"); } +DECLARE_OOXMLEXPORT_TEST(testThemeOrange, "themeOrange.docx") +{ + // Assert that the theme color of the 1st paragraph is "accent1" + //CPPUNIT_ASSERT_EQUAL(getProperty<sal_Int16>(getParagraph(1), "CharColorTheme"), static_cast<sal_Int16>(4)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 421e722049c937e24d8b4740e14de4e172845c16 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Sep 24 12:32:14 2015 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:17 2021 +0900 Improve preview of theme color sets - add color set name Change-Id: I1f7b3668ba9dfbab1da283741e99754de2d6be47 diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index 09a7665950c9..d41db8ffd659 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -19,6 +19,7 @@ #include <editeng/fontitem.hxx> #include <vcl/bitmapex.hxx> #include <vcl/image.hxx> +#include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/virdev.hxx> #include <charatr.hxx> @@ -371,17 +372,39 @@ BitmapEx GenerateColorPreview(const svx::ColorSet& rColorSet) { ScopedVclPtrInstance<VirtualDevice> pVirtualDev(*Application::GetDefaultDevice()); float fScaleFactor = pVirtualDev->GetDPIScaleFactor(); - tools::Long BORDER = 2 * fScaleFactor; - tools::Long SIZE = 12 * fScaleFactor; + long BORDER = 3 * fScaleFactor; + long SIZE = 14 * fScaleFactor; + long LABEL_HEIGHT = 16 * fScaleFactor; + long LABEL_TEXT_HEIGHT = 14 * fScaleFactor; - Size aSize(BORDER * 7 + SIZE * 6, BORDER * 3 + SIZE * 2); + Size aSize(BORDER * 7 + SIZE * 6 + BORDER * 2, BORDER * 3 + SIZE * 2 + LABEL_HEIGHT); pVirtualDev->SetOutputSizePixel(aSize); + pVirtualDev->SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetFaceColor())); + pVirtualDev->Erase(); tools::Long x = BORDER; - tools::Long y1 = BORDER; + tools::Long y1 = BORDER + LABEL_HEIGHT; tools::Long y2 = y1 + SIZE + BORDER; pVirtualDev->SetLineColor(COL_LIGHTGRAY); + pVirtualDev->SetFillColor(COL_LIGHTGRAY); + tools::Rectangle aNameRect(Point(0, 0), Size(aSize.Width(), LABEL_HEIGHT)); + pVirtualDev->DrawRect(aNameRect); + + vcl::Font aFont; + OUString aName = rColorSet.getName(); + aFont.SetFontHeight(LABEL_TEXT_HEIGHT); + pVirtualDev->SetFont(aFont); + + Size aTextSize(pVirtualDev->GetTextWidth(aName), pVirtualDev->GetTextHeight()); + + Point aPoint((aNameRect.GetWidth() / 2.0) - (aTextSize.Width() / 2.0), + (aNameRect.GetHeight() / 2.0) - (aTextSize.Height() / 2.0)); + + pVirtualDev->DrawText(aPoint, aName); + + pVirtualDev->SetLineColor(COL_LIGHTGRAY); + pVirtualDev->SetFillColor(); for (sal_uInt32 i = 0; i < 12; i += 2) { @@ -392,6 +415,8 @@ BitmapEx GenerateColorPreview(const svx::ColorSet& rColorSet) pVirtualDev->DrawRect(tools::Rectangle(x, y2, x + SIZE, y2 + SIZE)); x += SIZE + BORDER; + if (i == 2 || i == 8) + x += BORDER; } return pVirtualDev->GetBitmapEx(Point(), aSize); @@ -419,6 +444,7 @@ ThemePanel::ThemePanel(weld::Widget* pParent) { mxValueSetColors->SetColCount(2); mxValueSetColors->SetLineCount(3); + mxValueSetColors->SetColor(Application::GetSettings().GetStyleSettings().GetFaceColor()); mxApplyButton->connect_clicked(LINK(this, ThemePanel, ClickHdl)); mxListBoxFonts->connect_row_activated(LINK(this, ThemePanel, DoubleClickHdl)); commit 8d02d87a4d04b46607844c427db414b769355381 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Sep 24 12:30:10 2015 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:16 2021 +0900 StylePresets: set bacground color for ValueSet Change-Id: Ifbaab139235dbe2fdcebf278bce2c91c2b744aa6 diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx index 79b1b93ed34c..981f26b3e839 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx @@ -13,8 +13,9 @@ #include "StylePresetsPanel.hxx" #include <vcl/image.hxx> -#include <vcl/virdev.hxx> +#include <vcl/settings.hxx> #include <vcl/svapp.hxx> +#include <vcl/virdev.hxx> #include <sfx2/objsh.hxx> #include <sfx2/StylePreviewRenderer.hxx> @@ -145,6 +146,7 @@ StylePresetsPanel::StylePresetsPanel(weld::Widget* pParent) { mxValueSet->SetColCount(2); + mxValueSet->SetColor(Application::GetSettings().GetStyleSettings().GetFaceColor()); mxValueSet->SetDoubleClickHdl(LINK(this, StylePresetsPanel, DoubleClickHdl)); RefreshList(); commit 18e3cc3d6aad67209af5ee160fd45c14b46632df Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Sep 23 13:38:38 2015 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:16 2021 +0900 adjust the conversion from theme color type to the color set index Change-Id: I8c54c8935de8acc3e2b302e10327aa2488f9ac85 diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx b/writerfilter/source/dmapper/TDefTableHandler.cxx index 42ab0d61bd83..4bc8faf7e3d5 100644 --- a/writerfilter/source/dmapper/TDefTableHandler.cxx +++ b/writerfilter/source/dmapper/TDefTableHandler.cxx @@ -298,15 +298,15 @@ sal_Int16 TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType) case NS_ooxml::LN_Value_St_ThemeColor_followedHyperlink: return 11; case NS_ooxml::LN_Value_St_ThemeColor_none: - return 12; + return -1; case NS_ooxml::LN_Value_St_ThemeColor_background1: - return 13; + return 0; case NS_ooxml::LN_Value_St_ThemeColor_text1: - return 14; + return 1; case NS_ooxml::LN_Value_St_ThemeColor_background2: - return 15; + return 2; case NS_ooxml::LN_Value_St_ThemeColor_text2: - return 16; + return 3; default: break; } commit 0c22d32b6f085c0bdd635c94862c8adf24978e07 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Sep 23 13:37:43 2015 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:15 2021 +0900 convert tint value from ooxml to the value we support Change-Id: I5a79ca434be16f9dccc5aa6118a7efbf4544f0b1 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index c08e1e130ce1..0542f58ef11f 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -999,7 +999,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_Color_themeTint: if (m_pImpl->GetTopContext()) { - m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_TINT_OR_SHADE, uno::makeAny(sal_Int16(nIntValue * 10000 / 256))); + m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_TINT_OR_SHADE, uno::makeAny(sal_Int16((256 - nIntValue) * 10000 / 256))); } m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeTint", OUString::number(nIntValue, 16)); break; commit 08dd0301fdc4db88dc23067ad127e7e31a9f6032 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Sep 23 13:35:56 2015 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:14 2021 +0900 check that the color index is valid Change-Id: Id5c7c83f50e1611af12f3b25e6c9a335a8353ba0 diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index 8f63588f9622..09a7665950c9 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -231,9 +231,9 @@ void changeFont(SwFormat* pFormat, SwDocStyleSheet const * pStyle, FontSet const void changeColor(SwTextFormatColl* pCollection, svx::ColorSet const& rColorSet, StyleRedefinition* /*pRedefinition*/) { SvxColorItem aColorItem(pCollection->GetColor()); - if (aColorItem.GetThemeIndex() >= 0) + sal_Int16 nIndex = aColorItem.GetThemeIndex(); + if (nIndex >= 0 && nIndex < 12) { - sal_Int16 nIndex = aColorItem.GetThemeIndex(); Color aColor = Color(rColorSet.getColor(nIndex)); aColor.ApplyTintOrShade(aColorItem.GetTintOrShade()); aColorItem.SetValue(aColor); commit 9e236d08406392eb53fe87d3b083372455acadad Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Sep 23 13:33:59 2015 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:13 2021 +0900 swap text and background colors in colorsets Change-Id: I1e1da85d6c58e3ed5ab4c44c2ab0ae7c3b080251 diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx index 0c68d726a017..7a04eb4e6314 100644 --- a/svx/source/styles/ColorSets.cxx +++ b/svx/source/styles/ColorSets.cxx @@ -28,10 +28,10 @@ void ColorSets::init() { { ColorSet aColorSet("Breeze"); - aColorSet.add(0, 0x232629); - aColorSet.add(1, 0xFCFCFC); - aColorSet.add(2, 0x31363B); - aColorSet.add(3, 0xEFF0F1); + aColorSet.add(0, 0xFCFCFC); + aColorSet.add(1, 0x232629); + aColorSet.add(2, 0xEFF0F1); + aColorSet.add(3, 0x31363B); aColorSet.add(4, 0xDA4453); aColorSet.add(5, 0xF47750); aColorSet.add(6, 0xFDBC4B); @@ -44,10 +44,10 @@ void ColorSets::init() } { ColorSet aColorSet("Material Blue"); - aColorSet.add(0, 0x212121); - aColorSet.add(1, 0xFFFFFF); - aColorSet.add(2, 0x37474F); - aColorSet.add(3, 0xECEFF1); + aColorSet.add(0, 0xFFFFFF); + aColorSet.add(1, 0x212121); + aColorSet.add(2, 0xECEFF1); + aColorSet.add(3, 0x37474F); aColorSet.add(4, 0x7986CB); aColorSet.add(5, 0x303F9F); aColorSet.add(6, 0x64B5F6); @@ -60,10 +60,10 @@ void ColorSets::init() } { ColorSet aColorSet("Material Red"); - aColorSet.add(0, 0x212121); - aColorSet.add(1, 0xFFFFFF); - aColorSet.add(2, 0x424242); - aColorSet.add(3, 0xF5F5F5); + aColorSet.add(0, 0xFFFFFF); + aColorSet.add(1, 0x212121); + aColorSet.add(2, 0xF5F5F5); + aColorSet.add(3, 0x424242); aColorSet.add(4, 0xFF9800); aColorSet.add(5, 0xFF6D00); aColorSet.add(6, 0xFF5722); @@ -76,10 +76,10 @@ void ColorSets::init() } { ColorSet aColorSet("Material Green"); - aColorSet.add(0, 0x212121); - aColorSet.add(1, 0xFFFFFF); - aColorSet.add(2, 0x424242); - aColorSet.add(3, 0xF5F5F5); + aColorSet.add(0, 0xFFFFFF); + aColorSet.add(1, 0x212121); + aColorSet.add(2, 0xF5F5F5); + aColorSet.add(3, 0x424242); aColorSet.add(4, 0x009688); aColorSet.add(5, 0x00bfa5); aColorSet.add(6, 0x4caf50); commit c10ce5f10d826873de3657e6a1f0c60032204f0f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Sep 20 19:27:09 2015 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:12 2021 +0900 Support reading back theme color from an ooxml document ooxml supports theme colors and tint/shade value that additionally changed the theme color. Read back which theme color + tint/shade value was applied in the resulting color and add this attributes as properties to be used by writer. In sidebar theme panel the changing the theme colors now doesn't takes this into account and changes the colors correctly. Change-Id: I6703e86b1fc6b2ba07f3023ec48e619aec961ff1 diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx index 011e504ae7f4..c637521dcf2d 100644 --- a/include/editeng/unoprnms.hxx +++ b/include/editeng/unoprnms.hxx @@ -22,6 +22,8 @@ #define UNO_NAME_CHAR_COLOR "CharColor" +#define UNO_NAME_CHAR_COLOR_THEME "CharColorTheme" +#define UNO_NAME_CHAR_COLOR_TINT_OR_SHADE "CharColorTintOrShade" #define UNO_NAME_CHAR_HEIGHT "CharHeight" #define UNO_NAME_CHAR_POSTURE "CharPosture" #define UNO_NAME_CHAR_SHADOWED "CharShadowed" diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 3580a8f416a2..26913359031e 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -1506,7 +1506,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s // SvxAdjustItem { u"" UNO_NAME_PARA_ADJUST, RES_PARATR_ADJUST, cppu::UnoType<sal_Int16>::get(),PropertyAttribute::MAYBEVOID, MID_PARA_ADJUST }, // SvxColorItem - { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, 0 }, + { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_COLOR_RGB }, // SvxShadowedItem { u"" UNO_NAME_CHAR_SHADOWED, RES_CHRATR_SHADOWED, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, // SvxContouredItem diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index 263a712010c0..f873500432e7 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -121,8 +121,10 @@ { u"" UNO_NAME_CHAR_HIGHLIGHT, RES_CHRATR_HIGHLIGHT, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_BACK_COLOR }, \ { u"" UNO_NAME_PARA_BACK_COLOR, RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_BACK_COLOR }, \ { u"" UNO_NAME_CHAR_CASE_MAP, RES_CHRATR_CASEMAP, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, 0 }, \ - { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, 0 }, \ + { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, MID_COLOR_RGB }, \ { u"" UNO_NAME_CHAR_TRANSPARENCE, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_COLOR_ALPHA }, \ + { u"" UNO_NAME_CHAR_COLOR_THEME, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_COLOR_THEME_INDEX }, \ + { u"" UNO_NAME_CHAR_COLOR_TINT_OR_SHADE, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_COLOR_TINT_OR_SHADE }, \ { u"" UNO_NAME_CHAR_STRIKEOUT, RES_CHRATR_CROSSEDOUT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT }, \ { u"" UNO_NAME_CHAR_CROSSED_OUT, RES_CHRATR_CROSSEDOUT, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, MID_CROSSED_OUT }, \ { u"" UNO_NAME_CHAR_ESCAPEMENT, RES_CHRATR_ESCAPEMENT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_ESC }, \ @@ -363,8 +365,10 @@ { u"" UNO_NAME_PARA_GRAPHIC_FILTER, RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER },\ { u"" UNO_NAME_PARA_GRAPHIC_LOCATION, RES_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, \ { u"" UNO_NAME_CHAR_CASE_MAP, RES_CHRATR_CASEMAP, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0},\ - { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, 0},\ + { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_COLOR_RGB }, \ { u"" UNO_NAME_CHAR_TRANSPARENCE, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_ALPHA},\ + { u"" UNO_NAME_CHAR_COLOR_THEME, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_THEME_INDEX }, \ + { u"" UNO_NAME_CHAR_COLOR_TINT_OR_SHADE, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_TINT_OR_SHADE }, \ { u"" UNO_NAME_CHAR_STRIKEOUT, RES_CHRATR_CROSSEDOUT, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},\ { u"" UNO_NAME_CHAR_CROSSED_OUT, RES_CHRATR_CROSSEDOUT, cppu::UnoType<bool>::get() , PROPERTY_NONE, 0},\ { u"" UNO_NAME_CHAR_ESCAPEMENT, RES_CHRATR_ESCAPEMENT, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_ESC },\ @@ -468,8 +472,10 @@ #define COMMON_ACCESSIBILITY_TEXT_ATTRIBUTE \ { u"" UNO_NAME_CHAR_BACK_COLOR, RES_CHRATR_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, \ - { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, 0}, \ + { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_COLOR_RGB }, \ { u"" UNO_NAME_CHAR_TRANSPARENCE, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_ALPHA }, \ + { u"" UNO_NAME_CHAR_COLOR_THEME, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_THEME_INDEX }, \ + { u"" UNO_NAME_CHAR_COLOR_TINT_OR_SHADE, RES_CHRATR_COLOR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_TINT_OR_SHADE }, \ { u"" UNO_NAME_CHAR_CONTOURED, RES_CHRATR_CONTOUR, cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, \ { u"" UNO_NAME_CHAR_EMPHASIS, RES_CHRATR_EMPHASIS_MARK, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_EMPHASIS}, \ { u"" UNO_NAME_CHAR_ESCAPEMENT, RES_CHRATR_ESCAPEMENT, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_ESC }, \ diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index 3ff74fcdb016..8f63588f9622 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -228,13 +228,17 @@ void changeFont(SwFormat* pFormat, SwDocStyleSheet const * pStyle, FontSet const } }*/ -void changeColor(SwTextFormatColl* pCollection, svx::ColorSet const & rColorSet, StyleRedefinition* pRedefinition) +void changeColor(SwTextFormatColl* pCollection, svx::ColorSet const& rColorSet, StyleRedefinition* /*pRedefinition*/) { - Color aColor = pRedefinition->getColor(rColorSet); - SvxColorItem aColorItem(pCollection->GetColor()); - aColorItem.SetValue(aColor); - pCollection->SetFormatAttr(aColorItem); + if (aColorItem.GetThemeIndex() >= 0) + { + sal_Int16 nIndex = aColorItem.GetThemeIndex(); + Color aColor = Color(rColorSet.getColor(nIndex)); + aColor.ApplyTintOrShade(aColorItem.GetTintOrShade()); + aColorItem.SetValue(aColor); + pCollection->SetFormatAttr(aColorItem); + } } std::vector<FontSet> initFontSets() diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index fd341dd4d765..c08e1e130ce1 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -989,12 +989,25 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) // footnote or endnote reference id - not needed break; case NS_ooxml::LN_CT_Color_themeColor: + if (m_pImpl->GetTopContext()) + { + sal_Int16 nIndex = TDefTableHandler::getThemeColorTypeIndex(nIntValue); + m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_THEME_INDEX, uno::makeAny(nIndex)); + } m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeColor", TDefTableHandler::getThemeColorTypeString(nIntValue)); break; case NS_ooxml::LN_CT_Color_themeTint: + if (m_pImpl->GetTopContext()) + { + m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_TINT_OR_SHADE, uno::makeAny(sal_Int16(nIntValue * 10000 / 256))); + } m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeTint", OUString::number(nIntValue, 16)); break; case NS_ooxml::LN_CT_Color_themeShade: + if (m_pImpl->GetTopContext()) + { + m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_TINT_OR_SHADE, uno::makeAny(sal_Int16((nIntValue - 256) * 10000 / 256))); + } m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeShade", OUString::number(nIntValue, 16)); break; case NS_ooxml::LN_CT_DocGrid_linePitch: diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 0100313bdf45..08b695a6007d 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -32,6 +32,8 @@ OUString getPropertyName( PropertyIds eId ) case PROP_CHAR_SHADOWED: sName = "CharShadowed"; break; case PROP_CHAR_CASE_MAP: sName = "CharCaseMap"; break; case PROP_CHAR_COLOR: sName = "CharColor"; break; + case PROP_CHAR_COLOR_THEME_INDEX: sName = "CharColorTheme"; break; + case PROP_CHAR_COLOR_TINT_OR_SHADE: sName = "CharColorTintOrShade"; break; case PROP_CHAR_RELIEF: sName = "CharRelief"; break; case PROP_CHAR_UNDERLINE: sName = "CharUnderline"; break; case PROP_CHAR_UNDERLINE_COLOR: sName = "CharUnderlineColor"; break; diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index a6afe0c5313f..09ec7954c8df 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -54,6 +54,8 @@ enum PropertyIds ,PROP_CHAR_CASE_MAP ,PROP_CHAR_CHAR_KERNING ,PROP_CHAR_COLOR + ,PROP_CHAR_COLOR_THEME_INDEX + ,PROP_CHAR_COLOR_TINT_OR_SHADE ,PROP_CHAR_COMBINE_IS_ON ,PROP_CHAR_COMBINE_PREFIX ,PROP_CHAR_COMBINE_SUFFIX diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx b/writerfilter/source/dmapper/TDefTableHandler.cxx index 9d7059feece6..42ab0d61bd83 100644 --- a/writerfilter/source/dmapper/TDefTableHandler.cxx +++ b/writerfilter/source/dmapper/TDefTableHandler.cxx @@ -269,6 +269,50 @@ OUString TDefTableHandler::getThemeColorTypeString(sal_Int32 nType) return OUString(); } +sal_Int16 TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType) +{ + switch (nType) + { + case NS_ooxml::LN_Value_St_ThemeColor_dark1: + return 0; + case NS_ooxml::LN_Value_St_ThemeColor_light1: + return 1; + case NS_ooxml::LN_Value_St_ThemeColor_dark2: + return 2; + case NS_ooxml::LN_Value_St_ThemeColor_light2: + return 3; + case NS_ooxml::LN_Value_St_ThemeColor_accent1: + return 4; + case NS_ooxml::LN_Value_St_ThemeColor_accent2: + return 5; + case NS_ooxml::LN_Value_St_ThemeColor_accent3: + return 6; + case NS_ooxml::LN_Value_St_ThemeColor_accent4: + return 7; + case NS_ooxml::LN_Value_St_ThemeColor_accent5: + return 8; + case NS_ooxml::LN_Value_St_ThemeColor_accent6: + return 9; + case NS_ooxml::LN_Value_St_ThemeColor_hyperlink: + return 10; + case NS_ooxml::LN_Value_St_ThemeColor_followedHyperlink: + return 11; + case NS_ooxml::LN_Value_St_ThemeColor_none: + return 12; + case NS_ooxml::LN_Value_St_ThemeColor_background1: + return 13; + case NS_ooxml::LN_Value_St_ThemeColor_text1: + return 14; + case NS_ooxml::LN_Value_St_ThemeColor_background2: + return 15; + case NS_ooxml::LN_Value_St_ThemeColor_text2: + return 16; + default: + break; + } + return -1; +} + void TDefTableHandler::lcl_attribute(Id rName, Value & rVal) { sal_Int32 nIntValue = rVal.getInt(); diff --git a/writerfilter/source/dmapper/TDefTableHandler.hxx b/writerfilter/source/dmapper/TDefTableHandler.hxx index 17e6f2ed4fab..f9ae47eb5390 100644 --- a/writerfilter/source/dmapper/TDefTableHandler.hxx +++ b/writerfilter/source/dmapper/TDefTableHandler.hxx @@ -66,6 +66,7 @@ public: css::beans::PropertyValue getInteropGrabBag(const OUString& aName = OUString()); static OUString getBorderTypeString(sal_Int32 nType); static OUString getThemeColorTypeString(sal_Int32 nType); + static sal_Int16 getThemeColorTypeIndex(sal_Int32 nType); }; } commit 8679a2be2c295abb011311cf263b7636bbdc729c Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Sep 20 19:20:59 2015 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Wed Jun 16 23:05:10 2021 +0900 Theme color and tint/shade attribute for SvxColorItem To support theme colors the SvxColorItem must be extended with an optional attribute theme index to define the index to which theme color current color belongs and an optional tint/shade attribute define how much the color ha been additionally tinted or shaded. Change-Id: I87b7788ead25f956eeec835ba80df5e913790697 diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 53f5328890b2..ac87db3a2573 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1311,14 +1311,18 @@ bool SvxContourItem::GetPresentation // class SvxColorItem ---------------------------------------------------- SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : - SfxPoolItem( nId ), - mColor( COL_BLACK ) + SfxPoolItem(nId), + mColor( COL_BLACK ), + maThemeIndex(-1), + maTintShade(0) { } SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) : SfxPoolItem( nId ), - mColor( rCol ) + mColor( rCol ), + maThemeIndex(-1), + maTintShade(0) { } @@ -1329,8 +1333,11 @@ SvxColorItem::~SvxColorItem() bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); + const SvxColorItem& rColorItem = static_cast<const SvxColorItem&>(rAttr); - return mColor == static_cast<const SvxColorItem&>( rAttr ).mColor; + return mColor == rColorItem.mColor && + maThemeIndex == rColorItem.maThemeIndex && + maTintShade == rColorItem.maTintShade; } bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const @@ -1349,6 +1356,16 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= mColor.GetAlpha() == 0; break; } + case MID_COLOR_THEME_INDEX: + { + rVal <<= maThemeIndex; + break; + } + case MID_COLOR_TINT_OR_SHADE: + { + rVal <<= maTintShade; + break; + } default: { rVal <<= mColor; @@ -1379,11 +1396,29 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) mColor.SetAlpha( Any2Bool( rVal ) ? 0 : 255 ); return true; } + case MID_COLOR_THEME_INDEX: + { + sal_Int16 nIndex = -1; + if (!(rVal >>= nIndex)) + return false; + maThemeIndex = nIndex; + } + break; + case MID_COLOR_TINT_OR_SHADE: + { + sal_Int16 nTintShade = -1; + if (!(rVal >>= nTintShade)) + return false; + maTintShade = nTintShade; + } + break; default: { return rVal >>= mColor; } + break; } + return true; } SvxColorItem* SvxColorItem::Clone( SfxItemPool * ) const diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index 630648adea19..cdd697a2a467 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -31,6 +31,8 @@ class EDITENG_DLLPUBLIC SvxColorItem : public SfxPoolItem { private: Color mColor; + sal_Int16 maThemeIndex; + sal_Int16 maTintShade; public: static SfxPoolItem* CreateDefault(); @@ -57,6 +59,26 @@ public: } void SetValue(const Color& rNewColor); + sal_Int16 GetThemeIndex() const + { + return maThemeIndex; + } + + void SetThemeIndex(sal_Int16 nIndex) + { + maThemeIndex = nIndex; + } + + sal_Int16 GetTintOrShade() const + { + return maTintShade; + } + + void SetTintOrShade(sal_Int16 nTintOrShade) + { + maTintShade = nTintOrShade; + } + void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h index 8a6c9d0e7769..860e86580a1b 100644 --- a/include/editeng/memberids.h +++ b/include/editeng/memberids.h @@ -178,8 +178,11 @@ #define MID_SHADOW_TRANSPARENCE 1 // SvxColorItem -#define MID_COLOR_RGB 0 -#define MID_COLOR_ALPHA 1 +#define MID_COLOR_RGB 0 +#define MID_COLOR_ALPHA 1 +#define MID_COLOR_THEME_INDEX 2 +#define MID_COLOR_TINT_OR_SHADE 3 + #endif diff --git a/offapi/com/sun/star/style/CharacterProperties.idl b/offapi/com/sun/star/style/CharacterProperties.idl index 2f8a87448a33..b9fb1e7a1ca9 100644 --- a/offapi/com/sun/star/style/CharacterProperties.idl +++ b/offapi/com/sun/star/style/CharacterProperties.idl @@ -468,6 +468,18 @@ published service CharacterProperties */ [optional, property] short CharTransparence; + /** If available, keeps the color theme index, so that the character can + * be re-colored easily based on a theme. + * + * @since LibreOffice 7.2 + **/ + [optional, property] short CharColorTheme; + + /** Tint or shade of the character color. + * + * @since LibreOffice 7.2 + **/ + [optional, property] short CharColorTintOrShade; }; }; }; }; }; diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index 549ffc3f3227..321d84019568 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -164,12 +164,19 @@ enum SvxShadowLocation }; item SvxShadowLocation SvxShadowLocationItem; +struct SvxColor +{ + INT32 ColorValue MID_COLOR_RGB; + INT16 ThemeIndex MID_COLOR_THEME_INDEX; + INT16 ThemeTintOrShade MID_COLOR_TINT_OR_SHADE; +}; +item SvxColor SvxColorItem; + item INT16 SvxCharScaleWidthItem; item INT16 SvxParaVertAlignItem; item INT16 SvxCharReliefItem; item BOOL SvxBlinkItem; item BOOL SvxAutoKernItem; -item INT32 SvxColorItem; item BOOL SvxContourItem; item INT16 SvxFormatBreakItem; // enum item BOOL SvxFormatKeepItem; commit e52bbca626e2cbe2f4d13632f65967604abb0abc Author: Noel Grandin <n...@peralex.com> AuthorDate: Tue Jun 15 15:27:40 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jun 16 15:15:32 2021 +0200 tdf#135316 docx open performance avoid unnecessary SwNumFormat creation Change-Id: I62a16fdeb1225606a54f384e5196e5137e8d2139 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117271 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index eb84b1b63a68..00eeed63ec70 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -916,10 +916,15 @@ SvxNumRule SwNumRule::MakeSvxNumRule() const meRuleType == NUM_RULE ? SvxNumRuleType::NUMBERING : SvxNumRuleType::OUTLINE_NUMBERING ); for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) { - SwNumFormat aNumFormat = Get(n); - if(aNumFormat.GetCharFormat()) - aNumFormat.SetCharFormatName(aNumFormat.GetCharFormat()->GetName()); - aRule.SetLevel(n, aNumFormat, maFormats[n] != nullptr); + const SwNumFormat & rNumFormat = Get(n); + if(rNumFormat.GetCharFormat()) + { + SwNumFormat aNewFormat = rNumFormat; + aNewFormat.SetCharFormatName(rNumFormat.GetCharFormat()->GetName()); + aRule.SetLevel(n, aNewFormat, maFormats[n] != nullptr); + } + else + aRule.SetLevel(n, rNumFormat, maFormats[n] != nullptr); } return aRule; } commit 736a2db98bbf7222bfec3dcff89999ccb71b576e Author: Georgy Litvinov <g...@litvinovg.pro> AuthorDate: Tue Jun 15 00:23:35 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Jun 16 15:07:08 2021 +0200 tdf#38187 Create back link from footnote text to anchor in text Change-Id: I1ddf447975872a45447bfa86d050c886f4191962 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117205 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index f3d9e69ad51b..94014ae13c9a 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1977,27 +1977,50 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() const SwPageFrame* pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() ); // Destination PageNum tools::Rectangle aRect = SwRectToPDFRect(pCurrPage, rDestRect.SVRect()); + // Back link rectangle calculation + const SwPageFrame* fnBodyPage = pCurrPage->getRootFrame()->GetPageByPageNum(nDestPageNum+1); + SwRect fnSymbolRect; + if (fnBodyPage->IsVertical()){ + tools::Long fnSymbolTop = fnBodyPage->GetTopMargin() + fnBodyPage->getFrameArea().Top(); + tools::Long symbolHeight = rDestRect.Top() - fnSymbolTop; + fnSymbolRect = SwRect(rDestRect.Pos().X(),fnSymbolTop,rDestRect.Width(),symbolHeight); + } else { + if (fnBodyPage->IsRightToLeft()){ + tools::Long fnSymbolRight = fnBodyPage->getFrameArea().Right() - fnBodyPage->GetRightMargin(); + tools::Long symbolWidth = fnSymbolRight - rDestRect.Right(); + fnSymbolRect = SwRect(rDestRect.Pos().X(),rDestRect.Pos().Y(),symbolWidth,rDestRect.Height()); + } else { + tools::Long fnSymbolLeft = fnBodyPage->GetLeftMargin() + fnBodyPage->getFrameArea().Left(); + tools::Long symbolWidth = rDestRect.Left() - fnSymbolLeft; + fnSymbolRect = SwRect(fnSymbolLeft,rDestRect.Pos().Y(),symbolWidth,rDestRect.Height()); + } + } + tools::Rectangle aFootnoteSymbolRect = SwRectToPDFRect(pCurrPage, fnSymbolRect.SVRect()); + + // Export back link + const sal_Int32 nBackLinkId = pPDFExtOutDevData->CreateLink(aFootnoteSymbolRect, nDestPageNum); // Destination Export const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest(aRect, nDestPageNum); mrSh.GotoFootnoteAnchor(); - // Link PageNums sal_Int32 aLinkPageNum = CalcOutputPageNum( aLinkRect ); - pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() ); - // Link Export aRect = SwRectToPDFRect(pCurrPage, aLinkRect.SVRect()); const sal_Int32 nLinkId = pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum); - + // Back link destination Export + const sal_Int32 nBackDestId = pPDFExtOutDevData->CreateDest(aRect, aLinkPageNum); // Store link info for tagged pdf output: const IdMapEntry aLinkEntry( aLinkRect, nLinkId ); s_aLinkIdMap.push_back( aLinkEntry ); - // Connect Link and Destination: + // Store backlink info for tagged pdf output: + const IdMapEntry aBackLinkEntry( aFootnoteSymbolRect, nBackLinkId ); + s_aLinkIdMap.push_back( aBackLinkEntry ); + // Connect Links and Destinations: pPDFExtOutDevData->SetLinkDest( nLinkId, nDestId ); + pPDFExtOutDevData->SetLinkDest( nBackLinkId, nBackDestId ); } - } } commit f283ec0bf68734558e903339f2f0d86633cc9a62 Author: Sarper Akdemir <sarper.akde...@collabora.com> AuthorDate: Wed Jun 9 08:24:12 2021 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jun 16 15:06:12 2021 +0200 tdf#59323: pptx export: slide footers roundtrip unit test Roundtrip test that checks the slide footers, and their placeholder indexes. Change-Id: I9c4b819092ac6699617d71538c35b066d6e6f974 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117013 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sd/qa/unit/data/pptx/tdf59323.pptx b/sd/qa/unit/data/pptx/tdf59323.pptx new file mode 100755 index 000000000000..0660c0af4f23 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf59323.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index b2d30225af44..e2cdef3d76f6 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -149,6 +149,7 @@ public: void testTdf118825(); void testTextColumns_tdf140852(); void testTextColumns_3columns(); + void testTdf59323_slideFooters(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -213,6 +214,7 @@ public: CPPUNIT_TEST(testTdf118825); CPPUNIT_TEST(testTextColumns_tdf140852); CPPUNIT_TEST(testTextColumns_3columns); + CPPUNIT_TEST(testTdf59323_slideFooters); CPPUNIT_TEST_SUITE_END(); @@ -1742,6 +1744,41 @@ void SdOOXMLExportTest2::testTextColumns_3columns() tempFile.EnableKillingFile(); } +void SdOOXMLExportTest2::testTdf59323_slideFooters() +{ + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf59323.pptx"), PPTX); + + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDoc->getDrawPages()->getCount()); + + for (int nPageIndex = 0; nPageIndex < 3; nPageIndex++) + { + uno::Reference<drawing::XDrawPage> xPage(getPage(0, xDocShRef)); + uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsFooterVisible").get<bool>()); + CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsDateTimeVisible").get<bool>()); + CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsPageNumberVisible").get<bool>()); + } + + // Test placeholder indexes + xmlDocUniquePtr pXmlDocMaster = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml"); + assertXPath(pXmlDocMaster, "//p:ph [@type='dt']", "idx", "1"); + assertXPath(pXmlDocMaster, "//p:ph [@type='ftr']", "idx", "2"); + assertXPath(pXmlDocMaster, "//p:ph [@type='sldNum']", "idx", "3"); + + xmlDocUniquePtr pXmlDocSlide1 = parseExport(tempFile, "ppt/slides/slide1.xml"); + assertXPath(pXmlDocSlide1, "//p:ph [@type='dt']", "idx", "1"); + assertXPath(pXmlDocSlide1, "//p:ph [@type='ftr']", "idx", "2"); + assertXPath(pXmlDocSlide1, "//p:ph [@type='sldNum']", "idx", "3"); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); commit 25ae0de974befb9c279936046056a850d77e0dca Author: Sarper Akdemir <sarper.akde...@collabora.com> AuthorDate: Wed Jun 9 08:21:27 2021 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jun 16 15:04:50 2021 +0200 tdf#59323: pptx export: add support for slide footers Adds support for exporting slide footers to PPTX. Slide footers are exported as shapes that use placeholder indexes to refer to the shapes on master. To make the references work they are exported to layout slides too. Change-Id: I8bfde520b0aec66405523c719844e69c6fc15b79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117012 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx index fffaa100e00c..8643ff58e841 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -124,6 +124,9 @@ private: @returns Placeholder index */ unsigned CreateNewPlaceholderIndex(const css::uno::Reference<css::drawing::XShape>& rXShape); + css::uno::Reference<css::drawing::XShape> GetReferencedPlaceholderXShape(const PlaceholderType eType, PageType ePageType) const; + void WritePlaceholderReferenceShapes(PowerPointShapeExport& rDML, PageType ePageType); + /// Should we export as .pptm, ie. do we contain macros? bool mbPptm; diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 9bf8069f6dde..b34da51dcfe3 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -28,6 +28,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <comphelper/storagehelper.hxx> +#include <comphelper/xmltools.hxx> #include <sax/fshelper.hxx> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> @@ -57,6 +58,10 @@ #include "pptx-animations.hxx" #include "../ppt/pptanimations.hxx" +#include <svx/svdpage.hxx> +#include <svx/unoapi.hxx> +#include <sdpage.hxx> + #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <utility> @@ -115,7 +120,11 @@ public: ShapeExport& WriteTextShape(const Reference< XShape >& xShape) override; ShapeExport& WriteUnknownShape(const Reference< XShape >& xShape) override; ShapeExport& WritePlaceholderShape(const Reference< XShape >& xShape, PlaceholderType ePlaceholder); + /** Writes a placeholder shape that references the placeholder on the master slide */ + ShapeExport& WritePlaceholderReferenceShape(PlaceholderType ePlaceholder, unsigned nReferencedPlaceholderIdx, PageType ePageType, Reference<XPropertySet>& rXPagePropSet); ShapeExport& WritePageShape(const Reference< XShape >& xShape, PageType ePageType, bool bPresObj); + /** Writes textbody of a placeholder that references the placeholder on the master slide */ + ShapeExport& WritePlaceholderReferenceTextBody(PlaceholderType ePlaceholder, PageType ePageType, const Reference<XPropertySet> xPagePropSet); // helper parts bool WritePlaceholder(const Reference< XShape >& xShape, PlaceholderType ePlaceholder, bool bMaster); @@ -1504,6 +1513,8 @@ void PowerPointExport::WriteShapeTree(const FSHelperPtr& pFS, PageType ePageType } } + if ( ePageType == NORMAL || ePageType == LAYOUT ) + WritePlaceholderReferenceShapes(aDML, ePageType); pFS->endElementNS(XML_p, XML_spTree); } @@ -1596,13 +1607,146 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderShape(const Reference< XShap } mpFS->endElementNS(XML_p, XML_spPr); - WriteTextBox(xShape, XML_p); + WriteTextBox(xShape, XML_p, bUsePlaceholderIndex); + + mpFS->endElementNS(XML_p, XML_sp); + + return *this; +} + +ShapeExport& PowerPointShapeExport::WritePlaceholderReferenceShape( + PlaceholderType ePlaceholder, unsigned nReferencedPlaceholderIdx, PageType ePageType, + Reference<XPropertySet>& rXPagePropSet) +{ + mpFS->startElementNS(XML_p, XML_sp); + + // non visual shape properties + mpFS->startElementNS(XML_p, XML_nvSpPr); + const OString aPlaceholderID("PlaceHolder " + OString::number(mnShapeIdMax++)); + GetFS()->singleElementNS(XML_p, XML_cNvPr, XML_id, OString::number(mnShapeIdMax), XML_name, + aPlaceholderID.getStr()); + + mpFS->startElementNS(XML_p, XML_cNvSpPr); + mpFS->singleElementNS(XML_a, XML_spLocks, XML_noGrp, "1"); + mpFS->endElementNS(XML_p, XML_cNvSpPr); + mpFS->startElementNS(XML_p, XML_nvPr); + + const char* pType = getPlaceholderTypeName(ePlaceholder); + mpFS->singleElementNS(XML_p, XML_ph, XML_type, pType, XML_idx, + OString::number(nReferencedPlaceholderIdx)); + mpFS->endElementNS(XML_p, XML_nvPr); + mpFS->endElementNS(XML_p, XML_nvSpPr); + + // visual shape properties + mpFS->startElementNS(XML_p, XML_spPr); + mpFS->endElementNS(XML_p, XML_spPr); + + WritePlaceholderReferenceTextBody(ePlaceholder, ePageType, rXPagePropSet); mpFS->endElementNS(XML_p, XML_sp); return *this; } +ShapeExport& PowerPointShapeExport::WritePlaceholderReferenceTextBody( + PlaceholderType ePlaceholder, PageType ePageType, const Reference<XPropertySet> xPagePropSet) +{ + mpFS->startElementNS(XML_p, XML_txBody); + mpFS->singleElementNS(XML_a, XML_bodyPr); + mpFS->startElementNS(XML_a, XML_p); + + switch (ePlaceholder) + { + case Header: + break; + case Footer: + { + OUString aFooterText; + if (ePageType == LAYOUT) + { + aFooterText = "Footer"; + } + else + { + xPagePropSet->getPropertyValue("FooterText") >>= aFooterText; + } + mpFS->startElementNS(XML_a, XML_r); + mpFS->startElementNS(XML_a, XML_t); + mpFS->writeEscaped(aFooterText); + mpFS->endElementNS(XML_a, XML_t); + mpFS->endElementNS(XML_a, XML_r); + break; + } + case SlideNumber: + { + OUString aSlideNum; + sal_Int32 nSlideNum = 0; + if (ePageType == LAYOUT) + { + aSlideNum = "<#>"; + } + else + { + xPagePropSet->getPropertyValue("Number") >>= nSlideNum; + aSlideNum = OUString::number(nSlideNum); + } + OString aUUID(comphelper::xml::generateGUIDString()); + mpFS->startElementNS(XML_a, XML_fld, XML_id, aUUID.getStr(), XML_type, "slidenum"); + mpFS->startElementNS(XML_a, XML_t); + mpFS->writeEscaped(aSlideNum); + mpFS->endElementNS(XML_a, XML_t); + mpFS->endElementNS(XML_a, XML_fld); + break; + } + case DateAndTime: + { + OUString aDateTimeType = "datetime1"; + bool bIsDateTimeFixed; + xPagePropSet->getPropertyValue("IsDateTimeFixed") >>= bIsDateTimeFixed; + + if(ePageType != LAYOUT && !bIsDateTimeFixed) + { + sal_Int32 nDateTimeFormat; + xPagePropSet->getPropertyValue("DateTimeFormat") >>= nDateTimeFormat; + + // 4 LSBs represent the date + SvxDateFormat eDate = static_cast<SvxDateFormat>(nDateTimeFormat & 0x0f); + // the 4 bits after the date bits represent the time + SvxTimeFormat eTime = static_cast<SvxTimeFormat>(nDateTimeFormat >> 4); + aDateTimeType = GetDatetimeTypeFromDateTime(eDate, eTime); + + if (aDateTimeType == "datetime") + aDateTimeType = "datetime1"; + } + + if(!bIsDateTimeFixed) + { + OString aUUID(comphelper::xml::generateGUIDString()); + mpFS->startElementNS(XML_a, XML_fld, XML_id, aUUID.getStr(), XML_type, aDateTimeType); + mpFS->endElementNS(XML_a, XML_fld); + } + else + { + OUString aDateTimeText; + xPagePropSet->getPropertyValue("DateTimeText") >>= aDateTimeText; + mpFS->startElementNS(XML_a, XML_r); + mpFS->startElementNS(XML_a, XML_t); + mpFS->writeEscaped(aDateTimeText); + mpFS->endElementNS(XML_a, XML_t); + mpFS->endElementNS(XML_a, XML_r); + } + break; + } + default: + SAL_INFO("sd.eppt", "warning: no defined textbody for referenced placeholder type: " + << ePlaceholder); + } + mpFS->endElementNS(XML_a, XML_p); + mpFS->endElementNS(XML_p, XML_txBody); + + return *this; +} + #define SYS_COLOR_SCHEMES " <a:dk1>\ <a:sysClr val=\"windowText\" lastClr=\"000000\"/>\ </a:dk1>\ @@ -2087,12 +2231,106 @@ void PowerPointExport::WriteDiagram(const FSHelperPtr& pFS, PowerPointShapeExpor pFS->endElementNS(XML_p, XML_graphicFrame); } +void PowerPointExport::WritePlaceholderReferenceShapes(PowerPointShapeExport& rDML, PageType ePageType) +{ + bool bCheckProps = ePageType == NORMAL; + Reference<XShape> xShape; + Any aAny; + OUString aText; + if (ePageType == LAYOUT + || (bCheckProps && PropValue::GetPropertyValue(aAny, mXPagePropSet, "IsFooterVisible", true) + && aAny == true && GetPropertyValue(aAny, mXPagePropSet, "FooterText", true) + && (aAny >>= aText) && !aText.isEmpty())) + { + if ((xShape = GetReferencedPlaceholderXShape(Footer, ePageType))) + rDML.WritePlaceholderReferenceShape(Footer, + maPlaceholderShapeToIndexMap.find(xShape)->second, + ePageType, mXPagePropSet); + } + + if (ePageType == LAYOUT + || (bCheckProps + && PropValue::GetPropertyValue(aAny, mXPagePropSet, "IsPageNumberVisible", true) + && aAny == true)) + { + if ((xShape = GetReferencedPlaceholderXShape(SlideNumber, ePageType))) + rDML.WritePlaceholderReferenceShape(SlideNumber, + maPlaceholderShapeToIndexMap.find(xShape)->second, + ePageType, mXPagePropSet); + } + + if (ePageType == LAYOUT + || (bCheckProps + && PropValue::GetPropertyValue(aAny, mXPagePropSet, "IsDateTimeVisible", true) + && aAny == true + && ((GetPropertyValue(aAny, mXPagePropSet, "DateTimeText", true) && (aAny >>= aText) + && !aText.isEmpty()) + || mXPagePropSet->getPropertyValue("IsDateTimeFixed") == false))) + { + if ((xShape = GetReferencedPlaceholderXShape(DateAndTime, ePageType))) + rDML.WritePlaceholderReferenceShape(DateAndTime, + maPlaceholderShapeToIndexMap.find(xShape)->second, + ePageType, mXPagePropSet); + } +} + unsigned PowerPointExport::CreateNewPlaceholderIndex(const css::uno::Reference<XShape> &rXShape) { maPlaceholderShapeToIndexMap.insert({rXShape, mnPlaceholderIndexMax}); return mnPlaceholderIndexMax++; } +Reference<XShape> PowerPointExport::GetReferencedPlaceholderXShape(const PlaceholderType eType, + PageType ePageType) const +{ + PresObjKind ePresObjKind = PresObjKind::NONE; + switch (eType) + { + case oox::core::None: + break; + case oox::core::SlideImage: + break; + case oox::core::Notes: + break; + case oox::core::Header: + ePresObjKind = PresObjKind::Header; + break; + case oox::core::Footer: + ePresObjKind = PresObjKind::Footer; + break; + case oox::core::SlideNumber: + ePresObjKind = PresObjKind::SlideNumber; + break; + case oox::core::DateAndTime: + ePresObjKind = PresObjKind::DateTime; + break; + case oox::core::Outliner: + break; + case oox::core::Title: + ePresObjKind = PresObjKind::Title; + break; + case oox::core::Subtitle: + break; + } + if (ePresObjKind != PresObjKind::NONE) + { + SdPage* pMasterPage; + if (ePageType == LAYOUT) + { + // since Layout pages do not have drawpages themselves - mXDrawPage is still the master they reference to.. + pMasterPage = SdPage::getImplementation(mXDrawPage); + } + else + { + pMasterPage + = &static_cast<SdPage&>(SdPage::getImplementation(mXDrawPage)->TRG_GetMasterPage()); + } + if (SdrObject* pMasterFooter = pMasterPage->GetPresObj(ePresObjKind)) + return GetXShapeForSdrObject(pMasterFooter); + } + return nullptr; +} + // UNO component extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* css_comp_Impress_oox_PowerPointExport(uno::XComponentContext* rxCtxt, commit fc3c92c82198e7ab56d21fbc896f4153bc8628c1 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jun 16 09:32:27 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 16 15:02:03 2021 +0200 both children are at position 0 instead of one at 0 and the other at 1 Change-Id: I1943d2e68f39fb463d76237d6eb0bffe800a6b6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117313 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/uiconfig/ui/numberingpositionpage.ui b/cui/uiconfig/ui/numberingpositionpage.ui index 885f61ce558f..7c2c3fb30bd9 100644 --- a/cui/uiconfig/ui/numberingpositionpage.ui +++ b/cui/uiconfig/ui/numberingpositionpage.ui @@ -501,7 +501,7 @@ numbering and text:</property> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> commit 6c4e61fcc73574eb5d55cc0bcb3c6ff8d69debc6 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jun 16 09:18:00 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 16 15:01:40 2021 +0200 gtk4: reenable some more working dialogs Change-Id: Iaa8d77b231f8366ff4c33221691e9a3cadb73fa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117312 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index b8ece3292b5d..6e5917a40356 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -22245,12 +22245,15 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "cui/ui/areatabpage.ui" && rUIFile != "cui/ui/autocorrectdialog.ui" && rUIFile != "cui/ui/bitmaptabpage.ui" && + rUIFile != "cui/ui/borderpage.ui" && rUIFile != "cui/ui/breaknumberoption.ui" && rUIFile != "cui/ui/colorpage.ui" && rUIFile != "cui/ui/colorpickerdialog.ui" && rUIFile != "cui/ui/editdictionarydialog.ui" && rUIFile != "cui/ui/eventassigndialog.ui" && rUIFile != "cui/ui/eventassignpage.ui" && + rUIFile != "cui/ui/gradientpage.ui" && + rUIFile != "cui/ui/hatchpage.ui" && rUIFile != "cui/ui/hangulhanjaadddialog.ui" && rUIFile != "cui/ui/hangulhanjaconversiondialog.ui" && rUIFile != "cui/ui/hangulhanjaeditdictdialog.ui" && @@ -22268,13 +22271,20 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "cui/ui/macroassignpage.ui" && rUIFile != "cui/ui/macroselectordialog.ui" && rUIFile != "cui/ui/namedialog.ui" && + rUIFile != "cui/ui/numberingoptionspage.ui" && + rUIFile != "cui/ui/numberingpositionpage.ui" && rUIFile != "cui/ui/objectnamedialog.ui" && rUIFile != "cui/ui/objecttitledescdialog.ui" && rUIFile != "cui/ui/optjsearchpage.ui" && rUIFile != "cui/ui/optlingupage.ui" && rUIFile != "cui/ui/optnewdictionarydialog.ui" && rUIFile != "cui/ui/pastespecial.ui" && + rUIFile != "cui/ui/patterntabpage.ui" && rUIFile != "cui/ui/percentdialog.ui" && + rUIFile != "cui/ui/pickbulletpage.ui" && + rUIFile != "cui/ui/pickgraphicpage.ui" && + rUIFile != "cui/ui/picknumberingpage.ui" && + rUIFile != "cui/ui/pickoutlinepage.ui" && rUIFile != "cui/ui/qrcodegen.ui" && rUIFile != "cui/ui/scriptorganizer.ui" && rUIFile != "cui/ui/searchattrdialog.ui" && @@ -22286,6 +22296,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "cui/ui/thesaurus.ui" && rUIFile != "cui/ui/tipofthedaydialog.ui" && rUIFile != "cui/ui/toolbarmodedialog.ui" && + rUIFile != "cui/ui/transparencytabpage.ui" && rUIFile != "cui/ui/wordcompletionpage.ui" && rUIFile != "cui/ui/zoomdialog.ui" && rUIFile != "filter/ui/pdfgeneralpage.ui" && @@ -22313,6 +22324,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "sfx/ui/password.ui" && rUIFile != "sfx/ui/printeroptionsdialog.ui" && rUIFile != "sfx/ui/safemodequerydialog.ui" && + rUIFile != "sfx/ui/saveastemplatedlg.ui" && rUIFile != "sfx/ui/securityinfopage.ui" && rUIFile != "sfx/ui/singletabdialog.ui" && rUIFile != "sfx/ui/templatecategorydlg.ui" && @@ -22330,6 +22342,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "svx/ui/chineseconversiondialog.ui" && rUIFile != "svx/ui/chinesedictionary.ui" && rUIFile != "svx/ui/colorwindow.ui" && + rUIFile != "svx/ui/docrecoveryprogressdialog.ui" && rUIFile != "svx/ui/docrecoverysavedialog.ui" && rUIFile != "svx/ui/findreplacedialog.ui" && rUIFile != "svx/ui/fontworkgallerydialog.ui" && @@ -22399,6 +22412,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "modules/smath/ui/symdefinedialog.ui" && rUIFile != "modules/swriter/ui/autotext.ui" && rUIFile != "modules/swriter/ui/bibliographyentry.ui" && + rUIFile != "modules/swriter/ui/bulletsandnumbering.ui" && rUIFile != "modules/swriter/ui/columndialog.ui" && rUIFile != "modules/swriter/ui/columnpage.ui" && rUIFile != "modules/swriter/ui/editcategories.ui" && @@ -22407,6 +22421,10 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "modules/swriter/ui/footendnotedialog.ui" && rUIFile != "modules/swriter/ui/footnotepage.ui" && rUIFile != "modules/swriter/ui/footnotesendnotestabpage.ui" && + rUIFile != "modules/swriter/ui/framedialog.ui" && + rUIFile != "modules/swriter/ui/frmaddpage.ui" && + rUIFile != "modules/swriter/ui/frmtypepage.ui" && + rUIFile != "modules/swriter/ui/frmurlpage.ui" && rUIFile != "modules/swriter/ui/gotopagedialog.ui" && rUIFile != "modules/swriter/ui/indentpage.ui" && rUIFile != "modules/swriter/ui/indexentry.ui" && @@ -22429,6 +22447,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "modules/swriter/ui/statisticsinfopage.ui" && rUIFile != "modules/swriter/ui/titlepage.ui" && rUIFile != "modules/swriter/ui/watermarkdialog.ui" && + rUIFile != "modules/swriter/ui/wrappage.ui" && rUIFile != "modules/swriter/ui/wordcount.ui" && rUIFile != "vcl/ui/printdialog.ui" && rUIFile != "vcl/ui/printerdevicepage.ui" && commit 0f9dc676eefce79ea63218edd910af486a09a52b Author: Sarper Akdemir <sarper.akde...@collabora.com> AuthorDate: Wed Jun 9 07:58:44 2021 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jun 16 15:01:19 2021 +0200 tdf#59323: pptx export: add initial support for lstStyles in textboxes Adds initial support for writing lstStyles that are specific to a shape. Current implementation only writes first paragraph and first textruns properties in it. Made WriteParagraphProperties return a bool that determines whether or not it wrote a pPr tag. Needed this since lvl1pPr tag should be started even if there was no paragraph properties since run properties also written inside it. Change-Id: Ie0cfc9b9f221093db3a1111ca29140a6dfb5e8ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117011 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 7f6de9f99006..c90e1c06a844 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -276,10 +276,19 @@ public: void WriteTransformation(const css::uno::Reference< css::drawing::XShape >& xShape, const tools::Rectangle& rRectangle, sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0, bool bIsGroupShape = false); - void WriteText( const css::uno::Reference< css::uno::XInterface >& rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0); + void WriteText( const css::uno::Reference< css::uno::XInterface >& rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0, bool bWritePropertiesAsLstStyles = false); + + /** Populates the lstStyle with the shape's text run and paragraph properties */ + void WriteLstStyles(const css::uno::Reference<css::text::XTextContent>& rParagraph, + bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, + const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet); void WriteParagraph( const css::uno::Reference< css::text::XTextContent >& rParagraph, bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet); - void WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, float fFirstCharHeight); + /** Writes paragraph properties + + @returns true if any paragraph properties were written + */ + bool WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, float fFirstCharHeight, const sal_Int32 nElement = XML_pPr ); void WriteParagraphNumbering(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight, sal_Int16 nLevel ); void WriteParagraphTabStops(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet); diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx index 6ac3aa754cc5..3e9bf364d400 100644 --- a/include/oox/export/shapes.hxx +++ b/include/oox/export/shapes.hxx @@ -179,7 +179,7 @@ public: * @return <tt>*this</tt> */ ShapeExport& WriteShape( const css::uno::Reference< css::drawing::XShape >& xShape ); - ShapeExport& WriteTextBox( const css::uno::Reference< css::uno::XInterface >& xIface, sal_Int32 nXmlNamespace ); + ShapeExport& WriteTextBox( const css::uno::Reference< css::uno::XInterface >& xIface, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles = false ); virtual ShapeExport& WriteTextShape( const css::uno::Reference< css::drawing::XShape >& xShape ); ShapeExport& diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 26598636efbd..76874c5b1493 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1899,7 +1899,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool else if (GetProperty(rXPropSet, "CharHeight")) { nSize = static_cast<sal_Int32>(100*(*o3tl::doAccess<float>(mAny))); - if ( nElement == XML_rPr ) + if ( nElement == XML_rPr || nElement == XML_defRPr ) { rbOverridingCharHeight = true; rnCharHeight = nSize; @@ -2822,14 +2822,14 @@ void DrawingML::WriteLinespacing( const LineSpacing& rSpacing ) } } -void DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rParagraph, float fFirstCharHeight) +bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 nElement) { Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY ); Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY ); PropertyState eState; if( !rXPropSet.is() || !rXPropState.is() ) - return; + return false; sal_Int16 nLevel = -1; if (GetProperty(rXPropSet, "NumberingLevel")) @@ -2878,17 +2878,17 @@ void DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara if( !(nLevel != -1 || nAlignment != style::ParagraphAdjust_LEFT || bHasLinespacing) ) - return; + return false; if (nParaLeftMargin) // For Paragraph - mpFS->startElementNS( XML_a, XML_pPr, + mpFS->startElementNS( XML_a, nElement, XML_lvl, sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0), XML_marL, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nParaLeftMargin)), nParaLeftMargin > 0), XML_indent, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nParaFirstLineIndent)), nParaFirstLineIndent != 0), XML_algn, GetAlignment( nAlignment ), XML_rtl, sax_fastparser::UseIf(ToPsz10(bRtl), bRtl)); else - mpFS->startElementNS( XML_a, XML_pPr, + mpFS->startElementNS( XML_a, nElement, XML_lvl, sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0), XML_marL, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeftMargin)), nLeftMargin > 0), XML_indent, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLineIndentation)), nLineIndentation != 0), @@ -2927,7 +2927,50 @@ void DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara WriteParagraphTabStops( rXPropSet ); - mpFS->endElementNS( XML_a, XML_pPr ); + // do not end element for lstStyles since, defRPr should be stacked inside it + if( nElement != XML_lvl1pPr ) + mpFS->endElementNS( XML_a, nElement ); + + return true; +} + +void DrawingML::WriteLstStyles(const css::uno::Reference<css::text::XTextContent>& rParagraph, + bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, + const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet) +{ + Reference<XEnumerationAccess> access(rParagraph, UNO_QUERY); + if (!access.is()) + return; + + Reference<XEnumeration> enumeration(access->createEnumeration()); + if (!enumeration.is()) + return; + + + Reference<XTextRange> rRun; + + if (enumeration->hasMoreElements()) + { + Any aAny(enumeration->nextElement()); + if (aAny >>= rRun) + { + float fFirstCharHeight = rnCharHeight / 1000.; + Reference<XPropertySet> xFirstRunPropSet(rRun, UNO_QUERY); + Reference<XPropertySetInfo> xFirstRunPropSetInfo + = xFirstRunPropSet->getPropertySetInfo(); + + if (xFirstRunPropSetInfo->hasPropertyByName("CharHeight")) + fFirstCharHeight = xFirstRunPropSet->getPropertyValue("CharHeight").get<float>(); + + mpFS->startElementNS(XML_a, XML_lstStyle); + if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_lvl1pPr) ) + mpFS->startElementNS(XML_a, XML_lvl1pPr); + WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, rbOverridingCharHeight, + rnCharHeight, GetScriptType(rRun->getString()), rXShapePropSet); + mpFS->endElementNS(XML_a, XML_lvl1pPr); + mpFS->endElementNS(XML_a, XML_lstStyle); + } + } } void DrawingML::WriteParagraph( const Reference< XTextContent >& rParagraph, @@ -3005,7 +3048,7 @@ bool DrawingML::IsFontworkShape(const css::uno::Reference<css::beans::XPropertyS } void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bool bText, - sal_Int32 nXmlNamespace) + sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles) { // ToDo: Fontwork in DOCX Reference< XText > xXText( rXIface, UNO_QUERY ); @@ -3433,6 +3476,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo bool bOverridingCharHeight = false; sal_Int32 nCharHeight = -1; + bool bFirstParagraph = true; while( enumeration->hasMoreElements() ) { @@ -3440,7 +3484,13 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo Any any ( enumeration->nextElement() ); if( any >>= paragraph) - WriteParagraph( paragraph, bOverridingCharHeight, nCharHeight, rXPropSet ); + { + if (bFirstParagraph && bWritePropertiesAsLstStyles) + WriteLstStyles(paragraph, bOverridingCharHeight, nCharHeight, rXPropSet); + + WriteParagraph(paragraph, bOverridingCharHeight, nCharHeight, rXPropSet); + bFirstParagraph = false; + } } } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index f45b0aabc61d..323b0ebcc2f5 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1552,7 +1552,7 @@ ShapeExport& ShapeExport::WriteShape( const Reference< XShape >& xShape ) return *this; } -ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, sal_Int32 nXmlNamespace ) +ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles ) { // In case this shape has an associated textbox, then export that, and we're done. if (GetDocumentType() == DOCUMENT_DOCX && GetTextExport()) @@ -1577,7 +1577,7 @@ ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, s pFS->startElementNS(nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_txBody : XML_txbx)); - WriteText( xIface, /*bBodyPr=*/(GetDocumentType() != DOCUMENT_DOCX) ); + WriteText( xIface, /*bBodyPr=*/(GetDocumentType() != DOCUMENT_DOCX), true, 0, bWritePropertiesAsLstStyles ); pFS->endElementNS( nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_txBody : XML_txbx) ); if (GetDocumentType() == DOCUMENT_DOCX) WriteText( xIface, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace ); commit 560eea7be7668af90e75c4dee2a2f16cbdbf0945 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jun 16 09:08:55 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 16 15:01:02 2021 +0200 set default width/height of minimum for dialog Change-Id: I25ea3a44f7bda7916bb129e7642150c80b9dab11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117291 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/uiconfig/swriter/ui/framedialog.ui b/sw/uiconfig/swriter/ui/framedialog.ui index c70ff1971854..9adc58ab67bc 100644 --- a/sw/uiconfig/swriter/ui/framedialog.ui +++ b/sw/uiconfig/swriter/ui/framedialog.ui @@ -7,6 +7,8 @@ <property name="border-width">6</property> <property name="title" translatable="yes" context="framedialog|FrameDialog">Frame</property> <property name="modal">True</property> + <property name="default-width">0</property> + <property name="default-height">0</property> <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> commit e7185e1994055672ff338974fe8ccb98daa947dd Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jun 16 09:08:29 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 16 15:00:43 2021 +0200 resave with latest glade Change-Id: I736005e7a6d669dea75347bddcd8114ceea4fe33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117290 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/uiconfig/swriter/ui/framedialog.ui b/sw/uiconfig/swriter/ui/framedialog.ui index d16d1fe4c87b..c70ff1971854 100644 --- a/sw/uiconfig/swriter/ui/framedialog.ui +++ b/sw/uiconfig/swriter/ui/framedialog.ui @@ -1,31 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.38.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.20"/> <object class="GtkDialog" id="FrameDialog"> - <property name="can_focus">False</property> - <property name="border_width">6</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> <property name="title" translatable="yes" context="framedialog|FrameDialog">Frame</property> <property name="modal">True</property> - <property name="type_hint">dialog</property> - <child> - <placeholder/> - </child> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="can-focus">False</property> + <property name="layout-style">end</property> <child> <object class="GtkButton" id="reset"> <property name="label" translatable="yes" context="stock">_Reset</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -38,10 +35,10 @@ <object class="GtkButton" id="ok"> <property name="label" translatable="yes" context="stock">_OK</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -54,8 +51,8 @@ <object class="GtkButton" id="cancel"> <property name="label" translatable="yes" context="stock">_Cancel</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -68,8 +65,8 @@ <object class="GtkButton" id="help"> <property name="label" translatable="yes" context="stock">_Help</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -83,47 +80,23 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkNotebook" id="tabcontrol"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="scrollable">True</property> - <property name="enable_popup">True</property> + <property name="enable-popup">True</property> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -132,42 +105,18 @@ <child type="tab"> <object class="GtkLabel" id="type"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|type">Type</property> </object> <packing> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -179,43 +128,19 @@ <child type="tab"> <object class="GtkLabel" id="options"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|options">Options</property> </object> <packing> <property name="position">1</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -227,43 +152,19 @@ <child type="tab"> <object class="GtkLabel" id="wrap"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|wrap">Wrap</property> </object> <packing> <property name="position">2</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -275,43 +176,19 @@ <child type="tab"> <object class="GtkLabel" id="hyperlink"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|hyperlink">Hyperlink</property> </object> <packing> <property name="position">3</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -323,43 +200,19 @@ <child type="tab"> <object class="GtkLabel" id="borders"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|borders">Borders</property> </object> <packing> <property name="position">4</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -371,43 +224,19 @@ <child type="tab"> <object class="GtkLabel" id="area"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|area">Area</property> </object> <packing> <property name="position">5</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -419,43 +248,19 @@ <child type="tab"> <object class="GtkLabel" id="transparence"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|transparence">Transparency</property> </object> <packing> <property name="position">6</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -467,43 +272,19 @@ <child type="tab"> <object class="GtkLabel" id="columns"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|columns">Columns</property> </object> <packing> <property name="position">7</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> + <property name="can-focus">False</property> <child> <placeholder/> </child> @@ -515,12 +296,12 @@ <child type="tab"> <object class="GtkLabel" id="macro"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="framedialog|macro">Macro</property> </object> <packing> <property name="position">8</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> </object> commit 3b8fb0ba187ad8b0a5eb6102dcfd982aee6db9f5 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jun 16 08:48:35 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jun 16 15:00:16 2021 +0200 gtk 4.3.2 will have a fix for this Change-Id: Idae818c0d7220d0fbe08462eff1654c22d24310c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117284 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx index ce9af84251d5..0e8c697ee753 100644 --- a/vcl/unx/gtk4/convert3to4.cxx +++ b/vcl/unx/gtk4/convert3to4.cxx @@ -1341,13 +1341,16 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode xNode->removeChild(xRemove); // https://gitlab.gnome.org/GNOME/gtk/-/issues/4041 double encode ampersands if use-underline is used - if (xPropertyLabel && bUseUnderline) + if (gtk_check_version(4, 3, 2) != nullptr) { - OString sText = xPropertyLabel->getFirstChild()->getNodeValue().toUtf8(); - gchar* pText = g_markup_escape_text(sText.getStr(), sText.getLength()); - xPropertyLabel->getFirstChild()->setNodeValue( - OUString(pText, strlen(pText), RTL_TEXTENCODING_UTF8)); - g_free(pText); + if (xPropertyLabel && bUseUnderline) + { + OString sText = xPropertyLabel->getFirstChild()->getNodeValue().toUtf8(); + gchar* pText = g_markup_escape_text(sText.getStr(), sText.getLength()); + xPropertyLabel->getFirstChild()->setNodeValue( + OUString(pText, strlen(pText), RTL_TEXTENCODING_UTF8)); + g_free(pText); + } } return ConvertResult(bChildCanFocus, bHasVisible, bHasIconSize, bAlwaysShowImage, bUseUnderline, commit 1178d2978d3328de0bf0bccb9920fbc8b9a3a414 Author: Sarper Akdemir <sarper.akde...@collabora.com> AuthorDate: Wed Jun 9 07:54:04 2021 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jun 16 14:56:21 2021 +0200 tdf#59323: pptx export: add placeholder index to master footer placeholders OOXML uses placeholder index to determine from which layout placeholder it should be inheriting styles, position etc. Added maPlaceholderShapeToIndexMap that stores corresponding Placeholder index for a Placeholder XShape on the master slide. Right now only used for placeholder types Footer, DateAndTime and SlideNumber. Change-Id: If788f235d00b6d1cde7194d9e4a0789e019432c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117010 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx index 93029f073487..fffaa100e00c 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -118,6 +118,12 @@ private: static void WriteDiagram(const FSHelperPtr& pFS, PowerPointShapeExport& rDML, const css::uno::Reference<css::drawing::XShape>& rXShape, int nDiagramId); + /** Create a new placeholder index for a master placeholder shape + ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits