bin/find-can-be-private-symbols.classes.results | 49 + cui/source/dialogs/colorpicker.cxx | 33 + cui/source/dialogs/tipofthedaydlg.cxx | 10 cui/util/cui.component | 4 external/libxml2/ExternalProject_libxml2.mk | 2 filter/source/msfilter/escherex.cxx | 14 filter/source/msfilter/eschesdo.cxx | 2 filter/source/msfilter/svdfppt.cxx | 2 filter/source/svg/svgexport.cxx | 2 helpcontent2 | 2 include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx | 68 ++ include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx | 91 +++ include/drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx | 78 +++ include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx | 83 +++ include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx | 73 ++ include/drawinglayer/primitive2d/polygonprimitive2d.hxx | 250 ---------- include/svtools/colrdlg.hxx | 9 include/svx/PaletteManager.hxx | 3 include/svx/svdundo.hxx | 4 include/svx/unoapi.hxx | 3 include/unotools/compatibility.hxx | 2 offapi/UnoApi_offapi.mk | 1 offapi/com/sun/star/cui/AsyncColorPicker.idl | 41 + oox/source/drawingml/shape.cxx | 2 oox/source/export/drawingml.cxx | 10 oox/source/export/shapes.cxx | 6 oox/source/vml/vmlshape.cxx | 6 ridljar/com/sun/star/lib/util/NativeLibraryLoader.java | 9 sc/inc/postit.hxx | 8 sc/source/core/data/postit.cxx | 9 sc/source/filter/excel/xeescher.cxx | 2 sc/source/filter/excel/xiescher.cxx | 2 sc/source/filter/xcl97/xcl97esc.cxx | 4 sc/source/filter/xcl97/xcl97rec.cxx | 2 sc/source/filter/xml/xmlcelli.cxx | 14 sc/source/filter/xml/xmlexprt.cxx | 2 sc/source/ui/Accessibility/AccessibleDocument.cxx | 2 sc/source/ui/inc/datatransformation.hxx | 4 sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 17 sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx | 2 sd/qa/unit/export-tests.cxx | 4 sd/qa/unit/misc-tests.cxx | 4 sd/source/core/CustomAnimationEffect.cxx | 4 sd/source/filter/eppt/eppt.cxx | 2 sd/source/filter/eppt/epptso.cxx | 4 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx | 8 sd/source/ui/animations/CustomAnimationPane.cxx | 2 sd/source/ui/slideshow/slideshowimpl.cxx | 2 sd/source/ui/unoidl/unoobj.cxx | 2 solenv/clang-format/excludelist | 1 starmath/source/mathml/import.cxx | 6 stoc/source/uriproc/UriReference.cxx | 16 stoc/source/uriproc/UriReference.hxx | 6 svtools/source/dialogs/colrdlg.cxx | 65 ++ svx/qa/unit/customshapes.cxx | 36 - svx/qa/unit/svdraw.cxx | 2 svx/source/accessibility/AccessibleControlShape.cxx | 2 svx/source/accessibility/AccessibleShape.cxx | 12 svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 12 svx/source/customshapes/EnhancedCustomShapeHandle.cxx | 8 svx/source/sdr/primitive2d/primitivefactory2d.cxx | 2 svx/source/svdraw/svdoashp.cxx | 8 svx/source/svdraw/svdundo.cxx | 4 svx/source/table/tableundo.cxx | 10 svx/source/table/tableundo.hxx | 3 svx/source/tbxctrls/PaletteManager.cxx | 29 - svx/source/tbxctrls/fillctrl.cxx | 10 svx/source/unodraw/UnoGraphicExporter.cxx | 8 svx/source/unodraw/unoshape.cxx | 9 sw/inc/AnnotationWin.hxx | 3 sw/inc/PostItMgr.hxx | 7 sw/qa/extras/odfexport/data/shapes-hyperlink.odt |binary sw/qa/extras/odfexport/odfexport2.cxx | 19 sw/qa/extras/ooxmlexport/data/Simple-TOC.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 12 sw/qa/extras/uiwriter/uiwriter2.cxx | 45 + sw/source/core/access/accmap.cxx | 4 sw/source/core/doc/DocumentContentOperationsManager.cxx | 64 ++ sw/source/core/inc/ModelTraverser.hxx | 2 sw/source/filter/ww8/styles.cxx | 2 sw/source/filter/ww8/wrtw8esh.cxx | 2 sw/source/filter/ww8/ww8par.cxx | 2 sw/source/filter/ww8/ww8par4.cxx | 2 sw/source/uibase/docvw/AnnotationWin.cxx | 6 sw/source/uibase/docvw/AnnotationWin2.cxx | 4 sw/source/uibase/docvw/PostItMgr.cxx | 6 toolkit/source/controls/tree/treedatamodel.cxx | 24 vcl/Library_vcl.mk | 1 vcl/skia/gdiimpl.cxx | 16 vcl/source/control/fixed.cxx | 1 vcl/source/outdev/background.cxx | 77 +++ vcl/source/outdev/bitmap.cxx | 3 vcl/source/outdev/font.cxx | 12 vcl/source/outdev/outdevstate.cxx | 58 -- vcl/source/outdev/wallpaper.cxx | 11 writerfilter/source/dmapper/GraphicImport.cxx | 4 writerfilter/source/rtftok/rtfsdrimport.cxx | 2 97 files changed, 1039 insertions(+), 558 deletions(-)
New commits: commit ddf90ad13d1e4df45dc414d737e50f086c8737fd Author: Chris Sherlock <chris.sherloc...@gmail.com> AuthorDate: Wed May 5 18:03:51 2021 +1000 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Aug 19 13:56:57 2021 +0200 vcl: move ImplReleaseFonts() to outdev/font.cxx Change-Id: I4bd54c24f415e28014690fd775a3a5136d2be433 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115371 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 6c761ec4bf07..1db0ad16207f 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1437,4 +1437,16 @@ void OutputDevice::ResetNewFontCache() mxFontCache = std::make_shared<ImplFontCache>(); } +void OutputDevice::ImplReleaseFonts() +{ + mpGraphics->ReleaseFonts(); + + mbNewFont = true; + mbInitFont = true; + + mpFontInstance.clear(); + mpDeviceFontList.reset(); + mpDeviceFontSizeList.reset(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index c50349cc1f30..51b2c0c874ad 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -571,17 +571,4 @@ void OutputDevice::InitFillColor() mbInitFillColor = false; } -void OutputDevice::ImplReleaseFonts() -{ - mpGraphics->ReleaseFonts(); - - mbNewFont = true; - mbInitFont = true; - - mpFontInstance.clear(); - mpDeviceFontList.reset(); - mpDeviceFontSizeList.reset(); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 0f7401838d77172ef545e38cd07fac253869c904 Author: Chris Sherlock <chris.sherloc...@gmail.com> AuthorDate: Wed May 5 05:08:54 2021 +1000 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Aug 19 13:56:10 2021 +0200 vcl: add braces to SetBackground() function to make reading easier Change-Id: Icb91c4e8aae3f6f25515ca75a3cc230d9238dd4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115370 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/outdev/background.cxx b/vcl/source/outdev/background.cxx index 6bcb3fdeb6c5..2a6d96c3328f 100644 --- a/vcl/source/outdev/background.cxx +++ b/vcl/source/outdev/background.cxx @@ -49,7 +49,9 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground ) // Some of these are probably wrong (e.g. if the gradient has transparency), // but hopefully nobody uses that. If you do, feel free to implement it properly. if( rBackground.GetStyle() == WallpaperStyle::NONE ) + { mpAlphaVDev->SetBackground( rBackground ); + } else if( rBackground.IsBitmap()) { BitmapEx bitmap = rBackground.GetBitmap(); @@ -59,7 +61,9 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground ) mpAlphaVDev->SetBackground( Wallpaper( COL_BLACK )); } else if( rBackground.IsGradient()) + { mpAlphaVDev->SetBackground( Wallpaper( COL_BLACK )); + } else { // Color background. commit eb1bf3c87104790fc17a71d070e570cce278c9e4 Author: Chris Sherlock <chris.sherloc...@gmail.com> AuthorDate: Wed May 5 04:03:43 2021 +1000 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Aug 19 13:55:34 2021 +0200 vcl: move background functions to background.cxx Change-Id: Iee2e42f3881512d2e779d16505c50f76731e398a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115369 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index c2cc51592e42..f6c57e5785fc 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -15028,6 +15028,7 @@ vcl/source/opengl/win/WinDeviceInfo.cxx vcl/source/opengl/win/context.cxx vcl/source/opengl/x11/X11DeviceInfo.cxx vcl/source/opengl/x11/context.cxx +vcl/source/outdev/background.cxx vcl/source/outdev/bitmap.cxx vcl/source/outdev/clipping.cxx vcl/source/outdev/curvedshapes.cxx diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 9fb2e352bdea..c7a0e5c48986 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -211,6 +211,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/edit/xtextedt \ vcl/source/toolkit/group \ vcl/source/toolkit/morebtn \ + vcl/source/outdev/background \ vcl/source/outdev/outdev \ vcl/source/outdev/outdevstate \ vcl/source/outdev/clipping \ diff --git a/vcl/source/outdev/background.cxx b/vcl/source/outdev/background.cxx new file mode 100644 index 000000000000..6bcb3fdeb6c5 --- /dev/null +++ b/vcl/source/outdev/background.cxx @@ -0,0 +1,73 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <vcl/virdev.hxx> + +Color OutputDevice::GetBackgroundColor() const +{ + return GetBackground().GetColor(); +} + +void OutputDevice::SetBackground() +{ + + maBackground = Wallpaper(); + mbBackground = false; + + if( mpAlphaVDev ) + mpAlphaVDev->SetBackground(); +} + +void OutputDevice::SetBackground( const Wallpaper& rBackground ) +{ + + maBackground = rBackground; + + if( rBackground.GetStyle() == WallpaperStyle::NONE ) + mbBackground = false; + else + mbBackground = true; + + if( mpAlphaVDev ) + { + // Some of these are probably wrong (e.g. if the gradient has transparency), + // but hopefully nobody uses that. If you do, feel free to implement it properly. + if( rBackground.GetStyle() == WallpaperStyle::NONE ) + mpAlphaVDev->SetBackground( rBackground ); + else if( rBackground.IsBitmap()) + { + BitmapEx bitmap = rBackground.GetBitmap(); + if( bitmap.IsAlpha()) + mpAlphaVDev->SetBackground( Wallpaper( BitmapEx( Bitmap( bitmap.GetAlpha())))); + else + mpAlphaVDev->SetBackground( Wallpaper( COL_BLACK )); + } + else if( rBackground.IsGradient()) + mpAlphaVDev->SetBackground( Wallpaper( COL_BLACK )); + else + { + // Color background. + int transparency = 255 - rBackground.GetColor().GetAlpha(); + mpAlphaVDev->SetBackground( Wallpaper( Color( transparency, transparency, transparency ))); + } + } +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 7fa966606744..c50349cc1f30 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -436,51 +436,6 @@ void OutputDevice::SetLineColor( const Color& rColor ) mpAlphaVDev->SetLineColor( COL_BLACK ); } -void OutputDevice::SetBackground() -{ - - maBackground = Wallpaper(); - mbBackground = false; - - if( mpAlphaVDev ) - mpAlphaVDev->SetBackground(); -} - -void OutputDevice::SetBackground( const Wallpaper& rBackground ) -{ - - maBackground = rBackground; - - if( rBackground.GetStyle() == WallpaperStyle::NONE ) - mbBackground = false; - else - mbBackground = true; - - if( mpAlphaVDev ) - { - // Some of these are probably wrong (e.g. if the gradient has transparency), - // but hopefully nobody uses that. If you do, feel free to implement it properly. - if( rBackground.GetStyle() == WallpaperStyle::NONE ) - mpAlphaVDev->SetBackground( rBackground ); - else if( rBackground.IsBitmap()) - { - BitmapEx bitmap = rBackground.GetBitmap(); - if( bitmap.IsAlpha()) - mpAlphaVDev->SetBackground( Wallpaper( BitmapEx( Bitmap( bitmap.GetAlpha())))); - else - mpAlphaVDev->SetBackground( Wallpaper( COL_BLACK )); - } - else if( rBackground.IsGradient()) - mpAlphaVDev->SetBackground( Wallpaper( COL_BLACK )); - else - { - // Color background. - int transparency = 255 - rBackground.GetColor().GetAlpha(); - mpAlphaVDev->SetBackground( Wallpaper( Color( transparency, transparency, transparency ))); - } - } -} - void OutputDevice::SetFont( const vcl::Font& rNewFont ) { diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx index 37f3b0c1bcd1..2223eba4c6a2 100644 --- a/vcl/source/outdev/wallpaper.cxx +++ b/vcl/source/outdev/wallpaper.cxx @@ -17,13 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <cassert> - -#include <vcl/gdimtf.hxx> #include <vcl/metaact.hxx> -#include <vcl/outdev.hxx> #include <vcl/virdev.hxx> +#include <cassert> + Color OutputDevice::GetReadableFontColor(const Color& rFontColor, const Color& rBgColor) const { if (rBgColor.IsDark() && rFontColor.IsDark()) @@ -34,11 +32,6 @@ Color OutputDevice::GetReadableFontColor(const Color& rFontColor, const Color& r return rFontColor; } -Color OutputDevice::GetBackgroundColor() const -{ - return GetBackground().GetColor(); -} - void OutputDevice::DrawWallpaper( const tools::Rectangle& rRect, const Wallpaper& rWallpaper ) { commit 1103727fb24b368419ea0cfd2382560ef6b82f43 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Aug 19 16:13:33 2021 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Aug 19 13:52:49 2021 +0200 drawinglayer: split polygonprimitive2d.hxx into multiple files The header polygonprimitive2d.hxx contains multiple primitives, which should be independent in their own header files. Split them in its own file, but for now keep polygonprimitive2d.hxx with includes all the new headers so that compilation goes through with no need to change any other files. Change-Id: I5c8ea2ed0c6d38374c1b871fef562b2164b9c8fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120708 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx new file mode 100644 index 000000000000..7530162b2168 --- /dev/null +++ b/include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/color/bcolor.hxx> + +namespace drawinglayer::primitive2d +{ +/** PolygonHairlinePrimitive2D class + + This primitive defines a Hairline. Since hairlines are view-dependent, + this primitive is view-dependent, too. + + This is one of the non-decomposable primitives, so a renderer + should process it. + */ +class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D +{ +private: + /// the hairline geometry + basegfx::B2DPolygon maPolygon; + + /// the hairline color + basegfx::BColor maBColor; + +public: + /// constructor + PolygonHairlinePrimitive2D(const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rBColor); + + /// data read access + const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } + const basegfx::BColor& getBColor() const { return maBColor; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// get range + virtual basegfx::B2DRange + getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; +}; + +} // end of namespace primitive2d::drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx new file mode 100644 index 000000000000..9bdcb53528cf --- /dev/null +++ b/include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/color/bcolor.hxx> + +namespace drawinglayer::primitive2d +{ +/** PolygonMarkerPrimitive2D class + + This primitive defines a two-colored marker hairline which is + dashed with the given dash length. Since hairlines are view-dependent, + this primitive is view-dependent, too. + + It will be decomposed to the needed PolygonHairlinePrimitive2D if + not handled directly by a renderer. + */ +class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D final + : public BufferedDecompositionPrimitive2D +{ +private: + /// the marker hairline geometry + basegfx::B2DPolygon maPolygon; + + /// the two colors + basegfx::BColor maRGBColorA; + basegfx::BColor maRGBColorB; + + /// the dash distance in 'pixels' + double mfDiscreteDashLength; + + /// decomposition is view-dependent, remember last InverseObjectToViewTransformation + basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation; + + /// local decomposition. + virtual void + create2DDecomposition(Primitive2DContainer& rContainer, + const geometry::ViewInformation2D& rViewInformation) const override; + +public: + /// constructor + PolygonMarkerPrimitive2D(const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rRGBColorA, + const basegfx::BColor& rRGBColorB, double fDiscreteDashLength); + + /// data read access + const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } + const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } + const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } + double getDiscreteDashLength() const { return mfDiscreteDashLength; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// get range + virtual basegfx::B2DRange + getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; + + /// Override standard getDecomposition to be view-dependent here + virtual void + get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, + const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; +}; + +} // end of namespace primitive2d::drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx new file mode 100644 index 000000000000..2577ffdfbeb7 --- /dev/null +++ b/include/drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx> +#include <drawinglayer/attribute/linestartendattribute.hxx> + +namespace drawinglayer::primitive2d +{ +/** PolygonStrokeArrowPrimitive2D class + + This primitive defines a PolygonStrokePrimitive2D, + possibly extended by start and end definitions, which are + normally used for arrows. + */ +class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D final : public PolygonStrokePrimitive2D +{ +private: + /// geometric definitions for line start and end + attribute::LineStartEndAttribute maStart; + attribute::LineStartEndAttribute maEnd; + + /// local decomposition. + virtual void + create2DDecomposition(Primitive2DContainer& rContainer, + const geometry::ViewInformation2D& rViewInformation) const override; + +public: + /// constructor + PolygonStrokeArrowPrimitive2D(const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::StrokeAttribute& rStrokeAttribute, + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd); + + /// constructor without stroking + PolygonStrokeArrowPrimitive2D(const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd); + + /// data read access + const attribute::LineStartEndAttribute& getStart() const { return maStart; } + const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// get range + virtual basegfx::B2DRange + getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; +}; + +} // end of namespace primitive2d::drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx new file mode 100644 index 000000000000..ab1566033f2f --- /dev/null +++ b/include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx> +#include <drawinglayer/attribute/lineattribute.hxx> +#include <drawinglayer/attribute/strokeattribute.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> + +namespace drawinglayer::primitive2d +{ +/** PolygonStrokePrimitive2D class + + This primitive defines a line with line width, line join, line color + and stroke attributes. It will be decomposed dependent on the definition + to the needed primitives, e.g. filled PolyPolygons for fat lines. + */ +class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D +{ +private: + /// the line geometry + basegfx::B2DPolygon maPolygon; + + /// the line attributes like width, join and color + attribute::LineAttribute maLineAttribute; + + /// the line stroking (if used) + attribute::StrokeAttribute maStrokeAttribute; + +protected: + /// local decomposition. + virtual void + create2DDecomposition(Primitive2DContainer& rContainer, + const geometry::ViewInformation2D& rViewInformation) const override; + +public: + /// constructor + PolygonStrokePrimitive2D(const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::StrokeAttribute& rStrokeAttribute); + + /// constructor without stroking + PolygonStrokePrimitive2D(const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute); + + /// data read access + const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } + const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } + const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// get range + virtual basegfx::B2DRange + getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; +}; + +} // end of namespace primitive2d::drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx b/include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx new file mode 100644 index 000000000000..0a11f861f680 --- /dev/null +++ b/include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx> + +namespace drawinglayer::primitive2d +{ +/** PolygonWavePrimitive2D class + + This primitive defines a waveline based on a PolygonStrokePrimitive2D + where the wave is defined by wave width and wave length. + */ +class PolygonWavePrimitive2D final : public PolygonStrokePrimitive2D +{ +private: + /// wave definition + double mfWaveWidth; + double mfWaveHeight; + + /// local decomposition. + virtual void + create2DDecomposition(Primitive2DContainer& rContainer, + const geometry::ViewInformation2D& rViewInformation) const override; + +public: + /// constructor + PolygonWavePrimitive2D(const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::StrokeAttribute& rStrokeAttribute, double fWaveWidth, + double fWaveHeight); + + /// constructor without stroking + PolygonWavePrimitive2D(const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, double fWaveWidth, + double fWaveHeight); + + /// data read access + double getWaveWidth() const { return mfWaveWidth; } + double getWaveHeight() const { return mfWaveHeight; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /// get range + virtual basegfx::B2DRange + getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; +}; + +} // end of namespace primitive2d::drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx index 21d970d5835a..874edde03583 100644 --- a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -21,250 +21,10 @@ #include <drawinglayer/drawinglayerdllapi.h> -#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx> -#include <drawinglayer/attribute/lineattribute.hxx> -#include <drawinglayer/attribute/strokeattribute.hxx> -#include <drawinglayer/attribute/linestartendattribute.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/color/bcolor.hxx> - -namespace drawinglayer::primitive2d -{ -/** PolygonHairlinePrimitive2D class - - This primitive defines a Hairline. Since hairlines are view-dependent, - this primitive is view-dependent, too. - - This is one of the non-decomposable primitives, so a renderer - should process it. - */ -class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D -{ -private: - /// the hairline geometry - basegfx::B2DPolygon maPolygon; - - /// the hairline color - basegfx::BColor maBColor; - -public: - /// constructor - PolygonHairlinePrimitive2D(const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rBColor); - - /// data read access - const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } - const basegfx::BColor& getBColor() const { return maBColor; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - - /// get range - virtual basegfx::B2DRange - getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; - - /// provide unique ID - virtual sal_uInt32 getPrimitive2DID() const override; -}; - -/** PolygonMarkerPrimitive2D class - - This primitive defines a two-colored marker hairline which is - dashed with the given dash length. Since hairlines are view-dependent, - this primitive is view-dependent, too. - - It will be decomposed to the needed PolygonHairlinePrimitive2D if - not handled directly by a renderer. - */ -class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D final - : public BufferedDecompositionPrimitive2D -{ -private: - /// the marker hairline geometry - basegfx::B2DPolygon maPolygon; - - /// the two colors - basegfx::BColor maRGBColorA; - basegfx::BColor maRGBColorB; - - /// the dash distance in 'pixels' - double mfDiscreteDashLength; - - /// decomposition is view-dependent, remember last InverseObjectToViewTransformation - basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation; - - /// local decomposition. - virtual void - create2DDecomposition(Primitive2DContainer& rContainer, - const geometry::ViewInformation2D& rViewInformation) const override; - -public: - /// constructor - PolygonMarkerPrimitive2D(const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rRGBColorA, - const basegfx::BColor& rRGBColorB, double fDiscreteDashLength); - - /// data read access - const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } - const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } - const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } - double getDiscreteDashLength() const { return mfDiscreteDashLength; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - - /// get range - virtual basegfx::B2DRange - getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; - - /// Override standard getDecomposition to be view-dependent here - virtual void - get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, - const geometry::ViewInformation2D& rViewInformation) const override; - - /// provide unique ID - virtual sal_uInt32 getPrimitive2DID() const override; -}; - -/** PolygonStrokePrimitive2D class - - This primitive defines a line with line width, line join, line color - and stroke attributes. It will be decomposed dependent on the definition - to the needed primitives, e.g. filled PolyPolygons for fat lines. - */ -class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D -{ -private: - /// the line geometry - basegfx::B2DPolygon maPolygon; - - /// the line attributes like width, join and color - attribute::LineAttribute maLineAttribute; - - /// the line stroking (if used) - attribute::StrokeAttribute maStrokeAttribute; - -protected: - /// local decomposition. - virtual void - create2DDecomposition(Primitive2DContainer& rContainer, - const geometry::ViewInformation2D& rViewInformation) const override; - -public: - /// constructor - PolygonStrokePrimitive2D(const basegfx::B2DPolygon& rPolygon, - const attribute::LineAttribute& rLineAttribute, - const attribute::StrokeAttribute& rStrokeAttribute); - - /// constructor without stroking - PolygonStrokePrimitive2D(const basegfx::B2DPolygon& rPolygon, - const attribute::LineAttribute& rLineAttribute); - - /// data read access - const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } - const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } - const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - - /// get range - virtual basegfx::B2DRange - getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; - - /// provide unique ID - virtual sal_uInt32 getPrimitive2DID() const override; -}; - -/** PolygonWavePrimitive2D class - - This primitive defines a waveline based on a PolygonStrokePrimitive2D - where the wave is defined by wave width and wave length. - */ -class PolygonWavePrimitive2D final : public PolygonStrokePrimitive2D -{ -private: - /// wave definition - double mfWaveWidth; - double mfWaveHeight; - - /// local decomposition. - virtual void - create2DDecomposition(Primitive2DContainer& rContainer, - const geometry::ViewInformation2D& rViewInformation) const override; - -public: - /// constructor - PolygonWavePrimitive2D(const basegfx::B2DPolygon& rPolygon, - const attribute::LineAttribute& rLineAttribute, - const attribute::StrokeAttribute& rStrokeAttribute, double fWaveWidth, - double fWaveHeight); - - /// constructor without stroking - PolygonWavePrimitive2D(const basegfx::B2DPolygon& rPolygon, - const attribute::LineAttribute& rLineAttribute, double fWaveWidth, - double fWaveHeight); - - /// data read access - double getWaveWidth() const { return mfWaveWidth; } - double getWaveHeight() const { return mfWaveHeight; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - - /// get range - virtual basegfx::B2DRange - getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; - - /// provide unique ID - virtual sal_uInt32 getPrimitive2DID() const override; -}; - -/** PolygonStrokeArrowPrimitive2D class - - This primitive defines a PolygonStrokePrimitive2D, - possibly extended by start and end definitions, which are - normally used for arrows. - */ -class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D final : public PolygonStrokePrimitive2D -{ -private: - /// geometric definitions for line start and end - attribute::LineStartEndAttribute maStart; - attribute::LineStartEndAttribute maEnd; - - /// local decomposition. - virtual void - create2DDecomposition(Primitive2DContainer& rContainer, - const geometry::ViewInformation2D& rViewInformation) const override; - -public: - /// constructor - PolygonStrokeArrowPrimitive2D(const basegfx::B2DPolygon& rPolygon, - const attribute::LineAttribute& rLineAttribute, - const attribute::StrokeAttribute& rStrokeAttribute, - const attribute::LineStartEndAttribute& rStart, - const attribute::LineStartEndAttribute& rEnd); - - /// constructor without stroking - PolygonStrokeArrowPrimitive2D(const basegfx::B2DPolygon& rPolygon, - const attribute::LineAttribute& rLineAttribute, - const attribute::LineStartEndAttribute& rStart, - const attribute::LineStartEndAttribute& rEnd); - - /// data read access - const attribute::LineStartEndAttribute& getStart() const { return maStart; } - const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - - /// get range - virtual basegfx::B2DRange - getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; - - /// provide unique ID - virtual sal_uInt32 getPrimitive2DID() const override; -}; -} // end of namespace primitive2d::drawinglayer +#include <drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolygonMarkerPrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolygonStrokeArrowPrimitive2D.hxx> /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 5440492ff9f949ee9ed9052e8bab6f5136d78b2a Author: Gabor Kelemen <kelemen.gab...@nisz.hu> AuthorDate: Thu Aug 5 22:56:19 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Thu Aug 19 13:39:32 2021 +0200 tdf143726 DOCX: export default TOC Header style with correct name This seems to have been a typo since it was mapped to the default name of the Table of Authorities index's heading in Word which is not really supported anyways. Change-Id: I4cadce18c30c5497f27479fcc251fdf85d859145 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120091 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/Simple-TOC.odt b/sw/qa/extras/ooxmlexport/data/Simple-TOC.odt new file mode 100644 index 000000000000..475f59e051a9 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/Simple-TOC.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 21609b3a9c8e..d1f0603ec884 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -858,6 +858,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf139549, "tdf139549.docx") CPPUNIT_ASSERT_DOUBLES_EQUAL(40.1, aStyleCommandValue.toFloat(), 0.1); } + +DECLARE_OOXMLEXPORT_TEST(testTdf143726, "Simple-TOC.odt") +{ + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); + CPPUNIT_ASSERT(pXmlStyles); + // Without the fix this was "TOA Heading" which belongs to the "Table of Authorities" index in Word + // TOC's heading style should be exported as "TOC Heading" as that's the default Word style name + assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ContentsHeading']/w:name", "val", "TOC Heading"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx index 4c8c9bc49555..6f613b40fad6 100644 --- a/sw/source/filter/ww8/styles.cxx +++ b/sw/source/filter/ww8/styles.cxx @@ -73,7 +73,7 @@ namespace "Endnote Text", "Table of Authorities", "Macro Text", - "TOA Heading", + "TOC Heading", "List", "List 2", "List 3", commit b55db12f79a01ccbd3276f4a291fe20750efbaf3 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Aug 19 10:27:00 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Aug 19 13:09:33 2021 +0200 use std::optional<OutlinerParaObject> in SwPostItMgr it is a COW object, no need to allocate separately on heap Change-Id: I9388d2a850a39a8645071dfb2907a4fe7785ac21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120703 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index 69335760f4fe..53ae31f83b10 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_INC_ANNOTATIONWIN_HXX #include <basegfx/range/b2drange.hxx> +#include <editeng/outlobj.hxx> #include <tools/date.hxx> #include <tools/time.hxx> #include <vcl/InterimItemWindow.hxx> @@ -80,7 +81,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow /// Calculate parent postit id of current annotation window sal_uInt32 CalcParent(); - void InitAnswer(OutlinerParaObject const * pText); + void InitAnswer(OutlinerParaObject const & rText); bool IsProtected() const; diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index 760fc7f8abe7..a2f0af3b9dea 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -33,6 +33,7 @@ #include <unotools/configitem.hxx> #include <com/sun/star/uno/Any.hxx> #include "SidebarWindowsTypes.hxx" +#include <editeng/outlobj.hxx> #include <svl/lstner.hxx> #include <vcl/vclptr.hxx> @@ -137,7 +138,7 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener bool mbReadOnly; bool mbDeleteNote; FieldShadowState mShadowState; - OutlinerParaObject* mpAnswer; + std::optional<OutlinerParaObject> mpAnswer; OUString maAnswerText; bool mbIsShowAnchor; @@ -251,8 +252,8 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener static Color GetColorLight(std::size_t aAuthorIndex); static Color GetColorAnchor(std::size_t aAuthorIndex); - void RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;} - OutlinerParaObject* IsAnswer() {return mpAnswer;} + void RegisterAnswer(OutlinerParaObject* pAnswer) { if (pAnswer) mpAnswer =* pAnswer; else mpAnswer.reset(); } + OutlinerParaObject* IsAnswer() { return mpAnswer ? &*mpAnswer : nullptr; } void RegisterAnswerText(const OUString& aAnswerText) { maAnswerText = aAnswerText; } const OUString& GetAnswerText() const { return maAnswerText; } void CheckMetaText(); diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 01d12affedad..7ecc4889b5fc 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -397,7 +397,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing() return aCount - 1; } -void SwAnnotationWin::InitAnswer(OutlinerParaObject const * pText) +void SwAnnotationWin::InitAnswer(OutlinerParaObject const & rText) { // If tiled annotations is off in lok case, skip adding additional reply text. if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isTiledAnnotations()) @@ -420,8 +420,8 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject const * pText) // insert old, selected text or "..." // TODO: iterate over all paragraphs, not only first one to find out if it is empty - if (!pText->GetTextObject().GetText(0).isEmpty()) - GetOutlinerView()->GetEditView().InsertText(pText->GetTextObject()); + if (!rText.GetTextObject().GetText(0).isEmpty()) + GetOutlinerView()->GetEditView().InsertText(rText.GetTextObject()); else GetOutlinerView()->InsertText("..."); GetOutlinerView()->InsertText("\"\n"); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 71a78d6fae0e..12988e4d3343 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1072,8 +1072,8 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot) // will be created if (!mpOutliner->GetEditEngine().GetText().isEmpty()) { - OutlinerParaObject* pPara = new OutlinerParaObject(GetOutlinerView()->GetEditView().CreateTextObject()); - mrMgr.RegisterAnswer(pPara); + OutlinerParaObject aPara(GetOutlinerView()->GetEditView().CreateTextObject()); + mrMgr.RegisterAnswer(&aPara); } if (mrMgr.HasActiveSidebarWin()) mrMgr.SetActiveSidebarWin(nullptr); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index fe85da695657..a60b70b6cbef 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -200,7 +200,6 @@ SwPostItMgr::SwPostItMgr(SwView* pView) , mbLayouting(false) , mbReadOnly(mpView->GetDocShell()->IsReadOnly()) , mbDeleteNote(true) - , mpAnswer(nullptr) , mbIsShowAnchor( false ) { if(!mpView->GetDrawView() ) @@ -742,9 +741,8 @@ void SwPostItMgr::LayoutPostIts() if (mpAnswer) { if (static_cast<bool>(pPostIt->CalcParent())) //do we really have another note in front of this one - pPostIt->InitAnswer(mpAnswer); - delete mpAnswer; - mpAnswer = nullptr; + pPostIt->InitAnswer(*mpAnswer); + mpAnswer.reset(); } } commit 1b06e7e9e8c467de3450077fe8b90be6b7f73e4b Author: Katarina Behrens <bu...@bubli.org> AuthorDate: Wed Aug 18 22:21:41 2021 +0200 Commit: Katarina Behrens <bu...@bubli.org> CommitDate: Thu Aug 19 12:27:39 2021 +0200 tdf#143567: Distinguish bitmap vs. pattern fill style By the time fill style state change (SID_ATTR_FILL_STYLE) happens, the actual bitmap fill may or may not be known. If it is not known, it is impossible to tell whether it is a regular bitmap or a pattern. That's why this toolbar sometimes incorrectly reports bitmap fill instead of pattern one To solve the problem, we adjust fill style listbox selection only later, by the time we know for sure the fill IS a pattern Change-Id: I0aa95c49601d77dca29ab54ad4c056a76a90e049 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120687 Tested-by: Jenkins Reviewed-by: Katarina Behrens <bu...@bubli.org> diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 3711d7fc4053..6c93563a0b20 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -142,13 +142,6 @@ void SvxFillToolBoxControl::StateChangedAtToolBoxControl( mpLbFillType->set_sensitive(true); drawing::FillStyle eXFS = mpStyleItem->GetValue(); mnLastXFS = sal::static_int_cast< sal_Int32 >(eXFS); - - if (eXFS == drawing::FillStyle_BITMAP && - mpBitmapItem && mpBitmapItem->isPattern() ) - { - mnLastXFS = sal::static_int_cast<sal_Int32>(PATTERN); - } - mpLbFillType->set_active(mnLastXFS); if(drawing::FillStyle_NONE == eXFS) @@ -555,6 +548,9 @@ void SvxFillToolBoxControl::Update() } else if (mpBitmapItem && mpBitmapItem->isPattern() && pSh->GetItem(SID_PATTERN_LIST)) { + mnLastXFS = sal::static_int_cast<sal_Int32>(PATTERN); + mpLbFillType->set_active(mnLastXFS); + SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_PATTERN_LIST)->GetPatternList()); const OUString aString(mpBitmapItem->GetName()); commit 97b61ea3297e04e64aab1e1a4ec50202e9f86fff Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Aug 16 11:09:47 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Aug 19 12:20:57 2021 +0200 ridljar: check that UnoClassLoader is used for NativeLibraryLoader The native libraries are local to class loaders, so System.load("java_uno.so") will fail with any other class loader. Change-Id: Ifa3b1b8dfef07b64828943654e28ff1f0fb5a494 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120527 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/ridljar/com/sun/star/lib/util/NativeLibraryLoader.java b/ridljar/com/sun/star/lib/util/NativeLibraryLoader.java index eb5c6af34e90..d255a71ea5d1 100644 --- a/ridljar/com/sun/star/lib/util/NativeLibraryLoader.java +++ b/ridljar/com/sun/star/lib/util/NativeLibraryLoader.java @@ -21,6 +21,7 @@ package com.sun.star.lib.util; import java.io.File; import java.net.URL; import java.net.URLClassLoader; +import com.sun.star.lib.unoloader.UnoClassLoader; /** * Helper functions to locate and load native files. @@ -35,6 +36,14 @@ import java.net.URLClassLoader; * algorithm.</p> */ public final class NativeLibraryLoader { + static { + // if it's some other class loader, then resolving the symbol + // Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call in + // java_uno will not work and result in UnsatisfiedLinkError + if (!(NativeLibraryLoader.class.getClassLoader() instanceof com.sun.star.lib.unoloader.UnoClassLoader)) { + System.err.println("warning: com.sun.star.lib.util.NativeLibraryLoader must be loaded by com.sun.star.lib.unoloader.UnoClassLoader for java_uno bridge to work (not a problem if this is using Java remote bridge or unit test)"); + } + } /** * Load a system library, using a given class loader to locate the library. * commit 71ebb55b4e888c8d1642d52742fc6d0d11ba3b9e Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Aug 17 17:15:18 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Aug 19 12:13:32 2021 +0200 toolkit: fix deadlock in MutableTreeNode Broadcasting may call back into this, from TreeControlPeer::updateNode(). Release maMutex before broadcasting to fix it. (regression f7ee6baa1b14410fa79aac5dd9d6877df44a823a) Change-Id: I91a8e043aaed02422601e5d4d5253379abab5d7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120616 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/toolkit/source/controls/tree/treedatamodel.cxx b/toolkit/source/controls/tree/treedatamodel.cxx index b482d854349c..935fc39d46ff 100644 --- a/toolkit/source/controls/tree/treedatamodel.cxx +++ b/toolkit/source/controls/tree/treedatamodel.cxx @@ -85,7 +85,8 @@ public: void setParent( MutableTreeNode* pParent ); void broadcast_changes(); - void broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew); + void broadcast_changes(std::unique_lock<std::mutex> & rLock, + const Reference< XTreeNode >& xNode, bool bNew); // XMutableTreeNode virtual css::uno::Any SAL_CALL getDataValue() override; @@ -273,11 +274,14 @@ void MutableTreeNode::broadcast_changes() } } -void MutableTreeNode::broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew) +void MutableTreeNode::broadcast_changes(std::unique_lock<std::mutex> & rLock, + const Reference< XTreeNode >& xNode, bool const bNew) { - if( mxModel.is() ) + auto const xModel(mxModel); + rLock.unlock(); + if (xModel.is()) { - mxModel->broadcast( bNew ? nodes_inserted : nodes_removed, this, xNode ); + xModel->broadcast(bNew ? nodes_inserted : nodes_removed, this, xNode); } } @@ -295,7 +299,7 @@ void SAL_CALL MutableTreeNode::setDataValue( const Any& _datavalue ) void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >& xChildNode ) { - std::scoped_lock aGuard( maMutex ); + std::unique_lock aGuard( maMutex ); rtl::Reference< MutableTreeNode > xImpl( dynamic_cast< MutableTreeNode* >( xChildNode.get() ) ); if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) ) @@ -305,12 +309,12 @@ void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >& xImpl->setParent(this); xImpl->mbIsInserted = true; - broadcast_changes( xChildNode, true ); + broadcast_changes(aGuard, xChildNode, true); } void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const Reference< XMutableTreeNode >& xChildNode ) { - std::scoped_lock aGuard( maMutex ); + std::unique_lock aGuard( maMutex ); if( (nChildIndex < 0) || (nChildIndex > static_cast<sal_Int32>(maChildren.size())) ) throw IndexOutOfBoundsException(); @@ -327,12 +331,12 @@ void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const maChildren.insert( aIter, xImpl ); xImpl->setParent( this ); - broadcast_changes( xChildNode, true ); + broadcast_changes(aGuard, xChildNode, true); } void SAL_CALL MutableTreeNode::removeChildByIndex( sal_Int32 nChildIndex ) { - std::scoped_lock aGuard( maMutex ); + std::unique_lock aGuard( maMutex ); if( (nChildIndex < 0) || (nChildIndex >= static_cast<sal_Int32>(maChildren.size())) ) throw IndexOutOfBoundsException(); @@ -351,7 +355,7 @@ void SAL_CALL MutableTreeNode::removeChildByIndex( sal_Int32 nChildIndex ) xImpl->setParent(nullptr); xImpl->mbIsInserted = false; - broadcast_changes( xImpl, false ); + broadcast_changes(aGuard, xImpl, false); } void SAL_CALL MutableTreeNode::setHasChildrenOnDemand( sal_Bool bChildrenOnDemand ) commit 074790ad6f4e02e7aed3f9c954f0b4005b40fa21 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Aug 19 11:23:13 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Aug 19 12:12:06 2021 +0200 remove some locking from UriReference we write these fields in the constructor and then never modify them again, so safe to skip locking Change-Id: I5cb5ea085ee8c2f6e4ce6417c2648265aa5a06d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120704 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/stoc/source/uriproc/UriReference.cxx b/stoc/source/uriproc/UriReference.cxx index b5962ea74342..de39330579e2 100644 --- a/stoc/source/uriproc/UriReference.cxx +++ b/stoc/source/uriproc/UriReference.cxx @@ -71,41 +71,34 @@ bool UriReference::isAbsolute() const { OUString UriReference::getSchemeSpecificPart() { - std::lock_guard g(m_mutex); OUStringBuffer buf; appendSchemeSpecificPart(buf); return buf.makeStringAndClear(); } bool UriReference::isHierarchical() { - std::lock_guard g(m_mutex); return m_scheme.isEmpty() || m_hasAuthority || m_path.startsWith("/"); } bool UriReference::hasAuthority() { - std::lock_guard g(m_mutex); return m_hasAuthority; } -OUString UriReference::getAuthority() { - std::lock_guard g(m_mutex); +const OUString& UriReference::getAuthority() { return m_authority; } -OUString UriReference::getPath() { - std::lock_guard g(m_mutex); +const OUString& UriReference::getPath() { return m_path; } bool UriReference::hasRelativePath() { - std::lock_guard g(m_mutex); return !m_hasAuthority && (m_path.isEmpty() || m_path[0] != '/'); } sal_Int32 UriReference::getPathSegmentCount() { - std::lock_guard g(m_mutex); if (m_path.isEmpty()) { return 0; } else { @@ -123,7 +116,6 @@ sal_Int32 UriReference::getPathSegmentCount() OUString UriReference::getPathSegment(sal_Int32 index) { - std::lock_guard g(m_mutex); if (!m_path.isEmpty() && index >= 0) { for (sal_Int32 i = m_path[0] == '/' ? 1 : 0;; ++i) { if (index-- == 0) { @@ -140,12 +132,10 @@ OUString UriReference::getPathSegment(sal_Int32 index) } bool UriReference::hasQuery() { - std::lock_guard g(m_mutex); return m_hasQuery; } -OUString UriReference::getQuery() { - std::lock_guard g(m_mutex); +const OUString& UriReference::getQuery() { return m_query; } diff --git a/stoc/source/uriproc/UriReference.hxx b/stoc/source/uriproc/UriReference.hxx index 90a095873364..9c137e9daa42 100644 --- a/stoc/source/uriproc/UriReference.hxx +++ b/stoc/source/uriproc/UriReference.hxx @@ -55,10 +55,10 @@ public: bool hasAuthority(); /// @throws css::uno::RuntimeException - OUString getAuthority(); + const OUString& getAuthority(); /// @throws css::uno::RuntimeException - OUString getPath(); + const OUString& getPath(); /// @throws css::uno::RuntimeException bool hasRelativePath(); @@ -73,7 +73,7 @@ public: bool hasQuery(); /// @throws css::uno::RuntimeException - OUString getQuery(); + const OUString& getQuery(); /// @throws css::uno::RuntimeException bool hasFragment(); commit 60485d591882954bbec717bfc0f4ffce8c9e9d5e Author: Noel Grandin <n...@peralex.com> AuthorDate: Wed Aug 18 22:05:55 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Aug 19 12:02:48 2021 +0200 reduce skia re-alloc costs (tdf#105575) by reserving space before building the SkPath Change-Id: Ic01f614bf574fd3252d379ed38e3039cb0c56b18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120701 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 858bdfe6895a..fa1e43f0533c 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -146,6 +146,11 @@ void addPolyPolygonToPath(const basegfx::B2DPolyPolygon& rPolyPolygon, SkPath& r if (nPolygonCount == 0) return; + sal_uInt32 nPointCount = 0; + for (const auto& rPolygon : rPolyPolygon) + nPointCount += rPolygon.count(); + rPath.incReserve(nPointCount * 2); + for (const auto& rPolygon : rPolyPolygon) { addPolygonToPath(rPolygon, rPath, hasOnlyOrthogonal); @@ -555,6 +560,7 @@ void SkiaSalGraphicsImpl::setCanvasClipRegion(SkCanvas* canvas, const vcl::Regio // in case a polygon is used leads to off-by-one errors such as tdf#133208. RectangleVector rectangles; region.GetRegionRectangles(rectangles); + path.incReserve(rectangles.size() + 1); for (const tools::Rectangle& rectangle : rectangles) path.addRect(SkRect::MakeXYWH(rectangle.Left(), rectangle.Top(), rectangle.GetWidth(), rectangle.GetHeight())); @@ -1137,9 +1143,14 @@ bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDev if (eLineJoin != basegfx::B2DLineJoin::NONE || fLineWidth <= 1.0) { SkPath aPath; + sal_uInt32 nPointCount = 0; + for (const auto& rPolygon : std::as_const(aPolyPolygonLine)) + nPointCount += (rPolygon.count() + 1); + aPath.incReserve(nPointCount + 2); + aPath.setFillType(SkPathFillType::kEvenOdd); - for (sal_uInt32 a(0); a < aPolyPolygonLine.count(); a++) - addPolygonToPath(aPolyPolygonLine.getB2DPolygon(a), aPath); + for (const auto& rPolygon : std::as_const(aPolyPolygonLine)) + addPolygonToPath(rPolygon, aPath); aPath.offset(toSkX(0) + posFix, toSkY(0) + posFix, nullptr); addUpdateRegion(aPath.getBounds()); getDrawCanvas()->drawPath(aPath, aPaint); @@ -1440,6 +1451,7 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFl rasterHack = true; #endif SkPath aPath; + aPath.incReserve(rPoly.count()); addPolygonToPath(rPoly, aPath); aPath.setFillType(SkPathFillType::kEvenOdd); addUpdateRegion(aPath.getBounds()); commit 966d043b631fd1e850d0eb62d657fbca8f62c033 Author: Bayram Çiçek <m...@bayramcicek.com.tr> AuthorDate: Mon Aug 16 00:31:15 2021 +0300 Commit: Muhammet Kara <muhammet.k...@collabora.com> CommitDate: Thu Aug 19 12:01:51 2021 +0200 tdf#143890: Show preview of diagonal borders / Calc - in "Properties sidebar > Cell Appearance", Calc shows preview of the selected cell borders. (preview is at the bottom of "Background" text) - this feature doesn't work for diagonal borders. - diagonal borders preview is now shown with this patch. Change-Id: I9d98b045ccef5e8469cc38f08e5f14c3199d027c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120519 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.k...@collabora.com> diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx index 188a638e7315..75cb52209942 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -258,9 +258,9 @@ void CellAppearancePropertyPanel::NotifyItemUpdate( mbBottom = true; if(!AllSettings::GetLayoutRTL()) - UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor); + UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR); else - UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, mbVer, mbHor); + UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR); if(mbLeft || mbRight || mbTop || mbBottom) mbOuterBorder = true; @@ -301,9 +301,9 @@ void CellAppearancePropertyPanel::NotifyItemUpdate( bBottom = true; if(!AllSettings::GetLayoutRTL()) - UpdateCellBorder(bTop, bBottom, bLeft, bRight, mbVer, mbHor); + UpdateCellBorder(bTop, bBottom, bLeft, bRight, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR); else - UpdateCellBorder(bTop, bBottom, bRight, bLeft, mbVer, mbHor); + UpdateCellBorder(bTop, bBottom, bRight, bLeft, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR); if(mbVer || mbHor || bLeft || bRight || bTop || bBottom) mbInnerBorder = true; @@ -337,6 +337,7 @@ void CellAppearancePropertyPanel::NotifyItemUpdate( } } } + UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR); UpdateControlState(); break; case SID_ATTR_BORDER_DIAG_BLTR: @@ -363,6 +364,7 @@ void CellAppearancePropertyPanel::NotifyItemUpdate( } } } + UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR); UpdateControlState(); break; } @@ -464,7 +466,8 @@ void CellAppearancePropertyPanel::UpdateControlState() } } -void CellAppearancePropertyPanel::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, bool bVer, bool bHor) +void CellAppearancePropertyPanel::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, + bool bVer, bool bHor, bool bTLBR, bool bBLTR) { const Size aBmpSize = maIMGCellBorder.GetBitmapEx().GetSizePixel(); @@ -488,6 +491,10 @@ void CellAppearancePropertyPanel::UpdateCellBorder(bool bTop, bool bBot, bool bL pVirDev->DrawLine( aVT,aVB ); if(bHor) pVirDev->DrawLine( aHL,aHR ); + if(bTLBR) + pVirDev->DrawLine( aTL,aBR ); + if(bBLTR) + pVirDev->DrawLine( aBL,aTR ); mxTBCellBorder->set_item_image(SETBORDERSTYLE, pVirDev); } else diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx index d695df4ceb0a..412cd37e107a 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx @@ -139,7 +139,7 @@ private: void Initialize(); void SetStyleIcon(); void UpdateControlState(); - void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, bool bVer, bool bHor); + void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, bool bVer, bool bHor, bool bTLBR, bool bBLTR); }; } // end of namespace ::sc::sidebar commit 55c4bfc5717c6f915e8760eec95be76813d5fce8 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Aug 19 10:00:01 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Aug 19 11:53:13 2021 +0200 use std::optional<OutlinerParaObject> in SdrUndoAttrObj it is a COW object, no need to allocate separately on heap Change-Id: Ibfecb263eedb6ef5eca8122e80a564cb1e872db1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120699 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx index ccfa69476bba..0064aa85c6c5 100644 --- a/include/svx/svdundo.hxx +++ b/include/svx/svdundo.hxx @@ -154,10 +154,10 @@ protected: bool bHaveToTakeRedoSet; // When assigning TextItems to a drawing object with text: - std::unique_ptr<OutlinerParaObject> pTextUndo; + std::optional<OutlinerParaObject> pTextUndo; // #i8508# // The text rescue mechanism needs also to be implemented for redo actions. - std::unique_ptr<OutlinerParaObject> pTextRedo; + std::optional<OutlinerParaObject> pTextRedo; // If we have a group object: std::unique_ptr<SdrUndoGroup> pUndoGroup; diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 2eea31d23237..51f35d8e80c7 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -279,7 +279,7 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1, bool bSave { auto p = pObj->GetOutlinerParaObject(); if(p) - pTextUndo.reset( new OutlinerParaObject(*p) ); + pTextUndo = *p; } } @@ -316,7 +316,7 @@ void SdrUndoAttrObj::Undo() // #i8508# auto p = pObj->GetOutlinerParaObject(); if(p) - pTextRedo.reset( new OutlinerParaObject(*p) ); + pTextRedo = *p; } } diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx index 2840562a4acf..66641469dd09 100644 --- a/svx/source/table/tableundo.cxx +++ b/svx/source/table/tableundo.cxx @@ -61,10 +61,8 @@ void CellUndo::dispose() maUndoData.mpProperties = nullptr; delete maRedoData.mpProperties; maRedoData.mpProperties = nullptr; - delete maUndoData.mpOutlinerParaObject; - maUndoData.mpOutlinerParaObject = nullptr; - delete maRedoData.mpOutlinerParaObject; - maRedoData.mpOutlinerParaObject = nullptr; + maUndoData.mpOutlinerParaObject.reset(); + maRedoData.mpOutlinerParaObject.reset(); } void CellUndo::ObjectInDestruction(const SdrObject& ) @@ -136,9 +134,9 @@ void CellUndo::getDataFromCell( Data& rData ) rData.mpProperties = mxCell->CloneProperties( *mxObjRef, *mxCell); if( mxCell->GetOutlinerParaObject() ) - rData.mpOutlinerParaObject = new OutlinerParaObject(*mxCell->GetOutlinerParaObject()); + rData.mpOutlinerParaObject = *mxCell->GetOutlinerParaObject(); else - rData.mpOutlinerParaObject = nullptr; + rData.mpOutlinerParaObject.reset(); rData.msFormula = mxCell->msFormula; rData.mfValue = mxCell->mfValue; diff --git a/svx/source/table/tableundo.hxx b/svx/source/table/tableundo.hxx index 861251963658..822f5ec642fa 100644 --- a/svx/source/table/tableundo.hxx +++ b/svx/source/table/tableundo.hxx @@ -55,7 +55,7 @@ private: struct Data { sdr::properties::TextProperties* mpProperties; - OutlinerParaObject* mpOutlinerParaObject; + std::optional<OutlinerParaObject> mpOutlinerParaObject; OUString msFormula; double mfValue; @@ -66,7 +66,6 @@ private: Data() : mpProperties(nullptr) - , mpOutlinerParaObject(nullptr) , mfValue(0) , mnError(0) , mbMerged(false) commit e545598e738407019419a4c0fc252314d8f434d4 Author: Rafael Lima <rafael.palma.l...@gmail.com> AuthorDate: Thu Aug 19 10:23:38 2021 +0200 Commit: Gerrit Code Review <ger...@gerrit.libreoffice.org> CommitDate: Thu Aug 19 10:23:38 2021 +0200 Update git submodules * Update helpcontent2 from branch 'master' to e0504d8b59b76437009203f68877a07fb9951cde - tdf#73359 update information about image/frame alignment Change-Id: Iecca0467229b019c9dd35589375ba269e2dcb713 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/120585 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org> diff --git a/helpcontent2 b/helpcontent2 index a50cd071131a..e0504d8b59b7 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit a50cd071131aaf106c24c9d3b58cb0b90e019fcb +Subproject commit e0504d8b59b76437009203f68877a07fb9951cde commit ee3171adb24a3d720466fa43bec869910333f892 Author: László Németh <nem...@numbertext.org> AuthorDate: Wed Aug 18 13:50:37 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Thu Aug 19 10:21:35 2021 +0200 tdf#143918 sw: fix reject of multiple changes Reuse "extra data" (i.e. tracked direct character formatting) of the previous redline on the formatted text range to track all character formatting changes, i.e. the new and the previous ones, too. E.g. modified text size and color of the word are rejectable now, not only the last one (e.g. text color) of the multiple formatting changes. Follow-up to commit 0115a77eb84afb0d820d8e23f45e49b30b82a8d3 "tdf#50447 sw: track changes of character formatting". Change-Id: I6a82603ecce9885cd06bc27bedbadaac72f97240 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120668 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 429501de75c8..a38fc9fb8742 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2847,6 +2847,51 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf50447) } } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf143918) +{ + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf126206.docx"); + + SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + // bold text + auto xText = getParagraph(1)->getText(); + CPPUNIT_ASSERT(xText.is()); + { + auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 1))); + CPPUNIT_ASSERT(xCursor.is()); + CPPUNIT_ASSERT_EQUAL(OUString("Lorem "), xCursor->getString()); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(xCursor, "CharWeight")); + } + + // remove bold formatting with change tracking and after that, apply underline, too + pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 6, /*bBasicCall=*/false); + dispatchCommand(mxComponent, ".uno:Bold", {}); + dispatchCommand(mxComponent, ".uno:Underline", {}); + + xText = getParagraph(1)->getText(); + CPPUNIT_ASSERT(xText.is()); + { + auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 2))); + CPPUNIT_ASSERT(xCursor.is()); + CPPUNIT_ASSERT_EQUAL(OUString("Lorem "), xCursor->getString()); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xCursor, "CharWeight")); + } + + // reject tracked changes + dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {}); + + // bold text again + xText = getParagraph(1)->getText(); + CPPUNIT_ASSERT(xText.is()); + { + auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 1))); + CPPUNIT_ASSERT(xCursor.is()); + CPPUNIT_ASSERT_EQUAL(OUString("Lorem "), xCursor->getString()); + // This was NORMAL (only underlining was removed) + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(xCursor, "CharWeight")); + } +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101873) { SwDoc* pDoc = createSwDoc(); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index a3e13851130b..29e9e372804d 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1645,11 +1645,43 @@ namespace //local functions originally from docfmt.cxx } SwRangeRedline * pRedline = nullptr; + SwRedlineExtraData_FormatColl* pExtra = nullptr; if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() && pCharSet && pCharSet->Count() ) { if( pUndo ) pUndo->SaveRedlineData( rRg, false ); + // check existing redline on the same range, and use its extra data, if it exists + SwRedlineTable::size_type nRedlPos = rDoc.getIDocumentRedlineAccess().GetRedlinePos( + rRg.Start()->nNode.GetNode(), RedlineType::Format ); + if( SwRedlineTable::npos != nRedlPos ) + { + const SwPosition *pRStt, *pREnd; + do { + SwRangeRedline* pTmp = rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ]; + pRStt = pTmp->Start(); + pREnd = pTmp->End(); + SwComparePosition eCompare = ComparePosition( *rRg.Start(), *rRg.End(), *pRStt, *pREnd ); + if ( eCompare == SwComparePosition::Inside || eCompare == SwComparePosition::Equal ) + { + if (pTmp->GetExtraData()) + { + const SwRedlineExtraData* pExtraData = pTmp->GetExtraData(); + const SwRedlineExtraData_FormatColl* pFormattingChanges = + dynamic_cast<const SwRedlineExtraData_FormatColl*>(pExtraData); + // Check if the extra data is of type 'formatting changes' + if (pFormattingChanges) + { + // Get the item set that holds all the changes properties + const SfxItemSet *pChangesSet = pFormattingChanges->GetItemSet(); + pExtra = new SwRedlineExtraData_FormatColl( "", USHRT_MAX, pChangesSet ); + break; + } + } + } + } while( pRStt <= rRg.Start() && ++nRedlPos < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size()); + } + pRedline = new SwRangeRedline( RedlineType::Format, rRg ); auto const result(rDoc.getIDocumentRedlineAccess().AppendRedline( pRedline, true)); if (IDocumentRedlineAccess::AppendResult::IGNORED == result) @@ -1679,20 +1711,24 @@ namespace //local functions originally from docfmt.cxx // store original text attributes to reject formatting change if (pRedline) { - // Apply the first character's attributes to the ReplaceText - SfxItemSet aSet( rDoc.GetAttrPool(), - svl::Items<RES_CHRATR_BEGIN, RES_TXTATR_WITHEND_END - 1, - RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1> ); - pNode->GetTextNode()->GetParaAttr( aSet, pStt->nContent.GetIndex() + 1, aCntEnd.GetIndex() ); - - aSet.ClearItem( RES_TXTATR_REFMARK ); - aSet.ClearItem( RES_TXTATR_TOXMARK ); - aSet.ClearItem( RES_TXTATR_CJK_RUBY ); - aSet.ClearItem( RES_TXTATR_INETFMT ); - aSet.ClearItem( RES_TXTATR_META ); - aSet.ClearItem( RES_TXTATR_METAFIELD ); - - auto pExtra = new SwRedlineExtraData_FormatColl( "", USHRT_MAX, &aSet ); + // no existing format redline in the range + if (!pExtra) + { + // Apply the first character's attributes to the ReplaceText + SfxItemSet aSet( rDoc.GetAttrPool(), + svl::Items<RES_CHRATR_BEGIN, RES_TXTATR_WITHEND_END - 1, + RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1> ); + pNode->GetTextNode()->GetParaAttr( aSet, pStt->nContent.GetIndex() + 1, aCntEnd.GetIndex() ); + + aSet.ClearItem( RES_TXTATR_REFMARK ); + aSet.ClearItem( RES_TXTATR_TOXMARK ); + aSet.ClearItem( RES_TXTATR_CJK_RUBY ); + aSet.ClearItem( RES_TXTATR_INETFMT ); + aSet.ClearItem( RES_TXTATR_META ); + aSet.ClearItem( RES_TXTATR_METAFIELD ); + pExtra = new SwRedlineExtraData_FormatColl( "", USHRT_MAX, &aSet ); + } + if ( pExtra ) { std::unique_ptr<SwRedlineExtraData_FormatColl> xRedlineExtraData; commit 68bbc75dfeb7c910de7e3d40e840c9959d6875c0 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Aug 18 13:18:56 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Aug 19 10:18:21 2021 +0200 reduce visibility of some symbols Change-Id: I16b6be2217f56e5961e1352201a8ee4e2b033e97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120658 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/bin/find-can-be-private-symbols.classes.results b/bin/find-can-be-private-symbols.classes.results index d8cb7c7c4152..b831d7ffbfbe 100644 --- a/bin/find-can-be-private-symbols.classes.results +++ b/bin/find-can-be-private-symbols.classes.results @@ -13,16 +13,12 @@ BitmapSimpleColorQuantizationFilter BitmapSmoothenFilter BitmapSobelGreyFilter BitmapSolarizeFilter -BubbleWindow BuilderUtils -CommandListBox -CommandPopupHandler ConditionEditDropTarget CurrencyFormatter DdeGetPutItem DdeLink DdeService -DdeTopic DevelopmentToolDockingWindow E3dCompoundObject EditUndo @@ -32,7 +28,6 @@ FontSelectPattern FontSubsetInfo GalleryBinaryStorageLocations GalleryStorageLocations -GenPspGfxBackend GrBackendFormat GrBackendRenderTarget GrBackendSurfaceMutableState @@ -71,10 +66,16 @@ SalInfoPrinter SalPrinter SalSystem SbClassModuleObject +ScChart2DataProvider ScFormatEntry +ScMultiBlockUndo ScPaintHint ScPreviewShell +ScRefUndoData ScRefreshTimer +ScSimpleUndo +ScUndoCut +ScUndoPaste SdAbstractDialogFactory SdOptionsItem SdOptionsLayout @@ -117,20 +118,29 @@ SfxStyleSheetModifiedHint SfxViewFrameItem SfxVisibilityItem SpinListenerMultiplexer +SvtCompatibilityEntry SvxPrintItem SvxRsidItem SvxShowText SvxTPage SwAnchoredObject SwAuthenticator +SwAutoCorrect +SwBaseShell SwColExample SwConnectionListener SwContrastGrf +SwDocFac SwDocShell::LockAllViewsGuard_Impl SwDrawFrameFormat SwDrawModeGrf +SwDrawTextInfo +SwEditWin +SwEnvItem SwExtraRedline +SwExtraRedlineTable SwFltRedline +SwFlyFrame SwFormatEditInReadonly SwFormatEndAtTextEnd SwFormatFollowTextFlow @@ -138,22 +148,38 @@ SwFormatFootnoteAtTextEnd SwFormatLayoutSplit SwFormatNoBalancedColumns SwFormatRowSplit +SwFrame SwGammaGrf +SwHHCWrapper +SwHTMLWriter SwHeaderAndFooterEatSpacingItem +SwHyphWrapper SwLayoutFrame SwLuminanceGrf SwMirrorGrf SwNumRuleItem SwPagePreview +SwReader +SwReaderWriter +SwRect SwRedlineExtraData SwRedlineExtraData_FormatColl +SwRootFrame SwShellCursor +SwSortedObjs +SwSpellPopup SwTableCellInfo::Impl SwTableCellRedline SwTableRowRedline SwTestItem +SwTextFrame +SwTextShell +SwTransferable +SwUnoCursorHelper +SwVisibleCursor SwWebDocShell SwWebView +SwWriter SwWrtShellItem SwXTextRange::Impl SwXTextTableCursor @@ -161,13 +187,13 @@ SyntaxHighlighter::Tokenizer SystemWindow::ImplData TBCExtraInfo TBCGeneralInfo +TranslateNId VclBin VclBuilder::MenuAndId VclBuilder::ParserState VclBuilder::sortIntoBestTabTraversalOrder VclDrawingArea VclGrid -VclScrolledWindow VclWindowEvent WString WindowListenerMultiplexer @@ -233,6 +259,7 @@ formula::FormulaFAPToken formula::FormulaIndexToken formula::FormulaJumpToken formula::FormulaMissingToken +formula::FormulaSpaceToken formula::FormulaTokenIterator::Item formula::FormulaTypedDoubleToken formula::FormulaUnknownToken @@ -251,6 +278,10 @@ oox::ole::AxPageModel oox::ole::AxTabStripModel oox::ole::AxToggleButtonModel oox::ole::AxUserFormModel +sc::CopyFromClipContext +sc::DeleteRowTransformation +sc::FindReplaceTransformation +sc::FormulaGroupInterpreter sd::DrawView sdr::SelectionController sdr::ViewSelection @@ -258,9 +289,13 @@ sdr::animation::primitiveAnimator sdr::contact::ObjectContactPainter svx::CommonStyleManager svx::PropertyValueProvider -sw::BorderCacheOwner +sw::AccessibilityCheck sw::BroadcastingModify +sw::IndexingExport +sw::ModelTraverser +sw::UndoManager sw::UnoCursorHint +sw::search::SearchResultLocator ucbhelper::ActiveDataSink ucbhelper::InteractionAbort ucbhelper::InteractionApprove diff --git a/include/unotools/compatibility.hxx b/include/unotools/compatibility.hxx index 85c6c2484a31..eae757103e6c 100644 --- a/include/unotools/compatibility.hxx +++ b/include/unotools/compatibility.hxx @@ -33,7 +33,7 @@ namespace osl { class Mutex; } /*-************************************************************************************************************ @descr Struct to hold information about one compatibility entry *//*-*************************************************************************************************************/ -class UNOTOOLS_DLLPUBLIC SvtCompatibilityEntry +class SvtCompatibilityEntry { public: /*-************************************************************************************************************ diff --git a/sc/source/ui/inc/datatransformation.hxx b/sc/source/ui/inc/datatransformation.hxx index c82422db5a38..e5bf96690da0 100644 --- a/sc/source/ui/inc/datatransformation.hxx +++ b/sc/source/ui/inc/datatransformation.hxx @@ -183,7 +183,7 @@ class SC_DLLPUBLIC DateTimeTransformation : public DataTransformation const std::set<SCCOL>& getColumn() const; }; -class SC_DLLPUBLIC FindReplaceTransformation : public DataTransformation +class FindReplaceTransformation : public DataTransformation { SCCOL mnCol; OUString maFindString; @@ -198,7 +198,7 @@ class SC_DLLPUBLIC FindReplaceTransformation : public DataTransformation const OUString & getReplaceString() const; }; -class SC_DLLPUBLIC DeleteRowTransformation : public DataTransformation +class DeleteRowTransformation : public DataTransformation { SCCOL mnCol; OUString maFindString; diff --git a/sw/source/core/inc/ModelTraverser.hxx b/sw/source/core/inc/ModelTraverser.hxx index e6aab62c998f..f3c6acb9c6dd 100644 --- a/sw/source/core/inc/ModelTraverser.hxx +++ b/sw/source/core/inc/ModelTraverser.hxx @@ -26,7 +26,7 @@ public: virtual void handleSdrObject(SdrObject* pObject) = 0; }; -class SW_DLLPUBLIC ModelTraverser +class ModelTraverser { private: std::vector<std::shared_ptr<ModelTraverseHandler>> mpNodeHandler; commit f54ccf09a5073b6e544c976da68de0c9fc0bdf6c Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Jul 16 10:06:43 2021 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Thu Aug 19 10:02:15 2021 +0200 Make Custom Color Picker dialog async - now supports also XAsynchronousExecutableDialog - inherits from SfxDialogController to attach correct LOKNotifier Change-Id: Ic21db4057b8087d74a437b1c8ec95408ade5264d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119012 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120670 Tested-by: Jenkins diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 3f1bb0e8c53d..1ecaa887e206 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> #include <com/sun/star/beans/XPropertyAccess.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -31,6 +32,7 @@ #include <vcl/svapp.hxx> #include <vcl/virdev.hxx> #include <vcl/weld.hxx> +#include <sfx2/basedlgs.hxx> #include <svx/hexcolorcontrol.hxx> #include <basegfx/color/bcolortools.hxx> #include <cmath> @@ -727,7 +729,7 @@ void ColorSliderControl::SetValue(const Color& rColor, ColorMode eMode, double d namespace { -class ColorPickerDialog : public weld::GenericDialogController +class ColorPickerDialog : public SfxDialogController { private: ColorFieldControl m_aColorField; @@ -790,7 +792,7 @@ private: } ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, Color nColor, sal_Int16 nDialogMode) - : GenericDialogController(pParent, "cui/ui/colorpickerdialog.ui", "ColorPicker") + : SfxDialogController(pParent, "cui/ui/colorpickerdialog.ui", "ColorPicker") , m_xColorField(new weld::CustomWeld(*m_xBuilder, "colorField", m_aColorField)) , m_xColorSlider(new weld::CustomWeld(*m_xBuilder, "colorSlider", m_aColorSlider)) , m_xColorPreview(new weld::CustomWeld(*m_xBuilder, "preview", m_aColorPreview)) @@ -1205,7 +1207,7 @@ void ColorPickerDialog::setColorComponent( ColorComponent nComp, double dValue ) } } -typedef ::cppu::WeakComponentImplHelper< XServiceInfo, XExecutableDialog, XInitialization, XPropertyAccess > ColorPickerBase; +typedef ::cppu::WeakComponentImplHelper< XServiceInfo, XExecutableDialog, XAsynchronousExecutableDialog, XInitialization, XPropertyAccess > ColorPickerBase; namespace { @@ -1231,6 +1233,10 @@ public: virtual void SAL_CALL setTitle( const OUString& aTitle ) override; virtual sal_Int16 SAL_CALL execute( ) override; + // XAsynchronousExecutableDialog + virtual void SAL_CALL setDialogTitle( const OUString& aTitle ) override; + virtual void SAL_CALL startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener ) override; + private: Color mnColor; sal_Int16 mnMode; @@ -1279,7 +1285,8 @@ sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName ) Sequence< OUString > SAL_CALL ColorPicker::getSupportedServiceNames( ) { - return { "com.sun.star.ui.dialogs.ColorPicker" }; + return { "com.sun.star.ui.dialogs.ColorPicker", + "com.sun.star.ui.dialogs.AsyncColorPicker" }; } // XPropertyAccess @@ -1320,6 +1327,24 @@ sal_Int16 SAL_CALL ColorPicker::execute() return ret; } +// XAsynchronousExecutableDialog +void SAL_CALL ColorPicker::setDialogTitle( const OUString& ) +{ +} + +void SAL_CALL ColorPicker::startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener ) +{ + std::shared_ptr<ColorPickerDialog> xDlg = std::make_shared<ColorPickerDialog>(Application::GetFrameWeld(mxParent), mnColor, mnMode); + weld::DialogController::runAsync(xDlg, [this, xDlg, xListener] (sal_Int32 nResult) { + if (nResult) + mnColor = xDlg->GetColor(); + + sal_Int16 nRet = static_cast<sal_Int16>(nResult); + css::ui::dialogs::DialogClosedEvent aEvent( *this, nRet ); + xListener->dialogClosed( aEvent ); + }); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/util/cui.component b/cui/util/cui.component index 37023b4e1fa1..ae88b06d84bf 100644 --- a/cui/util/cui.component +++ b/cui/util/cui.component @@ -23,4 +23,8 @@ constructor="com_sun_star_cui_ColorPicker_get_implementation"> <service name="com.sun.star.ui.dialogs.ColorPicker"/> </implementation> + <implementation name="com.sun.star.cui.AsyncColorPicker" + constructor="com_sun_star_cui_ColorPicker_get_implementation"> + <service name="com.sun.star.ui.dialogs.AsyncColorPicker"/> + </implementation> </component> diff --git a/include/svtools/colrdlg.hxx b/include/svtools/colrdlg.hxx index ce644d63a865..fabdbcd1177e 100644 --- a/include/svtools/colrdlg.hxx +++ b/include/svtools/colrdlg.hxx @@ -21,6 +21,10 @@ #include <svtools/svtdllapi.h> #include <tools/color.hxx> +#include <tools/link.hxx> +#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> + +#include <functional> namespace weld { class Window; } @@ -43,10 +47,15 @@ public: void SetMode( svtools::ColorPickerMode eMode ); short Execute(weld::Window* pParent); + void ExecuteAsync(weld::Window* pParent, const std::function<void(sal_Int32)>& func); private: Color maColor; svtools::ColorPickerMode meMode; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog > mxDialog; + std::function<void(sal_Int32)> m_aResultFunc; + + DECL_LINK( DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx index 5d22e1d1f42d..179c2fb4a924 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -22,6 +22,7 @@ #include <svx/Palette.hxx> #include <rtl/ustring.hxx> #include <svx/xtable.hxx> +#include <svtools/colrdlg.hxx> #include <deque> #include <vector> @@ -47,6 +48,8 @@ class SVXCORE_DLLPUBLIC PaletteManager ColorSelectFunction maColorSelectFunction; css::uno::Reference < css::uno::XComponentContext > m_context; + + std::unique_ptr<SvColorDialog> m_pColorDlg; public: PaletteManager(); ~PaletteManager(); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 0de6196f54b4..72591fdbbbf8 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -100,6 +100,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/configuration,\ theDefaultProvider \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/cui,\ + AsyncColorPicker \ ColorPicker \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/datatransfer,\ diff --git a/offapi/com/sun/star/cui/AsyncColorPicker.idl b/offapi/com/sun/star/cui/AsyncColorPicker.idl new file mode 100644 index 000000000000..a4f8c28d9b3e --- /dev/null +++ b/offapi/com/sun/star/cui/AsyncColorPicker.idl @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_cui_AsyncColorPicker_idl__ +#define __com_sun_star_cui_AsyncColorPicker_idl__ + +#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.idl> +#include <com/sun/star/awt/XWindow.idl> + + +module com { module sun { module star { module cui { + +/** + @since LibreOffice 7.2 + */ +service AsyncColorPicker : com::sun::star::ui::dialogs::XAsynchronousExecutableDialog +{ + createWithParent([in] com::sun::star::awt::XWindow Parent); +}; + +}; }; }; }; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx index dbd7bd143ce9..d913ef87c2e9 100644 --- a/svtools/source/dialogs/colrdlg.cxx +++ b/svtools/source/dialogs/colrdlg.cxx @@ -20,12 +20,15 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/cui/AsyncColorPicker.hpp> #include <com/sun/star/cui/ColorPicker.hpp> #include <comphelper/processfactory.hxx> #include <svtools/colrdlg.hxx> +#include <svtools/dialogclosedlistener.hxx> #include <vcl/weld.hxx> #include <osl/diagnose.h> @@ -34,6 +37,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::ui::dialogs; +const OUStringLiteral sColor = u"Color"; SvColorDialog::SvColorDialog() : meMode(svtools::ColorPickerMode::Select) @@ -58,7 +62,6 @@ short SvColorDialog::Execute(weld::Window* pParent) short ret = 0; try { - static const OUStringLiteral sColor( u"Color" ); Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference<css::awt::XWindow> xParent; @@ -69,7 +72,7 @@ short SvColorDialog::Execute(weld::Window* pParent) Reference< XPropertyAccess > xPropertyAccess( xDialog, UNO_QUERY_THROW ); Sequence< PropertyValue > props( 2 ); - props[0].Name = sColor; + props[0].Name = OUString( sColor ); props[0].Value <<= maColor; props[1].Name = "Mode"; props[1].Value <<= static_cast<sal_Int16>(meMode); @@ -98,4 +101,62 @@ short SvColorDialog::Execute(weld::Window* pParent) return ret; } +void SvColorDialog::ExecuteAsync(weld::Window* pParent, const std::function<void(sal_Int32)>& func) +{ + m_aResultFunc = func; + + try + { + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + + Reference<css::awt::XWindow> xParent; + if (pParent) + xParent = pParent->GetXWindow(); + + mxDialog = css::cui::AsyncColorPicker::createWithParent(xContext, xParent); + Reference< XPropertyAccess > xPropertyAccess( mxDialog, UNO_QUERY_THROW ); + + Sequence< PropertyValue > props( 2 ); + props[0].Name = OUString( sColor ); + props[0].Value <<= maColor; + props[1].Name = "Mode"; + props[1].Value <<= static_cast<sal_Int16>(meMode); + + xPropertyAccess->setPropertyValues( props ); + + rtl::Reference< ::svt::DialogClosedListener > pListener = new ::svt::DialogClosedListener(); + pListener->SetDialogClosedLink( LINK( this, SvColorDialog, DialogClosedHdl ) ); + + mxDialog->startExecuteModal( pListener ); + } + catch(Exception&) + { + OSL_ASSERT(false); + } +} + +IMPL_LINK( SvColorDialog, DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, pEvent, void ) +{ + sal_Int32 nResult = 0; + sal_Int16 nDialogRet = pEvent->DialogResult; + if( nDialogRet == ExecutableDialogResults::OK ) + { + nResult = RET_OK; + + Reference< XPropertyAccess > xPropertyAccess( mxDialog, UNO_QUERY_THROW ); + Sequence< PropertyValue > props = xPropertyAccess->getPropertyValues(); + + for( const auto& rProp : std::as_const(props) ) + { + if( rProp.Name == sColor ) + { + rProp.Value >>= maColor; + } + } + } + + m_aResultFunc(nResult); + mxDialog.clear(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 4084dffc993c..7bb067952438 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -28,7 +28,6 @@ #include <svx/svxids.hrc> #include <svx/dialmgr.hxx> #include <tbxcolorupdate.hxx> -#include <svtools/colrdlg.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <stack> @@ -301,19 +300,21 @@ void PaletteManager::PopupColorPicker(weld::Window* pParent, const OUString& aCo { // The calling object goes away during aColorDlg.Execute(), so we must copy this OUString aCommandCopy = aCommand; - SvColorDialog aColorDlg; - aColorDlg.SetColor(rInitialColor); - aColorDlg.SetMode(svtools::ColorPickerMode::Modify); - if (aColorDlg.Execute(pParent) == RET_OK) - { - Color aLastColor = aColorDlg.GetColor(); - OUString sColorName = "#" + aLastColor.AsRGBHexString().toAsciiUpperCase(); - NamedColor aNamedColor = std::make_pair(aLastColor, sColorName); - if (mpBtnUpdater) - mpBtnUpdater->Update(aNamedColor); - AddRecentColor(aLastColor, sColorName); - maColorSelectFunction(aCommandCopy, aNamedColor); - } + m_pColorDlg = std::make_unique<SvColorDialog>(); + m_pColorDlg->SetColor(rInitialColor); + m_pColorDlg->SetMode(svtools::ColorPickerMode::Modify); + m_pColorDlg->ExecuteAsync(pParent, [this, aCommandCopy] (sal_Int32 nResult) { + if (nResult == RET_OK) + { + Color aLastColor = m_pColorDlg->GetColor(); + OUString sColorName = "#" + aLastColor.AsRGBHexString().toAsciiUpperCase(); + NamedColor aNamedColor = std::make_pair(aLastColor, sColorName); + if (mpBtnUpdater) + mpBtnUpdater->Update(aNamedColor); + AddRecentColor(aLastColor, sColorName); + maColorSelectFunction(aCommandCopy, aNamedColor); + } + }); } void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor) commit abd08d042fb397fbf97b93d8ca1a6426c1b304e6 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon Jul 26 14:50:56 2021 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Thu Aug 19 10:02:00 2021 +0200 jsdialog: dump id for images ... etc. - the rest is truncated