[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - editeng/source
editeng/source/editeng/editattr.cxx |2 +- editeng/source/editeng/editdoc.cxx |7 +-- 2 files changed, 6 insertions(+), 3 deletions(-) New commits: commit aa8d68f9764eb7714871de7c56b5a0ca7c2ead8b Author: Maxim Monastirsky AuthorDate: Wed May 31 21:59:06 2023 +0300 Commit: Xisco Fauli CommitDate: Wed Nov 1 21:56:33 2023 +0100 tdf#103064 editeng: fix handling of char highlighting Transparency should be set to false if a color is present, but not with COL_TRANSPARENT. Compare with what is done for shape text in VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D. Change-Id: I5e4c8e53b53a363813ced50358c5ee795cdb61dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153107 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit 9474ff4cc0abbd16f91ea582050c2332bdad88a3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158699 Reviewed-by: Xisco Fauli diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index 3277ed0916ba..42e5f20206ba 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -230,7 +230,7 @@ EditCharAttribBackgroundColor::EditCharAttribBackgroundColor( void EditCharAttribBackgroundColor::SetFont( SvxFont& rFont, OutputDevice* ) { Color aColor = static_cast(GetItem())->GetValue(); -rFont.SetTransparent(false); +rFont.SetTransparent(aColor == COL_TRANSPARENT); rFont.SetFillColor(aColor); } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 9fff222d9368..08750a94fcd2 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1976,7 +1976,6 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S { vcl::Font aPrevFont( rFont ); rFont.SetAlignment( ALIGN_BASELINE ); -rFont.SetTransparent( true ); sal_uInt16 nWhich_FontInfo = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ); sal_uInt16 nWhich_Language = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ); @@ -1997,7 +1996,11 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_COLOR ) == SfxItemState::SET ) ) rFont.SetColor( rSet.Get( EE_CHAR_COLOR ).GetValue() ); if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == SfxItemState::SET ) ) -rFont.SetFillColor( rSet.Get( EE_CHAR_BKGCOLOR ).GetValue() ); +{ +auto& aColor = rSet.Get( EE_CHAR_BKGCOLOR ).GetValue(); +rFont.SetTransparent(aColor == COL_TRANSPARENT); +rFont.SetFillColor(aColor); +} if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == SfxItemState::SET ) ) rFont.SetFontSize( Size( rFont.GetFontSize().Width(), static_cast(rSet.Get( nWhich_FontHeight ) ).GetHeight() ) ); if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == SfxItemState::SET ) )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/sfx2 include/svx sfx2/Library_sfx.mk sfx2/source svx/inc svx/source
include/sfx2/namedcolor.hxx| 57 + include/sfx2/objsh.hxx |4 ++ include/svx/Palette.hxx| 50 include/svx/PaletteManager.hxx |1 include/svx/colorwindow.hxx|3 - include/svx/tbcontrl.hxx |1 sfx2/Library_sfx.mk|1 sfx2/source/doc/objcont.cxx| 15 sfx2/source/inc/objshimp.hxx |4 ++ svx/inc/tbxcolorupdate.hxx |8 +++- svx/source/tbxctrls/PaletteManager.cxx |9 - svx/source/tbxctrls/tbcontrl.cxx | 15 +--- svx/source/tbxctrls/tbxcolorupdate.cxx | 57 +++-- 13 files changed, 145 insertions(+), 80 deletions(-) New commits: commit 1345619e0b3c2825c2ae50ada2c209d4ad8461ad Author: Maxim Monastirsky AuthorDate: Sun Jul 2 17:31:38 2023 +0300 Commit: Xisco Fauli CommitDate: Wed Sep 6 09:37:18 2023 +0200 tdf#154270 Sync toolbar button recent colors As the last used color is stored per button instance, these will go out of sync with several buttons being visible (e.g. a toolbar and a sidebar, or a toolbar overflow popup), and will reset whenever the toolbar resets (e.g. change in selection, switch from print preview, or customization). Fix that by storing the last colors per-document, and notifying other buttons on changes. Keep the last color also stored per-button for now, as a fallback for reportdesign (which isn't sfx2 based). Change-Id: I866f1de5c8ff6f56c47dc4b6b5acf52957d4e6c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153943 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156519 diff --git a/include/sfx2/namedcolor.hxx b/include/sfx2/namedcolor.hxx new file mode 100644 index ..fc7941686fbd --- /dev/null +++ b/include/sfx2/namedcolor.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include + +#include +#include + +struct SFX2_DLLPUBLIC NamedColor +{ +Color m_aColor; +OUString m_aName; +sal_Int16 m_nThemeIndex = -1; +sal_Int16 m_nLumMod = 1; +sal_Int16 m_nLumOff = 0; + +NamedColor() = default; + +NamedColor(Color const& rColor, OUString const& rName) +: m_aColor(rColor) +, m_aName(rName) +{ +} + +model::ComplexColor getComplexColor() +{ +model::ComplexColor aComplexColor; + +auto eThemeColorType = model::convertToThemeColorType(m_nThemeIndex); + +if (eThemeColorType != model::ThemeColorType::Unknown) +{ +aComplexColor.setSchemeColor(eThemeColorType); + +if (m_nLumMod != 1) +aComplexColor.addTransformation({ model::TransformationType::LumMod, m_nLumMod }); + +if (m_nLumMod != 0) +aComplexColor.addTransformation({ model::TransformationType::LumOff, m_nLumOff }); +} + +aComplexColor.setFinalColor(m_aColor); + +return aComplexColor; +} +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index b29fb43d77e4..9b7db5347597 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -47,6 +47,7 @@ namespace weld {class Button; } namespace model {class ColorSet; } +struct NamedColor; class SbxValue; class SbxArray; class BasicManager; @@ -558,6 +559,9 @@ public: GetDialogContainer(); StarBASIC* GetBasic() const; +std::optional GetRecentColor(sal_uInt16 nSlotId); +void SetRecentColor(sal_uInt16 nSlotId, const NamedColor& rColor); + virtual std::set GetDocColors(); virtual std::shared_ptr GetThemeColors(); diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index c108a1679d98..5bf63762b75c 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -20,60 +20,12 @@ #pragma once #include +#include #include -#include -#include -#include - -#include -#include - class SvxColorValueSet; -struct SVXCORE_DLLPUBLIC NamedColor -{ -Color m_aColor; -OUString m_aName; -sal_Int16 m_nThemeIndex = -1; -sal_Int16 m_nLumMod = 1; -sal_Int16 m_nLumOff = 0; - -NamedColor() = default; - -NamedColor(Color const& rColor, OUString const& rName) -: m_aColor(rColor) -, m_aName(rName) -{} -
[Libreoffice-commits] core.git: 2 commits - reportdesign/source sw/source
reportdesign/source/ui/report/ReportController.cxx |3 +-- sw/source/uibase/shells/textsh1.cxx|3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 6591a83a6e6bfaed336c11ea6f928e8764b6563d Author: Maxim Monastirsky AuthorDate: Thu Jul 6 12:43:52 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jul 7 09:51:32 2023 +0200 Fix .uno:CharBackColor status update We have the editeng pool set as our secondary, and it maps SID_ATTR_CHAR_BACK_COLOR to EE_CHAR_BKGCOLOR, which then can't be found in the switch in SwTextShell::GetState. But handling EE_CHAR_BKGCOLOR here will be very confusing for anyone reading this code, so let's map it back to the slot id. Without this fix, the current highlighting color isn't preselected in the toolbar dropdown. Change-Id: I85e5ceb6d2193f831928f224577d6f87e889981f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154102 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index da8b94a33d7b..abf5caee862d 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -2162,7 +2162,8 @@ void SwTextShell::GetState( SfxItemSet &rSet ) sal_uInt16 nWhich = aIter.FirstWhich(); while ( nWhich ) { -switch ( nWhich ) +const sal_uInt16 nSlotId = GetPool().GetSlotId(nWhich); +switch (nSlotId) { case FN_FORMAT_CURRENT_FOOTNOTE_DLG: if( !rSh.IsCursorInFootnote() ) commit 371f9131f15e41b1f121f26478ab997d13afc56a Author: Maxim Monastirsky AuthorDate: Thu Jul 6 13:44:07 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jul 7 09:51:26 2023 +0200 reportdesign: Fix setting font color from the toolbar dropdown Seems like a recent regression from changing the argument name in PaletteManager::DispatchColorCommand. Change-Id: I2756a2c615398d40b15991cad2982cc80d6f6a99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154150 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index cc3a096b3046..873d17c353c1 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -1469,8 +1469,7 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > case SID_ATTR_CHAR_COLOR2: case SID_ATTR_CHAR_COLOR_EXT: { -const SequenceAsHashMap aMap(aArgs); -const util::Color aColor = aMap.getUnpackedValueOrDefault(PROPERTY_FONTCOLOR,util::Color()); +const util::Color aColor( lcl_extractBackgroundColor( aArgs ) ); impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARCOLOR,uno::Any(aColor),aArgs); bForceBroadcast = true; }
[Libreoffice-commits] core.git: drawinglayer/source editeng/source svx/source
drawinglayer/source/processor2d/vclprocessor2d.cxx |7 ++- editeng/source/editeng/editattr.cxx|2 +- editeng/source/editeng/editdoc.cxx |2 +- svx/source/tbxctrls/tbcontrl.cxx |2 +- 4 files changed, 5 insertions(+), 8 deletions(-) New commits: commit 619ac8bbb31a62087ac1e3745cc28b461bfb49c0 Author: Maxim Monastirsky AuthorDate: Thu Jul 6 01:58:42 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu Jul 6 09:33:52 2023 +0200 tdf#126382 Correct check for transparency Change-Id: I0664abae6f83736678108fab31dd119fae811054 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154082 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index ad680803438d..3ad89f1cab63 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -185,11 +185,8 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( // set FillColor Attribute const Color aFillColor(rTextCandidate.getTextFillColor()); -if (aFillColor != COL_TRANSPARENT) -{ -aFont.SetFillColor(aFillColor); -aFont.SetTransparent(false); -} +aFont.SetTransparent(aFillColor.IsTransparent()); +aFont.SetFillColor(aFillColor); // handle additional font attributes const primitive2d::TextDecoratedPortionPrimitive2D* pTCPP = nullptr; diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index 42e5f20206ba..a045f16ade81 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -230,7 +230,7 @@ EditCharAttribBackgroundColor::EditCharAttribBackgroundColor( void EditCharAttribBackgroundColor::SetFont( SvxFont& rFont, OutputDevice* ) { Color aColor = static_cast(GetItem())->GetValue(); -rFont.SetTransparent(aColor == COL_TRANSPARENT); +rFont.SetTransparent(aColor.IsTransparent()); rFont.SetFillColor(aColor); } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 08750a94fcd2..d4dc4ee16e37 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1998,7 +1998,7 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == SfxItemState::SET ) ) { auto& aColor = rSet.Get( EE_CHAR_BKGCOLOR ).GetValue(); -rFont.SetTransparent(aColor == COL_TRANSPARENT); +rFont.SetTransparent(aColor.IsTransparent()); rFont.SetFillColor(aColor); } if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == SfxItemState::SET ) ) diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 052d8558386b..da8493c75059 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2349,7 +2349,7 @@ void ColorWindow::SelectEntry(const NamedColor& rNamedColor) const Color &rColor = rNamedColor.m_aColor; -if (mxButtonAutoColor->get_visible() && (rColor == COL_TRANSPARENT || rColor == COL_AUTO)) +if (mxButtonAutoColor->get_visible() && rColor.IsFullyTransparent()) { mpDefaultButton = mxButtonAutoColor.get(); return;
[Libreoffice-commits] core.git: svx/source svx/uiconfig sw/uiconfig
svx/source/sidebar/text/TextPropertyPanel.cxx |8 -- svx/source/sidebar/text/TextPropertyPanel.hxx |2 - svx/uiconfig/ui/sidebartextpanel.ui | 32 +++--- sw/uiconfig/sglobal/toolbar/textstylebar.xml |2 - sw/uiconfig/swriter/toolbar/textstylebar.xml |2 - sw/uiconfig/swriter/ui/notebookbar_groups.ui |2 - 6 files changed, 8 insertions(+), 40 deletions(-) New commits: commit c0f1f67bfd2853554b58127e91443526c44163d7 Author: Maxim Monastirsky AuthorDate: Wed Jul 5 01:28:05 2023 +0300 Commit: Maxim Monastirsky CommitDate: Wed Jul 5 08:14:20 2023 +0200 Swap .uno:FontColor for .uno:Color Following tdf#105293, which left some UI elements unchanged. This also simplifies the sidebar, as .uno:Color is universal while .uno:FontColor works only with Writer text. It also benefits tdf#154270, as using the same command in the toolbar and the sidebar will keep their color in sync. Change-Id: Ia6e1ffef4012b6f8db4c9079d0b0c99a59887670 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154012 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx index d5bfc2a480df..5b4e907cd86b 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -49,9 +49,7 @@ TextPropertyPanel::TextPropertyPanel(weld::Widget* pParent, const css::uno::Refe , mxFontEffectsDispatch(new ToolbarUnoDispatcher(*mxFontEffects, *m_xBuilder, rxFrame)) , mxFontAdjust(m_xBuilder->weld_toolbar("fontadjust")) , mxFontAdjustDispatch(new ToolbarUnoDispatcher(*mxFontAdjust, *m_xBuilder, rxFrame)) -, mxToolBoxFontColorSw(m_xBuilder->weld_toolbar("colorbar_writer")) -, mxToolBoxFontColorSwDispatch(new ToolbarUnoDispatcher(*mxToolBoxFontColorSw, *m_xBuilder, rxFrame)) -, mxToolBoxFontColor(m_xBuilder->weld_toolbar("colorbar_others")) +, mxToolBoxFontColor(m_xBuilder->weld_toolbar("colorbar")) , mxToolBoxFontColorDispatch(new ToolbarUnoDispatcher(*mxToolBoxFontColor, *m_xBuilder, rxFrame)) , mxToolBoxBackgroundColor(m_xBuilder->weld_toolbar("colorbar_background")) , mxToolBoxBackgroundColorDispatch(new ToolbarUnoDispatcher(*mxToolBoxBackgroundColor, *m_xBuilder, rxFrame)) @@ -78,7 +76,6 @@ TextPropertyPanel::~TextPropertyPanel() mxDefaultBarDispatch.reset(); mxPositionBarDispatch.reset(); mxSpacingBarDispatch.reset(); -mxToolBoxFontColorSwDispatch.reset(); mxToolBoxFontColorDispatch.reset(); mxToolBoxBackgroundColorDispatch.reset(); mxFontAdjustDispatch.reset(); @@ -90,7 +87,6 @@ TextPropertyPanel::~TextPropertyPanel() mxDefaultBar.reset(); mxPositionBar.reset(); mxSpacingBar.reset(); -mxToolBoxFontColorSw.reset(); mxToolBoxFontColor.reset(); mxToolBoxBackgroundColor.reset(); mxFontAdjust.reset(); @@ -143,8 +139,6 @@ void TextPropertyPanel::HandleContextChange ( break; } -mxToolBoxFontColor->set_visible(!bWriterText); -mxToolBoxFontColorSw->set_visible(bWriterText); mxToolBoxBackgroundColor->set_visible(bWriterText || bDrawText); mxResetBar->set_visible(bWriterText || bCalcText); mxDefaultBar->set_visible(bDrawText); diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index 3ad44bde78ac..c383ef1bd891 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -53,8 +53,6 @@ private: std::unique_ptr mxFontEffectsDispatch; std::unique_ptr mxFontAdjust; std::unique_ptr mxFontAdjustDispatch; -std::unique_ptr mxToolBoxFontColorSw; -std::unique_ptr mxToolBoxFontColorSwDispatch; std::unique_ptr mxToolBoxFontColor; std::unique_ptr mxToolBoxFontColorDispatch; std::unique_ptr mxToolBoxBackgroundColor; diff --git a/svx/uiconfig/ui/sidebartextpanel.ui b/svx/uiconfig/ui/sidebartextpanel.ui index 732c3ee421ed..97a92d97a0f5 100644 --- a/svx/uiconfig/ui/sidebartextpanel.ui +++ b/svx/uiconfig/ui/sidebartextpanel.ui @@ -161,31 +161,7 @@ False 6 - -True -True -icons -False -2 - - -True -True - - -False -False - - - - -False -True -0 - - - - + True True icons @@ -205,7 +181,7 @@
[Libreoffice-commits] core.git: include/sfx2 include/svx sfx2/Library_sfx.mk sfx2/source svx/inc svx/source
include/sfx2/namedcolor.hxx| 57 + include/sfx2/objsh.hxx |4 ++ include/svx/Palette.hxx| 46 -- include/svx/PaletteManager.hxx |1 include/svx/colorwindow.hxx|3 - include/svx/tbcontrl.hxx |1 sfx2/Library_sfx.mk|1 sfx2/source/doc/objcont.cxx| 15 sfx2/source/inc/objshimp.hxx |4 ++ svx/inc/tbxcolorupdate.hxx |8 +++- svx/source/tbxctrls/PaletteManager.cxx |9 - svx/source/tbxctrls/tbcontrl.cxx | 15 +--- svx/source/tbxctrls/tbxcolorupdate.cxx | 57 +++-- 13 files changed, 145 insertions(+), 76 deletions(-) New commits: commit 8ffb8e164d9d350a1b9887d0a75e0a82892008ee Author: Maxim Monastirsky AuthorDate: Sun Jul 2 17:31:38 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue Jul 4 20:26:42 2023 +0200 tdf#154270 Sync toolbar button recent colors As the last used color is stored per button instance, these will go out of sync with several buttons being visible (e.g. a toolbar and a sidebar, or a toolbar overflow popup), and will reset whenever the toolbar resets (e.g. change in selection, switch from print preview, or customization). Fix that by storing the last colors per-document, and notifying other buttons on changes. Keep the last color also stored per-button for now, as a fallback for reportdesign (which isn't sfx2 based). Change-Id: I866f1de5c8ff6f56c47dc4b6b5acf52957d4e6c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153943 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/include/sfx2/namedcolor.hxx b/include/sfx2/namedcolor.hxx new file mode 100644 index ..fc7941686fbd --- /dev/null +++ b/include/sfx2/namedcolor.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include + +#include +#include + +struct SFX2_DLLPUBLIC NamedColor +{ +Color m_aColor; +OUString m_aName; +sal_Int16 m_nThemeIndex = -1; +sal_Int16 m_nLumMod = 1; +sal_Int16 m_nLumOff = 0; + +NamedColor() = default; + +NamedColor(Color const& rColor, OUString const& rName) +: m_aColor(rColor) +, m_aName(rName) +{ +} + +model::ComplexColor getComplexColor() +{ +model::ComplexColor aComplexColor; + +auto eThemeColorType = model::convertToThemeColorType(m_nThemeIndex); + +if (eThemeColorType != model::ThemeColorType::Unknown) +{ +aComplexColor.setSchemeColor(eThemeColorType); + +if (m_nLumMod != 1) +aComplexColor.addTransformation({ model::TransformationType::LumMod, m_nLumMod }); + +if (m_nLumMod != 0) +aComplexColor.addTransformation({ model::TransformationType::LumOff, m_nLumOff }); +} + +aComplexColor.setFinalColor(m_aColor); + +return aComplexColor; +} +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 15533c2954ca..dfb69b264418 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -47,6 +47,7 @@ namespace weld {class Button; } namespace model {class ColorSet; } +struct NamedColor; class SbxValue; class SbxArray; class BasicManager; @@ -564,6 +565,9 @@ public: GetDialogContainer(); StarBASIC* GetBasic() const; +std::optional GetRecentColor(sal_uInt16 nSlotId); +void SetRecentColor(sal_uInt16 nSlotId, const NamedColor& rColor); + virtual std::set GetDocColors(); virtual std::shared_ptr GetThemeColors(); diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index 4858b47140c4..5bf63762b75c 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -20,56 +20,12 @@ #pragma once #include +#include #include -#include -#include -#include - -#include -#include - class SvxColorValueSet; -struct SVXCORE_DLLPUBLIC NamedColor -{ -Color m_aColor; -OUString m_aName; -sal_Int16 m_nThemeIndex = -1; -sal_Int16 m_nLumMod = 1; -sal_Int16 m_nLumOff = 0; - -NamedColor() = default; - -NamedColor(Color const& rColor, OUString const& rName) -: m_aColor(rColor) -, m_aName(rName) -{} - -model::ComplexColor getComplexColor() -{ -model::ComplexColor aComp
[Libreoffice-commits] core.git: include/svl sfx2/source svl/source sw/inc sw/source
include/svl/style.hxx |4 -- sfx2/source/dialog/StyleList.cxx|3 + svl/source/items/style.cxx | 11 -- sw/inc/docstyle.hxx |3 - sw/source/core/unocore/unostyle.cxx | 11 +- sw/source/uibase/app/docstyle.cxx | 57 6 files changed, 4 insertions(+), 85 deletions(-) New commits: commit ce391e52fbb759997f7e2c225513cc074a0f3974 Author: Maxim Monastirsky AuthorDate: Mon Jun 26 17:17:53 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 30 10:00:40 2023 +0200 Drop SfxStyleSheetBasePool::SetParent Use SfxStyleSheetBase::SetParent directly instead. The base class was just calling it anyway, while the SwDocStyleSheetPool override was mostly a copy & paste of its override in SwDocStyleSheet. Change-Id: I18d8208ed2d079e0f2ce4f13a5dbdda6fe4730e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153773 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/include/svl/style.hxx b/include/svl/style.hxx index 257b1786eb57..fc12dc0be74e 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -274,10 +274,6 @@ public: SfxStyleSheetBase* Next(); virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ); -virtual boolSetParent(SfxStyleFamily eFam, - const OUString &rStyle, - const OUString &rParent); - voidReindex(); /** Add a style sheet. * Not an actual public function. Do not call it from non-subclasses. diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index bf9bf80d9db8..b9f9c0c62237 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -580,7 +580,8 @@ void StyleList::DropHdl(const OUString& rStyle, const OUString& rParent) m_bDontUpdate = true; const SfxStyleFamilyItem* pItem = GetFamilyItem(); const SfxStyleFamily eFam = pItem->GetFamily(); -m_pStyleSheetPool->SetParent(eFam, rStyle, rParent); +if (auto pStyle = m_pStyleSheetPool->Find(rStyle, eFam)) +pStyle->SetParent(rParent); m_bDontUpdate = false; } diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 40ba0ca85f72..41551e506498 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -585,17 +585,6 @@ SfxStyleSheetBasePool::~SfxStyleSheetBasePool() Clear(); } -bool SfxStyleSheetBasePool::SetParent(SfxStyleFamily eFam, const OUString& rStyle, const OUString& rParent) -{ -SfxStyleSheetIterator aIter(this, eFam, SfxStyleSearchBits::All); -SfxStyleSheetBase *pStyle = aIter.Find(rStyle); -OSL_ENSURE(pStyle, "Template not found. Writer with solar <2541?"); -if(pStyle) -return pStyle->SetParent(rParent); -else -return false; -} - std::unique_ptr SfxStyleSheetBasePool::CreateIterator ( SfxStyleFamily eFam, diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 7d0a07de2dc8..b411bfe4b1ce 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -226,9 +226,6 @@ public: virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ) override; -virtual bool SetParent( SfxStyleFamily eFam, const OUString &rStyle, -const OUString &rParent ) override; - virtual void Remove( SfxStyleSheetBase* pStyle) override; boolIsOrganizerMode() const { return m_bOrganizer; } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 75428e103eab..071ca0daae31 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1114,17 +1114,10 @@ void XStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement) SfxStyleSearchBits nMask = SfxStyleSearchBits::All; if(m_rEntry.family() == SfxStyleFamily::Para && !pNewStyle->IsConditional()) nMask &= ~SfxStyleSearchBits::SwCondColl; -m_pBasePool->Make(sStyleName, m_rEntry.family(), nMask); +auto pStyle = &m_pBasePool->Make(sStyleName, m_rEntry.family(), nMask); pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool); pNewStyle->SetStyleName(sStyleName); -const OUString sParentStyleName(pNewStyle->GetParentStyleName()); -if (!sParentStyleName.isEmpty()) -{ -SfxStyleSheetBase* pParentBase = m_pBasePool->Find(sParentStyleName, m_rEntry.family()); -if(pParentBase && pParentBase->GetFamily() == m_rEntry.family() && -pParentBase->GetPool() ==
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/app/docstyle.cxx | 109 -- 1 file changed, 48 insertions(+), 61 deletions(-) New commits: commit 759d414748bda99f29b04806f72d479e320c2f9f Author: Maxim Monastirsky AuthorDate: Wed Jun 21 09:07:20 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 23 17:26:42 2023 +0200 tdf#103064 Simplify the code a bit - Use SfxItemIter instead of manually iterating the ranges. While SwFormat::GetItemState does some extra stuff on top of SfxItemSet, it doesn't seem to be relevant for our use case. - Avoid searching for styles again and again. Change-Id: I397dd71a5ffb8cbf7d508b68abb3fc1b585938af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153479 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index e50c087d23fc..c78966a762e6 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -151,8 +151,7 @@ public: if (nId == SfxHintId::StyleSheetModified) { pStyleSheet->SetName(pDocStyleSheet->GetName()); -pStyleSheet->GetItemSet().ClearItem(); -EnsureStyleHierarchy(pDocStyleSheet->GetName(), pDocStyleSheet->GetFamily()); +UpdateStyleHierarchyFrom(pStyleSheet, pDocStyleSheet); static_cast(pStyleSheet)->Broadcast(SfxHint(SfxHintId::DataChanged)); } else if (nId == SfxHintId::StyleSheetErased) @@ -162,21 +161,19 @@ public: SfxStyleSheetBase* Find(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits = SfxStyleSearchBits::All) override { -if (eFamily != SfxStyleFamily::All) -EnsureStyleHierarchy(rName, eFamily); -return SfxStyleSheetPool::Find(rName, eFamily); -} +auto pStyleSheet = SfxStyleSheetPool::Find(rName, eFamily); -void EnsureStyleHierarchy(const OUString& rName, SfxStyleFamily eFamily) -{ -auto pDocStyleSheet = m_pOwner->Find(rName, eFamily); -if (!pDocStyleSheet) -return; +if (auto pDocStyleSheet = pStyleSheet ? nullptr : m_pOwner->Find(rName, eFamily)) +{ +pStyleSheet = &Make(pDocStyleSheet->GetName(), pDocStyleSheet->GetFamily()); +UpdateStyleHierarchyFrom(pStyleSheet, pDocStyleSheet); +} -auto pStyleSheet = SfxStyleSheetPool::Find(rName, eFamily); -if (!pStyleSheet) -pStyleSheet = &Make(rName, eFamily); +return pStyleSheet; +} +void UpdateStyleHierarchyFrom(SfxStyleSheetBase* pStyleSheet, SfxStyleSheetBase* pDocStyleSheet) +{ FillItemSet(pStyleSheet, pDocStyleSheet); // Remember now, as the next calls will invalidate pDocStyleSheet. @@ -193,61 +190,50 @@ public: void FillItemSet(SfxStyleSheetBase* pDestSheet, SfxStyleSheetBase* pSourceSheet) { auto& rItemSet = pDestSheet->GetItemSet(); -if (rItemSet.Count() > 0) -return; +rItemSet.ClearItem(); auto pCol = static_cast(pSourceSheet)->GetCollection(); -if (!pCol->GetAttrSet().Count()) -return; - -const WhichRangesContainer aRanges(svl::Items); +SfxItemIter aIter(pCol->GetAttrSet()); +std::optional oLRSpaceItem; -for (const auto& range : aRanges) +for (auto pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem()) { -std::optional oLRSpaceItem; +if (aIter.GetItemState(false) != SfxItemState::SET) +continue; -for (auto i = range.first; i < range.second; ++i) +auto nWhich = pItem->Which(); +auto nSlotId = rPool.GetSlotId(nWhich); +auto nNewWhich = rPool.GetSecondaryPool()->GetWhich(nSlotId); +if (nNewWhich != nSlotId) +rItemSet.Put(pItem->CloneSetWhich(nNewWhich)); +else if (nWhich == RES_MARGIN_FIRSTLINE) { -const SfxPoolItem* pItem; -if (pCol->GetItemState(i, false, &pItem) != SfxItemState::SET) -continue; - -auto nSlotId = rPool.GetSlotId(i); -auto nNewWhich = rPool.GetSecondaryPool()->GetWhich(nSlotId); -if (nNewWhich != nSlotId) -rItemSet.Put(pItem->CloneSetWhich(nNewWhich)); -else if (i == RES_MARGIN_FIRSTLINE) -{ -if (!oLRSpaceItem) -oLRSpaceItem.emplace(EE_PARA_LRSPACE); -auto pFirstLineItem = static_cast(pItem); - (*oLRSpaceItem).SetTextFirstLineOffsetValue(pFirstLineItem->GetTextFirstLineOffset()); - (*oLRSpaceItem).SetAutoFirst
[Libreoffice-commits] core.git: sw/inc sw/source
sw/inc/doc.hxx |2 - sw/source/core/doc/docfmt.cxx|8 -- sw/source/core/inc/UndoAttribute.hxx |8 +++--- sw/source/core/undo/unattr.cxx | 42 +++ sw/source/uibase/app/docstyle.cxx| 15 ++-- 5 files changed, 46 insertions(+), 29 deletions(-) New commits: commit 6cc71f3eef4e5108e44ab6c1943def1d3a0f707a Author: Maxim Monastirsky AuthorDate: Wed Jun 21 07:30:53 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 23 08:31:13 2023 +0200 tdf#103064 Fix reset to parent style handling If the style ends up empty, it still needs modification broadcasting if it used to be non-empty. So let's just trust the pool notification for when to notify clients. And given that broadcasting happens now always after EnsureStyleHierarchy, I assume that the explicit broadcasting in SetParent is no longer needed. Also added broadcasting to the undo of a reset. And the undo actions were combined, so we don't get separate notifications for each reset attribute. Change-Id: Ia2895fe346ef337cc0b4fe5dc4275f5b2dc60cd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153478 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index c729e0b2a983..c709db694d07 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -729,7 +729,7 @@ public: void SetAttr( const SfxItemSet&, SwFormat& ); // method to reset a certain attribute at the given format -void ResetAttrAtFormat( const sal_uInt16 nWhichId, +void ResetAttrAtFormat( const std::vector& rIds, SwFormat& rChangedFormat ); /** Set attribute as new default attribute in current document. diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 8ed9c4c9d249..3a503407c90f 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -498,14 +498,16 @@ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFormat& rFormat ) getIDocumentState().SetModified(); } -void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId, +void SwDoc::ResetAttrAtFormat( const std::vector& rIds, SwFormat& rChangedFormat ) { std::unique_ptr pUndo; if (GetIDocumentUndoRedo().DoesUndo()) -pUndo.reset(new SwUndoFormatResetAttr( rChangedFormat, nWhichId )); +pUndo.reset(new SwUndoFormatResetAttr( rChangedFormat, rIds )); -const bool bAttrReset = rChangedFormat.ResetFormatAttr( nWhichId ); +bool bAttrReset = false; +for (const auto& nWhichId : rIds) +bAttrReset = rChangedFormat.ResetFormatAttr(nWhichId) || bAttrReset; if ( bAttrReset ) { diff --git a/sw/source/core/inc/UndoAttribute.hxx b/sw/source/core/inc/UndoAttribute.hxx index 7fbbb5b522cd..f6905cafc6cf 100644 --- a/sw/source/core/inc/UndoAttribute.hxx +++ b/sw/source/core/inc/UndoAttribute.hxx @@ -132,7 +132,7 @@ class SwUndoFormatResetAttr final : public SwUndo { public: SwUndoFormatResetAttr( SwFormat& rChangedFormat, -const sal_uInt16 nWhichId ); + const std::vector& rIds ); virtual ~SwUndoFormatResetAttr() override; virtual void UndoImpl( ::sw::UndoRedoContext & ) override; @@ -141,10 +141,10 @@ class SwUndoFormatResetAttr final : public SwUndo private: // format at which a certain attribute is reset. SwFormat * const m_pChangedFormat; -// which ID of the reset attribute -const sal_uInt16 m_nWhichId; // old attribute which has been reset - needed for undo. -std::unique_ptr m_pOldItem; +SfxItemSet m_aSet; + +void BroadcastStyleChange(); }; class SwUndoDontExpandFormat final : public SwUndo diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index acc1503ee35c..66ccb4073bc3 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -233,7 +233,7 @@ void SwUndoFormatAttr::UndoImpl(::sw::UndoRedoContext & rContext) else if (RES_CHRFMT == m_nFormatWhich) nFamily = SfxStyleFamily::Char; -if (pFormat && nFamily != SfxStyleFamily::None) +if (m_oOldSet && m_oOldSet->Count() > 0 && nFamily != SfxStyleFamily::None) rContext.GetDoc().BroadcastStyleOperation(pFormat->GetName(), nFamily, SfxHintId::StyleSheetModified); } @@ -549,14 +549,16 @@ bool SwUndoFormatAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext) } SwUndoFormatResetAttr::SwUndoFormatResetAttr( SwFormat& rChangedFormat, -const sal_uInt16 nWhichId ) + const std::vector& rIds ) : SwUndo( SwUndoId::RESETATTR, rChangedFormat.GetDoc() ) ,
[Libreoffice-commits] core.git: sw/inc sw/source
sw/inc/docstyle.hxx |2 +- sw/source/uibase/app/docstyle.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 9cfed79cc1eb6182a807dafec796c0423d6003d6 Author: Maxim Monastirsky AuthorDate: Wed Jun 21 10:10:03 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 23 08:30:51 2023 +0200 This can be const Change-Id: Ie69b8a926c20d1923c4e1ad580838f1b57bbd3f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153480 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 82b33adf4efd..7d0a07de2dc8 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -181,7 +181,7 @@ class SwStyleSheetIterator final : public SfxStyleSheetIterator, public SfxListe sal_uInt32 m_nLastPos; boolm_bFirstCalled; -bool IsUsedInComments(const OUString& rName); +bool IsUsedInComments(const OUString& rName) const; voidAppendStyleList(const std::vector& rLst, boolbUsed, boolbTestHidden, diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index d43d5f652ff1..8f8e9eb94c19 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -3409,7 +3409,7 @@ void SwStyleSheetIterator::AppendStyleList(const std::vector& rList, } } -bool SwStyleSheetIterator::IsUsedInComments(const OUString& rName) +bool SwStyleSheetIterator::IsUsedInComments(const OUString& rName) const { auto pPool = static_cast(pBasePool)->GetEEStyleSheetPool(); SfxStyleSheetIterator aIter(pPool, GetSearchFamily(), SfxStyleSearchBits::Used);
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/app/docsh2.cxx |3 +++ sw/source/uibase/docvw/AnnotationWin2.cxx |6 ++ sw/source/uibase/docvw/PostItMgr.cxx |5 + sw/source/uibase/shells/langhelper.cxx| 19 ++- 4 files changed, 12 insertions(+), 21 deletions(-) New commits: commit 5ca721c182251e94922a7d11c6756f8ba789a574 Author: Maxim Monastirsky AuthorDate: Mon Jun 19 15:45:06 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 23 08:30:27 2023 +0200 tdf#103064 Refresh spellcheck marks on default lang change i.e. Tools > Language > For All Text, or Tools > Options... > Language Settings > Languages. The new language was already set as a pool default and picked by comments, just the spellcheck marks weren't refreshed. Another issue is that (unlike the Options dialog) menu items for specific languages (e.g. "English (USA)") also reset language settings in all paragraph/character styles, as implemented in tdf#35282, and this needs to be broadcasted as style modification. However as it turns out, the problem described in tdf#35282 was also reported in i#102191, for which the OOo devs provided a different fix (setting the new lang as DF), which was eventually merged as well as commit 8780cc5c294085fe7379a24eee58ac446cc40d0c ("cws tl84: #i102191# 'set language for all text' now uses hard language attribute"). So now we have two solutions for the same problem applied both. Given this, I prefer to instead revert the commit of tdf#35282, as it seems odd that a menu that claims to modify text actually modifies arbitrary styles (which might not even be used in the text). (fwiw there is also a third possible solution for i#102191/tdf#35282 which wasn't even discussed: Just rename the menu title from "For All Text" to "Document", as the problem seems to be really that the menu title sets wrong expectations that it modifies the text attributes, and not just the document defaults.) An open question regarding the fix of i#102191 is whether comments and shapes should also get the default language as DF. This actually used to work for comments until recently, as we used to force the document body language on attached comments. But this is no longer the case, so a different solution would need to be developed if this is still wanted. Change-Id: Ib097765e30a7272270737fc61df6d10aa51565fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153477 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 4de0e8eae7ed..0a8e4e6c7900 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -875,8 +875,11 @@ void SwDocShell::Execute(SfxRequest& rReq) } break; case SID_SPELLCHECKER_CHANGED: +{ //! false, true, true is on the save side but a probably overdone SwModule::CheckSpellChanges(false, true, true, false ); +Broadcast(SfxHint(SfxHintId::LanguageChanged)); +} break; case SID_MAIL_PREPAREEXPORT: diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 86348469f853..834b03839835 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1243,11 +1243,9 @@ void SwAnnotationWin::SetSpellChecking() { const SwViewOption* pVOpt = pWrtShell->GetViewOptions(); EEControlBits nCntrl = mpOutliner->GetControlWord(); +mpOutliner->SetControlWord(nCntrl & ~EEControlBits::ONLINESPELLING); if (pVOpt->IsOnlineSpell()) -nCntrl |= EEControlBits::ONLINESPELLING; -else -nCntrl &= ~EEControlBits::ONLINESPELLING; -mpOutliner->SetControlWord(nCntrl); +mpOutliner->SetControlWord(nCntrl | EEControlBits::ONLINESPELLING); mpOutliner->CompleteOnlineSpelling(); Invalidate(); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 91dfcd2f2774..2d08a3941ac9 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -479,6 +479,11 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } break; } +case SfxHintId::LanguageChanged: +{ +SetSpellChecking(); +break; +} case SfxHintId::SwSplitNodeOperation: { // if we are in a SplitNode/Cut operation, do not delete note and then add again, as this will flicker diff --git a/sw/source/uibase/shells/lan
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/shells/langhelper.cxx | 39 +++-- 1 file changed, 13 insertions(+), 26 deletions(-) New commits: commit 4d5508e27bdccb7d1465686773bb57a14310ed14 Author: Maxim Monastirsky AuthorDate: Sun Jun 18 02:59:55 2023 +0300 Commit: Maxim Monastirsky CommitDate: Mon Jun 19 13:12:16 2023 +0200 tdf#103064 Don't overwrite all formatting with DF on lang change i.e. right click on the language field in the statusbar, and choose a language from the popup menu. We now start with an empty itemset and only put there the modified items. This in turn makes the spelling restating hack unnecessary, so move it near its last consumer in ResetLanguages. Change-Id: Ie0f97a7fa41dc19b5785a41ee2ef4fb9c814f74a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153252 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 23ea1abd6dfd..e4c2ba715a4f 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -93,10 +93,9 @@ namespace SwLangHelper bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh ) { bool bRestoreSelection = false; -SfxItemSet aEditAttr(pOLV->GetAttribs()); ESelection aSelection = pOLV->GetSelection(); EditView & rEditView = pOLV->GetEditView(); -EditEngine * pEditEngine = rEditView.GetEditEngine(); +SfxItemSet aEditAttr(rEditView.GetEmptyItemSet()); // get the language OUString aNewLangText; @@ -173,30 +172,6 @@ namespace SwLangHelper else SwLangHelper::SetLanguage( rSh, pOLV, aSelection, aNewLangText, bForSelection, aEditAttr ); -// ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks -// when setting a new language attribute -if (bForSelection) -{ -if (SwWrtShell* pWrtShell = rView.GetWrtShellPtr()) -{ -const SwViewOption* pVOpt = pWrtShell->GetViewOptions(); -EEControlBits nCntrl = pEditEngine->GetControlWord(); -// turn off -nCntrl &= ~EEControlBits::ONLINESPELLING; -pEditEngine->SetControlWord(nCntrl); - -//turn back on -if (pVOpt->IsOnlineSpell()) -nCntrl |= EEControlBits::ONLINESPELLING; -else -nCntrl &= ~EEControlBits::ONLINESPELLING; -pEditEngine->SetControlWord(nCntrl); - -pEditEngine->CompleteOnlineSpelling(); -rEditView.Invalidate(); -} -} - if (!bForSelection) { // need to release view and restore selection... @@ -369,6 +344,18 @@ namespace SwLangHelper rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE ); rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CJK ); rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CTL ); + +// ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks +// when setting a new language attribute +EditEngine* pEditEngine = rEditView.GetEditEngine(); +EEControlBits nCntrl = pEditEngine->GetControlWord(); +// turn off +pEditEngine->SetControlWord(nCntrl & ~EEControlBits::ONLINESPELLING); +//turn back on +pEditEngine->SetControlWord(nCntrl); +pEditEngine->CompleteOnlineSpelling(); + +rEditView.Invalidate(); } else {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/ui/view/tabvwsha.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit dbcfabe25d2806974fedb774f39a3517dd1a4df6 Author: Maxim Monastirsky AuthorDate: Fri Jun 16 11:53:37 2023 +0300 Commit: Maxim Monastirsky CommitDate: Sun Jun 18 20:28:26 2023 +0200 sc drawstyles: Restore text selection after applying a style Change-Id: I0a9bb39d8a7a9e770b3593eaa0a97867cbe86913 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153171 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit 8a0a4a4e1fa63edaa5ef923e0db56df7d08eb73c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153221 diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index f1305672a096..ed556d472286 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -933,6 +933,8 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) ScMarkData& rMark = GetViewData().GetMarkData(); ScModule* pScMod = SC_MOD(); SdrObject* pEditObject = GetDrawView()->GetTextEditObject(); +OutlinerView* pOLV= GetDrawView()->GetTextEditOutlinerView(); +ESelection aSelection = pOLV ? pOLV->GetSelection() : ESelection(); OUStringaRefName; boolbUndo = rDoc.IsUndoEnabled(); @@ -1683,7 +1685,11 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) // reactivate text editing instead: auto pFuText = dynamic_cast(GetDrawFuncPtr()); if (pFuText && pEditObject != GetDrawView()->GetTextEditObject()) +{ pFuText->SetInEditMode(pEditObject); +if (GetDrawView()->GetTextEditOutlinerView()) +GetDrawView()->GetTextEditOutlinerView()->SetSelection(aSelection); +} } void ScTabViewShell::GetStyleState( SfxItemSet& rSet )
[Libreoffice-commits] core.git: sc/source
sc/source/ui/view/tabvwsha.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 8a0a4a4e1fa63edaa5ef923e0db56df7d08eb73c Author: Maxim Monastirsky AuthorDate: Fri Jun 16 11:53:37 2023 +0300 Commit: Maxim Monastirsky CommitDate: Sun Jun 18 02:02:41 2023 +0200 sc drawstyles: Restore text selection after applying a style Change-Id: I0a9bb39d8a7a9e770b3593eaa0a97867cbe86913 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153171 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 231630a4e5d3..c07a070e08ef 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -936,6 +936,8 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) ScMarkData& rMark = GetViewData().GetMarkData(); ScModule* pScMod = SC_MOD(); SdrObject* pEditObject = GetDrawView()->GetTextEditObject(); +OutlinerView* pOLV= GetDrawView()->GetTextEditOutlinerView(); +ESelection aSelection = pOLV ? pOLV->GetSelection() : ESelection(); OUStringaRefName; boolbUndo = rDoc.IsUndoEnabled(); @@ -1686,7 +1688,11 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) // reactivate text editing instead: auto pFuText = dynamic_cast(GetDrawFuncPtr()); if (pFuText && pEditObject != GetDrawView()->GetTextEditObject()) +{ pFuText->SetInEditMode(pEditObject); +if (GetDrawView()->GetTextEditOutlinerView()) +GetDrawView()->GetTextEditOutlinerView()->SetSelection(aSelection); +} } void ScTabViewShell::GetStyleState( SfxItemSet& rSet )
[Libreoffice-commits] core.git: 2 commits - sw/inc sw/sdi sw/source
sw/inc/docstyle.hxx |3 + sw/sdi/annotsh.sdi| 35 -- sw/source/uibase/app/docst.cxx| 59 -- sw/source/uibase/app/docstyle.cxx | 18 +++ 4 files changed, 58 insertions(+), 57 deletions(-) New commits: commit c66afb209de6132deac8fee9425a351391edc89e Author: Maxim Monastirsky AuthorDate: Fri Jun 16 02:16:26 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 16 10:19:57 2023 +0200 tdf#103064 Improve comment style usage detection With this patch the "Applied Styles" filter should list also styles used in comments. Change-Id: Ifcb716cb66a0d271ca3d7ce477e6299015310ff1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153163 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 2d7bfdf3ff99..82b33adf4efd 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -181,6 +181,7 @@ class SwStyleSheetIterator final : public SfxStyleSheetIterator, public SfxListe sal_uInt32 m_nLastPos; boolm_bFirstCalled; +bool IsUsedInComments(const OUString& rName); voidAppendStyleList(const std::vector& rLst, boolbUsed, boolbTestHidden, @@ -235,7 +236,7 @@ public: virtual std::unique_ptr CreateIterator( SfxStyleFamily, SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; SwDoc& GetDoc() const { return m_rDoc; } -SfxStyleSheetPool* GetEEStyleSheetPool() { return mxEEStyleSheetPool.get(); } +SfxStyleSheetPool* GetEEStyleSheetPool() const { return mxEEStyleSheetPool.get(); } void dispose(); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index c869b10f7a5c..d43d5f652ff1 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2471,12 +2471,9 @@ bool SwDocStyleSheet::IsUsed() const if (m_rDoc.IsUsed(*pMod)) return true; -SfxStyleSheetIterator aIter(static_cast(m_pPool)->GetEEStyleSheetPool(), nFamily); -auto pStyle = aIter.Find(GetName()); -if (pStyle && pStyle->IsUsed()) -return true; - -return false; +SfxStyleSheetIterator aIter(static_cast(m_pPool)->GetEEStyleSheetPool(), nFamily, +SfxStyleSearchBits::Used); +return aIter.Find(GetName()) != nullptr; } OUString SwDocStyleSheet::GetUsedBy() @@ -3010,7 +3007,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() { SwTextFormatColl* pColl = (*rDoc.GetTextFormatColls())[ i ]; -const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl); +const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl) || IsUsedInComments(pColl->GetName()); if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() ) continue; @@ -3412,6 +3409,13 @@ void SwStyleSheetIterator::AppendStyleList(const std::vector& rList, } } +bool SwStyleSheetIterator::IsUsedInComments(const OUString& rName) +{ +auto pPool = static_cast(pBasePool)->GetEEStyleSheetPool(); +SfxStyleSheetIterator aIter(pPool, GetSearchFamily(), SfxStyleSearchBits::Used); +return aIter.Find(rName) != nullptr; +} + void SwDocStyleSheetPool::InvalidateIterator() { if (SfxStyleSheetIterator* pIter = GetCachedIterator()) commit 4923ddf33292cafecb5e216a5bdaac5bbe5da869 Author: Maxim Monastirsky AuthorDate: Thu Jun 15 11:39:40 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 16 10:19:45 2023 +0200 tdf#103064 sw: enable the UI commands Change-Id: Ic3e5ab9df5386a1cad0801f7044e6148620aa3b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152643 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi index 3d11cd67a60e..b137fc577f2d 100644 --- a/sw/sdi/annotsh.sdi +++ b/sw/sdi/annotsh.sdi @@ -290,11 +290,6 @@ interface Annotation : _Annotation StateMethod = StateDisableItems ; ] -SID_STYLE_FAMILY2 -[ -StateMethod = StateDisableItems ; -] - SID_STYLE_FAMILY3 [ StateMethod = StateDisableItems ; @@ -330,36 +325,6 @@ interface Annotation : _Annotation StateMethod = StateDisableItems ; ] -SID_STYLE_APPLY // status(fina|play) -[ -StateMethod = StateDisableItems ; -] - -SID_STYLE_NEW // ole : no, status : ? -[ -StateMethod = StateDisableItems ; -] - -SID_STYLE_EDIT // ole : no, status : ? -[ -StateMethod = StateDisableItems ; -] - -SID_STYLE_DELETE // ole : no, status : ? -[ -StateMethod = StateDisableItems ; -] - -SID_STYLE_HIDE -
[Libreoffice-commits] core.git: editeng/source include/editeng sw/inc sw/source
editeng/source/outliner/outlvw.cxx| 12 + include/editeng/outliner.hxx |2 sw/inc/AnnotationWin.hxx |5 -- sw/inc/fmtfld.hxx |3 - sw/source/core/fields/textapi.cxx |4 + sw/source/core/text/txtfld.cxx|5 -- sw/source/uibase/docvw/AnnotationWin.cxx | 18 --- sw/source/uibase/docvw/AnnotationWin2.cxx | 72 -- sw/source/uibase/docvw/PostItMgr.cxx | 29 9 files changed, 20 insertions(+), 130 deletions(-) New commits: commit 6cb6f76095d2df07102ffd3da7accf7d075df90b Author: Maxim Monastirsky AuthorDate: Thu Jun 15 11:39:25 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 16 00:49:09 2023 +0200 tdf#103064 sw: use the comment style by default instead of DF As part of that, language changes in the document's body are no longer applied to comments, as that would be a DF. Instead, the default language of comments is controlled via the style (see tdf#153805 for the use case). Change-Id: Icfa9a7334b52fe74292e82fa8daa01a15197e384 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153158 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 705b5e10b06b..382d1d63f7da 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -715,6 +715,18 @@ void OutlinerView::CreateSelectionList (std::vector &aSelList) } } +void OutlinerView::SetStyleSheet(const OUString& rStyleName) +{ +ParaRange aParas = ImpGetSelectedParagraphs(false); + +auto pStyle = pOwner->GetStyleSheetPool()->Find(rStyleName, SfxStyleFamily::Para); +if (!pStyle) +return; + +for (sal_Int32 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++) +pOwner->SetStyleSheet(nPara, static_cast(pStyle)); +} + const SfxStyleSheet* OutlinerView::GetStyleSheet() const { return pEditView->GetStyleSheet(); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 7622138271ee..0b9b06395dba 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -267,6 +267,8 @@ public: voidPaste( bool bUseSpecial = false ); voidPasteSpecial(); +void SetStyleSheet(const OUString& rStyleName); + const SfxStyleSheet* GetStyleSheet() const; SfxStyleSheet* GetStyleSheet(); diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index c3d556085a03..f7ac7b301d46 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -171,8 +171,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow bool IsMouseOverSidebarWin() const { return mbMouseOver; } -void SetLanguage(const SvxLanguageItem& rNewItem); - void ChangeSidebarItem( SwSidebarItem const & rSidebarItem ); virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; @@ -216,7 +214,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow virtual voidDataChanged( const DataChangedEvent& rDCEvt ) override; voidSetSizePixel( const Size& rNewSize ) override; -SfxItemSet DefaultItem(); DECL_DLLPRIVATE_LINK(ModifyHdl, LinkParamNone*, void); DECL_DLLPRIVATE_LINK(ScrollHdl, weld::ScrolledWindow&, void); @@ -228,8 +225,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow sal_uInt32 CountFollowing(); -SvxLanguageItem GetLanguage() const; - void SetMenuButtonColors(); SwPostItMgr&mrMgr; diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 6f5811539b17..4c4c1ea91293 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -178,8 +178,7 @@ enum class SwFormatFieldHintWhich REMOVED= 2, FOCUS = 3, CHANGED= 4, -LANGUAGE = 5, -RESOLVED = 6 +RESOLVED = 5 }; class SW_DLLPUBLIC SwFormatFieldHint final : public SfxHint diff --git a/sw/source/core/fields/textapi.cxx b/sw/source/core/fields/textapi.cxx index 88520065c7e3..6dcdc99d3b47 100644 --- a/sw/source/core/fields/textapi.cxx +++ b/sw/source/core/fields/textapi.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -189,6 +190,9 @@ void SwTextAPIEditSource::SetString( const OUString& rText ) m_pImpl->mpOutliner->Clear(); EnsureOutliner(); + +if (auto pStyle = m_pImpl->mpOutliner->GetStyleSheetPool()->Find(SwResId(STR_POOLCOLL_COMMENT), SfxStyleFamily::Para)) +m_pImpl->mpOutliner->SetStyleSheet(0, static_cast(pStyle)); m_pImpl->mpOutliner->Insert( rText ); } diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core
[Libreoffice-commits] core.git: 2 commits - editeng/source include/editeng include/svl svl/source svx/source sw/inc sw/qa sw/source
editeng/source/editeng/impedit.hxx |4 editeng/source/editeng/impedit2.cxx|2 editeng/source/editeng/impedit5.cxx|2 editeng/source/uno/unoedprx.cxx| 14 + editeng/source/uno/unofored.cxx| 14 + editeng/source/uno/unoforou.cxx| 14 + editeng/source/uno/unotext.cxx | 54 include/editeng/unoedprx.hxx |3 include/editeng/unoedsrc.hxx |3 include/editeng/unofored.hxx |3 include/editeng/unoforou.hxx |5 include/editeng/unotext.hxx|4 include/svl/style.hxx |2 svl/source/items/style.cxx |2 svx/source/accessibility/AccessibleEmptyEditSource.cxx |3 svx/source/dialog/weldeditview.cxx | 20 + sw/inc/docstyle.hxx|4 sw/inc/docufld.hxx |1 sw/qa/extras/odfexport/odfexport2.cxx | 29 ++ sw/source/core/fields/docufld.cxx |6 sw/source/core/fields/textapi.cxx | 61 +++-- sw/source/core/inc/textapi.hxx |1 sw/source/uibase/app/docstyle.cxx | 191 - sw/source/uibase/docvw/AnnotationWin2.cxx |5 sw/source/uibase/docvw/PostItMgr.cxx | 14 + 25 files changed, 428 insertions(+), 33 deletions(-) New commits: commit 6c4edf7f86912084371e15be7321e9c4764a9ca6 Author: Maxim Monastirsky AuthorDate: Thu Jun 15 11:36:43 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 16 00:48:56 2023 +0200 tdf#103064 sw,editeng: enable UNO API and ODF import/export Change-Id: Icf30e1f30fe6bf6a7d96d14b975954613cd68b70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153157 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 5bddd24fca7a..20d5df281bce 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -530,6 +530,20 @@ void SvxAccessibleTextAdapter::GetPortions( sal_Int32 nPara, std::vectorGetPortions( nPara, rList ); } +OUString SvxAccessibleTextAdapter::GetStyleSheet(sal_Int32 nPara) const +{ +assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder"); + +return mpTextForwarder->GetStyleSheet(nPara); +} + +void SvxAccessibleTextAdapter::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName) +{ +assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder"); + +mpTextForwarder->SetStyleSheet(nPara, rStyleName); +} + SfxItemState SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const { assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder"); diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index 5e1824ff5dca..66f4fde2bf78 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -124,6 +124,20 @@ void SvxEditEngineForwarder::GetPortions( sal_Int32 nPara, std::vectorGetName(); +return OUString(); +} + +void SvxEditEngineForwarder::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName) +{ +auto pStyleSheetPool = rEditEngine.GetStyleSheetPool(); +if (auto pStyle = pStyleSheetPool ? pStyleSheetPool->Find(rStyleName, SfxStyleFamily::Para) : nullptr) +rEditEngine.SetStyleSheet(nPara, static_cast(pStyle)); +} + void SvxEditEngineForwarder::QuickInsertText( const OUString& rText, const ESelection& rSel ) { rEditEngine.QuickInsertText( rText, rSel ); diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index f6d0fbb8eaea..8772ff9a77fa 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -186,6 +186,20 @@ void SvxOutlinerForwarder::GetPortions( sal_Int32 nPara, std::vector& const_cast(rOutliner.GetEditEngine()).GetPortions( nPara, rList ); } +OUString SvxOutlinerForwarder::GetStyleSheet(sal_Int32 nPara) const +{ +if (auto pStyle = rOutliner.GetStyleSheet(nPara)) +return pStyle->GetName(); +return OUString(); +} + +void SvxOutlinerForwarder::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName) +{ +auto pStyleSheetPool = rOutliner.GetStyleSheetPool(); +if (auto pStyle = pStyleSheetPool ? pStyleSheetPool->Find(rStyleName, SfxStyleFamily::Para) : nullptr) +rOutliner.SetStyleSheet(nPara, static_cast(pStyle)); +} + void SvxOutlinerForwarder::QuickInsertText( const OUString& rText, const ESelection& rSel ) { flus
[Libreoffice-commits] core.git: sfx2/source sw/inc sw/source
sfx2/source/dialog/StyleList.cxx |3 +-- sw/inc/docstyle.hxx|2 +- sw/source/core/model/ThemeColorChanger.cxx |3 +++ sw/source/core/undo/unattr.cxx |9 + sw/source/uibase/app/docst.cxx |6 +++--- sw/source/uibase/app/docstyle.cxx |6 +- sw/source/uibase/shells/basesh.cxx |4 7 files changed, 22 insertions(+), 11 deletions(-) New commits: commit e229e13f9d5f1322986775399276f5503ebb83f7 Author: Maxim Monastirsky AuthorDate: Thu Jun 15 11:21:01 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu Jun 15 22:37:41 2023 +0200 tdf#103064 sw: improved notifications on style modification - More useful notification on undo - Added notifications for theme change and UNO API. Change-Id: I554dceff92f4f8a6dd5c39c6965b7de706ab6678 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153110 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index 0247e01e7340..bf9bf80d9db8 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -1565,8 +1565,7 @@ void StyleList::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) if (!m_bDontUpdate && nId != SfxHintId::Dying && (dynamic_cast(&rHint) || dynamic_cast(&rHint) -|| dynamic_cast(&rHint) -|| nId == SfxHintId::StyleSheetModified)) +|| dynamic_cast(&rHint))) { if (!pIdle) { diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index d727245c059e..e71fb73c9828 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -99,7 +99,7 @@ public: which indicates that the indent attributes at a paragraph style should be reset in case that a list style is applied to the paragraph style and no indent attributes are applied. */ -voidSetItemSet( const SfxItemSet& rSet, +voidSetItemSet( const SfxItemSet& rSet, const bool bBroadcast = true, const bool bResetIndentAttrsAtParagraphStyle = false ); virtual SfxItemSet& GetItemSet() override; diff --git a/sw/source/core/model/ThemeColorChanger.cxx b/sw/source/core/model/ThemeColorChanger.cxx index caf4de1787ce..03fe47641bf3 100644 --- a/sw/source/core/model/ThemeColorChanger.cxx +++ b/sw/source/core/model/ThemeColorChanger.cxx @@ -430,7 +430,10 @@ void ThemeColorChanger::apply(std::shared_ptr const& pColorSet) bChanged = changeBackground(rAttrSet, *pNewSet, *pColorSet) || bChanged; if (bChanged) +{ pDocument->ChgFormat(*pTextFormatCollection, *pNewSet); + pPool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetModified, *pStyle)); +} } pStyle = static_cast(pPool->Next()); } diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 9b6a12a43707..acc1503ee35c 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -226,6 +226,15 @@ void SwUndoFormatAttr::UndoImpl(::sw::UndoRedoContext & rContext) if ( RES_FLYFRMFMT == m_nFormatWhich || RES_DRAWFRMFMT == m_nFormatWhich ) { rContext.SetSelections(static_cast(pFormat), nullptr); } + +SfxStyleFamily nFamily = SfxStyleFamily::None; +if (RES_TXTFMTCOLL == m_nFormatWhich || RES_CONDTXTFMTCOLL == m_nFormatWhich) +nFamily = SfxStyleFamily::Para; +else if (RES_CHRFMT == m_nFormatWhich) +nFamily = SfxStyleFamily::Char; + +if (pFormat && nFamily != SfxStyleFamily::None) +rContext.GetDoc().BroadcastStyleOperation(pFormat->GetName(), nFamily, SfxHintId::StyleSheetModified); } // Check if it is still in Doc diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index d4a05bf2a173..2016d712e9a7 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -594,7 +594,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) ::SfxToSwPageDescAttr( *pWrtShell, aSet ); // reset indent attributes at paragraph style, if a list style // will be applied and no indent attributes will be applied. -m_xTmp->SetItemSet( aSet, true ); +m_xTmp->SetItemSet( aSet, false, true ); } else { @@ -614,7 +614,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) ::ConvertAttrGenToChar(aTmpSet, m_xTmp->GetItemSet()); } -m_xTmp->SetItemSet( aTmpSet ); +m_xTmp->SetItemSet( aTmpSet, false ); if( SfxStyleFamily::Page == m_nFamily && SvtCTLOptions::IsCTLFontEnabled() ) { @@ -667,7 +667,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone
[Libreoffice-commits] core.git: editeng/source
editeng/source/editeng/editattr.cxx |2 +- editeng/source/editeng/editdoc.cxx |7 +-- 2 files changed, 6 insertions(+), 3 deletions(-) New commits: commit 9474ff4cc0abbd16f91ea582050c2332bdad88a3 Author: Maxim Monastirsky AuthorDate: Wed May 31 21:59:06 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu Jun 15 22:37:16 2023 +0200 tdf#103064 editeng: fix handling of char highlighting Transparency should be set to false if a color is present, but not with COL_TRANSPARENT. Compare with what is done for shape text in VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D. Change-Id: I5e4c8e53b53a363813ced50358c5ee795cdb61dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153107 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index 3277ed0916ba..42e5f20206ba 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -230,7 +230,7 @@ EditCharAttribBackgroundColor::EditCharAttribBackgroundColor( void EditCharAttribBackgroundColor::SetFont( SvxFont& rFont, OutputDevice* ) { Color aColor = static_cast(GetItem())->GetValue(); -rFont.SetTransparent(false); +rFont.SetTransparent(aColor == COL_TRANSPARENT); rFont.SetFillColor(aColor); } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 9fff222d9368..08750a94fcd2 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1976,7 +1976,6 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S { vcl::Font aPrevFont( rFont ); rFont.SetAlignment( ALIGN_BASELINE ); -rFont.SetTransparent( true ); sal_uInt16 nWhich_FontInfo = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ); sal_uInt16 nWhich_Language = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ); @@ -1997,7 +1996,11 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_COLOR ) == SfxItemState::SET ) ) rFont.SetColor( rSet.Get( EE_CHAR_COLOR ).GetValue() ); if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == SfxItemState::SET ) ) -rFont.SetFillColor( rSet.Get( EE_CHAR_BKGCOLOR ).GetValue() ); +{ +auto& aColor = rSet.Get( EE_CHAR_BKGCOLOR ).GetValue(); +rFont.SetTransparent(aColor == COL_TRANSPARENT); +rFont.SetFillColor(aColor); +} if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == SfxItemState::SET ) ) rFont.SetFontSize( Size( rFont.GetFontSize().Width(), static_cast(rSet.Get( nWhich_FontHeight ) ).GetHeight() ) ); if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == SfxItemState::SET ) )
[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
sw/inc/poolfmt.hxx |2 ++ sw/inc/strings.hrc |1 + sw/qa/python/check_styles.py|2 +- sw/source/core/doc/DocumentStylePoolManager.cxx | 10 +- sw/source/core/doc/SwStyleNameMapper.cxx|3 ++- sw/source/core/doc/poolfmt.cxx |1 + 6 files changed, 16 insertions(+), 3 deletions(-) New commits: commit 6e2c8f3f56ab52dfaa9bdce37423bac44cc64061 Author: Maxim Monastirsky AuthorDate: Thu Jun 15 11:23:02 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu Jun 15 19:34:13 2023 +0200 tdf#103064 sw: add a comment style Change-Id: I96acdf3200836efe1d66e19dd85000fca9e7a6fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153109 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/inc/poolfmt.hxx b/sw/inc/poolfmt.hxx index 358747e37808..4f017de21d3a 100644 --- a/sw/inc/poolfmt.hxx +++ b/sw/inc/poolfmt.hxx @@ -356,6 +356,8 @@ RES_POOLCOLL_SEND_ADDRESS, ///< Sender. RES_POOLCOLL_ENDNOTE, ///< Endnotes. RES_POOLCOLL_LABEL_DRAWING, ///< Label drawing objects. +RES_POOLCOLL_COMMENT, ///< Comment + RES_POOLCOLL_EXTRA_END, /// Group indices. diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 38ae2f61bff9..97d216e7ba83 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -152,6 +152,7 @@ #define STR_POOLCOLL_LABEL_FRAME NC_("STR_POOLCOLL_LABEL_FRAME", "Text") #define STR_POOLCOLL_LABEL_DRAWING NC_("STR_POOLCOLL_LABEL_DRAWING", "Drawing") #define STR_POOLCOLL_LABEL_FIGURE NC_("STR_POOLCOLL_LABEL_FIGURE", "Figure") +#define STR_POOLCOLL_COMMENTNC_("STR_POOLCOLL_COMMENT", "Comment") #define STR_POOLCOLL_ENVELOPE_ADDRESS NC_("STR_POOLCOLL_ENVELOPE_ADDRESS", "Addressee") #define STR_POOLCOLL_SEND_ADDRESS NC_("STR_POOLCOLL_SEND_ADDRESS", "Sender") #define STR_POOLCOLL_TOX_IDXH NC_("STR_POOLCOLL_TOX_IDXH", "Index Heading") diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py index 113fd801593c..aca3d8f0486e 100644 --- a/sw/qa/python/check_styles.py +++ b/sw/qa/python/check_styles.py @@ -131,7 +131,7 @@ class CheckStyle(unittest.TestCase): def test_ParagraphFamily(self): xDoc = CheckStyle._uno.openEmptyWriterDoc() xParaStyles = xDoc.StyleFamilies["ParagraphStyles"] -vEmptyDocStyles = ['Standard', 'Heading', 'Text body', 'List', 'Caption', 'Index', 'First line indent', 'Hanging indent', 'Text body indent', 'Salutation', 'Signature', 'List Indent', 'Marginalia', 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5', 'Heading 6', 'Heading 7', 'Heading 8', 'Heading 9', 'Heading 10', 'Title', 'Subtitle', 'Appendix', 'Numbering 1 Start', 'Numbering 1', 'Numbering 1 End', 'Numbering 1 Cont.', 'Numbering 2 Start', 'Numbering 2', 'Numbering 2 End', 'Numbering 2 Cont.', 'Numbering 3 Start', 'Numbering 3', 'Numbering 3 End', 'Numbering 3 Cont.', 'Numbering 4 Start', 'Numbering 4', 'Numbering 4 End', 'Numbering 4 Cont.', 'Numbering 5 Start', 'Numbering 5', 'Numbering 5 End', 'Numbering 5 Cont.', 'List 1 Start', 'List 1', 'List 1 End', 'List 1 Cont.', 'List 2 Start', 'List 2', 'List 2 End', 'List 2 Cont.', 'List 3 Start', 'List 3', 'List 3 End', 'List 3 Cont.', 'List 4 Start', 'List 4', 'List 4 End', 'List 4 Cont.', 'List 5 Start', 'List 5 ', 'List 5 End', 'List 5 Cont.', 'Index Heading', 'Index 1', 'Index 2', 'Index 3', 'Index Separator', 'Contents Heading', 'Contents 1', 'Contents 2', 'Contents 3', 'Contents 4', 'Contents 5', 'User Index Heading', 'User Index 1', 'User Index 2', 'User Index 3', 'User Index 4', 'User Index 5', 'Contents 6', 'Contents 7', 'Contents 8', 'Contents 9', 'Contents 10&
[Libreoffice-commits] core.git: editeng/source
editeng/source/editeng/impedit5.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit c89d6d690ba4b48c235752a6193aa77d9ecb7384 Author: Maxim Monastirsky AuthorDate: Thu Jun 15 11:16:29 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu Jun 15 19:33:48 2023 +0200 tdf#103064 editeng: invalidate spelling results on style change Because a style might define a different langauge. This is similar to what we do for DF in SetAttribs/SetParaAttribs. See also alternative approach in SwLangHelper::SetLanguageStatus or SwAnnotationWin::SetLanguage. Change-Id: I38caa716ec95958580f4ce0ede70eff5d1024e13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153108 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 3a87c4b5bfb7..8438f0be7632 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -87,6 +87,9 @@ void ImpEditEngine::SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle ) pNode->SetStyleSheet( pStyle, aStatus.UseCharAttribs() ); if ( pStyle ) StartListening(*pStyle, DuplicateHandling::Prevent); + +if (pNode->GetWrongList()) +pNode->GetWrongList()->ResetInvalidRange(0, pNode->Len()); ParaAttribsChanged( pNode ); } if (IsUpdateLayout()) @@ -110,6 +113,8 @@ void ImpEditEngine::UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle ) else pNode->SetStyleSheet( pStyle, false ); +if (pNode->GetWrongList()) +pNode->GetWrongList()->ResetInvalidRange(0, pNode->Len()); ParaAttribsChanged( pNode ); } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc
sw/inc/utlui.hrc |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit f6cb83f87865c2b5729c823a9ccb7b3d4404d7c0 Author: Maxim Monastirsky AuthorDate: Sun Jun 11 02:50:49 2023 +0300 Commit: Maxim Monastirsky CommitDate: Mon Jun 12 22:56:05 2023 +0200 tdf#154933 Update style names in autocorrect strings Change-Id: I8a5157e10179c1813c1fd1a8f94c13c977131cf0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152855 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit ca54b4112bcfdb08273bb6f452bc4ed6f5172984) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152872 diff --git a/sw/inc/utlui.hrc b/sw/inc/utlui.hrc index d5998e143514..5aa0b0e06e75 100644 --- a/sw/inc/utlui.hrc +++ b/sw/inc/utlui.hrc @@ -40,10 +40,10 @@ const TranslateId RID_SHELLRES_AUTOFMTSTRS[] = NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace dashes"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace 1st... with 1^st..."), NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine single line paragraphs"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body\" Style"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body indent\" Style"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Hanging indent\" Style"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body indent\" Style"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text\" Style"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text, Indented\" Style"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Hanging Indent\" Style"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text, Indented\" Style"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Heading $(ARG1)\" Style"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Bullet\" or \"Numbering\" Style"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine paragraphs"),
[Libreoffice-commits] core.git: sw/inc
sw/inc/utlui.hrc |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 7fa6198f29ac18ef2d58129918cb76c5da263d4f Author: Maxim Monastirsky AuthorDate: Sun Jun 11 02:50:49 2023 +0300 Commit: Maxim Monastirsky CommitDate: Sun Jun 11 23:47:01 2023 +0200 tdf#154933 Update style names in autocorrect strings Change-Id: I8a5157e10179c1813c1fd1a8f94c13c977131cf0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152855 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/inc/utlui.hrc b/sw/inc/utlui.hrc index d5998e143514..5aa0b0e06e75 100644 --- a/sw/inc/utlui.hrc +++ b/sw/inc/utlui.hrc @@ -40,10 +40,10 @@ const TranslateId RID_SHELLRES_AUTOFMTSTRS[] = NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace dashes"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace 1st... with 1^st..."), NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine single line paragraphs"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body\" Style"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body indent\" Style"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Hanging indent\" Style"), -NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body indent\" Style"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text\" Style"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text, Indented\" Style"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Hanging Indent\" Style"), +NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text, Indented\" Style"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Heading $(ARG1)\" Style"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Bullet\" or \"Numbering\" Style"), NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine paragraphs"),
[Libreoffice-commits] core.git: sc/sdi sc/source
sc/sdi/drawsh.sdi |1 + sc/sdi/drtxtob.sdi|1 + sc/source/ui/drawfunc/drawsh.cxx | 10 -- sc/source/ui/drawfunc/drtxtob.cxx | 13 - 4 files changed, 22 insertions(+), 3 deletions(-) New commits: commit 0a74b5fcfbfa68ad1cab228d74f08e8c35bc6820 Author: Maxim Monastirsky AuthorDate: Fri Apr 28 11:48:25 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue May 23 00:43:06 2023 +0200 sc drawstyles: Enable the clear DF command .uno:StandardTextAttributes works for shape formatting already (despite its name), but it's a different command than Format > Clear DF. So let's connect the regular Clear DF command to the same code. Also includes a workaround for comments to maintain their size. Changing the size (because of the "Fit height to text" setting) is probably confusing for other shapes as well, but for comments this requires an extra step to undo, as comments can't be resized unless they're shown permanently. And manually resizing each comment back will also result with inconsistency in their size. Change-Id: I7c158523ecc4be18d17479632eaf9fd2a51dca12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151161 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi index 13f1d6b150df..668608c549ab 100644 --- a/sc/sdi/drawsh.sdi +++ b/sc/sdi/drawsh.sdi @@ -37,6 +37,7 @@ interface TableDraw SID_DRAW_CHART [ StateMethod = StateDisableItems; ] SID_TEXT_STANDARD [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ] +SID_CELL_FORMAT_RESET [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ] SID_DRAWTEXT_ATTR_DLG [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ] // Slot-IDs for Objectbar: diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index 4670d216fba2..a4df9af69108 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -47,6 +47,7 @@ interface TableDrawText SID_THESAURUS [ ExecMethod = Execute; StateMethod = GetState; ] // attribute: SID_TEXT_STANDARD [ ExecMethod = ExecuteAttr; StateMethod = GetState; ] +SID_CELL_FORMAT_RESET [ ExecMethod = ExecuteAttr; StateMethod = GetState; ] SID_DRAWTEXT_ATTR_DLG [ ExecMethod = ExecuteAttr; StateMethod = GetState; ] SID_ATTR_CHAR_FONT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] SID_ATTR_CHAR_FONTHEIGHT[ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 291ec3e236bc..52ec9d9d438a 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -161,9 +161,15 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) } break; -case SID_TEXT_STANDARD: // delete hard text attributes +case SID_CELL_FORMAT_RESET: +case SID_TEXT_STANDARD: { -SfxItemSetFixed aEmptyAttr(GetPool()); +SfxItemSetFixed aEmptyAttr(GetPool()); + +if (ScDrawLayer::IsNoteCaption(pSingleSelectedObj)) +aEmptyAttr.Put(pView->GetAttrFromMarked(true)); + pView->SetAttributes(aEmptyAttr, true); } break; diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index f428465936b3..79f2bd1a588c 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -791,7 +791,8 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) { switch ( nSlot ) { -case SID_TEXT_STANDARD: // delete hard text attributes +case SID_CELL_FORMAT_RESET: +case SID_TEXT_STANDARD: { OutlinerView* pOutView = pView->IsTextEdit() ? pView->GetTextEditOutlinerView() : nullptr; @@ -799,8 +800,18 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) pOutView->Paint( tools::Rectangle() ); SfxItemSetFixed aEmptyAttr( *aEditAttr.GetPool() ); +SfxItemSetFixed aSizeAttr(*aEditAttr.GetPool()); + +aSizeAttr.Put(pView->GetAttrFromMarked(true)); pView->SetAttributes( aEmptyAttr, true ); +if (IsNoteEdit()) +{ +pView->SetAttributes(aSizeAttr, false); + pView->GetTextEditObject()->AdjustTextFrameWidthAndHeight(); +} + if ( pOutView ) { lcl_RemoveFields( *pOutView );
[Libreoffice-commits] core.git: officecfg/registry
officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 47fc6a5805592dc4e6b5339def60e2b0727a30eb Author: Maxim Monastirsky AuthorDate: Thu May 11 12:24:52 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu May 11 18:59:01 2023 +0200 tdf#154933 Rename "Text Body" to "Body Text" in menus Change-Id: I012beaa6188ed6c53dd72e100109b496a6636993 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151663 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index 7a8e12ba2125..8e9715c24acd 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -3759,15 +3759,15 @@ - Text Body + Body Text - Text Body + Body Text - Text Body Paragraph Style + Body Text Paragraph Style .uno:StyleApply?Style:string=Text body&FamilyName:string=ParagraphStyles
[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
sw/inc/strings.hrc |4 ++-- sw/qa/extras/odfexport/data/tdf103091.fodt |2 +- sw/qa/extras/odfexport/odfexport.cxx |2 +- sw/qa/extras/rtfexport/data/fdo69384-paste.rtf |2 +- sw/qa/extras/rtfexport/rtfexport2.cxx |4 ++-- sw/qa/extras/tiledrendering/tiledrendering.cxx |2 +- sw/qa/extras/uiwriter/uiwriter7.cxx| 10 +- sw/qa/uitest/styleInspector/styleInspector.py |2 +- sw/source/uibase/sidebar/StylePresetsPanel.cxx |2 +- 9 files changed, 15 insertions(+), 15 deletions(-) New commits: commit c83d241effbd09491e9f96d3e435ab91700f58b0 Author: Maxim Monastirsky AuthorDate: Thu May 11 00:56:56 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu May 11 11:20:47 2023 +0200 tdf#154933 Rename "Text Body" para style to "Body Text" - Change only the UI name, leaving the programmatic name which used by ODF and UNO API unchanged. - DOCX shouldn't be affected either, as that style is mapped to Word's "Text Body". - RTF export used to use the UI name (at least in 7.5). Which means that files created in older LO will show 2 styles for old and new names (same would happen also with files created with a different UI language). It seems to be no longer the case in current master. Change-Id: I8a4866d5db5f964a5d45071fb09a99ed4996fae4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151653 Tested-by: Maxim Monastirsky Reviewed-by: Heiko Tietze Reviewed-by: Maxim Monastirsky diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 733193103d1e..e9f4927c6200 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -73,10 +73,10 @@ #define STR_POOLFRM_LABEL NC_("STR_POOLFRM_LABEL", "Labels") // Template names #define STR_POOLCOLL_STANDARD NC_("STR_POOLCOLL_STANDARD", "Default Paragraph Style") -#define STR_POOLCOLL_TEXT NC_("STR_POOLCOLL_TEXT", "Text Body") +#define STR_POOLCOLL_TEXT NC_("STR_POOLCOLL_TEXT", "Body Text") #define STR_POOLCOLL_TEXT_IDENT NC_("STR_POOLCOLL_TEXT_IDENT", "First Line Indent") #define STR_POOLCOLL_TEXT_NEGIDENT NC_("STR_POOLCOLL_TEXT_NEGIDENT", "Hanging Indent") -#define STR_POOLCOLL_TEXT_MOVE NC_("STR_POOLCOLL_TEXT_MOVE", "Text Body Indent") +#define STR_POOLCOLL_TEXT_MOVE NC_("STR_POOLCOLL_TEXT_MOVE", "Body Text, Indented") #define STR_POOLCOLL_GREETING NC_("STR_POOLCOLL_GREETING", "Complimentary Close") #define STR_POOLCOLL_SIGNATURE NC_("STR_POOLCOLL_SIGNATURE", "Signature") #define STR_POOLCOLL_HEADLINE_BASE NC_("STR_POOLCOLL_HEADLINE_BASE", "Heading") diff --git a/sw/qa/extras/odfexport/data/tdf103091.fodt b/sw/qa/extras/odfexport/data/tdf103091.fodt index 1da98f49d828..7b7d35cd4672 100644 --- a/sw/qa/extras/odfexport/data/tdf103091.fodt +++ b/sw/qa/extras/odfexport/data/tdf103091.fodt @@ -32,7 +32,7 @@ - + diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index cdafc3abc4ba..1b2c83309e79 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1271,7 +1271,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf103091) // check that all conditional paragraph style conditions are imported uno::Reference xParaStyles(getStyles("ParagraphStyles")); uno::Reference xStyle1(xParaStyles->getByName( -"Text Body"), uno::UNO_QUERY); +"Text body"), uno::UNO_QUERY); auto conditions(getProperty>(xStyle1, "ParaStyleConditions")); CPPUNIT_ASSERT_EQUAL(sal_Int32(28), conditions.getLength()); diff --git a/sw/qa/extras/rtfexport/data/fdo69384-paste.rtf b/sw/qa/extras/rtfexport/data/fdo69384-paste.rtf index e0a9733c7475..0f8856654b79 100644 --- a/sw/qa/extras/rtfexport/data/fdo69384-paste.rtf +++ b/sw/qa/extras/rtfexport/data/fdo69384-paste.rtf @@ -8,7 +8,7 @@ {\s4\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext4 Object without fill;} {\s5\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext5 Object with no fill and no line;} {\s6\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext6 Text;} -{\s7\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs132\b0\ulnone\str
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sd/source
sd/source/ui/view/sdview3.cxx | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) New commits: commit a614740c09d99daf1a68f4642fded2c0c7608916 Author: Maxim Monastirsky AuthorDate: Fri May 5 11:12:36 2023 +0300 Commit: Michael Stahl CommitDate: Mon May 8 13:42:29 2023 +0200 tdf#155144 sd: Don't reset table styles on RTF pasting Regression of daab698b346e5e40b67f1e15c796c4e399ccaf8a ("sd: replace hardcoded table styles with xml file"). The problem is with the temp SdDrawDocument reusing the document's DrawDocShell. Before the mentioned commit we used to insert the default table styles directly into the style sheets pool, and that didn't affect the dest document as each SdDrawDocument maintains its own pool. However, after that commit we go through ODF import which use the document model which happens to be the dest document. This results with all the default table styles being replaced, with all their formatting being reset, and all existing tables being reset to the default style following the disposal of the original styles. At the same time, this leaves the temp SdDrawDocument with no table styles in its pool, and so the newly inserted table ends up with no style assigned. Change-Id: I9bebae929ec3d54e0139dd212ad0ad1dfe815caa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151417 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit 86b48c757906c3ef647f3d5e2579ac1fef1bf55b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151376 Reviewed-by: Michael Stahl diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index f96cd774a92a..9b94d9cca8b5 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -1571,19 +1571,17 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, bool View::PasteRTFTable( const ::tools::SvRef& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions ) { -SdDrawDocument aModel( DocumentType::Impress, mpDocSh ); -aModel.NewOrLoadCompleted(DocCreationMode::New); -aModel.GetItemPool().SetDefaultMetric(MapUnit::Map100thMM); -aModel.InsertPage(aModel.AllocPage(false).get()); +DrawDocShellRef xShell = new DrawDocShell(SfxObjectCreateMode::INTERNAL, false, DocumentType::Impress); +xShell->DoInitNew(); -Reference< XComponent > xComponent( new SdXImpressDocument( &aModel, true ) ); -aModel.setUnoModel( Reference< XInterface >::query( xComponent ) ); +SdDrawDocument* pModel = xShell->GetDoc(); +pModel->GetItemPool().SetDefaultMetric(MapUnit::Map100thMM); +pModel->InsertPage(pModel->AllocPage(false).get()); -CreateTableFromRTF( *xStm, &aModel ); -bool bRet = Paste(aModel, maDropPos, pPage, nPasteOptions); +CreateTableFromRTF(*xStm, pModel); +bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions); -xComponent->dispose(); -xComponent.clear(); +xShell->DoClose(); return bRet; }
[Libreoffice-commits] core.git: sd/source
sd/source/ui/view/sdview3.cxx | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) New commits: commit 86b48c757906c3ef647f3d5e2579ac1fef1bf55b Author: Maxim Monastirsky AuthorDate: Fri May 5 11:12:36 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri May 5 13:23:27 2023 +0200 tdf#155144 sd: Don't reset table styles on RTF pasting Regression of daab698b346e5e40b67f1e15c796c4e399ccaf8a ("sd: replace hardcoded table styles with xml file"). The problem is with the temp SdDrawDocument reusing the document's DrawDocShell. Before the mentioned commit we used to insert the default table styles directly into the style sheets pool, and that didn't affect the dest document as each SdDrawDocument maintains its own pool. However, after that commit we go through ODF import which use the document model which happens to be the dest document. This results with all the default table styles being replaced, with all their formatting being reset, and all existing tables being reset to the default style following the disposal of the original styles. At the same time, this leaves the temp SdDrawDocument with no table styles in its pool, and so the newly inserted table ends up with no style assigned. Change-Id: I9bebae929ec3d54e0139dd212ad0ad1dfe815caa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151417 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 6a1b776f4ead..06f07048455e 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -1568,19 +1568,17 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, bool View::PasteRTFTable( const ::tools::SvRef& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions ) { -SdDrawDocument aModel( DocumentType::Impress, mpDocSh ); -aModel.NewOrLoadCompleted(DocCreationMode::New); -aModel.GetItemPool().SetDefaultMetric(MapUnit::Map100thMM); -aModel.InsertPage(aModel.AllocPage(false).get()); +DrawDocShellRef xShell = new DrawDocShell(SfxObjectCreateMode::INTERNAL, false, DocumentType::Impress); +xShell->DoInitNew(); -Reference< XComponent > xComponent( new SdXImpressDocument( &aModel, true ) ); -aModel.setUnoModel( Reference< XInterface >::query( xComponent ) ); +SdDrawDocument* pModel = xShell->GetDoc(); +pModel->GetItemPool().SetDefaultMetric(MapUnit::Map100thMM); +pModel->InsertPage(pModel->AllocPage(false).get()); -CreateTableFromRTF( *xStm, &aModel ); -bool bRet = Paste(aModel, maDropPos, pPage, nPasteOptions); +CreateTableFromRTF(*xStm, pModel); +bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions); -xComponent->dispose(); -xComponent.clear(); +xShell->DoClose(); return bRet; }
[Libreoffice-commits] core.git: sc/res
sc/res/xml/styles.xml | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 732ca611a00068c5c77c1774ec893a2abccd6c1e Author: Maxim Monastirsky AuthorDate: Sun Apr 23 15:29:56 2023 +0300 Commit: Maxim Monastirsky CommitDate: Mon Apr 24 09:41:40 2023 +0200 Missing CJK and CTL attributes in default cell styles Presumably after 516bc904e94971b61e4b13af632bf321b0a4a640 ("Upgrade mdds and orcus to 2.1.0 and 0.18.0, respectively"). It appears that we used to set them from the latin attributes specified in styles.xml, which isn't correct. So let's just add them explicitly. Change-Id: I3300f73b0376275147f89d2db0ac3ef4bf2da5a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150892 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/res/xml/styles.xml b/sc/res/xml/styles.xml index d1d1a750e241..37cfc36afae1 100644 --- a/sc/res/xml/styles.xml +++ b/sc/res/xml/styles.xml @@ -1,13 +1,13 @@ - + - + - + @@ -16,7 +16,7 @@ - + @@ -40,11 +40,11 @@ - + - + @@ -59,6 +59,6 @@ - +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - svx/source
svx/source/unodraw/unoshtxt.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 18ad97d122fbaf7f120502fa73cea773dfe38455 Author: Maxim Monastirsky AuthorDate: Sun Mar 26 09:59:09 2023 +0300 Commit: Xisco Fauli CommitDate: Thu Apr 20 21:21:32 2023 +0200 tdf#154882: svx: don't overwrite the first cell's style i.e. new Draw document, change the char formatting in the default drawing style (e.g. font size), insert a table and fill its cells with text. Save and reload. After reload the first cell inherits the formatting of the default DS, instead of its assigned cell style. But dragging the table around shows the correct formatting in the dragging overlay, and it's also correct when copy & pasting the table. This is caused by the order of things at import, as a table is created initially with a single cell at least, and it gets its cell style assignment too early. There is also similar code to what is changed here in SdrTextObj:: BegTextEdit, and it's rightfully overridden by SdrTableObj. This appears to be a regression from 4-0, but I'm not sure which commit and what exactly changed there. Change-Id: Id096c7b5f330d6abd8f5b01c96448a9d8aac8001 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149616 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit f0287aad967761d46cb6903fc0d985a536408176) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150716 Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 168212aaa159..2743ccbaf6ee 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -592,7 +592,10 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() // its empty, so we have to force the outliner to initialise itself mpOutliner->SetText( "", mpOutliner->GetParagraph( 0 ) ); -if(mpObject->GetStyleSheet()) +auto pCell = dynamic_cast(mpText); +if (pCell && pCell->GetStyleSheet()) +mpOutliner->SetStyleSheet( 0, pCell->GetStyleSheet()); +else if (mpObject->GetStyleSheet()) mpOutliner->SetStyleSheet( 0, mpObject->GetStyleSheet()); } }
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/detfunc.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 0ed12710d743e12501292d688caf6e4a72f16376 Author: Maxim Monastirsky AuthorDate: Wed Apr 19 17:19:13 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu Apr 20 14:11:42 2023 +0200 sc drawstyles: Avoid styles for detective shapes Those are fixed shapes with fixed formatting, and not supposed to be changed by the user (with the exception of their color via Tools > Options... > LibreOffice > AC, but that is a user profile setting, not a document formatting). So we need to undo the setting of the default style, which happens by default for all created shapes. Change-Id: Id48b4e9fb9b84008f154a7277f17ec00156ccc76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150659 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 4ec4d4349918..ac2c477b0210 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -370,6 +370,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow, *pModel, aRect); +pBox->NbcSetStyleSheet(nullptr, true); pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet()); pBox->SetLayer( SC_LAYER_INTERN ); @@ -413,6 +414,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow, *pModel, SdrObjKind::Line, basegfx::B2DPolyPolygon(aTempPoly)); +pArrow->NbcSetStyleSheet(nullptr, true); pArrow->NbcSetLogicRect(tools::Rectangle::Normalize(aStartPos,aEndPos)); //TODO: needed ??? pArrow->SetMergedItemSetAndBroadcast(rAttrSet); @@ -447,6 +449,7 @@ void ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow, *pModel, aRect); +pBox->NbcSetStyleSheet(nullptr, true); pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet()); pBox->SetLayer( SC_LAYER_INTERN ); @@ -482,6 +485,7 @@ void ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow, *pModel, SdrObjKind::Line, basegfx::B2DPolyPolygon(aTempPoly)); +pArrow->NbcSetStyleSheet(nullptr, true); pArrow->NbcSetLogicRect(tools::Rectangle::Normalize(aStartPos,aEndPos)); //TODO: needed ??? pArrow->SetMergedItemSetAndBroadcast(rAttrSet); @@ -554,6 +558,7 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData aRect); SfxItemSet& rAttrSet = rData.GetCircleSet(); +pCircle->NbcSetStyleSheet(nullptr, true); pCircle->SetMergedItemSetAndBroadcast(rAttrSet); pCircle->SetLayer( SC_LAYER_INTERN );
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test4.cxx |7 +-- sc/source/ui/unoobj/styleuno.cxx |7 +++ sc/source/ui/view/tabvwsha.cxx | 25 + 3 files changed, 37 insertions(+), 2 deletions(-) New commits: commit 0f6e6e82a4a693a6970540db6e98d0302f3fefa6 Author: Maxim Monastirsky AuthorDate: Wed Apr 19 01:47:10 2023 +0300 Commit: Maxim Monastirsky CommitDate: Wed Apr 19 13:31:17 2023 +0200 sc drawstyles: Fix export of transparency Change-Id: I1abf277223718ae2d650728e5bd141372a771a87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150590 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index eb3af3a2b2bf..25eb30e19245 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1499,8 +1499,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testShapeStyles) uno::Reference xStyle( xMSF->createInstance("com.sun.star.style.GraphicStyle"), uno::UNO_QUERY_THROW); xGraphicStyles->insertByName("MyStyle1", Any(xStyle)); -uno::Reference(xStyle, uno::UNO_QUERY_THROW) -->setPropertyValue("FillColor", Any(COL_RED)); +uno::Reference xPropertySet(xStyle, uno::UNO_QUERY_THROW); +xPropertySet->setPropertyValue("FillColor", Any(COL_RED)); +xPropertySet->setPropertyValue("FillTransparence", Any(sal_Int16(40))); xStyle.set(xMSF->createInstance("com.sun.star.style.GraphicStyle"), uno::UNO_QUERY_THROW); xGraphicStyles->insertByName("MyStyle2", Any(xStyle)); @@ -1540,6 +1541,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testShapeStyles) Color nColor; xShape->getPropertyValue("FillColor") >>= nColor; CPPUNIT_ASSERT_EQUAL(COL_RED, nColor); +CPPUNIT_ASSERT_EQUAL(sal_Int16(40), + xShape->getPropertyValue("FillTransparence").get()); } } diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index f4280dd2a679..a97c12e3dec5 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -2025,6 +2025,13 @@ uno::Any ScStyleObj::getPropertyValue_Impl( std::u16string_view aPropertyName ) { if (!SvxUnoTextRangeBase::GetPropertyValueHelper(*pItemSet, pResultEntry, aAny)) aAny = SvxItemPropertySet_getPropertyValue(pResultEntry, *pItemSet); + +// since the sfx uint16 item now exports a sal_Int32, we may have to fix this here +if (pResultEntry->aType == ::cppu::UnoType::get() && +aAny.getValueType() == ::cppu::UnoType::get()) +{ +aAny <<= static_cast(aAny.get()); +} } } } diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index a3eb7bd5403d..b309ac6156d5 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -40,6 +40,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -1587,6 +1594,24 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) SfxItemSet& rAttr = pStyleSheet->GetItemSet(); sdr::properties::CleanupFillProperties(rAttr); +// check for unique names of named items for xml +auto checkForUniqueItem = [&] (auto nWhichId) +{ +if (auto pOldItem = rAttr.GetItemIfSet(nWhichId, false)) +{ +if (auto pNewItem = pOldItem->checkForUniqueItem(&GetDrawView()->GetModel())) +rAttr.Put(std::move(pNewItem)); +} +}; + +checkForUniqueItem(XATTR_FILLBITMAP); +checkForUniqueItem(XATTR_LINEDASH); +checkForUniqueItem(XATTR_LINESTART); +checkForUniqueItem(XATTR_LINEEND); +checkForUniqueItem(XATTR_FILLGRADIENT); +checkForUniqueItem(XATTR_FILLFLOATTRANSPARENCE); +checkForUniqueItem(XATTR_FILLHATCH); + static_cast(pStyleSheet)->Broadcast(SfxHint(SfxHintId::DataChanged)); GetScDrawView()->InvalidateAttribs(); }
[Libreoffice-commits] core.git: sd/source
sd/source/ui/table/TableDesignPane.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 61b41646c5a93ca24f2c9f143cdb0da2c9258989 Author: Maxim Monastirsky AuthorDate: Tue Apr 18 20:33:38 2023 +0300 Commit: Maxim Monastirsky CommitDate: Wed Apr 19 00:53:40 2023 +0200 tdf#154883 Set doc as modified on applying table style Change-Id: I2a20f35f8b6730f256216cea718ac9020347f119 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150584 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 216cf09b3b59..c5f20588397b 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -475,6 +475,7 @@ void TableDesignWidget::ApplyStyle() pBindings->Invalidate( SID_REDO ); } } +setDocumentModified(); } else { @@ -530,6 +531,7 @@ void TableDesignWidget::ApplyOptions() pBindings->Invalidate( SID_REDO ); } } +setDocumentModified(); } void TableDesignWidget::onSelectionChanged()
[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source svx/inc svx/source
sc/qa/unit/subsequent_export_test4.cxx|5 ++ sc/source/core/data/drwlayer.cxx |4 - sc/source/core/data/postit.cxx| 39 -- svx/inc/sdr/primitive2d/sdrattributecreator.hxx |3 - svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx |6 +- svx/source/sdr/primitive2d/sdrattributecreator.cxx|6 +- 6 files changed, 34 insertions(+), 29 deletions(-) New commits: commit a9a2ace53625a8fb3feb1c050648a875a98cb7a8 Author: Maxim Monastirsky AuthorDate: Fri Apr 14 14:58:09 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue Apr 18 09:33:28 2023 +0200 sc drawstyles: Comment shadow should depends on shadow attribute The shadow of comments differs from the shadow of normal callout shapes, as it shows only for the text rectangle. However the way it's implemented is weird: The shadow attribute is set to false, which turns off the "normal" shadow, and then the special shadow is drawn unconditionally. There is also a code that forces the shadow attribute to false on import, to handle some old files that used to have the shadow on. The confusion begins when one shows the comment, and looks at right click > Area... > Shadow, which (rightfully) shows the shadow as off, but doesn't align with what is visible on the document canvas. Moreover, the other shadow settings on this page do affect the comment shadow, but in order to change them it is needed to check the "Use shadow" checkbox first. But leaving that checkbox as checked will result with a double shadow being drawn for the text rectangle, and an unnecessary shadow drawn for the arrow part. The problem becomes now more visible, as there is a Note style listed in the sidebar. One possible approach could be to draw the special shadow only when the shadow attribute is on, and patch existing files on import to "shadow on" instead of "shadow off". But this will cause the "double shadow" problem when opened in older versions (unless the comment is hidden, in which case we used to override the shadow attribute). But now there's an opportunity for a better solution: As we assign the default comment style to imported comments, we can just clear the shadow attribute DF, instead of forcing it to some value. As a result, the "shadow on" attribute of the style will be in effect in newer versions, while in older versions it will fallback to the "shadow off" pool default. Change-Id: I4b35bc1e8e2e12ed35a82b0c2e9aabcf28b46270 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150353 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 663767c7374f..eb3af3a2b2bf 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1557,6 +1557,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles) auto pCaption = pNote->GetCaption(); CPPUNIT_ASSERT(pCaption); +// Check that we don't keep the shadow attribute as DF +// (see ScNoteUtil::CreateNoteFromCaption) +CPPUNIT_ASSERT_LESSEQUAL(SfxItemState::DEFAULT, + pCaption->GetMergedItemSet().GetItemState(SDRATTR_SHADOW, false)); + auto pStyleSheet = &pDoc->GetStyleSheetPool()->Make("MyStyle1", SfxStyleFamily::Frame); auto& rSet = pStyleSheet->GetItemSet(); rSet.Put(SvxFontHeightItem(1129, 100, EE_CHAR_FONTHEIGHT)); diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 3940d09906ee..8191dfcede66 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -382,9 +382,7 @@ void ScDrawLayer::CreateDefaultStyles() pSet->Put(SdrCaptionEscDirItem(SdrCaptionEscDir::BestFit)); // shadow -/* SdrShadowItem has false, instead the shadow is set for the rectangle - only with SetSpecialTextBoxShadow() when the object is created. */ -pSet->Put(makeSdrShadowItem(false)); +pSet->Put(makeSdrShadowItem(true)); pSet->Put(makeSdrShadowXDistItem(100)); pSet->Put(makeSdrShadowYDistItem(100)); diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index b4acfb35f205..66f034087678 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -112,8 +112,10 @@ void ScCaptionUtil::SetExtraItems( SdrCaptionObj& rCaption, const SfxItemSet& rE SfxItemSet aItemSet = rCaption.GetMergedItemSet(); aItemSet.Put(rExtraItemSet); -// reset shadow items -aItemSet.Put( makeSdrShadowItem( false ) ); +// reset shadow visibility (see also ScNoteUtil::Creat
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/postit.hxx |4 +++- sc/qa/unit/subsequent_filters_test4.cxx |8 +++- sc/source/core/data/postit.cxx | 14 ++ sc/source/filter/xml/xmlcelli.cxx |2 +- 4 files changed, 21 insertions(+), 7 deletions(-) New commits: commit 0ee9501c0b7dc1a291715fff9c1934b1c08cb654 Author: Maxim Monastirsky AuthorDate: Thu Apr 13 18:57:26 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue Apr 18 01:57:24 2023 +0200 sc drawstyles: Assign the Note style to imported comments ... that don't have a style assignment. Typically in ods files created by older versions or by 3rd party. - For hidden comments this should make no difference, as we used to apply the default comment formatting as DF underneath their defined DF, just now we do that as a style assignment instead. - Same for comments from xlsx and xls files. - For visible comments from ods files created by OOo/LO, there should be no difference either, as such files typically include the shape formatting in them. - For visible comments from ods files created by Excel, there will be a difference, as Excel used to not include the full shape formatting (known to be the case with Excel 2007 and 2016; can't test any other version). This resulted with a weird look, e.g. a line instead of an arrow, a default blue fill color and too distant shadow, which clearly not how comments supposed to look. Moreover, the comment will turn to transparent after hiding or copying the cell, and will revert to the default look anyway with resaving. Given that we were already enforcing the default formatting for hidden comments and for foreign formats, I think it's reasonable to do that for visible comments too (and in general it's unclear to me why the ODF import treats visible comments differently than hidden ones). The main motivation of this change is to aid solving the shadow issue - see the next commits. Regarding the comment height change in the testCommentSize test: This does *not* mean there is a change in that comment's import. What this test does is to replace the existing comment with a new comment, and that use the default formatting instead of inheriting the formatting of the old one. But while the current default formatting is whatever defined in the Note style, the old default formatting was actually the draw pool defaults. This is because we used to apply the comment formatting as DF, and the relevant svx code (in SdrTextObj::NbcSetText) wasn't aware of the fact that part of the DF was considered as default in this case. Which means that this test was actually asserting a buggy behavior. Change-Id: I37723cce3c719ecaa9c57bef25bcb168e353c55c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150489 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 7da83a9ebea0..6b458ad41763 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -193,6 +193,8 @@ public: The underlying ScPostIt::ScNoteData::ScCaptionPtr takes managing ownership of the pointer. +@param bHasStyle Is there a drawing style set for the note. + @return Pointer to the new cell note object if insertion was successful (i.e. the passed cell position was valid), null otherwise. The Calc document is the owner of the note object. The @@ -201,7 +203,7 @@ public: */ static ScPostIt*CreateNoteFromCaption( ScDocument& rDoc, const ScAddress& rPos, -SdrCaptionObj* pCaption ); +SdrCaptionObj* pCaption, bool bHasStyle ); /** Creates a cell note based on the passed caption object data. diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index 06af93de19d9..c439a02c6582 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include #include @@ -1580,6 +1582,10 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testCommentSize) SdrCaptionObj* pCaption = pNote->GetCaption(); CPPUNIT_ASSERT(pCaption); +// The values below depend on particular font and char size. +// At least assert that the corresponding style was set: +CPPUNIT_ASSERT_EQUAL(ScResId(STR_STYLENAME_NOTE), pCaption->GetStyleSheet()->GetName()); + const tools::Rectangle& rOldRect = pCaption->GetLogicRect(); CPPUNIT_ASSERT_EQUAL(tools::Long(2899), rOldRect.getOpenWidth()); CPPUNIT_ASSERT_EQUAL(tools::Long(939), rOldRect.getOpenHeight()); @@ -1588,7 +1594,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testCommentSi
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test4.cxx | 16 +++- sc/source/filter/excel/xlroot.cxx |1 + 2 files changed, 16 insertions(+), 1 deletion(-) New commits: commit 86cbbbccba19ba0433693e3e5c59c67e9dc6a003 Author: Maxim Monastirsky AuthorDate: Fri Apr 14 02:19:44 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue Apr 18 01:56:31 2023 +0200 sc drawstyles: Fix xlsx export for text attributes in comments Change-Id: Ic5b6099460bd5e978c04aff3233537059ce711b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150379 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 5d629e83eb4a..663767c7374f 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1583,7 +1583,21 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles) // Check that the style was imported, and survived copying CPPUNIT_ASSERT_EQUAL(OUString("MyStyle1"), pCaption->GetStyleSheet()->GetName()); -// Check that the style formatting is in effect +} + +saveAndReload("Calc Office Open XML"); + +{ +ScDocument* pDoc = getScDoc(); + +ScAddress aPos(0, 0, 0); +ScPostIt* pNote = pDoc->GetNote(aPos); +CPPUNIT_ASSERT(pNote); + +auto pCaption = pNote->GetOrCreateCaption(aPos); +CPPUNIT_ASSERT(pCaption); + +// Check that the style formatting is preserved CPPUNIT_ASSERT_EQUAL(sal_uInt32(1129), pCaption->GetMergedItemSet().Get(EE_CHAR_FONTHEIGHT).GetHeight()); } diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 47f5ff7806c1..71d308d2f29c 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -408,6 +408,7 @@ EditEngine& XclRoot::GetDrawEditEngine() const { mrData.mxDrawEditEng = std::make_shared( &GetDoc().GetDrawLayer()->GetItemPool() ); EditEngine& rEE = *mrData.mxDrawEditEng; + rEE.SetStyleSheetPool(static_cast(GetDoc().GetDrawLayer()->GetStyleSheetPool())); rEE.SetRefMapMode(MapMode(MapUnit::Map100thMM)); rEE.SetUpdateLayout( false ); rEE.EnableUndo( false );
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test4.cxx | 13 ++ sc/qa/unit/ucalc.cxx | 18 sc/source/core/data/document.cxx |7 - sc/source/core/data/drwlayer.cxx | 59 + sc/source/core/data/postit.cxx | 63 -- sc/source/core/tool/detfunc.cxx| 147 - sc/source/core/tool/stylehelper.cxx|1 7 files changed, 130 insertions(+), 178 deletions(-) New commits: commit 3e4b8463f288d87f91cd5bc864d30ae02d4f5579 Author: Maxim Monastirsky AuthorDate: Mon Apr 10 00:38:33 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue Apr 18 01:09:21 2023 +0200 sc drawstyles: Maintain comment formatting with styles Up to now the look of comments was maintained with the comment shape's DF, with the default formatting being reapplied on import (for hidden comments), on changing Tools > Options... > LibreOffice > AC > Notes background, and on changing the default cell style, while keeping the user-applied DF to some extent. However, as we attempt to support drawing styles, this approach is no longer viable, as applying DF on top of styles at random times makes styles useless in the context of comments. (One might argue, that the look of comments should ideally be treated as an app view setting, and not as a formatting of an individual shape. This definitely makes sense, but has compat. implications, as both LO and Excel allow formatting individual comments (e.g. show a comment, right click > Area...). However we will probably do it anyway if we ever implement threaded comments like in recent Excel [1], as the callout shape based approach seems to not scale to it.) One way around it could be to explicitly disable any style interaction with comments. But this will be unfortunate, as styles have a clear advantage of being able to consistently maintain the same formatting for several elements, much more that the fragile approach of mixing the default formatting and user-applied formatting in the same formatting layer. Not to mention the possibility to define several custom styles. In addition there is a request in tdf#55682 to disconnect the formatting of comments from the default cell style, having a dedicated style instead, which I find reasonable. So this commit introduces a comment style, and uses it for new comments instead of DF, making it easy to format all comments at once. And a style based formatting is never overriden with DF, unless explicitly set by the user. Changing Tools > Options... > LibreOffice > AC > Notes background still has an effect in two ways: (1) Sets the default background of the comment style for new documents, and (2) if changed while a document is open, changes also the comment style of the current document. An undo action is also added, in case changing the current document wasn't deliberate. Changing the default cell style no longer has any effect on comment formatting. One unfortunate side effect of this change, is that newly created and permanently visible comments will lose their default look when opened in an older version. But there is not much I can do here, as older versions don't support styles, and I believe the advantage of using styles outweigh this concern. Hidden comments are not affected by this. [1] see https://support.microsoft.com/en-us/office/the-difference-between-threaded-comments-and-notes-75a51eec-4092-42ab-abf8-7669077b7be3 Change-Id: I84215791b9e6ce393c6d979aa2b19ef70c76dff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150352 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 9d6e38ef8a09..5d629e83eb4a 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -1553,12 +1554,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles) ScPostIt* pNote = pDoc->GetNote(aPos); CPPUNIT_ASSERT(pNote); -pNote->ShowCaption(aPos, true); auto pCaption = pNote->GetCaption(); CPPUNIT_ASSERT(pCaption); auto pStyleSheet = &pDoc->GetStyleSheetPool()->Make("MyStyle1", SfxStyleFamily::Frame); -pCaption->SetStyleSheet(static_cast(pStyleSheet), true); +auto& rSet = pStyleSheet->GetItemSet(); +rSet.Put(SvxFontHeightItem(1129, 100, EE_CHAR_FONTHEIGHT)); + +pCaption->SetStyleSheet(static_cast(pStyleSheet), false); // Hidden comments use different code path on import pNote->ShowCaption(aPos, false); @@ -1575,
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/postit.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 1e79befa61a08de7a1ddaccb6c435dbb8015c063 Author: Maxim Monastirsky AuthorDate: Sun Apr 9 00:23:46 2023 +0300 Commit: Maxim Monastirsky CommitDate: Sun Apr 9 20:44:15 2023 +0200 sc drawstyles: Use display name to find comment styles Change-Id: I3f56fd4bdb914da336927385e6c0ca76f1c871ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150163 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 6da509043c12..74bd5a22adbd 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -923,7 +924,7 @@ ScPostIt* ScNoteUtil::CreateNoteFromObjectData( ScCaptionInitData& rInitData = *aNoteData.mxInitData; rInitData.moItemSet.emplace(std::move(rItemSet)); rInitData.mxOutlinerObj = rOutlinerObj; -rInitData.maStyleName = rStyleName; +rInitData.maStyleName = ScStyleNameConversion::ProgrammaticToDisplayName(rStyleName, SfxStyleFamily::Frame); // convert absolute caption position to relative position rInitData.mbDefaultPosSize = rCaptionRect.IsEmpty();
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source svx/source
sc/inc/postit.hxx |4 +- sc/qa/unit/subsequent_export_test4.cxx | 44 sc/source/core/data/postit.cxx | 23 +++- sc/source/filter/excel/xiescher.cxx |2 - sc/source/filter/xml/xmlcelli.cxx | 14 ++- svx/source/sdr/properties/captionproperties.cxx |5 ++ 6 files changed, 86 insertions(+), 6 deletions(-) New commits: commit 1e442e2c6800cf38e42749ac6644502cb3717bc3 Author: Maxim Monastirsky AuthorDate: Fri Mar 31 16:38:32 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Apr 7 15:59:04 2023 +0200 sc drawstyles: Keep style assignment for comments Need to handle 3 cases: - Import of hidden comments (not too much useful by itself, as we still force the default comment formatting as DF). - Copying cells with comments. - The comment popup that is shown when hovering over a comment marker. Change-Id: Ibf2e22f1432745fe46f89da624ed3586b5d9fb55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149943 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 36473542e1df..7da83a9ebea0 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -216,6 +216,8 @@ public: formatting attributes of the caption object. This function takes ownership of the passed item set. +@param rStyleName Drawing style associated with the caption object. + @param rOutlinerObj An outliner object containing (formatted) text for the caption object. @@ -229,7 +231,7 @@ public: */ static ScPostIt*CreateNoteFromObjectData( ScDocument& rDoc, const ScAddress& rPos, -SfxItemSet&& oItemSet, +SfxItemSet&& oItemSet, const OUString& rStyleName, const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& rCaptionRect, bool bShown ); diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 275493f61387..9d6e38ef8a09 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#include #include #include @@ -1540,6 +1542,48 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testShapeStyles) } } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles) +{ +createScDoc("ods/comment.ods"); + +{ +ScDocument* pDoc = getScDoc(); + +ScAddress aPos(0, 0, 0); +ScPostIt* pNote = pDoc->GetNote(aPos); +CPPUNIT_ASSERT(pNote); + +pNote->ShowCaption(aPos, true); +auto pCaption = pNote->GetCaption(); +CPPUNIT_ASSERT(pCaption); + +auto pStyleSheet = &pDoc->GetStyleSheetPool()->Make("MyStyle1", SfxStyleFamily::Frame); +pCaption->SetStyleSheet(static_cast(pStyleSheet), true); + +// Hidden comments use different code path on import +pNote->ShowCaption(aPos, false); +} + +saveAndReload("calc8"); + +{ +ScDocument aDoc; +aDoc.InitDrawLayer(); +aDoc.TransferTab(*getScDoc(), 0, 0); + +ScAddress aPos(0, 0, 0); +ScPostIt* pNote = aDoc.GetNote(aPos); +CPPUNIT_ASSERT(pNote); + +pNote->ShowCaption(aPos, true); +auto pCaption = pNote->GetCaption(); +CPPUNIT_ASSERT(pCaption); + +// Check that the style was imported, and survived copying +CPPUNIT_ASSERT_EQUAL(OUString("MyStyle1"), pCaption->GetStyleSheet()->GetName()); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 00aab1d52030..6da509043c12 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -89,9 +90,9 @@ void ScCaptionUtil::SetCaptionLayer( SdrCaptionObj& rCaption, bool bShown ) void ScCaptionUtil::SetBasicCaptionSettings( SdrCaptionObj& rCaption, bool bShown ) { -SetCaptionLayer( rCaption, bShown ); rCaption.SetFixedTail(); rCaption.SetSpecialTextBoxShadow(); +SetCaptionLayer( rCaption, bShown ); } void ScCaptionUtil::SetCaptionUserData( SdrCaptionObj& rCaption, const ScAddress& rPos ) @@ -458,6 +459,7 @@ struct ScCaptionInitData { std::optional< SfxItemSet > moItemSet; /// Caption object formatting. std::optional< OutlinerParaObject > mxOutlinerObj; /// Text object with all text portion formatti
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/stlsheet.cxx |1 + sc/source/ui/unoobj/servuno.cxx |6 +- 2 files changed, 6 insertions(+), 1 deletion(-) New commits: commit 3709d62860b07110a8420ff30c0150d81267b31d Author: Maxim Monastirsky AuthorDate: Fri Apr 7 00:40:43 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Apr 7 09:34:01 2023 +0200 crashtesting: crash on saving of fdo48916-1.ods That document has before . The problem was that only the default style was creating the draw layer (in ScDrawDefaultsObj::getModelPool), which means that the SdrItemPool didn't exist at the time the item set of the former style was created. The easiest solution seems to ensure the draw layer existence on each UNO style object creation, similar to the other draw layer related objects in this method. A similar fix was added recently for another scenario in commit aec0830f31c2fd258de711baaa7da24bd01488c9 ("Ensure valid SdrItemPool for drawing styles"). Change-Id: I50d89fea6d419119cd47ab163c82d1470b04b4a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150115 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 665b806ba540..062be0a05280 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -227,6 +227,7 @@ SfxItemSet& ScStyleSheet::GetItemSet() SfxItemPool* pItemPool = &GetPool()->GetPool(); if (dynamic_cast(pItemPool) == nullptr) pItemPool = pItemPool->GetSecondaryPool(); +assert(pItemPool); pSet = new SfxItemSetFixed< XATTR_LINE_FIRST, XATTR_LINE_LAST, diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 855d0ae76b22..d135ad68abfa 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -425,7 +425,11 @@ uno::Reference ScServiceProvider::MakeInstance( xRet.set(static_cast(new ScStyleObj( nullptr, SfxStyleFamily::Page, OUString() ))); break; case Type::GRAPHICSTYLE: -xRet.set(static_cast(new ScStyleObj( nullptr, SfxStyleFamily::Frame, OUString() ))); +if (pDocShell) +{ +pDocShell->MakeDrawLayer(); +xRet.set(static_cast(new ScStyleObj( nullptr, SfxStyleFamily::Frame, OUString() ))); +} break; case Type::AUTOFORMAT: xRet.set(static_cast(new ScAutoFormatObj( SC_AFMTOBJ_INVALID )));
[Libreoffice-commits] core.git: sc/source
sc/source/ui/app/transobj.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit aec0830f31c2fd258de711baaa7da24bd01488c9 Author: Maxim Monastirsky AuthorDate: Mon Apr 3 16:01:44 2023 +0300 Commit: Maxim Monastirsky CommitDate: Mon Apr 3 17:04:40 2023 +0200 Ensure valid SdrItemPool for drawing styles ... when pasting cells as OLE object. Problem caught by UBSAN build with UITest_conditional_format UITEST_TEST_NAME=tdf117899.Tdf117899.test_tdf117899: /sc/source/core/data/stlsheet.cxx:238:53: runtime error: reference binding to null pointer of type 'SfxItemPool' #0 0x7f9cb1ef60ce in ScStyleSheet::GetItemSet() /sc/source/core/data/stlsheet.cxx:231:28 #1 0x7f9cb1ed52e3 in ScStyleSheetPool::CopyStyleFrom(SfxStyleSheetBasePool*, rtl::OUString const&, SfxStyleFamily, bool) /sc/source/core/data/stlpool.cxx:144:40 #2 0x7f9cb1ed9285 in ScStyleSheetPool::CopyStdStylesFrom(ScStyleSheetPool*) /sc/source/core/data/stlpool.cxx:223:5 #3 0x7f9cb0e25d51 in ScDocument::CopyStdStylesFrom(ScDocument const&) /sc/source/core/data/documen8.cxx:292:35 #4 0x7f9cb4602d7c in ScTransferObj::InitDocShell(bool) /sc/source/ui/app/transobj.cxx:683:14 ScStyleSheetPool::CopyStdStylesFrom wants to create/update the default drawing style, but in case the source clipdoc didn't have shapes - without creating ScDrawLayer first, which means no SdrItemPool exists. Fix that by creating ScDrawLayer unconditionally, as we attempt to do this later on anyway. Regression of commit 685a864cfc40227559ed55f6273fd118174e8e6e ("sc drawstyles: Clipboard support"). Change-Id: I3def9860ab4f11c70c120f5324a60adf63056a7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149966 Tested-by: Maxim Monastirsky Reviewed-by: Maxim Monastirsky diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 138b0789370b..f19bf94a4ff1 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -677,8 +677,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) m_pDoc->GetName( m_aBlock.aStart.Tab(), aTabName ); rDestDoc.RenameTab( 0, aTabName ); -if (m_pDoc->GetDrawLayer() || m_pDoc->HasNotes()) -pDocSh->MakeDrawLayer(); +pDocSh->MakeDrawLayer(); rDestDoc.CopyStdStylesFrom(*m_pDoc);
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/table2.cxx |7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) New commits: commit 7fed5d046f1c7c9e8caa2e80c020ea8f8ff6df66 Author: Maxim Monastirsky AuthorDate: Sun Apr 2 00:49:31 2023 +0300 Commit: Maxim Monastirsky CommitDate: Sun Apr 2 10:11:21 2023 +0200 Related: tdf#152250 Copy also style hierarchy Change-Id: I134857c9a7749b0dd4a6fe6842dcc8c72d373f4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149928 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 4eb5671f0dc7..caa43bcf981b 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -695,13 +695,8 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO aStyleName = static_cast(pEntry)->GetStyleName(); if(!aStyleName.isEmpty()) -{ -if(rDocument.GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para)) -continue; - rDocument.GetStyleSheetPool()->CopyStyleFrom( -pTable->rDocument.GetStyleSheetPool(), aStyleName, SfxStyleFamily::Para ); -} +pTable->rDocument.GetStyleSheetPool(), aStyleName, SfxStyleFamily::Para, true ); } }
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/stlpool.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 341900458578cb7d875efeee1ffdc9a0429e92b7 Author: Maxim Monastirsky AuthorDate: Sun Apr 2 00:06:41 2023 +0300 Commit: Maxim Monastirsky CommitDate: Sun Apr 2 10:10:28 2023 +0200 Explicitly check for cell styles Now that this method is used also for drawing styles. Overlooked this in 685a864cfc40227559ed55f6273fd118174e8e6e ("sc drawstyles: Clipboard support"). Change-Id: I7218b735d743841106606739fbd72e45a1d4bf1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149923 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 6a450483d15e..6fa08b8112de 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -162,7 +162,7 @@ void ScStyleSheetPool::CopyStyleFrom( SfxStyleSheetBasePool* pSrcPool, rDestSet.Put( SvxSetItem( ATTR_PAGE_FOOTERSET, aDestSub ) ); } } -else// cell styles +else if ( eFamily == SfxStyleFamily::Para ) { // number format exchange list has to be handled here, too
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/drwlayer.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit ae1285a593173cddf002f9b9ca9a6f1003f49285 Author: Maxim Monastirsky AuthorDate: Sat Apr 1 23:42:10 2023 +0300 Commit: Maxim Monastirsky CommitDate: Sun Apr 2 10:09:41 2023 +0200 Try a different approach for cid#1524623 I fail to see how pClipDoc could be nullptr, as all call sites of ScDrawLayer::CopyFromClip get a ScDocument-owned ScDrawLayer. But even in such case we can still get the style sheets pool from ScDrawLayer itself, which guaranteed to have one with or without ScDocument, as per ScDrawLayer's ctor. Change-Id: I6a3b7af7080b0a07ab3ec1fcfa7c6ca00e365162 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149921 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 12d0c5153a6f..830852bd4fd1 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1935,8 +1935,8 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const { // Copy style sheet auto pStyleSheet = pOldObject->GetStyleSheet(); -if (pStyleSheet && !bSameDoc && pClipDoc) - pDoc->GetStyleSheetPool()->CopyStyleFrom(pClipDoc->GetStyleSheetPool(), +if (pStyleSheet && !bSameDoc) + pDoc->GetStyleSheetPool()->CopyStyleFrom(pClipModel->GetStyleSheetPool(), pStyleSheet->GetName(), pStyleSheet->GetFamily(), true); // Clone to target SdrModel
[Libreoffice-commits] core.git: sc/inc sc/source
sc/inc/bitmaps.hlst|1 + sc/inc/scstyles.hrc|9 + sc/source/ui/app/scmod.cxx |5 + 3 files changed, 15 insertions(+) New commits: commit 1b463f697405e64a03378fb38a32172c4d3c25e6 Author: Maxim Monastirsky AuthorDate: Fri Mar 17 14:56:04 2023 +0200 Commit: Maxim Monastirsky CommitDate: Thu Mar 30 22:43:36 2023 + sc drawstyles: Enable the UI I believe it's in a usable state now. But keep in mind that the work isn't finished yet. For example, there is only one base default style, and the work to support styles for comments wasn't merged yet. Change-Id: I1ad3a4803ad91773906743e19a35405d5cd3255d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149754 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/inc/bitmaps.hlst b/sc/inc/bitmaps.hlst index 1b24f4b28851..422ed5ddeb63 100644 --- a/sc/inc/bitmaps.hlst +++ b/sc/inc/bitmaps.hlst @@ -61,6 +61,7 @@ inline constexpr OUStringLiteral RID_BMP_INPUT_OK = u"sc/res/sc26051.png"; inline constexpr OUStringLiteral BMP_STYLES_FAMILY_CELL = u"sc/res/sf01.png"; inline constexpr OUStringLiteral BMP_STYLES_FAMILY_PAGE = u"sc/res/sf02.png"; +inline constexpr OUStringLiteral BMP_STYLES_FAMILY_GRAPHICS = u"sd/res/sf01.png"; inline constexpr OUStringLiteral BMP_ICON_SET_CIRCLES1_GRAY = u"sc/res/icon-set-circles1-gray.png"; inline constexpr OUStringLiteral BMP_ICON_SET_CIRCLES1_GREEN = u"sc/res/icon-set-circles1-green.png"; diff --git a/sc/inc/scstyles.hrc b/sc/inc/scstyles.hrc index 4e4c449d69c9..224f2cd475ac 100644 --- a/sc/inc/scstyles.hrc +++ b/sc/inc/scstyles.hrc @@ -41,4 +41,13 @@ const std::pair RID_PAGESTYLEFAMILY[] = { {}, SfxStyleSearchBits::Auto } }; +const std::pair RID_GRAPHICSTYLEFAMILY[] = +{ +{ NC_("RID_GRAPHICSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, +{ NC_("RID_GRAPHICSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, +{ NC_("RID_GRAPHICSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, +{ NC_("RID_GRAPHICSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, +{ {}, SfxStyleSearchBits::Auto } +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 18aa0845088c..2f84555fd3ca 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2308,6 +2308,11 @@ std::optional ScModule::CreateStyleFamilies() BMP_STYLES_FAMILY_PAGE, RID_PAGESTYLEFAMILY, SC_MOD()->GetResLocale())); +aStyleFamilies.emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Frame, + ScResId(STR_STYLE_FAMILY_GRAPHICS), +BMP_STYLES_FAMILY_GRAPHICS, +RID_GRAPHICSTYLEFAMILY, SC_MOD()->GetResLocale())); + return aStyleFamilies; }
[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source svx/source
sc/inc/drwlayer.hxx |1 sc/inc/stlpool.hxx|6 ++- sc/source/core/data/documen9.cxx |8 sc/source/core/data/drwlayer.cxx | 18 - sc/source/core/data/postit.cxx|5 ++ sc/source/core/data/stlpool.cxx | 42 -- sc/source/core/tool/stylehelper.cxx | 10 + sc/source/ui/app/drwtrans.cxx | 22 --- sc/source/ui/app/transobj.cxx |6 +-- sc/source/ui/view/viewfun5.cxx| 12 ++ sc/source/ui/view/viewfun7.cxx| 10 - svx/source/sdr/properties/attributeproperties.cxx |2 - svx/source/sdr/properties/graphicproperties.cxx |1 svx/source/sdr/properties/oleproperties.cxx |1 14 files changed, 119 insertions(+), 25 deletions(-) New commits: commit 685a864cfc40227559ed55f6273fd118174e8e6e Author: Maxim Monastirsky AuthorDate: Sun Mar 26 22:23:52 2023 +0300 Commit: Maxim Monastirsky CommitDate: Thu Mar 30 22:43:23 2023 + sc drawstyles: Clipboard support - Paste as Calc's own format (default in Calc, results with an OLE object elsewhere), should preserve style assignment. This can be in one of two ways: Either copy the shape itself, or a cell range that includes a shape. - Similarly, copying or moving a whole sheet to another document should also preserve the style. - Paste as drawing format (default in other apps, also default in Calc when copying shapes from other apps), should preserve the formatting as direct formatting. Pasting into Calc will also assign the default style to that shape. Change-Id: Icb951dad1a77ba9ced706c33c928980d1ec7f8ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149753 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx index 51694a405202..131b82c749ef 100644 --- a/sc/inc/stlpool.hxx +++ b/sc/inc/stlpool.hxx @@ -45,8 +45,10 @@ public: voidCreateStandardStyles(); voidCopyStdStylesFrom( ScStyleSheetPool* pSrcPool ); -voidCopyStyleFrom( ScStyleSheetPool* pSrcPool, - const OUString& rName, SfxStyleFamily eFamily ); +voidCopyUsedGraphicStylesFrom( SfxStyleSheetBasePool* pSrcPool ); +voidCopyStyleFrom( SfxStyleSheetBasePool* pSrcPool, + const OUString& rName, SfxStyleFamily eFamily, + bool bNewStyleHierarchy = false ); boolHasStandardStyles() const { return bHasStandardStyles; } diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 34c25c761db4..f63c1ee4d1f1 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,12 @@ void ScDocument::TransferDrawPage(const ScDocument& rSrcDoc, SCTAB nSrcPos, SCTA SdrObject* pOldObject = aIter.Next(); while (pOldObject) { +// Copy style sheet +auto pStyleSheet = pOldObject->GetStyleSheet(); +if (pStyleSheet) + GetStyleSheetPool()->CopyStyleFrom(rSrcDoc.GetStyleSheetPool(), + pStyleSheet->GetName(), pStyleSheet->GetFamily(), true); + // Clone to target SdrModel rtl::Reference pNewObject(pOldObject->CloneSdrObject(*mpDrawLayer)); pNewObject->NbcMove(Size(0,0)); diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 263c5698c15a..a3162055d386 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -385,8 +385,11 @@ SdrModel* ScDrawLayer::AllocModel() const { // Allocated model (for clipboard etc) must not have a pointer // to the original model's document, pass NULL as document: +auto pNewModel = std::make_unique(nullptr, aName); +auto pNewPool = static_cast(pNewModel->GetStyleSheetPool()); +pNewPool->CopyUsedGraphicStylesFrom(GetStyleSheetPool()); -return new ScDrawLayer( nullptr, aName ); +return pNewModel.release(); } bool ScDrawLayer::ScAddPage( SCTAB nTab ) @@ -1930,6 +1933,12 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const if (bObjectInArea && (pOldObject->GetLayer() != SC_LAYER_INTERN) && !IsNoteCaption(pOldObject)) { +// Copy style sheet +auto pStyleSheet = pOldObject->GetStyleSheet(
[Libreoffice-commits] core.git: svx/source
svx/source/unodraw/unoshtxt.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit f0287aad967761d46cb6903fc0d985a536408176 Author: Maxim Monastirsky AuthorDate: Sun Mar 26 09:59:09 2023 +0300 Commit: Maxim Monastirsky CommitDate: Sun Mar 26 10:25:36 2023 + svx: don't overwrite the first cell's style i.e. new Draw document, change the char formatting in the default drawing style (e.g. font size), insert a table and fill its cells with text. Save and reload. After reload the first cell inherits the formatting of the default DS, instead of its assigned cell style. But dragging the table around shows the correct formatting in the dragging overlay, and it's also correct when copy & pasting the table. This is caused by the order of things at import, as a table is created initially with a single cell at least, and it gets its cell style assignment too early. There is also similar code to what is changed here in SdrTextObj:: BegTextEdit, and it's rightfully overridden by SdrTableObj. This appears to be a regression from 4-0, but I'm not sure which commit and what exactly changed there. Change-Id: Id096c7b5f330d6abd8f5b01c96448a9d8aac8001 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149616 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 525ee88abd77..580b3c2f65a0 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -588,7 +588,10 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() // its empty, so we have to force the outliner to initialise itself mpOutliner->SetText( "", mpOutliner->GetParagraph( 0 ) ); -if(mpObject->GetStyleSheet()) +auto pCell = dynamic_cast(mpText); +if (pCell && pCell->GetStyleSheet()) +mpOutliner->SetStyleSheet( 0, pCell->GetStyleSheet()); +else if (mpObject->GetStyleSheet()) mpOutliner->SetStyleSheet( 0, mpObject->GetStyleSheet()); } }
[Libreoffice-commits] core.git: sc/qa sc/source xmloff/source
sc/qa/unit/subsequent_export_test4.cxx | 61 + sc/source/filter/xml/xmlexprt.cxx |8 +--- sc/source/filter/xml/xmlstyli.cxx | 23 sc/source/filter/xml/xmlstyli.hxx |8 xmloff/source/draw/shapeexport.cxx |3 + xmloff/source/draw/ximpshap.cxx|6 ++- 6 files changed, 102 insertions(+), 7 deletions(-) New commits: commit b1393fd5ce847f40abab49f57c67929bb0087fae Author: Maxim Monastirsky AuthorDate: Fri Mar 17 14:54:30 2023 +0200 Commit: Maxim Monastirsky CommitDate: Thu Mar 23 08:54:06 2023 + sc drawstyles: ODF import and export Change-Id: Id92088a7d70c550682fe707d81e94157edc7caa8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149330 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 024019e89c1e..3033ff4fef85 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -1456,6 +1457,66 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testAutofilterHiddenButton) } } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testShapeStyles) +{ +createScDoc(); + +{ +uno::Reference xMSF(mxComponent, uno::UNO_QUERY_THROW); +uno::Reference xStyleFamiliesSupplier(mxComponent, + uno::UNO_QUERY_THROW); +uno::Reference xGraphicStyles( + xStyleFamiliesSupplier->getStyleFamilies()->getByName("GraphicStyles"), +uno::UNO_QUERY_THROW); + +// create styles +uno::Reference xStyle( +xMSF->createInstance("com.sun.star.style.GraphicStyle"), uno::UNO_QUERY_THROW); +xGraphicStyles->insertByName("MyStyle1", Any(xStyle)); +uno::Reference(xStyle, uno::UNO_QUERY_THROW) +->setPropertyValue("FillColor", Any(COL_RED)); + +xStyle.set(xMSF->createInstance("com.sun.star.style.GraphicStyle"), uno::UNO_QUERY_THROW); +xGraphicStyles->insertByName("MyStyle2", Any(xStyle)); +xStyle->setParentStyle("MyStyle1"); + +xStyle.set(xMSF->createInstance("com.sun.star.style.GraphicStyle"), uno::UNO_QUERY_THROW); +xGraphicStyles->insertByName("MyStyle3", Any(xStyle)); +xStyle->setParentStyle("MyStyle2"); + +// create shape +uno::Reference xShape( +xMSF->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY_THROW); + +uno::Reference xDPS(mxComponent, uno::UNO_QUERY_THROW); +uno::Reference xShapes(xDPS->getDrawPages()->getByIndex(0), + uno::UNO_QUERY_THROW); +xShapes->add(xShape); +uno::Reference(xShape, uno::UNO_QUERY_THROW) +->setPropertyValue("Style", Any(xStyle)); +} + +saveAndReload("calc8"); + +{ +uno::Reference xDPS(mxComponent, uno::UNO_QUERY_THROW); +uno::Reference xShapes(xDPS->getDrawPages()->getByIndex(0), + uno::UNO_QUERY_THROW); +uno::Reference xShape(xShapes->getByIndex(0), uno::UNO_QUERY_THROW); + +// check style hierarchy +uno::Reference xStyle(xShape->getPropertyValue("Style"), + uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_EQUAL(OUString("MyStyle3"), xStyle->getName()); +CPPUNIT_ASSERT_EQUAL(OUString("MyStyle2"), xStyle->getParentStyle()); + +// check that styles have effect on shapes +Color nColor; +xShape->getPropertyValue("FillColor") >>= nColor; +CPPUNIT_ASSERT_EQUAL(COL_RED, nColor); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 2e35f05367ca..df2d26e49d20 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -392,6 +392,8 @@ ScXMLExport::ScXMLExport( GetAutoStylePool()->AddFamily(XmlStyleFamily::TABLE_TABLE, XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME, xTableStylesExportPropertySetMapper, XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX); +GetShapeExport(); // make sure the graphics styles family is added + if( !(getExportFlags() & (SvXMLExportFlags::STYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT)) ) return; @@ -1980,10 +1982,7 @@ void ScXMLExport::ExportStyles_( bool bUsed )
[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk
sc/UIConfig_scalc.mk |1 sc/inc/scabstdlg.hxx |5 sc/inc/styleuno.hxx|2 sc/inc/unonames.hxx|1 sc/source/ui/attrdlg/scdlgfact.cxx |7 sc/source/ui/attrdlg/scdlgfact.hxx |4 sc/source/ui/inc/styledlg.hxx | 16 sc/source/ui/styleui/styledlg.cxx | 102 +++ sc/source/ui/unoobj/shapeuno.cxx | 33 + sc/source/ui/view/tabvwsha.cxx |7 sc/uiconfig/scalc/ui/drawtemplatedialog.ui | 847 + 11 files changed, 1023 insertions(+), 2 deletions(-) New commits: commit ca487e3f4c0f97c14bcff3a5372717d47f32ee94 Author: Maxim Monastirsky AuthorDate: Fri Mar 17 14:42:20 2023 +0200 Commit: Maxim Monastirsky CommitDate: Wed Mar 22 10:16:12 2023 + sc drawstyles: Add a dialog for style editing Change-Id: I7e62251024df8f24bd6fe318f5c0262bbd6a1a11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149279 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 13a4b98a6c7c..d83aa96dbaa1 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -121,6 +121,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/deletecolumnentry \ sc/uiconfig/scalc/ui/deletecontents \ sc/uiconfig/scalc/ui/descriptivestatisticsdialog \ + sc/uiconfig/scalc/ui/drawtemplatedialog \ sc/uiconfig/scalc/ui/dropmenu \ sc/uiconfig/scalc/ui/doubledialog \ sc/uiconfig/scalc/ui/erroralerttabpage \ diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 9901d48bd610..1868964e9bd0 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -43,6 +43,7 @@ class ScTabViewShell; class ScConditionalFormat; class ScConditionalFormatList; class Date; +class SdrView; enum class CreateNameFlags; enum class CellShiftDisabledFlags; @@ -551,6 +552,10 @@ public: SfxStyleSheetBase& rStyleBase, bool bPage /*true : page, false: para*/) = 0; +virtual VclPtr CreateScDrawStyleDlg(weld::Window* pParent, + SfxStyleSheetBase& rStyleBase, + SdrView* pView) = 0; + virtual VclPtr CreateScSubTotalDlg(weld::Window* pParent, const SfxItemSet& rArgSet) = 0; diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 0eca6bafb8a7..d0db6f84505a 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -1328,6 +1328,13 @@ VclPtr ScAbstractDialogFactory_Impl::CreateScStyleDlg(weld return VclPtr::Create(std::make_shared(pParent, rStyleBase, bPage)); } +VclPtr ScAbstractDialogFactory_Impl::CreateScDrawStyleDlg(weld::Window* pParent, + SfxStyleSheetBase& rStyleBase, + SdrView* pView) +{ +return VclPtr::Create(std::make_shared(pParent, rStyleBase, pView)); +} + VclPtr ScAbstractDialogFactory_Impl::CreateScSubTotalDlg(weld::Window* pParent, const SfxItemSet& rArgSet) { return VclPtr::Create(std::make_shared(pParent, rArgSet)); diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index e39428018287..855abeecf1c8 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -791,6 +791,10 @@ public: SfxStyleSheetBase& rStyleBase, bool bPage) override; +virtual VclPtr CreateScDrawStyleDlg(weld::Window* pParent, + SfxStyleSheetBase& rStyleBase, + SdrView* pView) override; + virtual VclPtr CreateScSubTotalDlg(weld::Window* pParent, const SfxItemSet& rArgSet) override; virtual VclPtr CreateScCharDlg(weld::Window* pParent, diff --git a/sc/source/ui/inc/styledlg.hxx b/sc/source/ui/inc/styledlg.hxx index 2f43e04745a6..736849ef963d 100644 --- a/sc/source/ui/inc/styledlg.hxx +++ b/sc/source/ui/inc/styledlg.hxx @@ -22,6 +22,7 @@ #include class SfxStyleSheetBase; +class SdrView; class ScStyleDlg : public SfxStyleDialogController { @@ -38,4 +39,19 @@ private: bool m_bPage; }; +class ScDrawStyleDlg : public SfxStyleDialogController +{ +public: +ScDrawStyleDlg(weld::Window* pParent, +
[Libreoffice-commits] core.git: framework/source sc/inc sc/sdi sc/source
framework/source/uielement/styletoolbarcontroller.cxx |3 sc/inc/globstr.hrc|1 sc/sdi/drawsh.sdi | 12 - sc/sdi/drtxtob.sdi| 12 - sc/sdi/tabvwsh.sdi|1 sc/source/ui/drawfunc/drawsh2.cxx |2 sc/source/ui/drawfunc/fusel.cxx |8 + sc/source/ui/undo/undostyl.cxx| 16 +- sc/source/ui/view/tabview3.cxx|2 sc/source/ui/view/tabvwsha.cxx| 143 +- 10 files changed, 164 insertions(+), 36 deletions(-) New commits: commit 1cfeb4bd8ce7f7727a81136bd3e2d6ebea976895 Author: Maxim Monastirsky AuthorDate: Fri Mar 17 14:28:36 2023 +0200 Commit: Maxim Monastirsky CommitDate: Tue Mar 21 23:10:39 2023 + sc drawstyles: Handle style commands and undo Change-Id: Ibd81f7aba9ef2efca89556c31cd9b09867419d0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149203 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/styletoolbarcontroller.cxx b/framework/source/uielement/styletoolbarcontroller.cxx index 31aed5336f10..3ff1e777eb6d 100644 --- a/framework/source/uielement/styletoolbarcontroller.cxx +++ b/framework/source/uielement/styletoolbarcontroller.cxx @@ -34,7 +34,8 @@ OUString MapFamilyToCommand( std::u16string_view rFamily ) return ".uno:CharStyle"; else if ( rFamily == u"PageStyles" ) return ".uno:PageStyle"; -else if ( rFamily == u"FrameStyles" ) +else if ( rFamily == u"FrameStyles" || + rFamily == u"GraphicStyles" ) // In sc return ".uno:FrameStyle"; else if ( rFamily == u"NumberingStyles" ) return ".uno:ListStyle"; diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 88eca11e5a89..16fce3f32974 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -84,6 +84,7 @@ #define STR_UNDO_EDITCELLSTYLE NC_("STR_UNDO_EDITCELLSTYLE", "Edit Cell Style") #define STR_UNDO_APPLYPAGESTYLE NC_("STR_UNDO_APPLYPAGESTYLE", "Apply Page Style") #define STR_UNDO_EDITPAGESTYLE NC_("STR_UNDO_EDITPAGESTYLE", "Edit Page Style") +#define STR_UNDO_EDITGRAPHICSTYLE NC_("STR_UNDO_EDITGRAPHICSTYLE", "Edit Drawing Style") #define STR_UNDO_DETADDPRED NC_("STR_UNDO_DETADDPRED", "Trace Precedents") #define STR_UNDO_DETDELPRED NC_("STR_UNDO_DETDELPRED", "Remove Precedent") #define STR_UNDO_DETADDSUCC NC_("STR_UNDO_DETADDSUCC", "Trace Dependents") diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi index ccd5d69605d4..13f1d6b150df 100644 --- a/sc/sdi/drawsh.sdi +++ b/sc/sdi/drawsh.sdi @@ -35,18 +35,6 @@ interface TableDraw SID_OPENDLG_EDIT_PRINTAREA [ StateMethod = StateDisableItems; ] // others: SID_DRAW_CHART [ StateMethod = StateDisableItems; ] -SID_STYLE_FAMILY2 [ StateMethod = StateDisableItems; ] -SID_STYLE_FAMILY4 [ StateMethod = StateDisableItems; ] -SID_STYLE_APPLY [ StateMethod = StateDisableItems; ] -SID_STYLE_WATERCAN [ StateMethod = StateDisableItems; ] -SID_STYLE_NEW_BY_EXAMPLE[ StateMethod = StateDisableItems; ] -SID_STYLE_UPDATE_BY_EXAMPLE [ StateMethod = StateDisableItems; ] -SID_STYLE_NEW [ StateMethod = StateDisableItems; ] -SID_STYLE_EDIT [ StateMethod = StateDisableItems; ] -SID_STYLE_DELETE[ StateMethod = StateDisableItems; ] -SID_STYLE_HIDE [ StateMethod = StateDisableItems; ] -SID_STYLE_SHOW [ StateMethod = StateDisableItems; ] - SID_TEXT_STANDARD [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ] SID_DRAWTEXT_ATTR_DLG [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ] diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index 5280430413bc..4670d216fba2 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -33,18 +33,6 @@ interface TableDrawText // others: SID_DRAW_CHART [ StateMethod = StateDisableItems; ] SID_OPENDLG_FUNCTION[ StateMethod = StateDisableItems; ] -SID_STYLE_FAMILY2 [ StateMethod = StateDisableItems; ] -SID_STYLE_FAMILY4 [ StateMethod = StateDisableItems; ] -SID_STYLE_APPLY [ StateMethod = StateDisableItems; ] -SID_STYLE_WATERCAN [ StateMethod = StateDisableItems; ] -SID_STYLE_NEW_BY_EXAMPLE[ StateMethod = StateDisableItems; ] -SID_STYLE_UPDATE_BY_EXAMPLE [ StateMethod
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/drwlayer.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit f460bd163afb06dc2dccc877269106af38767484 Author: Maxim Monastirsky AuthorDate: Sun Mar 19 19:52:09 2023 +0200 Commit: Maxim Monastirsky CommitDate: Tue Mar 21 23:10:20 2023 + sc drawstyles: Connect the styles pool to the draw layer Change-Id: Ie87bb028264b74fd3e15e23a3ad60ab3c48bb14d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149202 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index e6203697a4e7..653571cabd38 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -72,6 +72,7 @@ #include #include #include +#include #include #include @@ -280,6 +281,8 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, OUString _aName ) : rPool.FreezeIdRanges(); // the pool is also used directly +SetStyleSheetPool(pDocument ? pDocument->GetStyleSheetPool() : new ScStyleSheetPool(rPool, pDocument)); + SdrLayerAdmin& rAdmin = GetLayerAdmin(); rAdmin.NewLayer("vorne",SC_LAYER_FRONT.get()); rAdmin.NewLayer("hinten", SC_LAYER_BACK.get()); @@ -292,9 +295,11 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, OUString _aName ) : ScModule* pScMod = SC_MOD(); Outliner& rOutliner = GetDrawOutliner(); rOutliner.SetCalcFieldValueHdl( LINK( pScMod, ScModule, CalcFieldValueHdl ) ); + rOutliner.SetStyleSheetPool(static_cast(GetStyleSheetPool())); Outliner& rHitOutliner = GetHitTestOutliner(); rHitOutliner.SetCalcFieldValueHdl( LINK( pScMod, ScModule, CalcFieldValueHdl ) ); + rHitOutliner.SetStyleSheetPool(static_cast(GetStyleSheetPool())); // set FontHeight pool defaults without changing static SdrEngineDefaults SfxItemPool* pOutlinerPool = rOutliner.GetEditTextObjectPool();
[Libreoffice-commits] core.git: include/svx sc/inc sc/qa sc/source
include/svx/svdpool.hxx |1 include/svx/xpool.hxx |3 sc/inc/globstr.hrc |1 sc/inc/servuno.hxx |2 sc/qa/extras/scstylefamiliesobj.cxx |2 sc/source/core/data/stlpool.cxx |2 sc/source/core/data/stlsheet.cxx| 42 sc/source/ui/unoobj/servuno.cxx |4 sc/source/ui/unoobj/styleuno.cxx| 183 +++- 9 files changed, 212 insertions(+), 28 deletions(-) New commits: commit 6db5e15e5b91f34232e90225a723e0673ecfc2f0 Author: Maxim Monastirsky AuthorDate: Fri Mar 17 14:50:25 2023 +0200 Commit: Maxim Monastirsky CommitDate: Tue Mar 21 23:10:01 2023 + sc drawstyles: Implement the styles family Change-Id: I2af6072685e4c79cfe2f177c0aae27044f86d840 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149184 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/include/svx/svdpool.hxx b/include/svx/svdpool.hxx index e61b6fe97005..3d2201edef5b 100644 --- a/include/svx/svdpool.hxx +++ b/include/svx/svdpool.hxx @@ -20,7 +20,6 @@ #pragma once #include -#include class XLineAttrSetItem; class XFillAttrSetItem; diff --git a/include/svx/xpool.hxx b/include/svx/xpool.hxx index e8fc6f5e7225..13f5fa3d7a7d 100644 --- a/include/svx/xpool.hxx +++ b/include/svx/xpool.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SVX_XPOOL_HXX #define INCLUDED_SVX_XPOOL_HXX +#include #include #include @@ -29,7 +30,7 @@ |* \/ -class XOutdevItemPool : public SfxItemPool +class SVXCORE_DLLPUBLIC XOutdevItemPool : public SfxItemPool { protected: std::vector* mpLocalPoolDefaults; diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 95f7138c81c9..88eca11e5a89 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -443,6 +443,7 @@ #define STR_FORM_SCROLLBAR NC_("STR_FORM_SCROLLBAR", "Scroll Bar") #define STR_STYLE_FAMILY_CELL NC_("STR_STYLE_FAMILY_CELL", "Cell Styles") #define STR_STYLE_FAMILY_PAGE NC_("STR_STYLE_FAMILY_PAGE", "Page Styles") +#define STR_STYLE_FAMILY_GRAPHICS NC_("STR_STYLE_FAMILY_GRAPHICS", "Drawing Styles") #define STR_ERR_DATAPILOTSOURCE NC_("STR_ERR_DATAPILOTSOURCE", "Pivot table source data is invalid.") #define STR_OPTIONS_WARN_SEPARATORS NC_("STR_OPTIONS_WARN_SEPARATORS", "Because the current formula separator settings conflict with the locale, the formula separators have been reset to their default values.") #define STR_UNDO_INSERT_CURRENT_DATE NC_("STR_UNDO_INSERT_CURRENT_DATE", "Insert Current Date") diff --git a/sc/inc/servuno.hxx b/sc/inc/servuno.hxx index b8a6d49fd172..b705f3ef01b4 100644 --- a/sc/inc/servuno.hxx +++ b/sc/inc/servuno.hxx @@ -32,7 +32,7 @@ public: enum class Type { SHEET , URLFIELD , PAGEFIELD , PAGESFIELD , DATEFIELD , TIMEFIELD , TITLEFIELD , FILEFIELD , -SHEETFIELD , CELLSTYLE , PAGESTYLE , +SHEETFIELD , CELLSTYLE , PAGESTYLE , GRAPHICSTYLE , // sheet AUTOFORMAT , AUTOFORMATS, CELLRANGES , FUNCTIONDESCRIPTIONS , GLOBALSHEETSETTINGS , RECENTFUNCTIONS , diff --git a/sc/qa/extras/scstylefamiliesobj.cxx b/sc/qa/extras/scstylefamiliesobj.cxx index 89ec9a2b46f7..72fb135bd56d 100644 --- a/sc/qa/extras/scstylefamiliesobj.cxx +++ b/sc/qa/extras/scstylefamiliesobj.cxx @@ -82,7 +82,7 @@ private: ScStyleFamiliesObj::ScStyleFamiliesObj() : UnoApiTest("/sc/qa/extras/testdocuments") , XElementAccess(cppu::UnoType::get()) -, XIndexAccess(2) +, XIndexAccess(3) , XNameAccess("CellStyles") , XServiceInfo("ScStyleFamiliesObj", "com.sun.star.style.StyleFamilies") { diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 8f554896ff21..e7f6d26aa0c7 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -101,7 +101,7 @@ rtl::Reference ScStyleSheetPool::Create( const OUString& rN SfxStyleSearchBits nMaskP ) { rtl::Reference pSheet = new ScStyleSheet( rName, *this, eFamily, nMaskP ); -if ( eFamily == SfxStyleFamily::Para && ScResId(STR_STYLENAME_STANDARD) != rName ) +if ( eFamily != SfxStyleFamily::Page && ScResId(STR_STYLENAME_STANDARD) != rName ) pSheet->SetParent( ScResId(STR_STYLENAME_STANDARD) ); return pSheet; diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 4ee18ef0f0fb..665b806ba540 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -26,6 +26,10 @@ #include #include #include +#
[Libreoffice-commits] core.git: sc/inc sc/source
sc/inc/document.hxx |1 - sc/source/core/data/docpool.cxx |1 + sc/source/core/data/documen2.cxx |2 +- sc/source/core/data/documen9.cxx | 18 -- 4 files changed, 2 insertions(+), 20 deletions(-) New commits: commit ba58d80a1a9c30e58b20184135e81cc1851bdd75 Author: Maxim Monastirsky AuthorDate: Sun Mar 19 00:16:00 2023 +0200 Commit: Maxim Monastirsky CommitDate: Sun Mar 19 17:40:26 2023 + sc drawstyles: Delay the destruction of SdrItemPool Nowadays SfxItemPool_Impl::mpSecondary is ref counted, so there is no fear in destroying the draw layer before the doc pool. This kind of change is needed for drawing styles, as their item set references the SdrItemPool with a raw pointer, but they are destroyed as part of the styles pool, much later than the draw layer. Change-Id: I169bbacfbdbec2121217b13293b6f495898fe2e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149090 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 137b786e8c8b..9c6e376acca5 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2673,7 +2673,6 @@ private: voidImplCreateOptions(); // Suggestion: switch to on-demand? voidImplDeleteOptions(); -voidDeleteDrawLayer(); SC_DLLPUBLIC bool DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) const; voidUpdateDrawPrinter(); diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index e0a07582e453..47c485e4f139 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -327,6 +327,7 @@ ScDocumentPool::ScDocumentPool() ScDocumentPool::~ScDocumentPool() { Delete(); +SetSecondaryPool(nullptr); for ( sal_uInt16 i=0; i < ATTR_ENDINDEX-ATTR_STARTINDEX+1; i++ ) { diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index a7ea162177a9..fa979a953cb8 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -386,7 +386,7 @@ ScDocument::~ScDocument() pDBCollection.reset(); pSelectionAttr.reset(); apTemporaryChartLock.reset(); -DeleteDrawLayer(); +mpDrawLayer.reset(); mpPrinter.disposeAndClear(); ImplDeleteOptions(); pConsolidateDlgData.reset(); diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index b471a9a0f0f6..e6a6501c46e4 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -226,24 +226,6 @@ IMPL_LINK( ScDocument, GetUserDefinedColor, sal_uInt16, nColorIndex, Color* ) return const_cast(&(xColorList->GetColor(nColorIndex)->GetColor())); } -void ScDocument::DeleteDrawLayer() -{ -ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE); - -// remove DrawingLayer's SfxItemPool from Calc's SfxItemPool where -// it is registered as secondary pool -if (mxPoolHelper.is() && !IsClipOrUndo()) //Using IsClipOrUndo as a proxy for SharePooledResources called -{ -ScDocumentPool* pLocalPool = mxPoolHelper->GetDocPool(); - -if(pLocalPool && pLocalPool->GetSecondaryPool()) -{ -pLocalPool->SetSecondaryPool(nullptr); -} -} -mpDrawLayer.reset(); -} - bool ScDocument::DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) const { return mpDrawLayer->GetPrintArea( rRange, bSetHor, bSetVer );
[Libreoffice-commits] core.git: sc/sdi sc/source
sc/sdi/formatsh.sdi| 11 sc/sdi/tabvwsh.sdi | 12 sc/source/ui/inc/formatsh.hxx |1 sc/source/ui/inc/tabvwsh.hxx |3 sc/source/ui/view/formatsh.cxx | 726 - sc/source/ui/view/tabvwsha.cxx | 723 6 files changed, 738 insertions(+), 738 deletions(-) New commits: commit 796c9c5ac2196e62546bcef229dcd08a3b8724db Author: Maxim Monastirsky AuthorDate: Fri Mar 17 11:09:49 2023 +0200 Commit: Maxim Monastirsky CommitDate: Fri Mar 17 14:34:04 2023 + sc drawstyles: Move style commands to ScTabViewShell For them to be available also when shapes are selected. This commit alone shouldn't cause any change in behavior. Change-Id: Ic038618fe8b450ef2c93a19efb2e27c41f6de0f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149047 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/sdi/formatsh.sdi b/sc/sdi/formatsh.sdi index 4e566eb5069e..3cb4c050feaa 100644 --- a/sc/sdi/formatsh.sdi +++ b/sc/sdi/formatsh.sdi @@ -39,17 +39,6 @@ interface TableFont interface FormatForSelection { // slots which are disabled in the DrawShell {{ -SID_STYLE_FAMILY2 [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_APPLY [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_WATERCAN [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_NEW_BY_EXAMPLE[ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_UPDATE_BY_EXAMPLE [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_NEW [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_FAMILY4 [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_EDIT [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_DELETE[ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_HIDE [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] -SID_STYLE_SHOW [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ] SID_STYLE_PREVIEW [ ExecMethod = ExecuteStyle; ] SID_STYLE_END_PREVIEW [ ExecMethod = ExecuteStyle; ] SID_CLASSIFICATION_APPLY [ ExecMethod = ExecuteStyle; ] diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi index 50049bad7abc..5938317eb8aa 100644 --- a/sc/sdi/tabvwsh.sdi +++ b/sc/sdi/tabvwsh.sdi @@ -205,6 +205,18 @@ interface TableEditView SID_GRID_USE[ ExecMethod = ExecDrawOpt; StateMethod = GetDrawOptState; ] SID_HELPLINES_MOVE [ ExecMethod = ExecDrawOpt; StateMethod = GetDrawOptState; ] +SID_STYLE_FAMILY2 [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_FAMILY4 [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_APPLY [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_WATERCAN [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_NEW_BY_EXAMPLE[ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_UPDATE_BY_EXAMPLE [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_NEW [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_EDIT [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_DELETE[ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_HIDE [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] +SID_STYLE_SHOW [ ExecMethod = ExecStyle; StateMethod = GetStyleState; ] + SID_GETUNDOSTRINGS [ StateMethod = GetUndoState; ] SID_GETREDOSTRINGS [ StateMethod = GetUndoState; ] SID_UNDO[ ExecMethod = ExecuteUndo; StateMethod = GetUndoState; ] diff --git a/sc/source/ui/inc/formatsh.hxx b/sc/source/ui/inc/formatsh.hxx index 193c98e04b4e..85819b1ac50f 100644 --- a/sc/source/ui/inc/formatsh.hxx +++ b/sc/source/ui/inc/formatsh.hxx @@ -60,7 +60,6 @@ public: voidGetBorderState( SfxItemSet& rSet ); voidExecuteStyle( SfxRequest& rReq ); -voidGetStyleState( SfxItemSet& rSet ); voidExecuteTextDirection( const SfxRequest& rReq ); voidGetTextDirectionState( SfxItemSet& rSet ); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 31709a47c16a..e87b6355198c 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -277,6 +277,9 @@ public: voidExecDrawOpt(const SfxRequest& rReq); voidGetDrawOptState(SfxItemSet &rSet); +voidExecStyle(SfxRequest& rReq); +voidGetStyleState(SfxItemSet &rSet
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source
sc/source/ui/drawfunc/futext3.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit 25dd1b089fedec1a7ba45f3a3be7d10217165106 Author: Maxim Monastirsky AuthorDate: Thu Mar 9 02:37:19 2023 +0200 Commit: Michael Stahl CommitDate: Thu Mar 9 10:01:57 2023 + tdf#154050 Unset external pointer before destroying Regression of 48ca2336251d62ac2e90300cd9945fb84b1cddd8 ("tdf#125040 Avoid flickering on context change"). Before that commit the state of toolbar commands was updating async, which is how it managed to not crash. Change-Id: I07e2ce25faf848c7db33dd029b54a98bafcf8fa9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148518 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit 37b2bb1f6c18b915286264682bf0b3c25f0d552a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148501 Reviewed-by: Michael Stahl diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx index 1c13beea9388..a0db57860945 100644 --- a/sc/source/ui/drawfunc/futext3.cxx +++ b/sc/source/ui/drawfunc/futext3.cxx @@ -92,6 +92,11 @@ void FuText::StopEditMode() if( pNote ) rDoc.LockStreamValid(true); // only the affected sheet is invalidated below +/* Unset the outliner undo manager before the call to SdrEndTextEdit. +SdrObjEditView::SdrEndTextEdit destroys it, but then ScDrawView::SdrEndTextEdit +initiates some UI update which might try to access the now invalid pointer. */ +rViewShell.SetDrawTextUndo( nullptr ); + /* SdrObjEditView::SdrEndTextEdit() may try to delete the entire drawing object, if it does not contain text and has invisible border and fill. This must not happen for note caption objects. They will be removed @@ -102,9 +107,6 @@ void FuText::StopEditMode() case. */ /*SdrEndTextEditKind eResult =*/ pView->SdrEndTextEdit( pNote != nullptr ); -// or ScEndTextEdit (with drawview.hxx) -rViewShell.SetDrawTextUndo( nullptr ); - vcl::Cursor* pCur = pWindow->GetCursor(); if( pCur && pCur->IsVisible() ) pCur->Hide();
[Libreoffice-commits] core.git: sc/source
sc/source/ui/drawfunc/futext3.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit 37b2bb1f6c18b915286264682bf0b3c25f0d552a Author: Maxim Monastirsky AuthorDate: Thu Mar 9 02:37:19 2023 +0200 Commit: Maxim Monastirsky CommitDate: Thu Mar 9 07:23:25 2023 + tdf#154050 Unset external pointer before destroying Regression of 48ca2336251d62ac2e90300cd9945fb84b1cddd8 ("tdf#125040 Avoid flickering on context change"). Before that commit the state of toolbar commands was updating async, which is how it managed to not crash. Change-Id: I07e2ce25faf848c7db33dd029b54a98bafcf8fa9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148518 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx index 1c13beea9388..a0db57860945 100644 --- a/sc/source/ui/drawfunc/futext3.cxx +++ b/sc/source/ui/drawfunc/futext3.cxx @@ -92,6 +92,11 @@ void FuText::StopEditMode() if( pNote ) rDoc.LockStreamValid(true); // only the affected sheet is invalidated below +/* Unset the outliner undo manager before the call to SdrEndTextEdit. +SdrObjEditView::SdrEndTextEdit destroys it, but then ScDrawView::SdrEndTextEdit +initiates some UI update which might try to access the now invalid pointer. */ +rViewShell.SetDrawTextUndo( nullptr ); + /* SdrObjEditView::SdrEndTextEdit() may try to delete the entire drawing object, if it does not contain text and has invisible border and fill. This must not happen for note caption objects. They will be removed @@ -102,9 +107,6 @@ void FuText::StopEditMode() case. */ /*SdrEndTextEditKind eResult =*/ pView->SdrEndTextEdit( pNote != nullptr ); -// or ScEndTextEdit (with drawview.hxx) -rViewShell.SetDrawTextUndo( nullptr ); - vcl::Cursor* pCur = pWindow->GetCursor(); if( pCur && pCur->IsVisible() ) pCur->Hide();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sd/qa xmloff/source
sd/qa/unit/misc-tests.cxx | 52 + xmloff/source/table/XMLTableExport.cxx |4 +- xmloff/source/table/XMLTableImport.cxx |2 - 3 files changed, 55 insertions(+), 3 deletions(-) New commits: commit 03a84f60e94edc803bc3825b3ccb81771d4e522a Author: Maxim Monastirsky AuthorDate: Wed Dec 7 15:51:01 2022 +0200 Commit: Xisco Fauli CommitDate: Fri Dec 9 17:49:17 2022 + Fix sd encoded table style name handling Found this while looking into improving insertion of pages with tables, as SdDrawDocument::InsertBookmarkAsPage uses "_" as the rename suffix for styles with identical names but a different content. This commit fixes two issues: - For import, cell styles with encoded names couldn't be found by table styles. The reason is that styles are referenced in ODF by encoded names, but at runtime by display names. Yet we were searching the cell style family by encoded names. This was already handled for sw in insertTabletemplate(), and now do the same for sd. - For export, table template names were encoded, but then referenced by tables using their non-encoded names. This is unlike the sw code that doesn't encode them, and therefore doesn't have this problem. Looking at the schema, both table:name attribute of a table template, and table:template-name attribute of a table are of type "string", which suggests that there is indeed no need to encode those names. This aligns with the fact that table templates don't have a display-name attribute. Change-Id: Ie61b6a1c95b033404ee98f3fc40d8e82434a6a6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143839 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit 8bd31225d79f10993d0e0727ee7d27c729874b51) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143729 Reviewed-by: Xisco Fauli diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index bc741c6ac2fe..ee03008dfb47 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -80,6 +81,7 @@ public: void testTdf131033(); void testTdf129898LayerDrawnInSlideshow(); void testTdf136956(); +void testEncodedTableStyles(); CPPUNIT_TEST_SUITE(SdMiscTest); CPPUNIT_TEST(testTdf99396); @@ -101,6 +103,7 @@ public: CPPUNIT_TEST(testTdf131033); CPPUNIT_TEST(testTdf129898LayerDrawnInSlideshow); CPPUNIT_TEST(testTdf136956); +CPPUNIT_TEST(testEncodedTableStyles); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -891,6 +894,55 @@ void SdMiscTest::testTdf136956() CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRowCount()); } +void SdMiscTest::testEncodedTableStyles() +{ +// Silence unrelated failure: +// Error: element "table:table-template" is missing "first-row-start-column" attribute +skipValidation(); + +createSdDrawDoc(); + +{ +uno::Reference xStyleFamiliesSupplier(mxComponent, + uno::UNO_QUERY_THROW); +uno::Reference xTableStyleFamily( +xStyleFamiliesSupplier->getStyleFamilies()->getByName("table"), uno::UNO_QUERY_THROW); +uno::Reference xCellStyleFamily( +xStyleFamiliesSupplier->getStyleFamilies()->getByName("cell"), uno::UNO_QUERY_THROW); + +uno::Reference xTableStyle(xTableStyleFamily->createInstance(), + uno::UNO_QUERY_THROW); +uno::Reference xCellStyle(xCellStyleFamily->createInstance(), + uno::UNO_QUERY_THROW); + +uno::Reference(xTableStyleFamily, uno::UNO_QUERY_THROW) +->insertByName("table_1", uno::Any(xTableStyle)); +uno::Reference(xCellStyleFamily, uno::UNO_QUERY_THROW) +->insertByName("table-body_1", uno::Any(xCellStyle)); +uno::Reference(xTableStyle, uno::UNO_QUERY_THROW) +->replaceByName("body", uno::Any(xCellStyle)); +} + +saveAndReload("draw8"); + +{ +uno::Reference xStyleFamiliesSupplier(mxComponent, + uno::UNO_QUERY_THROW); +uno::Reference xTableStyleFamily( +xStyleFamiliesSupplier->getStyleFamilies()->getByName("table"), uno::UNO_QUERY_THROW); +// Such style used to be exported as "table_5f_1" instead. +CPPUNIT_ASSERT(xTableStyleFamily->hasByName("table_1")); + +uno::Reference xTableStyle(xTableStyleFam
[Libreoffice-commits] core.git: 2 commits - include/xmloff sd/qa sw/source xmloff/source
include/xmloff/table/XMLTableImport.hxx |3 - sd/qa/unit/misc-tests.cxx | 52 ++ sw/source/filter/xml/xmlfmt.cxx |2 xmloff/source/table/XMLTableExport.cxx |4 - xmloff/source/table/XMLTableImport.cxx | 92 5 files changed, 70 insertions(+), 83 deletions(-) New commits: commit 95a3d7733c5b48c99b2b74b06c7718fdcd03 Author: Maxim Monastirsky AuthorDate: Thu Dec 8 14:07:36 2022 +0200 Commit: Maxim Monastirsky CommitDate: Fri Dec 9 00:13:42 2022 + Deduplicate table styles insertion (Not adding a test here, as this should already be covered by several tests in sw/qa/extras/odfexport/odfexport.cxx.) Change-Id: Ic3cae9f38efc55d3d9055a45bc642d7b15fa382a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143840 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/include/xmloff/table/XMLTableImport.hxx b/include/xmloff/table/XMLTableImport.hxx index 0889637f2e23..3577ed8adedf 100644 --- a/include/xmloff/table/XMLTableImport.hxx +++ b/include/xmloff/table/XMLTableImport.hxx @@ -58,13 +58,12 @@ public: const rtl::Reference< SvXMLImportPropertyMapper >& GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper; } void addTableTemplate( const OUString& rsStyleName, XMLTableTemplate& xTableTemplate ); -/// Inserts to the doc template with given name. -void insertTabletemplate( const OUString& rsStyleName, bool bOverwrite); /// Inserts all table templates. void finishStyles(); private: SvXMLImport& mrImport; +boolmbWriter; rtl::Reference< SvXMLImportPropertyMapper > mxCellImportPropertySetMapper; rtl::Reference< SvXMLImportPropertyMapper > mxRowImportPropertySetMapper; rtl::Reference< SvXMLImportPropertyMapper > mxColumnImportPropertySetMapper; diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 8d21591e12b9..9bd4d2a5f41b 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -919,6 +919,8 @@ OUString SwXMLStylesContext_Impl::GetServiceName( XmlStyleFamily nFamily ) const void SwXMLStylesContext_Impl::endFastElement(sal_Int32 ) { GetSwImport().InsertStyles( IsAutomaticStyle() ); +if (!IsAutomaticStyle()) +GetImport().GetShapeImport()->GetShapeTableImport()->finishStyles(); } namespace { diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index 65b6be09d2ff..40899a4fda84 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -206,7 +206,6 @@ public: virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; -virtual void CreateAndInsert( bool bOverwrite ) override; protected: virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) override; @@ -234,21 +233,21 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLProxyContext::creat XMLTableImport::XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef ) : mrImport( rImport ) +, mbWriter( false ) { -bool bWriter = false; // check if called by Writer Reference xFac(rImport.GetModel(), UNO_QUERY); if (xFac.is()) try { Sequence sSNS = xFac->getAvailableServiceNames(); -bWriter = comphelper::findValue(sSNS, "com.sun.star.style.TableStyle") != -1; +mbWriter = comphelper::findValue(sSNS, "com.sun.star.style.TableStyle") != -1; } catch(const Exception&) { SAL_WARN("xmloff.table", "Error while checking available service names"); } -if (bWriter) +if (mbWriter) { mxCellImportPropertySetMapper = XMLTextImportHelper::CreateTableCellExtPropMapper(rImport); } @@ -288,69 +287,6 @@ void XMLTableImport::addTableTemplate( const OUString& rsStyleName, XMLTableTemp maTableTemplates.emplace_back(rsStyleName, xPtr); } -void XMLTableImport::insertTabletemplate(const OUString& rsStyleName, bool bOverwrite) -{ -// FIXME: All templates will be inserted eventually, but -// instead of simply iterating them, like in finishStyles(), -// we search here by name again and again. -auto it = std::find_if(maTableTemplates.begin(), maTableTemplates.end(), -[&rsStyleName](const auto& item) { return rsStyleName == item.first; }); -if (it == maTableTemplates.end()) -return; - -try -{ -Reference xFamiliesSupp(mrImport.GetModel(), UNO_QUERY_THROW); -Reference xFamilies(xFamiliesSupp->ge
[Libreoffice-commits] core.git: sd/inc sd/source
sd/inc/stlpool.hxx |1 + sd/inc/stlsheet.hxx |1 + sd/source/core/drawdoc3.cxx | 21 ++--- sd/source/core/stlpool.cxx |9 + 4 files changed, 29 insertions(+), 3 deletions(-) New commits: commit 441ecdc951211cc1e8453434d26ae40c121cb153 Author: Maxim Monastirsky AuthorDate: Mon Dec 5 14:25:31 2022 +0200 Commit: Maxim Monastirsky CommitDate: Wed Dec 7 10:59:29 2022 + sd: improve handling of table styles on page pasting - Remove table styles that were copied from the source document, but not actually used in the pasted pages. Same as we were doing already for graphic/cell styles. - Disable the undo record of inserted cell styles, as long as we don't have undo actions also for the table style. This prevents data loss, as otherwise the table style will be exported, but not the cell styles it uses. The difficulty with having an undo action for table styles is that once a style is removed from its family it is disposed, so we no longer able to use that style for a redo action. This was "solved" in i#120015 for graphic/cell styles, by not disposing them at all. However table styles maintain cyclic references with their cell styles, so we can't give up on disposing. I'll take the time to think on a proper solution for this (e.g. making copies of styles instead of dealing with the original ones might be an option). For now, let's just remove this unfinished undo attempt. Change-Id: Iae06273217b2d695401921a84e7edf096556530e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143749 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx index bb73e157ed3f..9e1693249f86 100644 --- a/sd/inc/stlpool.hxx +++ b/sd/inc/stlpool.hxx @@ -75,6 +75,7 @@ public: voidCopyGraphicSheets(SdStyleSheetPool& rSourcePool); voidCopyCellSheets(SdStyleSheetPool& rSourcePool); voidCopyTableStyles(SdStyleSheetPool const & rSourcePool); +voidCopyTableStyles(SdStyleSheetPool const & rSourcePool, XStyleVector& rCreatedSheets); voidCopyCellSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets); voidRenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets, std::u16string_view rRenameSuffix); diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx index 9080c3b8805b..e830c097e990 100644 --- a/sd/inc/stlsheet.hxx +++ b/sd/inc/stlsheet.hxx @@ -165,6 +165,7 @@ private: }; typedef std::vector< rtl::Reference< SdStyleSheet > > SdStyleSheetVector; +typedef std::vector< css::uno::Reference< css::style::XStyle > > XStyleVector; struct StyleSheetCopyResult { diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 810969940bae..bf7d304e 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -345,6 +345,21 @@ lcl_removeUnusedStyles(SfxStyleSheetBasePool* const pStyleSheetPool, StyleSheetC rStyles = aUsedStyles; } +void +lcl_removeUnusedTableStyles(SdStyleSheetPool* const pStyleSheetPool, XStyleVector const & rStyles) +{ +css::uno::Reference xTableFamily( +pStyleSheetPool->getByName("table"), css::uno::UNO_QUERY); +if (!xTableFamily) +return; + +for (const auto& a : rStyles) +{ +if (!a->isInUse()) +xTableFamily->removeByName(a->getName()); +} +} + SfxStyleSheet *lcl_findStyle(StyleSheetCopyResultVector& rStyles, std::u16string_view aStyleName) { for (const auto& a : rStyles) @@ -524,7 +539,8 @@ bool SdDrawDocument::InsertBookmarkAsPage( rStyleSheetPool.CopyCellSheets(rBookmarkStyleSheetPool, aNewCellStyles); // TODO handle undo of table styles too -rStyleSheetPool.CopyTableStyles(rBookmarkStyleSheetPool); +XStyleVector aNewTableStyles; +rStyleSheetPool.CopyTableStyles(rBookmarkStyleSheetPool, aNewTableStyles); // Insert document @@ -934,9 +950,8 @@ bool SdDrawDocument::InsertBookmarkAsPage( lcl_removeUnusedStyles(GetStyleSheetPool(), aNewGraphicStyles); if (!aNewGraphicStyles.empty() && pUndoMgr) pUndoMgr->AddUndoAction(std::make_unique(this, aNewGraphicStyles, true)); + lcl_removeUnusedTableStyles(static_cast(GetStyleSheetPool()), aNewTableStyles); lcl_removeUnusedStyles(GetStyleSheetPool(), aNewCellStyles); -if (!aNewCellStyles.empty() && pUndoMgr) - pUndoMgr->AddUndoAction(std::make_unique(this, aNewCellStyles, true)); if( bUndo ) EndUndo(); diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 738279e8a440..4bca10fb71bc 100644 --- a
[Libreoffice-commits] core.git: 2 commits - sd/source
sd/source/core/stlpool.cxx | 53 + 1 file changed, 21 insertions(+), 32 deletions(-) New commits: commit 86c50d7d7de2e5c4be5f7c6931d87d1b17bcaf82 Author: Maxim Monastirsky AuthorDate: Sun Dec 4 16:26:55 2022 +0200 Commit: Maxim Monastirsky CommitDate: Mon Dec 5 07:26:20 2022 + sd: Don't replace table styles on page pasting i.e. insert a table, and set its style to anything except default. Then right click on the page in the page pane => Copy. Right click again => Paste. The table on the first page will reset to the default table style. The problem is in SdStyleSheetPool::CopyTableStyles which attempts to replace existing styles with the pasted ones, causing the old ones to be destroyed. But in fact there's absolutely no case where we want to do anything like this. All we want is to keep the formatting of the pasted page, not to change existing styles which might be used in the rest of the document. (And if the pasted style has indeed a different formatting, it can be inserted under a different name. To be handled in a follow-up commit.) Change-Id: I7caaffc72265bb045bf21c831f2da27012e41845 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143644 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index ad4733f96189..738279e8a440 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -553,7 +553,7 @@ void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool const & rSourcePool) const OUString sName(Reference(xSourceTableStyle, UNO_QUERY_THROW)->getName()); if( xTarget->hasByName( sName ) ) -xTarget->replaceByName( sName, Any( xNewTableStyle ) ); +Reference(xNewTableStyle, UNO_QUERY_THROW)->dispose(); else xTarget->insertByName( sName, Any( xNewTableStyle ) ); } commit 1c3dc6cdc53a2463af12688918d222d44039a96c Author: Maxim Monastirsky AuthorDate: Sun Dec 4 16:21:27 2022 +0200 Commit: Maxim Monastirsky CommitDate: Mon Dec 5 07:26:11 2022 + Simplify SdStyleSheetPool::CopyTableStyles a bit Change-Id: Ib8bbc8f71b310c1b968f36a94e99cce6019dd6cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143643 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 79f07b0b614a..ad4733f96189 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -526,47 +526,36 @@ void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool const & rSourcePool) Reference< XNameContainer > xTarget( mxTableFamily, UNO_QUERY ); Reference< XSingleServiceFactory > xFactory( mxTableFamily, UNO_QUERY ); -if( !(xSource.is() && xFactory.is() && mxTableFamily.is()) ) +if( !xSource || !xFactory ) return; for( sal_Int32 nIndex = 0; nIndex < xSource->getCount(); nIndex++ ) try { -Reference< XStyle > xSourceTableStyle( xSource->getByIndex( nIndex ), UNO_QUERY ); -if( xSourceTableStyle.is() ) +Reference< XNameAccess > xSourceTableStyle( xSource->getByIndex( nIndex ), UNO_QUERY_THROW ); +Reference< XNameReplace > xNewTableStyle( xFactory->createInstance(), UNO_QUERY_THROW ); + +const Sequence< OUString > aStyleNames( xSourceTableStyle->getElementNames() ); +for( const OUString& aName : aStyleNames ) { -Reference< XStyle > xNewTableStyle( xFactory->createInstance(), UNO_QUERY ); -if( xNewTableStyle.is() ) +Reference< XStyle > xSourceStyle( xSourceTableStyle->getByName( aName ), UNO_QUERY ); +Reference< XStyle > xTargetStyle; +if( xSourceStyle.is() ) try { -Reference< XNameAccess> xSourceNames( xSourceTableStyle, UNO_QUERY_THROW ); - -const Sequence< OUString > aStyleNames( xSourceNames->getElementNames() ); - -Reference< XNameReplace > xTargetNames( xNewTableStyle, UNO_QUERY ); - -for( const OUString& aName : aStyleNames ) -{ -Reference< XStyle > xSourceStyle( xSourceNames->getByName( aName ), UNO_QUERY ); -Reference< XStyle > xTargetStyle; -if( xSourceStyle.is() ) try -{ -mxCellFamily->getByName( xSourceStyle->getName() ) >>= xTargetStyle; -} -catch( Exception& ) -{ -TOOLS_WARN_EXCEPTION( "sd", "sd::SdStyleSheetPool::CopyTableStyles()" ); -} -
[Libreoffice-commits] core.git: sd/source
sd/source/ui/table/TableDesignPane.cxx | 35 ++--- 1 file changed, 20 insertions(+), 15 deletions(-) New commits: commit 6d77d826c15807e80ccfff749908332e09c9f6f6 Author: Maxim Monastirsky AuthorDate: Wed Nov 30 22:47:04 2022 +0200 Commit: Maxim Monastirsky CommitDate: Thu Dec 1 10:59:54 2022 +0100 sd: sensible naming for created cell styles Instead of "user1", "user2" etc. now we have - e.g. magenta-dark-first-row, which makes them a lot easier to identify. Change-Id: I2db5e20f5f1d46d14034acb15b0f95c58a3f7611 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143514 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index aa331c3dcda1..cab67aa87f4f 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -97,6 +97,8 @@ const std::string_view gPropNames[CB_COUNT] = "UseBandingColumnStyle" }; +constexpr std::u16string_view aTableStyleBaseName = u"table"; + TableDesignWidget::TableDesignWidget(weld::Builder& rBuilder, ViewShellBase& rBase) : mrBase(rBase) , m_xMenu(rBuilder.weld_menu("menu")) @@ -207,15 +209,14 @@ IMPL_LINK(TableDesignWidget, implContextMenuHandler, const Point*, pPoint, void) namespace { -OUString getNewValidTableStyleName(const Reference& rTableFamily) +OUString getNewStyleName(const Reference& rFamily, std::u16string_view rBaseName) { -OUString aName; +OUString aName(rBaseName); sal_Int32 nIndex = 1; -do +while(rFamily->hasByName(aName)) { -aName = "table" + OUString::number(nIndex++); +aName = rBaseName + OUString::number(nIndex++); } -while(rTableFamily->hasByName(aName)); return aName; } @@ -228,7 +229,7 @@ void TableDesignWidget::InsertStyle() Reference xFactory(mxTableFamily, UNO_QUERY_THROW); Reference xTableFamily(mxTableFamily, UNO_QUERY_THROW); Reference xTableStyle(xFactory->createInstance(), UNO_QUERY_THROW); -const OUString aName(getNewValidTableStyleName(xTableFamily)); +const OUString aName(getNewStyleName(xTableFamily, aTableStyleBaseName)); xTableFamily->insertByName(aName, Any(xTableStyle)); Reference xCellStyle(mxCellFamily->getByName("default"), UNO_QUERY_THROW); @@ -255,33 +256,35 @@ void TableDesignWidget::CloneStyle() { try { -Reference xSrcTableStyle(mxTableFamily->getByIndex(m_xValueSet->GetSelectedItemId() - 1), UNO_QUERY_THROW); +Reference xSrcTableStyle(mxTableFamily->getByIndex(m_xValueSet->GetSelectedItemId() - 1), UNO_QUERY_THROW); Reference xFactory(mxTableFamily, UNO_QUERY_THROW); Reference xTableFamily(mxTableFamily, UNO_QUERY_THROW); -Reference xDestTableStyle(xFactory->createInstance(), UNO_QUERY_THROW); -const OUString aName(getNewValidTableStyleName(xTableFamily)); +Reference xDestTableStyle(xFactory->createInstance(), UNO_QUERY_THROW); +const OUString aName(getNewStyleName(xTableFamily, aTableStyleBaseName)); xTableFamily->insertByName(aName, Any(xDestTableStyle)); -for (sal_Int32 i = 0; i < xDestTableStyle->getCount(); ++i) +auto aNames(xSrcTableStyle->getElementNames()); +for (const auto& name : aNames) { -Reference xSrcCellStyle(xSrcTableStyle->getByIndex(i), UNO_QUERY); +Reference xSrcCellStyle(xSrcTableStyle->getByName(name), UNO_QUERY); if (xSrcCellStyle && xSrcCellStyle->isUserDefined()) { Reference xCellFactory(mxCellFamily, UNO_QUERY_THROW); Reference xDestCellStyle(xCellFactory->createInstance(), UNO_QUERY_THROW); xDestCellStyle->setParentStyle(xSrcCellStyle->getParentStyle()); -mxCellFamily->insertByName(xDestCellStyle->getName(), Any(xDestCellStyle)); +const OUString aStyleName(getNewStyleName(mxCellFamily, Concat2View(aName + "-" + name))); +mxCellFamily->insertByName(aStyleName, Any(xDestCellStyle)); rtl::Reference xSrcStyleSheet = static_cast(xSrcCellStyle.get()); rtl::Reference xDestStyleSheet = static_cast(xDestCellStyle.get()); xDestStyleSheet->GetItemSet().Put(xSrcStyleSheet->GetItemSet()); -xDestTableStyle->replaceByIndex(i, Any(xDestCellStyle)); +xDestTableStyle->replaceByName(name, Any(xDestCellStyle)); } else -xDestTableStyle->replaceByIndex(i, Any(xSrcCellStyle)); +x
[Libreoffice-commits] core.git: include/xmloff sd/inc sd/Package_xml.mk sd/qa sd/source sd/xml svx/source xmloff/source
include/xmloff/table/XMLTableImport.hxx |5 sd/Package_xml.mk|1 sd/inc/app.hrc |7 sd/inc/strings.hrc |5 sd/qa/uitest/impress_tests2/tdf139511.py | 10 - sd/qa/uitest/impress_tests2/tdf91762.py |7 sd/source/core/drawdoc4.cxx | 227 ++- sd/source/core/stlpool.cxx |7 sd/xml/styles.xml| 196 ++ svx/source/table/tabledesign.cxx |6 xmloff/source/draw/sdxmlimp.cxx | 21 ++ xmloff/source/table/XMLTableImport.cxx |8 - 12 files changed, 287 insertions(+), 213 deletions(-) New commits: commit daab698b346e5e40b67f1e15c796c4e399ccaf8a Author: Maxim Monastirsky AuthorDate: Tue Nov 22 14:07:12 2022 +0200 Commit: Maxim Monastirsky CommitDate: Tue Nov 29 09:39:22 2022 +0100 sd: replace hardcoded table styles with xml file Including a new set of default styles, provided by Rafael Lima. Some ui tests had to be modified, because the new borders are thicker. If you intend to edit the xml file, please keep in mind the following requirements: 1) There should be a table template called "default". It's applied to newly inserted tables. 2) There should be a cell style called "default". It's used for new table styles. 3) Please make all cell styles inherit from "default" (directly or indirectly), unless you intend to specify font names in them. "default" has its font names filled programmatically based on officecfg/registry/data/org/openoffice/VCL.xcu. 4) Whenever possible please use for cell properties, instead of the incorrect and we currently use for export. See tdf#72238 and tdf#72239. Change-Id: I73dd4492fefb65b1870238aec7dc64f8076f6e95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141825 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/include/xmloff/table/XMLTableImport.hxx b/include/xmloff/table/XMLTableImport.hxx index c0f702b5caaa..0889637f2e23 100644 --- a/include/xmloff/table/XMLTableImport.hxx +++ b/include/xmloff/table/XMLTableImport.hxx @@ -36,7 +36,10 @@ class SvXMLStyleContext; typedef std::map< OUString, OUString > XMLTableTemplate; -typedef std::map < OUString, std::shared_ptr< XMLTableTemplate > > XMLTableTemplateMap; +// Not using a map here, as we want the templates to be +// inserted in the same order they were defined in the +// xml (at least for sd built in templates): +typedef std::vector< std::pair< OUString, std::shared_ptr< XMLTableTemplate > > > XMLTableTemplateMap; class XMLOFF_DLLPUBLIC XMLTableImport final : public salhelper::SimpleReferenceObject { diff --git a/sd/Package_xml.mk b/sd/Package_xml.mk index fa227b72823c..555d46021bb7 100644 --- a/sd/Package_xml.mk +++ b/sd/Package_xml.mk @@ -14,6 +14,7 @@ $(eval $(call gb_Package_add_files,sd_xml,$(LIBO_SHARE_FOLDER)/config/soffice.cf transitions.xml \ layoutlist.xml \ objectlist.xml \ + styles.xml \ )) # vim: set noet sw=4 ts=4: diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 875dc0cc3e75..dcd09a8c7e46 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -67,13 +67,6 @@ #define HID_PSEUDOSHEET_NOTES (HID_SD_START + 98) #define HID_PSEUDOSHEET_SUBTITLE(HID_SD_START + 101) -#define HID_SD_CELL_STYLE_DEFAULT (HID_SD_START + 194) -#define HID_SD_CELL_STYLE_BANDED(HID_SD_START + 195) -#define HID_SD_CELL_STYLE_HEADER(HID_SD_START + 196) -#define HID_SD_CELL_STYLE_TOTAL (HID_SD_START + 197) -#define HID_SD_CELL_STYLE_FIRST_COLUMN (HID_SD_START + 198) -#define HID_SD_CELL_STYLE_LAST_COLUMN (HID_SD_START + 199) - #define SID_PAGESETUP (SID_SD_START+2) // FREE #define SID_COPYOBJECTS (SID_SD_START+4) diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc index 662acd59db12..c9a48bfe3574 100644 --- a/sd/inc/strings.hrc +++ b/sd/inc/strings.hrc @@ -360,11 +360,6 @@ #define STR_PSEUDOSHEET_NOTES NC_("STR_PSEUDOSHEET_NOTES", "Notes" ) #define STR_POWERPOINT_IMPORT NC_("STR_POWERPOINT_IMPORT", "PowerPoint Import") #define STR_SAVE_DOCNC_("STR_SAVE_DOC", "Save Document" ) -#define STR_POOLSHEET_BANDED_CELL NC_("STR_POOLSHEET_BANDED_CELL", "Banding cell" ) -#define STR_POOLSHEET_HEADER NC_("STR_POOLSHEET_HEADER", "Header" ) -#define STR_POOLSHEET_TOTAL
[Libreoffice-commits] core.git: sd/inc sd/source
sd/inc/stlsheet.hxx|2 ++ sd/source/core/stlsheet.cxx| 29 + sd/source/ui/table/TableDesignPane.cxx | 16 +--- 3 files changed, 40 insertions(+), 7 deletions(-) New commits: commit 423c2a6ac74cd30c6576e6794f67fda4fb685c11 Author: Maxim Monastirsky AuthorDate: Thu Nov 24 21:22:42 2022 +0200 Commit: Maxim Monastirsky CommitDate: Fri Nov 25 14:17:22 2022 +0100 sd: better detection of user defined cell styles Cell style might be used for several table roles at once, or even in several table styles (esp. after new/clone actions). But when we're editing a style, we want just a single place to be changed. The initial solution was to check if the style is user defined. The problem is that if we change the built-in styles set, then documents created with the old styles will have their once built-in styles turned into user defined. In such case we might still attempt to edit a shared style, which is unintended. So try harder, and check also that the style isn't used twice and that there is no other styles inheriting from it. Change-Id: I67d8c61b15161c9d839e97f7a31a1349a7e2613c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143288 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx index 645259e9e8fc..9080c3b8805b 100644 --- a/sd/inc/stlsheet.hxx +++ b/sd/inc/stlsheet.hxx @@ -63,6 +63,8 @@ public: virtual boolHasClearParentSupport() const override; virtual voidSetHelpId( const OUString& r, sal_uLong nId ) override; +bool IsEditable(); + voidAdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems = true); SdStyleSheet* GetRealStyleSheet() const; diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 1c11e5fea39d..4d72cf0915c6 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -325,6 +325,35 @@ bool SdStyleSheet::IsUsed() const return bResult; } +/** + * Checks if a cell style is used in two places at once. + * Typically we modify the formatting of a single place, + * so such style shouldn't be edited directly. + */ +bool SdStyleSheet::IsEditable() +{ +if (GetFamily() != SfxStyleFamily::Frame) +return true; + +if (!IsUserDefined()) +return false; + +const size_t nListenerCount = GetSizeOfVector(); +for (size_t n = 0; n < nListenerCount; ++n) +{ +SfxListener* pListener = GetListener(n); +if (pListener == this) +continue; +if (dynamic_cast(pListener)) +return false; +} + +MutexGuard aGuard(mrBHelper.rMutex); + +auto pContainer = mrBHelper.getContainer(cppu::UnoType::get()); +return !pContainer || pContainer->getLength() <= 1; +} + /** * Determine the style sheet for which this dummy is for. */ diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index dd7749db7e79..aa331c3dcda1 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -303,8 +303,10 @@ void TableDesignWidget::ResetStyle() for (sal_Int32 i = 0; i < xTableStyle->getCount(); ++i) { Reference xCellStyle(xTableStyle->getByIndex(i), UNO_QUERY); -if (xCellStyle && xCellStyle->isUserDefined()) -xTableStyle->replaceByIndex(i, mxCellFamily->getByName(xCellStyle->getParentStyle())); +while (xCellStyle && xCellStyle->isUserDefined() && !xCellStyle->getParentStyle().isEmpty()) + xCellStyle.set(mxCellFamily->getByName(xCellStyle->getParentStyle()), UNO_QUERY); + +xTableStyle->replaceByIndex(i, Any(xCellStyle)); } endTextEditForStyle(xTableStyle); @@ -353,17 +355,17 @@ void TableDesignWidget::EditStyle(std::string_view rCommand) { Reference xTableStyle(mxTableFamily->getByIndex(m_xValueSet->GetSelectedItemId() - 1), UNO_QUERY_THROW); Reference xCellStyle(xTableStyle->getByName(OUString::fromUtf8(rCommand)), UNO_QUERY_THROW); +rtl::Reference xStyleSheet = static_cast(xCellStyle.get()); -bool bUserDefined = xCellStyle->isUserDefined(); +bool bUserDefined = xStyleSheet->IsEditable(); if (!bUserDefined) { Reference xFactory(mxCellFamily, UNO_QUERY_THROW); -Reference xNewStyle(xFactory->createInstance(), UNO_QUERY_THROW); -xNewStyle->setParentStyle(xCellStyle->getName()); -xCellStyle = xNewStyle; +xCellStyle.set(xFactory->createInstance(), UNO_QUERY_THROW); +xCellStyle->setParentStyle(xStyleSheet->getName()); +
[Libreoffice-commits] core.git: sd/source
sd/source/ui/inc/TableDesignPane.hxx |1 + sd/source/ui/table/TableDesignPane.cxx | 21 + 2 files changed, 22 insertions(+) New commits: commit 24ea3f7b0ed23e8ed1b8e42db440aaf54084e1ac Author: Maxim Monastirsky AuthorDate: Tue Nov 22 11:56:36 2022 +0200 Commit: Maxim Monastirsky CommitDate: Tue Nov 22 14:04:08 2022 +0100 End text edit mode before changing a table style Because we now support text attributes in styles, and their visualization will not update when in edit mode. Change-Id: I117812442b07476a84b9bd887fa2380ec4581283 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143101 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/source/ui/inc/TableDesignPane.hxx b/sd/source/ui/inc/TableDesignPane.hxx index a3658bb30bf2..2ab94204b7ff 100644 --- a/sd/source/ui/inc/TableDesignPane.hxx +++ b/sd/source/ui/inc/TableDesignPane.hxx @@ -86,6 +86,7 @@ private: void removeListener(); void updateControls(); void selectStyle(std::u16string_view rStyle); +void endTextEditForStyle(const css::uno::Reference& rStyle); void setDocumentModified(); void FillDesignPreviewControl(); diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 07371e6e9980..dd7749db7e79 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -307,6 +307,7 @@ void TableDesignWidget::ResetStyle() xTableStyle->replaceByIndex(i, mxCellFamily->getByName(xCellStyle->getParentStyle())); } +endTextEditForStyle(xTableStyle); Reference(xTableStyle, UNO_QUERY_THROW)->setModified(false); updateControls(); @@ -331,6 +332,8 @@ void TableDesignWidget::DeleteStyle() if (xBox->run() != RET_YES) return; + +endTextEditForStyle(xTableStyle); } Reference(mxTableFamily, UNO_QUERY_THROW)->removeByName(xTableStyle->getName()); @@ -377,6 +380,8 @@ void TableDesignWidget::EditStyle(std::string_view rCommand) mrBase.GetFrameWeld(), &aNewAttr, *mrBase.GetDrawView()->GetModel(), true) : nullptr); if (pDlg && pDlg->Execute() == RET_OK) { +endTextEditForStyle(xTableStyle); + if (!bUserDefined) { mxCellFamily->insertByName(xCellStyle->getName(), Any(xCellStyle)); @@ -446,6 +451,9 @@ void TableDesignWidget::ApplyStyle() { if( pView ) { +if (pView->IsTextEdit()) +pView->SdrEndTextEdit(); + SfxRequest aReq( SID_TABLE_STYLE, SfxCallMode::SYNCHRON, SfxGetpApp()->GetPool() ); aReq.AppendItem( SfxStringItem( SID_TABLE_STYLE, sStyleName ) ); @@ -668,6 +676,19 @@ void TableDesignWidget::selectStyle(std::u16string_view rStyle) } } +void TableDesignWidget::endTextEditForStyle(const Reference& rStyle) +{ +if (!mxSelectedTable) +return; + +Reference xTableStyle(mxSelectedTable->getPropertyValue("TableTemplate"), UNO_QUERY); +if (xTableStyle != rStyle) +return; + +if (mrBase.GetDrawView()->IsTextEdit()) +mrBase.GetDrawView()->SdrEndTextEdit(); +} + void TableDesignWidget::addListener() { Link aLink( LINK(this,TableDesignWidget,EventMultiplexerListener) );
[Libreoffice-commits] core.git: 2 commits - icon-themes/colibre include/svx sd/inc sd/qa sd/source sd/uiconfig svx/source xmloff/source
icon-themes/colibre/sd/res/addtablestyle.png |binary include/svx/sdr/table/tablecontroller.hxx|3 sd/inc/bitmaps.hlst |1 sd/inc/strings.hrc |2 sd/qa/unit/data/odg/tablestyles.fodg | 22 + sd/qa/unit/export-tests.cxx | 35 ++ sd/source/core/drawdoc4.cxx |5 sd/source/core/stlsheet.cxx |9 sd/source/ui/inc/TableDesignPane.hxx | 16 + sd/source/ui/table/TableDesignPane.cxx | 317 +-- sd/uiconfig/simpress/ui/tabledesignpanel.ui | 118 ++ svx/source/table/tablecontroller.cxx | 56 ++-- svx/source/table/tabledesign.cxx | 126 ++ xmloff/source/table/XMLTableExport.cxx | 14 + 14 files changed, 674 insertions(+), 50 deletions(-) New commits: commit f23d3661ab04601650db95f846081317fc06801d Author: Maxim Monastirsky AuthorDate: Sun Nov 13 14:50:08 2022 +0200 Commit: Maxim Monastirsky CommitDate: Mon Nov 21 14:39:14 2022 +0100 sd: table design editing Change-Id: I75559c80da015a13ee078bdda06f6f4975fe5946 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140943 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/icon-themes/colibre/sd/res/addtablestyle.png b/icon-themes/colibre/sd/res/addtablestyle.png new file mode 100644 index ..8e4422cb733f Binary files /dev/null and b/icon-themes/colibre/sd/res/addtablestyle.png differ diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx index e71eba7cf608..bb02fc271f52 100644 --- a/include/svx/sdr/table/tablecontroller.hxx +++ b/include/svx/sdr/table/tablecontroller.hxx @@ -87,6 +87,9 @@ public: const SdrTableObj& rObj, const rtl::Reference< sdr::SelectionController >& xRefController); +static SvxBoxItem TextDistancesToSvxBoxItem(const SfxItemSet& rAttrSet); +static void SvxBoxItemToTextDistances(const SvxBoxItem& pOriginalItem, SfxItemSet& rAttrSet); + SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const; SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll); void SetAttrToSelectedShape(const SfxItemSet& rAttr); diff --git a/sd/inc/bitmaps.hlst b/sd/inc/bitmaps.hlst index e1c798cfae4e..32e81ced59fa 100644 --- a/sd/inc/bitmaps.hlst +++ b/sd/inc/bitmaps.hlst @@ -78,6 +78,7 @@ inline constexpr OUStringLiteral BMP_POINTER_ICON = u"sd/res/pointericon.png"; inline constexpr OUStringLiteral BMP_WAIT_ICON = u"sd/res/waiticon.png"; inline constexpr OUStringLiteral BMP_FADE_EFFECT_INDICATOR = u"sd/res/fade_effect_indicator.png"; inline constexpr OUStringLiteral BMP_CUSTOM_ANIMATION_INDICATOR = u"sd/res/click_16.png"; +inline constexpr OUStringLiteral BMP_INSERT_TABLESTYLE = u"sd/res/addtablestyle.png"; // Presenter Screen bitmaps: inline constexpr OUStringLiteral BMP_PRESENTERSCREEN_BORDER_LEFT = u"sd/res/presenterscreen-BorderLeft.png"; inline constexpr OUStringLiteral BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_DISABLED = u"sd/res/presenterscreen-ButtonSlideNextDisabled.png"; diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc index 05326f9e461a..662acd59db12 100644 --- a/sd/inc/strings.hrc +++ b/sd/inc/strings.hrc @@ -484,5 +484,7 @@ #define RID_SVXSTR_MENU_LAST NC_("RID_SVXSTR_MENU_LAST", "~Last Slide") #define STR_CLOSE_PANE NC_("STR_CLOSE_PANE", "Close Pane") +#define STR_INSERT_TABLESTYLE NC_("STR_INSERT_TABLESTYLE", "Add a new design") +#define STR_REMOVE_TABLESTYLE NC_("STR_REMOVE_TABLESTYLE", "The selected style is in use in this document.\nIf you will delete this style, tables using it will revert to the default style.\nDo you still wish to delete this style?\n") /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/TableDesignPane.hxx b/sd/source/ui/inc/TableDesignPane.hxx index 042eb6137662..a3658bb30bf2 100644 --- a/sd/source/ui/inc/TableDesignPane.hxx +++ b/sd/source/ui/inc/TableDesignPane.hxx @@ -25,7 +25,7 @@ #include namespace com::sun::star::beans { class XPropertySet; } -namespace com::sun::star::container { class XIndexAccess; } +namespace com::sun::star::container { class XIndexAccess; class XNameContainer; } namespace com::sun::star::drawing { class XDrawView; } namespace sd @@ -52,12 +52,16 @@ class TableValueSet final : public ValueSet { private: bool m_bModal; +Link maContextMenuHandler; public: TableValueSet(std::unique_ptr pScrolledWindow); +virtual bool Command(const CommandEvent& rEvent) override; virtual void Re
[Libreoffice-commits] core.git: cui/qa cui/source cui/uiconfig include/svx svx/source
cui/qa/unit/cui-dialogs-test.cxx |3 cui/source/dialogs/sdrcelldlg.cxx| 43 + cui/source/factory/dlgfact.cxx |4 cui/source/factory/dlgfact.hxx |2 cui/source/inc/paragrph.hxx |8 + cui/source/inc/sdrcelldlg.hxx|2 cui/source/tabpages/paragrph.cxx | 40 - cui/uiconfig/ui/formatcellsdialog.ui | 151 +-- cui/uiconfig/ui/paragalignpage.ui| 11 ++ include/svx/svxdlg.hxx |2 svx/source/table/tablecontroller.cxx |2 11 files changed, 244 insertions(+), 24 deletions(-) New commits: commit 553cfbfc9e74a03fe02a58e9aa6076fc1dddeb7b Author: Maxim Monastirsky AuthorDate: Tue Oct 4 16:05:06 2022 +0300 Commit: Maxim Monastirsky CommitDate: Sat Nov 19 18:13:54 2022 +0100 Prepare the dialog for cell style editing Change-Id: I54ec1486f49f240e1ab88662b9d1b0b741cf8878 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142905 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/cui/qa/unit/cui-dialogs-test.cxx b/cui/qa/unit/cui-dialogs-test.cxx index f4f73facbaa6..cf8c302fc209 100644 --- a/cui/qa/unit/cui-dialogs-test.cxx +++ b/cui/qa/unit/cui-dialogs-test.cxx @@ -69,7 +69,8 @@ VclPtr CuiDialogsTest::createDialogByID(sal_uInt32 nID) { case 0: // "cui/ui/formatcellsdialog.ui" { -pReturnDialog = mpFact->CreateSvxFormatCellsDialog(nullptr, mxAttr.get(), *mxModel); +pReturnDialog += mpFact->CreateSvxFormatCellsDialog(nullptr, mxAttr.get(), *mxModel, true); break; } diff --git a/cui/source/dialogs/sdrcelldlg.cxx b/cui/source/dialogs/sdrcelldlg.cxx index fda8b4ce1385..3afbc0f694d3 100644 --- a/cui/source/dialogs/sdrcelldlg.cxx +++ b/cui/source/dialogs/sdrcelldlg.cxx @@ -21,10 +21,15 @@ #include #include #include +#include +#include +#include +#include +#include #include -SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel) -: SfxTabDialogController(pParent, "cui/ui/formatcellsdialog.ui", "FormatCellsDialog", pAttr) +SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel, bool bStyle) +: SfxTabDialogController(pParent, "cui/ui/formatcellsdialog.ui", "FormatCellsDialog", pAttr, bStyle) , mrOutAttrs(*pAttr) , mpColorTab(rModel.GetColorList()) , mnColorTabState ( ChangeType::NONE ) @@ -37,7 +42,29 @@ SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemS AddTabPage("effects", RID_SVXPAGE_CHAR_EFFECTS); AddTabPage("border", RID_SVXPAGE_BORDER ); AddTabPage("area", RID_SVXPAGE_AREA); -AddTabPage("shadow", SvxShadowTabPage::Create, nullptr); + +if (bStyle) +{ +AddTabPage("position", RID_SVXPAGE_CHAR_POSITION); +AddTabPage("highlight", RID_SVXPAGE_BKG); +AddTabPage("indentspacing", RID_SVXPAGE_STD_PARAGRAPH); +AddTabPage("alignment", SvxParaAlignTabPage::Create, SvxParaAlignTabPage::GetSdrRanges); +RemoveTabPage("shadow"); +} +else +{ +RemoveTabPage("position"); +RemoveTabPage("highlight"); +RemoveTabPage("indentspacing"); +RemoveTabPage("alignment"); +AddTabPage("shadow", SvxShadowTabPage::Create, nullptr); +RemoveStandardButton(); +} + +if (bStyle && SvtCJKOptions::IsAsianTypographyEnabled()) +AddTabPage("asian", RID_SVXPAGE_PARA_ASIAN); +else +RemoveTabPage("asian"); } void SvxFormatCellsDialog::PageCreated(const OString& rId, SfxTabPage &rPage) @@ -62,6 +89,16 @@ void SvxFormatCellsDialog::PageCreated(const OString& rId, SfxTabPage &rPage) static_cast(rPage).SetColorList( mpColorTab ); static_cast(rPage).SetColorChgd( &mnColorTabState ); } +else if (rId == "alignment") +{ +static_cast(rPage).EnableSdrVertAlign(); +} +else if (rId == "highlight") +{ +SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR))); +rPage.PageCreated(aSet); +} else SfxTabDialogController::PageCreated(rId, rPage); } diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index fb61dafcecbb..930452d64d09 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1428,9 +1428,9 @@ VclPtr AbstractDialogFactory_Impl::CreateLinksDialog(wel return VclPtr::Create(std::move(xLinkDlg)); } -VclPtr AbstractDialogFactory_Impl::Creat
[Libreoffice-commits] core.git: svx/source
svx/source/table/svdotable.cxx | 22 +- svx/source/table/tabledesign.cxx |6 -- 2 files changed, 21 insertions(+), 7 deletions(-) New commits: commit b257b4f247bc2a1fa4d469ec82e37bdbb268951b Author: Maxim Monastirsky AuthorDate: Sun Nov 13 11:07:40 2022 +0200 Commit: Maxim Monastirsky CommitDate: Mon Nov 14 09:36:05 2022 +0100 svx: On table style removal, revert to the default style Change-Id: Ie299634c93640a89d9c98b2cd517c5cb83434ea7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142666 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 7764f35d1842..c605bb8c2e8c 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -749,12 +749,24 @@ void SdrTableObjImpl::dumpAsXml(xmlTextWriterPtr pWriter) const // XEventListener -void SAL_CALL SdrTableObjImpl::disposing( const css::lang::EventObject& /*Source*/ ) +void SAL_CALL SdrTableObjImpl::disposing( const css::lang::EventObject& Source ) { -mxActiveCell.clear(); -mxTable.clear(); -mpLayouter.reset(); -mpTableObj = nullptr; +assert(Source.Source == mxTableStyle); +(void)Source; + +Reference xDefaultStyle; +try +{ +Reference xSupplier(mpTableObj->getSdrModelFromSdrObject().getUnoModel(), UNO_QUERY_THROW); +Reference xTableFamily(xSupplier->getStyleFamilies()->getByName("table"), UNO_QUERY_THROW); +xDefaultStyle.set(xTableFamily->getByName("default"), UNO_QUERY_THROW); +} +catch( Exception& ) +{ +TOOLS_WARN_EXCEPTION("svx.table", ""); +} + +mpTableObj->setTableStyle(xDefaultStyle); } diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index e2f629a2cb87..ec316972232d 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -109,7 +109,7 @@ public: void notifyModifyListener(); // this function is called upon disposing the component -virtual void disposing(std::unique_lock&) override; +virtual void disposing(std::unique_lock& aGuard) override; static const CellStyleNameMap& getCellStyleNameMap(); @@ -374,8 +374,10 @@ void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& // XComponent -void TableDesignStyle::disposing(std::unique_lock&) +void TableDesignStyle::disposing(std::unique_lock& aGuard) { +maModifyListeners.disposeAndClear(aGuard, EventObject(Reference(this))); + for(Reference & rCellStyle : maCellStyles) { Reference xBroadcaster(rCellStyle, UNO_QUERY);
[Libreoffice-commits] core.git: svx/inc svx/source
svx/inc/sdr/properties/textproperties.hxx |1 + svx/source/table/svdotable.cxx|5 - 2 files changed, 5 insertions(+), 1 deletion(-) New commits: commit f06353aadfc1a9329da0d5fe0cb5878d124b01aa Author: Maxim Monastirsky AuthorDate: Wed Oct 19 21:19:39 2022 +0300 Commit: Maxim Monastirsky CommitDate: Mon Nov 14 09:35:27 2022 +0100 svx: Update tables on style changes After modifying a cell style, it is required to broadcast the SfxHintId::DataChanged hint on that style, to update the table appearance. However, it doesn't work when only text attributes (e.g. font name or color) were changed, unless the table is also moved around a bit. It seems to be the same problem as i#101556, whose fix didn't handle the table case. The problem here is that the change hint is handled by the individual cells properties objects, and nothing updates the table's properties object. Change-Id: I30ebc85c16b20c5354f02a309e6fa3dd4b31f669 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142665 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/svx/inc/sdr/properties/textproperties.hxx b/svx/inc/sdr/properties/textproperties.hxx index 916e5a7f6b5b..8a5065442ed0 100644 --- a/svx/inc/sdr/properties/textproperties.hxx +++ b/svx/inc/sdr/properties/textproperties.hxx @@ -79,6 +79,7 @@ namespace sdr::properties // #i101556# versioning support virtual sal_uInt32 getVersion() const override; +void increaseVersion() { maVersion++; } }; } // end of namespace sdr::properties diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index a22baf6d07b7..7764f35d1842 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -666,8 +666,11 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset // XModifyListener -void SAL_CALL SdrTableObjImpl::modified( const css::lang::EventObject& /*aEvent*/ ) +void SAL_CALL SdrTableObjImpl::modified( const css::lang::EventObject& aEvent ) { +if (aEvent.Source == mxTableStyle && mpTableObj) + static_cast(mpTableObj->GetProperties()).increaseVersion(); + update(); }
[Libreoffice-commits] core.git: sd/qa xmloff/source
sd/qa/unit/data/odg/tablestyles.fodg | 34 ++ sd/qa/unit/export-tests.cxx| 35 +++ xmloff/source/table/XMLTableExport.cxx | 14 ++- xmloff/source/table/XMLTableImport.cxx | 42 - 4 files changed, 123 insertions(+), 2 deletions(-) New commits: commit 6f32f1a12be06c4da92b807d8a35cb079984e26a Author: Maxim Monastirsky AuthorDate: Fri Oct 28 12:20:49 2022 +0300 Commit: Maxim Monastirsky CommitDate: Mon Oct 31 11:49:11 2022 +0100 tdf#72238 xmloff,sd: Import of Handles fo:border*, fo:padding*, fo:background-color and style:vertical-align attributes. Export is unchanged for now, as older versions still can't read this, and on the other hand we probably want to keep the import of the wrong attributes for the long term, to not break existing documents. Also, we can't fully export fill properties anyway because of tdf#103602. Change-Id: I8687507b98602ffcd05adb2087c894bb45aa3c6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142058 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sd/qa/unit/data/odg/tablestyles.fodg b/sd/qa/unit/data/odg/tablestyles.fodg new file mode 100644 index ..7b54e73955f9 --- /dev/null +++ b/sd/qa/unit/data/odg/tablestyles.fodg @@ -0,0 +1,34 @@ + +http://www.w3.org/TR/css3-text/"; xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooow="http://openoffice.org/2004/writer"; xmlns:xlink="http://www.w3.org/1999/xli nk" xmlns:drawooo="http://openoffice.org/2010/draw"; xmlns:oooc="http://openoffice.org/2004/calc"; xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table"; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report"; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office"; xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:o oo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.graphics"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 1a4060731387..f219e936ca9f 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -95,6 +96,7 @@ public: void testMasterPageBackgroundFullSize(); void testColumnsODG(); void testTdf112126(); +void testCellProperties(); CPPUNIT_TEST_SUITE(SdExportTest); @@ -143,6 +145,7 @@ public: CPPUNIT_TEST(testMasterPageBackgroundFullSize); CPPUNIT_TEST(testColumnsODG); CPPUNIT_TEST(testTdf112126); +CPPUNIT_TEST(testCellProperties); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -1994,6 +1997,38 @@ void SdExportTest::testTdf112126() xDocShRef
[Libreoffice-commits] core.git: cui/uiconfig sd/uiconfig
cui/uiconfig/ui/formatcellsdialog.ui| 197 +--- sd/uiconfig/simpress/ui/tabledesignpanel.ui | 100 +++--- 2 files changed, 87 insertions(+), 210 deletions(-) New commits: commit aa779fbd649dbf0e8e35ba744cdc81bd7171057b Author: Maxim Monastirsky AuthorDate: Sat Oct 15 23:31:21 2022 +0300 Commit: Maxim Monastirsky CommitDate: Thu Oct 20 10:03:47 2022 +0200 resave with latest glade Change-Id: I0ec13675efa1bd70fa4517bfcff0531da85a8e49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141540 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/cui/uiconfig/ui/formatcellsdialog.ui b/cui/uiconfig/ui/formatcellsdialog.ui index 9df8d7b34f68..0ced6ff18c63 100644 --- a/cui/uiconfig/ui/formatcellsdialog.ui +++ b/cui/uiconfig/ui/formatcellsdialog.ui @@ -1,33 +1,30 @@ - + -False -6 +False +6 Table Properties True -0 -0 -dialog - - - +0 +0 +dialog -False +False vertical 12 -False -end +False +end _Reset True -True -True +True +True True @@ -40,10 +37,10 @@ _OK True -True -True -True -True +True +True +True +True True @@ -56,8 +53,8 @@ _Cancel True -True -True +True +True True @@ -70,8 +67,8 @@ _Help True -True -True +True +True True @@ -85,47 +82,23 @@ False True -end +end 0 True -False +False True True True -True +True True -False - - - - - - - - - - - - - - - - - - - - - - - - +False @@ -134,42 +107,18 @@ True -False +False Font -False +False True -False - - - - - - - - - - - - - - - - - - - - - - - - +False @@ -181,43 +130,19 @@ True -False +False Font Effects 1 -False +False True -False - - - - - - - - - - - - - - - - - - - - - - - - +False @@ -229,43 +154,19 @@ True -False +False Borders
[Libreoffice-commits] core.git: svx/source
svx/source/table/tabledesign.cxx | 11 +++ 1 file changed, 11 insertions(+) New commits: commit 1a25000f91cae9f4275ec4a5c1d390fe7e52a86d Author: Maxim Monastirsky AuthorDate: Fri Oct 7 01:40:26 2022 +0300 Commit: Maxim Monastirsky CommitDate: Fri Oct 7 10:24:24 2022 +0200 svx: Destroy unused table styles Loading sd document with a table, replaces the built in table style with the one loaded from the document. But the old one used to not be destroyed, because it set as a listener of its cell styles. Change-Id: I8ae0a553207df20233886656307bb4ad371993f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141043 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index 03b16250f03e..e2f629a2cb87 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -377,7 +377,12 @@ void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& void TableDesignStyle::disposing(std::unique_lock&) { for(Reference & rCellStyle : maCellStyles) +{ +Reference xBroadcaster(rCellStyle, UNO_QUERY); +if (xBroadcaster) +xBroadcaster->removeModifyListener(this); rCellStyle.clear(); +} } @@ -569,6 +574,9 @@ void SAL_CALL TableDesignFamily::removeByName( const OUString& rName ) [&rName](const Reference& rpStyle) { return rpStyle->getName() == rName; }); if (iter != maDesigns.end()) { +Reference xComponent(*iter, UNO_QUERY); +if (xComponent) +xComponent->dispose(); maDesigns.erase( iter ); return; } @@ -592,6 +600,9 @@ void SAL_CALL TableDesignFamily::replaceByName( const OUString& rName, const Any [&rName](const Reference& rpStyle) { return rpStyle->getName() == rName; }); if (iter != maDesigns.end()) { +Reference xComponent(*iter, UNO_QUERY); +if (xComponent) +xComponent->dispose(); (*iter) = xStyle; xStyle->setName( rName ); return;
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/app/docst.cxx|6 -- sw/source/uibase/shells/tabsh.cxx | 14 -- 2 files changed, 16 insertions(+), 4 deletions(-) New commits: commit 9080200713292a200f2c6283f9c3f438411fc7d4 Author: Maxim Monastirsky AuthorDate: Thu Oct 6 01:32:11 2022 +0300 Commit: Maxim Monastirsky CommitDate: Thu Oct 6 20:05:34 2022 +0200 tdf#149741 Handle also inherited direction Change-Id: I0abc381bb9895c8ec5a18ddee1071fa6d13183ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141003 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 0ff18faa34d9..7e3b7e024ee2 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -596,12 +596,14 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) } else { -if(SfxStyleFamily::Page == m_nFamily) +if(SfxStyleFamily::Page == m_nFamily || SfxStyleFamily::Frame == m_nFamily) { static const sal_uInt16 aInval[] = { SID_IMAGE_ORIENTATION, SID_ATTR_CHAR_FONT, -FN_INSERT_CTRL, FN_INSERT_OBJ_CTRL, 0}; +FN_INSERT_CTRL, FN_INSERT_OBJ_CTRL, +FN_TABLE_INSERT_COL_BEFORE, +FN_TABLE_INSERT_COL_AFTER, 0}; pView->GetViewFrame()->GetBindings().Invalidate(aInval); } SfxItemSet aTmpSet( *m_pDlg->GetOutputItemSet() ); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 9a9182f40978..01bd9389c152 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -72,6 +72,7 @@ #include #include #include +#include #include #include @@ -1363,8 +1364,17 @@ void SwTableShell::GetState(SfxItemSet &rSet) case FN_TABLE_INSERT_COL_AFTER: { SfxImageItem aImageItem(nSlot); -if (pFormat->GetFrameDir().GetValue() == SvxFrameDirection::Horizontal_RL_TB) -aImageItem.SetMirrored(true); +if (pFormat->GetFrameDir().GetValue() == SvxFrameDirection::Environment) +{ +// Inherited from superordinate object (page or frame). +// If the table spans multiple pages, direction is set by the first page. +SwIterator aIterT(*pFormat); +for (SwTabFrame* pFrame = aIterT.First(); pFrame; +pFrame = static_cast(pFrame->GetPrecede())) +aImageItem.SetMirrored(pFrame->IsRightToLeft()); +} +else +aImageItem.SetMirrored(pFormat->GetFrameDir().GetValue() == SvxFrameDirection::Horizontal_RL_TB); rSet.Put(aImageItem); break; }
[Libreoffice-commits] core.git: framework/source
framework/source/uielement/generictoolbarcontroller.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 79e450749d58e21cad747592f49e505830184d74 Author: Maxim Monastirsky AuthorDate: Tue Sep 27 23:42:26 2022 +0300 Commit: Maxim Monastirsky CommitDate: Fri Sep 30 13:01:32 2022 +0200 tdf#151172 crash in notebookbar with extension enabled Change-Id: I60d777b27ffee095807490f4b181b1b08ed88462 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140683 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index f61a0d0150b9..1fd8998f0460 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -356,8 +356,9 @@ ImageOrientationController::ImageOrientationController(const ReferenceRemoveEventListener(LINK(this, ImageOrientationController, WindowEventListener)); +VclPtr pWindow = VCLUnoHelper::GetWindow(getParent()); +if (pWindow) +pWindow->RemoveEventListener(LINK(this, ImageOrientationController, WindowEventListener)); } IMPL_LINK(ImageOrientationController, WindowEventListener, VclWindowEvent&, rWindowEvent, void)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-1' - sc/source sd/source sw/source
sc/source/ui/drawfunc/drtxtob.cxx|2 +- sc/source/ui/view/editsh.cxx |2 +- sd/source/ui/view/drtxtob.cxx|2 +- sw/source/uibase/shells/annotsh.cxx |2 +- sw/source/uibase/shells/drwtxtex.cxx |2 +- sw/source/uibase/shells/textsh1.cxx |2 +- 6 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 02293e09b5e1c066c377cf4f0b6aa5c0aa61a581 Author: Maxim Monastirsky AuthorDate: Wed Aug 31 16:55:41 2022 +0300 Commit: Christian Lohmaier CommitDate: Fri Sep 9 15:39:58 2022 +0200 tdf#150506 Execution parameter confused with slot state Regression of a6eddceda5d376cd73922123a3bb3a5683307c41 ("rename some SID to FN_PARAM"). Change-Id: I5bcafdcec16cc91b1b77f7a3affd630a2f6cc556 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139121 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit a72861e3be5b89544ae943c0c5cc6d43e8e70a7d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138992 Reviewed-by: Caolán McNamara (cherry picked from commit 3e39f667590355843336edda9b2f8f7676bbc870) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139419 Reviewed-by: Xisco Fauli Reviewed-by: Eike Rathke Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 3e8a7f975f23..ec796f4a8521 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -450,7 +450,7 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) EditView& rEditView = pOutView->GetEditView(); bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); } -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable thesaurus main menu and context menu entry if there is nothing to look up bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index dbfd28404fd7..0fd33f62ed6d 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -817,7 +817,7 @@ void ScEditShell::GetState( SfxItemSet& rSet ) LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = pActiveView && GetStatusValueForThesaurusFromContext(aStatusVal, nLang, *pActiveView); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable thesaurus context menu entry if there is nothing to look up bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang ); diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index b3f53c7a6860..b10af08289fa 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -415,7 +415,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) OUStringaStatusVal; LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() ); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 3801f0489da7..4089a84970c5 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1399,7 +1399,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) OUStringaStatusVal; LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 0891d65c57d8..1a5f3a8665d4 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -703,7 +703,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/source sd/source sw/source
sc/source/ui/drawfunc/drtxtob.cxx|2 +- sc/source/ui/view/editsh.cxx |2 +- sd/source/ui/view/drtxtob.cxx|2 +- sw/source/uibase/shells/annotsh.cxx |2 +- sw/source/uibase/shells/drwtxtex.cxx |2 +- sw/source/uibase/shells/textsh1.cxx |2 +- 6 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 3e39f667590355843336edda9b2f8f7676bbc870 Author: Maxim Monastirsky AuthorDate: Wed Aug 31 16:55:41 2022 +0300 Commit: Caolán McNamara CommitDate: Thu Sep 1 13:09:35 2022 +0200 tdf#150506 Execution parameter confused with slot state Regression of a6eddceda5d376cd73922123a3bb3a5683307c41 ("rename some SID to FN_PARAM"). Change-Id: I5bcafdcec16cc91b1b77f7a3affd630a2f6cc556 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139121 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit a72861e3be5b89544ae943c0c5cc6d43e8e70a7d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138992 Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 3e8a7f975f23..ec796f4a8521 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -450,7 +450,7 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) EditView& rEditView = pOutView->GetEditView(); bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); } -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable thesaurus main menu and context menu entry if there is nothing to look up bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index dbfd28404fd7..0fd33f62ed6d 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -817,7 +817,7 @@ void ScEditShell::GetState( SfxItemSet& rSet ) LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = pActiveView && GetStatusValueForThesaurusFromContext(aStatusVal, nLang, *pActiveView); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable thesaurus context menu entry if there is nothing to look up bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang ); diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index b3f53c7a6860..b10af08289fa 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -415,7 +415,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) OUStringaStatusVal; LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() ); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 3801f0489da7..4089a84970c5 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1399,7 +1399,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) OUStringaStatusVal; LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 0891d65c57d8..1a5f3a8665d4 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -703,7 +703,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) LanguageType nLang = LANGUAGE_NONE; bool bIsLookUpWord = GetStatusValueForThesaurusFromContext(aStatusVal, nLang, pOLV->GetEditView()); -rSet.Put(SfxStringItem(FN_PARAM_THES_WORD_REPLACE, aStatusVal)); +rSet.Put(SfxS
[Libreoffice-commits] core.git: sc/source sd/source sw/source
sc/source/ui/drawfunc/drtxtob.cxx|2 +- sc/source/ui/view/editsh.cxx |2 +- sd/source/ui/view/drtxtob.cxx|2 +- sw/source/uibase/shells/annotsh.cxx |2 +- sw/source/uibase/shells/drwtxtex.cxx |2 +- sw/source/uibase/shells/textsh1.cxx |2 +- 6 files changed, 6 insertions(+), 6 deletions(-) New commits: commit a72861e3be5b89544ae943c0c5cc6d43e8e70a7d Author: Maxim Monastirsky AuthorDate: Wed Aug 31 16:55:41 2022 +0300 Commit: Maxim Monastirsky CommitDate: Wed Aug 31 21:53:56 2022 +0200 tdf#150506 Execution parameter confused with slot state Regression of a6eddceda5d376cd73922123a3bb3a5683307c41 ("rename some SID to FN_PARAM"). Change-Id: I5bcafdcec16cc91b1b77f7a3affd630a2f6cc556 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139121 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 3e8a7f975f23..ec796f4a8521 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -450,7 +450,7 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) EditView& rEditView = pOutView->GetEditView(); bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); } -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable thesaurus main menu and context menu entry if there is nothing to look up bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index dbfd28404fd7..0fd33f62ed6d 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -817,7 +817,7 @@ void ScEditShell::GetState( SfxItemSet& rSet ) LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = pActiveView && GetStatusValueForThesaurusFromContext(aStatusVal, nLang, *pActiveView); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable thesaurus context menu entry if there is nothing to look up bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang ); diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index b3f53c7a6860..b10af08289fa 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -415,7 +415,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) OUStringaStatusVal; LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() ); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 26d3d7f67513..3dcfc6a4a346 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1399,7 +1399,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) OUStringaStatusVal; LanguageTypenLang = LANGUAGE_NONE; bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); -rSet.Put( SfxStringItem( FN_PARAM_THES_WORD_REPLACE, aStatusVal ) ); +rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 0891d65c57d8..1a5f3a8665d4 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -703,7 +703,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) LanguageType nLang = LANGUAGE_NONE; bool bIsLookUpWord = GetStatusValueForThesaurusFromContext(aStatusVal, nLang, pOLV->GetEditView()); -rSet.Put(SfxStringItem(FN_PARAM_THES_WORD_REPLACE, aStatusVal)); +rSet.Put(SfxStringItem(SID_THES, aStatusVal)); // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference
[Libreoffice-commits] core.git: framework/inc framework/source include/framework include/sfx2 sfx2/inc sfx2/source vcl/source
framework/inc/uielement/toolbarmanager.hxx |2 framework/source/uielement/generictoolbarcontroller.cxx | 94 +++- framework/source/uielement/toolbarmanager.cxx | 10 + include/framework/generictoolbarcontroller.hxx | 24 +++- include/sfx2/weldutils.hxx |1 sfx2/inc/sidebar/ControllerFactory.hxx |4 sfx2/inc/sidebar/SidebarToolBox.hxx |1 sfx2/source/sidebar/ControllerFactory.cxx | 12 ++ sfx2/source/sidebar/SidebarToolBox.cxx |9 + sfx2/source/toolbox/weldutils.cxx |5 vcl/source/window/toolbox2.cxx | 43 ++- 11 files changed, 169 insertions(+), 36 deletions(-) New commits: commit dbeb697d62250e9429462c7f61b859893262a651 Author: Maxim Monastirsky AuthorDate: Fri Jul 29 09:56:51 2022 +0300 Commit: Maxim Monastirsky CommitDate: Tue Aug 30 13:08:39 2022 +0200 tdf#149956 Rework toolbar image flipping An unified code, covering both vcl and weld cases. For SidebarToolBox, the controller is created before items are inserted, so we listen for item insert event to set initially correct state. Change-Id: I3841f21883104b4d3f8541c97ec7fa5fc0bec575 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139022 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 865a1b54d5b4..debd898c9b45 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -55,6 +55,7 @@ class Menu; namespace framework { +class ImageOrientationController; class ToolBarManager; class ToolBarManagerImpl @@ -246,6 +247,7 @@ class ToolBarManager final : public ToolbarManager_Base OUString m_sIconTheme; rtl::Reference< ToolBarManager > m_aOverflowManager; +rtl::Reference< ImageOrientationController > m_aImageController; }; } diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index 312b5ed9e77f..f61a0d0150b9 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -30,9 +30,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -338,6 +338,98 @@ IMPL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, void*, p, void ) delete pExecuteInfo; } +ImageOrientationController::ImageOrientationController(const Reference& rContext, + const Reference& rFrame, + const Reference& rParentWindow, + const OUString& rModuleName) +: ToolboxController(rContext, rFrame, ".uno:ImageOrientation") +, m_nRotationAngle(0_deg10) +, m_bMirrored(false) +{ +m_sModuleName = rModuleName; +m_xParentWindow = rParentWindow; +initialize({}); +if (!m_pToolbar) +VCLUnoHelper::GetWindow(getParent())->AddEventListener(LINK(this, ImageOrientationController, WindowEventListener)); +} + +void ImageOrientationController::dispose() +{ +ToolboxController::dispose(); +if (!m_pToolbar) +VCLUnoHelper::GetWindow(getParent())->RemoveEventListener(LINK(this, ImageOrientationController, WindowEventListener)); +} + +IMPL_LINK(ImageOrientationController, WindowEventListener, VclWindowEvent&, rWindowEvent, void) +{ +if (m_bDisposed || rWindowEvent.GetId() != VclEventId::ToolboxItemAdded) +return; + +ToolBox* pToolBox = static_cast(rWindowEvent.GetWindow()); +ToolBoxItemId nItemId = pToolBox->GetItemId(reinterpret_cast(rWindowEvent.GetData())); +OUString aCommand = pToolBox->GetItemCommand(nItemId); + +if (vcl::CommandInfoProvider::IsMirrored(aCommand, getModuleName())) +pToolBox->SetItemImageMirrorMode(nItemId, m_bMirrored); +if (vcl::CommandInfoProvider::IsRotated(aCommand, getModuleName())) +pToolBox->SetItemImageAngle(nItemId, m_nRotationAngle); +} + +void ImageOrientationController::statusChanged(const css::frame::FeatureStateEvent& rEvent) +{ +if (m_bDisposed) +throw DisposedException(); + +SfxImageItem aItem; +aItem.PutValue(rEvent.State, 0); + +if (m_bMirrored == aItem.IsMirrored() && m_nRotationAngle == aItem.GetRotation()) +return; + +m_bMirrored = aItem.IsMirrored(); +m_nRotationAngle = aItem.GetRotation(); + +if (m_pToolbar) +{ +for (int i = 0, nCount = m_pToolbar->get_n_items(); i < nCount; ++i) +{
[Libreoffice-commits] core.git: framework/source include/framework include/vcl sfx2/source vcl/inc vcl/source vcl/unx
framework/source/uielement/generictoolbarcontroller.cxx | 14 ++ include/framework/generictoolbarcontroller.hxx |1 include/vcl/weld.hxx|1 sfx2/source/toolbox/weldutils.cxx |7 +-- vcl/inc/salvtables.hxx |2 vcl/source/app/salvtables.cxx |6 ++ vcl/source/window/toolbox2.cxx | 13 -- vcl/unx/gtk3/gtkinst.cxx| 33 8 files changed, 53 insertions(+), 24 deletions(-) New commits: commit 4fb8c0d14cb2468f7336438004f699b9eb7e7e4a Author: Maxim Monastirsky AuthorDate: Fri Jul 29 00:36:18 2022 +0300 Commit: Maxim Monastirsky CommitDate: Tue Aug 30 13:08:03 2022 +0200 tdf#149741 tdf#149956 Make flipping work also in the sidebar - Reset the icon each time, as there seems to be no easy way to retrieve the existing icon from a gtk widget in order to mirror it, like we used to do for vcl. Similar approach is currently taken in ToolboxButtonColorUpdaterBase::Update. - Store the flipping state also in GtkInstanceToolbar, similar to vcl's ToolBox. This seems to be the easiest way to make flipping not break on icon theme change, covering all 4 cases (ToolBarManager, SidebarToolBox, ToolbarUnoDispatcher, GenericToolbarController), w/o too involved changes in each. This might benefit from some refactoring later on, but should be good enough for now. - One unsolved problem is the appearance of flipped icons with svg themes, as the regular variant is handed to gtk directly, whereas the flipped one is loaded by us, resulting with a different (blurry) look. Change-Id: I48c16827b46fb75fd798a041851af6e2648ae8fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139021 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index e8e49cb30933..312b5ed9e77f 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -91,6 +91,7 @@ GenericToolbarController::GenericToolbarController( const Reference< XComponentC , m_xToolbar( pToolbar ) , m_nID( nID ) , m_bEnumCommand( isEnumCommand( aCommand )) +, m_bMirrored( false ) , m_bMadeInvisible( false ) , m_aEnumCommand( getEnumCommand( aCommand )) { @@ -189,6 +190,7 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event ) boolbValue; OUStringaStrValue; +SfxImageItem aImageItem; if ( Event.State >>= bValue ) { @@ -199,6 +201,13 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event ) { m_pToolbar->set_item_label(sId, aStrValue); } +else if ( aImageItem.PutValue( Event.State, 0 ) && aImageItem.IsMirrored() != m_bMirrored ) +{ +m_pToolbar->set_item_image_mirrored(sId, aImageItem.IsMirrored()); +auto xGraphic(vcl::CommandInfoProvider::GetXGraphicForCommand(m_aCommandURL, m_xFrame, m_pToolbar->get_icon_size())); +m_pToolbar->set_item_image(sId, xGraphic); +m_bMirrored = !m_bMirrored; +} else m_pToolbar->set_item_active(sId, false); @@ -295,9 +304,12 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event ) if ( m_bMadeInvisible ) m_xToolbar->ShowItem( m_nID ); } -else if ( aImageItem.PutValue( Event.State, 0 ) ) +else if ( aImageItem.PutValue( Event.State, 0 ) && aImageItem.IsMirrored() != m_bMirrored ) { m_xToolbar->SetItemImageMirrorMode( m_nID, aImageItem.IsMirrored() ); +Image aImage( vcl::CommandInfoProvider::GetImageForCommand( m_aCommandURL, m_xFrame, m_xToolbar->GetImageSize() )); +m_xToolbar->SetItemImage( m_nID, aImage ); +m_bMirrored = !m_bMirrored; if ( m_bMadeInvisible ) m_xToolbar->ShowItem( m_nID ); } diff --git a/include/framework/generictoolbarcontroller.hxx b/include/framework/generictoolbarcontroller.hxx index e177ea5f00a9..473941a7682a 100644 --- a/include/framework/generictoolbarcontroller.hxx +++ b/include/framework/generictoolbarcontroller.hxx @@ -64,6 +64,7 @@ class FWK_DLLPUBLIC GenericToolbarController final : public svt::ToolboxControll VclPtr m_xToolbar; ToolBoxItemId m_nID; boolm_bEnumCommand : 1, +m_bMirrored : 1, m_bMadeInvisible : 1; OUStringm_aEnumCommand; }; diff --git a/include/vcl/weld.hxx b/includ
[Libreoffice-commits] core.git: framework/inc framework/source include/vcl vcl/source
framework/inc/uielement/toolbarmanager.hxx|1 framework/source/uielement/toolbarmanager.cxx |9 - include/vcl/toolbox.hxx |9 - vcl/source/window/builder.cxx |2 - vcl/source/window/toolbox.cxx | 40 -- 5 files changed, 61 deletions(-) New commits: commit 2958e4c92f15652c424765f02c87518011eb2406 Author: Maxim Monastirsky AuthorDate: Fri Jul 29 00:08:46 2022 +0300 Commit: Maxim Monastirsky CommitDate: Tue Aug 30 13:07:36 2022 +0200 tdf#149956 Remove previous vcl only solution Change-Id: Id67b75856a230e175ccc6328ec0838c78589191b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139020 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 162e14aca4e3..865a1b54d5b4 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -82,7 +82,6 @@ public: virtual void Clear() = 0; virtual void SetName(const OUString& rName) = 0; virtual void SetHelpId(const OString& rHelpId) = 0; -virtual void TrackImageOrientation(const css::uno::Reference& rFrame) = 0; virtual bool WillUsePopupMode() = 0; virtual bool IsReallyVisible() = 0; virtual void SetIconSize(ToolBoxButtonSize eSize) = 0; diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 86a6c161900d..d1251f96cb84 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -292,11 +292,6 @@ public: m_pToolBar->SetHelpId( rHelpId ); } -virtual void TrackImageOrientation(const css::uno::Reference& rFrame) override -{ -m_pToolBar->TrackImageOrientation(rFrame); -} - virtual bool WillUsePopupMode() override { return m_pToolBar->WillUsePopupMode(); @@ -483,8 +478,6 @@ public: virtual void SetHelpId(const OString& /*rHelpId*/) override {} -virtual void TrackImageOrientation(const css::uno::Reference&) override {} - virtual bool WillUsePopupMode() override { return true; } virtual bool IsReallyVisible() override { return true; } @@ -1669,8 +1662,6 @@ void ToolBarManager::RequestImages() ++pIter; ++i; } - -m_pImpl->TrackImageOrientation(m_xFrame); } void ToolBarManager::notifyRegisteredControllers( const OUString& aUIElementName, const OUString& aCommand ) diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index f89cb335b541..055d82f1e722 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -34,8 +34,6 @@ #include namespace com::sun::star::frame { class XFrame; } -namespace com::sun::star::frame { struct FeatureStateEvent; } -template class VclStatusListener; class Timer; struct ImplToolItem; @@ -116,7 +114,6 @@ private: tools::LongmnBottomBorder; tools::LongmnLastResizeDY; tools::LongmnActivateCount; -Degree10mnImagesRotationAngle; ToolBoxItemId mnLastFocusItemId; ToolBoxItemId mnHighItemId; ToolBoxItemId mnCurItemId; @@ -143,7 +140,6 @@ private: mbDragging:1, mbIsKeyEvent:1, mbChangingHighlight:1, -mbImagesMirrored:1, mbLineSpacing:1, mbIsArranged:1; WindowAlign meAlign; @@ -161,8 +157,6 @@ private: Link maMenuButtonHdl; Link maStateChangedHandler; Link maDataChangedHandler; -/** StatusListener. Notifies about rotated images etc */ -rtl::Reference> mpStatusListener; public: using Window::ImplInit; @@ -504,14 +498,11 @@ public: void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout ); -void statusChanged(const css::frame::FeatureStateEvent& rEvent); void SetToolBoxTextPosition( ToolBoxTextPosition ePosition ); void SetLineSpacing(bool b) { mbLineSpacing = b; } -void TrackImageOrientation(const css::uno::Reference& rFrame); - virtual void DumpAsPropertyTree(tools::JsonWriter&) override; }; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index f1a31674e19e..441680aec077 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2155,8 +2155,6 @@ VclPtr VclBuilder::makeObject(vcl::Window *pParent, const OString & m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu); setupFromActionName(static_cast(xWindow.get()), rMap, m_xFrame); } -else if (xWindow->GetType() == WindowType::TOOLBOX) - static_cast(xWindow.get())->TrackImageOrientation(m_xFram
Re: ESC meeting minutes: 2022-08-11
Hi, > + Q: Is there a Help for the toolbars (usig F1 on the tbar) > + there is a fix in RC3 hopefully? (Thorsten) > https://gerrit.libreoffice.org/c/core/+/138030 related? > + seems F1 is processed differently in toolbars > + did it ever work? needs some more digging (feedback > appreciated) Just want to clarify here that F1 actually works for toolbars, i.e. pressing F6 until the focus lands on the toolbar, and making sure that a toolbar button is focused and not a different control like a combobox (because those might have their own help ids), then pressing F1 will try to bring the help for .HelpId:. The following toolbars have defined bookmarks in help, and all open the correct help pages after my patch applied: tableobjectbar, findbar, logo. (I did comment about this already in the respective bugzilla ticket, but it appears that it went unnoticed.)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-0' - framework/source
framework/source/uielement/toolbarmanager.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 00cc08d8b2e44b02d706305630e1bccb8d7b1149 Author: Maxim Monastirsky AuthorDate: Tue Aug 9 21:26:55 2022 +0300 Commit: Thorsten Behrens CommitDate: Wed Aug 10 13:58:47 2022 +0200 Missing colon in toolbar help ids Regression of 5200a73627d13e2997f81b53f61e143e77e328ee ("use more string_view in various"). Change-Id: I402eb6c03dcfa661c79c5469cfca3c86ac528f60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138066 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit f4c922f91e717728376dca943008a6dd56387c71) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138023 Reviewed-by: Noel Grandin Tested-by: Noel Grandin (cherry picked from commit ad0354c5c5964eefa9241653581c1860d1042644) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138030 Reviewed-by: Xisco Fauli Reviewed-by: Caolán McNamara Tested-by: Thorsten Behrens Reviewed-by: Thorsten Behrens diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 4d56884ffbb2..3cce6eef4509 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -633,7 +633,7 @@ void ToolBarManager::Init() sal_Int32 idx = m_aResourceName.lastIndexOf('/'); idx++; // will become 0 if '/' not found: use full string std::u16string_view aToolbarName = m_aResourceName.subView( idx ); -OString aHelpIdAsString = ".HelpId" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); +OString aHelpIdAsString = ".HelpId:" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); m_pImpl->SetHelpId( aHelpIdAsString ); m_aAsyncUpdateControllersTimer.SetTimeout( 50 );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - framework/source
framework/source/uielement/toolbarmanager.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ad0354c5c5964eefa9241653581c1860d1042644 Author: Maxim Monastirsky AuthorDate: Tue Aug 9 21:26:55 2022 +0300 Commit: Noel Grandin CommitDate: Wed Aug 10 13:17:17 2022 +0200 Missing colon in toolbar help ids Regression of 5200a73627d13e2997f81b53f61e143e77e328ee ("use more string_view in various"). Change-Id: I402eb6c03dcfa661c79c5469cfca3c86ac528f60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138066 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit f4c922f91e717728376dca943008a6dd56387c71) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138023 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 4d56884ffbb2..3cce6eef4509 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -633,7 +633,7 @@ void ToolBarManager::Init() sal_Int32 idx = m_aResourceName.lastIndexOf('/'); idx++; // will become 0 if '/' not found: use full string std::u16string_view aToolbarName = m_aResourceName.subView( idx ); -OString aHelpIdAsString = ".HelpId" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); +OString aHelpIdAsString = ".HelpId:" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); m_pImpl->SetHelpId( aHelpIdAsString ); m_aAsyncUpdateControllersTimer.SetTimeout( 50 );
[Libreoffice-commits] core.git: framework/source
framework/source/uielement/toolbarmanager.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f4c922f91e717728376dca943008a6dd56387c71 Author: Maxim Monastirsky AuthorDate: Tue Aug 9 21:26:55 2022 +0300 Commit: Maxim Monastirsky CommitDate: Wed Aug 10 08:29:33 2022 +0200 Missing colon in toolbar help ids Regression of 5200a73627d13e2997f81b53f61e143e77e328ee ("use more string_view in various"). Change-Id: I402eb6c03dcfa661c79c5469cfca3c86ac528f60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138066 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index ef3470a28fb3..86a6c161900d 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -614,7 +614,7 @@ void ToolBarManager::Init() sal_Int32 idx = m_aResourceName.lastIndexOf('/'); idx++; // will become 0 if '/' not found: use full string std::u16string_view aToolbarName = m_aResourceName.subView( idx ); -OString aHelpIdAsString = ".HelpId" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); +OString aHelpIdAsString = ".HelpId:" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); m_pImpl->SetHelpId( aHelpIdAsString ); m_aAsyncUpdateControllersTimer.SetTimeout( 50 );
[Libreoffice-commits] core.git: forms/source framework/source include/vcl vcl/inc vcl/source vcl/workben
forms/source/solar/control/navtoolbar.cxx |6 ++ framework/source/uielement/toolbarmanager.cxx |9 +++-- framework/source/uielement/toolbarmerger.cxx |3 +-- include/vcl/toolbox.hxx |1 + vcl/inc/toolbox.h |1 + vcl/source/app/salvtables.cxx |3 +-- vcl/source/window/NotebookBarAddonsMerger.cxx |1 - vcl/source/window/builder.cxx |3 +-- vcl/source/window/toolbox2.cxx| 14 -- vcl/workben/vcldemo.cxx |2 +- 10 files changed, 19 insertions(+), 24 deletions(-) New commits: commit c76857fe4e725834e6be9bd5b3273df95bf7fafd Author: Maxim Monastirsky AuthorDate: Thu Jul 21 23:56:42 2022 +0300 Commit: Maxim Monastirsky CommitDate: Wed Aug 10 08:28:18 2022 +0200 Make ToolBox::InsertItem take the command name For the next patch for tdf#149956 I need the command to be already set when the VclEventId::ToolboxItemAdded event is emitted. Change-Id: I3d8ce44b426a3ed5704d4520d6e62bc4efbf8e44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138038 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index 217a9d55d0d3..7193ac4532c1 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -91,7 +91,6 @@ namespace frm if ( pAsciiCommandName != nullptr ) return ".uno:" + OUString::createFromAscii( pAsciiCommandName ); -OSL_FAIL( "lcl_getCommandURL: unknown FormFeature!" ); return OUString(); } } @@ -279,13 +278,12 @@ namespace frm { // it's _not_ a separator // insert the entry -m_pToolbar->InsertItem( ToolBoxItemId(pSupportedFeatures->nId), OUString(), pSupportedFeatures->bRepeat ? ToolBoxItemBits::REPEAT : ToolBoxItemBits::NONE ); +OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) ); +m_pToolbar->InsertItem( ToolBoxItemId(pSupportedFeatures->nId), OUString(), sCommandURL, pSupportedFeatures->bRepeat ? ToolBoxItemBits::REPEAT : ToolBoxItemBits::NONE ); m_pToolbar->SetQuickHelpText( ToolBoxItemId(pSupportedFeatures->nId), OUString() ); // TODO if ( !isArtificialItem( pSupportedFeatures->nId ) ) { -OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) ); -m_pToolbar->SetItemCommand( ToolBoxItemId(pSupportedFeatures->nId), sCommandURL ); auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommandURL, m_sModuleId); m_pToolbar->SetQuickHelpText(ToolBoxItemId(pSupportedFeatures->nId), vcl::CommandInfoProvider::GetLabelForCommand(aProperties)); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 7dbee84c1072..ef3470a28fb3 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -221,8 +221,7 @@ public: const OUString& rLabel, ToolBoxItemBits nItemBits) override { -m_pToolBar->InsertItem( nId, rLabel, nItemBits ); -m_pToolBar->SetItemCommand( nId, rCommandURL ); +m_pToolBar->InsertItem( nId, rLabel, rCommandURL, nItemBits ); m_pToolBar->SetQuickHelpText(nId, rTooltip); m_pToolBar->EnableItem( nId ); m_pToolBar->SetItemState( nId, TRISTATE_FALSE ); @@ -1525,7 +1524,7 @@ void ToolBarManager::FillAddonToolbar( const Sequence< Sequence< PropertyValue > } else { -m_pToolBar->InsertItem( nId, aTitle ); +m_pToolBar->InsertItem( nId, aTitle, aURL ); OUString aShortcut(vcl::CommandInfoProvider::GetCommandShortcut(aURL, m_xFrame)); if (!aShortcut.isEmpty()) @@ -1536,7 +1535,6 @@ void ToolBarManager::FillAddonToolbar( const Sequence< Sequence< PropertyValue > pRuntimeItemData->aControlType = aControlType; pRuntimeItemData->nWidth = nWidth; m_pToolBar->SetItemData( nId, pRuntimeItemData ); -m_pToolBar->SetItemCommand( nId, aURL ); // Fill command map. It stores all our commands and from what // image manager we got our image. So we can decide if we have to use an @@ -1583,8 +1581,7 @@ void ToolBarManager::FillOverflowToolbar( ToolBox const * pParent ) } const OUString aCommandURL( pParent->GetItemComm
[Libreoffice-commits] core.git: framework/inc framework/source
framework/inc/uielement/toolbarmanager.hxx|1 - framework/source/uielement/toolbarmanager.cxx | 10 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) New commits: commit 085abe2b7187f2cfd69a5a1c6e84ef0c9c214f78 Author: Maxim Monastirsky AuthorDate: Thu Jul 28 01:08:31 2022 +0300 Commit: Maxim Monastirsky CommitDate: Wed Aug 10 08:24:27 2022 +0200 Unnecessary ToolBox::SetItemText call Change-Id: I8d15e9657b3a6d01de9d07130ae3aa8284fbd178 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138037 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 2e7cd1c01a9a..162e14aca4e3 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -65,7 +65,6 @@ public: virtual void Destroy() = 0; virtual css::uno::Reference GetInterface() = 0; virtual void InsertItem(ToolBoxItemId nId, -const OUString& rString, const OUString& rCommandURL, const OUString& rTooltip, const OUString& rLabel, diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index b2efe27c2f0a..7dbee84c1072 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -216,16 +216,14 @@ public: } virtual void InsertItem(ToolBoxItemId nId, -const OUString& rString, const OUString& rCommandURL, const OUString& rTooltip, const OUString& rLabel, ToolBoxItemBits nItemBits) override { -m_pToolBar->InsertItem( nId, rString, nItemBits ); +m_pToolBar->InsertItem( nId, rLabel, nItemBits ); m_pToolBar->SetItemCommand( nId, rCommandURL ); m_pToolBar->SetQuickHelpText(nId, rTooltip); -m_pToolBar->SetItemText( nId, rLabel ); m_pToolBar->EnableItem( nId ); m_pToolBar->SetItemState( nId, TRISTATE_FALSE ); } @@ -420,7 +418,6 @@ public: } virtual void InsertItem(ToolBoxItemId nId, -const OUString& /*rString*/, const OUString& rCommandURL, const OUString& rTooltip, const OUString& rLabel, @@ -1410,7 +1407,6 @@ void ToolBarManager::FillToolbarFromContainer( const Reference< XIndexAccess >& auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, m_aModuleIdentifier); if (!aProperties.hasElements()) // E.g., user-provided macro command? aProperties = aProps; // Use existing info, including user-provided Label -OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aProperties)); ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle ); @@ -1418,9 +1414,9 @@ void ToolBarManager::FillToolbarFromContainer( const Reference< XIndexAccess >& aTooltip = vcl::CommandInfoProvider::GetTooltipForCommand(aCommandURL, aProperties, m_xFrame); if ( aLabel.isEmpty() ) -aLabel = aString; +aLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties); -m_pImpl->InsertItem(nId, aString, aCommandURL, aTooltip, aLabel, nItemBits); +m_pImpl->InsertItem(nId, aCommandURL, aTooltip, aLabel, nItemBits); // Fill command map. It stores all our commands and from what // image manager we got our image. So we can decide if we have to use an
[Libreoffice-commits] core.git: framework/source
framework/source/uielement/toolbarmanager.cxx | 45 +- 1 file changed, 16 insertions(+), 29 deletions(-) New commits: commit d69340d4d1e7f96f0633bebd5abcf20114fbef0f Author: Maxim Monastirsky AuthorDate: Sun Jul 17 17:08:29 2022 +0300 Commit: Maxim Monastirsky CommitDate: Mon Jul 18 00:44:40 2022 +0200 Simplify by using InitAnyPropertySequence Change-Id: I145ce892e101ba4e8906cbdb0d32a52a4c655d43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137151 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 34a63156bc2a..b2efe27c2f0a 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include @@ -1076,27 +1076,14 @@ void ToolBarManager::CreateControllers() if ( m_xToolbarControllerFactory.is() && m_xToolbarControllerFactory->hasController( aCommandURL, m_aModuleIdentifier )) { -PropertyValue aPropValue; -std::vector< Any > aPropertyVector; - -aPropValue.Name = "ModuleIdentifier"; -aPropValue.Value<<= m_aModuleIdentifier; -aPropertyVector.push_back( Any( aPropValue )); -aPropValue.Name = "Frame"; -aPropValue.Value<<= m_xFrame; -aPropertyVector.push_back( Any( aPropValue )); -aPropValue.Name = "ServiceManager"; Reference xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); -aPropValue.Value<<= xMSF; -aPropertyVector.push_back( Any( aPropValue )); -aPropValue.Name = "ParentWindow"; -aPropValue.Value<<= xToolbarWindow; -aPropertyVector.push_back( Any( aPropValue )); -aPropValue.Name = "Identifier"; -aPropValue.Value<<= sal_uInt16(nId); -aPropertyVector.push_back( uno::Any( aPropValue ) ); - -Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); +Sequence< Any > aArgs( comphelper::InitAnyPropertySequence( { +{ "ModuleIdentifier", Any(m_aModuleIdentifier) }, +{ "Frame", Any(m_xFrame) }, +{ "ServiceManager", Any(xMSF) }, +{ "ParentWindow", Any(xToolbarWindow) }, +{ "Identifier", Any(sal_uInt16(nId)) }, +} )); xController.set( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext( aCommandURL, aArgs, m_xContext ), UNO_QUERY ); bInit = false; // Initialization is done through the factory service @@ -1184,14 +1171,14 @@ void ToolBarManager::CreateControllers() if ( bInit ) { Reference xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); -Sequence< Any > aArgs { -Any( comphelper::makePropertyValue("Frame", m_xFrame) ), -Any( comphelper::makePropertyValue("CommandURL", aCommandURL) ), -Any( comphelper::makePropertyValue("ServiceManager", xMSF) ), -Any( comphelper::makePropertyValue("ParentWindow", xToolbarWindow) ), -Any( comphelper::makePropertyValue("ModuleIdentifier", m_aModuleIdentifier) ), -Any( comphelper::makePropertyValue("Identifier", sal_uInt16(nId)) ), -}; +Sequence< Any > aArgs( comphelper::InitAnyPropertySequence( { +{ "Frame", Any(m_xFrame) }, +{ "CommandURL", Any(aCommandURL) }, +{ "ServiceManager", Any(xMSF) }, +{ "ParentWindow", Any(xToolbarWindow) }, +{ "ModuleIdentifier", Any(m_aModuleIdentifier) }, +{ "Identifier", Any(sal_uInt16(nId)) }, +} )); xInit->initialize( aArgs ); }
[Libreoffice-commits] core.git: framework/source
framework/source/uielement/toolbarmanager.cxx |8 1 file changed, 8 deletions(-) New commits: commit f1f52b6e5086124c75b57f6f6ff1f1f0353e40af Author: Maxim Monastirsky AuthorDate: Sun Jul 17 17:07:29 2022 +0300 Commit: Maxim Monastirsky CommitDate: Mon Jul 18 00:39:51 2022 +0200 Remove the broken SupportsVisible hack pController is always empty since commit ac1aefd5174258d9bcb41465ce566ed1a0819f3d ("Extend ToolBarManager to build weld::Toolbar"). But even before that it did nothing, as it was set only for controllers created by the sfx2 legacy factory, but neither .uno:SwitchXFormsDesignMode nor .uno:ViewDataSourceBrowser had such controllers (It did however work in the past for some other commands before commit fb60217569b0fb5bc949c58b054da71992fe2582 ("tdf#83320 Hide vertical text commands early"). Also, searching the codebase for SfxVisibilityItem reveals more commands that set visibility, and I'm not sure if hardcoding all of them here is a good approach in general. Change-Id: Id8c22e729d2402837de0598fa8ca4d41160804c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137150 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 587cd8b61ad8..34a63156bc2a 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1054,8 +1054,6 @@ void ToolBarManager::CreateControllers() bool bCreate( true ); Reference< XStatusListener > xController; -rtl::Reference pController; - OUString aCommandURL( m_pImpl->GetItemCommand( nId ) ); // Command can be just an alias to another command. auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, m_aModuleIdentifier); @@ -1196,12 +1194,6 @@ void ToolBarManager::CreateControllers() }; xInit->initialize( aArgs ); - -if (pController) -{ -if (aCommandURL == ".uno:SwitchXFormsDesignMode" || aCommandURL == ".uno:ViewDataSourceBrowser") -pController->setFastPropertyValue_NoBroadcast(1, Any(true)); -} } // Request an item window from the toolbar controller and set it at the VCL toolbar
[Libreoffice-commits] core.git: framework/inc framework/source include/framework include/sfx2 sfx2/source
framework/inc/uielement/toolbarmanager.hxx |5 -- framework/source/fwe/classes/sfxhelperfunctions.cxx | 23 -- framework/source/uielement/toolbarmanager.cxx | 42 include/framework/sfxhelperfunctions.hxx| 19 - include/sfx2/tbxctrl.hxx|1 sfx2/source/appl/app.cxx| 12 - 6 files changed, 12 insertions(+), 90 deletions(-) New commits: commit f87c7018fa5641eeecd788907ea66892514255a6 Author: Maxim Monastirsky AuthorDate: Sun Jul 17 15:43:17 2022 +0300 Commit: Maxim Monastirsky CommitDate: Sun Jul 17 22:36:53 2022 +0200 No need for SfxWeldToolBoxControllerFactory sfx2::sidebar::ControllerFactory::CreateToolBoxController only supports creating controllers using the uno factory, or GenericToolbarController as a fallback. Given that we already handle the uno factory case in ToolBarManager::CreateControllers, all this complexity is really just for creating GenericToolbarController with a different ctor, which we can do locally as well. Change-Id: I3a5a3cda95a6c5db97615286e93630214f76cbfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137149 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 17840c46fe95..2e7cd1c01a9a 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -64,10 +64,6 @@ public: virtual void Init() = 0; virtual void Destroy() = 0; virtual css::uno::Reference GetInterface() = 0; -virtual css::uno::Reference CreateToolBoxController( -const css::uno::Reference& rFrame, -ToolBoxItemId nId, -const OUString& aCommandURL ) = 0; virtual void InsertItem(ToolBoxItemId nId, const OUString& rString, const OUString& rCommandURL, @@ -230,6 +226,7 @@ class ToolBarManager final : public ToolbarManager_Base std::unique_ptr m_pImpl; VclPtr m_pToolBar; +weld::Toolbar* m_pWeldedToolBar; OUString m_aModuleIdentifier; OUString m_aResourceName; diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx b/framework/source/fwe/classes/sfxhelperfunctions.cxx index 170f3e7156bb..5a1cc0d716d5 100644 --- a/framework/source/fwe/classes/sfxhelperfunctions.cxx +++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx @@ -24,7 +24,6 @@ #include static pfunc_setToolBoxControllerCreator pToolBoxControllerCreator = nullptr; -static pfunc_setWeldToolBoxControllerCreator pWeldToolBoxControllerCreator = nullptr; static pfunc_setStatusBarControllerCreator pStatusBarControllerCreator = nullptr; static pfunc_getRefreshToolbarspRefreshToolbars= nullptr; static pfunc_createDockingWindow pCreateDockingWindow= nullptr; @@ -58,28 +57,6 @@ rtl::Reference CreateToolBoxController( const Reference< return nullptr; } -pfunc_setWeldToolBoxControllerCreator SetWeldToolBoxControllerCreator( pfunc_setWeldToolBoxControllerCreator pSetWeldToolBoxControllerCreator ) -{ -::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); -pfunc_setWeldToolBoxControllerCreator pOldSetToolBoxControllerCreator = pWeldToolBoxControllerCreator; -pWeldToolBoxControllerCreator = pSetWeldToolBoxControllerCreator; -return pOldSetToolBoxControllerCreator; -} - -css::uno::Reference CreateWeldToolBoxController( const Reference< XFrame >& rFrame, weld::Toolbar* pToolbar, weld::Builder* pBuilder, const OUString& aCommandURL ) -{ -pfunc_setWeldToolBoxControllerCreator pFactory = nullptr; -{ -::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); -pFactory = pWeldToolBoxControllerCreator; -} - -if ( pFactory ) -return (*pFactory)( rFrame, pToolbar, pBuilder, aCommandURL ); -else -return nullptr; -} - pfunc_setStatusBarControllerCreator SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator ) { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index a632828b5c8c..587cd8b61ad8 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -200,19 +200,6 @@ public: return VCLUnoHelper::GetInterface(m_pToolBar); } -virtual css::uno::Reference CreateToolBoxCo
[Libreoffice-commits] core.git: 2 commits - framework/inc framework/source include/vcl vcl/inc vcl/source
framework/inc/uielement/toolbarmanager.hxx|1 + framework/source/uielement/toolbarmanager.cxx |9 + include/vcl/toolbox.hxx |2 ++ include/vcl/toolkit/button.hxx|4 ++-- vcl/inc/vclstatuslistener.hxx | 20 +--- vcl/source/control/button.cxx |4 ++-- vcl/source/window/builder.cxx |4 +++- vcl/source/window/toolbox.cxx | 12 +--- vcl/source/window/toolbox2.cxx| 23 +-- 9 files changed, 46 insertions(+), 33 deletions(-) New commits: commit e695b6d89a00c86fc35332213be42d5b29196eae Author: Maxim Monastirsky AuthorDate: Wed Jul 13 09:50:17 2022 +0300 Commit: Maxim Monastirsky CommitDate: Wed Jul 13 14:52:28 2022 +0200 Related: tdf#149956 Keep in sync after icon theme change We can't just refresh the listener for .uno:ImageOrientation, as that won't work for tdf#149741. Change-Id: Iee584c98f5b81542cd9be4760433b96e97981f45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137015 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 5237aec9365f..3913b5ee6321 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -943,6 +943,15 @@ void* ToolBox::GetItemData( ToolBoxItemId nItemId ) const return nullptr; } +static Image ImplMirrorImage( const Image& rImage ) +{ +BitmapExaMirrBitmapEx( rImage.GetBitmapEx() ); + +aMirrBitmapEx.Mirror( BmpMirrorFlags::Horizontal ); + +return Image( aMirrBitmapEx ); +} + void ToolBox::SetItemImage( ToolBoxItemId nItemId, const Image& rImage ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -953,7 +962,10 @@ void ToolBox::SetItemImage( ToolBoxItemId nItemId, const Image& rImage ) ImplToolItem* pItem = &mpData->m_aItems[nPos]; Size aOldSize = pItem->maImage.GetSizePixel(); -pItem->maImage = rImage; +if (pItem->mbMirrorMode) +pItem->maImage = ImplMirrorImage(rImage); +else +pItem->maImage = rImage; // only once all is calculated, do extra work if (!mbCalc) @@ -1003,15 +1015,6 @@ void ToolBox::SetItemImageAngle( ToolBoxItemId nItemId, Degree10 nAngle10 ) } } -static Image ImplMirrorImage( const Image& rImage ) -{ -BitmapExaMirrBitmapEx( rImage.GetBitmapEx() ); - -aMirrBitmapEx.Mirror( BmpMirrorFlags::Horizontal ); - -return Image( aMirrBitmapEx ); -} - void ToolBox::SetItemImageMirrorMode( ToolBoxItemId nItemId, bool bMirror ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); commit 421688a4c2fc64e64ce211d579bad2174e005db4 Author: Maxim Monastirsky AuthorDate: Tue Jul 12 23:19:47 2022 +0300 Commit: Maxim Monastirsky CommitDate: Wed Jul 13 14:52:18 2022 +0200 tdf#149956 Pass the correct frame to VclStatusListener Starting directly to Writer (i.e. with "--writer") will attempt to create VclStatusListeners for .uno:ImageOrientation before the frame is activated, causing the dispatcher to not be found. Also defer that stuff to after a toolbar is filled, so we get a correct initial state for toolbars which shown when the current paragraph is rtl already. (There is a similar problem with the NB, but it isn't handled in this patch.) Change-Id: Ie482007c10a4014b4a2fd4d53f05d433777ecfb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137014 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 746b40ebc787..17840c46fe95 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -87,6 +87,7 @@ public: virtual void Clear() = 0; virtual void SetName(const OUString& rName) = 0; virtual void SetHelpId(const OString& rHelpId) = 0; +virtual void TrackImageOrientation(const css::uno::Reference& rFrame) = 0; virtual bool WillUsePopupMode() = 0; virtual bool IsReallyVisible() = 0; virtual void SetIconSize(ToolBoxButtonSize eSize) = 0; diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index e9de797e689a..a632828b5c8c 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -308,6 +308,11 @@ public: m_pToolBar->SetHelpId( rHelpId ); } +virtual void TrackImageOrientation(const css::uno::Reference& rFrame) override +{ +m_pToolBar->TrackImageOrientation(rFrame); +} + virtual bool WillUsePopupMode() override { return m_pToolBar->WillUsePopupMode(); @@ -508,6 +513,8 @@ public: virtual void Set
[Libreoffice-commits] core.git: framework/source sw/sdi sw/source
framework/source/uielement/generictoolbarcontroller.cxx |8 sw/sdi/_tabsh.sdi |4 ++-- sw/sdi/swriter.sdi |4 ++-- sw/source/uibase/shells/tabsh.cxx | 10 ++ 4 files changed, 22 insertions(+), 4 deletions(-) New commits: commit b0a3245c63a2f77ce761ebd11820b341969a48b4 Author: Maxim Monastirsky AuthorDate: Tue Jul 5 01:03:07 2022 +0300 Commit: Maxim Monastirsky CommitDate: Tue Jul 5 13:40:53 2022 +0200 tdf#149741 Mirror insert column icons for RTL tables The usual approach of setting the respective property in *Commands.xcu won't work here, as that works with the paragraph direction, which doesn't have to be the same as the table direction. Change-Id: I9c4d49a5c553a8a74e7760d257167a0be42c89c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136818 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index 25f2e0157e9e..e8e49cb30933 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -218,6 +219,7 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event ) ItemStatus aItemState; Visibility aItemVisibility; ControlCommand aControlCommand; +SfxImageItemaImageItem; if (( Event.State >>= bValue ) && !m_bEnumCommand ) { @@ -293,6 +295,12 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event ) if ( m_bMadeInvisible ) m_xToolbar->ShowItem( m_nID ); } +else if ( aImageItem.PutValue( Event.State, 0 ) ) +{ +m_xToolbar->SetItemImageMirrorMode( m_nID, aImageItem.IsMirrored() ); +if ( m_bMadeInvisible ) +m_xToolbar->ShowItem( m_nID ); +} else if ( m_bMadeInvisible ) m_xToolbar->ShowItem( m_nID ); diff --git a/sw/sdi/_tabsh.sdi b/sw/sdi/_tabsh.sdi index 5d4017b4790d..e4b6b9a2dd6c 100644 --- a/sw/sdi/_tabsh.sdi +++ b/sw/sdi/_tabsh.sdi @@ -141,7 +141,7 @@ interface BaseTextTable FN_TABLE_INSERT_COL_BEFORE // status(final|play) [ ExecMethod = Execute ; -StateMethod = NoState ; +StateMethod = GetState ; DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] @@ -156,7 +156,7 @@ interface BaseTextTable FN_TABLE_INSERT_COL_AFTER // status(final|play) [ ExecMethod = Execute ; -StateMethod = NoState ; +StateMethod = GetState ; DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index bf4ed3ec8b25..49fa8f2bb4e6 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -2643,7 +2643,7 @@ SfxVoidItem InsertColumnDialog FN_TABLE_INSERT_COL_DLG GroupId = SfxGroupId::Table; ] -SfxVoidItem InsertColumnsBefore FN_TABLE_INSERT_COL_BEFORE +SfxImageItem InsertColumnsBefore FN_TABLE_INSERT_COL_BEFORE () [ AutoUpdate = FALSE, @@ -2680,7 +2680,7 @@ SfxVoidItem InsertColumns FN_TABLE_INSERT_COL GroupId = SfxGroupId::Table; ] -SfxVoidItem InsertColumnsAfter FN_TABLE_INSERT_COL_AFTER +SfxImageItem InsertColumnsAfter FN_TABLE_INSERT_COL_AFTER () [ AutoUpdate = FALSE, diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 3cbea6b77389..88a4c3e10c15 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -1358,6 +1359,15 @@ void SwTableShell::GetState(SfxItemSet &rSet) } break; } +case FN_TABLE_INSERT_COL_BEFORE: +case FN_TABLE_INSERT_COL_AFTER: +{ +SfxImageItem aImageItem(nSlot); +if (pFormat->GetFrameDir().GetValue() == SvxFrameDirection::Horizontal_RL_TB) +aImageItem.SetMirrored(true); +rSet.Put(aImageItem); +break; +} case FN_TABLE_INSERT_ROW: case FN_TABLE_INSERT_ROW_AFTER: case FN_TABLE_INSERT_ROW_DLG:
[Libreoffice-commits] core.git: framework/source
framework/source/uielement/newmenucontroller.cxx | 45 +-- 1 file changed, 2 insertions(+), 43 deletions(-) New commits: commit bdd217c1f23e0fb5f84542f1fb41036c3de538df Author: Maxim Monastirsky AuthorDate: Mon Jun 27 12:27:35 2022 +0300 Commit: Maxim Monastirsky CommitDate: Tue Jun 28 13:55:56 2022 +0200 NewMenuController: Use status update to determine the default factory This is a follow-up to 2446fdba3ec4a81d6e3b619a1d9e91b3c6dcbd54 ("tdf#134887 Rework last item handling in NewToolbarController"). We should better get the information on what is going to be executed from the entity that will actually execute it, instead of guessing on our own. This makes a difference for at least XML Form Document, where CTRL+N used to be shown next to the "XML Form Document" entry, although pressing that shortcut will open a regular writer doc. Change-Id: Ib9b58ea2fb83a6cfe9a603af6be97fb36a25ddc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136554 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index d282509d93f5..14b59c263b85 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -111,7 +110,6 @@ void NewMenuController::determineAndSetNewDocAccel(const css::awt::KeyEvent& rKe { sal_uInt16 nCount(m_xPopupMenu->getItemCount()); sal_uInt16 nId( 0 ); -bool bFound( false ); OUString aCommand; if ( !m_aEmptyDocURL.isEmpty() ) @@ -127,34 +125,11 @@ void NewMenuController::determineAndSetNewDocAccel(const css::awt::KeyEvent& rKe if ( aCommand.startsWith( m_aEmptyDocURL ) ) { m_xPopupMenu->setAcceleratorKeyEvent(nId, rKeyCode); -bFound = true; break; } } } } - -if ( bFound ) -return; - -// Search for the default module name -OUString aDefaultModuleName( SvtModuleOptions().GetDefaultModuleName() ); -if ( aDefaultModuleName.isEmpty() ) -return; - -for ( sal_uInt16 i = 0; i < nCount; i++ ) -{ -if (m_xPopupMenu->getItemType(i) != css::awt::MenuItemType_SEPARATOR) -{ -nId = m_xPopupMenu->getItemId(i); -aCommand = m_xPopupMenu->getCommand(nId); -if ( aCommand.indexOf( aDefaultModuleName ) >= 0 ) -{ -m_xPopupMenu->setAcceleratorKeyEvent(nId, rKeyCode); -break; -} -} -} } void NewMenuController::setAccelerators() @@ -372,8 +347,9 @@ void SAL_CALL NewMenuController::disposing( const EventObject& ) } // XStatusListener -void SAL_CALL NewMenuController::statusChanged( const FeatureStateEvent& ) +void SAL_CALL NewMenuController::statusChanged( const FeatureStateEvent& Event ) { +Event.State >>= m_aEmptyDocURL; } // XMenuListener @@ -452,23 +428,6 @@ void NewMenuController::impl_setPopupMenu() { m_aModuleIdentifier = xModuleManager->identify( m_xFrame ); m_bModuleIdentified = true; - -if ( !m_aModuleIdentifier.isEmpty() ) -{ -Sequence< PropertyValue > aSeq; - -if ( xModuleManager->getByName( m_aModuleIdentifier ) >>= aSeq ) -{ -for ( PropertyValue const & prop : std::as_const(aSeq) ) -{ -if ( prop.Name == "ooSetupFactoryEmptyDocumentURL" ) -{ -prop.Value >>= m_aEmptyDocURL; -break; -} -} -} -} } catch ( const RuntimeException& ) {
[Libreoffice-commits] core.git: framework/source
framework/source/uielement/toolbarwrapper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 230a988c9011ffc365070acf9ecd750825b0b1ec Author: Maxim Monastirsky AuthorDate: Thu Jun 16 13:24:24 2022 +0300 Commit: Maxim Monastirsky CommitDate: Fri Jun 17 14:00:14 2022 +0200 tdf#125040 Ignore the default context This isn't a meaningful context, but a way to represent a lack of context. Typically it's a temporary state, followed by a proper context being set. The problem becomes apparent when a context deactivation is caused by switching to another document window, as the further activation will happen only when the former window is focused again. This makes the contextual controls disappear in the meantime. Change-Id: I96c8356acb2434c579dc74407043b55eb5374a0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136010 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 9acbe7ca7b55..8f3937ef094f 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -269,7 +269,7 @@ void SAL_CALL ToolBarWrapper::notifyContextChangeEvent( const ContextChangeEvent if ( m_bDisposed ) throw DisposedException(); -if ( aEvent.ContextName.isEmpty() ) +if ( aEvent.ContextName.isEmpty() || aEvent.ContextName == "default" ) return; const OUString aContextToolbar( m_aResourceURL + "-" + aEvent.ContextName.toAsciiLowerCase() );
[Libreoffice-commits] core.git: icon-themes/colibre icon-themes/elementary officecfg/registry sw/uiconfig sw/UIConfig_swriter.mk
icon-themes/colibre/links.txt | 43 ++ icon-themes/elementary/links.txt | 43 ++ officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu| 158 ++ officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu | 88 + sw/UIConfig_swriter.mk | 11 sw/uiconfig/swriter/toolbar/singlemode-annotation.xml | 34 ++ sw/uiconfig/swriter/toolbar/singlemode-draw.xml| 64 sw/uiconfig/swriter/toolbar/singlemode-drawtext.xml| 52 +++ sw/uiconfig/swriter/toolbar/singlemode-form.xml| 50 +++ sw/uiconfig/swriter/toolbar/singlemode-frame.xml | 49 +++ sw/uiconfig/swriter/toolbar/singlemode-graphic.xml | 52 +++ sw/uiconfig/swriter/toolbar/singlemode-media.xml | 39 ++ sw/uiconfig/swriter/toolbar/singlemode-ole.xml | 47 ++ sw/uiconfig/swriter/toolbar/singlemode-printpreview.xml| 40 ++ sw/uiconfig/swriter/toolbar/singlemode-table.xml | 98 ++ sw/uiconfig/swriter/toolbar/singlemode-text.xml| 98 ++ sw/uiconfig/swriter/toolbar/singlemode.xml | 76 17 files changed, 974 insertions(+), 68 deletions(-) New commits: commit 0930096c4c5ed14f46a79f03b29f21cc915d7203 Author: Maxim Monastirsky AuthorDate: Wed Jun 15 22:32:54 2022 +0300 Commit: Maxim Monastirsky CommitDate: Thu Jun 16 14:03:33 2022 +0200 tdf#125040 Recreate Contextual Single for Writer Change-Id: I791631aedb9efbb7bbdc41234ee39e1d3c834ce1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135959 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/icon-themes/colibre/links.txt b/icon-themes/colibre/links.txt index 74ad1112d9f7..eecb932abacb 100644 --- a/icon-themes/colibre/links.txt +++ b/icon-themes/colibre/links.txt @@ -2719,3 +2719,46 @@ cmd/sc_redactionpreviewexport.png cmd/sc_exportdirecttopdf.png # Extension Dialog cmd/sc_stars-full.png sc/res/icon-set-stars-full.png cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png + +# Contextual Single Toolbar +cmd/32/zoom-more.png cmd/32/optionstreedialog.png +cmd/32/accepttrackedchanges-more.png cmd/32/optionstreedialog.png +cmd/32/fontdialog-more.png cmd/32/optionstreedialog.png +cmd/32/paragraphdialog-more.png cmd/32/optionstreedialog.png +cmd/32/tabledialog-more.png cmd/32/optionstreedialog.png +cmd/32/transformdialog-more.png cmd/32/optionstreedialog.png +cmd/32/graphicdialog-more.png cmd/32/optionstreedialog.png +cmd/32/framedialog-more.png cmd/32/optionstreedialog.png +cmd/32/objectdialog-more.png cmd/32/optionstreedialog.png +cmd/32/borderdialog-more.png cmd/32/optionstreedialog.png +cmd/32/textwrap-more.png cmd/32/optionstreedialog.png +cmd/32/formatarea-more.png cmd/32/optionstreedialog.png +cmd/32/formatline-more.png cmd/32/optionstreedialog.png + +cmd/lc_zoom-more.png cmd/lc_optionstreedialog.png +cmd/lc_accepttrackedchanges-more.png cmd/lc_optionstreedialog.png +cmd/lc_fontdialog-more.png cmd/lc_optionstreedialog.png +cmd/lc_paragraphdialog-more.png cmd/lc_optionstreedialog.png +cmd/lc_tabledialog-more.png cmd/lc_optionstreedialog.png +cmd/lc_transformdialog-more.png cmd/lc_optionstreedialog.png +cmd/lc_graphicdialog-more.png cmd/lc_optionstreedialog.png +cmd/lc_framedialog-more.png cmd/lc_optionstreedialog.png +cmd/lc_objectdialog-more.png cmd/lc_optionstreedialog.png +cmd/lc_borderdialog-more.png cmd/lc_optionstreedialog.png +cmd/lc_textwrap-more.png cmd/lc_optionstreedialog.png +cmd/lc_formatarea-more.png cmd/lc_optionstreedialog.png +cmd/lc_formatline-more.png cmd/lc_optionstreedialog.png + +cmd/sc_zoom-more.png sfx2/res/symphony/open_more.png +cmd/sc_accepttrackedchanges-more.png sfx2/res/symphony/open_more.png +cmd/sc_fontdialog-more.png sfx2/res/symphony/open_more.png +cmd/sc_paragraphdialog-more.png sfx2/res/symphony/open_more.png +cmd/sc_tabledialog-more.png sfx2/res/symphony/open_more.png +cmd/sc_transformdialog-more.png sfx2/res/symphony/open_more.png +cmd/sc_graphicdialog-more.png sfx2/res/symphony/open_more.png +cmd/sc_framedialog-more.png sfx2/res/symphony/open_more.png +cmd/sc_objectdialog-more.png sfx2/res/symphony/open_more.png +cmd/sc_borderdialog-more.png sfx2/res/symphony/open_more.png +cmd/sc_textwrap-more.png sfx2/res/symphony/open_more.png +cmd/sc_formatarea-more.png sfx2/res/symphony/open_more.png +cmd/sc_formatline-more.png sfx2/res/symphony/open_more.png diff --git a/icon-themes/elementary/links.txt b/icon-themes/elementary/links.txt index da4436c53178..03d70a8a2cb6 100644 --- a/icon-themes/elementary/links.txt +++ b/icon-themes/elementary/links.txt @@ -2671,3 +2671,46 @@ cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png cmd/32
[Libreoffice-commits] core.git: framework/source
framework/source/uielement/toolbarwrapper.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 48ca2336251d62ac2e90300cd9945fb84b1cddd8 Author: Maxim Monastirsky AuthorDate: Thu Jun 16 01:07:31 2022 +0300 Commit: Maxim Monastirsky CommitDate: Thu Jun 16 14:00:12 2022 +0200 tdf#125040 Avoid flickering on context change Change-Id: I442fada34e10fe13e68987abba34969a8ab50bc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135958 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 146cddf2867d..9acbe7ca7b55 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -130,6 +130,8 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) catch( const Exception& ) { } +// Avoid flickering on context change +bPopupMode = true; } // Create VCL based toolbar which will be filled with settings data
[Libreoffice-commits] core.git: framework/inc framework/source include/sfx2 sfx2/source
framework/inc/uielement/toolbarmanager.hxx| 10 + framework/inc/uielement/toolbarmerger.hxx |2 framework/inc/uielement/toolbarwrapper.hxx| 16 - framework/source/uielement/toolbarmanager.cxx | 224 ++ framework/source/uielement/toolbarmerger.cxx |8 framework/source/uielement/toolbarwrapper.cxx | 116 + include/sfx2/notebookbar/SfxNotebookBar.hxx |2 sfx2/source/appl/workwin.cxx |2 sfx2/source/notebookbar/SfxNotebookBar.cxx|5 9 files changed, 233 insertions(+), 152 deletions(-) New commits: commit 9bc1ffa2153d2474b023e0860d3c9c68ee18727b Author: Maxim Monastirsky AuthorDate: Mon Jun 6 22:50:14 2022 +0300 Commit: Maxim Monastirsky CommitDate: Mon Jun 13 18:47:01 2022 +0200 tdf#125040 Make single mode toolbar context aware This patch modifies the "Standard (Single Mode)" toolbar to have an optional context-aware section, given that a corresponding singlemode-.xml files exist. This is a lot like the "Contextual Single" NB, except that it's implemented with regular toolbars, so docking/ customization/extensions/uno api etc. are all working. In addition, the "Single Toolbar" mode was modified to not show any other contextual toolbar. (But of course the single mode toolbar itself is perfectly usable outside of this mode.) Change-Id: Id746d9df59340a81962a8689b132941deea54b6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135591 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 1cfddd99ef45..746b40ebc787 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -94,6 +94,7 @@ public: virtual void ConnectCallbacks(ToolBarManager* pManager) = 0; virtual void SetMenuType(ToolBoxMenuType eType) = 0; virtual void MergeToolbar(ToolBoxItemId & rItemId, + sal_uInt16 nFirstItem, const OUString& rModuleIdentifier, CommandToInfoMap& rCommandMap, MergeToolbarInstruction& rInstruction) = 0; @@ -144,7 +145,9 @@ class ToolBarManager final : public ToolbarManager_Base void CheckAndUpdateImages(); void RequestImages(); -void FillToolbar( const css::uno::Reference< css::container::XIndexAccess >& rToolBarData ); +void FillToolbar( const css::uno::Reference< css::container::XIndexAccess >& rToolBarData, + const css::uno::Reference< css::container::XIndexAccess >& rContextData, + const OUString& rContextToolbarName ); void FillAddonToolbar( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rAddonToolbar ); void FillOverflowToolbar( ToolBox const * pParent ); void notifyRegisteredControllers( const OUString& aUIElementName, const OUString& aCommand ); @@ -193,6 +196,9 @@ class ToolBarManager final : public ToolbarManager_Base private: void Init(); +void FillToolbarFromContainer(const css::uno::Reference< css::container::XIndexAccess >& rItemContainer, + const OUString& rResourceName, ToolBoxItemId& nId, ToolBoxItemId& nAddonId); +void ToggleButton(const OUString& rResourceName, std::u16string_view rCommand); void AddCustomizeMenuItems(ToolBox const * pToolBar); void InitImageManager(); void RemoveControllers(); @@ -219,12 +225,14 @@ class ToolBarManager final : public ToolbarManager_Base m_bUpdateControllers : 1; sal_Int16 m_eSymbolSize; +sal_uInt16 m_nContextMinPos; std::unique_ptr m_pImpl; VclPtr m_pToolBar; OUString m_aModuleIdentifier; OUString m_aResourceName; +OUString m_aContextResourceName; css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; css::uno::Reference< css::frame::XFrame >m_xFrame; diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index 837507baa386..b84ca2005e39 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -75,7 +75,7 @@ class ToolBarMerger OUString& rControlType,
[Libreoffice-commits] core.git: include/vcl sc/source sfx2/source sw/source vcl/source
include/vcl/notebookbar/notebookbar.hxx|8 +- sc/source/ui/view/prevwsh.cxx | 26 +--- sfx2/source/notebookbar/SfxNotebookBar.cxx |6 -- sw/source/uibase/inc/pview.hxx |2 sw/source/uibase/uiview/pview.cxx | 16 ++--- sw/source/uibase/utlui/content.cxx |9 +-- sw/source/uibase/utlui/navipi.cxx |1 vcl/source/control/notebookbar.cxx | 86 +++-- 8 files changed, 77 insertions(+), 77 deletions(-) New commits: commit 881774e9e35055cbaed36324542bae006eedb4fb Author: Maxim Monastirsky AuthorDate: Tue Jun 7 10:11:48 2022 +0300 Commit: Maxim Monastirsky CommitDate: Sun Jun 12 10:38:27 2022 +0200 Related: tdf#125040 NB: rework print preview context Current implementation broadcasts the context change before the new controller was set on the frame (via XFrame::setComponent). This isn't going to work for anything LayoutManager based, as it responds to frame events by recreating all toolbars, so the newly created toolbar won't see the context sent for the old controller. Solve that by delaying the context change to SfxShell::Activate, like anywhere else in the codebase. And make NB listen to frame events, so it could also switch listening to the new controller. Also fixed a crash when switching to print preview in Writer with the navigator in the sidebar being active. Ideally we shouldn't even try to create sidebar panels in print preview, as the sidebar as a whole is disabled. But left that for a future investigation. Change-Id: I07759c676d2a2eb6f752fe778b559b15d2d759ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135492 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/include/vcl/notebookbar/notebookbar.hxx b/include/vcl/notebookbar/notebookbar.hxx index 635bea058f2a..b93e3707fb7c 100644 --- a/include/vcl/notebookbar/notebookbar.hxx +++ b/include/vcl/notebookbar/notebookbar.hxx @@ -18,6 +18,7 @@ namespace com::sun::star::ui { class XContextChangeEventListener; } +class NotebookBarContextChangeEventListener; class NotebookbarContextControl; class SystemWindow; class SfxViewShell; @@ -44,8 +45,7 @@ public: void DataChanged(const DataChangedEvent& rDCEvt) override; -void ControlListenerForCurrentController(bool bListen); -void StopListeningAllControllers(); +void SetupListener(bool bListen); bool IsWelded() const { return m_bIsWelded; } VclPtr& GetMainContainer() { return m_xVclContentArea; } @@ -54,10 +54,8 @@ public: private: VclPtr m_pSystemWindow; -css::uno::Reference m_pEventListener; -std::set> m_alisteningControllers; +rtl::Reference m_pEventListener; std::vector m_pContextContainers; -css::uno::Reference mxFrame; const SfxViewShell* m_pViewShell; VclPtr m_xVclContentArea; diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 18cae40634d7..d38b4311f143 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -155,26 +155,7 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, nMaxVertPos(0) { Construct( &pViewFrame->GetWindow() ); - -try -{ -SfxShell::SetContextBroadcasterEnabled(true); -SfxShell::SetContextName( - vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview)); -SfxShell::BroadcastContextForActivation(true); -} -catch (const css::uno::RuntimeException& e) -{ -// tdf#130559: allow BackingComp to fail adding listener when opening document -css::uno::Reference xServiceInfo(e.Context, css::uno::UNO_QUERY); -if (!xServiceInfo || !xServiceInfo->supportsService("com.sun.star.frame.StartModule")) -throw; -SAL_WARN("sc.ui", "Opening file from StartModule straight into print preview"); -} - -auto& pNotebookBar = pViewFrame->GetWindow().GetSystemWindow()->GetNotebookBar(); -if (pNotebookBar) -pNotebookBar->ControlListenerForCurrentController(false); // stop listening + SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview)); if ( auto pTabViewShell = dynamic_cast( pOldSh) ) { @@ -202,9 +183,6 @@ ScPreviewShell::~ScPreviewShell() if (mpFrameWindow) mpFrameWindow->SetCloseHdl(Link()); // Remove close handler. -if (auto& pBar = GetViewFrame()->GetWindow().GetSystemWindow()->GetNotebookBar()) -pBar->ControlListenerForCurrentController(true); // let it start listening now - // #108333#; notify Accessibility that Shell is dying and before destroy all BroadcastAccessibility( SfxHint( SfxHintId::Dying ) ); pAccessibilityBroadcaster.reset(); @@ -560,6 +538,8 @@ void ScPrevie
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 26 ++ sc/source/ui/unoobj/defltuno.cxx |3 +++ 2 files changed, 29 insertions(+) New commits: commit a796aa9d65e3d4292232820d424b3f62c673fa07 Author: Maxim Monastirsky AuthorDate: Sun Feb 7 17:42:27 2021 +0200 Commit: Eike Rathke CommitDate: Thu May 13 18:26:12 2021 +0200 tdf#112559 sc: Expose font height via the Defaults UNO API This fixes both ODF import and export of the default cell style. Change-Id: I776591c6ed932a136b95107d3c4a0f25c1bebdf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110539 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 01cf0a236a24..4864266b8790 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,7 @@ public: virtual void tearDown() override; void test(); +void testDefaultFontHeight(); void testTdf139167(); void testTdf113271(); void testTdf139394(); @@ -293,6 +295,7 @@ public: CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); +CPPUNIT_TEST(testDefaultFontHeight); CPPUNIT_TEST(testTdf139167); CPPUNIT_TEST(testTdf113271); CPPUNIT_TEST(testTdf139394); @@ -544,6 +547,29 @@ void ScExportTest::test() xDocSh->DoClose(); } +void ScExportTest::testDefaultFontHeight() +{ +ScDocShellRef xDocSh = new ScDocShell; +xDocSh->DoInitNew(); + +ScDocumentPool* pPool = xDocSh->GetDocument().GetPool(); +pPool->SetPoolDefaultItem(SvxFontHeightItem(400, 100, ATTR_FONT_HEIGHT)); +pPool->SetPoolDefaultItem(SvxFontHeightItem(400, 100, ATTR_CJK_FONT_HEIGHT)); +pPool->SetPoolDefaultItem(SvxFontHeightItem(400, 100, ATTR_CTL_FONT_HEIGHT)); + +xDocSh = saveAndReload(xDocSh.get(), FORMAT_ODS); + +pPool = xDocSh->GetDocument().GetPool(); +const SvxFontHeightItem& rItem = pPool->GetDefaultItem(ATTR_FONT_HEIGHT); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(400), rItem.GetHeight()); +const SvxFontHeightItem& rCJKItem = pPool->GetDefaultItem(ATTR_CJK_FONT_HEIGHT); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(400), rCJKItem.GetHeight()); +const SvxFontHeightItem& rCTLItem = pPool->GetDefaultItem(ATTR_CTL_FONT_HEIGHT); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(400), rCTLItem.GetHeight()); + +xDocSh->DoClose(); +} + void ScExportTest::testTdf139167() { ScDocShellRef xShell = loadDoc(u"tdf139167.", FORMAT_XLSX); diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx index b09a5a004d2b..ae2fe0242892 100644 --- a/sc/source/ui/unoobj/defltuno.cxx +++ b/sc/source/ui/unoobj/defltuno.cxx @@ -59,6 +59,9 @@ static const SfxItemPropertyMapEntry* lcl_GetDocDefaultsMap() {u"" SC_UNONAME_CLOCAL, ATTR_FONT_LANGUAGE, cppu::UnoType::get(), 0, MID_LANG_LOCALE }, {u"" SC_UNO_CJK_CLOCAL, ATTR_CJK_FONT_LANGUAGE, cppu::UnoType::get(), 0, MID_LANG_LOCALE }, {u"" SC_UNO_CTL_CLOCAL, ATTR_CTL_FONT_LANGUAGE, cppu::UnoType::get(), 0, MID_LANG_LOCALE }, +{u"" SC_UNONAME_CHEIGHT, ATTR_FONT_HEIGHT, cppu::UnoType::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS }, +{u"" SC_UNO_CJK_CHEIGHT, ATTR_CJK_FONT_HEIGHT, cppu::UnoType::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS }, +{u"" SC_UNO_CTL_CHEIGHT, ATTR_CTL_FONT_HEIGHT, cppu::UnoType::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS }, {u"" SC_UNO_STANDARDDEC, 0, cppu::UnoType::get(),0, 0 }, {u"" SC_UNO_TABSTOPDIS, 0, cppu::UnoType::get(),0, 0 }, { u"", 0, css::uno::Type(), 0, 0 } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source
sw/source/core/unocore/unomap.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit d803e27ab9fd779720bcf970834d74b41ab90f65 Author: Maxim Monastirsky AuthorDate: Mon Feb 1 16:14:44 2021 +0200 Commit: Michael Stahl CommitDate: Wed Feb 10 10:32:50 2021 +0100 tdf#139529 Fix incomplete DisplayName property for table styles Commit 4dc823990ab217cb9d07a0555d3015d43380fdf5 ("tdf#107852 Support DisplayName property for table styles") only handled the getPropertyValue method, which isn't enough to make it work with introspection, as used from Basic or the new dev docking panel. Change-Id: Ia4d90ab6030585dc469c0b274bef4b988ce647c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110468 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit 9933c3631b5bd9d7b47d0d12c5a7dd292cf1944f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110568 Reviewed-by: Michael Stahl diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 0ae02dedefed..fc8d3713c4a2 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -1492,6 +1492,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { u"" UNO_NAME_TABLE_FIRST_ROW_START_COLUMN, 0, cppu::UnoType::get(), PROPERTY_NONE, 0 }, { u"" UNO_NAME_TABLE_LAST_ROW_END_COLUMN,0, cppu::UnoType::get(), PROPERTY_NONE, 0 }, { u"" UNO_NAME_TABLE_LAST_ROW_START_COLUMN, 0, cppu::UnoType::get(), PROPERTY_NONE, 0 }, +{ u"" UNO_NAME_DISPLAY_NAME, 0, cppu::UnoType::get(), PropertyAttribute::READONLY, 0 }, { u"", 0, css::uno::Type(), 0, 0 } }; m_aMapEntriesArr[nPropertyId] = aTableStyleMap; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/source
sw/source/core/unocore/unomap.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 9933c3631b5bd9d7b47d0d12c5a7dd292cf1944f Author: Maxim Monastirsky AuthorDate: Mon Feb 1 16:14:44 2021 +0200 Commit: Maxim Monastirsky CommitDate: Sat Feb 6 22:39:13 2021 +0100 tdf#139529 Fix incomplete DisplayName property for table styles Commit 4dc823990ab217cb9d07a0555d3015d43380fdf5 ("tdf#107852 Support DisplayName property for table styles") only handled the getPropertyValue method, which isn't enough to make it work with introspection, as used from Basic or the new dev docking panel. Change-Id: Ia4d90ab6030585dc469c0b274bef4b988ce647c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110468 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index abcb313351d0..ff415b7ab658 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -1491,6 +1491,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { u"" UNO_NAME_TABLE_FIRST_ROW_START_COLUMN, 0, cppu::UnoType::get(), PROPERTY_NONE, 0 }, { u"" UNO_NAME_TABLE_LAST_ROW_END_COLUMN,0, cppu::UnoType::get(), PROPERTY_NONE, 0 }, { u"" UNO_NAME_TABLE_LAST_ROW_START_COLUMN, 0, cppu::UnoType::get(), PROPERTY_NONE, 0 }, +{ u"" UNO_NAME_DISPLAY_NAME, 0, cppu::UnoType::get(), PropertyAttribute::READONLY, 0 }, { u"", 0, css::uno::Type(), 0, 0 } }; m_aMapEntriesArr[nPropertyId] = aTableStyleMap; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - solenv/bin
solenv/bin/uiimagelist.xsl |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 9fb11584425d692136c3c83d4e02a78432738f6b Author: Maxim Monastirsky AuthorDate: Thu Jan 28 11:06:35 2021 +0200 Commit: Caolán McNamara CommitDate: Thu Jan 28 17:55:27 2021 +0100 tdf#139781 Handle also "icon-name" property name Change-Id: Iaf2c8521588bdf58daa3166b1efa27979eca2e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110048 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky (cherry picked from commit ed28902e2d2b8929617c92226be985e322147569) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110062 Reviewed-by: Caolán McNamara diff --git a/solenv/bin/uiimagelist.xsl b/solenv/bin/uiimagelist.xsl index 3d14f8d31dc4..659d3b943ae1 100644 --- a/solenv/bin/uiimagelist.xsl +++ b/solenv/bin/uiimagelist.xsl @@ -17,7 +17,7 @@ - + ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits