From 85ced7dad83c9d804ded113e6baf37a2814cfd34 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Tue, 19 Nov 2024 00:04:30 +0530 Subject: [PATCH 001/373] LOK: use boolean or disabled payload for EditDoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it is more appropriate state variable for this particular command, as in many cases its disabled and that can not be treated as false as document still maybe editable Change-Id: Ib19a0cc087518a18bf295abd08b93815606af1fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176736 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara (cherry picked from commit 04375f2a31cc6c233a015215f06682462b30425f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176748 Reviewed-by: Pranam Lashkari Tested-by: Jenkins --- sfx2/source/control/unoctitm.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index fb39d340ebb5..1a4661b7740e 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1192,7 +1192,6 @@ constexpr auto handlers = frozen::make_unordered_map Date: Tue, 19 Nov 2024 12:43:39 +0100 Subject: [PATCH 002/373] Improve LOK tilebench README.md for joining test The previous command was not working, because of the lack of absolute path and also the wrong path to the test document. This should be fixed now. Change-Id: I2230041e17e4b6b33cfd44e5f15a5fce086a5f1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176764 Tested-by: Jenkins Reviewed-by: Hossein --- libreofficekit/qa/data/join/README | 4 ---- libreofficekit/qa/data/join/README.md | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) delete mode 100644 libreofficekit/qa/data/join/README create mode 100644 libreofficekit/qa/data/join/README.md diff --git a/libreofficekit/qa/data/join/README b/libreofficekit/qa/data/join/README deleted file mode 100644 index 35762e1f0525..000000000000 --- a/libreofficekit/qa/data/join/README +++ /dev/null @@ -1,4 +0,0 @@ -Files to run through tilebench --join to detect problems. - -bin/run tilebench instdir/program libreofficekit/qa/join/ --join - diff --git a/libreofficekit/qa/data/join/README.md b/libreofficekit/qa/data/join/README.md new file mode 100644 index 000000000000..787b05b83b89 --- /dev/null +++ b/libreofficekit/qa/data/join/README.md @@ -0,0 +1,16 @@ +# LibreOfficeKit tilebench joining tests + +This folder contain documents to run through `tilebench --join` to detect problems. To run the tests, simply invoke: + + bin/run tilebench $PWD/instdir/program libreofficekit/qa/data/join/ --join + +After the tests are complete, you may see an output like this: + +``` +Failed 81 joins + Zoom 0.5 bad tiles: 23 with 5637 mismatching pixels + Zoom 0.6 bad tiles: 12 with 1341 mismatching pixels + ... + Zoom 2 bad tiles: 3 with 1675 mismatching pixels +``` + From b0eceb839a8ddb70412d8cc5737eb3bd2b90b2c8 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 19 Nov 2024 14:26:51 +0100 Subject: [PATCH 003/373] svx: prefix members of SvxB3DVectorItem See tdf#94879 for motivation. Change-Id: I74c53028d9966ca4059c7a145b3fb0d914d8ae77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176770 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- include/svx/e3ditem.hxx | 4 ++-- svx/source/items/e3ditem.cxx | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/svx/e3ditem.hxx b/include/svx/e3ditem.hxx index bad0e95c89f5..7302c93d97c6 100644 --- a/include/svx/e3ditem.hxx +++ b/include/svx/e3ditem.hxx @@ -27,7 +27,7 @@ class SAL_WARN_UNUSED UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxB3DVectorItem final : public SfxPoolItem { - basegfx::B3DVector aVal; + basegfx::B3DVector m_aVal; public: SvxB3DVectorItem( TypedWhichId nWhich, const basegfx::B3DVector& rVal ); @@ -40,7 +40,7 @@ public: virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - const basegfx::B3DVector& GetValue() const { return aVal; } + const basegfx::B3DVector& GetValue() const { return m_aVal; } void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/svx/source/items/e3ditem.cxx b/svx/source/items/e3ditem.cxx index 05a2ff8bcb2c..736b3ab76e7a 100644 --- a/svx/source/items/e3ditem.cxx +++ b/svx/source/items/e3ditem.cxx @@ -32,21 +32,21 @@ SvxB3DVectorItem::~SvxB3DVectorItem() SvxB3DVectorItem::SvxB3DVectorItem( TypedWhichId _nWhich, const basegfx::B3DVector& rVal ) : SfxPoolItem( _nWhich, SfxItemType::SvxB3DVectorItemType ), - aVal( rVal ) + m_aVal( rVal ) { } SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) : SfxPoolItem( rItem ), - aVal( rItem.aVal ) + m_aVal( rItem.m_aVal ) { } bool SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const { assert(SfxPoolItem::operator==(rItem)); - return static_cast(rItem).aVal == aVal; + return static_cast(rItem).m_aVal == m_aVal; } SvxB3DVectorItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const @@ -56,14 +56,14 @@ SvxB3DVectorItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { - assert(!std::isnan(aVal.getX()) && !std::isnan(aVal.getY()) && !std::isnan(aVal.getZ())); + assert(!std::isnan(m_aVal.getX()) && !std::isnan(m_aVal.getY()) && !std::isnan(m_aVal.getZ())); drawing::Direction3D aDirection; // enter values - aDirection.DirectionX = aVal.getX(); - aDirection.DirectionY = aVal.getY(); - aDirection.DirectionZ = aVal.getZ(); + aDirection.DirectionX = m_aVal.getX(); + aDirection.DirectionY = m_aVal.getY(); + aDirection.DirectionZ = m_aVal.getZ(); rVal <<= aDirection; return true; @@ -77,11 +77,11 @@ bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) if(!(rVal >>= aDirection)) return false; - aVal.setX(aDirection.DirectionX); - aVal.setY(aDirection.DirectionY); - aVal.setZ(aDirection.DirectionZ); + m_aVal.setX(aDirection.DirectionX); + m_aVal.setY(aDirection.DirectionY); + m_aVal.setZ(aDirection.DirectionZ); - assert(!std::isnan(aVal.getX()) && !std::isnan(aVal.getY()) && !std::isnan(aVal.getZ())); + assert(!std::isnan(m_aVal.getX()) && !std::isnan(m_aVal.getY()) && !std::isnan(m_aVal.getZ())); return true; } @@ -91,9 +91,9 @@ void SvxB3DVectorItem::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxB3DVectorItem")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"), BAD_CAST(OString::number(aVal.getX()).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"), BAD_CAST(OString::number(aVal.getY()).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("z"), BAD_CAST(OString::number(aVal.getZ()).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"), BAD_CAST(OString::number(m_aVal.getX()).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"), BAD_CAST(OString::number(m_aVal.getY()).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("z"), BAD_CAST(OString::number(m_aVal.getZ()).getStr())); (void)xmlTextWriterEndElement(pWriter); } From e289fdedeb326a37253be509962c6c8ba0ccee80 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 13:55:54 +0100 Subject: [PATCH 004/373] canvas: simplify getViewStateTransform/getRenderStateTransform Change-Id: If9487aff0d80f7ee9d368cd97bc2828a856cc392 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176766 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- canvas/source/directx/dx_canvashelper.cxx | 3 +-- canvas/source/tools/canvastools.cxx | 20 ++++++++----------- .../mtfrenderer/cachedprimitivebase.cxx | 4 +--- cppcanvas/source/mtfrenderer/implrenderer.cxx | 10 +++------- .../mtfrenderer/transparencygroupaction.cxx | 6 ++---- cppcanvas/source/wrapper/implcanvas.cxx | 4 +--- include/canvas/canvastools.hxx | 10 ++++------ 7 files changed, 20 insertions(+), 37 deletions(-) diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index 1184886784c9..bd3523a134b9 100644 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -728,8 +728,7 @@ namespace dxcanvas "CanvasHelper::setupGraphicsState: reference device invalid" ); // setup view transform first. Clipping e.g. depends on it - ::basegfx::B2DHomMatrix aTransform; - ::canvas::tools::getViewStateTransform(aTransform, viewState); + ::basegfx::B2DHomMatrix aTransform = ::canvas::tools::getViewStateTransform(viewState); // add output offset if( !maOutputOffset.equalZero() ) diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index b77524351b96..4b227c0b1c0d 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -91,10 +91,10 @@ namespace canvas::tools return viewState; } - ::basegfx::B2DHomMatrix& getViewStateTransform( ::basegfx::B2DHomMatrix& transform, - const rendering::ViewState& viewState ) + ::basegfx::B2DHomMatrix getViewStateTransform( const rendering::ViewState& viewState ) { - return ::basegfx::unotools::homMatrixFromAffineMatrix( transform, viewState.AffineTransform ); + ::basegfx::B2DHomMatrix aTransform; + return ::basegfx::unotools::homMatrixFromAffineMatrix( aTransform, viewState.AffineTransform ); } rendering::ViewState& setViewStateTransform( rendering::ViewState& viewState, @@ -105,10 +105,10 @@ namespace canvas::tools return viewState; } - ::basegfx::B2DHomMatrix& getRenderStateTransform( ::basegfx::B2DHomMatrix& transform, - const rendering::RenderState& renderState ) + ::basegfx::B2DHomMatrix getRenderStateTransform( const rendering::RenderState& renderState ) { - return ::basegfx::unotools::homMatrixFromAffineMatrix( transform, renderState.AffineTransform ); + ::basegfx::B2DHomMatrix aTransform; + return ::basegfx::unotools::homMatrixFromAffineMatrix( aTransform, renderState.AffineTransform ); } rendering::RenderState& setRenderStateTransform( rendering::RenderState& renderState, @@ -122,18 +122,14 @@ namespace canvas::tools rendering::RenderState& appendToRenderState( rendering::RenderState& renderState, const ::basegfx::B2DHomMatrix& rTransform ) { - ::basegfx::B2DHomMatrix transform; - - getRenderStateTransform( transform, renderState ); + ::basegfx::B2DHomMatrix transform = getRenderStateTransform( renderState ); return setRenderStateTransform( renderState, transform * rTransform ); } rendering::RenderState& prependToRenderState( rendering::RenderState& renderState, const ::basegfx::B2DHomMatrix& rTransform ) { - ::basegfx::B2DHomMatrix transform; - - getRenderStateTransform( transform, renderState ); + ::basegfx::B2DHomMatrix transform = getRenderStateTransform( renderState ); return setRenderStateTransform( renderState, rTransform * transform ); } diff --git a/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx b/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx index 99f4f95ecc9a..94cc42f77e4a 100644 --- a/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx +++ b/cppcanvas/source/mtfrenderer/cachedprimitivebase.cxx @@ -47,9 +47,7 @@ namespace cppcanvas::internal SAL_INFO( "cppcanvas.emf", "::cppcanvas::internal::CachedPrimitiveBase: 0x" << std::hex << this ); const rendering::ViewState aViewState( mpCanvas->getViewState() ); - ::basegfx::B2DHomMatrix aTotalTransform; - - ::canvas::tools::getViewStateTransform( aTotalTransform, + ::basegfx::B2DHomMatrix aTotalTransform = ::canvas::tools::getViewStateTransform( aViewState ); aTotalTransform *= rTransformation; diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 4a041ee5de5a..381387080bd3 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -2980,9 +2980,7 @@ namespace cppcanvas::internal // render subset of actions // ======================== - ::basegfx::B2DHomMatrix aMatrix; - ::canvas::tools::getRenderStateTransform( aMatrix, - getRenderState() ); + ::basegfx::B2DHomMatrix aMatrix = ::canvas::tools::getRenderStateTransform( getRenderState() ); ActionRenderer aRenderer( aMatrix ); @@ -3024,8 +3022,7 @@ namespace cppcanvas::internal // query bounds for subset of actions // ================================== - ::basegfx::B2DHomMatrix aMatrix; - ::canvas::tools::getRenderStateTransform( aMatrix, + ::basegfx::B2DHomMatrix aMatrix = ::canvas::tools::getRenderStateTransform( getRenderState() ); AreaQuery aQuery( aMatrix ); @@ -3043,8 +3040,7 @@ namespace cppcanvas::internal { SAL_INFO( "cppcanvas.emf", "::cppcanvas::internal::ImplRenderer::draw()" ); - ::basegfx::B2DHomMatrix aMatrix; - ::canvas::tools::getRenderStateTransform( aMatrix, + ::basegfx::B2DHomMatrix aMatrix = ::canvas::tools::getRenderStateTransform( getRenderState() ); try diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx index c3c1cfdf50f6..1f62c0bc30d9 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx @@ -176,12 +176,10 @@ namespace cppcanvas::internal // determine overall transformation matrix (render, view, // and passed transformation) - ::basegfx::B2DHomMatrix aTransform; - ::canvas::tools::getRenderStateTransform( aTransform, maState ); + ::basegfx::B2DHomMatrix aTransform = ::canvas::tools::getRenderStateTransform( maState ); aTransform = rTransformation * aTransform; - ::basegfx::B2DHomMatrix aTotalTransform; - ::canvas::tools::getViewStateTransform( aTotalTransform, mpCanvas->getViewState() ); + ::basegfx::B2DHomMatrix aTotalTransform = ::canvas::tools::getViewStateTransform( mpCanvas->getViewState() ); aTotalTransform = aTotalTransform * aTransform; // since pure translational changes to the transformation diff --git a/cppcanvas/source/wrapper/implcanvas.cxx b/cppcanvas/source/wrapper/implcanvas.cxx index 81b5a3759fd6..6f13f7452e65 100644 --- a/cppcanvas/source/wrapper/implcanvas.cxx +++ b/cppcanvas/source/wrapper/implcanvas.cxx @@ -55,9 +55,7 @@ namespace cppcanvas::internal ::basegfx::B2DHomMatrix ImplCanvas::getTransformation() const { - ::basegfx::B2DHomMatrix aMatrix; - return ::canvas::tools::getViewStateTransform( aMatrix, - maViewState ); + return ::canvas::tools::getViewStateTransform( maViewState ); } void ImplCanvas::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx index cf9ca35180e6..be6f55aafebb 100644 --- a/include/canvas/canvastools.hxx +++ b/include/canvas/canvastools.hxx @@ -129,17 +129,15 @@ namespace canvas CANVASTOOLS_DLLPUBLIC css::rendering::ViewState& initViewState( css::rendering::ViewState& viewState ); - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& - getViewStateTransform( ::basegfx::B2DHomMatrix& transform, - const css::rendering::ViewState& viewState ); + CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix + getViewStateTransform( const css::rendering::ViewState& viewState ); CANVASTOOLS_DLLPUBLIC css::rendering::ViewState& setViewStateTransform( css::rendering::ViewState& viewState, const ::basegfx::B2DHomMatrix& transform ); - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& - getRenderStateTransform( ::basegfx::B2DHomMatrix& transform, - const css::rendering::RenderState& renderState ); + CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix + getRenderStateTransform( const css::rendering::RenderState& renderState ); CANVASTOOLS_DLLPUBLIC css::rendering::RenderState& setRenderStateTransform( css::rendering::RenderState& renderState, From b20156432fcb2dadabff2decaa04537a7eebc042 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 14:37:36 +0100 Subject: [PATCH 005/373] canvas: simplify calcRectToOriginTransform Change-Id: I851d9d11c9d3f3c34353913a146ad168a98dc3d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176771 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- canvas/source/tools/canvastools.cxx | 6 +++--- canvas/source/vcl/impltools.cxx | 3 +-- include/canvas/canvastools.hxx | 8 ++------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 4b227c0b1c0d..18d103cc1228 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -810,10 +810,10 @@ namespace canvas::tools // rSpriteSize is mapped with its left,top corner to (0,0) // again. This is required to properly render sprite // animations to buffer bitmaps. - ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform, - const ::basegfx::B2DRange& i_srcRect, - const ::basegfx::B2DHomMatrix& i_transformation ) + ::basegfx::B2DHomMatrix calcRectToOriginTransform( const ::basegfx::B2DRange& i_srcRect, + const ::basegfx::B2DHomMatrix& i_transformation ) { + ::basegfx::B2DHomMatrix o_transform; if( i_srcRect.isEmpty() ) { o_transform = i_transformation; diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index cafc59a9b83f..854e8c1618e3 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -237,8 +237,7 @@ namespace vclcanvas::tools // aligned with (0,0). The method takes the given // rectangle, and calculates a transformation that maps // this rectangle unscaled to the origin. - ::basegfx::B2DHomMatrix aLocalTransform; - ::canvas::tools::calcRectToOriginTransform( aLocalTransform, + ::basegfx::B2DHomMatrix aLocalTransform = ::canvas::tools::calcRectToOriginTransform( aSrcRect, rTransform ); diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx index be6f55aafebb..c82f0541a6db 100644 --- a/include/canvas/canvastools.hxx +++ b/include/canvas/canvastools.hxx @@ -199,10 +199,6 @@ namespace canvas the upper, left corner to the origin, and leaving the size untouched. - @param o_transform - Output parameter, to receive the resulting transformation - matrix. - @param i_srcRect Input parameter, specifies the original source rectangle. The resulting transformation will exactly map @@ -213,12 +209,12 @@ namespace canvas translations (if necessary), to exactly map the source rectangle to the origin. - @return a reference to the resulting transformation matrix + @return the resulting transformation matrix @see calcRectToRectTransform() @see calcTransformedRectBounds() */ - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform, + CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix calcRectToOriginTransform( const ::basegfx::B2DRange& i_srcRect, const ::basegfx::B2DHomMatrix& i_transformation ); From d991795635784675f6659dc47265088b1803cd52 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 14:25:01 +0100 Subject: [PATCH 006/373] canvas: simplify calcTransformedRectBounds Change-Id: Ia0314a985ae2183727587ad254faec12ee49b66c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176769 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- canvas/source/tools/canvascustomspritehelper.cxx | 6 ++---- canvas/source/tools/canvastools.cxx | 9 +++------ canvas/source/vcl/canvashelper.cxx | 3 +-- canvas/source/vcl/canvashelper_texturefill.cxx | 15 +++++---------- canvas/source/vcl/impltools.cxx | 3 +-- cppcanvas/source/mtfrenderer/mtftools.cxx | 4 +--- include/canvas/canvastools.hxx | 7 ++----- .../source/engine/shapes/viewappletshape.cxx | 6 ++---- .../source/engine/shapes/viewbackgroundshape.cxx | 3 +-- slideshow/source/engine/shapes/viewmediashape.cxx | 7 ++----- slideshow/source/engine/shapes/viewshape.cxx | 8 ++------ slideshow/source/engine/slide/slideimpl.cxx | 3 +-- slideshow/source/engine/slideview.cxx | 9 +++------ slideshow/source/engine/tools.cxx | 6 +----- 14 files changed, 27 insertions(+), 62 deletions(-) diff --git a/canvas/source/tools/canvascustomspritehelper.cxx b/canvas/source/tools/canvascustomspritehelper.cxx index 2517e05be947..d6aa4e06f0f5 100644 --- a/canvas/source/tools/canvascustomspritehelper.cxx +++ b/canvas/source/tools/canvascustomspritehelper.cxx @@ -70,8 +70,7 @@ namespace canvas // rectangular area which is actually covered by the sprite. // coordinates are relative to the sprite origin. - ::basegfx::B2DRectangle aSpriteRectPixel; - ::canvas::tools::calcTransformedRectBounds( aSpriteRectPixel, + ::basegfx::B2DRectangle aSpriteRectPixel = ::canvas::tools::calcTransformedRectBounds( aBounds, maTransform ); @@ -413,8 +412,7 @@ namespace canvas // transform bounds at origin, as the sprite transformation is // formulated that way - ::basegfx::B2DRectangle aTransformedBounds; - return ::canvas::tools::calcTransformedRectBounds( aTransformedBounds, + return ::canvas::tools::calcTransformedRectBounds( rBounds, aTransform ); } diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 18d103cc1228..cf72e8fed401 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -821,9 +821,7 @@ namespace canvas::tools } // transform by given transformation - ::basegfx::B2DRectangle aTransformedRect; - - calcTransformedRectBounds( aTransformedRect, + ::basegfx::B2DRectangle aTransformedRect = calcTransformedRectBounds( i_srcRect, i_transformation ); @@ -837,11 +835,10 @@ namespace canvas::tools return o_transform; } - ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange& outRect, - const ::basegfx::B2DRange& inRect, + ::basegfx::B2DRange calcTransformedRectBounds( const ::basegfx::B2DRange& inRect, const ::basegfx::B2DHomMatrix& transformation ) { - outRect.reset(); + ::basegfx::B2DRange outRect; if( inRect.isEmpty() ) return outRect; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index f398f6734f1a..a35a93bc1dba 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -795,8 +795,7 @@ namespace vclcanvas // modify output position, to account for the fact // that transformBitmap() always normalizes its output // bitmap into the smallest enclosing box. - ::basegfx::B2DRectangle aDestRect; - ::canvas::tools::calcTransformedRectBounds( aDestRect, + ::basegfx::B2DRectangle aDestRect = ::canvas::tools::calcTransformedRectBounds( ::basegfx::B2DRectangle(0, 0, aBmpSize.Width(), diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index f9501cf8d426..2a1ec6b88c9a 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -574,9 +574,8 @@ namespace vclcanvas // extra-verbosity { ::basegfx::B2DRectangle aRect(0.0, 0.0, 1.0, 1.0); - ::basegfx::B2DRectangle aTextureDeviceRect; ::basegfx::B2DHomMatrix aTextureTransform; - ::canvas::tools::calcTransformedRectBounds( aTextureDeviceRect, + ::basegfx::B2DRectangle aTextureDeviceRect = ::canvas::tools::calcTransformedRectBounds( aRect, aTextureTransform ); rOutDev.SetLineColor( COL_RED ); @@ -699,8 +698,7 @@ namespace vclcanvas aTotalTransform *= aTextureTransform; const ::basegfx::B2DRectangle aRect(0.0, 0.0, 1.0, 1.0); - ::basegfx::B2DRectangle aTextureDeviceRect; - ::canvas::tools::calcTransformedRectBounds( aTextureDeviceRect, + ::basegfx::B2DRectangle aTextureDeviceRect = ::canvas::tools::calcTransformedRectBounds( aRect, aTotalTransform ); @@ -806,8 +804,7 @@ namespace vclcanvas // modify output position, to account for the fact // that transformBitmap() always normalizes its output // bitmap into the smallest enclosing box. - ::basegfx::B2DRectangle aDestRect; - ::canvas::tools::calcTransformedRectBounds( aDestRect, + ::basegfx::B2DRectangle aDestRect = ::canvas::tools::calcTransformedRectBounds( ::basegfx::B2DRectangle(0, 0, aBmpSize.Width, @@ -867,8 +864,7 @@ namespace vclcanvas // Finally, the bound rect is transformed back to // device coordinate space, were we determine the // start point from it. - ::basegfx::B2DRectangle aTextureSpacePolygonRect; - ::canvas::tools::calcTransformedRectBounds( aTextureSpacePolygonRect, + ::basegfx::B2DRectangle aTextureSpacePolygonRect = ::canvas::tools::calcTransformedRectBounds( vcl::unotools::b2DRectangleFromRectangle(aPolygonDeviceRect), aInverseTextureTransform ); @@ -891,8 +887,7 @@ namespace vclcanvas nY1 + 1.0 ); // and convert back to device space - ::basegfx::B2DRectangle aSingleDeviceTextureRect; - ::canvas::tools::calcTransformedRectBounds( aSingleDeviceTextureRect, + ::basegfx::B2DRectangle aSingleDeviceTextureRect = ::canvas::tools::calcTransformedRectBounds( aSingleTextureRect, aPureTotalTransform ); diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index 854e8c1618e3..7b431bdf7258 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -223,13 +223,12 @@ namespace vclcanvas::tools // deleted from the transformation; this can be handled by // an offset when painting the bitmap const Size aBmpSize( rBitmap.GetSizePixel() ); - ::basegfx::B2DRectangle aDestRect; // calc effective transformation for bitmap const ::basegfx::B2DRectangle aSrcRect( 0, 0, aBmpSize.Width(), aBmpSize.Height() ); - ::canvas::tools::calcTransformedRectBounds( aDestRect, + ::basegfx::B2DRectangle aDestRect = ::canvas::tools::calcTransformedRectBounds( aSrcRect, rTransform ); diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index dce2973bebca..e0ed0e94f222 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -634,9 +634,7 @@ namespace cppcanvas::tools viewState, renderState ); - ::basegfx::B2DRange aTransformedBounds; - return ::canvas::tools::calcTransformedRectBounds( aTransformedBounds, - rBounds, + return ::canvas::tools::calcTransformedRectBounds(rBounds, aTransform ); } diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx index c82f0541a6db..72660839a110 100644 --- a/include/canvas/canvastools.hxx +++ b/include/canvas/canvastools.hxx @@ -176,18 +176,15 @@ namespace canvas specified input rectangle, and returns the bounding box of the resulting output area. - @param o_Rect - Output rectangle - @param i_Rect Input rectangle @param i_Transformation Transformation to apply to the input rectangle - @return a reference to the resulting rectangle + @return the resulting rectangle */ - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange& o_Rect, + CANVASTOOLS_DLLPUBLIC ::basegfx::B2DRange calcTransformedRectBounds( const ::basegfx::B2DRange& i_Rect, const ::basegfx::B2DHomMatrix& i_Transformation ); diff --git a/slideshow/source/engine/shapes/viewappletshape.cxx b/slideshow/source/engine/shapes/viewappletshape.cxx index faf7d7719184..460d0170c633 100644 --- a/slideshow/source/engine/shapes/viewappletshape.cxx +++ b/slideshow/source/engine/shapes/viewappletshape.cxx @@ -164,8 +164,7 @@ namespace slideshow::internal // resize surrounding window and applet to current shape size // ========================================================== - ::basegfx::B2DRange aTmpRange; - ::canvas::tools::calcTransformedRectBounds( aTmpRange, + ::basegfx::B2DRange aTmpRange = ::canvas::tools::calcTransformedRectBounds( rBounds, mpViewLayer->getTransformation() ); const ::basegfx::B2IRange aPixelBounds( @@ -230,8 +229,7 @@ namespace slideshow::internal if( !mxFrame.is() ) return false; - ::basegfx::B2DRange aTmpRange; - ::canvas::tools::calcTransformedRectBounds( aTmpRange, + ::basegfx::B2DRange aTmpRange = ::canvas::tools::calcTransformedRectBounds( rBounds, mpViewLayer->getTransformation() ); const ::basegfx::B2IRange aPixelBounds( diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx index f961eabb7107..978ade81db84 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx @@ -61,8 +61,7 @@ namespace slideshow::internal // buffered bitmap is invalid, re-create // determine transformed page bounds - ::basegfx::B2DRectangle aTmpRect; - ::canvas::tools::calcTransformedRectBounds( aTmpRect, + ::basegfx::B2DRectangle aTmpRect = ::canvas::tools::calcTransformedRectBounds( maBounds, aCanvasTransform ); diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index bf683d17a341..ec19f11b66f8 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -228,8 +228,7 @@ namespace slideshow::internal maWindowOffset.Y = aRect.Y; } - ::basegfx::B2DRange aTmpRange; - ::canvas::tools::calcTransformedRectBounds( aTmpRange, + ::basegfx::B2DRange aTmpRange = ::canvas::tools::calcTransformedRectBounds( rNewBounds, mpViewLayer->getTransformation() ); const ::basegfx::B2IRange aRangePix( @@ -422,9 +421,7 @@ namespace slideshow::internal if( pWindow ) { - ::basegfx::B2DRange aTmpRange; - ::canvas::tools::calcTransformedRectBounds( aTmpRange, - rBounds, + ::basegfx::B2DRange aTmpRange = ::canvas::tools::calcTransformedRectBounds( rBounds, mpViewLayer->getTransformation() ); const ::basegfx::B2IRange aRangePix( ::basegfx::unotools::b2ISurroundingRangeFromB2DRange( aTmpRange )); diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 836e0bd97928..b29afe8e4642 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -248,8 +248,7 @@ namespace slideshow::internal // transformation might result in smaller // overall bounds. - ::basegfx::B2DRectangle aBoundsPixel; - ::canvas::tools::calcTransformedRectBounds( aBoundsPixel, + ::basegfx::B2DRectangle aBoundsPixel = ::canvas::tools::calcTransformedRectBounds( rUntransformedArea, rCanvasTransformation ); @@ -339,11 +338,9 @@ namespace slideshow::internal // char scaling). NOTE: to cancel the shape translation, // contained in rSpriteBoundsPixel, this is _without_ any // translational component. - ::basegfx::B2DRectangle aLogShapeBounds; const ::basegfx::B2DRectangle aNominalShapeBoundsPixel( shapeArea2AreaPixel( aCanvasTransform, ::canvas::tools::calcTransformedRectBounds( - aLogShapeBounds, ::basegfx::B2DRectangle(0.0,0.0,1.0,1.0), aNonTranslationalShapeTransformation ) ) ); @@ -582,8 +579,7 @@ namespace slideshow::internal // area_ in device pixel const ::basegfx::B2DHomMatrix aCanvasTransform( rDestinationCanvas->getTransformation() ); - ::basegfx::B2DRectangle aTmpRect; - ::canvas::tools::calcTransformedRectBounds( aTmpRect, + ::basegfx::B2DRectangle aTmpRect = ::canvas::tools::calcTransformedRectBounds( rUpdateBounds, aCanvasTransform ); diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 6b7d92e78648..6e758c995711 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -72,8 +72,7 @@ basegfx::B2IVector getSlideSizePixel(const basegfx::B2DVector& rSlideSize, { const basegfx::B2DRange aRect(0, 0, rSlideSize.getX(), rSlideSize.getY()); - basegfx::B2DRange aTmpRect; - canvas::tools::calcTransformedRectBounds(aTmpRect, aRect, rTransformation); + basegfx::B2DRange aTmpRect = canvas::tools::calcTransformedRectBounds(aRect, rTransformation); // #i42440# Returned slide size is one pixel too small, as // rendering happens one pixel to the right and below the diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index 3e6d0b6ab624..44f7c3a0e4d3 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -213,8 +213,7 @@ void clearRect( ::cppcanvas::CanvasSharedPtr const& pCanvas, basegfx::B2IRange getLayerBoundsPixel( basegfx::B2DRange const& rLayerBounds, basegfx::B2DHomMatrix const& rTransformation ) { - ::basegfx::B2DRange aTmpRect; - ::canvas::tools::calcTransformedRectBounds( aTmpRect, + ::basegfx::B2DRange aTmpRect = ::canvas::tools::calcTransformedRectBounds( rLayerBounds, rTransformation ); @@ -464,8 +463,7 @@ public: virtual css::geometry::IntegerSize2D getTranslationOffset() const override { - basegfx::B2DRectangle aTmpRect; - canvas::tools::calcTransformedRectBounds( aTmpRect, + basegfx::B2DRectangle aTmpRect = canvas::tools::calcTransformedRectBounds( maLayerBounds, maTransformation ); geometry::IntegerSize2D offset(0, 0); @@ -514,8 +512,7 @@ private: { // Offset given transformation by left, top border of given // range (after transformation through given transformation) - basegfx::B2DRectangle aTmpRect; - canvas::tools::calcTransformedRectBounds( aTmpRect, + basegfx::B2DRectangle aTmpRect = canvas::tools::calcTransformedRectBounds( maLayerBounds, maTransformation ); diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index 6f19dad8a405..4e55fe430d5d 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -561,11 +561,8 @@ namespace slideshow::internal aTransform *= rShapeTransform; - ::basegfx::B2DRectangle aRes; - // apply shape transformation to unit rect return ::canvas::tools::calcTransformedRectBounds( - aRes, rUnitBounds, aTransform ); } @@ -764,8 +761,7 @@ namespace slideshow::internal const basegfx::B2DRange aRect( 0,0, rSlideSize.getX(), rSlideSize.getY() ); - basegfx::B2DRange aTmpRect; - canvas::tools::calcTransformedRectBounds( aTmpRect, + basegfx::B2DRange aTmpRect = canvas::tools::calcTransformedRectBounds( aRect, pView->getTransformation() ); From 256463f132597b257cde0b2e3506757b785e4b08 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 19 Nov 2024 12:44:53 +0100 Subject: [PATCH 007/373] loplugin:passparamsbyref Change-Id: I9ad592670399f25eeaea375bf71e6d30ee20118f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176763 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- vcl/unx/gtk4/gtkaccessibleregistry.cxx | 8 ++++---- vcl/unx/gtk4/gtkaccessibleregistry.hxx | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/vcl/unx/gtk4/gtkaccessibleregistry.cxx b/vcl/unx/gtk4/gtkaccessibleregistry.cxx index c8086ec4b13e..357df91d0160 100644 --- a/vcl/unx/gtk4/gtkaccessibleregistry.cxx +++ b/vcl/unx/gtk4/gtkaccessibleregistry.cxx @@ -14,9 +14,9 @@ std::map GtkAccessibleRegistry::m_aMapping = {}; -LoAccessible* -GtkAccessibleRegistry::getLOAccessible(css::uno::Reference xAcc, - GdkDisplay* pDisplay, GtkAccessible* pParent) +LoAccessible* GtkAccessibleRegistry::getLOAccessible( + css::uno::Reference const& xAcc, GdkDisplay* pDisplay, + GtkAccessible* pParent) { if (!xAcc.is()) return nullptr; @@ -48,7 +48,7 @@ GtkAccessibleRegistry::getLOAccessible(css::uno::Reference xAcc) +void GtkAccessibleRegistry::remove(css::uno::Reference const& xAcc) { assert(xAcc.is()); m_aMapping.erase(xAcc.get()); diff --git a/vcl/unx/gtk4/gtkaccessibleregistry.hxx b/vcl/unx/gtk4/gtkaccessibleregistry.hxx index e2ad1588e8db..fb57ff9be4b1 100644 --- a/vcl/unx/gtk4/gtkaccessibleregistry.hxx +++ b/vcl/unx/gtk4/gtkaccessibleregistry.hxx @@ -23,10 +23,11 @@ private: public: /** Returns the related LoAccessible* for the XAccessible. Creates a new one if none exists yet. */ - static LoAccessible* getLOAccessible(css::uno::Reference xAcc, - GdkDisplay* pDisplay, GtkAccessible* pParent = nullptr); + static LoAccessible* + getLOAccessible(css::uno::Reference const& xAcc, + GdkDisplay* pDisplay, GtkAccessible* pParent = nullptr); /** Removes the entry for the given XAccessible. */ - static void remove(css::uno::Reference xAcc); + static void remove(css::uno::Reference const& xAcc); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From f1ab6d3e046c261ac0cc0de35bed3e61ba052dca Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 18 Nov 2024 19:49:51 +0200 Subject: [PATCH 008/373] Simplify SalGraphicsImpl::Init it is only used for one thing, so rename it, and use a default implementation to avoid having empty implementations everywhere Change-Id: Ib650bb520ccbfcc27537b754db4d3de4ad10e638 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176733 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/headless/SvpGraphicsBackend.cxx | 2 -- vcl/inc/headless/SvpGraphicsBackend.hxx | 2 -- vcl/inc/qt5/QtGraphics.hxx | 2 -- vcl/inc/quartz/salgdi.h | 2 -- vcl/inc/salgdiimpl.hxx | 3 ++- vcl/inc/skia/gdiimpl.hxx | 2 -- vcl/inc/skia/x11/gdiimpl.hxx | 2 +- vcl/quartz/AquaGraphicsBackend.cxx | 2 -- vcl/skia/gdiimpl.cxx | 2 -- vcl/skia/osx/gdiimpl.cxx | 1 - vcl/skia/x11/gdiimpl.cxx | 3 +-- vcl/skia/x11/salvd.cxx | 2 +- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 2 -- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 2 -- vcl/unx/generic/gdi/salgdi.cxx | 2 +- vcl/unx/generic/gdi/salvd.cxx | 2 +- vcl/win/gdi/gdiimpl.cxx | 4 ---- vcl/win/gdi/gdiimpl.hxx | 2 -- vcl/win/gdi/salgdi.cxx | 2 -- vcl/win/gdi/salvd.cxx | 3 --- 20 files changed, 7 insertions(+), 37 deletions(-) diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index ddd85978dd82..58a50653a743 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -24,8 +24,6 @@ SvpGraphicsBackend::SvpGraphicsBackend(CairoCommon& rCairoCommon) { } -void SvpGraphicsBackend::Init() {} - void SvpGraphicsBackend::setClipRegion(const vcl::Region& i_rClip) { m_rCairoCommon.m_aClipRegion = i_rClip; diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx index 4e2322148376..53678d619198 100644 --- a/vcl/inc/headless/SvpGraphicsBackend.hxx +++ b/vcl/inc/headless/SvpGraphicsBackend.hxx @@ -34,8 +34,6 @@ class SAL_DLLPUBLIC_RTTI SvpGraphicsBackend final : public SalGraphicsImpl public: SvpGraphicsBackend(CairoCommon& rCairoCommon); - void Init() override; - OUString getRenderBackendName() const override { return u"svp"_ustr; } void setClipRegion(vcl::Region const& rRegion) override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index 5212d30873b2..fea1a2a0de18 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -59,8 +59,6 @@ public: QtGraphicsBackend(QtFrame* pFrame, QImage* pQImage); ~QtGraphicsBackend() override; - void Init() override {} - QImage* getQImage() { return m_pQImage; } void setQImage(QImage* pQImage) { m_pQImage = pQImage; } diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 00abbc6df182..e0ccbfbb4fd1 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -269,8 +269,6 @@ public: AquaGraphicsBackend(AquaSharedAttributes & rShared); ~AquaGraphicsBackend() override; - void Init() override; - OUString getRenderBackendName() const override { return "aqua"; diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 8fa7b54ca3f0..56e303b2806e 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -72,7 +72,8 @@ public: // so see the SalGraphics class for documentation (both uppercase and lowercase // function variants). - virtual void Init() = 0; + /// Only used by the X11SkiaSalGraphicsImpl backend + virtual void UpdateX11GeometryProvider() {} virtual void DeInit() {} diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 88d066aaafdb..7fad579d0db2 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -41,8 +41,6 @@ public: SkiaSalGraphicsImpl(SalGraphics& pParent, SalGeometryProvider* pProvider); virtual ~SkiaSalGraphicsImpl() override; - virtual void Init() override; - virtual void DeInit() override; virtual OUString getRenderBackendName() const override { return u"skia"_ustr; } diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx index 835f565e9c36..990c3d60b64a 100644 --- a/vcl/inc/skia/x11/gdiimpl.hxx +++ b/vcl/inc/skia/x11/gdiimpl.hxx @@ -24,7 +24,7 @@ private: public: X11SkiaSalGraphicsImpl(X11SalGraphics& rParent); - virtual void Init() override; + virtual void UpdateX11GeometryProvider() override; virtual void Flush() override; static void prepareSkia(); diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index daf413165f8f..61a09efebc4f 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -196,8 +196,6 @@ AquaGraphicsBackend::AquaGraphicsBackend(AquaSharedAttributes& rShared) AquaGraphicsBackend::~AquaGraphicsBackend() {} -void AquaGraphicsBackend::Init() {} - void AquaGraphicsBackend::setClipRegion(vcl::Region const& rRegion) { // release old clip path diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index eaf0051bacea..938c640ca34a 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -301,8 +301,6 @@ SkiaSalGraphicsImpl::~SkiaSalGraphicsImpl() assert(!mWindowContext); } -void SkiaSalGraphicsImpl::Init() {} - void SkiaSalGraphicsImpl::createSurface() { SkiaZone zone; diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index 4874b056dad7..45216340492c 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -59,7 +59,6 @@ AquaSkiaSalGraphicsImpl::AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent, : SkiaSalGraphicsImpl(rParent, rShared.mpFrame) , AquaGraphicsBackendBase(rShared, this) { - Init(); // mac code doesn't call Init() } AquaSkiaSalGraphicsImpl::~AquaSkiaSalGraphicsImpl() diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx index ffad26bd9b1f..34df45fa7d09 100644 --- a/vcl/skia/x11/gdiimpl.cxx +++ b/vcl/skia/x11/gdiimpl.cxx @@ -35,11 +35,10 @@ X11SkiaSalGraphicsImpl::X11SkiaSalGraphicsImpl(X11SalGraphics& rParent) { } -void X11SkiaSalGraphicsImpl::Init() +void X11SkiaSalGraphicsImpl::UpdateX11GeometryProvider() { // The m_pFrame and m_pVDev pointers are updated late in X11 setProvider(mX11Parent.GetGeometryProvider()); - SkiaSalGraphicsImpl::Init(); } void X11SkiaSalGraphicsImpl::createWindowSurfaceInternal(bool forceRaster) diff --git a/vcl/skia/x11/salvd.cxx b/vcl/skia/x11/salvd.cxx index 464793305896..8979f36d32b3 100644 --- a/vcl/skia/x11/salvd.cxx +++ b/vcl/skia/x11/salvd.cxx @@ -26,7 +26,7 @@ void X11SalGraphics::Init(X11SkiaSalVirtualDevice* pDevice) m_pVDev = pDevice; m_pFrame = nullptr; - mxImpl->Init(); + mxImpl->UpdateX11GeometryProvider(); } X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, tools::Long nDX, diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index 4ec2b453a622..c4cda27cd006 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -196,8 +196,6 @@ std::shared_ptr X11CairoSalGraphicsImpl::getBitmap(tools::Long nX, to return mrCairoCommon.getBitmap(nX, nY, nWidth, nHeight); } -void X11CairoSalGraphicsImpl::Init() {} - bool X11CairoSalGraphicsImpl::drawPolyLineBezier(sal_uInt32, const Point*, const PolyFlags*) { return false; diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index 607809d1421f..f6a9b2e83ab0 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -33,8 +33,6 @@ private: public: X11CairoSalGraphicsImpl(X11SalGraphics& rParent, CairoCommon& rCairoCommon); - void Init() override; - OUString getRenderBackendName() const override { return u"gen"_ustr; } // get the depth of the device diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index e765919d6528..a9f0a3c0cbb8 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -143,7 +143,7 @@ void X11SalGraphics::Init( X11SalFrame& rFrame, Drawable aTarget, m_pVDev = nullptr; SetDrawable(aTarget, rFrame.GetSurface(), nXScreen); - mxImpl->Init(); + mxImpl->UpdateX11GeometryProvider(); } void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // const diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index e0a9d33f6e87..33ba19c95d59 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -79,7 +79,7 @@ void X11SalGraphics::Init(X11SalVirtualDevice *pDevice, SalColormap* pColormap, m_pFrame = nullptr; SetDrawable(pDevice->GetDrawable(), pDevice->GetSurface(), m_nXScreen); - mxImpl->Init(); + mxImpl->UpdateX11GeometryProvider(); } X11SalVirtualDevice::X11SalVirtualDevice(const SalGraphics& rGraphics, tools::Long &nDX, tools::Long &nDY, diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index ca222660e458..7438f6a4ded7 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -235,10 +235,6 @@ WinSalGraphicsImpl::~WinSalGraphicsImpl() } } -void WinSalGraphicsImpl::Init() -{ -} - bool WinSalGraphicsImpl::drawEPS(tools::Long, tools::Long, tools::Long, tools::Long, void*, sal_uInt32) { return false; diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 15f1a20b5881..980454ebc303 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -66,8 +66,6 @@ public: virtual ~WinSalGraphicsImpl() override; - virtual void Init() override; - virtual OUString getRenderBackendName() const override { return "gdi"; } virtual void setClipRegion( const vcl::Region& ) override; diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx index 8da350105afd..1040810975c6 100644 --- a/vcl/win/gdi/salgdi.cxx +++ b/vcl/win/gdi/salgdi.cxx @@ -464,8 +464,6 @@ void WinSalGraphics::InitGraphics() ::SetTextAlign( getHDC(), TA_BASELINE | TA_LEFT | TA_NOUPDATECP ); ::SetBkMode( getHDC(), TRANSPARENT ); ::SetROP2( getHDC(), R2_COPYPEN ); - - mpImpl->Init(); } void WinSalGraphics::DeInitGraphics() diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx index 7b3e7e11fc5c..2f6d3456a748 100644 --- a/vcl/win/gdi/salvd.cxx +++ b/vcl/win/gdi/salvd.cxx @@ -214,9 +214,6 @@ bool WinSalVirtualDevice::SetSize( tools::Long nDX, tools::Long nDY ) SelectBitmap(getHDC(), hNewBmp); mhBmp.reset(hNewBmp); - if (mpGraphics) - mpGraphics->GetImpl()->Init(); - return true; } From 980164fe222460799f733a6f1a3acc53d5cb002c Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 16:47:20 +0100 Subject: [PATCH 009/373] svx: unused return Change-Id: If747870121e3fc8c2d97b5fc769b2d928a4c3f9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176777 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- compilerplugins/clang/unusedmethods.unused-returns.results | 2 -- include/svx/framelink.hxx | 2 +- svx/source/dialog/framelink.cxx | 4 +--- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/compilerplugins/clang/unusedmethods.unused-returns.results b/compilerplugins/clang/unusedmethods.unused-returns.results index 7866efc445d7..090769f1a2f6 100644 --- a/compilerplugins/clang/unusedmethods.unused-returns.results +++ b/compilerplugins/clang/unusedmethods.unused-returns.results @@ -152,8 +152,6 @@ include/svx/autoformathelper.hxx:216 _Bool AutoFormatBase::SaveBlockB(SvStream &,unsigned short) const include/svx/dlgctrl.hxx:99 Point SvxRectCtl::SetActualRPWithoutInvalidate(enum RectPoint) -include/svx/framelink.hxx:159 - svx::frame::Style & svx::frame::Style::MirrorSelf() include/svx/PaletteManager.hxx:87 _Bool PaletteManager::GetLumModOff(unsigned short,unsigned short,short &,short &) include/test/a11y/AccessibilityTools.hxx:119 diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx index 5c98c3a1a3c6..fdd20c5994bf 100644 --- a/include/svx/framelink.hxx +++ b/include/svx/framelink.hxx @@ -156,7 +156,7 @@ public: void SetType( SvxBorderLineStyle nType ) { mnType = nType; } /** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */ - Style& MirrorSelf(); + void MirrorSelf(); /** Enables the Word-compatible Style comparison code. */ void SetWordTableCell(bool bWordTableCell) { mbWordTableCell = bWordTableCell; } diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index 887fc445dc0c..60adda1d7136 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -160,7 +160,7 @@ void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWid } } -Style& Style::MirrorSelf() +void Style::MirrorSelf() { if (mfSecn) { @@ -173,8 +173,6 @@ Style& Style::MirrorSelf() { meRefMode = (meRefMode == RefMode::Begin) ? RefMode::End : RefMode::Begin; } - - return *this; } bool Style::operator==( const Style& rOther) const From d02286e7724304a5931181f3c61aed411cbfeae5 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 16:51:24 +0100 Subject: [PATCH 010/373] sw: unused return Change-Id: I18a5665609b3e15a98bb88e6d307e9f18be967e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176778 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- sw/source/core/table/swtable.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 3a24d194339c..bad44b2b04dc 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -94,7 +94,7 @@ void SwTableBox::setDummyFlag( bool bDummy ) } //JP 15.09.98: Bug 55741 - Keep tabs (front and rear) -static OUString& lcl_TabToBlankAtSttEnd( OUString& rText ) +static void lcl_TabToBlankAtSttEnd( OUString& rText ) { sal_Unicode c; sal_Int32 n; @@ -105,10 +105,9 @@ static OUString& lcl_TabToBlankAtSttEnd( OUString& rText ) for( n = rText.getLength(); n && ' ' >= ( c = rText[--n] ); ) if( '\x9' == c ) rText = rText.replaceAt( n, 1, u" " ); - return rText; } -static OUString& lcl_DelTabsAtSttEnd( OUString& rText ) +static void lcl_DelTabsAtSttEnd( OUString& rText ) { sal_Unicode c; sal_Int32 n; @@ -125,7 +124,6 @@ static OUString& lcl_DelTabsAtSttEnd( OUString& rText ) sBuff.remove( n, 1 ); } rText = sBuff.makeStringAndClear(); - return rText; } void InsTableBox( SwDoc& rDoc, SwTableNode* pTableNd, From 74d46954cd4a1e2377573683c3a2f7f7033ffb5b Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Mon, 18 Nov 2024 06:38:06 +0100 Subject: [PATCH 011/373] tdf#160084 Simplify comparison for basegfx::fTools Change-Id: I6ae56ad61ceec5bc34898befd636a0ceae8266e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176700 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- svx/source/sdr/overlay/overlaytools.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx index 5fe5d20ab784..6642005039eb 100644 --- a/svx/source/sdr/overlay/overlaytools.cxx +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -328,7 +328,7 @@ sal_uInt32 OverlayStaticRectanglePrimitive::getPrimitive2DID() const aPolyPolygon.append(aInnerPolygon); // create fill primitive - if (basegfx::fTools::lessOrEqual(getTransparence(), 0.0)) + if (getTransparence() <= 0.0) { // no transparence aRetval = new PolyPolygonColorPrimitive2D( From 40a1affe63dd1321a423308cce8a407b4972949a Mon Sep 17 00:00:00 2001 From: Dione Maddern Date: Tue, 19 Nov 2024 19:59:28 +0100 Subject: [PATCH 012/373] Update git submodules * Update helpcontent2 from branch 'master' to e9c7414e4fd17c6f2ffbe6208db2c741fe33e803 - tdf#162504 Create help page for Number Format pane Create new page source/text/scalc/sidebar_number_format.xhp to describe the features of the Number Format pane in the Properties sidebar deck. In AllLangHelp_scalc.mk - Add new file source/text/scalc/sidebar_number_format.xhp to repository. In source/text/scalc/01/default_number_formats.xhp - Add variable and section tags so that content can be easily linked and embedded in other pages. - Remove old comments In source/text/shared/01/05020300.xhp - Add variable and section tags so that content can be easily linked and embedded in other pages. - Remove old comments In /home/dione/libreoffice/helpcontent2/source/text/shared/01/sidebar_properties.xhp THIS PAGE IS A WIP AND WILL NOT BE LINKED IN HELP UNTIL IT IS FINISHED - Embed description of the help page for Number Formats - Added index bookmarks (Currently commented out) - Updated application switches to hide the desription of the Paragraph pane for CALC and BASE. Change-Id: I7e1849ddc41cad7fd5d4b6c57e8a03186eb6575f Reviewed-on: https://gerrit.libreoffice.org/c/help/+/176720 Tested-by: Jenkins Tested-by: Olivier Hallot Reviewed-by: Olivier Hallot --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index b3bc6425768d..e9c7414e4fd1 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit b3bc6425768d93d6b9bb7304ed3a0ead4b03e2a7 +Subproject commit e9c7414e4fd17c6f2ffbe6208db2c741fe33e803 From 836d73a65180d89a077e36457f1f3aa1698c2058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 15 Nov 2024 12:30:39 +0000 Subject: [PATCH 013/373] consider VndSunStarExpand an exotic protocol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and generally don't bother with it when fetching data from urls Change-Id: I51a2601c6fb7d6c32f9e2d1286ee0d3b05b370b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176645 Reviewed-by: Michael Stahl Reviewed-by: Caolán McNamara Tested-by: Jenkins --- avmedia/source/viewer/mediawindow_impl.cxx | 13 +++++++------ editeng/source/items/frmitems.cxx | 9 +++++++-- .../source/commonembedding/persistence.cxx | 17 +++++++++++++---- forms/source/component/ImageControl.cxx | 2 +- forms/source/component/clickableimage.cxx | 2 +- sfx2/source/appl/linkmgr2.cxx | 5 ++++- sw/source/filter/html/htmlgrin.cxx | 3 ++- toolkit/source/controls/unocontrols.cxx | 3 ++- tools/source/fsys/urlobj.cxx | 1 + unotools/source/misc/mediadescriptor.cxx | 4 ++++ vcl/source/filter/graphicfilter.cxx | 8 +++++++- 11 files changed, 49 insertions(+), 18 deletions(-) diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 4bada4d23ec1..823152e3b029 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -171,15 +171,16 @@ void MediaWindowImpl::dispose() uno::Reference MediaWindowImpl::createPlayer(const OUString& rURL, const OUString& rReferer, const OUString*) { - uno::Reference xPlayer; - if( rURL.isEmpty() ) - return xPlayer; + return nullptr; if (SvtSecurityOptions::isUntrustedReferer(rReferer)) - { - return xPlayer; - } + return nullptr; + + if (INetURLObject(rURL).IsExoticProtocol()) + return nullptr; + + uno::Reference xPlayer; // currently there isn't anything else, throw any mime type to the media players //if (!pMimeType || *pMimeType == AVMEDIA_MIMETYPE_COMMON) diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 930fdd70f2e2..8b4e10e25c83 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -4739,6 +4739,13 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co return nullptr; } + INetURLObject aGraphicURL( maStrLink ); + if (aGraphicURL.IsExoticProtocol()) + { + SAL_WARN("editeng", "Ignore exotic protocol: " << maStrLink); + return nullptr; + } + // tdf#94088 prepare graphic and state Graphic aGraphic; bool bGraphicLoaded = false; @@ -4759,8 +4766,6 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co // a 'data:' scheme url and try to load that (embedded graphics) if(!bGraphicLoaded) { - INetURLObject aGraphicURL( maStrLink ); - if( INetProtocol::Data == aGraphicURL.GetProtocol() ) { std::unique_ptr const xMemStream(aGraphicURL.getData()); diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 15ad2ea51e89..53c27b3a9ac9 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -403,11 +404,19 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() uno::Sequence< beans::PropertyValue > aArgs( m_aDocMediaDescriptor.getLength() + nLen ); auto pArgs = aArgs.getArray(); - pArgs[0].Name = "URL"; - if(m_aLinkTempFile.is()) - pArgs[0].Value <<= m_aLinkTempFile->getUri(); + OUString sURL; + if (m_aLinkTempFile.is()) + sURL = m_aLinkTempFile->getUri(); else - pArgs[0].Value <<= m_aLinkURL; + sURL = m_aLinkURL; + if (INetURLObject(sURL).IsExoticProtocol()) + { + SAL_WARN("embeddedobj.common", "Ignore exotic protocol: " << pArgs[0].Value); + return nullptr; + } + + pArgs[0].Name = "URL"; + pArgs[0].Value <<= sURL; pArgs[1].Name = "FilterName"; pArgs[1].Value <<= m_aLinkFilterName; diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx index fc879ed06450..d06cd0e82214 100644 --- a/forms/source/component/ImageControl.cxx +++ b/forms/source/component/ImageControl.cxx @@ -401,7 +401,7 @@ bool OImageControlModel::impl_updateStreamForURL_lck( const OUString& _rURL, Val { OUString referer; getPropertyValue(u"Referer"_ustr) >>= referer; - if (SvtSecurityOptions::isUntrustedReferer(referer)) { + if (SvtSecurityOptions::isUntrustedReferer(referer) || INetURLObject(_rURL).IsExoticProtocol()) { return false; } diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index 5c95ef6be5fe..7a6d709241a6 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -736,7 +736,7 @@ namespace frm // the SfxMedium is not allowed to be created with an invalid URL, so we have to check this first INetURLObject aUrl(rURL); - if (INetProtocol::NotValid == aUrl.GetProtocol()) + if (INetProtocol::NotValid == aUrl.GetProtocol() || aUrl.IsExoticProtocol()) // we treat an invalid URL like we would treat no URL return; diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index da2a3cf141f7..8a54ac946945 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -537,8 +537,11 @@ bool LinkManager::GetGraphicFromAny(std::u16string_view rMimeType, sReferer = sh->GetMedium()->GetName(); OUString sURL = rValue.get(); - if (!SvtSecurityOptions::isUntrustedReferer(sReferer)) + if (!SvtSecurityOptions::isUntrustedReferer(sReferer) && + !INetURLObject(sURL).IsExoticProtocol()) + { rGraphic = vcl::graphic::loadFromURL(sURL, pParentWin); + } if (rGraphic.IsNone()) rGraphic.SetDefaultType(); rGraphic.setOriginURL(sURL); diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 9282b7b8c175..be46359ae39f 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -680,7 +680,8 @@ IMAGE_SETEVENT: bool bNeedWidth = (!bPercentWidth && !nWidth) || bRelWidthScale; bool bRelHeightScale = bPercentHeight && nHeight == SwFormatFrameSize::SYNCED; bool bNeedHeight = (!bPercentHeight && !nHeight) || bRelHeightScale; - if ((bNeedWidth || bNeedHeight) && !bFuzzing && allowAccessLink(*m_xDoc)) + if ((bNeedWidth || bNeedHeight) && !bFuzzing && allowAccessLink(*m_xDoc) && + !aGraphicURL.IsExoticProtocol()) { GraphicDescriptor aDescriptor(aGraphicURL); if (aDescriptor.Detect(/*bExtendedInfo=*/true)) diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 2fff360fc88b..ea328276bf3c 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +70,7 @@ css::uno::Reference< css::graphic::XGraphic > ImageHelper::getGraphicFromURL_nothrow( const OUString& _rURL, OUString const & referer ) { uno::Reference< graphic::XGraphic > xGraphic; - if ( _rURL.isEmpty() || SvtSecurityOptions::isUntrustedReferer(referer) ) + if (_rURL.isEmpty() || SvtSecurityOptions::isUntrustedReferer(referer) || INetURLObject(_rURL).IsExoticProtocol()) return xGraphic; try diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 84a89cd32808..d09b0d547d7e 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -4892,6 +4892,7 @@ bool INetURLObject::IsExoticProtocol() const return m_eScheme == INetProtocol::Slot || m_eScheme == INetProtocol::Macro || m_eScheme == INetProtocol::Uno || + m_eScheme == INetProtocol::VndSunStarExpand || isSchemeEqualTo(u"vnd.sun.star.script") || isSchemeEqualTo(u"service"); } diff --git a/unotools/source/misc/mediadescriptor.cxx b/unotools/source/misc/mediadescriptor.cxx index 87dcbab0cbf1..f1f192149086 100644 --- a/unotools/source/misc/mediadescriptor.cxx +++ b/unotools/source/misc/mediadescriptor.cxx @@ -337,6 +337,10 @@ bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, bool bLockFi if (sURL.matchIgnoreAsciiCase(".component:") || sURL.matchIgnoreAsciiCase("private:factory/")) return false; // No UCB content for .component URLs and factory URLs + + if (INetURLObject(sURL).IsExoticProtocol()) + return false; + OUString referer(getUnpackedValueOrDefault(PROP_REFERRER, OUString())); if (SvtSecurityOptions::isUntrustedReferer(referer)) { return false; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index c265c16866af..af9b2b774b4b 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -446,10 +446,16 @@ ErrCode GraphicFilter::CanImportGraphic( std::u16string_view rMainUrl, SvStream& ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath, sal_uInt16 nFormat, sal_uInt16 * pDeterminedFormat, GraphicFilterImportFlags nImportFlags ) { - ErrCode nRetValue = ERRCODE_GRFILTER_FORMATERROR; SAL_WARN_IF( rPath.GetProtocol() == INetProtocol::NotValid, "vcl.filter", "GraphicFilter::ImportGraphic() : ProtType == INetProtocol::NotValid" ); OUString aMainUrl( rPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); + if (rPath.IsExoticProtocol()) + { + SAL_WARN("vcl.filter", "GraphicFilter::ImportGraphic(), ignore exotic protocol: " << aMainUrl); + return ERRCODE_GRFILTER_FORMATERROR; + } + + ErrCode nRetValue = ERRCODE_GRFILTER_FORMATERROR; std::unique_ptr xStream(::utl::UcbStreamHelper::CreateStream( aMainUrl, StreamMode::READ | StreamMode::SHARE_DENYNONE )); if (xStream) { From f6a539cb5fdd487aa90a1ba551e034b4fdecbf2f Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 17:20:49 +0100 Subject: [PATCH 014/373] sfx2: unused returns Change-Id: I0ab14e51d10cf67c956624710d1f82c69662e586 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176784 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sfx2/source/devtools/DocumentModelTreeHandler.cxx | 3 +-- sfx2/source/devtools/ObjectInspectorTreeHandler.cxx | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/sfx2/source/devtools/DocumentModelTreeHandler.cxx b/sfx2/source/devtools/DocumentModelTreeHandler.cxx index a850b78e7ac4..f113ce9f6482 100644 --- a/sfx2/source/devtools/DocumentModelTreeHandler.cxx +++ b/sfx2/source/devtools/DocumentModelTreeHandler.cxx @@ -99,13 +99,12 @@ void lclAppendToParentEntry(const std::unique_ptr& rTree, } // append a root entry to a input TreeView -OUString lclAppend(const std::unique_ptr& rTree, DocumentModelTreeEntry* pEntry) +void lclAppend(const std::unique_ptr& rTree, DocumentModelTreeEntry* pEntry) { OUString sId(weld::toId(pEntry)); OUString const& rString = pEntry->getString(); rTree->insert(nullptr, -1, &rString, &sId, nullptr, nullptr, pEntry->shouldShowExpander(), nullptr); - return sId; } /** Entry that represents a object, which implements a XNameAccess */ diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx index 1457fe1a10d0..fd9f879ab446 100644 --- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx +++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx @@ -349,8 +349,8 @@ public: }; // appends the node to the root of the tree view -OUString lclAppendNode(const std::unique_ptr& pTree, - ObjectInspectorNodeInterface* pEntry) +void lclAppendNode(const std::unique_ptr& pTree, + ObjectInspectorNodeInterface* pEntry) { OUString sName = pEntry->getObjectName(); OUString sId(weld::toId(pEntry)); @@ -363,13 +363,11 @@ OUString lclAppendNode(const std::unique_ptr& pTree, { pTree->set_text(*pCurrent, rPair.second, rPair.first); } - - return sId; } // appends the node to the parent -OUString lclAppendNodeToParent(const std::unique_ptr& pTree, - const weld::TreeIter* pParent, ObjectInspectorNodeInterface* pEntry) +void lclAppendNodeToParent(const std::unique_ptr& pTree, + const weld::TreeIter* pParent, ObjectInspectorNodeInterface* pEntry) { OUString sName = pEntry->getObjectName(); OUString sId(weld::toId(pEntry)); @@ -382,8 +380,6 @@ OUString lclAppendNodeToParent(const std::unique_ptr& pTree, { pTree->set_text(*pCurrent, rPair.second, rPair.first); } - - return sId; } /** Node that represent just a simple string with no children or columns */ From 08c04a589ad87274647e7bdb76957d5285eca116 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 17:39:02 +0100 Subject: [PATCH 015/373] tdf#163486: PVS: variable is used after it was moved Since commit 9fe2ead3d5355224dd94d6462b0ddc6100f6d4e3 Author: Noel Grandin Date: Fri Oct 8 06:43:18 2021 +0200 loplugin:moveparam in svx V1030 The 'aSdrObjects' variable is used after it was moved. Change-Id: I9b426204ff2e2e2d0f6b375e201259765aa12736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176785 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Xisco Fauli --- svx/source/svdraw/svdxcgv.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index ab4fa320275c..78d89e135ac7 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -705,7 +705,8 @@ void SdrExchangeView::DrawMarkedObj(OutputDevice& rOut) const if(!aSdrObjects.empty()) { - sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, std::move(aSdrObjects), aSdrObjects[0]->getSdrPageFromSdrObject()); + SdrPage* pPage = aSdrObjects[0]->getSdrPageFromSdrObject(); + sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, std::move(aSdrObjects), pPage); sdr::contact::DisplayInfo aDisplayInfo; // do processing From 3746195ff989a4596afc456d53010d8860bd7b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 19 Nov 2024 12:51:52 +0000 Subject: [PATCH 016/373] catch invalid ranges at export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit log failure and continue to export the remainder of the document #0 0x0000733dda8ae4a1 in __cxa_throw () from target:/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x0000733dc5d0bd43 in ScCellRangeObj::getCellRangeByPosition (this=0x2a753d60, nLeft=43, nTop=-7, nRight=43, nBottom=-7) at sc/source/ui/unoobj/cellsuno.cxx:4638 #2 0x0000733dc66150d5 in ScTableSheetObj::getCellRangeByPosition (this=0x2a753d60, nLeft=43, nTop=-7, nRight=43, nBottom=-7) at sc/source/ui/unoobj/cellsuno.cxx:6711 #3 0x0000733dc62d3e38 in ScXMLExport::GetMerged (this=0x1fc74160, pCellAddress=, xTable=...) at sc/source/filter/xml/xmlexprt.cxx:2750 #4 0x0000733dc62d7104 in ScXMLExport::AddStyleFromCells (this=0x1fc74160, xProperties=..., xTable=..., nTable=0, pOldName=0x0) at sc/source/filter/xml/xmlexprt.cxx:2156 #5 0x0000733dc62dfebb in ScXMLExport::collectAutoStyles (this=) at sc/source/filter/xml/xmlexprt.cxx:2559 #6 0x0000733dc62d0fff in ScXMLExport::ExportAutoStyles_ (this=0x1fc74160) at sc/source/filter/xml/xmlexprt.cxx:2657 #7 0x0000733dd833a7a4 in SvXMLExport::ImplExportAutoStyles (this=0x1fc74160) at xmloff/source/core/xmlexp.cxx:1123 #8 0x0000733dd833d098 in SvXMLExport::exportDoc (this=0x1fc74160, eClass=) at xmloff/source/core/xmlexp.cxx:1389 #9 0x0000733dd83386f6 in SvXMLExport::filter (this=this@entry=0x1fc74160, aDescriptor=...) at xmloff/source/core/xmlexp.cxx:815 #10 0x0000733dc62e6452 in ScXMLExport::filter (this=0x1fc74160, aDescriptor=...) at sc/source/filter/xml/xmlexprt.cxx:5472 #11 0x0000733dc63204a0 in ScXMLImportWrapper::ExportToComponent (this=0x7ffc11959890, xContext=..., xModel=..., xWriter=..., aDescriptor=..., sName=..., sMediaType=..., sComponentName=..., aArgs=..., pSharedData=...) at sc/source/filter/xml/xmlwrap.cxx:707 #12 0x0000733dc632679a in ScXMLImportWrapper::Export (this=this@entry=0x7ffc11959890, bStylesOnly=bStylesOnly@entry=false) at sc/source/filter/xml/xmlwrap.cxx:943 #13 0x0000733dc6465d5e in ScDocShell::SaveXML (this=0x11d1c440, pSaveMedium=0x138252f0, xStor=...) at sc/source/ui/docshell/docsh.cxx:653 #14 0x0000733dc646a519 in ScDocShell::SaveAs (this=0x11d1c440, rMedium=...) at sc/source/ui/docshell/docsh.cxx:1913 #15 0x0000733dd6ae7432 in SfxObjectShell::SaveAsOwnFormat (this=0x11d1c440, rMedium=...) at sfx2/source/doc/objstor.cxx:3378 #16 0x0000733dd6af0ae6 in SfxObjectShell::SaveTo_Impl (this=0x11d1c440, rMedium=..., pSet=0x7ffc11959fe0) at sfx2/source/doc/objstor.cxx:1520 #17 0x0000733dd6af2f08 in SfxObjectShell::DoSave_Impl (this=0x11d1c440, pArgs=0x7ffc11959fe0) at sfx2/source/doc/objstor.cxx:2760 #18 0x0000733dd6b2b3aa in SfxBaseModel::storeSelf (this=0x5348c30, aSeqArgs=...) at /opt/rh/devtoolset-12/root/usr/include/c++/12/optional:306 #19 0x0000733dd6ab2671 in SfxStoringHelper::GUIStoreModel (this=this@entry=0x2ba275b0, xModel=..., aSlotName=..., aArgsSequence=..., bPreselectPassword=bPreselectPassword@entry=false, nDocumentSignatureState=SignatureState::NOSIGNATURES, bIsAsync=false) perhaps some relation to https://gerrit.libreoffice.org/c/core/+/160363 which is a somewhat similar situation Change-Id: I6b28ef0e9df0f44641fa5c582b5827dbcfb4af8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176765 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176792 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- sc/source/filter/xml/xmlexprt.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 2ca445ba2a1f..0b7646bbc583 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2729,6 +2729,20 @@ void ScXMLExport::CollectInternalShape( uno::Reference< drawing::XShape > const } } +static uno::Reference lclGetSheetRange(const uno::Reference & xTable, sal_Int32 nCol, sal_Int32 nRow) +{ + try + { + return uno::Reference(xTable->getCellRangeByPosition(nCol, nRow, nCol, nRow), uno::UNO_QUERY); + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("sc", "Exception in getCellRangeByPosition, col: " << nCol << ", row: " << nRow); + assert(false && "try and capture this in crashtesting"); + } + return nullptr; +} + bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress, const uno::Reference & xTable) { @@ -2740,7 +2754,7 @@ bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress, bool bRowInc(nEndRow > nRow); while(!bReady && nRow <= nEndRow && nCol <= nEndCol) { - uno::Reference xSheetCellRange(xTable->getCellRangeByPosition(nCol, nRow, nCol, nRow), uno::UNO_QUERY); + uno::Reference xSheetCellRange(lclGetSheetRange(xTable, nCol, nRow)); if (xSheetCellRange.is()) { uno::Reference xCursor(xTable->createCursorByRange(xSheetCellRange)); From c5834bcfacba768fb361ae273534f1eac63f546f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 19 Nov 2024 17:55:08 +0200 Subject: [PATCH 017/373] use default implementation for hasFastDrawTransformedBitmap so only the one that implements it needs to override it Change-Id: I1acffb4796d95d75edc4507f533d9b1f8987972b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176790 Reviewed-by: Noel Grandin Tested-by: Jenkins --- vcl/headless/CairoCommon.cxx | 2 -- vcl/headless/SvpGraphicsBackend.cxx | 5 ----- vcl/inc/headless/CairoCommon.hxx | 1 - vcl/inc/headless/SvpGraphicsBackend.hxx | 2 -- vcl/inc/qt5/QtGraphics.hxx | 2 -- vcl/inc/quartz/salgdi.h | 2 -- vcl/inc/salgdi.hxx | 3 ++- vcl/inc/salgdiimpl.hxx | 3 ++- vcl/qt5/QtGraphics_GDI.cxx | 2 -- vcl/quartz/AquaGraphicsBackend.cxx | 2 -- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 5 ----- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 2 -- 12 files changed, 4 insertions(+), 27 deletions(-) diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index 1550f3cd898f..0cb8ceefdedd 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -1988,8 +1988,6 @@ cairo_surface_t* CairoCommon::createCairoSurface(const BitmapBuffer* pBuffer) return target; } -bool CairoCommon::hasFastDrawTransformedBitmap() { return false; } - bool CairoCommon::supportsOperation(OutDevSupportType eType) { switch (eType) diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index 58a50653a743..c1210be0e557 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -246,11 +246,6 @@ bool SvpGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull, getAntiAlias()); } -bool SvpGraphicsBackend::hasFastDrawTransformedBitmap() const -{ - return CairoCommon::hasFastDrawTransformedBitmap(); -} - bool SvpGraphicsBackend::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) { diff --git a/vcl/inc/headless/CairoCommon.hxx b/vcl/inc/headless/CairoCommon.hxx index a62c2fad73dd..96630f39b681 100644 --- a/vcl/inc/headless/CairoCommon.hxx +++ b/vcl/inc/headless/CairoCommon.hxx @@ -229,7 +229,6 @@ struct VCL_DLLPUBLIC CairoCommon static cairo_surface_t* createCairoSurface(const BitmapBuffer* pBuffer); static bool supportsOperation(OutDevSupportType eType); - static bool hasFastDrawTransformedBitmap(); private: void doXorOnRelease(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop, sal_Int32 nExtentsRight, diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx index 53678d619198..a6f6f843482d 100644 --- a/vcl/inc/headless/SvpGraphicsBackend.hxx +++ b/vcl/inc/headless/SvpGraphicsBackend.hxx @@ -117,8 +117,6 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; - bool hasFastDrawTransformedBitmap() const override; - bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index fea1a2a0de18..eb1a870bb09f 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -146,8 +146,6 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; - bool hasFastDrawTransformedBitmap() const override; - bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) override; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index e0ccbfbb4fd1..40209e97b3ba 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -355,8 +355,6 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; - bool hasFastDrawTransformedBitmap() const override; - bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 5c4356e5bf62..6b2c35a35e36 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -571,7 +571,8 @@ protected: /// (for example, some OutputDevice optimizations could try access the pixels, which /// would make performance worse for GPU-backed backends). /// See also tdf#138068. - virtual bool hasFastDrawTransformedBitmap() const = 0; + /// Only currently true for SkiaSalGraphicsImpl + virtual bool hasFastDrawTransformedBitmap() const { return false; } /** Render solid rectangle with given transparency * diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 56e303b2806e..c79cf7ea14f3 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -206,7 +206,8 @@ public: const SalBitmap* pAlphaBitmap, double fAlpha) = 0; - virtual bool hasFastDrawTransformedBitmap() const = 0; + /// Only currently true for SkiaSalGraphicsImpl + virtual bool hasFastDrawTransformedBitmap() const { return false; } virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index 15a0c64f14bc..fc039c685dc9 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -633,8 +633,6 @@ bool QtGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull, return true; } -bool QtGraphicsBackend::hasFastDrawTransformedBitmap() const { return false; } - bool QtGraphicsBackend::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) { diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index 61a09efebc4f..958ea7fcc6f1 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -1287,8 +1287,6 @@ bool AquaGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull, return true; } -bool AquaGraphicsBackend::hasFastDrawTransformedBitmap() const { return false; } - bool AquaGraphicsBackend::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) { diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index c4cda27cd006..acc9fc295523 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -128,11 +128,6 @@ void X11CairoSalGraphicsImpl::invert(sal_uInt32 nPoints, const Point* pPtAry, Sa mrCairoCommon.invert(nPoints, pPtAry, nFlags, getAntiAlias()); } -bool X11CairoSalGraphicsImpl::hasFastDrawTransformedBitmap() const -{ - return CairoCommon::hasFastDrawTransformedBitmap(); -} - bool X11CairoSalGraphicsImpl::supportsOperation(OutDevSupportType eType) const { return CairoCommon::supportsOperation(eType); diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index f6a9b2e83ab0..f0376e3b0068 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -164,8 +164,6 @@ public: bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize) override; - bool hasFastDrawTransformedBitmap() const override; - /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */ bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX, const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, From 657873772c2ab37eca2558950c3515458c21f2c5 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 19 Nov 2024 17:20:11 +0100 Subject: [PATCH 018/373] gtk3 a11y: Simplify gtk3/gtk4 version check One gtk3-specific section is sufficient. Change-Id: I42a5cd1b94df7874665743a386af8e2e19590b0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176786 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/unx/gtk3/gtkinst.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index c3205805cada..f7c220273417 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -18839,11 +18839,9 @@ public: virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() override { -#if !GTK_CHECK_VERSION(4, 0, 0) - AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget); -#endif gint x(0), y(0); #if !GTK_CHECK_VERSION(4, 0, 0) + AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget); if (pAtkObject && ATK_IS_COMPONENT(pAtkObject)) atk_component_get_extents(ATK_COMPONENT(pAtkObject), &x, &y, nullptr, nullptr, ATK_XY_SCREEN); #endif From 357f040d36c4bdebb59c9ada1a2ee20423ca2155 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 19 Nov 2024 17:27:20 +0100 Subject: [PATCH 019/373] tdf#155449 gtk3 a11y: Hold reference to the original AtkObject Let the AtkObjectWrapper hold a reference to the original AtkObject, and release it in `atk_object_wrapper_finalize`. Without this, the original AtkObject might get destroyed too early. Then trying to access it would result in a crash. While occasionally also seen elsewhere, this was somewhat more reliably reproducible when starting the Orca screen reader or a pyatspi event listener script while the spell check dialog in Writer was shown. Backtrace of how the AtkObject got destroyed (reverse-debugged with rr with a data breakpoint on the AtkObject's accessible description): 1 _int_free_create_chunk malloc.c 4738 0x7fe5766a858e 2 _int_free_merge_chunk malloc.c 4700 0x7fe5766a99b8 3 _int_free malloc.c 4646 0x7fe5766a9d31 4 __GI___libc_free malloc.c 3398 0x7fe5766ac4ff 5 atk_object_finalize atkobject.c 1399 0x7fe5626a7785 6 g_object_unref 0x7fe56e9b94ee 7 expiry_func accessible-leasing.c 122 0x7fe5624f32b1 8 ?? 0x7fe568f0f88e 9 ?? 0x7fe568f0c7df 10 ?? 0x7fe568f0ea17 11 g_main_context_iteration 0x7fe568f0f180 12 GtkSalData::Yield gtkdata.cxx 405 0x7fe5634766ec 13 GtkInstance::DoYield gtkinst.cxx 425 0x7fe56347b493 14 ImplYield svapp.cxx 385 0x7fe56db0e106 15 Application::Yield svapp.cxx 473 0x7fe56db0da9f 16 Application::Execute svapp.cxx 360 0x7fe56db0d880 17 desktop::Desktop::Main app.cxx 1679 0x7fe576926d8b 18 ImplSVMain svmain.cxx 228 0x7fe56db2e996 19 SVMain svmain.cxx 246 0x7fe56db30589 20 soffice_main sofficemain.cxx 121 0x7fe5769a08da 21 sal_main main.c 51 0x5644db935a6d 22 main main.c 49 0x5644db935a47 Backtrace of the crash when using the already deleted object later: 1 g_type_check_instance_cast 0x7fe56e9d9337 2 atk_object_get_index_in_parent atkobject.c 1007 0x7fe5626a5ae5 3 wrapper_get_index_in_parent atkwrapper.cxx 545 0x7fe56344a244 4 atk_object_get_index_in_parent atkobject.c 1011 0x7fe5626a5b3c 5 append_cache_item cache-adaptor.c 183 0x7fe562500591 6 append_accessible_hf cache-adaptor.c 246 0x7fe56250029b 7 g_hash_table_foreach 0x7fe568efacd3 8 spi_cache_foreach accessible-cache.c 423 0x7fe5624f33f9 9 impl_GetItems cache-adaptor.c 328 0x7fe562500174 10 handle_other droute.c 558 0x7fe56250f8a4 11 handle_message droute.c 605 0x7fe56250e7d6 12 ?? 0x7fe5764f5e64 13 dbus_connection_dispatch 0x7fe5764e58ab 14 message_queue_dispatch atspi-gmain.c 89 0x7fe5623abc52 15 ?? 0x7fe568f0c7df 16 ?? 0x7fe568f0ea17 17 g_main_context_iteration 0x7fe568f0f180 18 GtkSalData::Yield gtkdata.cxx 405 0x7fe5634766ec 19 GtkInstance::DoYield gtkinst.cxx 425 0x7fe56347b493 20 ImplYield svapp.cxx 385 0x7fe56db0e106 21 Application::Yield svapp.cxx 473 0x7fe56db0da9f 22 Application::Execute svapp.cxx 360 0x7fe56db0d880 23 desktop::Desktop::Main app.cxx 1679 0x7fe576926d8b 24 ImplSVMain svmain.cxx 228 0x7fe56db2e996 25 SVMain svmain.cxx 246 0x7fe56db30589 26 soffice_main sofficemain.cxx 121 0x7fe5769a08da 27 sal_main main.c 51 0x5644db935a6d 28 main main.c 49 0x5644db935a47 The deleted object is the `AtkObject *accessible` param passed to `atk_object_get_index_in_parent`. This is with at-spi2-core git main as of commit 422cac4bd657ce783164324e6ae4b3d54a8aa761. Change-Id: I23d8a3d55bd587aa99316d71524a18afcd6c0479 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176787 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/unx/gtk3/a11y/atkwrapper.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx index 4cff5dd6c176..6c71c40d0ed3 100644 --- a/vcl/unx/gtk3/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx @@ -674,6 +674,9 @@ atk_object_wrapper_finalize (GObject *obj) atk_object_wrapper_dispose( pWrap ); + if (pWrap->mpOrig) + g_object_unref(pWrap->mpOrig); + parent_class->finalize( obj ); } @@ -969,6 +972,8 @@ atk_object_wrapper_new( const css::uno::Reference< css::accessibility::XAccessib pWrap->mpContext = xContext; pWrap->mpOrig = orig; + if (pWrap->mpOrig) + g_object_ref(pWrap->mpOrig); AtkObject* atk_obj = ATK_OBJECT(pWrap); atk_obj->role = mapToAtkRole(xContext->getAccessibleRole(), xContext->getAccessibleStateSet()); From b5c5b51e7561624f46c34ec1c1b024269b92739b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 19 Nov 2024 08:47:00 +0000 Subject: [PATCH 020/373] use TOOLS_WARN_EXCEPTION to get exception details MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I68f45585878b323e44ce9ca2d660c72ebb7be174 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176791 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- oox/source/core/xmlfilterbase.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 2f5c7a84d72a..38a51cc4b2d4 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -420,8 +421,7 @@ bool XmlFilterBase::importFragment( const rtl::Reference& rxHan } catch( Exception& ) { - OSL_FAIL( OStringBuffer( "XmlFilterBase::importFragment - XML parser failed in fragment '" + - OUStringToOString( aFragmentPath, RTL_TEXTENCODING_ASCII_US ) + "'" ).getStr() ); + TOOLS_WARN_EXCEPTION("oox", "XmlFilterBase::importFragment - XML parser failed in fragment '" << aFragmentPath << "'" ); } } catch( Exception& ) From 6c6e4358ae14328e1dd4bab7cdd8e9019187429c Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 19 Nov 2024 08:44:12 +0100 Subject: [PATCH 021/373] desktop: fix crash in forceSetClipboardForCurrentView() Crashreport signature: > Fatal signal received: SIGSEGV code: 1 for address: 0x0 > program/libmergedlo.so > (anonymous namespace)::forceSetClipboardForCurrentView(_LibreOfficeKitDocument*) > desktop/source/lib/init.cxx:1376 (discriminator 6) > program/libmergedlo.so > rtl::Reference::~Reference() > include/rtl/ref.hxx:128 > program/libmergedlo.so > com::sun::star::uno::Reference::~Reference() > include/com/sun/star/uno/Reference.hxx:113 Sounds like an attempted document load that failed, but we still try to set the clipboard for the first view during shutdown. Change-Id: I21e5742ae4fcd4b24daf2888f3d64aae437d4fda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176812 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- desktop/source/lib/init.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7de039d56e58..006910049f7d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1357,6 +1357,10 @@ rtl::Reference forceSetClipboardForCurrentView(LibreOfficeKitDocum { ITiledRenderable* pDoc = getTiledRenderable(pThis); rtl::Reference xClip(LOKClipboardFactory::getClipboardForCurView()); + if (!pDoc) + { + return xClip; + } SAL_INFO("lok", "Set to clipboard for view " << xClip.get()); // FIXME: using a hammer here - should not be necessary if all tests used createView. From d248d8f5271c380e51af9482b6724d471e2cb929 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 20 Nov 2024 09:15:07 +0100 Subject: [PATCH 022/373] CppunitTest_sw_tiledrendering2: try to make this more stable This fails from time to time, see for a case. When it fails, we get no status callback at all, while the interesting failure is when we get a status callback, but it's wrong. Just give up in the rare case when we get no status callback to avoid false alarms for now. Change-Id: I8f971b64db878d207f9fd2e4fffc4d4b9a4a14e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176818 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/qa/extras/tiledrendering2/tiledrendering2.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sw/qa/extras/tiledrendering2/tiledrendering2.cxx b/sw/qa/extras/tiledrendering2/tiledrendering2.cxx index 42f769ed1a17..45254de62e64 100644 --- a/sw/qa/extras/tiledrendering2/tiledrendering2.cxx +++ b/sw/qa/extras/tiledrendering2/tiledrendering2.cxx @@ -208,6 +208,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testStatusBarPageNumber) // Then make sure the page number in view 2 is correct: CPPUNIT_ASSERT_EQUAL(static_cast(1), aView2.m_aStateChanges.size()); + // FIXME this should not happen, but it does from time to time. + if (!aView2.m_aStateChanges.empty()) + { + return; + } // Without the accompanying fix in place, this test would have failed with: // - Expected: .uno:StatePageNumber=Page 2 of 2 // - Actual : .uno:StatePageNumber=Page 1 of 2 From fd4498d62c9c317ea9d3a53e335033cf85ab2d02 Mon Sep 17 00:00:00 2001 From: Alain Romedenne Date: Wed, 20 Nov 2024 11:04:37 +0100 Subject: [PATCH 023/373] Update git submodules * Update helpcontent2 from branch 'master' to aa2f1c2c7172ad20c607734c8c11057ee717599a - New arguments in ScriptForge.Exception.PythonShell() method Change-Id: Iceb8b2480055e912eb712ff1eb7d842be440f6ba Reviewed-on: https://gerrit.libreoffice.org/c/help/+/176712 Tested-by: Jenkins Reviewed-by: Alain Romedenne --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index e9c7414e4fd1..aa2f1c2c7172 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit e9c7414e4fd17c6f2ffbe6208db2c741fe33e803 +Subproject commit aa2f1c2c7172ad20c607734c8c11057ee717599a From b4bd177f841db980754e233f7996c1a855647ed4 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 20 Nov 2024 09:26:02 +0100 Subject: [PATCH 024/373] update language-subtag-registry to 2024-11-19 How the file was created: mkdir data cd data wget https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry cd .. tar cvjf language-subtag-registry-2024-11-19.tar.bz2 data/language-subtag-registry Change-Id: I1ae31648771642592f8ce5c201ded8fd84eef8c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176821 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- download.lst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download.lst b/download.lst index cd0d4612d049..6f0eee4f66b5 100644 --- a/download.lst +++ b/download.lst @@ -394,8 +394,8 @@ LIBJPEG_TURBO_TARBALL := libjpeg-turbo-2.1.5.1.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -LANGTAGREG_SHA256SUM := 75bc394dd83ddfd62b172a462db1b66bdb5950f40823ed63b8c7db6b71e37e75 -LANGTAGREG_TARBALL := language-subtag-registry-2024-06-14.tar.bz2 +LANGTAGREG_SHA256SUM := 121f27bd1fabac9a74fb042cf68396b6df74cdf5d1ccc30f4c9b78584cc13864 +LANGTAGREG_TARBALL := language-subtag-registry-2024-11-19.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts From cb610c0200152ea2d62152a3e6f5e003e246bd21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kay=20=C5=9Eat=C4=B1r?= Date: Thu, 3 Oct 2024 12:12:27 +0300 Subject: [PATCH 025/373] cool#7406: Refactor Calc->getPartInfo & use JsonWriter. Indeed this seems unrelated to the task. But grid in Impress requires to add new properties to "getPartInfo (impress)". When i checked the code, i saw that we use getPartInfo's result (on server side) like it's a text instead of JSON. So we'll refactor that part. Touching that part requires also touching some other shared functions on COOL side. And those changes also required adding new props here. We have been fetching this data (without adding new properties) one by one. We now will be able to fetch the whole part's data at once. This commit also uses JsonWriter class. Change-Id: Icc26ae71c668c391218e2d517259e1ef32a0832f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176815 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sc/source/ui/unoobj/docuno.cxx | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index e1a4fdb9ec14..81e6e039e3f7 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -649,16 +649,25 @@ OUString ScModelObj::getPartInfo( int nPart ) const bool bIsSelected = false; //pViewData->GetDocument()->IsSelected(nPart); const bool bIsRTLLayout = pViewData->GetDocument().IsLayoutRTL(nPart); - OUString aPartInfo = "{ \"visible\": \"" + - OUString::number(static_cast(bIsVisible)) + - "\", \"selected\": \"" + - OUString::number(static_cast(bIsSelected)) + - "\", \"rtllayout\": \"" + - OUString::number(static_cast(bIsRTLLayout)) + - "\", \"protected\": \"" + - OUString::number(static_cast(bIsProtected)) + - "\" }"; - return aPartInfo; + ::tools::JsonWriter jsonWriter; + jsonWriter.put("visible", static_cast(bIsVisible)); + jsonWriter.put("rtllayout", static_cast(bIsRTLLayout)); + jsonWriter.put("protected", static_cast(bIsProtected)); + jsonWriter.put("selected", static_cast(bIsSelected)); + + OUString tabName; + pViewData->GetDocument().GetName(nPart, tabName); + jsonWriter.put("name", tabName); + + sal_Int64 hashCode; + pViewData->GetDocument().GetHashCode(nPart, hashCode); + jsonWriter.put("hash", hashCode); + + Size lastColRow = getDataArea(nPart); + jsonWriter.put("lastcolumn", lastColRow.getWidth()); + jsonWriter.put("lastrow", lastColRow.getHeight()); + + return OStringToOUString(jsonWriter.finishAndGetAsOString(), RTL_TEXTENCODING_UTF8); } OUString ScModelObj::getPartName( int nPart ) From 5e3a88a283bbbe772703e099adcd70baf7ad3e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 5 Nov 2024 14:55:33 +0000 Subject: [PATCH 026/373] switching PageKind without switching EditMode retains current page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit i.e. ChangeEditMode doesn't do anything if the EditMode is unchanged but the PageKind was switched from Notes to Standard. So the same page of the other mode is still selected. An explicit SwitchPage is required to change the page from the other mode. This results in the reported mode of "2", but rendering actually still rendering as if in "mode 0", so a request to render a 'standard' page returns an image of the currently still-selected 'notes' page, which confusingly can be cached and not shown until served as a reply to a later request of the 'standard' page. See DrawViewShell::ReadFrameViewData and other places for more of this pattern. Change-Id: Ie8aa8f93f45189fd6f9c37c4077fa2b547ca4815 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176084 Reviewed-by: Miklos Vajna Reviewed-by: Gökay ŞATIR Tested-by: Jenkins CollaboraOffice (cherry picked from commit 95e9c210ef8380b0909c6ba596e3023bafef4083) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176824 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- desktop/source/lib/init.cxx | 1 + sd/source/ui/unoidl/unomodel.cxx | 2 ++ sd/source/ui/view/ViewShellBase.cxx | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 006910049f7d..e4c1c15aed12 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4331,6 +4331,7 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis, // TODO: we could be clever and e.g. set to 0 when we change to/from // embedded object mode, and not when changing between slide/notes/combined // modes? + // TODO: Also now see ViewShellBase::setEditMode for a similar case if ( nCurrentPart < pDoc->getParts() ) { pDoc->setPart( nCurrentPart ); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 347fc52f1e1f..182988f1d62b 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3874,6 +3874,8 @@ void SdXImpressDocument::setPartMode( int nPartMode ) break; } pViewSh->SetPageKind( aPageKind ); + //TODO do the same as setEditMode and then can probably remove the TODOs + //from doc_setPartMode } int SdXImpressDocument::getEditMode() diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 9b9c2be46db6..15f1a51f1e8b 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -1033,6 +1033,10 @@ void ViewShellBase::setEditMode(int nMode) if (DrawViewShell* pDrawViewShell = dynamic_cast(pViewShell)) { + EditMode eOrigEditMode = pDrawViewShell->GetEditMode(); + PageKind eOrigPageKind = pDrawViewShell->GetPageKind(); + sal_uInt16 nSelectedPage = pDrawViewShell->GetCurPagePos(); + switch ( nMode ) { case 0: @@ -1048,6 +1052,19 @@ void ViewShellBase::setEditMode(int nMode) pDrawViewShell->ChangeEditMode(EditMode::Page, false); break; } + + /* + If the EditMode is unchanged, then ChangeEditMode was typically a + no-op, and an additional explicit SwitchPage is required to reselect + the equivalent page from the other mode, otherwise a switch from + e.g. Notes to Standard will still render the still selected Note + page. + */ + if (eOrigEditMode == pDrawViewShell->GetEditMode() && + eOrigPageKind != pDrawViewShell->GetPageKind()) + { + pDrawViewShell->SwitchPage(nSelectedPage); + } } } From 57d123745a6e07da2a9893540e42b72e55641a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20=C3=87i=C3=A7ek?= Date: Wed, 30 Oct 2024 16:29:16 +0300 Subject: [PATCH 027/373] sc: autofill: send to-be-deleted cell addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with LOK_CALLBACK_TOOLTIP also avoid nullptr ViewShells: - if (comphelper::LibreOfficeKit::isActive()) + if (ScTabViewShell* pLOKViewShell + = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr) Signed-off-by: Bayram Çiçek Change-Id: I38578297cc1aadefe8c43033cdb14b9460e22c90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175827 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara (cherry picked from commit 459a9401f342210d7f6ab8fe6fa780ae28413ef6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176825 Tested-by: Jenkins --- sc/source/ui/view/tabview4.cxx | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index 2352f732befd..082c275fe113 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -288,7 +288,26 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) aHelpStr = aHelpStr.replaceFirst("%2", OUString::number(nCols) ); } else if ( aViewData.GetDelMark( aDelRange ) ) + { aHelpStr = ScResId( STR_QUICKHELP_DELETE ); + + if (ScTabViewShell* pLOKViewShell + = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr) + { + // autofill: collect the cell addresses that will be deleted + OUString sDeleteCellAddress + = OUString::Concat(OUString::number(aDelRange.aStart.Row()) + " " + + OUString::number(aDelRange.aStart.Col()) + " " + + OUString::number(aDelRange.aEnd.Row()) + " " + + OUString::number(aDelRange.aEnd.Col())); + + tools::JsonWriter writer; + writer.put("type", "autofilldeletecells"); + writer.put("delrange", sDeleteCellAddress); + OString sPayloadString = writer.finishAndGetAsOString(); + pLOKViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); + } + } else if ( nEndX != aMarkRange.aEnd.Col() || nEndY != aMarkRange.aEnd.Row() ) aHelpStr = rDoc.GetAutoFillPreview( aMarkRange, nEndX, nEndY ); @@ -313,7 +332,8 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) sTipString = aHelpStr; sTopParent = pWin; - if (comphelper::LibreOfficeKit::isActive()) + if (ScTabViewShell* pLOKViewShell + = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr) { // we need to use nAddX and nAddX here because we need the next row&column address OUString sCol = OUString::number(nEndX + nAddX); @@ -327,8 +347,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) writer.put("text", sTipString); writer.put("celladdress", sCellAddress); OString sPayloadString = writer.finishAndGetAsOString(); - ScTabViewShell* pViewShell = aViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); + pLOKViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); } } } From 343232190f1bafd608c574ac85ec27b4f404b79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 4 Nov 2024 16:46:21 +0000 Subject: [PATCH 028/373] use bNewFontLists of true to refetch new font lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit which becomes more obviously required since: commit d85cb3832286ae1fdcf4a8494abb8212f21e4e9a CommitDate: Fri Feb 2 22:47:28 2024 +0100 preload: open and close empty documents of main types in preinit. because since then SdModule has called GetVirtualRefDevice to create the long-life virtual device that is used to set the lists of available fonts before "addfonts" has been called to add extra fonts to the kit so impress/draw remains unaware of any changes there. It was actually "true" here before: commit ab612633003c75dfb30664db8cc8924c086a91ee CommitDate: Wed Apr 13 20:09:54 2022 +0200 Follow-up fix to Collabora Online "addfont" handling: avoid assertion failure but its uncertain what assertion is referred to here, perhaps the same assertion as later fixed by: commit d1ed24ba34d422128fd48184dbc3b344b5922d3a CommitDate: Wed Oct 2 16:19:47 2024 +0200 Get SolarMutex before calling ImplClearAllFontData Change-Id: Ibc81191ba3b88d9b4def90b6d9662a83295ec9cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176032 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176823 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- desktop/source/lib/init.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e4c1c15aed12..d6f209c2f1b8 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5279,9 +5279,9 @@ static void lo_setOption(LibreOfficeKit* /*pThis*/, const char *pOption, const c SolarMutexGuard aGuard; OutputDevice *pDevice = Application::GetDefaultDevice(); - OutputDevice::ImplClearAllFontData(false); + OutputDevice::ImplClearAllFontData(true); pDevice->AddTempDevFont(sMagicFileName, u""_ustr); - OutputDevice::ImplRefreshAllFontData(false); + OutputDevice::ImplRefreshAllFontData(true); } #endif } From a560f22c79c18df57b2e905fb7ff01e6ee2b5593 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 20 Nov 2024 08:38:28 +0100 Subject: [PATCH 029/373] gtk: Let GetCommandForItem return OString instead of char* This simplifies memory management, as it removes the need to manually free the memory using `g_free` again. Change-Id: I71f8e6a8df46c0090f2f003d3f443500028b1f83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176813 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/unx/gtk3/gtksalmenu.cxx | 46 +++++++++++++++---------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index a95d80a8c0ed..e187cbe40212 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -28,15 +28,15 @@ static bool bUnityMode = false; /* * This function generates a unique command name for each menu item */ -static gchar* GetCommandForItem(GtkSalMenu* pParentMenu, sal_uInt16 nItemId) +static OString GetCommandForItem(GtkSalMenu* pParentMenu, sal_uInt16 nItemId) { OString aCommand = "window-" + OString::number(reinterpret_cast(pParentMenu)) + "-" + OString::number(nItemId); - return g_strdup(aCommand.getStr()); + return aCommand; } -static gchar* GetCommandForItem(GtkSalMenuItem* pSalMenuItem) +static OString GetCommandForItem(GtkSalMenuItem* pSalMenuItem) { return GetCommandForItem(pSalMenuItem->mpParentMenu, pSalMenuItem->mnId); @@ -297,20 +297,20 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries) pOldCommandList = g_list_append( pOldCommandList, aCurrentCommand ); // Get the new command for the item. - gchar* aNativeCommand = GetCommandForItem(pSalMenuItem); + OString sNativeCommand = GetCommandForItem(pSalMenuItem); // Force updating of native menu labels. - if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == nullptr ) + if (!sNativeCommand.isEmpty() && pSalMenuItem->mpSubMenu == nullptr) { NativeSetItemText( nSection, nItemPos, aText, false ); NativeSetItemIcon( nSection, nItemPos, aImage ); NativeSetAccelerator(nSection, nItemPos, nAccelKey, nAccelKey.GetName()); - NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, false ); + NativeSetItemCommand(nSection, nItemPos, nId, sNativeCommand.getStr(), itemBits, bChecked, false); NativeCheckItem( nSection, nItemPos, itemBits, bChecked ); - NativeSetEnableItem( aNativeCommand, bEnabled ); + NativeSetEnableItem(sNativeCommand.getStr(), bEnabled); - pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) ); + pNewCommandList = g_list_append(pNewCommandList, g_strdup(sNativeCommand.getStr())); } else { @@ -323,8 +323,8 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries) if ( pSubmenu && pSubmenu->GetMenu() ) { - bool bNonMenuChangedToMenu = NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, false, true ); - pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) ); + bool bNonMenuChangedToMenu = NativeSetItemCommand(nSection, nItemPos, nId, sNativeCommand.getStr(), itemBits, false, true); + pNewCommandList = g_list_append(pNewCommandList, g_strdup(sNativeCommand.getStr())); GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos ); @@ -347,8 +347,6 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries) g_object_unref( pSubMenuModel ); } - g_free( aNativeCommand ); - ++nItemPos; ++validItems; } @@ -380,13 +378,12 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries) } if (!nItemsCount) { - gchar* aNativeCommand = GetCommandForItem(this, 0xFFFF); + OString sNativeCommand = GetCommandForItem(this, 0xFFFF); OUString aPlaceholderText(VclResId(SV_RESID_STRING_NOSELECTIONPOSSIBLE)); g_lo_menu_insert_in_section(pLOMenu, nSection-1, 0, OUStringToOString(aPlaceholderText, RTL_TEXTENCODING_UTF8).getStr()); - NativeSetItemCommand(nSection-1, 0, 0xFFFF, aNativeCommand, MenuItemBits::NONE, false, false); - NativeSetEnableItem(aNativeCommand, false); - g_free(aNativeCommand); + NativeSetItemCommand(nSection - 1, 0, 0xFFFF, sNativeCommand.getStr(), MenuItemBits::NONE, false, false); + NativeSetEnableItem(sNativeCommand.getStr(), false); } } @@ -689,9 +686,8 @@ void GtkSalMenu::RemoveItem( unsigned nPos ) if (mpActionGroup) { GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP(mpActionGroup); - gchar* pCommand = GetCommandForItem(maItems[nPos]); - g_lo_action_group_remove(pActionGroup, pCommand); - g_free(pCommand); + OString sCommand = GetCommandForItem(maItems[nPos]); + g_lo_action_group_remove(pActionGroup, sCommand.getStr()); } maItems.erase( maItems.begin() + nPos ); @@ -1574,9 +1570,8 @@ void GtkSalMenu::EnableItem( unsigned nPos, bool bEnable ) SolarMutexGuard aGuard; if ( bUnityMode && !mbInActivateCallback && !mbNeedsUpdate && GetTopLevel()->mbMenuBar && ( nPos < maItems.size() ) ) { - gchar* pCommand = GetCommandForItem( GetItemAtPos( nPos ) ); - NativeSetEnableItem( pCommand, bEnable ); - g_free( pCommand ); + OString sCommand = GetCommandForItem(GetItemAtPos(nPos)); + NativeSetEnableItem(sCommand.getStr(), bEnable); } } @@ -1597,7 +1592,7 @@ void GtkSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OU if ( !bUnityMode || mbInActivateCallback || mbNeedsUpdate || !GetTopLevel()->mbMenuBar || ( nPos >= maItems.size() ) ) return; - gchar* pCommand = GetCommandForItem( static_cast< GtkSalMenuItem* >( pSalMenuItem ) ); + OString sCommand = GetCommandForItem(static_cast(pSalMenuItem)); gint nSectionsCount = g_menu_model_get_n_items( mpMenuModel ); for ( gint nSection = 0; nSection < nSectionsCount; ++nSection ) @@ -1607,19 +1602,16 @@ void GtkSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OU { gchar* pCommandFromModel = g_lo_menu_get_command_from_item_in_section( G_LO_MENU( mpMenuModel ), nSection, nItem ); - if ( !g_strcmp0( pCommandFromModel, pCommand ) ) + if (pCommandFromModel == sCommand) { NativeSetItemText( nSection, nItem, rText ); g_free( pCommandFromModel ); - g_free( pCommand ); return; } g_free( pCommandFromModel ); } } - - g_free( pCommand ); } void GtkSalMenu::SetItemImage( unsigned, SalMenuItem*, const Image& ) From bf0c4166478c6e124bb4969e16444c8f478b8989 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 20 Nov 2024 08:44:32 +0100 Subject: [PATCH 030/373] gtk: Switch param from const char* to const OString& Change-Id: Ie92591770a2828a5f828d76d8c1bf7e5a253c3de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176814 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/unx/gtk/gtksalmenu.hxx | 2 +- vcl/unx/gtk3/gtksalmenu.cxx | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index 1a152a7142e1..eadb096e0c1e 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -103,7 +103,7 @@ public: MenuItemBits nBits, bool bChecked, bool bIsSubmenu ); - void NativeSetEnableItem( gchar const * aCommand, gboolean bEnable ); + void NativeSetEnableItem(const OString& sCommand, gboolean bEnable); void NativeCheckItem( unsigned nSection, unsigned nItemPos, MenuItemBits bits, gboolean bCheck ); void NativeSetAccelerator( unsigned nSection, unsigned nItemPos, const vcl::KeyCode& rKeyCode, std::u16string_view rKeyName ); diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index e187cbe40212..efe4da3dde44 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -308,7 +308,7 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries) NativeSetAccelerator(nSection, nItemPos, nAccelKey, nAccelKey.GetName()); NativeSetItemCommand(nSection, nItemPos, nId, sNativeCommand.getStr(), itemBits, bChecked, false); NativeCheckItem( nSection, nItemPos, itemBits, bChecked ); - NativeSetEnableItem(sNativeCommand.getStr(), bEnabled); + NativeSetEnableItem(sNativeCommand, bEnabled); pNewCommandList = g_list_append(pNewCommandList, g_strdup(sNativeCommand.getStr())); } @@ -383,7 +383,7 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries) g_lo_menu_insert_in_section(pLOMenu, nSection-1, 0, OUStringToOString(aPlaceholderText, RTL_TEXTENCODING_UTF8).getStr()); NativeSetItemCommand(nSection - 1, 0, 0xFFFF, sNativeCommand.getStr(), MenuItemBits::NONE, false, false); - NativeSetEnableItem(sNativeCommand.getStr(), false); + NativeSetEnableItem(sNativeCommand, false); } } @@ -1227,13 +1227,13 @@ void GtkSalMenu::NativeCheckItem( unsigned nSection, unsigned nItemPos, MenuItem g_free( aCommand ); } -void GtkSalMenu::NativeSetEnableItem( gchar const * aCommand, gboolean bEnable ) +void GtkSalMenu::NativeSetEnableItem(const OString& sCommand, gboolean bEnable) { SolarMutexGuard aGuard; GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( mpActionGroup ); - if ( g_action_group_get_action_enabled( G_ACTION_GROUP( pActionGroup ), aCommand ) != bEnable ) - g_lo_action_group_set_action_enabled( pActionGroup, aCommand, bEnable ); + if (g_action_group_get_action_enabled(G_ACTION_GROUP(pActionGroup), sCommand.getStr()) != bEnable) + g_lo_action_group_set_action_enabled(pActionGroup, sCommand.getStr(), bEnable); } void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString& rText, bool bFireEvent ) @@ -1571,7 +1571,7 @@ void GtkSalMenu::EnableItem( unsigned nPos, bool bEnable ) if ( bUnityMode && !mbInActivateCallback && !mbNeedsUpdate && GetTopLevel()->mbMenuBar && ( nPos < maItems.size() ) ) { OString sCommand = GetCommandForItem(GetItemAtPos(nPos)); - NativeSetEnableItem(sCommand.getStr(), bEnable); + NativeSetEnableItem(sCommand, bEnable); } } From db7152d2cabcfb0279cf3bd6947c321a6cb9448d Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Fri, 18 Oct 2024 06:38:35 +0200 Subject: [PATCH 031/373] tdf#163486: PVS: Identical branches Change-Id: Ibd3f95a7af4df51aee5fd1974914aa808dded229 V1037: Two or more case-branches perform the same actions. Check lines: 666, 688. Similar cases are grouped closer. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175051 Reviewed-by: David Gilbert Tested-by: Jenkins --- connectivity/source/drivers/file/FStatement.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index fca2c963eb33..ee260fdb33e5 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -659,14 +659,6 @@ void OStatement_Base::SetAssignValue(const OUString& aColumnName, { switch (::comphelper::getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { - // put criteria depending on the Type as String or double in the variable - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::LONGVARCHAR: - *(*m_aAssignValues)[nId] = ORowSetValue(aValue); - //Characterset is already converted, since the entire statement was converted - break; - case DataType::BIT: if (aValue.equalsIgnoreAsciiCase("TRUE") || aValue[0] == '1') *(*m_aAssignValues)[nId] = true; @@ -675,6 +667,10 @@ void OStatement_Base::SetAssignValue(const OUString& aColumnName, else throwFunctionSequenceException(*this); break; + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + //Characterset is already converted, since the entire statement was converted case DataType::TINYINT: case DataType::SMALLINT: case DataType::INTEGER: From 1a949fceae16913b29efae713b5890398c69ffac Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 19 Oct 2024 19:04:04 +0200 Subject: [PATCH 032/373] tdf#163486: PVS: Identical branches V1037 Two or more case-branches perform the same actions. Check lines: 1209, 1218 Change-Id: I9f2fe51a0b7d4514ff6a82d24be940ed50d39e81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175221 Tested-by: Jenkins Reviewed-by: David Gilbert --- starmath/source/mathtype.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 4289a9691975..d84a11e52ceb 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -1180,20 +1180,20 @@ bool MathType::HandleRecords(int nLevel, sal_uInt8 nSelector, break; case tmUARROW: if (nVariation == 0) - rRet.append(" widevec ");//left below + rRet.append(" widevec ");//left below - missing functionality else if (nVariation == 1) - rRet.append(" widevec ");//right below + rRet.append(" widevec ");//right below - missing functionality else if (nVariation == 2) - rRet.append(" widevec ");//double headed below + rRet.append(" widevec ");//double headed below - missing functionality rRet.append(" {"); break; case tmOARROW: if (nVariation == 0) - rRet.append(" widevec ");//left above + rRet.append(" widevec ");//left above - missing functionality else if (nVariation == 1) rRet.append(" widevec ");//right above else if (nVariation == 2) - rRet.append(" widevec ");//double headed above + rRet.append(" widevec ");//double headed above - missing functionality rRet.append(" {"); break; default: From ff4baa0770832cb7ffaac121dccd796669f7776c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 20 Nov 2024 14:05:23 +0100 Subject: [PATCH 033/373] Use notifyEach ...as had already been done prior to 8122c82d90117fc0c4c8ea87aa7f771d5e92bf36 "osl::Mutex->std::mutex in SfxGlobalEvents_Impl" Change-Id: Ia74c07a3458d7a5af428b68d1728cc9e51aa42a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176853 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- sfx2/source/notify/globalevents.cxx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx index 525a547f82b0..bf440b5ce215 100644 --- a/sfx2/source/notify/globalevents.cxx +++ b/sfx2/source/notify/globalevents.cxx @@ -481,18 +481,10 @@ void SfxGlobalEvents_Impl::implts_notifyListener(const document::DocumentEvent& std::unique_lock g(m_aLock); document::EventObject aLegacyEvent(aEvent.Source, aEvent.EventName); - m_aLegacyListeners.forEach(g, - [&aLegacyEvent](const css::uno::Reference& xListener) - { - xListener->notifyEvent(aLegacyEvent); - } - ); - m_aDocumentListeners.forEach(g, - [&aEvent](const css::uno::Reference& xListener) - { - xListener->documentEventOccured(aEvent); - } - ); + m_aLegacyListeners.notifyEach(g, + &document::XEventListener::notifyEvent, aLegacyEvent); + m_aDocumentListeners.notifyEach(g, + &document::XDocumentEventListener::documentEventOccured, aEvent); } From 278a05e0b627cc7d8abb47facb9d1289b006bdf4 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 20 Nov 2024 14:59:11 +0100 Subject: [PATCH 034/373] WARN about swallowed exceptions Change-Id: I2d6aef0dfa8bd8c002fd172b13363e629bc9cc3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176851 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sfx2/source/doc/sfxbasemodel.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 92a34e9fb8d8..7ecfd1d9a60c 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3324,6 +3324,7 @@ public: catch( RuntimeException& ) { // this exception is ignored to avoid problems with invalid listeners, the listener should be probably thrown away in future + TOOLS_WARN_EXCEPTION("sfx.appl", "ignoring"); } } }; From c635271eb17e3b9d50223356dbc09b771fcd643f Mon Sep 17 00:00:00 2001 From: "Armin Le Grand (Collabora)" Date: Tue, 19 Nov 2024 20:34:05 +0100 Subject: [PATCH 035/373] tdf#163428 CairoSDPR: Fix regression in freeing unified buffers I had added BufferedData_ModifiedBitmapEx for CairoSDPR (but not only) to allow Bitmaps modualted by BColorModifierStack to be buffered in the standard way and at the original Bitmap. This nicely can still hold the system-dependent form of the Bitmap to be used at the Bitmap of that buffered modified Bitmap. This uses something I was not aware of: One Buffer implementation may - as in this case - use another buffer. That may lead to the second buffer being deleted/freed when the first one gets freed - by timer or directly - what is wanted. This *needs* the methods inside SystemDependentDataBuffer to do the actual potential destruction of the Object outside the Mutex-Locked parts of the code, else this might lead to a deadlock. It is good to have found this, there may be other such combinations in the future: That the implementation of a buffer using that standard mechanism uses another class that may also be buffered. I have now made sure that buffered objects get deleted *outside* the Mutex-Locked areas. This is better anyways, the destruction does not need that lock - it is just needed so secure the manipulation of the local unordered_map that organizes the buffered elements globally. Change-Id: Ie2f346a3f1a24105b89310ace3ff7a41472143c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176795 Tested-by: Jenkins Reviewed-by: Armin Le Grand Reviewed-by: Moritz Duge --- vcl/source/app/svdata.cxx | 76 ++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index fa80f3dbf127..98cd3c6da16f 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -140,13 +140,26 @@ namespace void endUsage(basegfx::SystemDependentData_SharedPtr& rData) override { - std::unique_lock aGuard(m_aMutex); - EntryMap::iterator aFound(maEntries.find(rData)); + // tdf#163428 prepare space for entry to hold to avoid early deletion + basegfx::SystemDependentData_SharedPtr aToBeDeletedEntry; - if(aFound != maEntries.end()) { - maEntries.erase(aFound); + // lock m_aMutex in own scope + std::unique_lock aGuard(m_aMutex); + EntryMap::iterator aFound(maEntries.find(rData)); + + if(aFound != maEntries.end()) + { + // tdf#163428 ensure to hold/not delete entry while m_aMutex is locked + aToBeDeletedEntry = aFound->first; + + // remove from list + maEntries.erase(aFound); + } } + + // tdf#163428 aToBeDeletedEntry will be destucted, thus the + // entry referenmced by SharedPtr may be deleted now } void touchUsage(basegfx::SystemDependentData_SharedPtr& rData) override @@ -176,24 +189,55 @@ namespace IMPL_LINK_NOARG(SystemDependentDataBuffer, implTimeoutHdl, Timer *, void) { - std::unique_lock aGuard(m_aMutex); - EntryMap::iterator aIter(maEntries.begin()); + // tdf#163428 prepare a temporary list for SystemDependentData_SharedPtr + // entries that need to be removed from the unordered_map, but do not need + // locking m_aMutex + ::std::vector aToBeDeletedEntries; - while(aIter != maEntries.end()) { - if(aIter->second) + // lock m_aMutex in own scope + std::unique_lock aGuard(m_aMutex); + EntryMap::iterator aIter(maEntries.begin()); + + while(aIter != maEntries.end()) { - aIter->second--; - ++aIter; - } - else - { - aIter = maEntries.erase(aIter); + if(aIter->second) + { + aIter->second--; + ++aIter; + } + else + { + // tdf#163428 Do not potentially directly delete SystemDependentData_SharedPtr + // entries in the unordered_map (maEntries). That can/would happen when the shared_ptr + // has only one reference left. This can cause problems, e.g. we have + // BufferedData_ModifiedBitmapEx which can contain a Bitmap with added + // DataBuffers itself, thus deleting this here *directly* would trigger e.g. + // endUsage above. That would then block when we would still hold m_aMutex. + // This can potentially be the case with other derivations of + // basegfx::SystemDependentData, too. + // To avoid this, protect the part that needs protection by the m_aMutex, that + // is the modification of the unordered_map itself. Cleaning up the list entries can be + // done after this, without holding the lock. + // Thus, remember the SystemDependentData_SharedPtr in a temporary list by adding + // a reference/shared_ptr to it to guarantee it gets not deleted when it gets removed + // from the unordered_map. + // Anyways, only locking while manipulating the list is better, destruction of + // objects may be expensive and hold m_aMutex longer than necessary. + aToBeDeletedEntries.push_back(aIter->first); + + // remove from list. This decrements the shared_ptr, but delete is avoided + aIter = maEntries.erase(aIter); + } } + + if (maEntries.empty()) + maTimer->Stop(); } - if (maEntries.empty()) - maTimer->Stop(); + // tdf#163428 here aToBeDeletedEntries will be destroyed, the entries will be + // decremented and potentially deleted. These are of type SystemDependentData_SharedPtr, + // so we do not need to do anything explicitely here } } From f40dc496a511ae06a308dd0859bc3aad28a8ec7e Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Thu, 7 Nov 2024 16:12:56 +0100 Subject: [PATCH 036/373] Resolves tdf#163856 - Disentangle boundaries options * Boundary toggles removed from app colors * Object boundaries completely removed (color replaced with DOCBOUNDARIES; Impress placeholder on/off now an expert option) * Toggle options added under formatting aids * Individual UNO commands marked deprecated * New command added to show all boundaries * Frames follow sections now in state and color * Kind of wrapping doesn't matter anmymore Change-Id: I7bbec20831dcb95abef6523884d84b05a1a7df0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176242 Tested-by: Jenkins Reviewed-by: Rafael Lima --- cui/source/options/optcolor.cxx | 9 +- cui/uiconfig/ui/colorconfigwin.ui | 151 +-------- include/svtools/colorcfg.hxx | 1 - .../data/org/openoffice/Office/UI.xcu | 17 - .../openoffice/Office/UI/WriterCommands.xcu | 20 +- .../schema/org/openoffice/Office/Impress.xcs | 7 + .../schema/org/openoffice/Office/UI.xcs | 34 -- .../schema/org/openoffice/Office/Writer.xcs | 33 +- sd/source/ui/dlg/headerfooterdlg.cxx | 2 +- sd/source/ui/view/sdview.cxx | 312 +++++++++--------- .../ui/notebookbar_groupedbar_compact.ui | 9 +- .../ui/notebookbar_groupedbar_compact.ui | 9 +- svtools/source/config/colorcfg.cxx | 8 +- .../contact/viewobjectcontactofpageobj.cxx | 2 +- .../primitive2d/sdrolecontentprimitive2d.cxx | 2 +- svx/source/svdraw/svdoole2.cxx | 2 +- sw/inc/cmdid.h | 2 + sw/inc/viewopt.hxx | 49 +-- sw/qa/uitest/options/tdf78133.py | 8 +- sw/sdi/_viewsh.sdi | 6 + sw/sdi/swriter.sdi | 34 +- sw/source/core/layout/paintfrm.cxx | 88 ++--- sw/source/ui/config/optpage.cxx | 30 ++ sw/source/uibase/config/cfgitems.cxx | 12 + sw/source/uibase/config/usrpref.cxx | 20 +- sw/source/uibase/config/viewopt.cxx | 32 +- sw/source/uibase/inc/cfgitems.hxx | 4 + sw/source/uibase/inc/optpage.hxx | 6 + sw/source/uibase/uiview/view0.cxx | 30 +- sw/source/uibase/uno/unomod.cxx | 8 +- sw/uiconfig/sglobal/menubar/menubar.xml | 3 +- sw/uiconfig/sweb/menubar/menubar.xml | 2 +- sw/uiconfig/swform/menubar/menubar.xml | 3 +- sw/uiconfig/swreport/menubar/menubar.xml | 3 +- sw/uiconfig/swriter/menubar/menubar.xml | 4 +- sw/uiconfig/swriter/ui/notebookbar.ui | 16 +- sw/uiconfig/swriter/ui/notebookbar_compact.ui | 16 +- .../ui/notebookbar_groupedbar_compact.ui | 32 +- .../swriter/ui/notebookbar_groupedbar_full.ui | 32 +- sw/uiconfig/swriter/ui/optformataidspage.ui | 108 ++++-- sw/uiconfig/swxform/menubar/menubar.xml | 3 +- 41 files changed, 515 insertions(+), 654 deletions(-) diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index e9ef0c7800aa..67cb2462b0d2 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -108,10 +108,9 @@ const vEntryInfo[] = // The list of these entries (enum ColorConfigEntry) are in colorcfg.hxx. { Group_General, IDS(doccolor), std::u16string_view(u"/DocColor") }, - { Group_General, IDS_CB(docboundaries), std::u16string_view(u"/DocBoundaries") }, + { Group_General, IDS(docboundaries), std::u16string_view(u"/DocBoundaries") }, { Group_General, IDS(appback), std::u16string_view(u"/AppBackground") }, - { Group_General, IDS_CB(objboundaries), std::u16string_view(u"/ObjectBoundaries") }, - { Group_General, IDS_CB(tblboundaries), std::u16string_view(u"/TableBoundaries") }, + { Group_General, IDS(tblboundaries), std::u16string_view(u"/TableBoundaries") }, { Group_General, IDS(font), std::u16string_view(u"/FontColor") }, { Group_General, IDS_CB(unvisitedlinks), std::u16string_view(u"/Links") }, { Group_General, IDS_CB(visitedlinks), std::u16string_view(u"/LinksVisited") }, @@ -125,7 +124,7 @@ const vEntryInfo[] = { Group_Writer, IDS_CB(index), std::u16string_view(u"/WriterIdxShadings") }, { Group_Writer, IDS(direct), std::u16string_view(u"/WriterDirectCursor") }, { Group_Writer, IDS(script), std::u16string_view(u"/WriterScriptIndicator") }, - { Group_Writer, IDS_CB(section), std::u16string_view(u"/WriterSectionBoundaries") }, + { Group_Writer, IDS(section), std::u16string_view(u"/WriterSectionBoundaries") }, { Group_Writer, IDS(hdft), std::u16string_view(u"/WriterHeaderFooterMark") }, { Group_Writer, IDS(pagebreak), std::u16string_view(u"/WriterPageBreaks") }, { Group_Writer, IDS(nonprintchars), std::u16string_view(u"/WriterNonPrintChars") }, @@ -485,7 +484,7 @@ void ColorConfigWindow_Impl::CreateEntries() // get it to align its contents with that of a CheckBox { OUString sSampleText(u"XXXXXX"_ustr); - std::unique_ptr xCheckBox(m_xBuilder->weld_check_button(u"docboundaries"_ustr)); + std::unique_ptr xCheckBox(m_xBuilder->weld_check_button(u"unvisitedlinks"_ustr)); std::unique_ptr xFixedText(m_xBuilder->weld_label(u"doccolor"_ustr)); OUString sOrigCheck(xCheckBox->get_label()); OUString sOrigFixed(xFixedText->get_label()); diff --git a/cui/uiconfig/ui/colorconfigwin.ui b/cui/uiconfig/ui/colorconfigwin.ui index 91243182fdb6..5baa136e7757 100644 --- a/cui/uiconfig/ui/colorconfigwin.ui +++ b/cui/uiconfig/ui/colorconfigwin.ui @@ -18,7 +18,7 @@ 0 none - + True False @@ -50,7 +50,6 @@ True 0 True - @@ -61,14 +60,12 @@ - + Text boundaries True True - False start center - True @@ -86,7 +83,6 @@ end 0 True - @@ -127,7 +123,6 @@ end 0 True - @@ -138,65 +133,19 @@ - - Object boundaries - True - True - False - start - center - True - - - - - - 0 - 3 - - - - - True - True - False - end - 0 - True - - - - - - - - - - Object boundaries color - - - - - 1 - 3 - - - - + Table boundaries True True - False start center - True 0 - 4 + 3 @@ -207,7 +156,6 @@ end 0 True - @@ -222,7 +170,7 @@ 1 - 4 + 3 @@ -237,7 +185,7 @@ 0 - 5 + 4 @@ -248,14 +196,13 @@ end 0 True - 1 - 5 + 4 @@ -273,7 +220,7 @@ 0 - 6 + 5 @@ -284,7 +231,6 @@ end 0 True - @@ -299,7 +245,7 @@ 1 - 6 + 5 @@ -317,7 +263,7 @@ 0 - 7 + 6 @@ -328,7 +274,6 @@ end 0 True - @@ -343,7 +288,7 @@ 1 - 7 + 6 @@ -358,7 +303,7 @@ 0 - 8 + 7 @@ -369,14 +314,13 @@ end 0 True - 1 - 8 + 7 @@ -391,7 +335,7 @@ 0 - 9 + 8 @@ -402,14 +346,13 @@ end 0 True - 1 - 9 + 8 @@ -427,7 +370,7 @@ 0 - 10 + 9 @@ -438,7 +381,6 @@ end 0 True - @@ -453,7 +395,7 @@ 1 - 10 + 9 @@ -514,7 +456,6 @@ True 0 True - @@ -550,7 +491,6 @@ end 0 True - @@ -594,7 +534,6 @@ end 0 True - @@ -635,7 +574,6 @@ end 0 True - @@ -646,14 +584,12 @@ - + Section boundaries True True - False start center - True @@ -671,7 +607,6 @@ end 0 True - @@ -712,7 +647,6 @@ end 0 True - @@ -745,7 +679,6 @@ end 0 True - @@ -778,7 +711,6 @@ end 0 True - @@ -811,7 +743,6 @@ end 0 True - @@ -844,7 +775,6 @@ end 0 True - @@ -912,7 +842,6 @@ True 0 True - @@ -945,7 +874,6 @@ end 0 True - @@ -978,7 +906,6 @@ end 0 True - @@ -1011,7 +938,6 @@ end 0 True - @@ -1044,7 +970,6 @@ end 0 True - @@ -1062,7 +987,6 @@ end 0 True - @@ -1095,7 +1019,6 @@ end 0 True - @@ -1128,7 +1051,6 @@ end 0 True - @@ -1161,7 +1083,6 @@ end 0 True - @@ -1194,7 +1115,6 @@ end 0 True - @@ -1227,7 +1147,6 @@ end 0 True - @@ -1260,7 +1179,6 @@ end 0 True - @@ -1311,7 +1229,6 @@ end 0 True - @@ -1355,7 +1272,6 @@ end 0 True - @@ -1381,7 +1297,6 @@ end 0 True - @@ -1435,7 +1350,6 @@ True 0 True - @@ -1493,7 +1407,6 @@ True 0 True - @@ -1576,7 +1489,6 @@ True 0 True - @@ -1610,7 +1522,6 @@ True 0 True - @@ -1644,7 +1555,6 @@ True 0 True - @@ -1678,7 +1588,6 @@ True 0 True - @@ -1712,7 +1621,6 @@ True 0 True - @@ -1746,7 +1654,6 @@ True 0 True - @@ -1780,7 +1687,6 @@ True 0 True - @@ -1814,7 +1720,6 @@ True 0 True - @@ -1848,7 +1753,6 @@ True 0 True - @@ -1901,7 +1805,6 @@ True 0 True - @@ -1934,7 +1837,6 @@ end 0 True - @@ -1967,7 +1869,6 @@ end 0 True - @@ -2000,7 +1901,6 @@ end 0 True - @@ -2033,7 +1933,6 @@ end 0 True - @@ -2066,7 +1965,6 @@ end 0 True - @@ -2099,7 +1997,6 @@ end 0 True - @@ -2132,7 +2029,6 @@ end 0 True - @@ -2200,7 +2096,6 @@ True 0 True - @@ -2233,7 +2128,6 @@ end 0 True - @@ -2266,7 +2160,6 @@ end 0 True - @@ -2299,7 +2192,6 @@ end 0 True - @@ -2332,7 +2224,6 @@ end 0 True - @@ -2365,7 +2256,6 @@ end 0 True - @@ -2398,7 +2288,6 @@ end 0 True - @@ -2466,7 +2355,6 @@ True 0 True - @@ -2514,7 +2402,6 @@ end 0 True - @@ -2547,7 +2434,6 @@ end 0 True - @@ -2580,7 +2466,6 @@ end 0 True - diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx index 6cc4483cd40d..5e4e774826d7 100644 --- a/include/svtools/colorcfg.hxx +++ b/include/svtools/colorcfg.hxx @@ -32,7 +32,6 @@ enum ColorConfigEntry : int DOCCOLOR , DOCBOUNDARIES , APPBACKGROUND , - OBJECTBOUNDARIES , TABLEBOUNDARIES , FONTCOLOR , LINKS , diff --git a/officecfg/registry/data/org/openoffice/Office/UI.xcu b/officecfg/registry/data/org/openoffice/Office/UI.xcu index 942d15fe1f9e..f4e82ec18ecc 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI.xcu @@ -145,9 +145,6 @@ - - true - @@ -157,18 +154,7 @@ - - - true - - - - - - - true - @@ -252,9 +238,6 @@ - - true - diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index d75dd6c83946..b92f978d5c09 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -3010,7 +3010,7 @@ - Te~xt Boundaries + Te~xt Boundaries (deprecated) 1 @@ -3018,7 +3018,7 @@ - Sec~tion Boundaries + Sec~tion Boundaries (deprecated) 1 @@ -3186,7 +3186,21 @@ - Table Boundaries + Table Boundaries (deprecated) + + + 1 + + + + + Show Boundaries + + + Boundaries + + + Show boundaries for all types depending on settings at formatting aids. 1 diff --git a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs index 001ee08d2a64..c4de6da82393 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs @@ -577,6 +577,13 @@ false + + + Indicates whether placeholder get a virtual frame. + + + true + diff --git a/officecfg/registry/schema/org/openoffice/Office/UI.xcs b/officecfg/registry/schema/org/openoffice/Office/UI.xcs index dfe27c0d4a73..afb965c541cb 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI.xcs @@ -55,12 +55,6 @@ Specifies the settings for the documents boundaries. - - - Specifies the visibility of anchors (true = visible). - - true - Specifies the color used for of the document boundaries. @@ -77,32 +71,10 @@ - - - Specifies the settings for object boundaries. - - - - Specifies the visibility of object boundaries (true = visible). - - true - - - - Specifies the color used for object boundaries. - - - Specifies the settings for table boundaries. - - - Specifies the visibility of table boundaries (true = visible). - - true - Specifies the color used for table boundaries. @@ -269,12 +241,6 @@ Specifies the settings for section boundaries in Writer. - - - Specifies the visibility of section boundaries (true = visible). - - true - Specifies the color used for section boundaries. diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs index d1cd0b52d309..1ca15926fec9 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -901,13 +901,44 @@ 1 - + + + Shows text boundaries, if enabled. + + + true + + + Shows text boundaries as full frame (true) or crop marks (false), if enabled. false + + + + Shows section boundaries, if enabled. + + + true + + + + + Shows table boundaries, if enabled. + + + true + + + + Toggle all boundaries on/off. + + + false + diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 440664ae1176..c2936d014faa 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -689,7 +689,7 @@ void PresLayoutPreview::Paint(vcl::RenderContext& rRenderContext, SdrTextObj con // determine line color svtools::ColorConfig aColorConfig; - svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( bVisible ? svtools::FONTCOLOR : svtools::OBJECTBOUNDARIES ) ); + svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( bVisible ? svtools::FONTCOLOR : svtools::DOCBOUNDARIES ) ); // paint at OutDev rRenderContext.SetLineColor(aColor.nColor); diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 4087b209db2e..189d3050bbf8 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -255,188 +256,187 @@ void ViewRedirector::createRedirectedPrimitive2DSequence( bCreateOutline = true; } } + if (bCreateOutline) + bCreateOutline = officecfg::Office::Impress::Misc::TextObject::ShowBoundary::get(); if(bCreateOutline) { // empty presentation objects get a gray frame const svtools::ColorConfig aColorConfig; - const svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::OBJECTBOUNDARIES ) ); + const svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::DOCBOUNDARIES ) ); - if( aColor.bIsVisible ) + // get basic object transformation + const basegfx::BColor aRGBColor(aColor.nColor.getBColor()); + basegfx::B2DHomMatrix aObjectMatrix; + basegfx::B2DPolyPolygon aObjectPolyPolygon; + pObject->TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); + + // create dashed border { - // get basic object transformation - const basegfx::BColor aRGBColor(aColor.nColor.getBColor()); - basegfx::B2DHomMatrix aObjectMatrix; - basegfx::B2DPolyPolygon aObjectPolyPolygon; - pObject->TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); + // create object polygon + basegfx::B2DPolygon aPolygon(basegfx::utils::createUnitPolygon()); + aPolygon.transform(aObjectMatrix); - // create dashed border + // create line and stroke attribute + ::std::vector< double > aDotDashArray { 160.0, 80.0 }; + + const double fFullDotDashLen(::std::accumulate(aDotDashArray.begin(), aDotDashArray.end(), 0.0)); + const drawinglayer::attribute::LineAttribute aLine(aRGBColor); + drawinglayer::attribute::StrokeAttribute aStroke(std::move(aDotDashArray), fFullDotDashLen); + + // create primitive and add + const drawinglayer::primitive2d::Primitive2DReference xRef(new drawinglayer::primitive2d::PolygonStrokePrimitive2D( + std::move(aPolygon), + aLine, + std::move(aStroke))); + rVisitor.visit(xRef); + } + + // now paint the placeholder description, but only when masterpage + // is displayed as page directly (MasterPage view) + if(!bSubContentProcessing && bIsMasterPageObject) + { + OUString aObjectString; + + switch( eKind ) { - // create object polygon - basegfx::B2DPolygon aPolygon(basegfx::utils::createUnitPolygon()); - aPolygon.transform(aObjectMatrix); + case PresObjKind::Title: + { + if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PageKind::Standard) + { + static OUString aTitleAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_TITLE)); + aObjectString = aTitleAreaStr; + } - // create line and stroke attribute - ::std::vector< double > aDotDashArray { 160.0, 80.0 }; - - const double fFullDotDashLen(::std::accumulate(aDotDashArray.begin(), aDotDashArray.end(), 0.0)); - const drawinglayer::attribute::LineAttribute aLine(aRGBColor); - drawinglayer::attribute::StrokeAttribute aStroke(std::move(aDotDashArray), fFullDotDashLen); - - // create primitive and add - const drawinglayer::primitive2d::Primitive2DReference xRef(new drawinglayer::primitive2d::PolygonStrokePrimitive2D( - std::move(aPolygon), - aLine, - std::move(aStroke))); - rVisitor.visit(xRef); + break; + } + case PresObjKind::Outline: + { + static OUString aOutlineAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_OUTLINE)); + aObjectString = aOutlineAreaStr; + break; + } + case PresObjKind::Footer: + { + static OUString aFooterAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_FOOTER)); + aObjectString = aFooterAreaStr; + break; + } + case PresObjKind::Header: + { + static OUString aHeaderAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_HEADER)); + aObjectString = aHeaderAreaStr; + break; + } + case PresObjKind::DateTime: + { + static OUString aDateTimeStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_DATETIME)); + aObjectString = aDateTimeStr; + break; + } + case PresObjKind::Notes: + { + static OUString aDateTimeStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_NOTES)); + aObjectString = aDateTimeStr; + break; + } + case PresObjKind::SlideNumber: + { + if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PageKind::Standard) + { + static OUString aSlideAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_SLIDE)); + aObjectString = aSlideAreaStr; + } + else + { + static OUString aNumberAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_NUMBER)); + aObjectString = aNumberAreaStr; + } + break; + } + default: + { + break; + } } - // now paint the placeholder description, but only when masterpage - // is displayed as page directly (MasterPage view) - if(!bSubContentProcessing && bIsMasterPageObject) + if( !aObjectString.isEmpty() ) { - OUString aObjectString; + // decompose object matrix to be able to place text correctly + basegfx::B2DTuple aScale; + basegfx::B2DTuple aTranslate; + double fRotate, fShearX; + aObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX); - switch( eKind ) - { - case PresObjKind::Title: - { - if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PageKind::Standard) - { - static OUString aTitleAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_TITLE)); - aObjectString = aTitleAreaStr; - } + // create font + SdrTextObj* pTextObj = DynCastSdrTextObj( pObject ); + const SdrTextVertAdjust eTVA(pTextObj ? pTextObj->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER); + vcl::Font aScaledVclFont; - break; - } - case PresObjKind::Outline: - { - static OUString aOutlineAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_OUTLINE)); - aObjectString = aOutlineAreaStr; - break; - } - case PresObjKind::Footer: - { - static OUString aFooterAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_FOOTER)); - aObjectString = aFooterAreaStr; - break; - } - case PresObjKind::Header: - { - static OUString aHeaderAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_HEADER)); - aObjectString = aHeaderAreaStr; - break; - } - case PresObjKind::DateTime: - { - static OUString aDateTimeStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_DATETIME)); - aObjectString = aDateTimeStr; - break; - } - case PresObjKind::Notes: - { - static OUString aDateTimeStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_NOTES)); - aObjectString = aDateTimeStr; - break; - } - case PresObjKind::SlideNumber: - { - if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PageKind::Standard) - { - static OUString aSlideAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_SLIDE)); - aObjectString = aSlideAreaStr; - } - else - { - static OUString aNumberAreaStr(SdResId(STR_PLACEHOLDER_DESCRIPTION_NUMBER)); - aObjectString = aNumberAreaStr; - } - break; - } - default: - { - break; - } - } + // use a text size factor to get more reliable text sizes from the text layouter + // (and from vcl), tipp from HDU + static const sal_uInt32 nTextSizeFactor(100); - if( !aObjectString.isEmpty() ) - { - // decompose object matrix to be able to place text correctly - basegfx::B2DTuple aScale; - basegfx::B2DTuple aTranslate; - double fRotate, fShearX; - aObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX); + // use a factor to get more linear text size calculations + aScaledVclFont.SetFontHeight( 500 * nTextSizeFactor ); - // create font - SdrTextObj* pTextObj = DynCastSdrTextObj( pObject ); - const SdrTextVertAdjust eTVA(pTextObj ? pTextObj->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER); - vcl::Font aScaledVclFont; + // get basic geometry and get text size + drawinglayer::primitive2d::TextLayouterDevice aTextLayouter; + aTextLayouter.setFont(aScaledVclFont); + const sal_Int32 nTextLength(aObjectString.getLength()); - // use a text size factor to get more reliable text sizes from the text layouter - // (and from vcl), tipp from HDU - static const sal_uInt32 nTextSizeFactor(100); + // do not forget to use the factor again to get the width for the 500 + const double fTextWidth(aTextLayouter.getTextWidth(aObjectString, 0, nTextLength) * (1.0 / nTextSizeFactor)); + const double fTextHeight(aTextLayouter.getTextHeight() * (1.0 / nTextSizeFactor)); - // use a factor to get more linear text size calculations - aScaledVclFont.SetFontHeight( 500 * nTextSizeFactor ); + // calculate text primitive position. If text is at bottom, use top for + // the extra text and vice versa + const double fHorDist(125); + const double fVerDist(125); + const double fPosX((aTranslate.getX() + aScale.getX()) - fTextWidth - fHorDist); + const double fPosY((SDRTEXTVERTADJUST_BOTTOM == eTVA) + ? aTranslate.getY() - fVerDist + fTextHeight + : (aTranslate.getY() + aScale.getY()) - fVerDist); - // get basic geometry and get text size - drawinglayer::primitive2d::TextLayouterDevice aTextLayouter; - aTextLayouter.setFont(aScaledVclFont); - const sal_Int32 nTextLength(aObjectString.getLength()); + // get font attributes; use normally scaled font + vcl::Font aVclFont; + basegfx::B2DVector aTextSizeAttribute; - // do not forget to use the factor again to get the width for the 500 - const double fTextWidth(aTextLayouter.getTextWidth(aObjectString, 0, nTextLength) * (1.0 / nTextSizeFactor)); - const double fTextHeight(aTextLayouter.getTextHeight() * (1.0 / nTextSizeFactor)); + aVclFont.SetFontHeight( 500 ); - // calculate text primitive position. If text is at bottom, use top for - // the extra text and vice versa - const double fHorDist(125); - const double fVerDist(125); - const double fPosX((aTranslate.getX() + aScale.getX()) - fTextWidth - fHorDist); - const double fPosY((SDRTEXTVERTADJUST_BOTTOM == eTVA) - ? aTranslate.getY() - fVerDist + fTextHeight - : (aTranslate.getY() + aScale.getY()) - fVerDist); + drawinglayer::attribute::FontAttribute aFontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( + aTextSizeAttribute, + aVclFont, + false, + false)); - // get font attributes; use normally scaled font - vcl::Font aVclFont; - basegfx::B2DVector aTextSizeAttribute; + // fill text matrix + const basegfx::B2DHomMatrix aTextMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( + aTextSizeAttribute.getX(), aTextSizeAttribute.getY(), + fShearX, + fRotate, + fPosX, fPosY)); - aVclFont.SetFontHeight( 500 ); + // create DXTextArray (can be empty one) + ::std::vector< double > aDXArray{}; - drawinglayer::attribute::FontAttribute aFontAttribute( - drawinglayer::primitive2d::getFontAttributeFromVclFont( - aTextSizeAttribute, - aVclFont, - false, - false)); + // create locale; this may need some more information in the future + css::lang::Locale aLocale; - // fill text matrix - const basegfx::B2DHomMatrix aTextMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( - aTextSizeAttribute.getX(), aTextSizeAttribute.getY(), - fShearX, - fRotate, - fPosX, fPosY)); - - // create DXTextArray (can be empty one) - ::std::vector< double > aDXArray{}; - - // create locale; this may need some more information in the future - css::lang::Locale aLocale; - - // create primitive and add - const drawinglayer::primitive2d::Primitive2DReference xRef( - new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( - aTextMatrix, - aObjectString, - 0, - nTextLength, - std::move(aDXArray), - {}, - std::move(aFontAttribute), - std::move(aLocale), - aRGBColor)); - rVisitor.visit(xRef); - } + // create primitive and add + const drawinglayer::primitive2d::Primitive2DReference xRef( + new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aTextMatrix, + aObjectString, + 0, + nTextLength, + std::move(aDXArray), + {}, + std::move(aFontAttribute), + std::move(aLocale), + aRGBColor)); + rVisitor.visit(xRef); } } } diff --git a/sd/uiconfig/sdraw/ui/notebookbar_groupedbar_compact.ui b/sd/uiconfig/sdraw/ui/notebookbar_groupedbar_compact.ui index 2c98c6214e1d..99cd512de694 100644 --- a/sd/uiconfig/sdraw/ui/notebookbar_groupedbar_compact.ui +++ b/sd/uiconfig/sdraw/ui/notebookbar_groupedbar_compact.ui @@ -1257,14 +1257,7 @@ True False - .uno:ViewBounds - - - - - True - False - .uno:TableBoundaries + .uno:ShowBoundaries diff --git a/sd/uiconfig/simpress/ui/notebookbar_groupedbar_compact.ui b/sd/uiconfig/simpress/ui/notebookbar_groupedbar_compact.ui index 4f91bf2a2790..c854c27e1c82 100644 --- a/sd/uiconfig/simpress/ui/notebookbar_groupedbar_compact.ui +++ b/sd/uiconfig/simpress/ui/notebookbar_groupedbar_compact.ui @@ -1237,14 +1237,7 @@ True False - .uno:ViewBounds - - - - - True - False - .uno:TableBoundaries + .uno:ShowBoundaries diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index c75c8986130d..1065f3fbf876 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -113,10 +113,9 @@ uno::Sequence< OUString> GetPropertyNames(std::u16string_view rScheme) static const ColorConfigEntryData_Impl cNames[] = { { std::u16string_view(u"/DocColor") ,false }, - { std::u16string_view(u"/DocBoundaries") ,true }, + { std::u16string_view(u"/DocBoundaries") ,false }, { std::u16string_view(u"/AppBackground") ,false }, - { std::u16string_view(u"/ObjectBoundaries"),true }, - { std::u16string_view(u"/TableBoundaries") ,true }, + { std::u16string_view(u"/TableBoundaries") ,false }, { std::u16string_view(u"/FontColor") ,false }, { std::u16string_view(u"/Links") ,true }, { std::u16string_view(u"/LinksVisited") ,true }, @@ -129,7 +128,7 @@ uno::Sequence< OUString> GetPropertyNames(std::u16string_view rScheme) { std::u16string_view(u"/WriterIdxShadings") ,true }, { std::u16string_view(u"/WriterDirectCursor") ,true }, { std::u16string_view(u"/WriterScriptIndicator") ,false }, - { std::u16string_view(u"/WriterSectionBoundaries") ,true }, + { std::u16string_view(u"/WriterSectionBoundaries") ,false }, { std::u16string_view(u"/WriterHeaderFooterMark") ,false }, { std::u16string_view(u"/WriterPageBreaks") ,false }, { std::u16string_view(u"/WriterNonPrintChars") ,false }, @@ -549,7 +548,6 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, int nMod) { COL_WHITE, Color(0x1C1C1C) }, // DOCCOLOR { COL_LIGHTGRAY, Color(0x808080) }, // DOCBOUNDARIES { Color(0xDFDFDE), Color(0x333333) }, // APPBACKGROUND - { COL_LIGHTGRAY, Color(0x808080) }, // OBJECTBOUNDARIES { COL_LIGHTGRAY, Color(0x808080) }, // TABLEBOUNDARIES { COL_BLACK, COL_BLACK }, // FONTCOLOR { COL_BLUE, Color(0x1D99F3) }, // LINKS diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index 9430ac55ba3e..46dca806420b 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -287,7 +287,7 @@ void ViewObjectContactOfPageObj::createPrimitive2DSequence(const DisplayInfo& /* // add a gray outline frame, except not when printing if(bCreateGrayFrame) { - const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor); + const Color aFrameColor(aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor); basegfx::B2DPolygon aOwnOutline(basegfx::utils::createUnitPolygon()); aOwnOutline.transform(aPageObjectTransform); diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 7868303c5c08..9bbb06dde830 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -117,7 +117,7 @@ namespace drawinglayer::primitive2d return new GroupPrimitive2D(std::move(aContainer)); const svtools::ColorConfig aColorConfig; - const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES)); + const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::DOCBOUNDARIES)); if(aColor.bIsVisible) { diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index e744fc613a27..2d123a6a360e 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1317,7 +1317,7 @@ rtl::Reference SdrOle2Obj::createSdrGrafObjReplacement(bool bAddText) // gray outline pClone->SetMergedItem(XLineStyleItem(css::drawing::LineStyle_SOLID)); const svtools::ColorConfig aColorConfig; - const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES)); + const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::DOCBOUNDARIES)); pClone->SetMergedItem(XLineColorItem(OUString(), aColor.nColor)); // bitmap fill diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 02d06446328b..e6bef505a03c 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -157,6 +157,7 @@ class SwUINumRuleItem; #define FN_DRAW_WRAP_DLG TypedWhichId(FN_VIEW + 3) /* Draw wrapping dlg */ #define FN_RULER (FN_VIEW + 11) /* Horizontal ruler */ +#define FN_VIEW_BOUNDARIES (FN_VIEW + 12) /* View text, section, table boundaries */ #define FN_VIEW_GRAPHIC (FN_VIEW + 13) /* View graphic */ #define FN_VIEW_BOUNDS (FN_VIEW + 14) /* View bounds */ #define FN_VIEW_FIELDS (FN_VIEW + 15) /* View fields */ @@ -164,6 +165,7 @@ class SwUINumRuleItem; #define FN_VSCROLLBAR (FN_VIEW + 17) /* Vertical Scrollbar */ #define FN_HSCROLLBAR (FN_VIEW + 18) /* Horizontal Scrollbar */ #define FN_VIEW_SECTION_BOUNDARIES (FN_VIEW + 19) /* View section boundaries */ +// slot number 20220 conflicts with FN_BUL_NUM_RULE_INDEX! #define FN_VIEW_META_CHARS (FN_VIEW + 24) /* View meta chars */ #define FN_VIEW_MARKS (FN_VIEW + 25) /* View marks */ diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index 1aedb38d243b..1a9139ecc8d8 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -69,7 +69,11 @@ struct ViewOptFlags1 bool bShowOutlineContentVisibilityButton : 1; bool bShowChangesInMargin : 1; //tracked deletions in margin bool bShowChangesInMargin2 : 1; //tracked insertions in margin + bool bTextBoundaries : 1; // text boundaries bool bTextBoundariesFull : 1; // true = frame around text, false = crop marks at edges + bool bSectionBoundaries : 1; // section boundaries + bool bTableBoundaries : 1; // table boundaries + bool bShowBoundaries : 1; // show all boundaries ViewOptFlags1() : bUseHeaderFooterMenu(false) @@ -103,7 +107,11 @@ struct ViewOptFlags1 , bShowOutlineContentVisibilityButton(false) , bShowChangesInMargin(false) , bShowChangesInMargin2(false) + , bTextBoundaries(true) , bTextBoundariesFull(false) + , bSectionBoundaries(true) + , bTableBoundaries(true) + , bShowBoundaries(false) {} bool operator==(const ViewOptFlags1& rOther) const @@ -139,7 +147,11 @@ struct ViewOptFlags1 && bShowOutlineContentVisibilityButton == rOther.bShowOutlineContentVisibilityButton && bShowChangesInMargin == rOther.bShowChangesInMargin && bShowChangesInMargin2 == rOther.bShowChangesInMargin2 - && bTextBoundariesFull == rOther.bTextBoundariesFull; + && bTextBoundaries == rOther.bTextBoundaries + && bTextBoundariesFull == rOther.bTextBoundariesFull + && bSectionBoundaries == rOther.bSectionBoundaries + && bTableBoundaries == rOther.bTableBoundaries + && bShowBoundaries == rOther.bShowBoundaries; } void dumpAsXml(xmlTextWriterPtr pWriter) const; @@ -185,15 +197,11 @@ namespace o3tl { // Appearance flags. enum class ViewOptFlags { NONE = 0x0000, - DocBoundaries = 0x0001, - ObjectBoundaries = 0x0002, - TableBoundaries = 0x0004, - IndexShadings = 0x0008, - Links = 0x0010, - VisitedLinks = 0x0020, - FieldShadings = 0x0040, - SectionBoundaries = 0x0080, - Shadow = 0x0100, + IndexShadings = 0x0001, + Links = 0x0002, + VisitedLinks = 0x0004, + FieldShadings = 0x0008, + Shadow = 0x0010, }; namespace o3tl { template<> struct typed_flags : is_typed_flags {}; @@ -207,7 +215,6 @@ struct SwViewColors { return m_aDocColor == rOther.m_aDocColor && m_aDocBoundColor == rOther.m_aDocBoundColor - && m_aObjectBoundColor == rOther.m_aObjectBoundColor && m_aAppBackgroundColor == rOther.m_aAppBackgroundColor && m_aTableBoundColor == rOther.m_aTableBoundColor && m_aFontColor == rOther.m_aFontColor @@ -229,7 +236,6 @@ struct SwViewColors } Color m_aDocColor; // color of document boundaries Color m_aDocBoundColor; // color of document boundaries - Color m_aObjectBoundColor; // color of object boundaries Color m_aAppBackgroundColor; // application background Color m_aTableBoundColor; // color of table boundaries Color m_aFontColor; @@ -665,9 +671,21 @@ public: bool IsMultipageView() const { return IsViewLayoutBookMode() || GetViewLayoutColumns() == 0; } + bool IsTextBoundaries() const { return m_nCoreOptions.bTextBoundaries; } + void SetTextBoundaries( bool b) { m_nCoreOptions.bTextBoundaries = b; } + bool IsTextBoundariesFull() const { return m_nCoreOptions.bTextBoundariesFull; } void SetTextBoundariesFull( bool b) { m_nCoreOptions.bTextBoundariesFull = b; } + bool IsSectionBoundaries() const { return m_nCoreOptions.bSectionBoundaries; } + void SetSectionBoundaries( bool b) { m_nCoreOptions.bSectionBoundaries = b; } + + bool IsTableBoundaries() const { return m_nCoreOptions.bTableBoundaries; } + void SetTableBoundaries( bool b) { m_nCoreOptions.bTableBoundaries = b; } + + bool IsShowBoundaries() const { return m_nCoreOptions.bShowBoundaries; } + void SetShowBoundaries( bool b ) { m_nCoreOptions.bShowBoundaries = b; } + #ifdef DBG_UTIL // Correspond to statements in ui/config/cfgvw.src. bool IsTest1() const { return m_bTest1; } @@ -842,7 +860,6 @@ public: SW_DLLPUBLIC const Color& GetDocColor() const; SW_DLLPUBLIC const Color& GetDocBoundariesColor() const; const Color& GetAppBackgroundColor() const; - const Color& GetObjectBoundariesColor() const; const Color& GetTableBoundariesColor() const; const Color& GetIndexShadingsColor() const; const Color& GetLinksColor() const; @@ -861,20 +878,14 @@ public: bool IsAppearanceFlag(ViewOptFlags nFlag) const; - bool IsDocBoundaries() const {return IsAppearanceFlag(ViewOptFlags::DocBoundaries);} - bool IsObjectBoundaries() const {return IsAppearanceFlag(ViewOptFlags::ObjectBoundaries);} - bool IsTableBoundaries() const {return IsAppearanceFlag(ViewOptFlags::TableBoundaries);} bool IsIndexShadings() const {return IsAppearanceFlag(ViewOptFlags::IndexShadings);} bool IsLinks() const {return IsAppearanceFlag(ViewOptFlags::Links);} bool IsVisitedLinks() const {return IsAppearanceFlag(ViewOptFlags::VisitedLinks);} bool IsFieldShadings() const {return IsAppearanceFlag(ViewOptFlags::FieldShadings);} - bool IsSectionBoundaries() const {return IsAppearanceFlag(ViewOptFlags::SectionBoundaries);} bool IsShadow() const {return IsAppearanceFlag(ViewOptFlags::Shadow);} void SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig = false); - void SetDocBoundaries(bool bSet) {SetAppearanceFlag(ViewOptFlags::DocBoundaries, bSet);} - // get/set default anchor (0..2); use GetDefaultAnchorType() to convert into RndStdIds::FLY_* sal_Int32 GetDefaultAnchor() const { return m_nDefaultAnchor; } diff --git a/sw/qa/uitest/options/tdf78133.py b/sw/qa/uitest/options/tdf78133.py index d1d504523a90..3c650cad8401 100644 --- a/sw/qa/uitest/options/tdf78133.py +++ b/sw/qa/uitest/options/tdf78133.py @@ -27,8 +27,8 @@ class tdf78133(UITestCase): xLoAppColorsEntry = xLOEntry.getChild('8') xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors #change text boundaries checkbox, save - docboundaries = xDialog.getChild("docboundaries") - docboundaries.executeAction("CLICK", tuple()) + shadows = xDialog.getChild("shadows") + shadows.executeAction("CLICK", tuple()) #verify - reopen dialog and check if "text boundaries" is still unchecked with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: @@ -38,7 +38,7 @@ class tdf78133(UITestCase): xLoAppColorsEntry = xLOEntry.getChild('8') xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors #change text boundaries checkbox, save - docboundaries = xDialog.getChild("docboundaries") - self.assertEqual(get_state_as_dict(docboundaries)["Selected"], "false") + shadows = xDialog.getChild("shadows") + self.assertEqual(get_state_as_dict(shadows)["Selected"], "false") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 1ec913474a44..ba6ae5f6775d 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -889,6 +889,12 @@ interface BaseTextEditView StateMethod = StateViewOptions ; ] + FN_VIEW_BOUNDARIES // status() + [ + ExecMethod = ExecViewOptions ; + StateMethod = StateViewOptions ; + ] + FN_VIEW_GRAPHIC // status() [ ExecMethod = ExecViewOptions ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 0bc5e6e58952..caa91ab74f94 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -6366,7 +6366,7 @@ SfxVoidItem SynchronizeLabelsDlg FN_SYNC_LABELS GroupId = SfxGroupId::Edit; ] -SfxBoolItem TableBoundaries FN_VIEW_TABLEGRID +SfxBoolItem TableBoundaries FN_VIEW_TABLEGRID // deprecated 25.2 [ AutoUpdate = FALSE, @@ -6376,7 +6376,21 @@ SfxBoolItem TableBoundaries FN_VIEW_TABLEGRID Container = FALSE, RecordAbsolute = FALSE, RecordPerSet; + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::View; +] +SfxBoolItem ShowBoundaries FN_VIEW_BOUNDARIES +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; AccelConfig = TRUE, MenuConfig = TRUE, @@ -6785,8 +6799,7 @@ SfxVoidItem UpdateInputFields FN_UPDATE_INPUTFIELDS GroupId = SfxGroupId::Edit; ] -SfxBoolItem ViewBounds FN_VIEW_BOUNDS - +SfxBoolItem ViewBounds FN_VIEW_BOUNDS // deprecated 25.2 [ AutoUpdate = FALSE, FastCall = FALSE, @@ -6797,14 +6810,13 @@ SfxBoolItem ViewBounds FN_VIEW_BOUNDS RecordPerSet; - AccelConfig = TRUE, - MenuConfig = TRUE, - ToolBoxConfig = TRUE, + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, GroupId = SfxGroupId::View; ] -SfxBoolItem SectionBoundaries FN_VIEW_SECTION_BOUNDARIES - +SfxBoolItem SectionBoundaries FN_VIEW_SECTION_BOUNDARIES // deprecated 25.2 [ AutoUpdate = FALSE, FastCall = FALSE, @@ -6815,9 +6827,9 @@ SfxBoolItem SectionBoundaries FN_VIEW_SECTION_BOUNDARIES RecordPerSet; - AccelConfig = TRUE, - MenuConfig = TRUE, - ToolBoxConfig = TRUE, + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, GroupId = SfxGroupId::View; ] diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 24803baf1c89..5e1bb1392638 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -333,51 +333,12 @@ struct SwPaintProperties { static SwPaintProperties gProp; -static bool isSubsidiaryLinesFlysEnabled() -{ - return !gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() && - !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() && - !gProp.pSGlobalShell->GetViewOptions()->IsFormView() && - gProp.pSGlobalShell->GetViewOptions()->IsObjectBoundaries(); -} -//other subsidiary lines enabled? static bool isSubsidiaryLinesEnabled() { return !gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() && !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() && !gProp.pSGlobalShell->GetViewOptions()->IsFormView() && - !gProp.pSGlobalShell->GetViewOptions()->IsWhitespaceHidden() && - gProp.pSGlobalShell->GetViewOptions()->IsDocBoundaries(); -} -//subsidiary lines for sections -static bool isSubsidiaryLinesForSectionsEnabled() -{ - return !gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() && - !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() && - !gProp.pSGlobalShell->GetViewOptions()->IsFormView() && - gProp.pSGlobalShell->GetViewOptions()->IsSectionBoundaries(); -} - - -namespace { - -bool isTableBoundariesEnabled() -{ - if (!gProp.pSGlobalShell->GetViewOptions()->IsTable()) - return false; - - if (gProp.pSGlobalShell->GetViewOptions()->IsPagePreview()) - return false; - - if (gProp.pSGlobalShell->GetViewOptions()->IsReadonly()) - return false; - - if (gProp.pSGlobalShell->GetViewOptions()->IsFormView()) - return false; - - return gProp.pSGlobalShell->GetViewOptions()->IsTableBoundaries(); -} - + gProp.pSGlobalShell->GetViewOptions()->IsShowBoundaries(); } /** @@ -1107,8 +1068,8 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, switch ( rLRect.GetSubColor() ) { case SubColFlags::Page: pCol = &pOpt->GetDocBoundariesColor(); break; - case SubColFlags::Fly: pCol = &pOpt->GetObjectBoundariesColor(); break; case SubColFlags::Tab: pCol = &pOpt->GetTableBoundariesColor(); break; + case SubColFlags::Fly: case SubColFlags::Sect: pCol = &pOpt->GetSectionBoundColor(); break; } @@ -2576,7 +2537,9 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons const Color* pTmpColor = nullptr; if (0 == aStyles[ 0 ].GetWidth()) { - if (isTableBoundariesEnabled() && gProp.pSGlobalShell->GetWin()) + if (isSubsidiaryLinesEnabled() && + gProp.pSGlobalShell->GetViewOptions()->IsTableBoundaries() && + gProp.pSGlobalShell->GetWin()) aStyles[ 0 ].Set( rCol, rCol, rCol, false, 1, 0, 0 ); else aStyles[0].SetType(SvxBorderLineStyle::NONE); @@ -6564,7 +6527,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin _pViewShell->GetOut()->SetLineColor(); if (!bRight) { - _pViewShell->GetOut()->SetFillColor(_pViewShell->GetViewOptions()->GetObjectBoundariesColor()); + _pViewShell->GetOut()->SetFillColor(_pViewShell->GetViewOptions()->GetDocBoundariesColor()); _pViewShell->GetOut()->DrawRect(tools::Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()))) ; if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) _pViewShell->GetOut()->SetFillColor(COL_BLACK); @@ -6574,7 +6537,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin } else { - _pViewShell->GetOut()->SetFillColor(_pViewShell->GetViewOptions()->GetObjectBoundariesColor()); + _pViewShell->GetOut()->SetFillColor(_pViewShell->GetViewOptions()->GetDocBoundariesColor()); SwRect aSidebarBorder(aPageRect.TopRight(),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height())); _pViewShell->GetOut()->DrawRect(aSidebarBorder.SVRect()); if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) @@ -7065,8 +7028,10 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP /// Refreshes all subsidiary lines of a page. void SwPageFrame::RefreshSubsidiary( const SwRect &rRect ) const { - if ( !(isSubsidiaryLinesEnabled() || isTableBoundariesEnabled() - || isSubsidiaryLinesForSectionsEnabled() || isSubsidiaryLinesFlysEnabled()) ) + if ( !(isSubsidiaryLinesEnabled() || + gProp.pSGlobalShell->GetViewOptions()->IsTextBoundaries() || + gProp.pSGlobalShell->GetViewOptions()->IsSectionBoundaries() || + gProp.pSGlobalShell->GetViewOptions()->IsTableBoundaries()) ) return; if ( !rRect.HasArea() ) @@ -7099,10 +7064,7 @@ void SwPageFrame::RefreshSubsidiary( const SwRect &rRect ) const void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage, const SwRect &rRect ) const { - const bool bSubsOpt = isSubsidiaryLinesEnabled() - || (IsSctFrame() && isSubsidiaryLinesForSectionsEnabled()) - || (IsFlyFrame() && isSubsidiaryLinesFlysEnabled()); - if (bSubsOpt) + if (isSubsidiaryLinesEnabled()) PaintSubsidiaryLines( pPage, rRect ); const SwFrame *pLow = Lower(); @@ -7350,7 +7312,7 @@ std::vector SwPageFrame::GetSubsidiaryLinesPolygons(const S { std::vector aPolygons; - if (!rViewShell.GetViewOptions()->IsDocBoundaries()) + if (!rViewShell.GetViewOptions()->IsTextBoundaries()) return aPolygons; const SwFrame* pLay = Lower(); @@ -7499,7 +7461,7 @@ std::vector SwHeadFootFrame::GetSubsidiaryLinesPolygons(con { std::vector aPolygons; - if (!rViewShell.GetViewOptions()->IsDocBoundaries()) + if (!rViewShell.GetViewOptions()->IsTextBoundaries()) return aPolygons; SwRect aArea( getFramePrintArea() ); @@ -7573,22 +7535,12 @@ void SwLayoutFrame::PaintSubsidiaryLines( const SwPageFrame *pPage, const bool bCell = IsCellFrame(); - if (!bCell && IsFlyFrame()) - { - if (!gProp.pSGlobalShell->GetViewOptions()->IsObjectBoundaries()) - return; - - // if the frame is wrap none or wrap through, then text boundary lines have no meaning - // (unless the frame itself contains text) - const text::WrapTextMode aSurround = GetFormat()->GetSurround().GetSurround(); - if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR - && (!Lower() || !Lower()->IsTextFrame()) - && (aSurround == text::WrapTextMode::WrapTextMode_THROUGH - || aSurround == text::WrapTextMode::WrapTextMode_NONE)) - { - return; - } - } + if ( (IsSctFrame() || IsFlyFrame()) && + !gProp.pSGlobalShell->GetViewOptions()->IsSectionBoundaries() ) + return; + if ( IsTextFrame() && + !gProp.pSGlobalShell->GetViewOptions()->IsTextBoundaries() ) + return; // #i3662# - use frame area for cells for section use also frame area const bool bUseFrameArea = bCell || IsSctFrame(); diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 5cb915d69785..a591b9dbd5d9 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1744,6 +1744,9 @@ SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage(weld::Container* pPage, w , m_xFmtAidsAutoComplFrame(m_xBuilder->weld_frame(u"fmtaidsautocompleteframe"_ustr)) , m_xEncloseWithCharactersCB(m_xBuilder->weld_check_button(u"enclosewithcharacters"_ustr)) , m_xEncloseWithCharactersImg(m_xBuilder->weld_widget(u"lockenclosewithcharacters"_ustr)) + , m_xTextBoundariesCB(m_xBuilder->weld_check_button(u"cbTextBoundaries"_ustr)) + , m_xSectionBoundariesCB(m_xBuilder->weld_check_button(u"cbSectionBoundaries"_ustr)) + , m_xTableBoundariesCB(m_xBuilder->weld_check_button(u"cbTableBoundaries"_ustr)) { SwFillMode eMode = SwFillMode::Tab; bool bIsOn = false; @@ -1762,6 +1765,8 @@ SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage(weld::Container* pPage, w } m_xEncloseWithCharactersCB->set_active(bIsEncloseWithCharactersOn); + m_xTextBoundariesCB->connect_toggled(LINK(this, SwShdwCursorOptionsTabPage, TextBoundariesHdl)); + m_xDirectCursorFillMode->set_active( static_cast(eMode) ); const SfxUInt16Item* pHtmlModeItem = rSet.GetItemIfSet(SID_HTML_MODE, false); if(!pHtmlModeItem || !(pHtmlModeItem->GetValue() & HTMLMODE_ON)) @@ -1790,6 +1795,13 @@ SwShdwCursorOptionsTabPage::~SwShdwCursorOptionsTabPage() { } +IMPL_LINK_NOARG( SwShdwCursorOptionsTabPage, TextBoundariesHdl, weld::Toggleable&, void ) +{ + const bool bIsTextBoundaries(m_xTextBoundariesCB->get_active()); + m_xTextBoundariesFull->set_sensitive(bIsTextBoundaries); + m_xTextBoundariesCrop->set_sensitive(bIsTextBoundaries); +} + std::unique_ptr SwShdwCursorOptionsTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet ) { return std::make_unique(pPage, pController, *rSet); @@ -1880,6 +1892,9 @@ bool SwShdwCursorOptionsTabPage::FillItemSet( SfxItemSet* rSet ) aDisp.m_bManualBreak = m_xBreakCB->get_active(); aDisp.m_xDefaultAnchor = m_xDefaultAnchorType->get_active(); aDisp.m_bTextBoundariesFull = m_xTextBoundariesFull->get_active(); + aDisp.m_bTextBoundaries = m_xTextBoundariesCB->get_active(); + aDisp.m_bSectionBoundaries = m_xSectionBoundariesCB->get_active(); + aDisp.m_bTableBoundaries = m_xTableBoundariesCB->get_active(); bRet |= (!pOldAttr || aDisp != *pOldAttr); if(bRet) @@ -1991,10 +2006,25 @@ void SwShdwCursorOptionsTabPage::Reset( const SfxItemSet* rSet ) m_xDefaultAnchorType->set_sensitive(!bReadOnly); m_xDefaultAnchorTypeImg->set_visible(bReadOnly); + bReadOnly = officecfg::Office::Writer::Content::Display::TextBoundaries::isReadOnly(); + m_xTextBoundariesCB->set_active( pDocDisplayAttr->m_bTextBoundaries ); + m_xTextBoundariesCB->set_sensitive(!bReadOnly); + + const bool bIsTextBoundaries(m_xTextBoundariesCB->get_active()); + m_xTextBoundariesFull->set_sensitive(bIsTextBoundaries); + m_xTextBoundariesCrop->set_sensitive(bIsTextBoundaries); if (pDocDisplayAttr->m_bTextBoundariesFull) m_xTextBoundariesFull->set_active(true); else m_xTextBoundariesCrop->set_active(true); + + bReadOnly = officecfg::Office::Writer::Content::Display::SectionBoundaries::isReadOnly(); + m_xSectionBoundariesCB->set_active( pDocDisplayAttr->m_bSectionBoundaries ); + m_xSectionBoundariesCB->set_sensitive(!bReadOnly); + + bReadOnly = officecfg::Office::Writer::Content::Display::TableBoundaries::isReadOnly(); + m_xTableBoundariesCB->set_active( pDocDisplayAttr->m_bTableBoundaries ); + m_xTableBoundariesCB->set_sensitive(!bReadOnly); } } diff --git a/sw/source/uibase/config/cfgitems.cxx b/sw/source/uibase/config/cfgitems.cxx index 5018e1d0fbfa..33791054fe3a 100644 --- a/sw/source/uibase/config/cfgitems.cxx +++ b/sw/source/uibase/config/cfgitems.cxx @@ -34,7 +34,10 @@ SwDocDisplayItem::SwDocDisplayItem() : m_bCharHiddenText = m_bBookmarks = m_bManualBreak = true; + m_bTextBoundaries = true; m_bTextBoundariesFull = false; // default is crop + m_bSectionBoundaries = true; + m_bTableBoundaries = true; m_xDefaultAnchor = 1; //FLY_TO_CHAR }; @@ -50,7 +53,10 @@ SwDocDisplayItem::SwDocDisplayItem(const SwViewOption& rVOpt ) : m_bCharHiddenText = rVOpt.IsShowHiddenChar(true); m_bBookmarks = rVOpt.IsShowBookmarks(true); m_bManualBreak = rVOpt.IsLineBreak(true); + m_bTextBoundaries = rVOpt.IsTextBoundaries(); m_bTextBoundariesFull = rVOpt.IsTextBoundariesFull(); + m_bSectionBoundaries = rVOpt.IsSectionBoundaries(); + m_bTableBoundaries = rVOpt.IsTableBoundaries(); m_xDefaultAnchor = rVOpt.GetDefaultAnchor(); } @@ -73,7 +79,10 @@ bool SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const m_bCharHiddenText == rItem.m_bCharHiddenText && m_bBookmarks == rItem.m_bBookmarks && m_bManualBreak == rItem.m_bManualBreak && + m_bTextBoundaries == rItem.m_bTextBoundaries && m_bTextBoundariesFull == rItem.m_bTextBoundariesFull && + m_bSectionBoundaries == rItem.m_bSectionBoundaries && + m_bTableBoundaries == rItem.m_bTableBoundaries && m_xDefaultAnchor == rItem.m_xDefaultAnchor); } @@ -87,7 +96,10 @@ void SwDocDisplayItem::FillViewOptions( SwViewOption& rVOpt) const rVOpt.SetShowHiddenChar(m_bCharHiddenText ); rVOpt.SetShowBookmarks(m_bBookmarks ); rVOpt.SetLineBreak (m_bManualBreak ); + rVOpt.SetTextBoundaries(m_bTextBoundaries); rVOpt.SetTextBoundariesFull(m_bTextBoundariesFull); + rVOpt.SetSectionBoundaries(m_bSectionBoundaries); + rVOpt.SetTableBoundaries(m_bTableBoundaries); rVOpt.SetDefaultAnchor( m_xDefaultAnchor ); } diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx index 795a678412e1..d446baca6b42 100644 --- a/sw/source/uibase/config/usrpref.cxx +++ b/sw/source/uibase/config/usrpref.cxx @@ -125,8 +125,12 @@ Sequence SwContentViewConfig::GetPropertyNames() const "Display/DefaultAnchor", // 25 "Zoom/DefaultZoom", // 26 "Zoom/ZoomType", // 27 - "Zoom/ZoomValue", //28 - "Display/TextBoundaries" // 29 + "Zoom/ZoomValue", // 28 + "Display/TextBoundaries", // 29 + "Display/TextBoundariesFull", // 30 + "Display/SectionBoundaries", // 31 + "Display/TableBoundaries", // 32 + "Display/ShowBoundaries" // 33 }; #if defined(__GNUC__) && !defined(__clang__) // clang 8.0.0 says strcmp isn't constexpr @@ -205,7 +209,11 @@ void SwContentViewConfig::ImplCommit() case 26: bVal = m_rParent.IsDefaultZoom(); break;// "Zoom/DefaultZoom" case 27:pValues[nProp] <<= static_cast(m_rParent.GetDefaultZoomType()); break; // "Zoom/ZoomType" case 28: pValues[nProp] <<= static_cast(m_rParent.GetDefaultZoomValue()); break; // "Zoom/ZoomValue" - case 29: bVal = m_rParent.IsTextBoundariesFull(); break; // "Display/TextBoundaries" + case 29: bVal = m_rParent.IsTextBoundaries(); break; // "Display/TextBoundaries" + case 30: bVal = m_rParent.IsTextBoundariesFull(); break; // "Display/TextBoundariesFull" + case 31: bVal = m_rParent.IsSectionBoundaries(); break; // "Display/SectionBoundaries" + case 32: bVal = m_rParent.IsTableBoundaries(); break; // "Display/TableBoundaries" + case 33: bVal = m_rParent.IsShowBoundaries(); break; // "Display/ShowBoundaries" } if ((nProp != g_UpdateLinkIndex) && (nProp != g_DefaultAnchor) && (nProp != g_ZoomType) && (nProp != g_ZoomValue)) @@ -283,7 +291,11 @@ void SwContentViewConfig::Load() m_rParent.SetDefaultZoomValue(static_cast(nSet), true); } break; //"Zoom/ZoomValue" // 28 - case 29: m_rParent.SetTextBoundariesFull(bSet); break; //"Display/TextBoundaries" // 29 + case 29: m_rParent.SetTextBoundaries(bSet); break; //"Display/TextBoundaries" + case 30: m_rParent.SetTextBoundariesFull(bSet); break; //"Display/TextBoundariesFull" + case 31: m_rParent.SetSectionBoundaries(bSet); break; //"Display/SectionBoundaries" + case 32: m_rParent.SetTableBoundaries(bSet); break; //"Display/TableBoundaries" + case 33: m_rParent.SetShowBoundaries(bSet); break; //"Display/ShowBoundaries" } } } diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 00a908d7b624..082f8f4331dd 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -47,7 +47,6 @@ SwViewColors SwViewOption::s_aInitialColorConfig {}; SwViewColors::SwViewColors() : m_aDocColor(COL_LIGHTGRAY), m_aDocBoundColor(COL_LIGHTGRAY), - m_aObjectBoundColor(COL_LIGHTGRAY), m_aAppBackgroundColor(COL_LIGHTGRAY), m_aTableBoundColor(COL_LIGHTGRAY), m_aFontColor(COL_BLACK), @@ -72,23 +71,12 @@ SwViewColors::SwViewColors(const svtools::ColorConfig& rConfig) { m_aDocColor = rConfig.GetColorValue(svtools::DOCCOLOR).nColor; - svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES); - m_aDocBoundColor = aValue.nColor; + m_aDocBoundColor = rConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor; m_nAppearanceFlags = ViewOptFlags::NONE; - if(aValue.bIsVisible) - m_nAppearanceFlags |= ViewOptFlags::DocBoundaries; - m_aAppBackgroundColor = rConfig.GetColorValue(svtools::APPBACKGROUND).nColor; + m_aTableBoundColor = rConfig.GetColorValue(svtools::TABLEBOUNDARIES).nColor; - aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES); - m_aObjectBoundColor = aValue.nColor; - if(aValue.bIsVisible) - m_nAppearanceFlags |= ViewOptFlags::ObjectBoundaries; - - aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES); - m_aTableBoundColor = aValue.nColor; - if(aValue.bIsVisible) - m_nAppearanceFlags |= ViewOptFlags::TableBoundaries; + svtools::ColorConfigValue aValue; aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS); m_aIndexShadingsColor = aValue.nColor; @@ -126,10 +114,7 @@ SwViewColors::SwViewColors(const svtools::ColorConfig& rConfig) if (aValue.bIsVisible && !comphelper::LibreOfficeKit::isActive()) m_nAppearanceFlags |= ViewOptFlags::FieldShadings; - aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES); - m_aSectionBoundColor = aValue.nColor; - if(aValue.bIsVisible) - m_nAppearanceFlags |= ViewOptFlags::SectionBoundaries; + m_aSectionBoundColor = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES).nColor; aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS); m_aPageBreakColor = aValue.nColor; @@ -470,11 +455,6 @@ const Color& SwViewOption::GetDocBoundariesColor() const return m_aColorConfig.m_aDocBoundColor; } -const Color& SwViewOption::GetObjectBoundariesColor() const -{ - return m_aColorConfig.m_aObjectBoundColor; -} - const Color& SwViewOption::GetAppBackgroundColor() const { return m_aColorConfig.m_aAppBackgroundColor; @@ -573,14 +553,10 @@ void SwViewOption::SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveIn }; static const FlagToConfig_Impl aFlags[] = { - { ViewOptFlags::DocBoundaries , svtools::DOCBOUNDARIES }, - { ViewOptFlags::ObjectBoundaries , svtools::OBJECTBOUNDARIES }, - { ViewOptFlags::TableBoundaries , svtools::TABLEBOUNDARIES }, { ViewOptFlags::IndexShadings , svtools::WRITERIDXSHADINGS }, { ViewOptFlags::Links , svtools::LINKS }, { ViewOptFlags::VisitedLinks , svtools::LINKSVISITED }, { ViewOptFlags::FieldShadings , svtools::WRITERFIELDSHADINGS }, - { ViewOptFlags::SectionBoundaries , svtools::WRITERSECTIONBOUNDARIES }, { ViewOptFlags::Shadow , svtools::SHADOWCOLOR }, }; for (auto& item : aFlags) diff --git a/sw/source/uibase/inc/cfgitems.hxx b/sw/source/uibase/inc/cfgitems.hxx index a02f2ec7864d..2619e6449e12 100644 --- a/sw/source/uibase/inc/cfgitems.hxx +++ b/sw/source/uibase/inc/cfgitems.hxx @@ -53,6 +53,10 @@ class SW_DLLPUBLIC SwDocDisplayItem final : public SfxPoolItem bool m_bBookmarks :1; bool m_bManualBreak :1; bool m_bTextBoundariesFull :1; + bool m_bTextBoundaries :1; + bool m_bSectionBoundaries :1; + bool m_bTableBoundaries :1; + sal_Int32 m_xDefaultAnchor; public: diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index cdeb071100a7..ca60e8f00219 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -336,6 +336,12 @@ class SwShdwCursorOptionsTabPage final : public SfxTabPage std::unique_ptr m_xEncloseWithCharactersCB; std::unique_ptr m_xEncloseWithCharactersImg; + std::unique_ptr m_xTextBoundariesCB; + std::unique_ptr m_xSectionBoundariesCB; + std::unique_ptr m_xTableBoundariesCB; + + DECL_LINK(TextBoundariesHdl, weld::Toggleable&, void); + public: SwShdwCursorOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); virtual ~SwShdwCursorOptionsTabPage() override; diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 8d236be3ce87..fcf35ac29f4d 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -170,6 +170,7 @@ void SwView::RecheckBrowseMode() //SID_AUTOSPELL_MARKOFF, SID_TOGGLE_RESOLVED_NOTES, /* 11672*/ FN_RULER, /*20211*/ + FN_VIEW_BOUNDARIES, /*20212*/ FN_VIEW_GRAPHIC, /*20213*/ FN_VIEW_BOUNDS, /**/ FN_VIEW_FIELDS, /*20215*/ @@ -236,8 +237,10 @@ void SwView::StateViewOptions(SfxItemSet &rSet) aBool.SetValue( bState ); } break; + case FN_VIEW_BOUNDARIES: + aBool.SetValue( pOpt->IsShowBoundaries()); break; case FN_VIEW_BOUNDS: - aBool.SetValue( pOpt->IsDocBoundaries()); break; + aBool.SetValue( pOpt->IsTextBoundaries()); break; case FN_VIEW_SECTION_BOUNDARIES: aBool.SetValue(pOpt->IsSectionBoundaries()); break; case FN_VIEW_GRAPHIC: @@ -403,14 +406,26 @@ void SwView::ExecViewOptions(SfxRequest &rReq) case FN_VIEW_BOUNDS: if( STATE_TOGGLE == eState ) - bFlag = !pOpt->IsDocBoundaries(); - pOpt->SetAppearanceFlag(ViewOptFlags::DocBoundaries, bFlag, true ); + bFlag = !pOpt->IsTextBoundaries(); + pOpt->SetTextBoundaries( bFlag ); break; case FN_VIEW_SECTION_BOUNDARIES: if( STATE_TOGGLE == eState ) bFlag = !pOpt->IsSectionBoundaries(); - pOpt->SetAppearanceFlag(ViewOptFlags::SectionBoundaries, bFlag, true ); + pOpt->SetSectionBoundaries( bFlag ); + break; + + case FN_VIEW_TABLEGRID: + if( STATE_TOGGLE == eState ) + bFlag = !pOpt->IsTableBoundaries(); + pOpt->SetTableBoundaries( bFlag ); + break; + + case FN_VIEW_BOUNDARIES: + if( STATE_TOGGLE == eState ) + bFlag = !pOpt->IsShowBoundaries(); + pOpt->SetShowBoundaries( bFlag ); break; case SID_GRID_VISIBLE: @@ -521,13 +536,6 @@ void SwView::ExecViewOptions(SfxRequest &rReq) pOpt->SetViewAnyRuler( bFlag ); break; - - case FN_VIEW_TABLEGRID: - if( STATE_TOGGLE == eState ) - bFlag = !pOpt->IsTableBoundaries(); - pOpt->SetAppearanceFlag(ViewOptFlags::TableBoundaries, bFlag, true ); - break; - case FN_VIEW_FIELDNAME: if( STATE_TOGGLE == eState ) bFlag = !pOpt->IsFieldName() ; diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 2414fbfe44e1..713dea75838f 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -581,8 +581,8 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(*o3tl::doAccess(rValue)); break; case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(*o3tl::doAccess(rValue)); break; case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(*o3tl::doAccess(rValue)); break; - case HANDLE_VIEWSET_TABLE_BOUNDARIES : mpViewOption->SetAppearanceFlag(ViewOptFlags::TableBoundaries, *o3tl::doAccess(rValue), true); break; - case HANDLE_VIEWSET_TEXT_BOUNDARIES : mpViewOption->SetDocBoundaries(*o3tl::doAccess(rValue)); break; + case HANDLE_VIEWSET_TABLE_BOUNDARIES : mpViewOption->SetTableBoundaries(*o3tl::doAccess(rValue)); break; + case HANDLE_VIEWSET_TEXT_BOUNDARIES : mpViewOption->SetTextBoundaries(*o3tl::doAccess(rValue)); break; case HANDLE_VIEWSET_SMOOTH_SCROLLING : mpViewOption->SetSmoothScroll(*o3tl::doAccess(rValue)); break; case HANDLE_VIEWSET_SHOW_CONTENT_TIPS : mpViewOption->SetShowContentTips(*o3tl::doAccess(rValue)); break; case HANDLE_VIEWSET_IS_RASTER_VISIBLE : mpViewOption->SetGridVisible(*o3tl::doAccess(rValue)); break; @@ -751,7 +751,6 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c } } break; - case HANDLE_VIEWSET_TEXTBOUNDARIES: mpViewOption->SetTextBoundariesFull(*o3tl::doAccess(rValue)); break; default: throw UnknownPropertyException(OUString::number(rInfo.mnHandle)); } @@ -829,7 +828,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u case HANDLE_VIEWSET_HIDE_WHITESPACE : bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break; case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break; case HANDLE_VIEWSET_TABLE_BOUNDARIES : bBoolVal = mpConstViewOption->IsTableBoundaries(); break; - case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = mpConstViewOption->IsDocBoundaries(); break; + case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = mpConstViewOption->IsTextBoundaries(); break; case HANDLE_VIEWSET_SMOOTH_SCROLLING : bBoolVal = mpConstViewOption->IsSmoothScroll(); break; case HANDLE_VIEWSET_SHOW_CONTENT_TIPS : bBoolVal = mpConstViewOption->IsShowContentTips(); break; case HANDLE_VIEWSET_INLINECHANGES_TIPS : bBoolVal = mpConstViewOption->IsShowInlineTooltips(); break; @@ -932,7 +931,6 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u bBool = false; } break; - case HANDLE_VIEWSET_TEXTBOUNDARIES : bBoolVal = mpConstViewOption->IsTextBoundariesFull(); break; default: OSL_FAIL("there is no such ID!"); } if( bBool ) diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml index 1b1370e8b380..dd3eb8c6bd12 100644 --- a/sw/uiconfig/sglobal/menubar/menubar.xml +++ b/sw/uiconfig/sglobal/menubar/menubar.xml @@ -200,8 +200,7 @@ - - + diff --git a/sw/uiconfig/sweb/menubar/menubar.xml b/sw/uiconfig/sweb/menubar/menubar.xml index dc0715beeb81..00c5cefefe15 100644 --- a/sw/uiconfig/sweb/menubar/menubar.xml +++ b/sw/uiconfig/sweb/menubar/menubar.xml @@ -131,7 +131,7 @@ - + diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml index 5eebcc9a96a1..6da6a923e662 100644 --- a/sw/uiconfig/swform/menubar/menubar.xml +++ b/sw/uiconfig/swform/menubar/menubar.xml @@ -168,8 +168,7 @@ - - + diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml index 59f630afc70e..57b49e6b9d90 100644 --- a/sw/uiconfig/swreport/menubar/menubar.xml +++ b/sw/uiconfig/swreport/menubar/menubar.xml @@ -160,8 +160,7 @@ - - + diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index ea5ef0f6b9cb..04b9fb4e2c91 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -206,9 +206,7 @@ - - - + diff --git a/sw/uiconfig/swriter/ui/notebookbar.ui b/sw/uiconfig/swriter/ui/notebookbar.ui index 25983178d3da..524dffbc4939 100644 --- a/sw/uiconfig/swriter/ui/notebookbar.ui +++ b/sw/uiconfig/swriter/ui/notebookbar.ui @@ -2263,21 +2263,7 @@ True False - .uno:ViewBounds - - - - - True - False - .uno:TableBoundaries - - - - - True - False - .uno:SectionBoundaries + .uno:ShowBoundaries diff --git a/sw/uiconfig/swriter/ui/notebookbar_compact.ui b/sw/uiconfig/swriter/ui/notebookbar_compact.ui index 4e678b5a18ef..2a600fc1ccb5 100644 --- a/sw/uiconfig/swriter/ui/notebookbar_compact.ui +++ b/sw/uiconfig/swriter/ui/notebookbar_compact.ui @@ -2441,21 +2441,7 @@ True False - .uno:ViewBounds - - - - - True - False - .uno:TableBoundaries - - - - - True - False - .uno:SectionBoundaries + .uno:ShowBoundaries diff --git a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui index e0129e255828..f1688927c5e1 100644 --- a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui +++ b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui @@ -1670,21 +1670,7 @@ True False - .uno:ViewBounds - - - - - True - False - .uno:TableBoundaries - - - - - True - False - .uno:SectionBoundaries + .uno:ShowBoundaries @@ -3406,21 +3392,7 @@ True False - .uno:ViewBounds - - - - - True - False - .uno:TableBoundaries - - - - - True - False - .uno:SectionBoundaries + .uno:ShowBoundaries diff --git a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui index 59a3584f33a8..1eeacc41be3c 100644 --- a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui +++ b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui @@ -1649,21 +1649,7 @@ True False - .uno:ViewBounds - - - - - True - False - .uno:TableBoundaries - - - - - True - False - .uno:SectionBoundaries + .uno:ShowBoundaries @@ -3747,21 +3733,7 @@ True False - .uno:ViewBounds - - - - - True - False - .uno:TableBoundaries - - - - - True - False - .uno:SectionBoundaries + .uno:ShowBoundaries diff --git a/sw/uiconfig/swriter/ui/optformataidspage.ui b/sw/uiconfig/swriter/ui/optformataidspage.ui index de56bcb643a2..c461544ca92e 100644 --- a/sw/uiconfig/swriter/ui/optformataidspage.ui +++ b/sw/uiconfig/swriter/ui/optformataidspage.ui @@ -107,7 +107,7 @@ - Tabs + _Tabs True True False @@ -145,7 +145,7 @@ - Hidden characters + _Hidden characters True True False @@ -164,7 +164,7 @@ - Bookmarks + _Bookmarks True True False @@ -433,7 +433,7 @@ 6 - Math baseline alignment + _Math baseline alignment True True False @@ -844,38 +844,20 @@ 0 none - + True False + 12 6 3 - - Crop marks + + Te_xt True True False start - 12 - True - True - True - rbTextBoundariesFull - - - 0 - 1 - - - - - Full - True - True - False - start - 12 True True True @@ -885,13 +867,85 @@ 0 + + + Tab_les + True + True + False + start + True + True + True + + + 0 + 3 + 2 + + + + + _Sections and Frames + True + True + False + start + True + True + True + + + 0 + 2 + 2 + + + + + _Crop marks + True + True + False + start + 12 + True + True + True + + + 1 + 1 + + + + + Border _Outline + True + True + False + start + 12 + True + True + True + rbTextBoundariesCrop + + + 1 + 0 + + + + + True False - Text Boundaries + Object Boundaries diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml index 70e0c4a10b84..393fbf4aec4a 100644 --- a/sw/uiconfig/swxform/menubar/menubar.xml +++ b/sw/uiconfig/swxform/menubar/menubar.xml @@ -196,8 +196,7 @@ - - + From e8a7423baabd53c8e9f9dcdac687cdbd2aa44ec0 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 20 Nov 2024 14:50:12 +0100 Subject: [PATCH 037/373] CppunitTest_sw_htmlexport: split in two It already had 114 tests Change-Id: I16bddb42364c542fb2b5e115672096984b29e975 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176847 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/CppunitTest_sw_htmlexport2.mk | 80 + sw/Module_sw.mk | 1 + sw/qa/extras/htmlexport/htmlexport.cxx | 1813 +---------------- sw/qa/extras/htmlexport/htmlexport2.cxx | 1612 +++++++++++++++ sw/qa/extras/htmlexport/htmlmodeltestbase.hxx | 232 +++ 5 files changed, 1926 insertions(+), 1812 deletions(-) create mode 100644 sw/CppunitTest_sw_htmlexport2.mk create mode 100644 sw/qa/extras/htmlexport/htmlexport2.cxx create mode 100644 sw/qa/extras/htmlexport/htmlmodeltestbase.hxx diff --git a/sw/CppunitTest_sw_htmlexport2.mk b/sw/CppunitTest_sw_htmlexport2.mk new file mode 100644 index 000000000000..4d2cb5884034 --- /dev/null +++ b/sw/CppunitTest_sw_htmlexport2.mk @@ -0,0 +1,80 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# 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/. +# +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,sw_htmlexport2)) + +$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_htmlexport2)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sw_htmlexport2, \ + sw/qa/extras/htmlexport/htmlexport2 \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sw_htmlexport2, \ + comphelper \ + cppu \ + cppuhelper \ + editeng \ + i18nlangtag \ + msfilter \ + sal \ + sfx \ + subsequenttest \ + sot \ + sw \ + swqahelper \ + svl \ + svt \ + test \ + tl \ + unotest \ + utl \ + vcl \ +)) + +$(eval $(call gb_CppunitTest_use_externals,sw_htmlexport2,\ + boost_headers \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_set_include,sw_htmlexport2,\ + -I$(SRCDIR)/sw/inc \ + -I$(SRCDIR)/sw/source/core/inc \ + -I$(SRCDIR)/sw/source/uibase/inc \ + -I$(SRCDIR)/sw/qa/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_api,sw_htmlexport2,\ + udkapi \ + offapi \ + oovbaapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,sw_htmlexport2)) +$(eval $(call gb_CppunitTest_use_vcl,sw_htmlexport2)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sw_htmlexport2,\ + officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_use_rdb,sw_htmlexport2,services)) + +$(eval $(call gb_CppunitTest_use_configuration,sw_htmlexport2)) + +ifeq ($(OS),WNT) +# Initializing DocumentSignatureManager will require gpgme-w32spawn.exe in workdir/LinkTarget/Executable +# In fact, it is not even required to complete test successfully, but the dialog would stop execution +$(eval $(call gb_CppunitTest_use_packages,sw_htmlexport2,\ + $(call gb_Helper_optional,GPGMEPP,gpgmepp)\ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 6b53fbbbde2b..6d4ed9f55967 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -73,6 +73,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_docbookexport \ CppunitTest_sw_fodfexport \ CppunitTest_sw_htmlexport \ + CppunitTest_sw_htmlexport2 \ CppunitTest_sw_xhtmlexport \ CppunitTest_sw_htmlimport \ CppunitTest_sw_indexingexport \ diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 44eca01a2b13..a20b11ec41ef 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -7,275 +7,39 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include "htmlmodeltestbase.hxx" #include -#include #include -#include -#include #include #include #include #include -#include #include #include #include -#include #include -#include -#include - -#include -#include #include -#include #include #include -#include -#include -#include -#include #include #include -#include -#include #include #include -#include #include -#include -#include #include #include #include #include #include -#include #include #include -#include -#include namespace { -/// Test RTF parser that just extracts a single OLE2 object from a file. -class TestReqIfRtfReader : public SvRTFParser -{ -public: - TestReqIfRtfReader(SvStream& rStream); - void NextToken(int nToken) override; - bool WriteObjectData(SvStream& rOLE); - tools::Long GetObjw() const { return m_nObjw; } - tools::Long GetObjh() const { return m_nObjh; } - int getWmetafile() const { return m_nWmetafile; } - -private: - bool m_bInObjData = false; - OStringBuffer m_aHex; - tools::Long m_nObjw = 0; - tools::Long m_nObjh = 0; - int m_nWmetafile = 0; -}; - -TestReqIfRtfReader::TestReqIfRtfReader(SvStream& rStream) - : SvRTFParser(rStream) -{ -} - -void TestReqIfRtfReader::NextToken(int nToken) -{ - switch (nToken) - { - case '}': - m_bInObjData = false; - break; - case RTF_TEXTTOKEN: - if (m_bInObjData) - m_aHex.append(OUStringToOString(aToken, RTL_TEXTENCODING_ASCII_US)); - break; - case RTF_OBJDATA: - m_bInObjData = true; - break; - case RTF_OBJW: - m_nObjw = nTokenValue; - break; - case RTF_OBJH: - m_nObjh = nTokenValue; - break; - case RTF_WMETAFILE: - m_nWmetafile = nTokenValue; - break; - } -} - -bool TestReqIfRtfReader::WriteObjectData(SvStream& rOLE) -{ - OString aObjdata = m_aHex.makeStringAndClear(); - - SvMemoryStream aStream; - int b = 0; - int count = 2; - - // Feed the destination text to a stream. - for (int i = 0; i < aObjdata.getLength(); ++i) - { - char ch = aObjdata[i]; - if (ch != 0x0d && ch != 0x0a) - { - b = b << 4; - sal_Int8 parsed = msfilter::rtfutil::AsHex(ch); - if (parsed == -1) - return false; - b += parsed; - count--; - if (!count) - { - aStream.WriteChar(b); - count = 2; - b = 0; - } - } - } - - aStream.Seek(0); - rOLE.WriteStream(aStream); - return true; -} - -/// Parser for [MS-OLEDS] 2.2.5 EmbeddedObject, aka OLE1. -struct OLE1Reader -{ - sal_uInt32 m_nNativeDataSize; - std::vector m_aNativeData; - sal_uInt32 m_nPresentationDataSize; - - OLE1Reader(SvStream& rStream); -}; - -OLE1Reader::OLE1Reader(SvStream& rStream) -{ - // Skip ObjectHeader, see [MS-OLEDS] 2.2.4. - rStream.Seek(0); - CPPUNIT_ASSERT(rStream.remainingSize()); - sal_uInt32 nData; - rStream.ReadUInt32(nData); // OLEVersion - rStream.ReadUInt32(nData); // FormatID - rStream.ReadUInt32(nData); // ClassName - rStream.SeekRel(nData); - rStream.ReadUInt32(nData); // TopicName - rStream.SeekRel(nData); - rStream.ReadUInt32(nData); // ItemName - rStream.SeekRel(nData); - - rStream.ReadUInt32(m_nNativeDataSize); - m_aNativeData.resize(m_nNativeDataSize); - rStream.ReadBytes(m_aNativeData.data(), m_aNativeData.size()); - - rStream.ReadUInt32(nData); // OLEVersion for presentation data - CPPUNIT_ASSERT(rStream.good()); - rStream.ReadUInt32(nData); // FormatID - rStream.ReadUInt32(nData); // ClassName - rStream.SeekRel(nData); - rStream.ReadUInt32(nData); // Width - rStream.ReadUInt32(nData); // Height - rStream.ReadUInt32(nData); // PresentationDataSize - m_nPresentationDataSize = nData; -} - -/// Covers sw/source/filter/html/wrthtml.cxx and related fixes. -class HtmlExportTest : public SwModelTestBase, public HtmlTestTools -{ -public: - HtmlExportTest() - : SwModelTestBase(u"/sw/qa/extras/htmlexport/data/"_ustr, u"HTML (StarWriter)"_ustr) - { - } - - /// Wraps an RTF fragment into a complete RTF file, so an RTF parser can handle it. - static void wrapRtfFragment(const OUString& rURL, SvMemoryStream& rStream) - { - SvFileStream aRtfStream(rURL, StreamMode::READ); - rStream.WriteOString("{\\rtf1"); - rStream.WriteStream(aRtfStream); - rStream.WriteOString("}"); - rStream.Seek(0); - } -}; - -/// HTML export of the sw doc model tests. -class SwHtmlDomExportTest : public SwModelTestBase, public HtmlTestTools -{ -public: - SwHtmlDomExportTest() - : SwModelTestBase(u"/sw/qa/extras/htmlexport/data/"_ustr) - { - } - - OUString GetObjectPath(const OUString& ext); - /// Get the .ole path, assuming maTempFile is an XHTML export result. - OUString GetOlePath() { return GetObjectPath(u".ole"_ustr); } - OUString GetPngPath() { return GetObjectPath(u".png"_ustr); } - /// Parse the ole1 data out of an RTF fragment URL. - void ParseOle1FromRtfUrl(const OUString& rRtfUrl, SvMemoryStream& rOle1); - /// Export using the C++ HTML export filter, with xhtmlns=reqif-xhtml. - void ExportToReqif(); - /// Import using the C++ HTML import filter, with xhtmlns=reqif-xhtml. - void ImportFromReqif(const OUString& rUrl); - /// Export using the C++ HTML export filter - void ExportToHTML(); -}; - -OUString SwHtmlDomExportTest::GetObjectPath(const OUString& ext) -{ - assert(ext.startsWith(".")); - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - OUString aOlePath = getXPath( - pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(aOlePath.endsWith(ext)); - INetURLObject aUrl(maTempFile.GetURL()); - aUrl.setBase(aOlePath.subView(0, aOlePath.getLength() - ext.getLength())); - aUrl.setExtension(ext.subView(1)); - return aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE); -} - -void SwHtmlDomExportTest::ParseOle1FromRtfUrl(const OUString& rRtfUrl, SvMemoryStream& rOle1) -{ - SvMemoryStream aRtf; - HtmlExportTest::wrapRtfFragment(rRtfUrl, aRtf); - tools::SvRef xReader(new TestReqIfRtfReader(aRtf)); - CPPUNIT_ASSERT(xReader->CallParser() != SvParserState::Error); - CPPUNIT_ASSERT(xReader->WriteObjectData(rOle1)); - CPPUNIT_ASSERT(rOle1.Tell()); -} - -void SwHtmlDomExportTest::ExportToReqif() -{ - setFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); - save(u"HTML (StarWriter)"_ustr); -} - -void SwHtmlDomExportTest::ExportToHTML() -{ - uno::Sequence aStoreProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - }; - saveWithParams(aStoreProperties); -} - -void SwHtmlDomExportTest::ImportFromReqif(const OUString& rUrl) -{ - uno::Sequence aLoadProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - }; - loadWithParams(rUrl, aLoadProperties); -} - CPPUNIT_TEST_FIXTURE(HtmlExportTest, testFdo81276) { auto verify = [this]() { @@ -1817,1581 +1581,6 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedJPGShapeDirectly) assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:object", "type", u"image/png"); } - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGShapeAsOLE) -{ - // Given a document with an image shape: - createSwDoc(); - uno::Reference xFactory(mxComponent, uno::UNO_QUERY); - uno::Reference xShape( - xFactory->createInstance(u"com.sun.star.drawing.GraphicObjectShape"_ustr), uno::UNO_QUERY); - xShape->setSize(awt::Size(10000, 10000)); - uno::Reference xShapeProps(xShape, uno::UNO_QUERY); - xShapeProps->setPropertyValue(u"GraphicURL"_ustr, uno::Any(createFileURL(u"ole2.png"))); - uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - xDrawPageSupplier->getDrawPage()->add(xShape); - - // When exporting to XHTML: - uno::Sequence aStoreProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true), - }; - saveWithParams(aStoreProperties); - - // Then make sure the PNG is embedded with an RTF wrapper: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: text/rtf - // - Actual : image/png - // i.e. the OLE wrapper around the PNG was missing. - assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", u"text/rtf"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNG) -{ - // FIXME: the DPI check should be removed when either (1) the test is fixed to work with - // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin. - if (!IsDefaultDPI()) - return; - // Given a document with a shape: - createSwDoc(); - uno::Reference xFactory(mxComponent, uno::UNO_QUERY); - uno::Reference xShape( - xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); - xShape->setSize(awt::Size(10000, 10000)); - uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - xDrawPageSupplier->getDrawPage()->add(xShape); - - // When exporting to XHTML: - ExportToReqif(); - - // Then make sure the shape is embedded as a PNG: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: image/png - // - Actual : image/x-vclgraphic - // i.e. the result was invalid ReqIF. - assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", u"image/png"); - - // Then check the pixel size of the shape: - Size aPixelSize(Application::GetDefaultDevice()->LogicToPixel(Size(10000, 10000), - MapMode(MapUnit::Map100thMM))); - // Without the accompanying fix in place, this test would have failed with: - // - no attribute 'width' exist - // i.e. shapes had no width. - assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "width", - OUString::number(aPixelSize.getWidth())); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testShapeAsImageHtml) -{ - // Given a document with a shape: - createSwDoc(); - uno::Reference xFactory(mxComponent, uno::UNO_QUERY); - uno::Reference xShape( - xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); - xShape->setSize(awt::Size(5080, 2540)); - uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - xDrawPageSupplier->getDrawPage()->add(xShape); - - // When exporting to plain HTML: - saveAndReload(u"HTML (StarWriter)"_ustr); - - // Without the accompanying fix in place, this test would have failed with: - // - Expected: - // - Actual : /> - // i.e. the output was not well-formed. - CPPUNIT_ASSERT_EQUAL(u" "_ustr, getParagraph(1)->getString()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testJson) -{ - // Given a document with a shape: - createSwDoc(); - uno::Reference xFactory(mxComponent, uno::UNO_QUERY); - uno::Reference xShape( - xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); - xShape->setSize(awt::Size(2540, 2540)); - uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - xDrawPageSupplier->getDrawPage()->add(xShape); - - // When exporting to HTML, and specifying options as JSON: - setFilterOptions(u"{\"XhtmlNs\":{\"type\":\"string\", \"value\":\"reqif-xhtml\"}," - "\"ShapeDPI\":{\"type\":\"long\",\"value\":\"192\"}}"_ustr); - save(u"HTML (StarWriter)"_ustr); - - // Then make sure those options are not ignored: - // Without the accompanying fix in place, this test would have failed, as GetPngPath() expects - // XML output, but xhtmlns=reqif-xhtml was ignored. - OUString aPngUrl = GetPngPath(); - SvFileStream aFileStream(aPngUrl, StreamMode::READ); - GraphicDescriptor aDescriptor(aFileStream, nullptr); - aDescriptor.Detect(/*bExtendedInfo=*/true); - // Make sure that the increased DPI is taken into account: - tools::Long nExpected = 192; - CPPUNIT_ASSERT_EQUAL(nExpected, aDescriptor.GetSizePixel().getWidth()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNGCustomDPI) -{ - // FIXME: the DPI check should be removed when either (1) the test is fixed to work with - // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin. - if (!IsDefaultDPI()) - return; - // Given a document with a shape: - createSwDoc(); - uno::Reference xFactory(mxComponent, uno::UNO_QUERY); - uno::Reference xShape( - xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); - xShape->setSize(awt::Size(5080, 2540)); - uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - xDrawPageSupplier->getDrawPage()->add(xShape); - sal_Int32 nDPI = 600; - - // When exporting to XHTML: - uno::Sequence aStoreProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"ShapeDPI"_ustr, nDPI), - }; - saveWithParams(aStoreProperties); - - // Then make sure the shape is embedded as a PNG: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", u"image/png"); - - // Then check the pixel size of the shape: - Size aPixelSize(Application::GetDefaultDevice()->LogicToPixel(Size(5080, 2540), - MapMode(MapUnit::Map100thMM))); - tools::Long nPNGWidth = 1200; - OUString aPngUrl = GetPngPath(); - SvFileStream aFileStream(aPngUrl, StreamMode::READ); - GraphicDescriptor aDescriptor(aFileStream, nullptr); - aDescriptor.Detect(/*bExtendedInfo=*/true); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: 1200 - // - Actual : 1000 - // i.e. first setting a double DPI didn't result in larger pixel width of the PNG, then it was - // limited to 1000 pixels (because the pixel limit was 500k). - CPPUNIT_ASSERT_EQUAL(nPNGWidth, aDescriptor.GetSizePixel().getWidth()); - - // Then make sure the shape's logic size (in CSS pixels) don't change: - assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "width", - OUString::number(aPixelSize.getWidth())); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOleBmpTransparent) -{ - // Given a document with a transparent image: - createSwDoc(); - uno::Sequence aArgs = { - comphelper::makePropertyValue(u"FileName"_ustr, createFileURL(u"transparent.png")), - }; - dispatchCommand(mxComponent, u".uno:InsertGraphic"_ustr, aArgs); - - // When exporting to reqif with ExportImagesAsOLE=true: - uno::Sequence aStoreProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true), - }; - saveWithParams(aStoreProperties); - - // Then make sure the transparent pixel turns into white: - SvMemoryStream aOle1; - ParseOle1FromRtfUrl(GetOlePath(), aOle1); - OLE1Reader aOle1Reader(aOle1); - SvMemoryStream aBitmapStream(aOle1Reader.m_aNativeData.data(), aOle1Reader.m_aNativeData.size(), - StreamMode::READ); - Bitmap aBitmap; - ReadDIB(aBitmap, aBitmapStream, /*bFileHeader=*/true); - Size aBitmapSize = aBitmap.GetSizePixel(); - BitmapEx aBitmapEx(aBitmap); - Color nActualColor - = aBitmapEx.GetPixelColor(aBitmapSize.getWidth() - 1, aBitmapSize.getHeight() - 1); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: Color: R:255 G:255 B:255 A:0 - // - Actual : Color: R:0 G:0 B:0 A:0 - // i.e. the bitmap without an alpha channel was black, not white. - CPPUNIT_ASSERT_EQUAL(COL_WHITE, nActualColor); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListsHeading) -{ - // Given a document with lh, lh, li, li, lh and lh nodes: - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->Insert(u"list 1, header 1"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"list 1, header 2"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"list 2, item 1"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"list 2, item 2"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"list 3, header 1"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"list 3, header 2"_ustr); - SwDoc* pDoc = pWrtShell->GetDoc(); - pWrtShell->Up(false, 5); - { - sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); - SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; - { - SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); - SwTextNode& rTextNode = *rNode.GetTextNode(); - rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); - rTextNode.SetCountedInList(false); - } - pWrtShell->Down(false, 1); - { - SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); - SwTextNode& rTextNode = *rNode.GetTextNode(); - rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); - rTextNode.SetCountedInList(false); - } - } - pWrtShell->Down(false, 1); - { - sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); - SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; - { - SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); - SwTextNode& rTextNode = *rNode.GetTextNode(); - rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); - } - pWrtShell->Down(false, 1); - { - SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); - SwTextNode& rTextNode = *rNode.GetTextNode(); - rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); - } - } - pWrtShell->Down(false, 1); - { - sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); - SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; - { - SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); - SwTextNode& rTextNode = *rNode.GetTextNode(); - rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); - rTextNode.SetCountedInList(false); - } - pWrtShell->Down(false, 1); - { - SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); - SwTextNode& rTextNode = *rNode.GetTextNode(); - rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); - rTextNode.SetCountedInList(false); - } - } - - // When exporting to ReqIF: - ExportToReqif(); - - // Then make sure the output is valid xhtml: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - - OUString aContent - = getXPathContent(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol/" - "reqif-xhtml:li[@style='display: block']/reqif-xhtml:p"); - CPPUNIT_ASSERT_EQUAL(u"list 1, header 1"_ustr, aContent.trim()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testOleEmfPreviewToHtml) -{ - // Given a document containing an embedded object, with EMF preview: - createSwDoc("ole2.odt"); - - // When exporting to HTML: - ExportToHTML(); - - // Then make sure the tag has matching file extension and data: - htmlDocUniquePtr pDoc = parseHtml(maTempFile); - OUString aPath = getXPath(pDoc, "/html/body/p/img", "src"); - // Without the accompanying fix in place, this test would have failed, as aPath was - // ole_html_3978e5f373402b43.JPG, with EMF data. - CPPUNIT_ASSERT(aPath.endsWith("gif")); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testNestedBullets) -{ - // Given a documented with nested lists: - createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->Insert(u"first"_ustr); - sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); - SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; - { - SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); - SwTextNode& rTextNode = *rNode.GetTextNode(); - rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); - rTextNode.SetAttrListLevel(0); - } - pWrtShell->SplitNode(); - pWrtShell->Insert(u"second"_ustr); - { - SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); - SwTextNode& rTextNode = *rNode.GetTextNode(); - rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); - rTextNode.SetAttrListLevel(1); - } - - // When exporting to xhtml: - ExportToReqif(); - - // Then make sure that there is a
  • between the outer and the inner
      : - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - // Without the accompanying fix in place, this test would have failed with: - // - XPath '//reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p' not found - // i.e. the
    1. inside the outer
        was missing. - assertXPathContent( - pXmlDoc, "//reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p", - u"second"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTrailingLineBreak) -{ - // Given a document with a trailing line-break: - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->Insert(u"test\n"_ustr); - - // When exporting to reqif-xhtml: - ExportToReqif(); - - // Then make sure that we still have a single line-break: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: 1 - // - Actual : 2 - // - XPath '//reqif-xhtml:br' number of nodes is incorrect - assertXPath(pXmlDoc, "//reqif-xhtml:br", 1); - - // Then test the import side: - // Given an empty document: - // When importing a
        from reqif-xhtml: - ImportFromReqif(maTempFile.GetURL()); - - // Then make sure that line-break is not lost: - pWrtShell = getSwDocShell()->GetWrtShell(); - OUString aActual = pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText(); - // Without the accompanying fix in place, this test would have failed, as the trailing - // line-break was lost. - CPPUNIT_ASSERT_EQUAL(u"test\n"_ustr, aActual); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTab) -{ - // Given a document with leading tabs: - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->Insert(u"\t first"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"\t\t second"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"thi \t rd"_ustr); - - // When exporting to HTML, using LeadingTabWidth=2: - uno::Sequence aStoreProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"LeadingTabWidth"_ustr, static_cast(2)), - }; - saveWithParams(aStoreProperties); - - // Then make sure that leading tabs are replaced with 2 nbsps: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: first - // - Actual : first - // i.e. the leading tab was not replaced by 2 nbsps. - assertXPathContent(pXmlDoc, "//reqif-xhtml:p[1]", u"\xa0\xa0 first"); - // Test a leading tab that is not at the start of the paragraph: - assertXPathContent(pXmlDoc, "//reqif-xhtml:p[2]", u"\xa0\xa0\xa0\xa0 second"); - // Test a tab which is not leading: - assertXPathContent(pXmlDoc, "//reqif-xhtml:p[3]", u"thi \t rd"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTabHTML) -{ - // Given a document with leading tabs: - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->Insert(u"\t test"_ustr); - - // When exporting to plain HTML, using LeadingTabWidth=2: - uno::Sequence aStoreProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"LeadingTabWidth"_ustr, static_cast(2)), - }; - saveWithParams(aStoreProperties); - - // Then make sure that leading tabs are replaced with 2 nbsps: - htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); - CPPUNIT_ASSERT(pHtmlDoc); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: test - // - Actual : test - // i.e. the leading tab was not replaced by 2 nbsps. - assertXPathContent(pHtmlDoc, "/html/body/p", SAL_NEWLINE_STRING u"\xa0\xa0 test"); -} - -CPPUNIT_TEST_FIXTURE(HtmlExportTest, testClearingBreak) -{ - auto verify = [this]() { - uno::Reference xParagraph(getParagraph(1), uno::UNO_QUERY); - uno::Reference xPortions = xParagraph->createEnumeration(); - uno::Reference xPortion; - OUString aPortionType; - while (true) - { - // Ignore leading comments. - xPortion.set(xPortions->nextElement(), uno::UNO_QUERY); - xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; - if (aPortionType != "Annotation") - { - break; - } - } - // Skip "foo". - // Without the accompanying fix in place, this test would have failed with: - // An uncaught exception of type com.sun.star.container.NoSuchElementException - // i.e. the first para was just comments + text portion, the clearing break was lost. - xPortion.set(xPortions->nextElement(), uno::UNO_QUERY); - xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; - CPPUNIT_ASSERT_EQUAL(u"LineBreak"_ustr, aPortionType); - uno::Reference xLineBreak; - xPortion->getPropertyValue(u"LineBreak"_ustr) >>= xLineBreak; - sal_Int16 eClear{}; - uno::Reference xLineBreakProps(xLineBreak, uno::UNO_QUERY); - xLineBreakProps->getPropertyValue(u"Clear"_ustr) >>= eClear; - CPPUNIT_ASSERT_EQUAL(static_cast(SwLineBreakClear::ALL), eClear); - }; - - // Given a document with an at-para anchored image + a clearing break: - // When loading that file: - createSwWebDoc("clearing-break.html"); - // Then make sure that the clear property of the break is not ignored: - verify(); - saveAndReload(mpFilter); - // Make sure that the clear property of the break is not ignored during export: - verify(); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTableBackground) -{ - // Given a document with two tables: first stable has a background, second table has a - // background in its first row: - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - SwInsertTableOptions aInsertTableOptions(SwInsertTableFlags::DefaultBorder, - /*nRowsToRepeat=*/0); - pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/1, /*nCols=*/1); - pWrtShell->MoveTable(GotoPrevTable, fnTableStart); - SvxBrushItem aBrush(COL_LIGHTRED, RES_BACKGROUND); - pWrtShell->SetTabBackground(aBrush); - pWrtShell->Down(/*bSelect=*/false); - pWrtShell->SplitNode(); - pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/2, /*nCols=*/1); - pWrtShell->MoveTable(GotoPrevTable, fnTableStart); - aBrush.SetColor(COL_LIGHTGREEN); - pWrtShell->SetRowBackground(aBrush); - pWrtShell->Down(/*bSelect=*/false); - // Second row has an explicit transparent background. - aBrush.SetColor(COL_TRANSPARENT); - pWrtShell->SetRowBackground(aBrush); - - // When exporting to reqif-xhtml: - ExportToReqif(); - - // Then make sure that CSS markup is used, not HTML one: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - // Without the accompanying fix in place, this test would have failed with: - // - XPath '//reqif-xhtml:table[1]' no attribute 'style' exist - // i.e. HTML markup was used for the table background color. - assertXPath(pXmlDoc, "//reqif-xhtml:table[1]", "style", u"background: #ff0000"); - assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:table[1]", "bgcolor"); - assertXPath(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "style", - u"background: #00ff00"); - assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "bgcolor"); - // Second row has no explicit style, the default is not written. - assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[2]", "style"); -} - -CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio) -{ - // Given a document with an image: width is relative, height is "keep ratio": - createSwDoc(); - uno::Reference xFactory(mxComponent, uno::UNO_QUERY); - uno::Reference xTextGraphic( - xFactory->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); - xTextGraphic->setPropertyValue(u"AnchorType"_ustr, - uno::Any(text::TextContentAnchorType_AS_CHARACTER)); - xTextGraphic->setPropertyValue(u"RelativeWidth"_ustr, uno::Any(static_cast(42))); - xTextGraphic->setPropertyValue(u"IsSyncHeightToWidth"_ustr, uno::Any(true)); - uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference xBodyText = xTextDocument->getText(); - uno::Reference xCursor(xBodyText->createTextCursor()); - uno::Reference xTextContent(xTextGraphic, uno::UNO_QUERY); - xBodyText->insertTextContent(xCursor, xTextContent, false); - - // When exporting to HTML: - save(mpFilter); - - // Then make sure that the width is not a fixed size, that would break on resizing the browser - // window: - htmlDocUniquePtr pDoc = parseHtml(maTempFile); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: auto - // - Actual : 2 - // i.e. a static (CSS pixel) height was written. - assertXPath(pDoc, "/html/body/p/img", "height", u"auto"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir) -{ - // Given a document with a section: - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->Insert(u"test"_ustr); - pWrtShell->SelAll(); - SwSectionData aSectionData(SectionType::Content, u"mysect"_ustr); - pWrtShell->InsertSection(aSectionData); - - // When exporting to (reqif-)xhtml: - ExportToReqif(); - - // Then make sure CSS is used to export the text direction of the section: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - // Without the accompanying fix in place, this test would have failed with: - // - XPath '//reqif-xhtml:div[@id='mysect']' no attribute 'style' exist - // i.e. the dir="ltr" HTML attribute was used instead. - assertXPath(pXmlDoc, "//reqif-xhtml:div[@id='mysect']", "style", u"dir: ltr"); -} - -CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf114769) -{ - // Create document from scratch since relative urls to filesystem can be replaced - // by absolute during save/load - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->Insert(u"Hyperlink1"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"Hyperlink2"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"Hyperlink3"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"Hyperlink4"_ustr); - pWrtShell->SplitNode(); - pWrtShell->Insert(u"Hyperlink5"_ustr); - pWrtShell->SplitNode(); - - // Normal external URL - uno::Reference xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); - xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"http://libreoffice.org/"_ustr)); - - // Bookmark reference - xRun.set(getRun(getParagraph(2), 1), uno::UNO_QUERY); - xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"#some_bookmark"_ustr)); - - // Filesystem absolute link - xRun.set(getRun(getParagraph(3), 1), uno::UNO_QUERY); - xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"C:\\test.txt"_ustr)); - - // Filesystem relative link - xRun.set(getRun(getParagraph(4), 1), uno::UNO_QUERY); - xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"..\\..\\test.odt"_ustr)); - - // Filesystem relative link - xRun.set(getRun(getParagraph(5), 1), uno::UNO_QUERY); - xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u".\\another.odt"_ustr)); - - // Export - save(mpFilter); - - htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); - CPPUNIT_ASSERT(pHtmlDoc); - - assertXPath(pHtmlDoc, "/html/body/p[1]/a", "href", u"http://libreoffice.org/"); - assertXPath(pHtmlDoc, "/html/body/p[2]/a", "href", u"#some_bookmark"); - assertXPath(pHtmlDoc, "/html/body/p[3]/a", "href", u"C:\\test.txt"); - assertXPath(pHtmlDoc, "/html/body/p[4]/a", "href", u"..\\..\\test.odt"); - assertXPath(pHtmlDoc, "/html/body/p[5]/a", "href", u".\\another.odt"); -} - -CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf153923) -{ - createSwDoc("TableWithIndent.fodt"); - save(mpFilter); - - // Parse it as XML (strict!) - xmlDocUniquePtr pDoc = parseXml(maTempFile); - // Without the fix in place, this would fail - CPPUNIT_ASSERT(pDoc); - - assertXPath(pDoc, "/html/body//dl", 3); - // The 'dd' tag was not closed - assertXPath(pDoc, "/html/body//dd", 3); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf153923_ReqIF) -{ - createSwDoc("TableWithIndent.fodt"); - ExportToReqif(); - - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - assertXPath(pDoc, "//reqif-xhtml:table"); - // There should be no 'dd' or 'dl' tags, used as a hack for table indentation - assertXPath(pDoc, "//reqif-xhtml:dl", 0); - assertXPath(pDoc, "//reqif-xhtml:dd", 0); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfTransparentTifImg) -{ - // reqIf export must keep the TIF encoding of the image - createSwDoc("reqif-transparent-tif-img.odt"); - ExportToReqif(); - - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object[1]", "type", u"image/tiff"); - OUString imageName = getXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object[1]", "data"); - // Without the accompanying fix in place, this test would have failed, - // ending with .gif, because XOutFlags::UseGifIfSensible flag combined - // with the transparent image would result in GIF export - CPPUNIT_ASSERT(imageName.endsWith(".tif")); - - INetURLObject aURL(maTempFile.GetURL()); - aURL.setName(imageName); - GraphicDescriptor aDescriptor(aURL); - aDescriptor.Detect(); - CPPUNIT_ASSERT_EQUAL(GraphicFileFormat::TIF, aDescriptor.GetFileFormat()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf155387) -{ - createSwDoc("sub_li_and_ctd.fodt"); - ExportToReqif(); - - // Without the fix in place, this would fail - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - // Single top-level list - assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul"); - // Single top-level item - assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li"); - // 4 top-level paragraphs in the item - assertXPath(pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:p", 4); - // 2 sublists in the item - assertXPath( - pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:ul", 2); - // 2 items in the first sublist - assertXPath(pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:ul[1]/" - "reqif-xhtml:li", - 2); - // Check the last (most nested) subitem's text - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:ul[2]/" - "reqif-xhtml:li/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:p", - u"l3"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf155496) -{ - createSwDoc("listItemSubheader.fodt"); - ExportToReqif(); - - // Without the fix in place, this would fail - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - // Two top-level lists - assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul", 2); - // Single top-level item - assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li"); - // One top-level paragraph in the item - assertXPath(pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li/reqif-xhtml:p"); - // One sublist in the item - assertXPath( - pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li/reqif-xhtml:ul"); - // One item in the sublist - assertXPath(pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li/reqif-xhtml:ul/" - "reqif-xhtml:li"); - // Check its text - OUString aContent = getXPathContent( - pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li/reqif-xhtml:ul/" - "reqif-xhtml:li/reqif-xhtml:p"); - CPPUNIT_ASSERT_EQUAL(u"list 1 item 1\n\t\tsub-header"_ustr, aContent.trim()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_RightAlignedTable) -{ - createSwDoc("tableRight.fodt"); - ExportToReqif(); - - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - // No 'align' attribute must be present in 'div' - assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:div", "align"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ListsWithNumFormat) -{ - createSwDoc("listsWithNumFormat.fodt"); - ExportToReqif(); - - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - // No 'type' attribute must be present in 'ol' - assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[1]", "type"); - assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[2]", "type"); - assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[3]", "type"); - assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[4]", "type"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf155871) -{ - createSwDoc("tdf155871.fodt"); - ExportToReqif(); - - // Without the fix in place, this would fail - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ListsNoStartAttribute) -{ - createSwDoc("twoListsWithSameStyle.fodt"); - ExportToReqif(); - - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - // No 'start' attribute must be present in 'ol' - assertXPath(pDoc, "//reqif-xhtml:ol[@start]", 0); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_FrameTextAsObjectAltText) -{ - createSwDoc("frameWithText.fodt"); - ExportToReqif(); - - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - // Without the fix, this would fail with - // - Expected: Some text in frame & - // - Actual : Frame1 - // i.e., frame name was used as the object element content, not frame text - assertXPathContent(pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]/reqif-xhtml:object", - u"Some text in frame & "); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSingleOleExport) -{ - // Given a document containing an embedded OLE object: - createSwDoc("ole2.odt"); - - // Create a selection for that object: - auto xDrawPageSupplier(mxComponent.queryThrow()); - auto xDrawPage(xDrawPageSupplier->getDrawPage()); - auto xModel(mxComponent.queryThrow()); - auto xController(xModel->getCurrentController().queryThrow()); - xController->select(xDrawPage->getByIndex(0)); - - // Store only the selection - css::uno::Sequence aStoreProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"RTFOLEMimeType"_ustr, u"text/rtf"_ustr), - comphelper::makePropertyValue(u"SelectionOnly"_ustr, true), - }; - saveWithParams(aStoreProperties); - - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - - // The root element must be reqif-xhtml:object - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:object", "type", u"text/rtf"); - // It has no children - assertXPathChildren(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:object", 0); - // And the content is empty - assertXPathContent(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:object", u""); - - OUString aRtfData = getXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:object", "data"); - INetURLObject aUrl(maTempFile.GetURL()); - aUrl.setName(aRtfData); - SvMemoryStream aRtf; - HtmlExportTest::wrapRtfFragment(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), aRtf); - tools::SvRef xReader(new TestReqIfRtfReader(aRtf)); - // The RTF OLE exports correctly - CPPUNIT_ASSERT(xReader->CallParser() != SvParserState::Error); - CPPUNIT_ASSERT_EQUAL(tools::Long(9358), xReader->GetObjw()); - CPPUNIT_ASSERT_EQUAL(tools::Long(450), xReader->GetObjh()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_Tdf156602) -{ - createSwDoc("NestingInA1.fodt"); - ExportToReqif(); - - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - // The outer table must be kept in the document where the outer table is the first element, - // and its A1 starts with a nested table - - // Only two sub-elements must be inside the div: an outer table and a trailing paragraph - assertXPathChildren(pDoc, "/reqif-xhtml:html/reqif-xhtml:div", 2); - // The outer table must have exactly two rows - assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr", 2); - // First outer table cell must have two sub-elements: an inner table and a trailing paragraph - assertXPathChildren( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]", - 2); - // The inner table must have exactly two rows - assertXPath( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" - "reqif-xhtml:table/reqif-xhtml:tr", - 2); - // Check all the elements' content - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" - "reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/reqif-xhtml:p", - u"Inner.A1"); - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" - "reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[2]/reqif-xhtml:p", - u"Inner.B1"); - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" - "reqif-xhtml:table/reqif-xhtml:tr[2]/reqif-xhtml:td[1]/reqif-xhtml:p", - u"Inner.A2"); - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" - "reqif-xhtml:table/reqif-xhtml:tr[2]/reqif-xhtml:td[2]/reqif-xhtml:p", - u"Inner.B2"); - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" - "reqif-xhtml:p", - u"Outer.A1"); - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[2]/" - "reqif-xhtml:p", - u"Outer.B1"); - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[2]/reqif-xhtml:td[1]/" - "reqif-xhtml:p", - u"Outer.A2"); - assertXPathContent( - pDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[2]/reqif-xhtml:td[2]/" - "reqif-xhtml:p", - u"Outer.B2"); - assertXPathContent(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p", u"Following text"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf156647_CellPaddingRoundtrip) -{ - // Given a document with a table with cell padding: - createSwDoc("table_cell_padding.fodt"); - { - auto xTable = getParagraphOrTable(1); - auto aTableBorder = getProperty(xTable, u"TableBorder2"_ustr); - CPPUNIT_ASSERT_EQUAL(sal_Int16(1270), aTableBorder.Distance); - CPPUNIT_ASSERT(aTableBorder.IsDistanceValid); - } - // When exporting to reqif-xhtml: - ExportToReqif(); - // Make sure that we export it: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - assertXPath(pXmlDoc, "//reqif-xhtml:table", "cellpadding", u"48"); // px - // Now import it - ImportFromReqif(maTempFile.GetURL()); - // Then make sure that padding is not lost: - { - auto xTable = getParagraphOrTable(1); - auto aTableBorder = getProperty(xTable, u"TableBorder2"_ustr); - // Without the accompanying fix in place, this test would have failed: - // - Expected: 1270 - // - Actual : 97 - // as the padding was lost, and the default 55 twip padding was used. - CPPUNIT_ASSERT_EQUAL(sal_Int16(1270), aTableBorder.Distance); - CPPUNIT_ASSERT(aTableBorder.IsDistanceValid); - } -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf157643_WideHBorder) -{ - // Given a document with a table with a wide border between its two rows: - createSwDoc("table_with_wide_horizontal_border.fodt"); - // When exporting to reqif-xhtml: - ExportToReqif(); - // Make sure that there's no extra tr's: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr", 2); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_PreserveSpaces) -{ - // Given a document with leading, trailing, and repeating intermediate spaces: - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - static constexpr OUString paraText = u"\t test \t more text \t"_ustr; - pWrtShell->Insert(paraText); - - // When exporting to plain HTML, using PreserveSpaces: - saveWithParams({ - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"PreserveSpaces"_ustr, true), - }); - - // Then make sure that "white-space: pre-wrap" is written into the paragraph's style: - htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); - CPPUNIT_ASSERT(pHtmlDoc); - const OUString style = getXPath(pHtmlDoc, "/html/body/p", "style"); - CPPUNIT_ASSERT(style.indexOf("white-space: pre-wrap") >= 0); - // Also check that the paragraph text is correct, without modifications in whitespace - assertXPathContent(pHtmlDoc, "/html/body/p", paraText); - - // Test import - - setImportFilterName(u"HTML (StarWriter)"_ustr); - loadFromURL(maTempFile.GetURL()); - CPPUNIT_ASSERT_EQUAL(paraText, getParagraph(1)->getString()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_PreserveSpaces) -{ - // Given a document with leading, trailing, and repeating intermediate spaces: - createSwDoc(); - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - static constexpr OUString paraText = u"\t test \t more text \t"_ustr; - pWrtShell->Insert(paraText); - - // When exporting to ReqIF, using PreserveSpaces: - saveWithParams({ - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"PreserveSpaces"_ustr, true), - }); - - // Then make sure that xml:space="preserve" attribute exists in the paragraph element: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p", "space", u"preserve"); - // Also check that the paragraph text is correct, without modifications in whitespace - assertXPathContent(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p", paraText); - - // Test import - - setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); - setImportFilterName(u"HTML (StarWriter)"_ustr); - loadFromURL(maTempFile.GetURL()); - CPPUNIT_ASSERT_EQUAL(paraText, getParagraph(1)->getString()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_NoPreserveSpaces) -{ - // Test cases where "PreserveSpaces" should not introduce respective markup - - const auto assertXPath_NoWhiteSpaceInStyle - = [this](const xmlDocUniquePtr& pDoc, const char* pXPath) { - xmlXPathObjectPtr pXmlObj = getXPathNode(pDoc, pXPath); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL_MESSAGE(pXPath, 1, xmlXPathNodeSetGetLength(pXmlNodes)); - CPPUNIT_ASSERT(pXmlNodes); - xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; - if (xmlChar* prop = xmlGetProp(pXmlNode, BAD_CAST("style"))) - { - OUString style = OUString::fromUtf8(reinterpret_cast(prop)); - CPPUNIT_ASSERT_MESSAGE(pXPath, style.indexOf("white-space:") < 0); - } - xmlXPathFreeObject(pXmlObj); - }; - const auto assertXPath_HasWhiteSpaceInStyle - = [this](const xmlDocUniquePtr& pDoc, const char* pXPath) { - const OUString style = getXPath(pDoc, pXPath, "style"); - CPPUNIT_ASSERT_MESSAGE(pXPath, style.indexOf("white-space: pre-wrap") >= 0); - }; - - createSwDoc("test_no_space_preserve.fodt"); - - // Export to plain HTML, using PreserveSpaces: - saveWithParams({ - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"PreserveSpaces"_ustr, true), - }); - - htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); - CPPUNIT_ASSERT(pHtmlDoc); - - // No whitespace preservation, where no leading / trailing / double whitespace - assertXPath_NoWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[1]"); - // Whitespace preserved for a leading space - assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[2]"); - // Whitespace preserved for a trailing space - assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[3]"); - // Whitespace preserved for a double space - assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[4]"); - // No whitespace preservation for leading / trailing breaks - assertXPath_NoWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[5]"); - // Whitespace preserved for a leading break + space - assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[6]"); - // Whitespace preserved for a trailing space + break - assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[7]"); - // No whitespace preservation for a middle break - assertXPath_NoWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[8]"); - // Whitespace preserved for a middle space + break - assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[9]"); - // Whitespace preserved for a middle break + space - assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[10]"); - // No whitespace preservation for a trailing space and SVG - assertXPath_NoWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[11]"); - - // Test import - - setImportFilterName(u"HTML (StarWriter)"_ustr); - loadFromURL(maTempFile.GetURL()); - - CPPUNIT_ASSERT_EQUAL(u"No special spaces"_ustr, getParagraph(1)->getString()); - CPPUNIT_ASSERT_EQUAL(u" Leading space"_ustr, getParagraph(2)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Trailing space "_ustr, getParagraph(3)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Double space"_ustr, getParagraph(4)->getString()); - // Trailing break is removed in SwHTMLParser::AppendTextNode, and replaced with para spacing - CPPUNIT_ASSERT_EQUAL(u"\nLeading/trailing breaks"_ustr, getParagraph(5)->getString()); - CPPUNIT_ASSERT_EQUAL(u"\n Leading break + space"_ustr, getParagraph(6)->getString()); - // Trailing break is removed in SwHTMLParser::AppendTextNode, and replaced with para spacing - CPPUNIT_ASSERT_EQUAL(u"Trailing space + break "_ustr, getParagraph(7)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Middle\nbreak"_ustr, getParagraph(8)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Middle space \n+ break"_ustr, getParagraph(9)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Middle break\n + space"_ustr, getParagraph(10)->getString()); - // The SVG is replaced by a space in SwXParagraph::getString() - CPPUNIT_ASSERT_EQUAL(u"Trailing space and SVG "_ustr, getParagraph(11)->getString()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_NoPreserveSpaces) -{ - // Test cases where "PreserveSpaces" should not introduce respective markup - - createSwDoc("test_no_space_preserve.fodt"); - - // Export to ReqIF, using PreserveSpaces: - saveWithParams({ - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"PreserveSpaces"_ustr, true), - }); - - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - - // No whitespace preservation, where no leading / trailing / double whitespace - assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[1]", "space"); - // Whitespace preserved for a leading space - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]", "space", - u"preserve"); - // Whitespace preserved for a trailing space - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[3]", "space", - u"preserve"); - // Whitespace preserved for a double space - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[4]", "space", - u"preserve"); - // No whitespace preservation for leading / trailing breaks - assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[5]", "space"); - // Whitespace preserved for a leading break + space - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[6]", "space", - u"preserve"); - // No whitespace preservation for a trailing space + break - assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[7]", "space"); - // No whitespace preservation for a middle break - assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[8]", "space"); - // No whitespace preservation for a middle space + break - assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[9]", "space"); - // Whitespace preserved for a middle break + space - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[10]", "space", - u"preserve"); - // No whitespace preservation for a trailing space and SVG - assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[11]", "space"); - - // Test import - - setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); - setImportFilterName(u"HTML (StarWriter)"_ustr); - loadFromURL(maTempFile.GetURL()); - - CPPUNIT_ASSERT_EQUAL(u"No special spaces"_ustr, getParagraph(1)->getString()); - CPPUNIT_ASSERT_EQUAL(u" Leading space"_ustr, getParagraph(2)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Trailing space "_ustr, getParagraph(3)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Double space"_ustr, getParagraph(4)->getString()); - CPPUNIT_ASSERT_EQUAL(u"\nLeading/trailing breaks\n"_ustr, getParagraph(5)->getString()); - CPPUNIT_ASSERT_EQUAL(u"\n Leading break + space"_ustr, getParagraph(6)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Trailing space + break \n"_ustr, getParagraph(7)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Middle\nbreak"_ustr, getParagraph(8)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Middle space \n+ break"_ustr, getParagraph(9)->getString()); - CPPUNIT_ASSERT_EQUAL(u"Middle break\n + space"_ustr, getParagraph(10)->getString()); - // The SVG is replaced by a space in SwXParagraph::getString() - CPPUNIT_ASSERT_EQUAL(u"Trailing space and SVG "_ustr, getParagraph(11)->getString()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ExportFormulasAsPDF) -{ - // Given a document with a formula: - createSwDoc("embedded_formula.fodt"); - - // When exporting to reqif with ExportFormulasAsPDF=true: - uno::Sequence aStoreProperties = { - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"ExportFormulasAsPDF"_ustr, true), - }; - saveWithParams(aStoreProperties); - - // Make sure that the formula is exported as PDF: - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]/reqif-xhtml:object", - "type", u"application/pdf"); - - css::uno::Sequence descr{ - comphelper::makePropertyValue(u"URL"_ustr, GetObjectPath(u".pdf"_ustr)), - }; - - uno::Reference xFactory( - comphelper::getProcessComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW); - uno::Reference xTypeDetection( - xFactory->createInstance(u"com.sun.star.document.TypeDetection"_ustr), - uno::UNO_QUERY_THROW); - - CPPUNIT_ASSERT_EQUAL(u"pdf_Portable_Document_Format"_ustr, - xTypeDetection->queryTypeByDescriptor(descr, true)); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_NoBrClearForImageWrap) -{ - // Given a document with a paragraph-anchored image with "none" wrap: - createSwDoc("image_anchored_to_paragraph_no_wrap.fodt"); - // When exporting to reqif: - ExportToReqif(); - // Make sure that there's no 'br' elements in the 'object' (used to represent the wrapping - // in HTML export, using 'clear' attribute): - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object"); - assertXPath(pXmlDoc, - "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:br", - 0); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_Tdf160017_spanClosingOrder) -{ - // Given a document with a paragraph having explicit font color and character border properties: - createSwDoc("char_border_and_font_color.fodt"); - // When exporting to reqif: - ExportToReqif(); - // Without the fix, this would fail, because there was an extra closing - WrapReqifFromTempFile(); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160017_spanClosingOrder) -{ - // Given a document with a paragraph having explicit font color and character border properties: - createSwDoc("char_border_and_font_color.fodt"); - // When exporting to HTML: - ExportToHTML(); - // Parse it as XML (strict!) - // Without the fix, this would fail, because span and font elements closed in wrong order - CPPUNIT_ASSERT(parseXml(maTempFile)); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160390) -{ - // This document must not hang infinitely on HTML export - createSwDoc("tdf160390.fodt"); - ExportToHTML(); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_160867) -{ - // Given a document with an image with hyperlink, and text with hyperlink, both in a frame: - createSwDoc("tdf160867_image_with_link.fodt"); - // When exporting to HTML: - ExportToHTML(); - // Parse it as XML (strict!) - xmlDocUniquePtr pDoc = parseXml(maTempFile); - CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/html/body/p", 2); - - // Test export of image and text hyperlinks in the image map. - // Without the fix, the test would fail with - // - Expected: 1 - // - Actual : 0 - // - In <>, XPath '/html/body/p[2]/map' number of nodes is incorrect - const OUString mapName = getXPath(pDoc, "/html/body/p[2]/map", "name"); - assertXPath(pDoc, "/html/body/p[2]/map/area[1]", "shape", u"rect"); - CPPUNIT_ASSERT(getXPath(pDoc, "/html/body/p[2]/map/area[1]", "href").endsWith("foo/bar")); - assertXPath(pDoc, "/html/body/p[2]/map/area[2]", "shape", u"rect"); - CPPUNIT_ASSERT(getXPath(pDoc, "/html/body/p[2]/map/area[2]", "href").endsWith("baz")); - assertXPath(pDoc, "/html/body/p[2]/img", "usemap", Concat2View("#" + mapName)); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_160867) -{ - // Given a document with an image with hyperlink, and text with hyperlink, both in a frame: - createSwDoc("tdf160867_image_with_link.fodt"); - // When exporting to reqif: - ExportToReqif(); - // For now, we don't (yet) output the whole map in ReqIF case. - // Make sure that the first hyperlink from the objects in the frame is output as an element - // around the whole image of the frame. - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - assertXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a/reqif-xhtml:object"); - CPPUNIT_ASSERT( - getXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", "href").endsWith("foo/bar")); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_161979) -{ - // Given a document with two embedded metafiles: - createSwDoc("tdf161979_metafile.fodt"); - ExportToHTML(); - xmlDocUniquePtr pDoc = parseXml(maTempFile); - CPPUNIT_ASSERT(pDoc); - // First image: it has no EMF+ actions, and didn't use canvas rendering before the fix; - // yet, it didn't export correctly. - OUString imgName = getXPath(pDoc, "/html/body/p[2]/img", "src"); - CPPUNIT_ASSERT(imgName.endsWith(".gif")); - INetURLObject aUrl(maTempFile.GetURL()); - aUrl.setName(imgName); - Graphic graphic; - CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, GraphicFilter().ImportGraphic(graphic, aUrl)); - - // Check that only ~4% of pixels are not transparent (before the fix, it was completely black) - BitmapEx bitmap = graphic.GetBitmapEx(); - Size size = bitmap.GetSizePixel(); - int numNonTransparent = 0; - for (tools::Long y = 0; y < size.Height(); ++y) - for (tools::Long x = 0; x < size.Width(); ++x) - if (bitmap.GetPixelColor(x, y) != COL_TRANSPARENT) - ++numNonTransparent; - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.04, numNonTransparent / double(size.Height() * size.Width()), - 0.01); - - // Second image: it consists of EMF+ records (no EMF fallback). It used canvas rendering - // before the fix; it also didn't export correctly. - imgName = getXPath(pDoc, "/html/body/p[4]/img", "src"); - CPPUNIT_ASSERT(imgName.endsWith(".gif")); - aUrl.SetURL(maTempFile.GetURL()); - aUrl.setName(imgName); - graphic.Clear(); - CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, GraphicFilter().ImportGraphic(graphic, aUrl)); - - // Check that some pixels are transparent (before the fix, it was completely black) - bitmap = graphic.GetBitmapEx(); - size = bitmap.GetSizePixel(); - numNonTransparent = 0; - for (tools::Long y = 0; y < size.Height(); ++y) - for (tools::Long x = 0; x < size.Width(); ++x) - if (bitmap.GetPixelColor(x, y) != COL_TRANSPARENT) - ++numNonTransparent; - CPPUNIT_ASSERT(numNonTransparent > 0); - CPPUNIT_ASSERT(numNonTransparent < size.Height() * size.Width()); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_exportAbsoluteURLs_ownRelative) -{ - auto pBatch(comphelper::ConfigurationChanges::create()); - Resetter resetter([ - bInternetPreviousValue = officecfg::Office::Common::Save::URL::Internet::get(), - bFileSystemPreviousValue = officecfg::Office::Common::Save::URL::FileSystem::get(), pBatch - ]() { - officecfg::Office::Common::Save::URL::Internet::set(bInternetPreviousValue, pBatch); - officecfg::Office::Common::Save::URL::FileSystem::set(bFileSystemPreviousValue, pBatch); - return pBatch->commit(); - }); - // Set saving absolute URLs - officecfg::Office::Common::Save::URL::Internet::set(false, pBatch); - officecfg::Office::Common::Save::URL::FileSystem::set(false, pBatch); - pBatch->commit(); - - createSwDoc("URLs.odt"); - // Export to ReqIF, using absolute URLs - saveWithParams({ - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true), - comphelper::makePropertyValue(u"RelativeOwnObjectURL"_ustr, true), - }); - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - - // HTTP URL: must be absolute - assertXPath(pXmlDoc, "//reqif-xhtml:p[1]/reqif-xhtml:a", "href", u"http://www.example.org/"); - // file URL: must be absolute - assertXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", "href", - createFileURL(u"NonExistingPath/NonExistingFile.html")); - // form URL: must be absolute - assertXPath(pXmlDoc, "//reqif-xhtml:form", "action", u"https://www.example.org/submit"); - // linked image exported as object: generated, must be relative - OUString url = getXPath(pXmlDoc, "//reqif-xhtml:p[3]/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".ole")); - // its original image URL: must be absolute - assertXPath(pXmlDoc, "//reqif-xhtml:p[3]/reqif-xhtml:object/reqif-xhtml:object", "data", - createFileURL(u"external.png")); - // embedded image exported as object: generated, must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[4]/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".ole")); - // its image URL: generated, must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[4]/reqif-xhtml:object/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".png")); - // unordered list with image bullet - it gets embedded as base64 data - OUString style = getXPath(pXmlDoc, "//reqif-xhtml:ul", "style"); - CPPUNIT_ASSERT(style.indexOf("list-style-image: url(data:image/png;base64,") != -1); - // an as-char frame, exported as a whole to an object, must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".ole")); - // its file hyperlink must be absolute - assertXPath(pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object/reqif-xhtml:a", "href", - createFileURL(u"foo/bar")); - // its image URL: generated, must be relative - url = getXPath( - pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object/reqif-xhtml:a/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".png")); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_exportRelativeURLs) -{ - CPPUNIT_ASSERT(officecfg::Office::Common::Save::URL::Internet::get()); - CPPUNIT_ASSERT(officecfg::Office::Common::Save::URL::FileSystem::get()); - - createSwDoc("URLs.odt"); - // Export to ReqIF, using relative URLs (the default) - saveWithParams({ - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), - comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true), - }); - xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); - - // HTTP URL: must be absolute - assertXPath(pXmlDoc, "//reqif-xhtml:p[1]/reqif-xhtml:a", "href", u"http://www.example.org/"); - // file URL: must be relative - OUString url = getXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", "href"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith("NonExistingPath/NonExistingFile.html")); - // form URL: must be absolute - assertXPath(pXmlDoc, "//reqif-xhtml:form", "action", u"https://www.example.org/submit"); - // linked image exported as object: generated, must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[3]/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".ole")); - // its original image URL: must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[3]/reqif-xhtml:object/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith("external.png")); - // embedded image exported as object: generated, must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[4]/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".ole")); - // its image URL: generated, must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[4]/reqif-xhtml:object/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".png")); - // unordered list with image bullet - it gets embedded as base64 data - OUString style = getXPath(pXmlDoc, "//reqif-xhtml:ul", "style"); - CPPUNIT_ASSERT(style.indexOf("list-style-image: url(data:image/png;base64,") != -1); - // an as-char frame, exported as a whole to an object, must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".ole")); - // its file hyperlink must be relative - url = getXPath(pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object/reqif-xhtml:a", "href"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith("foo/bar")); - // its image URL: generated, must be relative - url = getXPath( - pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object/reqif-xhtml:a/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".png")); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_exportAbsoluteURLs_ownRelative) -{ - auto pBatch(comphelper::ConfigurationChanges::create()); - Resetter resetter([ - bInternetPreviousValue = officecfg::Office::Common::Save::URL::Internet::get(), - bFileSystemPreviousValue = officecfg::Office::Common::Save::URL::FileSystem::get(), pBatch - ]() { - officecfg::Office::Common::Save::URL::Internet::set(bInternetPreviousValue, pBatch); - officecfg::Office::Common::Save::URL::FileSystem::set(bFileSystemPreviousValue, pBatch); - return pBatch->commit(); - }); - // Set saving absolute URLs - officecfg::Office::Common::Save::URL::Internet::set(false, pBatch); - officecfg::Office::Common::Save::URL::FileSystem::set(false, pBatch); - pBatch->commit(); - - createSwDoc("URLs.odt"); - // Export to HTML, using absolute URLs - saveWithParams({ - comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), - comphelper::makePropertyValue(u"RelativeOwnObjectURL"_ustr, true), - }); - htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); - - // HTTP URL: must be absolute - assertXPath(pHtmlDoc, "//p[1]/a", "href", u"http://www.example.org/"); - // file URL: must be absolute - assertXPath(pHtmlDoc, "//p[2]/a", "href", - createFileURL(u"NonExistingPath/NonExistingFile.html")); - // form URL: must be absolute - assertXPath(pHtmlDoc, "//form", "action", u"https://www.example.org/submit"); - // linked image: must be absolute - assertXPath(pHtmlDoc, "//p[3]/img", "src", createFileURL(u"external.png")); - // embedded image: generated, must be relative - OUString url = getXPath(pHtmlDoc, "//p[4]/img", "src"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".png")); - // unordered list with image bullet - it gets embedded as base64 data - OUString style = getXPath(pHtmlDoc, "//ul", "style"); - CPPUNIT_ASSERT(style.indexOf("list-style-image: url(data:image/png;base64,") != -1); - // image-in-frame file hyperlink must be absolute; FIXME: HTMLOutFuncs::Out_ImageMap - // assertXPath(pHtmlDoc, "//p[5]/map/area", "href", createFileURL(u"foo/bar")); - // its image URL: generated, must be relative - url = getXPath(pHtmlDoc, "//p[5]/img", "src"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".gif")); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_exportRelativeURLs) -{ - CPPUNIT_ASSERT(officecfg::Office::Common::Save::URL::Internet::get()); - CPPUNIT_ASSERT(officecfg::Office::Common::Save::URL::FileSystem::get()); - - createSwDoc("URLs.odt"); - // Export to HTML, using relative URLs (the default) - ExportToHTML(); - htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); - - // HTTP URL: must be absolute - assertXPath(pHtmlDoc, "//p[1]/a", "href", u"http://www.example.org/"); - // file URL: must be relative - OUString url = getXPath(pHtmlDoc, "//p[2]/a", "href"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith("NonExistingPath/NonExistingFile.html")); - // form URL: must be absolute - assertXPath(pHtmlDoc, "//form", "action", u"https://www.example.org/submit"); - // linked image: must be relative - url = getXPath(pHtmlDoc, "//p[3]/img", "src"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith("external.png")); - // embedded image: generated, must be relative - url = getXPath(pHtmlDoc, "//p[4]/img", "src"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".png")); - // unordered list with image bullet - it gets embedded as base64 data - OUString style = getXPath(pHtmlDoc, "//ul", "style"); - CPPUNIT_ASSERT(style.indexOf("list-style-image: url(data:image/png;base64,") != -1); - // image-in-frame file hyperlink must be relative - url = getXPath(pHtmlDoc, "//p[5]/map/area", "href"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith("foo/bar")); - // its image URL: generated, must be relative - url = getXPath(pHtmlDoc, "//p[5]/img", "src"); - CPPUNIT_ASSERT(!url.startsWith("file:")); - CPPUNIT_ASSERT(url.endsWith(".gif")); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_162282) -{ - // Given a document with an embedded metafile: - createSwDoc("tdf162282.odt"); - ExportToReqif(); - xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); - - // Check that the exported EMF is exactly the same as in the ODF package - assertXPath(pDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", u"image/x-emf"); - OUString imgName = getXPath(pDoc, "//reqif-xhtml:p/reqif-xhtml:object", "data"); - CPPUNIT_ASSERT(imgName.endsWith(".emf")); - INetURLObject aUrl(maTempFile.GetURL()); - aUrl.setName(imgName); - SvFileStream aEmfStream(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), - StreamMode::READ); - - // without the fix, this would fail with - // - Expected: 220 - // - Actual : 111260 - CPPUNIT_ASSERT_EQUAL(sal_uInt64(220), aEmfStream.TellEnd()); - - css::uno::Sequence emfData(220); - aEmfStream.ReadBytes(emfData.getArray(), emfData.getLength()); - - const css::uno::Sequence correctData{ - 0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xF4, 0x01, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0x20, 0x45, 0x4D, 0x46, 0x00, - 0x00, 0x01, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, - 0x00, 0x38, 0x04, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0xF4, - 0x01, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x2D, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, - 0x00, 0xFA, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, - 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x28, - 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, - 0x2C, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, - 0x00, 0xC8, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, - }; - CPPUNIT_ASSERT_EQUAL(correctData, emfData); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_162426) -{ - // Given a document with an image with style:wrap="none": - createSwDoc("tdf162426_image_with_wrap_none.fodt"); - // Before the fix, an assertion failed in HtmlWriter::attribute when exporting to HTML : - ExportToHTML(); - - xmlDocUniquePtr pDoc = parseXml(maTempFile); - CPPUNIT_ASSERT(pDoc); - - // Before the fix, the 'border' attribute was written after the 'img' tag was already closed, - // so without the assertion, this would fail with - // - In <>, XPath '/html/body/p/img' no attribute 'border' exist - assertXPath(pDoc, "/html/body/p/img", "border", u"0"); -} - -CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_163873) -{ - // Given a document with an image with style:wrap="none": - createSwDoc("tdf131728.docx"); - // Before the fix, an assertion failed in HtmlWriter::attribute when exporting to HTML : - ExportToHTML(); - - xmlDocUniquePtr pDoc = parseXml(maTempFile); - CPPUNIT_ASSERT(pDoc); - - // Before the fix, inline headings weren't inline - assertXPath(pDoc, "/html/body/p[5]/span/h2", "style", u"display:inline;"); - assertXPath(pDoc, "/html/body/p[6]/span/h2", "style", u"display:inline;"); - assertXPath(pDoc, "/html/body/p[7]/span/h2", "style", u"display:inline;"); - assertXPath(pDoc, "/html/body/p[11]/span/h2", "style", u"display:inline;"); - assertXPath(pDoc, "/html/body/p[14]/span/h2", "style", u"display:inline;"); -} - } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/htmlexport/htmlexport2.cxx b/sw/qa/extras/htmlexport/htmlexport2.cxx new file mode 100644 index 000000000000..99e9d5347b15 --- /dev/null +++ b/sw/qa/extras/htmlexport/htmlexport2.cxx @@ -0,0 +1,1612 @@ +/* -*- 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/. + */ + +#include "htmlmodeltestbase.hxx" + +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace +{ +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGShapeAsOLE) +{ + // Given a document with an image shape: + createSwDoc(); + uno::Reference xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference xShape( + xFactory->createInstance(u"com.sun.star.drawing.GraphicObjectShape"_ustr), uno::UNO_QUERY); + xShape->setSize(awt::Size(10000, 10000)); + uno::Reference xShapeProps(xShape, uno::UNO_QUERY); + xShapeProps->setPropertyValue(u"GraphicURL"_ustr, uno::Any(createFileURL(u"ole2.png"))); + uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + xDrawPageSupplier->getDrawPage()->add(xShape); + + // When exporting to XHTML: + uno::Sequence aStoreProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true), + }; + saveWithParams(aStoreProperties); + + // Then make sure the PNG is embedded with an RTF wrapper: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: text/rtf + // - Actual : image/png + // i.e. the OLE wrapper around the PNG was missing. + assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", u"text/rtf"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNG) +{ + // FIXME: the DPI check should be removed when either (1) the test is fixed to work with + // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin. + if (!IsDefaultDPI()) + return; + // Given a document with a shape: + createSwDoc(); + uno::Reference xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference xShape( + xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); + xShape->setSize(awt::Size(10000, 10000)); + uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + xDrawPageSupplier->getDrawPage()->add(xShape); + + // When exporting to XHTML: + ExportToReqif(); + + // Then make sure the shape is embedded as a PNG: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: image/png + // - Actual : image/x-vclgraphic + // i.e. the result was invalid ReqIF. + assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", u"image/png"); + + // Then check the pixel size of the shape: + Size aPixelSize(Application::GetDefaultDevice()->LogicToPixel(Size(10000, 10000), + MapMode(MapUnit::Map100thMM))); + // Without the accompanying fix in place, this test would have failed with: + // - no attribute 'width' exist + // i.e. shapes had no width. + assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "width", + OUString::number(aPixelSize.getWidth())); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testShapeAsImageHtml) +{ + // Given a document with a shape: + createSwDoc(); + uno::Reference xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference xShape( + xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); + xShape->setSize(awt::Size(5080, 2540)); + uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + xDrawPageSupplier->getDrawPage()->add(xShape); + + // When exporting to plain HTML: + saveAndReload(u"HTML (StarWriter)"_ustr); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: + // - Actual : /> + // i.e. the output was not well-formed. + CPPUNIT_ASSERT_EQUAL(u" "_ustr, getParagraph(1)->getString()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testJson) +{ + // Given a document with a shape: + createSwDoc(); + uno::Reference xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference xShape( + xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); + xShape->setSize(awt::Size(2540, 2540)); + uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + xDrawPageSupplier->getDrawPage()->add(xShape); + + // When exporting to HTML, and specifying options as JSON: + setFilterOptions(u"{\"XhtmlNs\":{\"type\":\"string\", \"value\":\"reqif-xhtml\"}," + "\"ShapeDPI\":{\"type\":\"long\",\"value\":\"192\"}}"_ustr); + save(u"HTML (StarWriter)"_ustr); + + // Then make sure those options are not ignored: + // Without the accompanying fix in place, this test would have failed, as GetPngPath() expects + // XML output, but xhtmlns=reqif-xhtml was ignored. + OUString aPngUrl = GetPngPath(); + SvFileStream aFileStream(aPngUrl, StreamMode::READ); + GraphicDescriptor aDescriptor(aFileStream, nullptr); + aDescriptor.Detect(/*bExtendedInfo=*/true); + // Make sure that the increased DPI is taken into account: + tools::Long nExpected = 192; + CPPUNIT_ASSERT_EQUAL(nExpected, aDescriptor.GetSizePixel().getWidth()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNGCustomDPI) +{ + // FIXME: the DPI check should be removed when either (1) the test is fixed to work with + // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin. + if (!IsDefaultDPI()) + return; + // Given a document with a shape: + createSwDoc(); + uno::Reference xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference xShape( + xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); + xShape->setSize(awt::Size(5080, 2540)); + uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + xDrawPageSupplier->getDrawPage()->add(xShape); + sal_Int32 nDPI = 600; + + // When exporting to XHTML: + uno::Sequence aStoreProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"ShapeDPI"_ustr, nDPI), + }; + saveWithParams(aStoreProperties); + + // Then make sure the shape is embedded as a PNG: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", u"image/png"); + + // Then check the pixel size of the shape: + Size aPixelSize(Application::GetDefaultDevice()->LogicToPixel(Size(5080, 2540), + MapMode(MapUnit::Map100thMM))); + tools::Long nPNGWidth = 1200; + OUString aPngUrl = GetPngPath(); + SvFileStream aFileStream(aPngUrl, StreamMode::READ); + GraphicDescriptor aDescriptor(aFileStream, nullptr); + aDescriptor.Detect(/*bExtendedInfo=*/true); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1200 + // - Actual : 1000 + // i.e. first setting a double DPI didn't result in larger pixel width of the PNG, then it was + // limited to 1000 pixels (because the pixel limit was 500k). + CPPUNIT_ASSERT_EQUAL(nPNGWidth, aDescriptor.GetSizePixel().getWidth()); + + // Then make sure the shape's logic size (in CSS pixels) don't change: + assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object", "width", + OUString::number(aPixelSize.getWidth())); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOleBmpTransparent) +{ + // Given a document with a transparent image: + createSwDoc(); + uno::Sequence aArgs = { + comphelper::makePropertyValue(u"FileName"_ustr, createFileURL(u"transparent.png")), + }; + dispatchCommand(mxComponent, u".uno:InsertGraphic"_ustr, aArgs); + + // When exporting to reqif with ExportImagesAsOLE=true: + uno::Sequence aStoreProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true), + }; + saveWithParams(aStoreProperties); + + // Then make sure the transparent pixel turns into white: + SvMemoryStream aOle1; + ParseOle1FromRtfUrl(GetOlePath(), aOle1); + OLE1Reader aOle1Reader(aOle1); + SvMemoryStream aBitmapStream(aOle1Reader.m_aNativeData.data(), aOle1Reader.m_aNativeData.size(), + StreamMode::READ); + Bitmap aBitmap; + ReadDIB(aBitmap, aBitmapStream, /*bFileHeader=*/true); + Size aBitmapSize = aBitmap.GetSizePixel(); + BitmapEx aBitmapEx(aBitmap); + Color nActualColor + = aBitmapEx.GetPixelColor(aBitmapSize.getWidth() - 1, aBitmapSize.getHeight() - 1); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: Color: R:255 G:255 B:255 A:0 + // - Actual : Color: R:0 G:0 B:0 A:0 + // i.e. the bitmap without an alpha channel was black, not white. + CPPUNIT_ASSERT_EQUAL(COL_WHITE, nActualColor); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListsHeading) +{ + // Given a document with lh, lh, li, li, lh and lh nodes: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Insert(u"list 1, header 1"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"list 1, header 2"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"list 2, item 1"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"list 2, item 2"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"list 3, header 1"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"list 3, header 2"_ustr); + SwDoc* pDoc = pWrtShell->GetDoc(); + pWrtShell->Up(false, 5); + { + sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); + SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; + { + SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); + SwTextNode& rTextNode = *rNode.GetTextNode(); + rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); + rTextNode.SetCountedInList(false); + } + pWrtShell->Down(false, 1); + { + SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); + SwTextNode& rTextNode = *rNode.GetTextNode(); + rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); + rTextNode.SetCountedInList(false); + } + } + pWrtShell->Down(false, 1); + { + sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); + SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; + { + SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); + SwTextNode& rTextNode = *rNode.GetTextNode(); + rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); + } + pWrtShell->Down(false, 1); + { + SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); + SwTextNode& rTextNode = *rNode.GetTextNode(); + rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); + } + } + pWrtShell->Down(false, 1); + { + sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); + SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; + { + SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); + SwTextNode& rTextNode = *rNode.GetTextNode(); + rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); + rTextNode.SetCountedInList(false); + } + pWrtShell->Down(false, 1); + { + SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); + SwTextNode& rTextNode = *rNode.GetTextNode(); + rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); + rTextNode.SetCountedInList(false); + } + } + + // When exporting to ReqIF: + ExportToReqif(); + + // Then make sure the output is valid xhtml: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + + OUString aContent + = getXPathContent(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol/" + "reqif-xhtml:li[@style='display: block']/reqif-xhtml:p"); + CPPUNIT_ASSERT_EQUAL(u"list 1, header 1"_ustr, aContent.trim()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testOleEmfPreviewToHtml) +{ + // Given a document containing an embedded object, with EMF preview: + createSwDoc("ole2.odt"); + + // When exporting to HTML: + ExportToHTML(); + + // Then make sure the tag has matching file extension and data: + htmlDocUniquePtr pDoc = parseHtml(maTempFile); + OUString aPath = getXPath(pDoc, "/html/body/p/img", "src"); + // Without the accompanying fix in place, this test would have failed, as aPath was + // ole_html_3978e5f373402b43.JPG, with EMF data. + CPPUNIT_ASSERT(aPath.endsWith("gif")); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testNestedBullets) +{ + // Given a documented with nested lists: + createSwDoc(); + SwDoc* pDoc = getSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Insert(u"first"_ustr); + sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); + SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; + { + SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); + SwTextNode& rTextNode = *rNode.GetTextNode(); + rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); + rTextNode.SetAttrListLevel(0); + } + pWrtShell->SplitNode(); + pWrtShell->Insert(u"second"_ustr); + { + SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->GetNode(); + SwTextNode& rTextNode = *rNode.GetTextNode(); + rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); + rTextNode.SetAttrListLevel(1); + } + + // When exporting to xhtml: + ExportToReqif(); + + // Then make sure that there is a
      1. between the outer and the inner
          : + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + // Without the accompanying fix in place, this test would have failed with: + // - XPath '//reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p' not found + // i.e. the
        1. inside the outer
            was missing. + assertXPathContent( + pXmlDoc, "//reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p", + u"second"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTrailingLineBreak) +{ + // Given a document with a trailing line-break: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Insert(u"test\n"_ustr); + + // When exporting to reqif-xhtml: + ExportToReqif(); + + // Then make sure that we still have a single line-break: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 2 + // - XPath '//reqif-xhtml:br' number of nodes is incorrect + assertXPath(pXmlDoc, "//reqif-xhtml:br", 1); + + // Then test the import side: + // Given an empty document: + // When importing a
            from reqif-xhtml: + ImportFromReqif(maTempFile.GetURL()); + + // Then make sure that line-break is not lost: + pWrtShell = getSwDocShell()->GetWrtShell(); + OUString aActual = pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText(); + // Without the accompanying fix in place, this test would have failed, as the trailing + // line-break was lost. + CPPUNIT_ASSERT_EQUAL(u"test\n"_ustr, aActual); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTab) +{ + // Given a document with leading tabs: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Insert(u"\t first"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"\t\t second"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"thi \t rd"_ustr); + + // When exporting to HTML, using LeadingTabWidth=2: + uno::Sequence aStoreProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"LeadingTabWidth"_ustr, static_cast(2)), + }; + saveWithParams(aStoreProperties); + + // Then make sure that leading tabs are replaced with 2 nbsps: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: first + // - Actual : first + // i.e. the leading tab was not replaced by 2 nbsps. + assertXPathContent(pXmlDoc, "//reqif-xhtml:p[1]", u"\xa0\xa0 first"); + // Test a leading tab that is not at the start of the paragraph: + assertXPathContent(pXmlDoc, "//reqif-xhtml:p[2]", u"\xa0\xa0\xa0\xa0 second"); + // Test a tab which is not leading: + assertXPathContent(pXmlDoc, "//reqif-xhtml:p[3]", u"thi \t rd"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTabHTML) +{ + // Given a document with leading tabs: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Insert(u"\t test"_ustr); + + // When exporting to plain HTML, using LeadingTabWidth=2: + uno::Sequence aStoreProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"LeadingTabWidth"_ustr, static_cast(2)), + }; + saveWithParams(aStoreProperties); + + // Then make sure that leading tabs are replaced with 2 nbsps: + htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); + CPPUNIT_ASSERT(pHtmlDoc); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: test + // - Actual : test + // i.e. the leading tab was not replaced by 2 nbsps. + assertXPathContent(pHtmlDoc, "/html/body/p", SAL_NEWLINE_STRING u"\xa0\xa0 test"); +} + +CPPUNIT_TEST_FIXTURE(HtmlExportTest, testClearingBreak) +{ + auto verify = [this]() { + uno::Reference xParagraph(getParagraph(1), uno::UNO_QUERY); + uno::Reference xPortions = xParagraph->createEnumeration(); + uno::Reference xPortion; + OUString aPortionType; + while (true) + { + // Ignore leading comments. + xPortion.set(xPortions->nextElement(), uno::UNO_QUERY); + xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; + if (aPortionType != "Annotation") + { + break; + } + } + // Skip "foo". + // Without the accompanying fix in place, this test would have failed with: + // An uncaught exception of type com.sun.star.container.NoSuchElementException + // i.e. the first para was just comments + text portion, the clearing break was lost. + xPortion.set(xPortions->nextElement(), uno::UNO_QUERY); + xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; + CPPUNIT_ASSERT_EQUAL(u"LineBreak"_ustr, aPortionType); + uno::Reference xLineBreak; + xPortion->getPropertyValue(u"LineBreak"_ustr) >>= xLineBreak; + sal_Int16 eClear{}; + uno::Reference xLineBreakProps(xLineBreak, uno::UNO_QUERY); + xLineBreakProps->getPropertyValue(u"Clear"_ustr) >>= eClear; + CPPUNIT_ASSERT_EQUAL(static_cast(SwLineBreakClear::ALL), eClear); + }; + + // Given a document with an at-para anchored image + a clearing break: + // When loading that file: + createSwWebDoc("clearing-break.html"); + // Then make sure that the clear property of the break is not ignored: + verify(); + saveAndReload(mpFilter); + // Make sure that the clear property of the break is not ignored during export: + verify(); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTableBackground) +{ + // Given a document with two tables: first stable has a background, second table has a + // background in its first row: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + SwInsertTableOptions aInsertTableOptions(SwInsertTableFlags::DefaultBorder, + /*nRowsToRepeat=*/0); + pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/1, /*nCols=*/1); + pWrtShell->MoveTable(GotoPrevTable, fnTableStart); + SvxBrushItem aBrush(COL_LIGHTRED, RES_BACKGROUND); + pWrtShell->SetTabBackground(aBrush); + pWrtShell->Down(/*bSelect=*/false); + pWrtShell->SplitNode(); + pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/2, /*nCols=*/1); + pWrtShell->MoveTable(GotoPrevTable, fnTableStart); + aBrush.SetColor(COL_LIGHTGREEN); + pWrtShell->SetRowBackground(aBrush); + pWrtShell->Down(/*bSelect=*/false); + // Second row has an explicit transparent background. + aBrush.SetColor(COL_TRANSPARENT); + pWrtShell->SetRowBackground(aBrush); + + // When exporting to reqif-xhtml: + ExportToReqif(); + + // Then make sure that CSS markup is used, not HTML one: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + // Without the accompanying fix in place, this test would have failed with: + // - XPath '//reqif-xhtml:table[1]' no attribute 'style' exist + // i.e. HTML markup was used for the table background color. + assertXPath(pXmlDoc, "//reqif-xhtml:table[1]", "style", u"background: #ff0000"); + assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:table[1]", "bgcolor"); + assertXPath(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "style", + u"background: #00ff00"); + assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "bgcolor"); + // Second row has no explicit style, the default is not written. + assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[2]", "style"); +} + +CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio) +{ + // Given a document with an image: width is relative, height is "keep ratio": + createSwDoc(); + uno::Reference xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference xTextGraphic( + xFactory->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); + xTextGraphic->setPropertyValue(u"AnchorType"_ustr, + uno::Any(text::TextContentAnchorType_AS_CHARACTER)); + xTextGraphic->setPropertyValue(u"RelativeWidth"_ustr, uno::Any(static_cast(42))); + xTextGraphic->setPropertyValue(u"IsSyncHeightToWidth"_ustr, uno::Any(true)); + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xBodyText = xTextDocument->getText(); + uno::Reference xCursor(xBodyText->createTextCursor()); + uno::Reference xTextContent(xTextGraphic, uno::UNO_QUERY); + xBodyText->insertTextContent(xCursor, xTextContent, false); + + // When exporting to HTML: + save(mpFilter); + + // Then make sure that the width is not a fixed size, that would break on resizing the browser + // window: + htmlDocUniquePtr pDoc = parseHtml(maTempFile); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: auto + // - Actual : 2 + // i.e. a static (CSS pixel) height was written. + assertXPath(pDoc, "/html/body/p/img", "height", u"auto"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir) +{ + // Given a document with a section: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Insert(u"test"_ustr); + pWrtShell->SelAll(); + SwSectionData aSectionData(SectionType::Content, u"mysect"_ustr); + pWrtShell->InsertSection(aSectionData); + + // When exporting to (reqif-)xhtml: + ExportToReqif(); + + // Then make sure CSS is used to export the text direction of the section: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + // Without the accompanying fix in place, this test would have failed with: + // - XPath '//reqif-xhtml:div[@id='mysect']' no attribute 'style' exist + // i.e. the dir="ltr" HTML attribute was used instead. + assertXPath(pXmlDoc, "//reqif-xhtml:div[@id='mysect']", "style", u"dir: ltr"); +} + +CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf114769) +{ + // Create document from scratch since relative urls to filesystem can be replaced + // by absolute during save/load + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Insert(u"Hyperlink1"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"Hyperlink2"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"Hyperlink3"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"Hyperlink4"_ustr); + pWrtShell->SplitNode(); + pWrtShell->Insert(u"Hyperlink5"_ustr); + pWrtShell->SplitNode(); + + // Normal external URL + uno::Reference xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); + xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"http://libreoffice.org/"_ustr)); + + // Bookmark reference + xRun.set(getRun(getParagraph(2), 1), uno::UNO_QUERY); + xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"#some_bookmark"_ustr)); + + // Filesystem absolute link + xRun.set(getRun(getParagraph(3), 1), uno::UNO_QUERY); + xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"C:\\test.txt"_ustr)); + + // Filesystem relative link + xRun.set(getRun(getParagraph(4), 1), uno::UNO_QUERY); + xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"..\\..\\test.odt"_ustr)); + + // Filesystem relative link + xRun.set(getRun(getParagraph(5), 1), uno::UNO_QUERY); + xRun->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u".\\another.odt"_ustr)); + + // Export + save(mpFilter); + + htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); + CPPUNIT_ASSERT(pHtmlDoc); + + assertXPath(pHtmlDoc, "/html/body/p[1]/a", "href", u"http://libreoffice.org/"); + assertXPath(pHtmlDoc, "/html/body/p[2]/a", "href", u"#some_bookmark"); + assertXPath(pHtmlDoc, "/html/body/p[3]/a", "href", u"C:\\test.txt"); + assertXPath(pHtmlDoc, "/html/body/p[4]/a", "href", u"..\\..\\test.odt"); + assertXPath(pHtmlDoc, "/html/body/p[5]/a", "href", u".\\another.odt"); +} + +CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf153923) +{ + createSwDoc("TableWithIndent.fodt"); + save(mpFilter); + + // Parse it as XML (strict!) + xmlDocUniquePtr pDoc = parseXml(maTempFile); + // Without the fix in place, this would fail + CPPUNIT_ASSERT(pDoc); + + assertXPath(pDoc, "/html/body//dl", 3); + // The 'dd' tag was not closed + assertXPath(pDoc, "/html/body//dd", 3); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf153923_ReqIF) +{ + createSwDoc("TableWithIndent.fodt"); + ExportToReqif(); + + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + assertXPath(pDoc, "//reqif-xhtml:table"); + // There should be no 'dd' or 'dl' tags, used as a hack for table indentation + assertXPath(pDoc, "//reqif-xhtml:dl", 0); + assertXPath(pDoc, "//reqif-xhtml:dd", 0); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfTransparentTifImg) +{ + // reqIf export must keep the TIF encoding of the image + createSwDoc("reqif-transparent-tif-img.odt"); + ExportToReqif(); + + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object[1]", "type", u"image/tiff"); + OUString imageName = getXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object[1]", "data"); + // Without the accompanying fix in place, this test would have failed, + // ending with .gif, because XOutFlags::UseGifIfSensible flag combined + // with the transparent image would result in GIF export + CPPUNIT_ASSERT(imageName.endsWith(".tif")); + + INetURLObject aURL(maTempFile.GetURL()); + aURL.setName(imageName); + GraphicDescriptor aDescriptor(aURL); + aDescriptor.Detect(); + CPPUNIT_ASSERT_EQUAL(GraphicFileFormat::TIF, aDescriptor.GetFileFormat()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf155387) +{ + createSwDoc("sub_li_and_ctd.fodt"); + ExportToReqif(); + + // Without the fix in place, this would fail + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + // Single top-level list + assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul"); + // Single top-level item + assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li"); + // 4 top-level paragraphs in the item + assertXPath(pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:p", 4); + // 2 sublists in the item + assertXPath( + pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:ul", 2); + // 2 items in the first sublist + assertXPath(pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:ul[1]/" + "reqif-xhtml:li", + 2); + // Check the last (most nested) subitem's text + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:ul[2]/" + "reqif-xhtml:li/reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:p", + u"l3"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf155496) +{ + createSwDoc("listItemSubheader.fodt"); + ExportToReqif(); + + // Without the fix in place, this would fail + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + // Two top-level lists + assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul", 2); + // Single top-level item + assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li"); + // One top-level paragraph in the item + assertXPath(pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li/reqif-xhtml:p"); + // One sublist in the item + assertXPath( + pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li/reqif-xhtml:ul"); + // One item in the sublist + assertXPath(pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li/reqif-xhtml:ul/" + "reqif-xhtml:li"); + // Check its text + OUString aContent = getXPathContent( + pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ul[1]/reqif-xhtml:li/reqif-xhtml:ul/" + "reqif-xhtml:li/reqif-xhtml:p"); + CPPUNIT_ASSERT_EQUAL(u"list 1 item 1\n\t\tsub-header"_ustr, aContent.trim()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_RightAlignedTable) +{ + createSwDoc("tableRight.fodt"); + ExportToReqif(); + + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + // No 'align' attribute must be present in 'div' + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:div", "align"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ListsWithNumFormat) +{ + createSwDoc("listsWithNumFormat.fodt"); + ExportToReqif(); + + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + // No 'type' attribute must be present in 'ol' + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[1]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[2]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[3]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[4]", "type"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf155871) +{ + createSwDoc("tdf155871.fodt"); + ExportToReqif(); + + // Without the fix in place, this would fail + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ListsNoStartAttribute) +{ + createSwDoc("twoListsWithSameStyle.fodt"); + ExportToReqif(); + + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + // No 'start' attribute must be present in 'ol' + assertXPath(pDoc, "//reqif-xhtml:ol[@start]", 0); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_FrameTextAsObjectAltText) +{ + createSwDoc("frameWithText.fodt"); + ExportToReqif(); + + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + // Without the fix, this would fail with + // - Expected: Some text in frame & + // - Actual : Frame1 + // i.e., frame name was used as the object element content, not frame text + assertXPathContent(pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]/reqif-xhtml:object", + u"Some text in frame & "); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSingleOleExport) +{ + // Given a document containing an embedded OLE object: + createSwDoc("ole2.odt"); + + // Create a selection for that object: + auto xDrawPageSupplier(mxComponent.queryThrow()); + auto xDrawPage(xDrawPageSupplier->getDrawPage()); + auto xModel(mxComponent.queryThrow()); + auto xController(xModel->getCurrentController().queryThrow()); + xController->select(xDrawPage->getByIndex(0)); + + // Store only the selection + css::uno::Sequence aStoreProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"RTFOLEMimeType"_ustr, u"text/rtf"_ustr), + comphelper::makePropertyValue(u"SelectionOnly"_ustr, true), + }; + saveWithParams(aStoreProperties); + + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + + // The root element must be reqif-xhtml:object + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:object", "type", u"text/rtf"); + // It has no children + assertXPathChildren(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:object", 0); + // And the content is empty + assertXPathContent(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:object", u""); + + OUString aRtfData = getXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:object", "data"); + INetURLObject aUrl(maTempFile.GetURL()); + aUrl.setName(aRtfData); + SvMemoryStream aRtf; + HtmlExportTest::wrapRtfFragment(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), aRtf); + tools::SvRef xReader(new TestReqIfRtfReader(aRtf)); + // The RTF OLE exports correctly + CPPUNIT_ASSERT(xReader->CallParser() != SvParserState::Error); + CPPUNIT_ASSERT_EQUAL(tools::Long(9358), xReader->GetObjw()); + CPPUNIT_ASSERT_EQUAL(tools::Long(450), xReader->GetObjh()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_Tdf156602) +{ + createSwDoc("NestingInA1.fodt"); + ExportToReqif(); + + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + // The outer table must be kept in the document where the outer table is the first element, + // and its A1 starts with a nested table + + // Only two sub-elements must be inside the div: an outer table and a trailing paragraph + assertXPathChildren(pDoc, "/reqif-xhtml:html/reqif-xhtml:div", 2); + // The outer table must have exactly two rows + assertXPath(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr", 2); + // First outer table cell must have two sub-elements: an inner table and a trailing paragraph + assertXPathChildren( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]", + 2); + // The inner table must have exactly two rows + assertXPath( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" + "reqif-xhtml:table/reqif-xhtml:tr", + 2); + // Check all the elements' content + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" + "reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/reqif-xhtml:p", + u"Inner.A1"); + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" + "reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[2]/reqif-xhtml:p", + u"Inner.B1"); + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" + "reqif-xhtml:table/reqif-xhtml:tr[2]/reqif-xhtml:td[1]/reqif-xhtml:p", + u"Inner.A2"); + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" + "reqif-xhtml:table/reqif-xhtml:tr[2]/reqif-xhtml:td[2]/reqif-xhtml:p", + u"Inner.B2"); + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[1]/" + "reqif-xhtml:p", + u"Outer.A1"); + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[1]/reqif-xhtml:td[2]/" + "reqif-xhtml:p", + u"Outer.B1"); + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[2]/reqif-xhtml:td[1]/" + "reqif-xhtml:p", + u"Outer.A2"); + assertXPathContent( + pDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr[2]/reqif-xhtml:td[2]/" + "reqif-xhtml:p", + u"Outer.B2"); + assertXPathContent(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p", u"Following text"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf156647_CellPaddingRoundtrip) +{ + // Given a document with a table with cell padding: + createSwDoc("table_cell_padding.fodt"); + { + auto xTable = getParagraphOrTable(1); + auto aTableBorder = getProperty(xTable, u"TableBorder2"_ustr); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1270), aTableBorder.Distance); + CPPUNIT_ASSERT(aTableBorder.IsDistanceValid); + } + // When exporting to reqif-xhtml: + ExportToReqif(); + // Make sure that we export it: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + assertXPath(pXmlDoc, "//reqif-xhtml:table", "cellpadding", u"48"); // px + // Now import it + ImportFromReqif(maTempFile.GetURL()); + // Then make sure that padding is not lost: + { + auto xTable = getParagraphOrTable(1); + auto aTableBorder = getProperty(xTable, u"TableBorder2"_ustr); + // Without the accompanying fix in place, this test would have failed: + // - Expected: 1270 + // - Actual : 97 + // as the padding was lost, and the default 55 twip padding was used. + CPPUNIT_ASSERT_EQUAL(sal_Int16(1270), aTableBorder.Distance); + CPPUNIT_ASSERT(aTableBorder.IsDistanceValid); + } +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf157643_WideHBorder) +{ + // Given a document with a table with a wide border between its two rows: + createSwDoc("table_with_wide_horizontal_border.fodt"); + // When exporting to reqif-xhtml: + ExportToReqif(); + // Make sure that there's no extra tr's: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr", 2); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_PreserveSpaces) +{ + // Given a document with leading, trailing, and repeating intermediate spaces: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + static constexpr OUString paraText = u"\t test \t more text \t"_ustr; + pWrtShell->Insert(paraText); + + // When exporting to plain HTML, using PreserveSpaces: + saveWithParams({ + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"PreserveSpaces"_ustr, true), + }); + + // Then make sure that "white-space: pre-wrap" is written into the paragraph's style: + htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); + CPPUNIT_ASSERT(pHtmlDoc); + const OUString style = getXPath(pHtmlDoc, "/html/body/p", "style"); + CPPUNIT_ASSERT(style.indexOf("white-space: pre-wrap") >= 0); + // Also check that the paragraph text is correct, without modifications in whitespace + assertXPathContent(pHtmlDoc, "/html/body/p", paraText); + + // Test import + + setImportFilterName(u"HTML (StarWriter)"_ustr); + loadFromURL(maTempFile.GetURL()); + CPPUNIT_ASSERT_EQUAL(paraText, getParagraph(1)->getString()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_PreserveSpaces) +{ + // Given a document with leading, trailing, and repeating intermediate spaces: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + static constexpr OUString paraText = u"\t test \t more text \t"_ustr; + pWrtShell->Insert(paraText); + + // When exporting to ReqIF, using PreserveSpaces: + saveWithParams({ + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"PreserveSpaces"_ustr, true), + }); + + // Then make sure that xml:space="preserve" attribute exists in the paragraph element: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p", "space", u"preserve"); + // Also check that the paragraph text is correct, without modifications in whitespace + assertXPathContent(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p", paraText); + + // Test import + + setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + setImportFilterName(u"HTML (StarWriter)"_ustr); + loadFromURL(maTempFile.GetURL()); + CPPUNIT_ASSERT_EQUAL(paraText, getParagraph(1)->getString()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_NoPreserveSpaces) +{ + // Test cases where "PreserveSpaces" should not introduce respective markup + + const auto assertXPath_NoWhiteSpaceInStyle + = [this](const xmlDocUniquePtr& pDoc, const char* pXPath) { + xmlXPathObjectPtr pXmlObj = getXPathNode(pDoc, pXPath); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + CPPUNIT_ASSERT_EQUAL_MESSAGE(pXPath, 1, xmlXPathNodeSetGetLength(pXmlNodes)); + CPPUNIT_ASSERT(pXmlNodes); + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + if (xmlChar* prop = xmlGetProp(pXmlNode, BAD_CAST("style"))) + { + OUString style = OUString::fromUtf8(reinterpret_cast(prop)); + CPPUNIT_ASSERT_MESSAGE(pXPath, style.indexOf("white-space:") < 0); + } + xmlXPathFreeObject(pXmlObj); + }; + const auto assertXPath_HasWhiteSpaceInStyle + = [this](const xmlDocUniquePtr& pDoc, const char* pXPath) { + const OUString style = getXPath(pDoc, pXPath, "style"); + CPPUNIT_ASSERT_MESSAGE(pXPath, style.indexOf("white-space: pre-wrap") >= 0); + }; + + createSwDoc("test_no_space_preserve.fodt"); + + // Export to plain HTML, using PreserveSpaces: + saveWithParams({ + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"PreserveSpaces"_ustr, true), + }); + + htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); + CPPUNIT_ASSERT(pHtmlDoc); + + // No whitespace preservation, where no leading / trailing / double whitespace + assertXPath_NoWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[1]"); + // Whitespace preserved for a leading space + assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[2]"); + // Whitespace preserved for a trailing space + assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[3]"); + // Whitespace preserved for a double space + assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[4]"); + // No whitespace preservation for leading / trailing breaks + assertXPath_NoWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[5]"); + // Whitespace preserved for a leading break + space + assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[6]"); + // Whitespace preserved for a trailing space + break + assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[7]"); + // No whitespace preservation for a middle break + assertXPath_NoWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[8]"); + // Whitespace preserved for a middle space + break + assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[9]"); + // Whitespace preserved for a middle break + space + assertXPath_HasWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[10]"); + // No whitespace preservation for a trailing space and SVG + assertXPath_NoWhiteSpaceInStyle(pHtmlDoc, "/html/body/p[11]"); + + // Test import + + setImportFilterName(u"HTML (StarWriter)"_ustr); + loadFromURL(maTempFile.GetURL()); + + CPPUNIT_ASSERT_EQUAL(u"No special spaces"_ustr, getParagraph(1)->getString()); + CPPUNIT_ASSERT_EQUAL(u" Leading space"_ustr, getParagraph(2)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Trailing space "_ustr, getParagraph(3)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Double space"_ustr, getParagraph(4)->getString()); + // Trailing break is removed in SwHTMLParser::AppendTextNode, and replaced with para spacing + CPPUNIT_ASSERT_EQUAL(u"\nLeading/trailing breaks"_ustr, getParagraph(5)->getString()); + CPPUNIT_ASSERT_EQUAL(u"\n Leading break + space"_ustr, getParagraph(6)->getString()); + // Trailing break is removed in SwHTMLParser::AppendTextNode, and replaced with para spacing + CPPUNIT_ASSERT_EQUAL(u"Trailing space + break "_ustr, getParagraph(7)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Middle\nbreak"_ustr, getParagraph(8)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Middle space \n+ break"_ustr, getParagraph(9)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Middle break\n + space"_ustr, getParagraph(10)->getString()); + // The SVG is replaced by a space in SwXParagraph::getString() + CPPUNIT_ASSERT_EQUAL(u"Trailing space and SVG "_ustr, getParagraph(11)->getString()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_NoPreserveSpaces) +{ + // Test cases where "PreserveSpaces" should not introduce respective markup + + createSwDoc("test_no_space_preserve.fodt"); + + // Export to ReqIF, using PreserveSpaces: + saveWithParams({ + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"PreserveSpaces"_ustr, true), + }); + + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + + // No whitespace preservation, where no leading / trailing / double whitespace + assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[1]", "space"); + // Whitespace preserved for a leading space + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]", "space", + u"preserve"); + // Whitespace preserved for a trailing space + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[3]", "space", + u"preserve"); + // Whitespace preserved for a double space + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[4]", "space", + u"preserve"); + // No whitespace preservation for leading / trailing breaks + assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[5]", "space"); + // Whitespace preserved for a leading break + space + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[6]", "space", + u"preserve"); + // No whitespace preservation for a trailing space + break + assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[7]", "space"); + // No whitespace preservation for a middle break + assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[8]", "space"); + // No whitespace preservation for a middle space + break + assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[9]", "space"); + // Whitespace preserved for a middle break + space + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[10]", "space", + u"preserve"); + // No whitespace preservation for a trailing space and SVG + assertXPathNoAttribute(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[11]", "space"); + + // Test import + + setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + setImportFilterName(u"HTML (StarWriter)"_ustr); + loadFromURL(maTempFile.GetURL()); + + CPPUNIT_ASSERT_EQUAL(u"No special spaces"_ustr, getParagraph(1)->getString()); + CPPUNIT_ASSERT_EQUAL(u" Leading space"_ustr, getParagraph(2)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Trailing space "_ustr, getParagraph(3)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Double space"_ustr, getParagraph(4)->getString()); + CPPUNIT_ASSERT_EQUAL(u"\nLeading/trailing breaks\n"_ustr, getParagraph(5)->getString()); + CPPUNIT_ASSERT_EQUAL(u"\n Leading break + space"_ustr, getParagraph(6)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Trailing space + break \n"_ustr, getParagraph(7)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Middle\nbreak"_ustr, getParagraph(8)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Middle space \n+ break"_ustr, getParagraph(9)->getString()); + CPPUNIT_ASSERT_EQUAL(u"Middle break\n + space"_ustr, getParagraph(10)->getString()); + // The SVG is replaced by a space in SwXParagraph::getString() + CPPUNIT_ASSERT_EQUAL(u"Trailing space and SVG "_ustr, getParagraph(11)->getString()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ExportFormulasAsPDF) +{ + // Given a document with a formula: + createSwDoc("embedded_formula.fodt"); + + // When exporting to reqif with ExportFormulasAsPDF=true: + uno::Sequence aStoreProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"ExportFormulasAsPDF"_ustr, true), + }; + saveWithParams(aStoreProperties); + + // Make sure that the formula is exported as PDF: + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]/reqif-xhtml:object", + "type", u"application/pdf"); + + css::uno::Sequence descr{ + comphelper::makePropertyValue(u"URL"_ustr, GetObjectPath(u".pdf"_ustr)), + }; + + uno::Reference xFactory( + comphelper::getProcessComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW); + uno::Reference xTypeDetection( + xFactory->createInstance(u"com.sun.star.document.TypeDetection"_ustr), + uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(u"pdf_Portable_Document_Format"_ustr, + xTypeDetection->queryTypeByDescriptor(descr, true)); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_NoBrClearForImageWrap) +{ + // Given a document with a paragraph-anchored image with "none" wrap: + createSwDoc("image_anchored_to_paragraph_no_wrap.fodt"); + // When exporting to reqif: + ExportToReqif(); + // Make sure that there's no 'br' elements in the 'object' (used to represent the wrapping + // in HTML export, using 'clear' attribute): + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + assertXPath(pXmlDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object"); + assertXPath(pXmlDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:br", + 0); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_Tdf160017_spanClosingOrder) +{ + // Given a document with a paragraph having explicit font color and character border properties: + createSwDoc("char_border_and_font_color.fodt"); + // When exporting to reqif: + ExportToReqif(); + // Without the fix, this would fail, because there was an extra closing + WrapReqifFromTempFile(); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160017_spanClosingOrder) +{ + // Given a document with a paragraph having explicit font color and character border properties: + createSwDoc("char_border_and_font_color.fodt"); + // When exporting to HTML: + ExportToHTML(); + // Parse it as XML (strict!) + // Without the fix, this would fail, because span and font elements closed in wrong order + CPPUNIT_ASSERT(parseXml(maTempFile)); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160390) +{ + // This document must not hang infinitely on HTML export + createSwDoc("tdf160390.fodt"); + ExportToHTML(); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_160867) +{ + // Given a document with an image with hyperlink, and text with hyperlink, both in a frame: + createSwDoc("tdf160867_image_with_link.fodt"); + // When exporting to HTML: + ExportToHTML(); + // Parse it as XML (strict!) + xmlDocUniquePtr pDoc = parseXml(maTempFile); + CPPUNIT_ASSERT(pDoc); + assertXPath(pDoc, "/html/body/p", 2); + + // Test export of image and text hyperlinks in the image map. + // Without the fix, the test would fail with + // - Expected: 1 + // - Actual : 0 + // - In <>, XPath '/html/body/p[2]/map' number of nodes is incorrect + const OUString mapName = getXPath(pDoc, "/html/body/p[2]/map", "name"); + assertXPath(pDoc, "/html/body/p[2]/map/area[1]", "shape", u"rect"); + CPPUNIT_ASSERT(getXPath(pDoc, "/html/body/p[2]/map/area[1]", "href").endsWith("foo/bar")); + assertXPath(pDoc, "/html/body/p[2]/map/area[2]", "shape", u"rect"); + CPPUNIT_ASSERT(getXPath(pDoc, "/html/body/p[2]/map/area[2]", "href").endsWith("baz")); + assertXPath(pDoc, "/html/body/p[2]/img", "usemap", Concat2View("#" + mapName)); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_160867) +{ + // Given a document with an image with hyperlink, and text with hyperlink, both in a frame: + createSwDoc("tdf160867_image_with_link.fodt"); + // When exporting to reqif: + ExportToReqif(); + // For now, we don't (yet) output the whole map in ReqIF case. + // Make sure that the first hyperlink from the objects in the frame is output as an
            element + // around the whole image of the frame. + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + assertXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a/reqif-xhtml:object"); + CPPUNIT_ASSERT( + getXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", "href").endsWith("foo/bar")); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_161979) +{ + // Given a document with two embedded metafiles: + createSwDoc("tdf161979_metafile.fodt"); + ExportToHTML(); + xmlDocUniquePtr pDoc = parseXml(maTempFile); + CPPUNIT_ASSERT(pDoc); + // First image: it has no EMF+ actions, and didn't use canvas rendering before the fix; + // yet, it didn't export correctly. + OUString imgName = getXPath(pDoc, "/html/body/p[2]/img", "src"); + CPPUNIT_ASSERT(imgName.endsWith(".gif")); + INetURLObject aUrl(maTempFile.GetURL()); + aUrl.setName(imgName); + Graphic graphic; + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, GraphicFilter().ImportGraphic(graphic, aUrl)); + + // Check that only ~4% of pixels are not transparent (before the fix, it was completely black) + BitmapEx bitmap = graphic.GetBitmapEx(); + Size size = bitmap.GetSizePixel(); + int numNonTransparent = 0; + for (tools::Long y = 0; y < size.Height(); ++y) + for (tools::Long x = 0; x < size.Width(); ++x) + if (bitmap.GetPixelColor(x, y) != COL_TRANSPARENT) + ++numNonTransparent; + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.04, numNonTransparent / double(size.Height() * size.Width()), + 0.01); + + // Second image: it consists of EMF+ records (no EMF fallback). It used canvas rendering + // before the fix; it also didn't export correctly. + imgName = getXPath(pDoc, "/html/body/p[4]/img", "src"); + CPPUNIT_ASSERT(imgName.endsWith(".gif")); + aUrl.SetURL(maTempFile.GetURL()); + aUrl.setName(imgName); + graphic.Clear(); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, GraphicFilter().ImportGraphic(graphic, aUrl)); + + // Check that some pixels are transparent (before the fix, it was completely black) + bitmap = graphic.GetBitmapEx(); + size = bitmap.GetSizePixel(); + numNonTransparent = 0; + for (tools::Long y = 0; y < size.Height(); ++y) + for (tools::Long x = 0; x < size.Width(); ++x) + if (bitmap.GetPixelColor(x, y) != COL_TRANSPARENT) + ++numNonTransparent; + CPPUNIT_ASSERT(numNonTransparent > 0); + CPPUNIT_ASSERT(numNonTransparent < size.Height() * size.Width()); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_exportAbsoluteURLs_ownRelative) +{ + auto pBatch(comphelper::ConfigurationChanges::create()); + Resetter resetter([ + bInternetPreviousValue = officecfg::Office::Common::Save::URL::Internet::get(), + bFileSystemPreviousValue = officecfg::Office::Common::Save::URL::FileSystem::get(), pBatch + ]() { + officecfg::Office::Common::Save::URL::Internet::set(bInternetPreviousValue, pBatch); + officecfg::Office::Common::Save::URL::FileSystem::set(bFileSystemPreviousValue, pBatch); + return pBatch->commit(); + }); + // Set saving absolute URLs + officecfg::Office::Common::Save::URL::Internet::set(false, pBatch); + officecfg::Office::Common::Save::URL::FileSystem::set(false, pBatch); + pBatch->commit(); + + createSwDoc("URLs.odt"); + // Export to ReqIF, using absolute URLs + saveWithParams({ + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true), + comphelper::makePropertyValue(u"RelativeOwnObjectURL"_ustr, true), + }); + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + + // HTTP URL: must be absolute + assertXPath(pXmlDoc, "//reqif-xhtml:p[1]/reqif-xhtml:a", "href", u"http://www.example.org/"); + // file URL: must be absolute + assertXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", "href", + createFileURL(u"NonExistingPath/NonExistingFile.html")); + // form URL: must be absolute + assertXPath(pXmlDoc, "//reqif-xhtml:form", "action", u"https://www.example.org/submit"); + // linked image exported as object: generated, must be relative + OUString url = getXPath(pXmlDoc, "//reqif-xhtml:p[3]/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".ole")); + // its original image URL: must be absolute + assertXPath(pXmlDoc, "//reqif-xhtml:p[3]/reqif-xhtml:object/reqif-xhtml:object", "data", + createFileURL(u"external.png")); + // embedded image exported as object: generated, must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[4]/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".ole")); + // its image URL: generated, must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[4]/reqif-xhtml:object/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".png")); + // unordered list with image bullet - it gets embedded as base64 data + OUString style = getXPath(pXmlDoc, "//reqif-xhtml:ul", "style"); + CPPUNIT_ASSERT(style.indexOf("list-style-image: url(data:image/png;base64,") != -1); + // an as-char frame, exported as a whole to an object, must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".ole")); + // its file hyperlink must be absolute + assertXPath(pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object/reqif-xhtml:a", "href", + createFileURL(u"foo/bar")); + // its image URL: generated, must be relative + url = getXPath( + pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object/reqif-xhtml:a/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".png")); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_exportRelativeURLs) +{ + CPPUNIT_ASSERT(officecfg::Office::Common::Save::URL::Internet::get()); + CPPUNIT_ASSERT(officecfg::Office::Common::Save::URL::FileSystem::get()); + + createSwDoc("URLs.odt"); + // Export to ReqIF, using relative URLs (the default) + saveWithParams({ + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true), + }); + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + + // HTTP URL: must be absolute + assertXPath(pXmlDoc, "//reqif-xhtml:p[1]/reqif-xhtml:a", "href", u"http://www.example.org/"); + // file URL: must be relative + OUString url = getXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", "href"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith("NonExistingPath/NonExistingFile.html")); + // form URL: must be absolute + assertXPath(pXmlDoc, "//reqif-xhtml:form", "action", u"https://www.example.org/submit"); + // linked image exported as object: generated, must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[3]/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".ole")); + // its original image URL: must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[3]/reqif-xhtml:object/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith("external.png")); + // embedded image exported as object: generated, must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[4]/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".ole")); + // its image URL: generated, must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[4]/reqif-xhtml:object/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".png")); + // unordered list with image bullet - it gets embedded as base64 data + OUString style = getXPath(pXmlDoc, "//reqif-xhtml:ul", "style"); + CPPUNIT_ASSERT(style.indexOf("list-style-image: url(data:image/png;base64,") != -1); + // an as-char frame, exported as a whole to an object, must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".ole")); + // its file hyperlink must be relative + url = getXPath(pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object/reqif-xhtml:a", "href"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith("foo/bar")); + // its image URL: generated, must be relative + url = getXPath( + pXmlDoc, "//reqif-xhtml:p[5]/reqif-xhtml:object/reqif-xhtml:a/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".png")); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_exportAbsoluteURLs_ownRelative) +{ + auto pBatch(comphelper::ConfigurationChanges::create()); + Resetter resetter([ + bInternetPreviousValue = officecfg::Office::Common::Save::URL::Internet::get(), + bFileSystemPreviousValue = officecfg::Office::Common::Save::URL::FileSystem::get(), pBatch + ]() { + officecfg::Office::Common::Save::URL::Internet::set(bInternetPreviousValue, pBatch); + officecfg::Office::Common::Save::URL::FileSystem::set(bFileSystemPreviousValue, pBatch); + return pBatch->commit(); + }); + // Set saving absolute URLs + officecfg::Office::Common::Save::URL::Internet::set(false, pBatch); + officecfg::Office::Common::Save::URL::FileSystem::set(false, pBatch); + pBatch->commit(); + + createSwDoc("URLs.odt"); + // Export to HTML, using absolute URLs + saveWithParams({ + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"RelativeOwnObjectURL"_ustr, true), + }); + htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); + + // HTTP URL: must be absolute + assertXPath(pHtmlDoc, "//p[1]/a", "href", u"http://www.example.org/"); + // file URL: must be absolute + assertXPath(pHtmlDoc, "//p[2]/a", "href", + createFileURL(u"NonExistingPath/NonExistingFile.html")); + // form URL: must be absolute + assertXPath(pHtmlDoc, "//form", "action", u"https://www.example.org/submit"); + // linked image: must be absolute + assertXPath(pHtmlDoc, "//p[3]/img", "src", createFileURL(u"external.png")); + // embedded image: generated, must be relative + OUString url = getXPath(pHtmlDoc, "//p[4]/img", "src"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".png")); + // unordered list with image bullet - it gets embedded as base64 data + OUString style = getXPath(pHtmlDoc, "//ul", "style"); + CPPUNIT_ASSERT(style.indexOf("list-style-image: url(data:image/png;base64,") != -1); + // image-in-frame file hyperlink must be absolute; FIXME: HTMLOutFuncs::Out_ImageMap + // assertXPath(pHtmlDoc, "//p[5]/map/area", "href", createFileURL(u"foo/bar")); + // its image URL: generated, must be relative + url = getXPath(pHtmlDoc, "//p[5]/img", "src"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".gif")); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_exportRelativeURLs) +{ + CPPUNIT_ASSERT(officecfg::Office::Common::Save::URL::Internet::get()); + CPPUNIT_ASSERT(officecfg::Office::Common::Save::URL::FileSystem::get()); + + createSwDoc("URLs.odt"); + // Export to HTML, using relative URLs (the default) + ExportToHTML(); + htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); + + // HTTP URL: must be absolute + assertXPath(pHtmlDoc, "//p[1]/a", "href", u"http://www.example.org/"); + // file URL: must be relative + OUString url = getXPath(pHtmlDoc, "//p[2]/a", "href"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith("NonExistingPath/NonExistingFile.html")); + // form URL: must be absolute + assertXPath(pHtmlDoc, "//form", "action", u"https://www.example.org/submit"); + // linked image: must be relative + url = getXPath(pHtmlDoc, "//p[3]/img", "src"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith("external.png")); + // embedded image: generated, must be relative + url = getXPath(pHtmlDoc, "//p[4]/img", "src"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".png")); + // unordered list with image bullet - it gets embedded as base64 data + OUString style = getXPath(pHtmlDoc, "//ul", "style"); + CPPUNIT_ASSERT(style.indexOf("list-style-image: url(data:image/png;base64,") != -1); + // image-in-frame file hyperlink must be relative + url = getXPath(pHtmlDoc, "//p[5]/map/area", "href"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith("foo/bar")); + // its image URL: generated, must be relative + url = getXPath(pHtmlDoc, "//p[5]/img", "src"); + CPPUNIT_ASSERT(!url.startsWith("file:")); + CPPUNIT_ASSERT(url.endsWith(".gif")); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_162282) +{ + // Given a document with an embedded metafile: + createSwDoc("tdf162282.odt"); + ExportToReqif(); + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + + // Check that the exported EMF is exactly the same as in the ODF package + assertXPath(pDoc, "//reqif-xhtml:p/reqif-xhtml:object", "type", u"image/x-emf"); + OUString imgName = getXPath(pDoc, "//reqif-xhtml:p/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(imgName.endsWith(".emf")); + INetURLObject aUrl(maTempFile.GetURL()); + aUrl.setName(imgName); + SvFileStream aEmfStream(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), + StreamMode::READ); + + // without the fix, this would fail with + // - Expected: 220 + // - Actual : 111260 + CPPUNIT_ASSERT_EQUAL(sal_uInt64(220), aEmfStream.TellEnd()); + + css::uno::Sequence emfData(220); + aEmfStream.ReadBytes(emfData.getArray(), emfData.getLength()); + + const css::uno::Sequence correctData{ + 0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xF4, 0x01, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0x20, 0x45, 0x4D, 0x46, 0x00, + 0x00, 0x01, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, + 0x00, 0x38, 0x04, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0xF4, + 0x01, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x2D, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, + 0x00, 0xFA, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, + 0x2C, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, + 0x00, 0xC8, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + }; + CPPUNIT_ASSERT_EQUAL(correctData, emfData); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_162426) +{ + // Given a document with an image with style:wrap="none": + createSwDoc("tdf162426_image_with_wrap_none.fodt"); + // Before the fix, an assertion failed in HtmlWriter::attribute when exporting to HTML : + ExportToHTML(); + + xmlDocUniquePtr pDoc = parseXml(maTempFile); + CPPUNIT_ASSERT(pDoc); + + // Before the fix, the 'border' attribute was written after the 'img' tag was already closed, + // so without the assertion, this would fail with + // - In <>, XPath '/html/body/p/img' no attribute 'border' exist + assertXPath(pDoc, "/html/body/p/img", "border", u"0"); +} + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_163873) +{ + // Given a document with an image with style:wrap="none": + createSwDoc("tdf131728.docx"); + // Before the fix, an assertion failed in HtmlWriter::attribute when exporting to HTML : + ExportToHTML(); + + xmlDocUniquePtr pDoc = parseXml(maTempFile); + CPPUNIT_ASSERT(pDoc); + + // Before the fix, inline headings weren't inline + assertXPath(pDoc, "/html/body/p[5]/span/h2", "style", u"display:inline;"); + assertXPath(pDoc, "/html/body/p[6]/span/h2", "style", u"display:inline;"); + assertXPath(pDoc, "/html/body/p[7]/span/h2", "style", u"display:inline;"); + assertXPath(pDoc, "/html/body/p[11]/span/h2", "style", u"display:inline;"); + assertXPath(pDoc, "/html/body/p[14]/span/h2", "style", u"display:inline;"); +} + +} // end of anonymous namespace +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/htmlexport/htmlmodeltestbase.hxx b/sw/qa/extras/htmlexport/htmlmodeltestbase.hxx new file mode 100644 index 000000000000..c3fc357118d8 --- /dev/null +++ b/sw/qa/extras/htmlexport/htmlmodeltestbase.hxx @@ -0,0 +1,232 @@ +/* -*- 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/. + */ + +#include +#include + +#include +#include +#include +#include +#include + +/// Test RTF parser that just extracts a single OLE2 object from a file. +class TestReqIfRtfReader : public SvRTFParser +{ +public: + TestReqIfRtfReader(SvStream& rStream); + void NextToken(int nToken) override; + bool WriteObjectData(SvStream& rOLE); + tools::Long GetObjw() const { return m_nObjw; } + tools::Long GetObjh() const { return m_nObjh; } + int getWmetafile() const { return m_nWmetafile; } + +private: + bool m_bInObjData = false; + OStringBuffer m_aHex; + tools::Long m_nObjw = 0; + tools::Long m_nObjh = 0; + int m_nWmetafile = 0; +}; + +TestReqIfRtfReader::TestReqIfRtfReader(SvStream& rStream) + : SvRTFParser(rStream) +{ +} + +void TestReqIfRtfReader::NextToken(int nToken) +{ + switch (nToken) + { + case '}': + m_bInObjData = false; + break; + case RTF_TEXTTOKEN: + if (m_bInObjData) + m_aHex.append(OUStringToOString(aToken, RTL_TEXTENCODING_ASCII_US)); + break; + case RTF_OBJDATA: + m_bInObjData = true; + break; + case RTF_OBJW: + m_nObjw = nTokenValue; + break; + case RTF_OBJH: + m_nObjh = nTokenValue; + break; + case RTF_WMETAFILE: + m_nWmetafile = nTokenValue; + break; + } +} + +bool TestReqIfRtfReader::WriteObjectData(SvStream& rOLE) +{ + OString aObjdata = m_aHex.makeStringAndClear(); + + SvMemoryStream aStream; + int b = 0; + int count = 2; + + // Feed the destination text to a stream. + for (int i = 0; i < aObjdata.getLength(); ++i) + { + char ch = aObjdata[i]; + if (ch != 0x0d && ch != 0x0a) + { + b = b << 4; + sal_Int8 parsed = msfilter::rtfutil::AsHex(ch); + if (parsed == -1) + return false; + b += parsed; + count--; + if (!count) + { + aStream.WriteChar(b); + count = 2; + b = 0; + } + } + } + + aStream.Seek(0); + rOLE.WriteStream(aStream); + return true; +} + +/// Parser for [MS-OLEDS] 2.2.5 EmbeddedObject, aka OLE1. +struct OLE1Reader +{ + sal_uInt32 m_nNativeDataSize; + std::vector m_aNativeData; + sal_uInt32 m_nPresentationDataSize; + + OLE1Reader(SvStream& rStream); +}; + +OLE1Reader::OLE1Reader(SvStream& rStream) +{ + // Skip ObjectHeader, see [MS-OLEDS] 2.2.4. + rStream.Seek(0); + CPPUNIT_ASSERT(rStream.remainingSize()); + sal_uInt32 nData; + rStream.ReadUInt32(nData); // OLEVersion + rStream.ReadUInt32(nData); // FormatID + rStream.ReadUInt32(nData); // ClassName + rStream.SeekRel(nData); + rStream.ReadUInt32(nData); // TopicName + rStream.SeekRel(nData); + rStream.ReadUInt32(nData); // ItemName + rStream.SeekRel(nData); + + rStream.ReadUInt32(m_nNativeDataSize); + m_aNativeData.resize(m_nNativeDataSize); + rStream.ReadBytes(m_aNativeData.data(), m_aNativeData.size()); + + rStream.ReadUInt32(nData); // OLEVersion for presentation data + CPPUNIT_ASSERT(rStream.good()); + rStream.ReadUInt32(nData); // FormatID + rStream.ReadUInt32(nData); // ClassName + rStream.SeekRel(nData); + rStream.ReadUInt32(nData); // Width + rStream.ReadUInt32(nData); // Height + rStream.ReadUInt32(nData); // PresentationDataSize + m_nPresentationDataSize = nData; +} + +/// Covers sw/source/filter/html/wrthtml.cxx and related fixes. +class HtmlExportTest : public SwModelTestBase, public HtmlTestTools +{ +public: + HtmlExportTest() + : SwModelTestBase(u"/sw/qa/extras/htmlexport/data/"_ustr, u"HTML (StarWriter)"_ustr) + { + } + + /// Wraps an RTF fragment into a complete RTF file, so an RTF parser can handle it. + static void wrapRtfFragment(const OUString& rURL, SvMemoryStream& rStream) + { + SvFileStream aRtfStream(rURL, StreamMode::READ); + rStream.WriteOString("{\\rtf1"); + rStream.WriteStream(aRtfStream); + rStream.WriteOString("}"); + rStream.Seek(0); + } +}; + +/// HTML export of the sw doc model tests. +class SwHtmlDomExportTest : public SwModelTestBase, public HtmlTestTools +{ +public: + SwHtmlDomExportTest() + : SwModelTestBase(u"/sw/qa/extras/htmlexport/data/"_ustr) + { + } + + OUString GetObjectPath(const OUString& ext); + /// Get the .ole path, assuming maTempFile is an XHTML export result. + OUString GetOlePath() { return GetObjectPath(u".ole"_ustr); } + OUString GetPngPath() { return GetObjectPath(u".png"_ustr); } + /// Parse the ole1 data out of an RTF fragment URL. + void ParseOle1FromRtfUrl(const OUString& rRtfUrl, SvMemoryStream& rOle1); + /// Export using the C++ HTML export filter, with xhtmlns=reqif-xhtml. + void ExportToReqif(); + /// Import using the C++ HTML import filter, with xhtmlns=reqif-xhtml. + void ImportFromReqif(const OUString& rUrl); + /// Export using the C++ HTML export filter + void ExportToHTML(); +}; + +OUString SwHtmlDomExportTest::GetObjectPath(const OUString& ext) +{ + assert(ext.startsWith(".")); + xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + OUString aOlePath = getXPath( + pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data"); + CPPUNIT_ASSERT(aOlePath.endsWith(ext)); + INetURLObject aUrl(maTempFile.GetURL()); + aUrl.setBase(aOlePath.subView(0, aOlePath.getLength() - ext.getLength())); + aUrl.setExtension(ext.subView(1)); + return aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE); +} + +void SwHtmlDomExportTest::ParseOle1FromRtfUrl(const OUString& rRtfUrl, SvMemoryStream& rOle1) +{ + SvMemoryStream aRtf; + HtmlExportTest::wrapRtfFragment(rRtfUrl, aRtf); + tools::SvRef xReader(new TestReqIfRtfReader(aRtf)); + CPPUNIT_ASSERT(xReader->CallParser() != SvParserState::Error); + CPPUNIT_ASSERT(xReader->WriteObjectData(rOle1)); + CPPUNIT_ASSERT(rOle1.Tell()); +} + +void SwHtmlDomExportTest::ExportToReqif() +{ + setFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + save(u"HTML (StarWriter)"_ustr); +} + +void SwHtmlDomExportTest::ExportToHTML() +{ + uno::Sequence aStoreProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + }; + saveWithParams(aStoreProperties); +} + +void SwHtmlDomExportTest::ImportFromReqif(const OUString& rUrl) +{ + uno::Sequence aLoadProperties = { + comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML (StarWriter)"_ustr), + comphelper::makePropertyValue(u"FilterOptions"_ustr, u"xhtmlns=reqif-xhtml"_ustr), + }; + loadWithParams(rUrl, aLoadProperties); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 755b28d019db62d29ef36535a501809912182960 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 20 Nov 2024 15:04:06 +0100 Subject: [PATCH 038/373] Catch exceptions thrown when notifying individual listeners Any such exceptions were already caught further up the stack (by SfxBaseModel::postEvent_Impl), but prevented later listeners from being notified as soon as one listener threw an exception (which I saw happen with some 3rd-party extension). Change-Id: Ia6bd1c73d29ab6d6e131652df51939ba0c0e988e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176854 Tested-by: Jenkins Reviewed-by: Stephan Bergmann Reviewed-by: Noel Grandin --- include/comphelper/interfacecontainer4.hxx | 95 ++++++++++++++++++++++ sfx2/source/notify/globalevents.cxx | 6 +- 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/include/comphelper/interfacecontainer4.hxx b/include/comphelper/interfacecontainer4.hxx index e4a41e30675d..c23c04c76018 100644 --- a/include/comphelper/interfacecontainer4.hxx +++ b/include/comphelper/interfacecontainer4.hxx @@ -204,6 +204,26 @@ public: template inline void forEach(std::unique_lock& rGuard, FuncT const& func) const; + /** Executes a functor for each contained listener of specified type, e.g. + forEach(.... + + If a css::lang::DisposedException occurs which relates to + the called listener, then that listener is removed from the container. + + If any other UNO exception occurs, the exceptionFunc is called. + + @tparam FuncT unary functor type, let your compiler deduce this for you + @tparam ExceptionFuncT nullary functor type, let your compiler deduce this for you + @param func unary functor object expecting an argument of type + css::uno::Reference + @param exceptionFunc nullary functor object + @param rGuard + this parameter only here to make that this container is accessed while locked + */ + template + inline void forEach(std::unique_lock& rGuard, FuncT const& func, + ExceptionFuncT const& exceptionFunc) const; + /** Calls a UNO listener method for each contained listener. The listener method must take a single argument of type EventT, @@ -231,6 +251,31 @@ public: void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&), const EventT& Event) const; + /** Calls a UNO listener method for each contained listener. + + The listener method must take a single argument of type EventT, + and return void. + + If a css::lang::DisposedException occurs which relates to + the called listener, then that listener is removed from the container. + + If any other UNO exception occurs, the exceptionFunc is called. + + @tparam EventT event type, let your compiler deduce this for you + @tparam ExceptionFuncT nullary functor type, let your compiler deduce this for you + @param NotificationMethod + Pointer to a method of a ListenerT interface. + @param Event + Event to notify to all contained listeners + @param exceptionFunc nullary functor object + @param rGuard + this parameter only here to make that this container is accessed while locked + */ + template + inline void notifyEach(std::unique_lock& rGuard, + void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&), + const EventT& Event, const ExceptionFuncT& exceptionFunc) const; + // this is moveable, but not copyable OInterfaceContainerHelper4(OInterfaceContainerHelper4&&) = default; OInterfaceContainerHelper4& operator=(OInterfaceContainerHelper4&&) = default; @@ -316,6 +361,45 @@ inline void OInterfaceContainerHelper4::forEach(std::unique_lock& rGuard.lock(); } +template +template +inline void OInterfaceContainerHelper4::forEach(std::unique_lock& rGuard, + FuncT const& func, + ExceptionFuncT const& exceptionFunc) const +{ + assert(rGuard.owns_lock()); + if (std::as_const(maData)->empty()) + { + return; + } + const_cast(*this) + .maData.make_unique(); // so we can iterate over the data without holding the lock + OInterfaceIteratorHelper4 iter(rGuard, const_cast(*this)); + rGuard.unlock(); + while (iter.hasMoreElements()) + { + auto xListener = iter.next(); + try + { + func(xListener); + } + catch (css::lang::DisposedException const& exc) + { + if (exc.Context == xListener) + { + rGuard.lock(); + iter.remove(rGuard); + rGuard.unlock(); + } + } + catch (css::uno::Exception) + { + exceptionFunc(); + } + } + rGuard.lock(); +} + template template inline void OInterfaceContainerHelper4::notifyEach( @@ -326,6 +410,17 @@ inline void OInterfaceContainerHelper4::notifyEach( NotifySingleListener(NotificationMethod, Event)); } +template +template +inline void OInterfaceContainerHelper4::notifyEach( + std::unique_lock& rGuard, + void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&), const EventT& Event, + const ExceptionFuncT& exceptionFunc) const +{ + forEach>( + rGuard, NotifySingleListener(NotificationMethod, Event), exceptionFunc); +} + template sal_Int32 OInterfaceContainerHelper4::getLength(std::unique_lock& rGuard) const diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx index bf440b5ce215..ae05b7c93911 100644 --- a/sfx2/source/notify/globalevents.cxx +++ b/sfx2/source/notify/globalevents.cxx @@ -482,9 +482,11 @@ void SfxGlobalEvents_Impl::implts_notifyListener(const document::DocumentEvent& document::EventObject aLegacyEvent(aEvent.Source, aEvent.EventName); m_aLegacyListeners.notifyEach(g, - &document::XEventListener::notifyEvent, aLegacyEvent); + &document::XEventListener::notifyEvent, aLegacyEvent, + [] { TOOLS_WARN_EXCEPTION("sfx.notify", "ignoring"); }); m_aDocumentListeners.notifyEach(g, - &document::XDocumentEventListener::documentEventOccured, aEvent); + &document::XDocumentEventListener::documentEventOccured, aEvent, + [] { TOOLS_WARN_EXCEPTION("sfx.notify", "ignoring"); }); } From 235aebe31e6ba32a7ffc6a960396f651bdaa6ae3 Mon Sep 17 00:00:00 2001 From: Jonathan Clark Date: Wed, 20 Nov 2024 08:16:40 -0700 Subject: [PATCH 039/373] tdf#91315 Implemented RTL support for SVG export Previously, the direction attribute was not set on text tags when exporting RTL text to SVG. This change adds the missing attribute. Change-Id: I57770c1cc44f10c3c43ccac2f5a17c1422c34d35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176869 Tested-by: Jenkins Reviewed-by: Jonathan Clark --- filter/qa/unit/data/tdf91315.fodp | 429 ++++++++++++++++++++++++++++++ filter/qa/unit/svg.cxx | 15 ++ filter/source/svg/svgwriter.cxx | 10 + 3 files changed, 454 insertions(+) create mode 100644 filter/qa/unit/data/tdf91315.fodp diff --git a/filter/qa/unit/data/tdf91315.fodp b/filter/qa/unit/data/tdf91315.fodp new file mode 100644 index 000000000000..a3d472fc1613 --- /dev/null +++ b/filter/qa/unit/data/tdf91315.fodp @@ -0,0 +1,429 @@ + + + 2015-05-16T06:24:54.7833246752015-05-16T06:26:35.675435300PT43S1LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/8392aa55baf949d7fecfcce56499256866ba5de9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <number> + + + + + + + + + + + + + + + + + + + + + + + <number> + + + + + + + + + + + + + + + + + + + + + + + + + <number> + + + + + + + + + + + בדיקה (test) + + + + + + + + + + + + + \ No newline at end of file diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 61372d1442f6..366102fd964c 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -364,6 +364,21 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testMapModeText) // ahead to get the rotation. } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTdf91315) +{ + // Load a presentation containing RTL text + loadFromFile(u"tdf91315.fodp"); + + save(u"impress_svg_Export"_ustr); + + xmlDocUniquePtr pXmlDoc = parseExportedFile(); + + assertXPath(pXmlDoc, "//svg:text[@direction='rtl']", 1); + // Without the accompanying fix, this test would have failed with: + // - Expected: 1 + // - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 2c19058cd3a4..6a9ae6b6219f 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -91,6 +91,7 @@ constexpr OUString aXMLAttrOffset = u"offset"_ustr; constexpr OUString aXMLAttrStopColor = u"stop-color"_ustr; constexpr OUString aXMLAttrStrokeLinejoin = u"stroke-linejoin"_ustr; constexpr OUString aXMLAttrStrokeLinecap = u"stroke-linecap"_ustr; +constexpr OUString aXMLAttrTextDirection = u"direction"_ustr; vcl::PushFlags SVGContextHandler::getPushFlags() const @@ -1332,6 +1333,15 @@ void SVGTextWriter::startTextShape() mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); } + // tdf#91315: Set text direction + auto nLayoutMode = mpVDev->GetLayoutMode(); + if (nLayoutMode + & (vcl::text::ComplexTextLayoutFlags::BiDiRtl + | vcl::text::ComplexTextLayoutFlags::BiDiStrong)) + { + mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrTextDirection, "rtl"); + } + mpTextShapeElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemText, true, mbIWS )); startTextParagraph(); } From 4b0b65f7605f1291fedc77ac850afed8e39dfcd8 Mon Sep 17 00:00:00 2001 From: Ilmari Lauhakangas Date: Wed, 20 Nov 2024 17:13:41 +0200 Subject: [PATCH 040/373] starmath: Use field color for SmEditTextWindow background With same reasoning as commit 8bb38e1b3f1ba1d9c563598d161230fdf27e4685 Author: Michael Weghorn Date: Mon Oct 14 12:22:32 2024 +0200 tdf#163397 svx: Use field color for WeldEditView bg Change-Id: Iac0c6b934946b6755ce53ac312c1e637678f966d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176856 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- starmath/source/edit.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 6acb44792dac..384f052ff000 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -100,8 +100,7 @@ void SmEditTextWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) { weld::CustomWidgetController::SetDrawingArea(pDrawingArea); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - Color aBgColor = rStyleSettings.GetWindowColor(); + Color aBgColor = Application::GetSettings().GetStyleSettings().GetFieldColor(); OutputDevice& rDevice = pDrawingArea->get_ref_device(); rDevice.SetBackground(aBgColor); From e3de36ececcc032a264c3249988a8f7b2916039f Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 20 Nov 2024 16:22:01 +0100 Subject: [PATCH 041/373] CppunitTest_sw_tiledrendering2: move to tiledrendering folder In preparation for a follow-up commit Change-Id: Id790d14ccbbb17f4ca086c67a702e199397d272b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176864 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- sw/CppunitTest_sw_tiledrendering2.mk | 2 +- .../data/format-insert-list.docx | Bin .../data/numrules.odt | Bin .../data/signed-doc.odt | Bin .../tiledrendering2.cxx | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) rename sw/qa/extras/{tiledrendering2 => tiledrendering}/data/format-insert-list.docx (100%) rename sw/qa/extras/{tiledrendering2 => tiledrendering}/data/numrules.odt (100%) rename sw/qa/extras/{tiledrendering2 => tiledrendering}/data/signed-doc.odt (100%) rename sw/qa/extras/{tiledrendering2 => tiledrendering}/tiledrendering2.cxx (99%) diff --git a/sw/CppunitTest_sw_tiledrendering2.mk b/sw/CppunitTest_sw_tiledrendering2.mk index 7716af0bfe25..401bde88aae1 100644 --- a/sw/CppunitTest_sw_tiledrendering2.mk +++ b/sw/CppunitTest_sw_tiledrendering2.mk @@ -14,7 +14,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sw_tiledrendering2)) $(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_tiledrendering2)) $(eval $(call gb_CppunitTest_add_exception_objects,sw_tiledrendering2, \ - sw/qa/extras/tiledrendering2/tiledrendering2 \ + sw/qa/extras/tiledrendering/tiledrendering2 \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_tiledrendering2, \ diff --git a/sw/qa/extras/tiledrendering2/data/format-insert-list.docx b/sw/qa/extras/tiledrendering/data/format-insert-list.docx similarity index 100% rename from sw/qa/extras/tiledrendering2/data/format-insert-list.docx rename to sw/qa/extras/tiledrendering/data/format-insert-list.docx diff --git a/sw/qa/extras/tiledrendering2/data/numrules.odt b/sw/qa/extras/tiledrendering/data/numrules.odt similarity index 100% rename from sw/qa/extras/tiledrendering2/data/numrules.odt rename to sw/qa/extras/tiledrendering/data/numrules.odt diff --git a/sw/qa/extras/tiledrendering2/data/signed-doc.odt b/sw/qa/extras/tiledrendering/data/signed-doc.odt similarity index 100% rename from sw/qa/extras/tiledrendering2/data/signed-doc.odt rename to sw/qa/extras/tiledrendering/data/signed-doc.odt diff --git a/sw/qa/extras/tiledrendering2/tiledrendering2.cxx b/sw/qa/extras/tiledrendering/tiledrendering2.cxx similarity index 99% rename from sw/qa/extras/tiledrendering2/tiledrendering2.cxx rename to sw/qa/extras/tiledrendering/tiledrendering2.cxx index 45254de62e64..37aded0e0a45 100644 --- a/sw/qa/extras/tiledrendering2/tiledrendering2.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering2.cxx @@ -52,7 +52,7 @@ protected: }; SwTiledRenderingTest::SwTiledRenderingTest() - : SwModelTestBase(u"/sw/qa/extras/tiledrendering2/data/"_ustr) + : SwModelTestBase(u"/sw/qa/extras/tiledrendering/data/"_ustr) { } From a7ec9431083cf5dde8a86e59b9af203f3d35073d Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 20 Nov 2024 17:32:59 +0100 Subject: [PATCH 042/373] CppunitTest_sw_tiledrendering: factor out common code Change-Id: Icc8958f9f86844149bc66d12d60111bdcac0f8ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176867 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- .../extras/tiledrendering/tiledrendering.cxx | 478 +--------------- .../extras/tiledrendering/tiledrendering2.cxx | 163 +----- .../tiledrenderingmodeltestbase.cxx | 510 ++++++++++++++++++ 3 files changed, 526 insertions(+), 625 deletions(-) create mode 100644 sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index a5fb0f88e03a..1846c1b535a2 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -7,15 +7,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include "tiledrenderingmodeltestbase.cxx" #include #include -#include - -#include -#include #include #include #include @@ -24,11 +20,8 @@ #include #include -#include #include #include -#include -#include #include #include #include @@ -44,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -53,11 +45,9 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -66,14 +56,10 @@ #include #include #include -#include -#include #include #include #include #include -#include -#include static std::ostream& operator<<(std::ostream& os, ViewShellId id) { @@ -81,240 +67,6 @@ static std::ostream& operator<<(std::ostream& os, ViewShellId id) return os; } -/// Testsuite for the SwXTextDocument methods implementing the vcl::ITiledRenderable interface. -class SwTiledRenderingTest : public SwModelTestBase -{ -public: - SwTiledRenderingTest(); - virtual void setUp() override; - virtual void tearDown() override; - -protected: - SwXTextDocument* createDoc(const char* pName = nullptr); - void setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell); - static void callback(int nType, const char* pPayload, void* pData); - void callbackImpl(int nType, const char* pPayload); - // First invalidation. - tools::Rectangle m_aInvalidation; - /// Union of all invalidations. - tools::Rectangle m_aInvalidations; - Size m_aDocumentSize; - OString m_aTextSelection; - bool m_bFound; - std::vector m_aSearchResultSelection; - std::vector m_aSearchResultPart; - int m_nSelectionBeforeSearchResult; - int m_nSelectionAfterSearchResult; - int m_nInvalidations; - int m_nRedlineTableSizeChanged; - int m_nRedlineTableEntryModified; - int m_nTrackedChangeIndex; - bool m_bFullInvalidateSeen; - OString m_sHyperlinkText; - OString m_sHyperlinkLink; - OString m_aFormFieldButton; - OString m_aContentControl; - OString m_ShapeSelection; - struct - { - std::string text; - std::string rect; - } m_aTooltip; - TestLokCallbackWrapper m_callbackWrapper; -}; - -SwTiledRenderingTest::SwTiledRenderingTest() - : SwModelTestBase(u"/sw/qa/extras/tiledrendering/data/"_ustr), - m_bFound(true), - m_nSelectionBeforeSearchResult(0), - m_nSelectionAfterSearchResult(0), - m_nInvalidations(0), - m_nRedlineTableSizeChanged(0), - m_nRedlineTableEntryModified(0), - m_nTrackedChangeIndex(-1), - m_bFullInvalidateSeen(false), - m_callbackWrapper(&callback, this) -{ -} - -void SwTiledRenderingTest::setUp() -{ - SwModelTestBase::setUp(); - - SwGlobals::ensure(); - SW_MOD()->ClearRedlineAuthors(); - - comphelper::LibreOfficeKit::setActive(true); -} - -void SwTiledRenderingTest::tearDown() -{ - if (mxComponent.is()) - { - SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - if (pWrtShell) - { - pWrtShell->GetSfxViewShell()->setLibreOfficeKitViewCallback(nullptr); - } - mxComponent->dispose(); - mxComponent.clear(); - } - m_callbackWrapper.clear(); - comphelper::LibreOfficeKit::setActive(false); - - test::BootstrapFixture::tearDown(); -} - -SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName) -{ - if (!pName) - createSwDoc(); - else - createSwDoc(pName); - - SwXTextDocument* pTextDocument = getSwTextDoc(); - pTextDocument->initializeForTiledRendering(uno::Sequence()); - return pTextDocument; -} - -void SwTiledRenderingTest::setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell) -{ - pViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); - m_callbackWrapper.setLOKViewId(SfxLokHelper::getView(pViewShell)); -} - -void SwTiledRenderingTest::callback(int nType, const char* pPayload, void* pData) -{ - static_cast(pData)->callbackImpl(nType, pPayload); -} - -void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) -{ - OString aPayload(pPayload); - switch (nType) - { - case LOK_CALLBACK_INVALIDATE_TILES: - { - tools::Rectangle aInvalidation; - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); - if (std::string_view("EMPTY") == pPayload) - { - m_bFullInvalidateSeen = true; - return; - } - - CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); - aInvalidation.SetLeft(aSeq[0].toInt32()); - aInvalidation.SetTop(aSeq[1].toInt32()); - aInvalidation.setWidth(aSeq[2].toInt32()); - aInvalidation.setHeight(aSeq[3].toInt32()); - if (m_aInvalidation.IsEmpty()) - { - m_aInvalidation = aInvalidation; - } - m_aInvalidations.Union(aInvalidation); - ++m_nInvalidations; - } - break; - case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: - { - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); - CPPUNIT_ASSERT_EQUAL(static_cast(2), aSeq.getLength()); - m_aDocumentSize.setWidth(aSeq[0].toInt32()); - m_aDocumentSize.setHeight(aSeq[1].toInt32()); - } - break; - case LOK_CALLBACK_TEXT_SELECTION: - { - m_aTextSelection = pPayload; - if (m_aSearchResultSelection.empty()) - ++m_nSelectionBeforeSearchResult; - else - ++m_nSelectionAfterSearchResult; - } - break; - case LOK_CALLBACK_SEARCH_NOT_FOUND: - { - m_bFound = false; - } - break; - case LOK_CALLBACK_SEARCH_RESULT_SELECTION: - { - m_aSearchResultSelection.clear(); - boost::property_tree::ptree aTree; - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, aTree); - for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) - { - m_aSearchResultSelection.emplace_back(rValue.second.get("rectangles").c_str()); - m_aSearchResultPart.push_back(std::atoi(rValue.second.get("part").c_str())); - } - } - break; - case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED: - { - ++m_nRedlineTableSizeChanged; - } - break; - case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED: - { - ++m_nRedlineTableEntryModified; - } - break; - case LOK_CALLBACK_STATE_CHANGED: - { - OString aTrackedChangeIndexPrefix(".uno:TrackedChangeIndex="_ostr); - if (aPayload.startsWith(aTrackedChangeIndexPrefix)) - { - OString sIndex = aPayload.copy(aTrackedChangeIndexPrefix.getLength()); - if (sIndex.isEmpty()) - m_nTrackedChangeIndex = -1; - else - m_nTrackedChangeIndex = sIndex.toInt32(); - } - } - break; - case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: - { - if (comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation()) - { - boost::property_tree::ptree aTree; - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, aTree); - boost::property_tree::ptree &aChild = aTree.get_child("hyperlink"); - m_sHyperlinkText = OString(aChild.get("text", "")); - m_sHyperlinkLink = OString(aChild.get("link", "")); - } - } - break; - case LOK_CALLBACK_FORM_FIELD_BUTTON: - { - m_aFormFieldButton = OString(pPayload); - } - break; - case LOK_CALLBACK_CONTENT_CONTROL: - { - m_aContentControl = OString(pPayload); - } - break; - case LOK_CALLBACK_GRAPHIC_SELECTION: - { - m_ShapeSelection = OString(pPayload); - } - break; - case LOK_CALLBACK_TOOLTIP: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - m_aTooltip.text = aTree.get_child("text").get_value(); - m_aTooltip.rect = aTree.get_child("rectangle").get_value(); - } - break; - } - -} - CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testRegisterCallback) { createDoc("dummy.fodt"); @@ -741,234 +493,6 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPartHash) } } -namespace { - - /// A view callback tracks callbacks invoked on one specific view. - class ViewCallback final - { - SfxViewShell* mpViewShell; - int mnView; - public: - bool m_bOwnCursorInvalidated; - int m_nOwnCursorInvalidatedBy; - bool m_bOwnCursorAtOrigin; - tools::Rectangle m_aOwnCursor; - bool m_bViewCursorInvalidated; - tools::Rectangle m_aViewCursor; - bool m_bOwnSelectionSet; - bool m_bViewSelectionSet; - OString m_aViewSelection; - OString m_aViewRenderState; - bool m_bTilesInvalidated; - bool m_bViewCursorVisible; - bool m_bGraphicViewSelection; - bool m_bGraphicSelection; - bool m_bViewLock; - OString m_aDocColor; - /// Set if any callback was invoked. - bool m_bCalled; - /// Redline table size changed payload - boost::property_tree::ptree m_aRedlineTableChanged; - /// Redline table modified payload - boost::property_tree::ptree m_aRedlineTableModified; - /// Post-it / annotation payload. - boost::property_tree::ptree m_aComment; - TestLokCallbackWrapper m_callbackWrapper; - - ViewCallback(SfxViewShell* pViewShell = nullptr, std::function const & rBeforeInstallFunc = {}) - : m_bOwnCursorInvalidated(false), - m_nOwnCursorInvalidatedBy(-1), - m_bOwnCursorAtOrigin(false), - m_bViewCursorInvalidated(false), - m_bOwnSelectionSet(false), - m_bViewSelectionSet(false), - m_bTilesInvalidated(false), - m_bViewCursorVisible(false), - m_bGraphicViewSelection(false), - m_bGraphicSelection(false), - m_bViewLock(false), - m_bCalled(false), - m_callbackWrapper(&callback, this) - { - // Because one call-site wants to set the bool fields up before the callback is installed - if (rBeforeInstallFunc) - rBeforeInstallFunc(*this); - - mpViewShell = pViewShell ? pViewShell : SfxViewShell::Current(); - mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); - mnView = SfxLokHelper::getView(); - m_callbackWrapper.setLOKViewId( mnView ); - } - - ~ViewCallback() - { - SfxLokHelper::setView(mnView); - mpViewShell->setLibreOfficeKitViewCallback(nullptr); - } - - static void callback(int nType, const char* pPayload, void* pData) - { - static_cast(pData)->callbackImpl(nType, pPayload); - } - - void callbackImpl(int nType, const char* pPayload) - { - OString aPayload(pPayload); - m_bCalled = true; - switch (nType) - { - case LOK_CALLBACK_INVALIDATE_TILES: - { - m_bTilesInvalidated = true; - } - break; - case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: - { - m_bOwnCursorInvalidated = true; - - OString sRect; - if(comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation()) - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - sRect = OString(aTree.get_child("rectangle").get_value()); - m_nOwnCursorInvalidatedBy = aTree.get_child("viewId").get_value(); - } - else - sRect = aPayload; - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::fromUtf8(sRect)); - if (std::string_view("EMPTY") == pPayload) - return; - CPPUNIT_ASSERT_EQUAL(static_cast(4), aSeq.getLength()); - m_aOwnCursor.SetLeft(aSeq[0].toInt32()); - m_aOwnCursor.SetTop(aSeq[1].toInt32()); - m_aOwnCursor.setWidth(aSeq[2].toInt32()); - m_aOwnCursor.setHeight(aSeq[3].toInt32()); - if (m_aOwnCursor.Left() == 0 && m_aOwnCursor.Top() == 0) - m_bOwnCursorAtOrigin = true; - } - break; - case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR: - { - m_bViewCursorInvalidated = true; - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - OString aRect( aTree.get_child("rectangle").get_value() ); - - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::fromUtf8(aRect)); - if (std::string_view("EMPTY") == pPayload) - return; - CPPUNIT_ASSERT_EQUAL(static_cast(4), aSeq.getLength()); - m_aViewCursor.SetLeft(aSeq[0].toInt32()); - m_aViewCursor.SetTop(aSeq[1].toInt32()); - m_aViewCursor.setWidth(aSeq[2].toInt32()); - m_aViewCursor.setHeight(aSeq[3].toInt32()); - } - break; - case LOK_CALLBACK_TEXT_SELECTION: - { - m_bOwnSelectionSet = true; - } - break; - case LOK_CALLBACK_TEXT_VIEW_SELECTION: - { - m_bViewSelectionSet = true; - m_aViewSelection = aPayload; - } - break; - case LOK_CALLBACK_VIEW_CURSOR_VISIBLE: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - m_bViewCursorVisible = aTree.get_child("visible").get_value() == "true"; - } - break; - case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - m_bGraphicViewSelection = aTree.get_child("selection").get_value() != "EMPTY"; - } - break; - case LOK_CALLBACK_GRAPHIC_SELECTION: - { - m_bGraphicSelection = aPayload != "EMPTY"; - } - break; - case LOK_CALLBACK_VIEW_LOCK: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - m_bViewLock = aTree.get_child("rectangle").get_value() != "EMPTY"; - } - break; - case LOK_CALLBACK_VIEW_RENDER_STATE: - { - m_aViewRenderState = pPayload; - } - break; - case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED: - { - m_aRedlineTableChanged.clear(); - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, m_aRedlineTableChanged); - m_aRedlineTableChanged = m_aRedlineTableChanged.get_child("redline"); - } - break; - case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED: - { - m_aRedlineTableModified.clear(); - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, m_aRedlineTableModified); - m_aRedlineTableModified = m_aRedlineTableModified.get_child("redline"); - } - break; - case LOK_CALLBACK_COMMENT: - { - m_aComment.clear(); - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, m_aComment); - m_aComment = m_aComment.get_child("comment"); - } - break; - case LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR: - { - m_aDocColor = aPayload; - break; - } - } - } - }; - - class TestResultListener : public cppu::WeakImplHelper - { - public: - sal_uInt32 m_nDocRepair; - - TestResultListener() : m_nDocRepair(0) - { - } - - virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& rEvent) override - { - if (rEvent.State == frame::DispatchResultState::SUCCESS) - { - rEvent.Result >>= m_nDocRepair; - } - } - - virtual void SAL_CALL disposing(const css::lang::EventObject&) override - { - } - }; - -} - CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testMissingInvalidation) { // Create two views. diff --git a/sw/qa/extras/tiledrendering/tiledrendering2.cxx b/sw/qa/extras/tiledrendering/tiledrendering2.cxx index 37aded0e0a45..f628042a447d 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering2.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering2.cxx @@ -7,159 +7,26 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include - -#include +#include "tiledrenderingmodeltestbase.cxx" #include -#include -#include #include #include #include #include #include -#include -#include #include -#include #include #include -#include #include #include -#include -#include #include -#include -#include #include namespace { -/// Writer tests with comphelper::LibreOfficeKit::isActive() enabled, part 2. -class SwTiledRenderingTest : public SwModelTestBase -{ -public: - SwTiledRenderingTest(); - virtual void setUp() override; - virtual void tearDown() override; - -protected: - SwXTextDocument* createDoc(const char* pName = nullptr); -}; - -SwTiledRenderingTest::SwTiledRenderingTest() - : SwModelTestBase(u"/sw/qa/extras/tiledrendering/data/"_ustr) -{ -} - -void SwTiledRenderingTest::setUp() -{ - SwModelTestBase::setUp(); - SwGlobals::ensure(); - SW_MOD()->ClearRedlineAuthors(); - comphelper::LibreOfficeKit::setActive(true); -} - -void SwTiledRenderingTest::tearDown() -{ - if (mxComponent.is()) - { - mxComponent->dispose(); - mxComponent.clear(); - } - comphelper::LibreOfficeKit::setActive(false); - test::BootstrapFixture::tearDown(); -} - -SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName) -{ - if (!pName) - createSwDoc(); - else - createSwDoc(pName); - SwXTextDocument* pTextDocument = getSwTextDoc(); - pTextDocument->initializeForTiledRendering(uno::Sequence()); - return pTextDocument; -} - -/// Test callback that works with comphelper::LibreOfficeKit::setAnyInputCallback(). -class AnyInputCallback final -{ -public: - static bool callback(void* /*pData*/) { return true; } - - AnyInputCallback() { comphelper::LibreOfficeKit::setAnyInputCallback(&callback, this); } - - ~AnyInputCallback() { comphelper::LibreOfficeKit::setAnyInputCallback(nullptr, nullptr); } -}; - -/// A view callback tracks callbacks invoked on one specific view. -class ViewCallback final -{ - SfxViewShell* mpViewShell; - int mnView; - -public: - std::vector m_aStateChanges; - tools::Rectangle m_aInvalidations; - bool m_bFullInvalidateSeen = false; - TestLokCallbackWrapper m_callbackWrapper; - - ViewCallback() - : m_callbackWrapper(&callback, this) - { - mpViewShell = SfxViewShell::Current(); - mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); - mnView = SfxLokHelper::getView(); - m_callbackWrapper.setLOKViewId(mnView); - } - - ~ViewCallback() - { - SfxLokHelper::setView(mnView); - mpViewShell->setLibreOfficeKitViewCallback(nullptr); - } - - static void callback(int nType, const char* pPayload, void* pData) - { - static_cast(pData)->callbackImpl(nType, pPayload); - } - - void callbackImpl(int nType, const char* pPayload) - { - switch (nType) - { - case LOK_CALLBACK_INVALIDATE_TILES: - { - if (std::string_view("EMPTY") == pPayload) - { - m_bFullInvalidateSeen = true; - return; - } - uno::Sequence aSeq - = comphelper::string::convertCommaSeparated(OUString::fromUtf8(pPayload)); - CPPUNIT_ASSERT_EQUAL(static_cast(4), aSeq.getLength()); - tools::Rectangle aInvalidation; - aInvalidation.SetLeft(aSeq[0].toInt32()); - aInvalidation.SetTop(aSeq[1].toInt32()); - aInvalidation.setWidth(aSeq[2].toInt32()); - aInvalidation.setHeight(aSeq[3].toInt32()); - m_aInvalidations.Union(aInvalidation); - break; - } - case LOK_CALLBACK_STATE_CHANGED: - { - m_aStateChanges.push_back(pPayload); - break; - } - } - } -}; - CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testStatusBarPageNumber) { // Given a document with 2 pages, first view on page 1, second view on page 2: @@ -225,30 +92,30 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPasteInvalidateNumRules) // Given a document with 3 pages: first page is ~empty, then page break, then pages 2 & 3 have // bullets: createDoc("numrules.odt"); - ViewCallback aView; SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + setupLibreOfficeKitViewCallback(pWrtShell->GetSfxViewShell()); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Insert(u"test"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 4, /*bBasicCall=*/false); dispatchCommand(mxComponent, u".uno:Cut"_ustr, {}); - aView.m_aInvalidations = tools::Rectangle(); - aView.m_bFullInvalidateSeen = false; + m_aInvalidations = tools::Rectangle(); + m_bFullInvalidateSeen = false; // When pasting at the end of page 1: dispatchCommand(mxComponent, u".uno:PasteUnformatted"_ustr, {}); // Then make sure we only invalidate page 1, not page 2 or page 3: - CPPUNIT_ASSERT(!aView.m_bFullInvalidateSeen); + CPPUNIT_ASSERT(!m_bFullInvalidateSeen); SwRootFrame* pLayout = pWrtShell->GetLayout(); SwFrame* pPage1 = pLayout->GetLower(); - CPPUNIT_ASSERT(aView.m_aInvalidations.Overlaps(pPage1->getFrameArea().SVRect())); + CPPUNIT_ASSERT(m_aInvalidations.Overlaps(pPage1->getFrameArea().SVRect())); SwFrame* pPage2 = pPage1->GetNext(); // Without the accompanying fix in place, this test would have failed, we invalidated page 2 and // page 3 as well. - CPPUNIT_ASSERT(!aView.m_aInvalidations.Overlaps(pPage2->getFrameArea().SVRect())); + CPPUNIT_ASSERT(!m_aInvalidations.Overlaps(pPage2->getFrameArea().SVRect())); SwFrame* pPage3 = pPage2->GetNext(); - CPPUNIT_ASSERT(!aView.m_aInvalidations.Overlaps(pPage3->getFrameArea().SVRect())); + CPPUNIT_ASSERT(!m_aInvalidations.Overlaps(pPage3->getFrameArea().SVRect())); } CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPasteInvalidateNumRulesBullet) @@ -256,32 +123,32 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPasteInvalidateNumRulesBullet) // Given a document with 3 pages: first page is ~empty, then page break, then pages 2 & 3 have // bullets: createDoc("numrules.odt"); - ViewCallback aView; SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + setupLibreOfficeKitViewCallback(pWrtShell->GetSfxViewShell()); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Insert(u"test"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 4, /*bBasicCall=*/false); dispatchCommand(mxComponent, u".uno:Cut"_ustr, {}); dispatchCommand(mxComponent, u".uno:DefaultBullet"_ustr, {}); - aView.m_aInvalidations = tools::Rectangle(); - aView.m_bFullInvalidateSeen = false; + m_aInvalidations = tools::Rectangle(); + m_bFullInvalidateSeen = false; // When pasting at the end of page 1, in a paragraph that is a bullet (a list, but not a // numbering): dispatchCommand(mxComponent, u".uno:PasteUnformatted"_ustr, {}); // Then make sure we only invalidate page 1, not page 2 or page 3: - CPPUNIT_ASSERT(!aView.m_bFullInvalidateSeen); + CPPUNIT_ASSERT(!m_bFullInvalidateSeen); SwRootFrame* pLayout = pWrtShell->GetLayout(); SwFrame* pPage1 = pLayout->GetLower(); - CPPUNIT_ASSERT(aView.m_aInvalidations.Overlaps(pPage1->getFrameArea().SVRect())); + CPPUNIT_ASSERT(m_aInvalidations.Overlaps(pPage1->getFrameArea().SVRect())); SwFrame* pPage2 = pPage1->GetNext(); // Without the accompanying fix in place, this test would have failed, we invalidated page 2 and // page 3 as well. - CPPUNIT_ASSERT(!aView.m_aInvalidations.Overlaps(pPage2->getFrameArea().SVRect())); + CPPUNIT_ASSERT(!m_aInvalidations.Overlaps(pPage2->getFrameArea().SVRect())); SwFrame* pPage3 = pPage2->GetNext(); - CPPUNIT_ASSERT(!aView.m_aInvalidations.Overlaps(pPage3->getFrameArea().SVRect())); + CPPUNIT_ASSERT(!m_aInvalidations.Overlaps(pPage3->getFrameArea().SVRect())); } CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testAsyncLayout) diff --git a/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx b/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx new file mode 100644 index 000000000000..62d41e0a63b0 --- /dev/null +++ b/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx @@ -0,0 +1,510 @@ +/* -*- 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/. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/// Testsuite for the SwXTextDocument methods implementing the vcl::ITiledRenderable interface. +class SwTiledRenderingTest : public SwModelTestBase +{ +public: + SwTiledRenderingTest(); + virtual void setUp() override; + virtual void tearDown() override; + +protected: + SwXTextDocument* createDoc(const char* pName = nullptr); + void setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell); + static void callback(int nType, const char* pPayload, void* pData); + void callbackImpl(int nType, const char* pPayload); + // First invalidation. + tools::Rectangle m_aInvalidation; + /// Union of all invalidations. + tools::Rectangle m_aInvalidations; + Size m_aDocumentSize; + OString m_aTextSelection; + bool m_bFound; + std::vector m_aSearchResultSelection; + std::vector m_aSearchResultPart; + int m_nSelectionBeforeSearchResult; + int m_nSelectionAfterSearchResult; + int m_nInvalidations; + int m_nRedlineTableSizeChanged; + int m_nRedlineTableEntryModified; + int m_nTrackedChangeIndex; + bool m_bFullInvalidateSeen; + OString m_sHyperlinkText; + OString m_sHyperlinkLink; + OString m_aFormFieldButton; + OString m_aContentControl; + OString m_ShapeSelection; + struct + { + std::string text; + std::string rect; + } m_aTooltip; + TestLokCallbackWrapper m_callbackWrapper; +}; + +SwTiledRenderingTest::SwTiledRenderingTest() + : SwModelTestBase(u"/sw/qa/extras/tiledrendering/data/"_ustr) + , m_bFound(true) + , m_nSelectionBeforeSearchResult(0) + , m_nSelectionAfterSearchResult(0) + , m_nInvalidations(0) + , m_nRedlineTableSizeChanged(0) + , m_nRedlineTableEntryModified(0) + , m_nTrackedChangeIndex(-1) + , m_bFullInvalidateSeen(false) + , m_callbackWrapper(&callback, this) +{ +} + +void SwTiledRenderingTest::setUp() +{ + SwModelTestBase::setUp(); + + SwGlobals::ensure(); + SW_MOD()->ClearRedlineAuthors(); + + comphelper::LibreOfficeKit::setActive(true); +} + +void SwTiledRenderingTest::tearDown() +{ + if (mxComponent.is()) + { + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + if (pWrtShell) + { + pWrtShell->GetSfxViewShell()->setLibreOfficeKitViewCallback(nullptr); + } + mxComponent->dispose(); + mxComponent.clear(); + } + m_callbackWrapper.clear(); + comphelper::LibreOfficeKit::setActive(false); + + test::BootstrapFixture::tearDown(); +} + +SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName) +{ + if (!pName) + createSwDoc(); + else + createSwDoc(pName); + + SwXTextDocument* pTextDocument = getSwTextDoc(); + pTextDocument->initializeForTiledRendering(uno::Sequence()); + return pTextDocument; +} + +void SwTiledRenderingTest::setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell) +{ + pViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); + m_callbackWrapper.setLOKViewId(SfxLokHelper::getView(pViewShell)); +} + +void SwTiledRenderingTest::callback(int nType, const char* pPayload, void* pData) +{ + static_cast(pData)->callbackImpl(nType, pPayload); +} + +void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) +{ + OString aPayload(pPayload); + switch (nType) + { + case LOK_CALLBACK_INVALIDATE_TILES: + { + tools::Rectangle aInvalidation; + uno::Sequence aSeq + = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); + if (std::string_view("EMPTY") == pPayload) + { + m_bFullInvalidateSeen = true; + return; + } + + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); + aInvalidation.SetLeft(aSeq[0].toInt32()); + aInvalidation.SetTop(aSeq[1].toInt32()); + aInvalidation.setWidth(aSeq[2].toInt32()); + aInvalidation.setHeight(aSeq[3].toInt32()); + if (m_aInvalidation.IsEmpty()) + { + m_aInvalidation = aInvalidation; + } + m_aInvalidations.Union(aInvalidation); + ++m_nInvalidations; + } + break; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { + uno::Sequence aSeq + = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); + CPPUNIT_ASSERT_EQUAL(static_cast(2), aSeq.getLength()); + m_aDocumentSize.setWidth(aSeq[0].toInt32()); + m_aDocumentSize.setHeight(aSeq[1].toInt32()); + } + break; + case LOK_CALLBACK_TEXT_SELECTION: + { + m_aTextSelection = pPayload; + if (m_aSearchResultSelection.empty()) + ++m_nSelectionBeforeSearchResult; + else + ++m_nSelectionAfterSearchResult; + } + break; + case LOK_CALLBACK_SEARCH_NOT_FOUND: + { + m_bFound = false; + } + break; + case LOK_CALLBACK_SEARCH_RESULT_SELECTION: + { + m_aSearchResultSelection.clear(); + boost::property_tree::ptree aTree; + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, aTree); + for (const boost::property_tree::ptree::value_type& rValue : + aTree.get_child("searchResultSelection")) + { + m_aSearchResultSelection.emplace_back( + rValue.second.get("rectangles").c_str()); + m_aSearchResultPart.push_back( + std::atoi(rValue.second.get("part").c_str())); + } + } + break; + case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED: + { + ++m_nRedlineTableSizeChanged; + } + break; + case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED: + { + ++m_nRedlineTableEntryModified; + } + break; + case LOK_CALLBACK_STATE_CHANGED: + { + OString aTrackedChangeIndexPrefix(".uno:TrackedChangeIndex="_ostr); + if (aPayload.startsWith(aTrackedChangeIndexPrefix)) + { + OString sIndex = aPayload.copy(aTrackedChangeIndexPrefix.getLength()); + if (sIndex.isEmpty()) + m_nTrackedChangeIndex = -1; + else + m_nTrackedChangeIndex = sIndex.toInt32(); + } + } + break; + case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: + { + if (comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation()) + { + boost::property_tree::ptree aTree; + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, aTree); + boost::property_tree::ptree& aChild = aTree.get_child("hyperlink"); + m_sHyperlinkText = OString(aChild.get("text", "")); + m_sHyperlinkLink = OString(aChild.get("link", "")); + } + } + break; + case LOK_CALLBACK_FORM_FIELD_BUTTON: + { + m_aFormFieldButton = OString(pPayload); + } + break; + case LOK_CALLBACK_CONTENT_CONTROL: + { + m_aContentControl = OString(pPayload); + } + break; + case LOK_CALLBACK_GRAPHIC_SELECTION: + { + m_ShapeSelection = OString(pPayload); + } + break; + case LOK_CALLBACK_TOOLTIP: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + m_aTooltip.text = aTree.get_child("text").get_value(); + m_aTooltip.rect = aTree.get_child("rectangle").get_value(); + } + break; + } +} + +/// A view callback tracks callbacks invoked on one specific view. +class ViewCallback final +{ + SfxViewShell* mpViewShell; + int mnView; + +public: + bool m_bOwnCursorInvalidated; + int m_nOwnCursorInvalidatedBy; + bool m_bOwnCursorAtOrigin; + tools::Rectangle m_aOwnCursor; + bool m_bViewCursorInvalidated; + tools::Rectangle m_aViewCursor; + bool m_bOwnSelectionSet; + bool m_bViewSelectionSet; + OString m_aViewSelection; + OString m_aViewRenderState; + bool m_bTilesInvalidated; + bool m_bViewCursorVisible; + bool m_bGraphicViewSelection; + bool m_bGraphicSelection; + bool m_bViewLock; + OString m_aDocColor; + /// Set if any callback was invoked. + bool m_bCalled; + /// Redline table size changed payload + boost::property_tree::ptree m_aRedlineTableChanged; + /// Redline table modified payload + boost::property_tree::ptree m_aRedlineTableModified; + /// Post-it / annotation payload. + boost::property_tree::ptree m_aComment; + std::vector m_aStateChanges; + TestLokCallbackWrapper m_callbackWrapper; + + ViewCallback(SfxViewShell* pViewShell = nullptr, + std::function const& rBeforeInstallFunc = {}) + : m_bOwnCursorInvalidated(false) + , m_nOwnCursorInvalidatedBy(-1) + , m_bOwnCursorAtOrigin(false) + , m_bViewCursorInvalidated(false) + , m_bOwnSelectionSet(false) + , m_bViewSelectionSet(false) + , m_bTilesInvalidated(false) + , m_bViewCursorVisible(false) + , m_bGraphicViewSelection(false) + , m_bGraphicSelection(false) + , m_bViewLock(false) + , m_bCalled(false) + , m_callbackWrapper(&callback, this) + { + // Because one call-site wants to set the bool fields up before the callback is installed + if (rBeforeInstallFunc) + rBeforeInstallFunc(*this); + + mpViewShell = pViewShell ? pViewShell : SfxViewShell::Current(); + mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); + mnView = SfxLokHelper::getView(); + m_callbackWrapper.setLOKViewId(mnView); + } + + ~ViewCallback() + { + SfxLokHelper::setView(mnView); + mpViewShell->setLibreOfficeKitViewCallback(nullptr); + } + + static void callback(int nType, const char* pPayload, void* pData) + { + static_cast(pData)->callbackImpl(nType, pPayload); + } + + void callbackImpl(int nType, const char* pPayload) + { + OString aPayload(pPayload); + m_bCalled = true; + switch (nType) + { + case LOK_CALLBACK_STATE_CHANGED: + { + m_aStateChanges.push_back(pPayload); + break; + } + case LOK_CALLBACK_INVALIDATE_TILES: + { + m_bTilesInvalidated = true; + } + break; + case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: + { + m_bOwnCursorInvalidated = true; + + OString sRect; + if (comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation()) + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + sRect = OString(aTree.get_child("rectangle").get_value()); + m_nOwnCursorInvalidatedBy = aTree.get_child("viewId").get_value(); + } + else + sRect = aPayload; + uno::Sequence aSeq + = comphelper::string::convertCommaSeparated(OUString::fromUtf8(sRect)); + if (std::string_view("EMPTY") == pPayload) + return; + CPPUNIT_ASSERT_EQUAL(static_cast(4), aSeq.getLength()); + m_aOwnCursor.SetLeft(aSeq[0].toInt32()); + m_aOwnCursor.SetTop(aSeq[1].toInt32()); + m_aOwnCursor.setWidth(aSeq[2].toInt32()); + m_aOwnCursor.setHeight(aSeq[3].toInt32()); + if (m_aOwnCursor.Left() == 0 && m_aOwnCursor.Top() == 0) + m_bOwnCursorAtOrigin = true; + } + break; + case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR: + { + m_bViewCursorInvalidated = true; + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + OString aRect(aTree.get_child("rectangle").get_value()); + + uno::Sequence aSeq + = comphelper::string::convertCommaSeparated(OUString::fromUtf8(aRect)); + if (std::string_view("EMPTY") == pPayload) + return; + CPPUNIT_ASSERT_EQUAL(static_cast(4), aSeq.getLength()); + m_aViewCursor.SetLeft(aSeq[0].toInt32()); + m_aViewCursor.SetTop(aSeq[1].toInt32()); + m_aViewCursor.setWidth(aSeq[2].toInt32()); + m_aViewCursor.setHeight(aSeq[3].toInt32()); + } + break; + case LOK_CALLBACK_TEXT_SELECTION: + { + m_bOwnSelectionSet = true; + } + break; + case LOK_CALLBACK_TEXT_VIEW_SELECTION: + { + m_bViewSelectionSet = true; + m_aViewSelection = aPayload; + } + break; + case LOK_CALLBACK_VIEW_CURSOR_VISIBLE: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + m_bViewCursorVisible + = aTree.get_child("visible").get_value() == "true"; + } + break; + case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + m_bGraphicViewSelection + = aTree.get_child("selection").get_value() != "EMPTY"; + } + break; + case LOK_CALLBACK_GRAPHIC_SELECTION: + { + m_bGraphicSelection = aPayload != "EMPTY"; + } + break; + case LOK_CALLBACK_VIEW_LOCK: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + m_bViewLock = aTree.get_child("rectangle").get_value() != "EMPTY"; + } + break; + case LOK_CALLBACK_VIEW_RENDER_STATE: + { + m_aViewRenderState = pPayload; + } + break; + case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED: + { + m_aRedlineTableChanged.clear(); + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, m_aRedlineTableChanged); + m_aRedlineTableChanged = m_aRedlineTableChanged.get_child("redline"); + } + break; + case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED: + { + m_aRedlineTableModified.clear(); + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, m_aRedlineTableModified); + m_aRedlineTableModified = m_aRedlineTableModified.get_child("redline"); + } + break; + case LOK_CALLBACK_COMMENT: + { + m_aComment.clear(); + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, m_aComment); + m_aComment = m_aComment.get_child("comment"); + } + break; + case LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR: + { + m_aDocColor = aPayload; + break; + } + } + } +}; + +class TestResultListener : public cppu::WeakImplHelper +{ +public: + sal_uInt32 m_nDocRepair; + + TestResultListener() + : m_nDocRepair(0) + { + } + + virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& rEvent) override + { + if (rEvent.State == frame::DispatchResultState::SUCCESS) + { + rEvent.Result >>= m_nDocRepair; + } + } + + virtual void SAL_CALL disposing(const css::lang::EventObject&) override {} +}; + +/// Test callback that works with comphelper::LibreOfficeKit::setAnyInputCallback(). +class AnyInputCallback final +{ +public: + static bool callback(void* /*pData*/) { return true; } + + AnyInputCallback() { comphelper::LibreOfficeKit::setAnyInputCallback(&callback, this); } + + ~AnyInputCallback() { comphelper::LibreOfficeKit::setAnyInputCallback(nullptr, nullptr); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 2bb92e0a9da148df662bc697eeb835cc1161544a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 19 Nov 2024 22:11:18 +0100 Subject: [PATCH 043/373] gtk3 a11y: Use OString literals Change-Id: I23365943e79847e3c7162808de3dc176f7db2b0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176804 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/unx/gtk3/a11y/atkwrapper.cxx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx index 6c71c40d0ed3..317c8290f461 100644 --- a/vcl/unx/gtk3/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx @@ -814,61 +814,61 @@ static bool isTableCell(uno::XInterface* pInterface) extern "C" { typedef GType (* GetGIfaceType ) (); } -const struct { - const char *name; +constexpr struct { + OString sName; GInterfaceInitFunc const aInit; GetGIfaceType const aGetGIfaceType; const uno::Type & (*aGetUnoType) (); } aTypeTable[] = { // re-location heaven: { - "Comp", componentIfaceInit, + "Comp"_ostr, componentIfaceInit, atk_component_get_type, cppu::UnoType::get }, { - "Act", actionIfaceInit, + "Act"_ostr, actionIfaceInit, atk_action_get_type, cppu::UnoType::get }, { - "Txt", textIfaceInit, + "Txt"_ostr, textIfaceInit, atk_text_get_type, cppu::UnoType::get }, { - "Val", valueIfaceInit, + "Val"_ostr, valueIfaceInit, atk_value_get_type, cppu::UnoType::get }, { - "Tab", tableIfaceInit, + "Tab"_ostr, tableIfaceInit, atk_table_get_type, cppu::UnoType::get }, { - "Cell", tablecellIfaceInit, + "Cell"_ostr, tablecellIfaceInit, atk_table_cell_get_type, // there is no UNO a11y interface for table cells, so this case is handled separately below nullptr }, { - "Edt", editableTextIfaceInit, + "Edt"_ostr, editableTextIfaceInit, atk_editable_text_get_type, cppu::UnoType::get }, { - "Img", imageIfaceInit, + "Img"_ostr, imageIfaceInit, atk_image_get_type, cppu::UnoType::get }, { - "Hyp", hypertextIfaceInit, + "Hyp"_ostr, hypertextIfaceInit, atk_hypertext_get_type, cppu::UnoType::get }, { - "Sel", selectionIfaceInit, + "Sel"_ostr, selectionIfaceInit, atk_selection_get_type, cppu::UnoType::get } @@ -887,19 +887,19 @@ ensureTypeFor( uno::XInterface *pAccessible ) for( i = 0; i < aTypeTableSize; i++ ) { - if(!g_strcmp0(aTypeTable[i].name, "Cell")) + if (aTypeTable[i].sName == "Cell") { // there is no UNO interface for table cells, but AtkTableCell can be supported // for table cells via the methods of the parent that is a table if (isTableCell(pAccessible)) { - aTypeNameBuf.append(aTypeTable[i].name); + aTypeNameBuf.append(aTypeTable[i].sName); bTypes[i] = true; } } else if (isOfType( pAccessible, aTypeTable[i].aGetUnoType() ) ) { - aTypeNameBuf.append(aTypeTable[i].name); + aTypeNameBuf.append(aTypeTable[i].sName); bTypes[i] = true; } } From 1ed564ecb73f2cab3a921a5bde67b9db48ea04a3 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Mon, 18 Nov 2024 14:13:05 +0100 Subject: [PATCH 044/373] tdf#163967 RTF: Pasting/loading hyperlink imports font color and underline Hyperlinks are typically colored and underlined. The RTF import - also used when pasting from clipbard - now evaluates font color and underline in the field result. Change-Id: I725fc3e94746c96d68379c021fb0c12cd3750096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176714 Reviewed-by: Thorsten Behrens Tested-by: Gabor Kelemen Tested-by: Jenkins --- editeng/source/editeng/eertfpar.cxx | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 615147f4c148..deacdfa5905a 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -517,12 +519,16 @@ void EditRTFParser::ReadField() int _nOpenBrackets = 1; // the first was already detected earlier bool bFldInst = false; bool bFldRslt = false; + bool bUnderline = false; + Color aColor; + bool bColor = false; OUString aFldInst; OUString aFldRslt; while( _nOpenBrackets && IsParserWorking() ) { - switch( GetNextToken() ) + auto nNextToken = GetNextToken(); + switch( nNextToken ) { case '}': { @@ -555,6 +561,21 @@ void EditRTFParser::ReadField() aFldRslt += aToken; } break; + case RTF_CF: + { + if (bFldRslt) + { + aColor = GetColor(sal_uInt16(nTokenValue)); + bColor = true; + } + } + break; + case RTF_UL: + { + if (bFldRslt) + bUnderline = true; + } + break; } } if ( !aFldInst.isEmpty() ) @@ -572,6 +593,17 @@ void EditRTFParser::ReadField() SvxFieldItem aField( SvxURLField( aFldInst, aFldRslt, SvxURLFormat::Repr ), EE_FEATURE_FIELD ); aCurSel = mpEditEngine->InsertField(aCurSel, aField); + if (bUnderline || bColor ) + { + SfxItemSet aAttribs( mpEditEngine->GetEmptyItemSet() ); + if (bUnderline) + aAttribs.Put(SvxUnderlineItem(LINESTYLE_SINGLE, EE_CHAR_UNDERLINE)); + if (bColor) + aAttribs.Put(SvxColorItem(aColor, EE_CHAR_COLOR)); + EditSelection aAttribSelection(aCurSel.Min(), aCurSel.Max()); + aAttribSelection.Min().SetIndex(aAttribSelection.Min().GetIndex() - 1); + mpEditEngine->SetAttribs(aAttribSelection, aAttribs, SetAttribsMode::Edge); + } mpEditEngine->UpdateFieldsOnly(); bLastActionInsertParaBreak = false; } From b3c93feae131dd7fe812e5d754fbcd96b85d262d Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Wed, 20 Nov 2024 20:06:00 +0100 Subject: [PATCH 045/373] Fix typo Change-Id: If765fa2c6e7df36dd5d62b351898b61ac263a6e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176872 Reviewed-by: Julien Nabet Tested-by: Julien Nabet --- vcl/source/app/svdata.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 98cd3c6da16f..daf1012d1d04 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -158,7 +158,7 @@ namespace } } - // tdf#163428 aToBeDeletedEntry will be destucted, thus the + // tdf#163428 aToBeDeletedEntry will be destructed, thus the // entry referenmced by SharedPtr may be deleted now } From ebce1088ce97587fe358eb76e21979b62881a4ee Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Wed, 20 Nov 2024 20:35:58 +0100 Subject: [PATCH 046/373] Fix typo Change-Id: I4520061338adfcb13d2eece2f59fb8331c7dbf8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176874 Tested-by: Jenkins Reviewed-by: Julien Nabet --- vcl/source/app/svdata.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index daf1012d1d04..60f8bff3799f 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -159,7 +159,7 @@ namespace } // tdf#163428 aToBeDeletedEntry will be destructed, thus the - // entry referenmced by SharedPtr may be deleted now + // entry referenced by SharedPtr may be deleted now } void touchUsage(basegfx::SystemDependentData_SharedPtr& rData) override From 3959d5bddafb61bcd50613d6c6453a2d6fe370b7 Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Wed, 20 Nov 2024 20:05:08 +0100 Subject: [PATCH 047/373] Fix typo Change-Id: I8c8e5c3e6c4e0a8a7f41943ac8c014e1175e093a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176871 Tested-by: Jenkins Reviewed-by: Julien Nabet --- vcl/source/app/svdata.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 60f8bff3799f..f767c2483925 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -237,7 +237,7 @@ namespace // tdf#163428 here aToBeDeletedEntries will be destroyed, the entries will be // decremented and potentially deleted. These are of type SystemDependentData_SharedPtr, - // so we do not need to do anything explicitely here + // so we do not need to do anything explicitly here } } From 1bc4835bd00d12bee93671a01423f4646f4622f0 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Tue, 19 Nov 2024 14:00:59 -0500 Subject: [PATCH 048/373] tdf#163872 ScTable::SetOptimalHeight: optimize if all rows ManualSize SetOptimalHeightsToRows does nothing if all the rows are manualsize. GetOptimalHeightsInColumn can be extremely expensive to run, so exit early if all the processing will have been for nothing. This doesn't solve bug 163872, but it does help with some of the sheets. Change-Id: I425bbd4f181058aa637c92f2abccf7c27dcf607d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176808 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Justin Luth --- sc/source/core/data/table1.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index d6f910d9867d..b61701ecb2db 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -475,6 +475,24 @@ bool ScTable::SetOptimalHeight( return false; } + if (!rCxt.isForceAutoSize()) + { + // Optimize - exit early if all rows have defined height - super expensive GetOptimalHeight + bool bAllRowsAreManualHeight = true; + for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow) + { + size_t nDummy; + CRFlags nRowFlags = pRowFlags->GetValue(nRow, nDummy, nRow); // NOTE: nRow might change + if (!(nRowFlags & CRFlags::ManualSize)) + { + bAllRowsAreManualHeight = false; + break; + } + } + if (bAllRowsAreManualHeight) + return false; + } + SCSIZE nCount = static_cast(nEndRow-nStartRow+1); ScProgress* pProgress = GetProgressBar(nCount, GetWeightedCount(), pOuterProgress, &rDocument); From e2f81814dd51bcbb49395f682a7e9677056fb4bd Mon Sep 17 00:00:00 2001 From: Alain Romedenne Date: Thu, 21 Nov 2024 03:51:04 +0100 Subject: [PATCH 049/373] Update git submodules * Update helpcontent2 from branch 'master' to 4eb5edf36d5bfa7f1dc90c09623086ade07b97b5 - ghost ref to OO.o Change-Id: I92d95d09dea69f9482a9a49ed6a380da017ce749 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/176820 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index aa2f1c2c7172..4eb5edf36d5b 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit aa2f1c2c7172ad20c607734c8c11057ee717599a +Subproject commit 4eb5edf36d5bfa7f1dc90c09623086ade07b97b5 From 8eebf99ec64761fb0461dced4aeef23c9e1824d0 Mon Sep 17 00:00:00 2001 From: Martin Srebotnjak Date: Thu, 21 Nov 2024 07:47:26 +0100 Subject: [PATCH 050/373] Update git submodules * Update translations from branch 'master' to 8f5f1e8348d605be128fcfa742e6fb92d52e758f - Updated Slovenian translation Change-Id: I5502cef3a456758e12170ad6d95a39b152cf63f1 --- translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations b/translations index fdabff5f73e1..8f5f1e8348d6 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit fdabff5f73e16046cb570561051304029eef48f9 +Subproject commit 8f5f1e8348d605be128fcfa742e6fb92d52e758f From 7606a6039aa4aebbb7b8be7abc8495d9c1db2065 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 20 Nov 2024 18:30:47 +0100 Subject: [PATCH 051/373] Missing test dependencies Change-Id: I554ca1edd014f91433a948302762bcd7a3ed64bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176870 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- sfx2/CppunitTest_sfx2_view.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sfx2/CppunitTest_sfx2_view.mk b/sfx2/CppunitTest_sfx2_view.mk index d68b0ab7952e..e207e4132de0 100644 --- a/sfx2/CppunitTest_sfx2_view.mk +++ b/sfx2/CppunitTest_sfx2_view.mk @@ -47,4 +47,13 @@ $(eval $(call gb_CppunitTest_use_custom_headers,sfx2_view,\ $(eval $(call gb_CppunitTest_use_configuration,sfx2_view)) +$(eval $(call gb_CppunitTest_use_executable,sfx2_view,xpdfimport)) + +$(eval $(call gb_CppunitTest_use_uiconfigs,sfx2_view, \ + modules/simpress \ + sfx \ + svt \ + svx \ +)) + # vim: set noet sw=4 ts=4: From 664ecbd8916478cdc28a9c793fbdb9359b3cac64 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 20 Nov 2024 16:08:14 +0200 Subject: [PATCH 052/373] remove OutDevSupportType::TransparentRect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit all our backends support transparency, and have some time, XRender support became mandatory a couple of years ago. Change-Id: Ie2db7e4665068fe88a926e9791d74a82c2e75834 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176852 Tested-by: Jenkins Reviewed-by: Caolán McNamara Reviewed-by: Noel Grandin --- cui/source/options/optgdlg.cxx | 12 +----------- include/svtools/optionsdrawinglayer.hxx | 5 ----- include/vcl/vclenum.hxx | 1 - svtools/source/config/optionsdrawinglayer.cxx | 16 +--------------- svx/source/sdr/overlay/overlayselection.cxx | 6 ------ vcl/headless/CairoCommon.cxx | 1 - vcl/qt5/QtGraphics_GDI.cxx | 11 +---------- vcl/quartz/AquaGraphicsBackend.cxx | 12 +----------- vcl/skia/gdiimpl.cxx | 11 +---------- vcl/win/gdi/gdiimpl.cxx | 14 ++------------ 10 files changed, 7 insertions(+), 82 deletions(-) diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 6ca5847d22cf..65717c944956 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -1065,17 +1065,7 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) m_xUseHardwareAccell->save_state(); { // #i95644# AntiAliasing - if(SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem()) - { - m_xUseAntiAliase->set_active(SvtOptionsDrawinglayer::IsAntiAliasing()); - } - else - { - m_xUseAntiAliase->set_active(false); - m_xUseAntiAliase->set_sensitive(false); - m_xUseAntiAliaseImg->set_visible(true); - } - + m_xUseAntiAliase->set_active(SvtOptionsDrawinglayer::IsAntiAliasing()); bEnable = !officecfg::Office::Common::Drawinglayer::AntiAliasing::isReadOnly(); m_xUseAntiAliase->set_sensitive(bEnable); m_xUseAntiAliaseImg->set_visible(!bEnable); diff --git a/include/svtools/optionsdrawinglayer.hxx b/include/svtools/optionsdrawinglayer.hxx index 28767ce73fbe..e620c0c71e6d 100644 --- a/include/svtools/optionsdrawinglayer.hxx +++ b/include/svtools/optionsdrawinglayer.hxx @@ -42,11 +42,6 @@ namespace SvtOptionsDrawinglayer SVT_DLLPUBLIC Color GetStripeColorA(); SVT_DLLPUBLIC Color GetStripeColorB(); -// #i95644# helper to check if AA is allowed on this system. Currently, for WIN it's disabled -// and OutDevSupportType::TransparentRect is checked (this hits XRenderExtension, e.g. -// currently for SunRay as long as not supported there) -SVT_DLLPUBLIC bool IsAAPossibleOnThisSystem(); - // primitives SVT_DLLPUBLIC bool IsAntiAliasing(); SVT_DLLPUBLIC bool IsSnapHorVerLinesToDiscrete(); diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx index 8d37156a3eec..e19648515d7d 100644 --- a/include/vcl/vclenum.hxx +++ b/include/vcl/vclenum.hxx @@ -164,7 +164,6 @@ typedef sal_uInt32 sal_UCS4; // TODO: this should be moved to rtl enum class OutDevSupportType { - TransparentRect, TransparentText // if alpha in TextColor can be honored }; diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 5c7ad7250472..277d716681f1 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -46,23 +46,9 @@ Color GetStripeColorB() static bool gbPixelSnapHairlineForwardInitial(false); static bool gbPixelSnapHairlineForwardLast(true); -bool IsAAPossibleOnThisSystem() -{ - static const bool gbAllowAA - = Application::GetDefaultDevice()->SupportsOperation(OutDevSupportType::TransparentRect); - return gbAllowAA; -} - - bool IsAntiAliasing() { - bool bAntiAliasing = drawinglayer::geometry::ViewInformation2D::getGlobalAntiAliasing(); - if (bAntiAliasing && !IsAAPossibleOnThisSystem()) - { - drawinglayer::geometry::ViewInformation2D::setGlobalAntiAliasing(false, true); - bAntiAliasing = false; - } - return bAntiAliasing; + return drawinglayer::geometry::ViewInformation2D::getGlobalAntiAliasing(); } /** diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index ff0b3a4a12f7..6f9284696d51 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -106,12 +106,6 @@ namespace sdr::overlay // not possible when in high contrast mode return OverlayType::Invert; } - - if(!pOut->SupportsOperation(OutDevSupportType::TransparentRect)) - { - // not possible when no fast transparence paint is supported on the system - return OverlayType::Invert; - } } } diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index 0cb8ceefdedd..754fd9d1797b 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -1992,7 +1992,6 @@ bool CairoCommon::supportsOperation(OutDevSupportType eType) { switch (eType) { - case OutDevSupportType::TransparentRect: case OutDevSupportType::TransparentText: return true; } diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index fc039c685dc9..8e76741c5f30 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -674,15 +674,6 @@ void QtGraphicsBackend::SetROPLineColor(SalROPColor /*nROPColor*/) {} void QtGraphicsBackend::SetROPFillColor(SalROPColor /*nROPColor*/) {} -bool QtGraphicsBackend::supportsOperation(OutDevSupportType eType) const -{ - switch (eType) - { - case OutDevSupportType::TransparentRect: - return true; - default: - return false; - } -} +bool QtGraphicsBackend::supportsOperation(OutDevSupportType /*eType*/) const { return false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index 958ea7fcc6f1..1a3b45949801 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -1326,16 +1326,6 @@ bool AquaGraphicsBackend::implDrawGradient(basegfx::B2DPolyPolygon const& /*rPol return false; } -bool AquaGraphicsBackend::supportsOperation(OutDevSupportType eType) const -{ - switch (eType) - { - case OutDevSupportType::TransparentRect: - return true; - default: - break; - } - return false; -} +bool AquaGraphicsBackend::supportsOperation(OutDevSupportType /*eType*/) const { return false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 938c640ca34a..aa5a49ba602b 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -2267,16 +2267,7 @@ void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Colo postDraw(); } -bool SkiaSalGraphicsImpl::supportsOperation(OutDevSupportType eType) const -{ - switch (eType) - { - case OutDevSupportType::TransparentRect: - return true; - default: - return false; - } -} +bool SkiaSalGraphicsImpl::supportsOperation(OutDevSupportType /*eType*/) const { return false; } static int getScaling() { diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 7438f6a4ded7..dbd3b15b2916 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -2707,19 +2707,9 @@ bool WinSalGraphicsImpl::implDrawGradient(basegfx::B2DPolyPolygon const & /*rPol return false; } -bool WinSalGraphicsImpl::supportsOperation(OutDevSupportType eType) const +bool WinSalGraphicsImpl::supportsOperation(OutDevSupportType /*eType*/) const { - bool bRet = false; - - switch (eType) - { - case OutDevSupportType::TransparentRect: - bRet = mrParent.mbVirDev || mrParent.mbWindow; - break; - default: - break; - } - return bRet; + return false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From ae2009b9cc4a1097b1583b70a965d8f3ede5e713 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 11:27:53 +0100 Subject: [PATCH 053/373] tdf#163486: PVS: variable is assigned values twice successively Since commit d0cacf09a1105d89bf3df84b18623d790e3aeb82 Author: Samuel Mehrbrodt Date: Wed Apr 27 11:45:04 2022 +0200 tdf#99708 Save formula bar height to document V519 The 'pSettings[14].Name' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 3806, 3816. Change-Id: I7afcee42d10d692c2c9a84b6a6f0a97ceb913081 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176761 Reviewed-by: Samuel Mehrbrodt Tested-by: Jenkins --- sc/inc/ViewSettingsSequenceDefines.hxx | 5 ++--- sc/source/ui/view/viewdata.cxx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sc/inc/ViewSettingsSequenceDefines.hxx b/sc/inc/ViewSettingsSequenceDefines.hxx index 1cb2b59eb9fc..42bdac0e2df2 100644 --- a/sc/inc/ViewSettingsSequenceDefines.hxx +++ b/sc/inc/ViewSettingsSequenceDefines.hxx @@ -57,7 +57,7 @@ // this are the defines for the position of the settings in the // TableViewSettingsSequence -#define SC_TABLE_VIEWSETTINGS_COUNT 16 +#define SC_TABLE_VIEWSETTINGS_COUNT 15 #define SC_CURSOR_X 0 #define SC_CURSOR_Y 1 @@ -73,8 +73,7 @@ #define SC_TABLE_ZOOM_TYPE 11 #define SC_TABLE_ZOOM_VALUE 12 #define SC_TABLE_PAGE_VIEW_ZOOM_VALUE 13 -#define SC_FORMULA_BAR_HEIGHT_VALUE 14 -#define SC_TABLE_SHOWGRID 15 +#define SC_TABLE_SHOWGRID 14 inline constexpr OUString SC_CURSORPOSITIONX = u"CursorPositionX"_ustr; inline constexpr OUString SC_CURSORPOSITIONY = u"CursorPositionY"_ustr; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 34ba5cee8197..0917ed676773 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -3813,8 +3813,8 @@ void ScViewData::WriteUserDataSequence(uno::Sequence & rSe pSettings[SC_OUTLSYMB].Value <<= maOptions.GetOption(VOPT_OUTLINER); pSettings[SC_VALUE_HIGHLIGHTING].Name = SC_UNO_VALUEHIGH; pSettings[SC_VALUE_HIGHLIGHTING].Value <<= maOptions.GetOption(VOPT_SYNTAX); - pSettings[SC_FORMULA_BAR_HEIGHT_VALUE].Name = SC_FORMULABARHEIGHT; - pSettings[SC_FORMULA_BAR_HEIGHT_VALUE].Value <<= GetFormulaBarLines();; + pSettings[SC_FORMULA_BAR_HEIGHT].Name = SC_FORMULABARHEIGHT; + pSettings[SC_FORMULA_BAR_HEIGHT].Value <<= GetFormulaBarLines();; const ScGridOptions& aGridOpt = maOptions.GetGridOptions(); pSettings[SC_SNAPTORASTER].Name = SC_UNO_SNAPTORASTER; From 4d41da669d443ecaffb344964a272630ccdca634 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 21 Nov 2024 00:39:29 +0100 Subject: [PATCH 054/373] CppunitTest_sc_tiledrendering2: move to tiledrendering folder In preparation for a follow-up commit Change-Id: I8e7852b1861d6879e0dcda8c6fddd947bec3c959 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176876 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/CppunitTest_sc_tiledrendering2.mk | 2 +- .../data/chart.ods | Bin .../data/multi-selection.ods | Bin .../tiledrendering2.cxx | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename sc/qa/unit/{tiledrendering2 => tiledrendering}/data/chart.ods (100%) rename sc/qa/unit/{tiledrendering2 => tiledrendering}/data/multi-selection.ods (100%) rename sc/qa/unit/{tiledrendering2 => tiledrendering}/tiledrendering2.cxx (99%) diff --git a/sc/CppunitTest_sc_tiledrendering2.mk b/sc/CppunitTest_sc_tiledrendering2.mk index d360780428a6..9acb0bffe924 100644 --- a/sc/CppunitTest_sc_tiledrendering2.mk +++ b/sc/CppunitTest_sc_tiledrendering2.mk @@ -14,7 +14,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sc_tiledrendering2)) $(eval $(call gb_CppunitTest_use_common_precompiled_header,sc_tiledrendering2)) $(eval $(call gb_CppunitTest_add_exception_objects,sc_tiledrendering2, \ - sc/qa/unit/tiledrendering2/tiledrendering2 \ + sc/qa/unit/tiledrendering/tiledrendering2 \ )) $(eval $(call gb_CppunitTest_use_libraries,sc_tiledrendering2, \ diff --git a/sc/qa/unit/tiledrendering2/data/chart.ods b/sc/qa/unit/tiledrendering/data/chart.ods similarity index 100% rename from sc/qa/unit/tiledrendering2/data/chart.ods rename to sc/qa/unit/tiledrendering/data/chart.ods diff --git a/sc/qa/unit/tiledrendering2/data/multi-selection.ods b/sc/qa/unit/tiledrendering/data/multi-selection.ods similarity index 100% rename from sc/qa/unit/tiledrendering2/data/multi-selection.ods rename to sc/qa/unit/tiledrendering/data/multi-selection.ods diff --git a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx b/sc/qa/unit/tiledrendering/tiledrendering2.cxx similarity index 99% rename from sc/qa/unit/tiledrendering2/tiledrendering2.cxx rename to sc/qa/unit/tiledrendering/tiledrendering2.cxx index b6f084738b43..878379b089fe 100644 --- a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering2.cxx @@ -39,7 +39,7 @@ public: }; Test::Test() - : UnoApiXmlTest(u"/sc/qa/unit/tiledrendering2/data/"_ustr) + : UnoApiXmlTest(u"/sc/qa/unit/tiledrendering/data/"_ustr) { } From 5c585cd975e8566a952651670a1e6b1865c22114 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 21 Nov 2024 01:01:19 +0100 Subject: [PATCH 055/373] CppunitTest_sc_tiledrendering: factor out common code Change-Id: If9f3ff5d9699876290fb643ed14ba64108cd191c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176877 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/qa/unit/tiledrendering/tiledrendering.cxx | 456 +---------------- sc/qa/unit/tiledrendering/tiledrendering2.cxx | 142 +----- .../tiledrenderingmodeltestbase.cxx | 465 ++++++++++++++++++ 3 files changed, 469 insertions(+), 594 deletions(-) create mode 100644 sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 8c63f99d82df..ca4c5191c1c5 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -7,17 +7,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include "tiledrenderingmodeltestbase.cxx" #include -#include -#include #include #include #include #include #include -#include #include #include #include @@ -35,24 +32,18 @@ #include #include #include -#include #include #include -#include #include #include #include -#include -#include #include #include #include #include #include -using namespace css; - static std::ostream& operator<<(std::ostream& os, ViewShellId const & id) { os << static_cast(id); return os; @@ -84,103 +75,6 @@ inline std::string toString(const ColRowZoom& item) } CPPUNIT_NS_END -namespace { -class ViewCallback; -} - -class ScTiledRenderingTest : public UnoApiXmlTest -{ -public: - ScTiledRenderingTest(); - virtual void setUp() override; - virtual void tearDown() override; - - void checkSampleInvalidation(const ViewCallback& rView, bool bFullRow); - void cellInvalidationHelper(ScModelObj* pModelObj, ScTabViewShell* pView, - const ScAddress& rAdr, bool bAddText, - bool bFullRow); - - ScModelObj* createDoc(const char* pName); - void setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell); - static void callback(int nType, const char* pPayload, void* pData); - void callbackImpl(int nType, const char* pPayload); - - /// document size changed callback. - osl::Condition m_aDocSizeCondition; - Size m_aDocumentSize; - - TestLokCallbackWrapper m_callbackWrapper; -}; - -ScTiledRenderingTest::ScTiledRenderingTest() - : UnoApiXmlTest(u"/sc/qa/unit/tiledrendering/data/"_ustr), - m_callbackWrapper(&callback, this) -{ -} - -void ScTiledRenderingTest::setUp() -{ - UnoApiXmlTest::setUp(); - - comphelper::LibreOfficeKit::setActive(true); -} - -void ScTiledRenderingTest::tearDown() -{ - if (mxComponent.is()) - { - mxComponent->dispose(); - mxComponent.clear(); - } - - m_callbackWrapper.clear(); - - comphelper::LibreOfficeKit::resetCompatFlag(); - - comphelper::LibreOfficeKit::setActive(false); - - UnoApiXmlTest::tearDown(); -} - -ScModelObj* ScTiledRenderingTest::createDoc(const char* pName) -{ - loadFromFile(OUString::createFromAscii(pName)); - - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - pModelObj->initializeForTiledRendering(uno::Sequence()); - return pModelObj; -} - -void ScTiledRenderingTest::setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell) -{ - pViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); - m_callbackWrapper.setLOKViewId(SfxLokHelper::getView(pViewShell)); -} - -void ScTiledRenderingTest::callback(int nType, const char* pPayload, void* pData) -{ - static_cast(pData)->callbackImpl(nType, pPayload); -} - -void ScTiledRenderingTest::callbackImpl(int nType, const char* pPayload) -{ - switch (nType) - { - case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: - { - OString aPayload(pPayload); - sal_Int32 nIndex = 0; - OString aToken = aPayload.getToken(0, ',', nIndex); - m_aDocumentSize.setWidth(aToken.toInt32()); - aToken = aPayload.getToken(0, ',', nIndex); - m_aDocumentSize.setHeight(aToken.toInt32()); - m_aDocSizeCondition.set(); - } - break; - } -} - CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) { ScModelObj* pModelObj = createDoc("select-row-cols.ods"); @@ -311,354 +205,6 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testEmptyColumnSelection) CPPUNIT_ASSERT_EQUAL(OString(), apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr)); } -namespace -{ -struct EditCursorMessage final { - tools::Rectangle m_aRelRect; - Point m_aRefPoint; - - void clear() - { - m_aRelRect.SetEmpty(); - m_aRefPoint = Point(-1, -1); - } - - bool empty() - { - return m_aRelRect.IsEmpty() && - m_aRefPoint.X() == -1 && - m_aRefPoint.Y() == -1; - } - - void parseMessage(const char* pMessage) - { - clear(); - if (!pMessage || !comphelper::LibreOfficeKit::isCompatFlagSet( - comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs) || - !comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation()) - return; - - std::stringstream aStream(pMessage); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - std::string aVal; - boost::property_tree::ptree::const_assoc_iterator it = aTree.find("refpoint"); - if (it != aTree.not_found()) - aVal = aTree.get_child("refpoint").get_value(); - else - return; // happens in testTextBoxInsert test - - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aVal)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aSeq.getLength()); - m_aRefPoint.setX(aSeq[0].toInt32()); - m_aRefPoint.setY(aSeq[1].toInt32()); - - aVal = aTree.get_child("relrect").get_value(); - aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aVal)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aSeq.getLength()); - m_aRelRect.SetLeft(aSeq[0].toInt32()); - m_aRelRect.SetTop(aSeq[1].toInt32()); - m_aRelRect.setWidth(aSeq[2].toInt32()); - m_aRelRect.setHeight(aSeq[3].toInt32()); - } - - tools::Rectangle getBounds() - { - tools::Rectangle aBounds = m_aRelRect; - aBounds.Move(m_aRefPoint.X(), m_aRefPoint.Y()); - return aBounds; - } -}; - -struct TextSelectionMessage -{ - std::vector m_aRelRects; - Point m_aRefPoint; - - void clear() { - m_aRefPoint.setX(0); - m_aRefPoint.setY(0); - m_aRelRects.clear(); - } - - bool empty() { - return m_aRelRects.empty(); - } - - void parseMessage(const char* pMessage) - { - clear(); - if (!pMessage) - return; - - std::string aStr(pMessage); - if (aStr.find(",") == std::string::npos) - return; - - size_t nRefDelimStart = aStr.find("::"); - std::string aRectListString = (nRefDelimStart == std::string::npos) ? aStr : aStr.substr(0, nRefDelimStart); - std::string aRefPointString = (nRefDelimStart == std::string::npos) ? - std::string("0, 0") : - aStr.substr(nRefDelimStart + 2, aStr.length() - 2 - nRefDelimStart); - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aRefPointString)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aSeq.getLength()); - m_aRefPoint.setX(aSeq[0].toInt32()); - m_aRefPoint.setY(aSeq[1].toInt32()); - - size_t nStart = 0; - size_t nEnd = aRectListString.find(";"); - if (nEnd == std::string::npos) - nEnd = aRectListString.length(); - do - { - std::string aRectString = aRectListString.substr(nStart, nEnd - nStart); - { - aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aRectString)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aSeq.getLength()); - tools::Rectangle aRect; - aRect.SetLeft(aSeq[0].toInt32()); - aRect.SetTop(aSeq[1].toInt32()); - aRect.setWidth(aSeq[2].toInt32()); - aRect.setHeight(aSeq[3].toInt32()); - - m_aRelRects.push_back(aRect); - } - - nStart = nEnd + 1; - nEnd = aRectListString.find(";", nStart); - } - while(nEnd != std::string::npos); - } - - tools::Rectangle getBounds(size_t nIndex) - { - if (nIndex >= m_aRelRects.size()) - return tools::Rectangle(); - - tools::Rectangle aBounds = m_aRelRects[nIndex]; - aBounds.Move(m_aRefPoint.X(), m_aRefPoint.Y()); - return aBounds; - } - -}; - -/// A view callback tracks callbacks invoked on one specific view. -class ViewCallback final -{ - SfxViewShell* mpViewShell; - int mnView; -public: - bool m_bOwnCursorInvalidated; - bool m_bViewCursorInvalidated; - bool m_bTextViewSelectionInvalidated; - bool m_bGraphicSelection; - bool m_bGraphicViewSelection; - bool m_bFullInvalidateTiles; - bool m_bInvalidateTiles; - std::vector m_aInvalidations; - tools::Rectangle m_aCellCursorBounds; - std::vector m_aInvalidationsParts; - std::vector m_aInvalidationsMode; - bool m_bViewLock; - OString m_sCellFormula; - boost::property_tree::ptree m_aCommentCallbackResult; - EditCursorMessage m_aInvalidateCursorResult; - TextSelectionMessage m_aTextSelectionResult; - OString m_sInvalidateHeader; - OString m_sInvalidateSheetGeometry; - OString m_aHyperlinkClicked; - OString m_ShapeSelection; - std::map m_aStateChanges; - TestLokCallbackWrapper m_callbackWrapper; - - ViewCallback(bool bDeleteListenerOnDestruct=true) - : m_bOwnCursorInvalidated(false), - m_bViewCursorInvalidated(false), - m_bTextViewSelectionInvalidated(false), - m_bGraphicSelection(false), - m_bGraphicViewSelection(false), - m_bFullInvalidateTiles(false), - m_bInvalidateTiles(false), - m_bViewLock(false), - m_callbackWrapper(&callback, this) - { - mpViewShell = SfxViewShell::Current(); - mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); - mnView = SfxLokHelper::getView(); - m_callbackWrapper.setLOKViewId( mnView ); - if (!bDeleteListenerOnDestruct) - mpViewShell = nullptr; - } - - ~ViewCallback() - { - if (mpViewShell) - { - SfxLokHelper::setView(mnView); - mpViewShell->setLibreOfficeKitViewCallback(nullptr); - } - } - - static void callback(int nType, const char* pPayload, void* pData) - { - static_cast(pData)->callbackImpl(nType, pPayload); - } - - void callbackImpl(int nType, const char* pPayload) - { - switch (nType) - { - case LOK_CALLBACK_CELL_CURSOR: - { - m_bOwnCursorInvalidated = true; - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); - m_aCellCursorBounds = tools::Rectangle(); - if (aSeq.getLength() == 6) { - m_aCellCursorBounds.SetLeft(aSeq[0].toInt32()); - m_aCellCursorBounds.SetTop(aSeq[1].toInt32()); - m_aCellCursorBounds.setWidth(aSeq[2].toInt32()); - m_aCellCursorBounds.setHeight(aSeq[3].toInt32()); - } - } - break; - case LOK_CALLBACK_CELL_VIEW_CURSOR: - { - m_bViewCursorInvalidated = true; - } - break; - case LOK_CALLBACK_TEXT_VIEW_SELECTION: - { - m_bTextViewSelectionInvalidated = true; - } - break; - case LOK_CALLBACK_VIEW_LOCK: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - m_bViewLock = aTree.get_child("rectangle").get_value() != "EMPTY"; - } - break; - case LOK_CALLBACK_GRAPHIC_SELECTION: - { - m_bGraphicSelection = true; - m_ShapeSelection = OString(pPayload); - } - break; - case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION: - { - m_bGraphicViewSelection = true; - } - break; - case LOK_CALLBACK_INVALIDATE_TILES: - { - OString text(pPayload); - if (text.startsWith("EMPTY")) - { - m_bFullInvalidateTiles = true; - } - else - { - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); - CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 6); - tools::Rectangle aInvalidationRect; - aInvalidationRect.SetLeft(aSeq[0].toInt32()); - aInvalidationRect.SetTop(aSeq[1].toInt32()); - aInvalidationRect.setWidth(aSeq[2].toInt32()); - aInvalidationRect.setHeight(aSeq[3].toInt32()); - m_aInvalidations.push_back(aInvalidationRect); - if (aSeq.getLength() == 6) - { - m_aInvalidationsParts.push_back(aSeq[4].toInt32()); - m_aInvalidationsMode.push_back(aSeq[5].toInt32()); - } - m_bInvalidateTiles = true; - } - } - break; - case LOK_CALLBACK_CELL_FORMULA: - { - m_sCellFormula = pPayload; - } - break; - case LOK_CALLBACK_COMMENT: - { - m_aCommentCallbackResult.clear(); - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, m_aCommentCallbackResult); - m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment"); - } - break; - case LOK_CALLBACK_INVALIDATE_HEADER: - { - m_sInvalidateHeader = pPayload; - } - break; - case LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY: - { - m_sInvalidateSheetGeometry = pPayload; - } - break; - case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: - { - m_aInvalidateCursorResult.parseMessage(pPayload); - } - break; - case LOK_CALLBACK_HYPERLINK_CLICKED: - { - m_aHyperlinkClicked = pPayload; - } - break; - case LOK_CALLBACK_TEXT_SELECTION: - { - m_aTextSelectionResult.parseMessage(pPayload); - } - break; - case LOK_CALLBACK_STATE_CHANGED: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - std::string aCommandName; - - if (aStream.str().starts_with("{")) - { - boost::property_tree::read_json(aStream, aTree); - auto it = aTree.find("commandName"); - if (it == aTree.not_found()) - { - break; - } - - aCommandName = it->second.get_value(); - } - else - { - std::string aState = aStream.str(); - auto it = aState.find("="); - if (it == std::string::npos) - { - break; - } - aCommandName = aState.substr(0, it); - aTree.put("state", aState.substr(it + 1)); - } - - m_aStateChanges[aCommandName] = aTree; - } - break; - } - } - - void ClearAllInvalids() - { - m_bInvalidateTiles = false; - m_aInvalidations.clear(); - m_aInvalidationsParts.clear(); - m_aInvalidationsMode.clear(); - } -}; -} //namespace - CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testViewCursors) { ScModelObj* pModelObj = createDoc("select-row-cols.ods"); diff --git a/sc/qa/unit/tiledrendering/tiledrendering2.cxx b/sc/qa/unit/tiledrendering/tiledrendering2.cxx index 878379b089fe..6e8ce9ea9def 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering2.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering2.cxx @@ -7,151 +7,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include - -#include +#include "tiledrenderingmodeltestbase.cxx" #include -#include -#include -#include -#include -#include #include #include -#include - -#include using namespace com::sun::star; -namespace -{ -class Test : public UnoApiXmlTest -{ -public: - Test(); - void setUp() override; - void tearDown() override; - - ScModelObj* createDoc(const char* pName); -}; - -Test::Test() - : UnoApiXmlTest(u"/sc/qa/unit/tiledrendering/data/"_ustr) -{ -} - -void Test::setUp() -{ - UnoApiXmlTest::setUp(); - - comphelper::LibreOfficeKit::setActive(true); -} - -void Test::tearDown() -{ - if (mxComponent.is()) - { - mxComponent->dispose(); - mxComponent.clear(); - } - - comphelper::LibreOfficeKit::resetCompatFlag(); - - comphelper::LibreOfficeKit::setActive(false); - - UnoApiXmlTest::tearDown(); -} - -ScModelObj* Test::createDoc(const char* pName) -{ - loadFromFile(OUString::createFromAscii(pName)); - - ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); - CPPUNIT_ASSERT(pModelObj); - pModelObj->initializeForTiledRendering(uno::Sequence()); - return pModelObj; -} - -/// A view callback tracks callbacks invoked on one specific view. -class ViewCallback final -{ - SfxViewShell* mpViewShell; - int mnView; - -public: - std::map m_aStateChanges; - tools::Rectangle m_aCellCursorBounds; - TestLokCallbackWrapper m_callbackWrapper; - - ViewCallback() - : m_callbackWrapper(&callback, this) - { - mpViewShell = SfxViewShell::Current(); - mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); - mnView = SfxLokHelper::getView(); - m_callbackWrapper.setLOKViewId(mnView); - } - - ~ViewCallback() - { - if (mpViewShell) - { - SfxLokHelper::setView(mnView); - mpViewShell->setLibreOfficeKitViewCallback(nullptr); - } - } - - static void callback(int nType, const char* pPayload, void* pData) - { - static_cast(pData)->callbackImpl(nType, pPayload); - } - - void callbackImpl(int nType, const char* pPayload) - { - switch (nType) - { - case LOK_CALLBACK_CELL_CURSOR: - { - uno::Sequence aSeq = comphelper::string::convertCommaSeparated( - OUString::createFromAscii(pPayload)); - m_aCellCursorBounds = tools::Rectangle(); - if (aSeq.getLength() >= 4) - { - m_aCellCursorBounds.SetLeft(aSeq[0].toInt32()); - m_aCellCursorBounds.SetTop(aSeq[1].toInt32()); - m_aCellCursorBounds.setWidth(aSeq[2].toInt32()); - m_aCellCursorBounds.setHeight(aSeq[3].toInt32()); - } - } - break; - case LOK_CALLBACK_STATE_CHANGED: - { - std::stringstream aStream(pPayload); - if (!aStream.str().starts_with("{")) - { - break; - } - - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - auto it = aTree.find("commandName"); - if (it == aTree.not_found()) - { - break; - } - - std::string aCommandName = it->second.get_value(); - m_aStateChanges[aCommandName] = aTree; - } - break; - } - } -}; - -CPPUNIT_TEST_FIXTURE(Test, testSidebarLocale) +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSidebarLocale) { ScModelObj* pModelObj = createDoc("chart.ods"); int nView1 = SfxLokHelper::getView(); @@ -179,7 +44,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSidebarLocale) CPPUNIT_ASSERT_EQUAL(std::string("de-DE"), aLocale); } -CPPUNIT_TEST_FIXTURE(Test, testCopyMultiSelection) +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCopyMultiSelection) { // Given a document with A1 and A3 as selected cells: ScModelObj* pModelObj = createDoc("multi-selection.ods"); @@ -212,7 +77,6 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyMultiSelection) // Without the fix, the text selection was complex. CPPUNIT_ASSERT(!xTransferable2->isComplex()); } -} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx b/sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx new file mode 100644 index 000000000000..9fa272789780 --- /dev/null +++ b/sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx @@ -0,0 +1,465 @@ +/* -*- 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/. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace css; + +class ViewCallback; + +class ScTiledRenderingTest : public UnoApiXmlTest +{ +public: + ScTiledRenderingTest(); + virtual void setUp() override; + virtual void tearDown() override; + + void checkSampleInvalidation(const ViewCallback& rView, bool bFullRow); + void cellInvalidationHelper(ScModelObj* pModelObj, ScTabViewShell* pView, const ScAddress& rAdr, + bool bAddText, bool bFullRow); + + ScModelObj* createDoc(const char* pName); + void setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell); + static void callback(int nType, const char* pPayload, void* pData); + void callbackImpl(int nType, const char* pPayload); + + /// document size changed callback. + osl::Condition m_aDocSizeCondition; + Size m_aDocumentSize; + + TestLokCallbackWrapper m_callbackWrapper; +}; + +ScTiledRenderingTest::ScTiledRenderingTest() + : UnoApiXmlTest(u"/sc/qa/unit/tiledrendering/data/"_ustr) + , m_callbackWrapper(&callback, this) +{ +} + +void ScTiledRenderingTest::setUp() +{ + UnoApiXmlTest::setUp(); + + comphelper::LibreOfficeKit::setActive(true); +} + +void ScTiledRenderingTest::tearDown() +{ + if (mxComponent.is()) + { + mxComponent->dispose(); + mxComponent.clear(); + } + + m_callbackWrapper.clear(); + + comphelper::LibreOfficeKit::resetCompatFlag(); + + comphelper::LibreOfficeKit::setActive(false); + + UnoApiXmlTest::tearDown(); +} + +ScModelObj* ScTiledRenderingTest::createDoc(const char* pName) +{ + loadFromFile(OUString::createFromAscii(pName)); + + ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); + CPPUNIT_ASSERT(pModelObj); + pModelObj->initializeForTiledRendering(uno::Sequence()); + return pModelObj; +} + +void ScTiledRenderingTest::setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell) +{ + pViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); + m_callbackWrapper.setLOKViewId(SfxLokHelper::getView(pViewShell)); +} + +void ScTiledRenderingTest::callback(int nType, const char* pPayload, void* pData) +{ + static_cast(pData)->callbackImpl(nType, pPayload); +} + +void ScTiledRenderingTest::callbackImpl(int nType, const char* pPayload) +{ + switch (nType) + { + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { + OString aPayload(pPayload); + sal_Int32 nIndex = 0; + OString aToken = aPayload.getToken(0, ',', nIndex); + m_aDocumentSize.setWidth(aToken.toInt32()); + aToken = aPayload.getToken(0, ',', nIndex); + m_aDocumentSize.setHeight(aToken.toInt32()); + m_aDocSizeCondition.set(); + } + break; + } +} + +struct EditCursorMessage final +{ + tools::Rectangle m_aRelRect; + Point m_aRefPoint; + + void clear() + { + m_aRelRect.SetEmpty(); + m_aRefPoint = Point(-1, -1); + } + + bool empty() { return m_aRelRect.IsEmpty() && m_aRefPoint.X() == -1 && m_aRefPoint.Y() == -1; } + + void parseMessage(const char* pMessage) + { + clear(); + if (!pMessage + || !comphelper::LibreOfficeKit::isCompatFlagSet( + comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs) + || !comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation()) + return; + + std::stringstream aStream(pMessage); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + std::string aVal; + boost::property_tree::ptree::const_assoc_iterator it = aTree.find("refpoint"); + if (it != aTree.not_found()) + aVal = aTree.get_child("refpoint").get_value(); + else + return; // happens in testTextBoxInsert test + + uno::Sequence aSeq + = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aVal)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aSeq.getLength()); + m_aRefPoint.setX(aSeq[0].toInt32()); + m_aRefPoint.setY(aSeq[1].toInt32()); + + aVal = aTree.get_child("relrect").get_value(); + aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aVal)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aSeq.getLength()); + m_aRelRect.SetLeft(aSeq[0].toInt32()); + m_aRelRect.SetTop(aSeq[1].toInt32()); + m_aRelRect.setWidth(aSeq[2].toInt32()); + m_aRelRect.setHeight(aSeq[3].toInt32()); + } + + tools::Rectangle getBounds() + { + tools::Rectangle aBounds = m_aRelRect; + aBounds.Move(m_aRefPoint.X(), m_aRefPoint.Y()); + return aBounds; + } +}; + +struct TextSelectionMessage +{ + std::vector m_aRelRects; + Point m_aRefPoint; + + void clear() + { + m_aRefPoint.setX(0); + m_aRefPoint.setY(0); + m_aRelRects.clear(); + } + + bool empty() { return m_aRelRects.empty(); } + + void parseMessage(const char* pMessage) + { + clear(); + if (!pMessage) + return; + + std::string aStr(pMessage); + if (aStr.find(",") == std::string::npos) + return; + + size_t nRefDelimStart = aStr.find("::"); + std::string aRectListString + = (nRefDelimStart == std::string::npos) ? aStr : aStr.substr(0, nRefDelimStart); + std::string aRefPointString + = (nRefDelimStart == std::string::npos) + ? std::string("0, 0") + : aStr.substr(nRefDelimStart + 2, aStr.length() - 2 - nRefDelimStart); + uno::Sequence aSeq + = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aRefPointString)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aSeq.getLength()); + m_aRefPoint.setX(aSeq[0].toInt32()); + m_aRefPoint.setY(aSeq[1].toInt32()); + + size_t nStart = 0; + size_t nEnd = aRectListString.find(";"); + if (nEnd == std::string::npos) + nEnd = aRectListString.length(); + do + { + std::string aRectString = aRectListString.substr(nStart, nEnd - nStart); + { + aSeq = comphelper::string::convertCommaSeparated( + OUString::createFromAscii(aRectString)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aSeq.getLength()); + tools::Rectangle aRect; + aRect.SetLeft(aSeq[0].toInt32()); + aRect.SetTop(aSeq[1].toInt32()); + aRect.setWidth(aSeq[2].toInt32()); + aRect.setHeight(aSeq[3].toInt32()); + + m_aRelRects.push_back(aRect); + } + + nStart = nEnd + 1; + nEnd = aRectListString.find(";", nStart); + } while (nEnd != std::string::npos); + } + + tools::Rectangle getBounds(size_t nIndex) + { + if (nIndex >= m_aRelRects.size()) + return tools::Rectangle(); + + tools::Rectangle aBounds = m_aRelRects[nIndex]; + aBounds.Move(m_aRefPoint.X(), m_aRefPoint.Y()); + return aBounds; + } +}; + +/// A view callback tracks callbacks invoked on one specific view. +class ViewCallback final +{ + SfxViewShell* mpViewShell; + int mnView; + +public: + bool m_bOwnCursorInvalidated; + bool m_bViewCursorInvalidated; + bool m_bTextViewSelectionInvalidated; + bool m_bGraphicSelection; + bool m_bGraphicViewSelection; + bool m_bFullInvalidateTiles; + bool m_bInvalidateTiles; + std::vector m_aInvalidations; + tools::Rectangle m_aCellCursorBounds; + std::vector m_aInvalidationsParts; + std::vector m_aInvalidationsMode; + bool m_bViewLock; + OString m_sCellFormula; + boost::property_tree::ptree m_aCommentCallbackResult; + EditCursorMessage m_aInvalidateCursorResult; + TextSelectionMessage m_aTextSelectionResult; + OString m_sInvalidateHeader; + OString m_sInvalidateSheetGeometry; + OString m_aHyperlinkClicked; + OString m_ShapeSelection; + std::map m_aStateChanges; + TestLokCallbackWrapper m_callbackWrapper; + + ViewCallback(bool bDeleteListenerOnDestruct = true) + : m_bOwnCursorInvalidated(false) + , m_bViewCursorInvalidated(false) + , m_bTextViewSelectionInvalidated(false) + , m_bGraphicSelection(false) + , m_bGraphicViewSelection(false) + , m_bFullInvalidateTiles(false) + , m_bInvalidateTiles(false) + , m_bViewLock(false) + , m_callbackWrapper(&callback, this) + { + mpViewShell = SfxViewShell::Current(); + mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); + mnView = SfxLokHelper::getView(); + m_callbackWrapper.setLOKViewId(mnView); + if (!bDeleteListenerOnDestruct) + mpViewShell = nullptr; + } + + ~ViewCallback() + { + if (mpViewShell) + { + SfxLokHelper::setView(mnView); + mpViewShell->setLibreOfficeKitViewCallback(nullptr); + } + } + + static void callback(int nType, const char* pPayload, void* pData) + { + static_cast(pData)->callbackImpl(nType, pPayload); + } + + void callbackImpl(int nType, const char* pPayload) + { + switch (nType) + { + case LOK_CALLBACK_CELL_CURSOR: + { + m_bOwnCursorInvalidated = true; + uno::Sequence aSeq = comphelper::string::convertCommaSeparated( + OUString::createFromAscii(pPayload)); + m_aCellCursorBounds = tools::Rectangle(); + if (aSeq.getLength() == 6) + { + m_aCellCursorBounds.SetLeft(aSeq[0].toInt32()); + m_aCellCursorBounds.SetTop(aSeq[1].toInt32()); + m_aCellCursorBounds.setWidth(aSeq[2].toInt32()); + m_aCellCursorBounds.setHeight(aSeq[3].toInt32()); + } + } + break; + case LOK_CALLBACK_CELL_VIEW_CURSOR: + { + m_bViewCursorInvalidated = true; + } + break; + case LOK_CALLBACK_TEXT_VIEW_SELECTION: + { + m_bTextViewSelectionInvalidated = true; + } + break; + case LOK_CALLBACK_VIEW_LOCK: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + m_bViewLock = aTree.get_child("rectangle").get_value() != "EMPTY"; + } + break; + case LOK_CALLBACK_GRAPHIC_SELECTION: + { + m_bGraphicSelection = true; + m_ShapeSelection = OString(pPayload); + } + break; + case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION: + { + m_bGraphicViewSelection = true; + } + break; + case LOK_CALLBACK_INVALIDATE_TILES: + { + OString text(pPayload); + if (text.startsWith("EMPTY")) + { + m_bFullInvalidateTiles = true; + } + else + { + uno::Sequence aSeq = comphelper::string::convertCommaSeparated( + OUString::createFromAscii(pPayload)); + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 6); + tools::Rectangle aInvalidationRect; + aInvalidationRect.SetLeft(aSeq[0].toInt32()); + aInvalidationRect.SetTop(aSeq[1].toInt32()); + aInvalidationRect.setWidth(aSeq[2].toInt32()); + aInvalidationRect.setHeight(aSeq[3].toInt32()); + m_aInvalidations.push_back(aInvalidationRect); + if (aSeq.getLength() == 6) + { + m_aInvalidationsParts.push_back(aSeq[4].toInt32()); + m_aInvalidationsMode.push_back(aSeq[5].toInt32()); + } + m_bInvalidateTiles = true; + } + } + break; + case LOK_CALLBACK_CELL_FORMULA: + { + m_sCellFormula = pPayload; + } + break; + case LOK_CALLBACK_COMMENT: + { + m_aCommentCallbackResult.clear(); + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, m_aCommentCallbackResult); + m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment"); + } + break; + case LOK_CALLBACK_INVALIDATE_HEADER: + { + m_sInvalidateHeader = pPayload; + } + break; + case LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY: + { + m_sInvalidateSheetGeometry = pPayload; + } + break; + case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: + { + m_aInvalidateCursorResult.parseMessage(pPayload); + } + break; + case LOK_CALLBACK_HYPERLINK_CLICKED: + { + m_aHyperlinkClicked = pPayload; + } + break; + case LOK_CALLBACK_TEXT_SELECTION: + { + m_aTextSelectionResult.parseMessage(pPayload); + } + break; + case LOK_CALLBACK_STATE_CHANGED: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + std::string aCommandName; + + if (aStream.str().starts_with("{")) + { + boost::property_tree::read_json(aStream, aTree); + auto it = aTree.find("commandName"); + if (it == aTree.not_found()) + { + break; + } + + aCommandName = it->second.get_value(); + } + else + { + std::string aState = aStream.str(); + auto it = aState.find("="); + if (it == std::string::npos) + { + break; + } + aCommandName = aState.substr(0, it); + aTree.put("state", aState.substr(it + 1)); + } + + m_aStateChanges[aCommandName] = aTree; + } + break; + } + } + + void ClearAllInvalids() + { + m_bInvalidateTiles = false; + m_aInvalidations.clear(); + m_aInvalidationsParts.clear(); + m_aInvalidationsMode.clear(); + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 0b7faed2818971d46122da16322691e3c836c0e6 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 21 Nov 2024 07:54:58 +0100 Subject: [PATCH 056/373] Latest VS 2022 Preview is 17.13.0 Preview 1.0 now ...while latest proper VS 2022 is 17.12.1 Change-Id: I93ebd2756e665f5f33ba71934ab625709c3758db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176893 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- configure.ac | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 01cb56658cff..6b978af0342b 100644 --- a/configure.ac +++ b/configure.ac @@ -4268,7 +4268,7 @@ map_vs_year_to_version() 2022) vsversion=17;; 2022preview) - vsversion=17.12;; + vsversion=17.13;; *) AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);; esac @@ -4394,7 +4394,7 @@ find_msvc() vcyear=2019 vctoolset=v142 ;; - 17.0 | 17.12) + 17.0 | 17.13) vcyear=2022 vctoolset=v143 ;; @@ -4565,7 +4565,7 @@ if test "$_os" = "WINNT"; then # are always "better", we list them in reverse chronological order. case "$vcnumwithdot" in - 16.0 | 17.0 | 17.12) + 16.0 | 17.0 | 17.13) WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0" ;; esac @@ -7048,7 +7048,7 @@ find_msms() msmdir= case "$VCVER" in - 16.0 | 17.0 | 17.12) + 16.0 | 17.0 | 17.13) for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/" echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5 @@ -7084,7 +7084,7 @@ find_msvc_x64_dlls() msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT" case "$VCVER" in - 16.0 | 17.0 | 17.12) + 16.0 | 17.0 | 17.13) for crtver in 141 142 143; do for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5 From 5cd7e18483b6d56ae836b02107063a657745134a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Nov 2024 08:33:40 +0000 Subject: [PATCH 057/373] cid#1634865 Uninitialized scalar field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit since: commit 43b9ab55a3b6ac1497bcadd6a71a5a133ece4d3d CommitDate: Tue Nov 19 01:15:00 2024 +0100 tdf#163956 calculate line height differently in FORMTEXT Change-Id: Ic0e6e78f77b1adf6f5ca9fe7a48e113bd8592552 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176898 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/core/text/porlin.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx index 2038265014d2..28f3c80d06a6 100644 --- a/sw/source/core/text/porlin.hxx +++ b/sw/source/core/text/porlin.hxx @@ -206,6 +206,7 @@ inline SwLinePortion::SwLinePortion(const SwLinePortion &rPortion) : mnWhichPor( rPortion.mnWhichPor ), m_bJoinBorderWithPrev( rPortion.m_bJoinBorderWithPrev ), m_bJoinBorderWithNext( rPortion.m_bJoinBorderWithNext ), + m_bIsFieldmarkText( rPortion.m_bIsFieldmarkText ), m_nExtraBlankWidth(rPortion.m_nExtraBlankWidth), m_nExtraShrunkWidth(rPortion.m_nExtraShrunkWidth), m_nLayoutContext(rPortion.m_nLayoutContext) From 60ca9c8fd48225069ed6c9c0cbcada4717999724 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 21 Nov 2024 01:13:38 +0100 Subject: [PATCH 058/373] CppunitTest_sd_tiledrendering2: move to tiledrendering folder In preparation for a follow-up commit Change-Id: Ifb3ee72cef3493cb1774c0a0c5ac6b5850309396 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176878 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sd/CppunitTest_sd_tiledrendering2.mk | 2 +- .../data}/data/dummy.odp | Bin .../tiledrendering2.cxx | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename sd/qa/unit/{tiledrendering2 => tiledrendering/data}/data/dummy.odp (100%) rename sd/qa/unit/{tiledrendering2 => tiledrendering}/tiledrendering2.cxx (98%) diff --git a/sd/CppunitTest_sd_tiledrendering2.mk b/sd/CppunitTest_sd_tiledrendering2.mk index 838f13fc3ece..07b867cc1309 100644 --- a/sd/CppunitTest_sd_tiledrendering2.mk +++ b/sd/CppunitTest_sd_tiledrendering2.mk @@ -14,7 +14,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sd_tiledrendering2)) $(eval $(call gb_CppunitTest_use_common_precompiled_header,sd_tiledrendering2)) $(eval $(call gb_CppunitTest_add_exception_objects,sd_tiledrendering2, \ - sd/qa/unit/tiledrendering2/tiledrendering2 \ + sd/qa/unit/tiledrendering/tiledrendering2 \ )) $(eval $(call gb_CppunitTest_use_libraries,sd_tiledrendering2, \ diff --git a/sd/qa/unit/tiledrendering2/data/dummy.odp b/sd/qa/unit/tiledrendering/data/data/dummy.odp similarity index 100% rename from sd/qa/unit/tiledrendering2/data/dummy.odp rename to sd/qa/unit/tiledrendering/data/data/dummy.odp diff --git a/sd/qa/unit/tiledrendering2/tiledrendering2.cxx b/sd/qa/unit/tiledrendering/tiledrendering2.cxx similarity index 98% rename from sd/qa/unit/tiledrendering2/tiledrendering2.cxx rename to sd/qa/unit/tiledrendering/tiledrendering2.cxx index 7abaa222e371..a9b0b6e5b8ff 100644 --- a/sd/qa/unit/tiledrendering2/tiledrendering2.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering2.cxx @@ -38,7 +38,7 @@ protected: }; Test::Test() - : UnoApiXmlTest(u"/sd/qa/unit/tiledrendering2/data/"_ustr) + : UnoApiXmlTest(u"/sd/qa/unit/tiledrendering/data/"_ustr) { } From 2b16fd7e9be7a61a0acb1c134cc55fa3f66655c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Nov 2024 08:36:43 +0000 Subject: [PATCH 059/373] cid#1634867 Using a moved object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit since: commit 193207c5abf339253e15b59f398da0c1f6f43bee CommitDate: Tue Nov 19 07:46:25 2024 +0100 improve loplugin passparamsbyref Change-Id: Ib2dfa03dfe66630ddb902ea4e75338ca70857e90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176899 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- svl/source/misc/sharedstringpool.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svl/source/misc/sharedstringpool.cxx b/svl/source/misc/sharedstringpool.cxx index 8cf20475bd5c..17e41e3a76ff 100644 --- a/svl/source/misc/sharedstringpool.cxx +++ b/svl/source/misc/sharedstringpool.cxx @@ -24,7 +24,7 @@ struct StringWithHash sal_Int32 hashCode; StringWithHash(OUString s) : str(std::move(s)) - , hashCode(s.hashCode()) + , hashCode(str.hashCode()) { } From 73cb99d5ea12b76c6cfbc498c58c4ed133b94c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Nov 2024 09:01:53 +0000 Subject: [PATCH 060/373] Related: cid#1364016 Missing move assignment operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I186718f4e74ca3a77d92a62358d6007a1f6fd7fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176903 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- .../extended/textwindowaccessibility.cxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 19867b61fcfb..8068d118ed9f 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1043,20 +1043,18 @@ void Document::retrieveRunAttributesImpl( tPropValMap aRunAttrSeq; if ( pColor ) { - css::beans::PropertyValue aPropVal; - aPropVal.Name = "CharColor"; - aPropVal.Handle = -1; - aPropVal.Value = mapFontColor( pColor->GetColor() ); - aPropVal.State = css::beans::PropertyState_DIRECT_VALUE; + css::beans::PropertyValue aPropVal{ + "CharColor", -1, + mapFontColor(pColor->GetColor()), + css::beans::PropertyState_DIRECT_VALUE}; aRunAttrSeq[ aPropVal.Name ] = aPropVal; } if ( pWeight ) { - css::beans::PropertyValue aPropVal; - aPropVal.Name = "CharWeight"; - aPropVal.Handle = -1; - aPropVal.Value = mapFontWeight( pWeight->getFontWeight() ); - aPropVal.State = css::beans::PropertyState_DIRECT_VALUE; + css::beans::PropertyValue aPropVal{ + "CharWeight", -1, + mapFontWeight(pWeight->getFontWeight()), + css::beans::PropertyState_DIRECT_VALUE}; aRunAttrSeq[ aPropVal.Name ] = aPropVal; } if ( !RequestedAttributes.hasElements() ) From e8c59414016a2f28ab9e15002e2c36b5a714924e Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 18 Nov 2024 19:51:52 +0100 Subject: [PATCH 061/373] sw: layout: fix crash in SwSectionFrame::MakeAll() sectfrm.cxx:854: Assertion `moveBackPos == &GetPrecede()->GetFrame()' failed. Because the section has columns, and GetPrevSctLeaf() apparently returns the body frame in a column. (regression from commit c60ad7e0fbf3cc86af167f5e98b38c25620ada7e) Change-Id: I16fcd7a42b24e54873cde0aa0087c7aa56b0a8e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176738 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/layout/sectfrm.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 11245f084a92..18701702197d 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -846,6 +846,10 @@ void SwSectionFrame::MakeAll(vcl::RenderContext* pRenderContext) // appropriately; then drop the temporary, if needed. if (SwLayoutFrame* moveBackPos = GetPrevSctLeaf()) { + if (moveBackPos->IsColBodyFrame()) + { + moveBackPos = moveBackPos->GetUpper()->GetUpper(); + } SwLayoutFrame* newUpper = moveBackPos; SwFrame* newSibling = nullptr; const bool temporaryMasterCreated = IsFollow(); From e8fca750c4a8b2ac99c4f47b65d31a4f58ad43f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Nov 2024 08:44:37 +0000 Subject: [PATCH 062/373] Related: cid#1634864 can use member list initialization here MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I39c56e381fda147b5dac885f95e93648c366225d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176901 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/core/unocore/unoportenum.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index d7078e09f30b..7e84c1948768 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -317,9 +317,8 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration( const sal_Int32 nStart, const sal_Int32 nEnd, bool bOnlyTextFields) + : m_pUnoCursor(rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint())) { - m_pUnoCursor = rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint()); - OSL_ENSURE(nEnd == -1 || (nStart <= nEnd && nEnd <= m_pUnoCursor->Start()->GetNode().GetTextNode()->GetText().getLength()), "start or end value invalid!"); @@ -333,9 +332,9 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration( SwXTextPortionEnumeration::SwXTextPortionEnumeration( SwPaM& rParaCursor, TextRangeList_t && rPortions ) - : m_Portions( std::move(rPortions) ) + : m_Portions(std::move(rPortions)) + , m_pUnoCursor(rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint())) { - m_pUnoCursor = rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint()); } SwXTextPortionEnumeration::~SwXTextPortionEnumeration() From cb362d3b4a09f612e27036d5f994479c4fa808c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sat, 2 Nov 2024 15:57:44 +0000 Subject: [PATCH 063/373] add XInitialization to PathSettings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so PathSettings could be reinitialized if the underlying assumptions it made on initialization have changed, like the location where the application is installed, which affects the "Internal" paths for e.g. AutoText which are RO paths that aren't normall allowed to change. Change-Id: I3e056ddfbfdc3257561bd67c39163b48d3dde9a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175951 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176904 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- framework/source/services/pathsettings.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 38171ab974ab..fcb0edae07d6 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,7 @@ sal_Int32 impl_getPropGroup(sal_Int32 nID) typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo, + css::lang::XInitialization, css::util::XChangesListener, // => XEventListener css::util::XPathSettings> // => XPropertySet PathSettings_BASE; @@ -325,6 +327,10 @@ public: { ::cppu::OPropertySetHelper::addVetoableChangeListener(p1, p2); } virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference& p2) override { ::cppu::OPropertySetHelper::removeVetoableChangeListener(p1, p2); } + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence& rArguments) override; + /** read all configured paths and create all needed internal structures. */ void impl_readAll(); @@ -1410,6 +1416,14 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgNew() return xCfg; } +// XInitialization +void SAL_CALL PathSettings::initialize(const css::uno::Sequence& /*rArguments*/) +{ + // so we can reinitialize/reset all path variables to default + osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex); + impl_readAll(); +} + } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * From a1a21ca3d4a8c36620fcb2e2af0b6ddd300f6739 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Thu, 21 Nov 2024 09:37:15 +0100 Subject: [PATCH 064/373] docx: export empty GrabBag elements as self-closing xml tags - 2 In 6cb711645b8d8f3cee0d3454e193cc7bf1cad305 the condition was not good, because there is a special element called "attributes" which is not a child element but contains attributes of the current element. In the condition we should check for 0 elements that are not "attributes". Change-Id: I1d6995e13f288902c1cce85ac3b7d4e0da213df8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176900 Tested-by: Jenkins Reviewed-by: Andras Timar --- sw/source/filter/ww8/docxattributeoutput.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f3b5ce705242..8061bdcd9f49 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3490,6 +3490,7 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence aAttributes; rtl::Reference pAttributes = FastSerializerHelper::createAttrList(); + sal_Int32 nElements = 0; for (const auto& rElement : rElements) { @@ -3497,6 +3498,10 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence>= aAttributes; } + else + { + ++nElements; + } } for (const auto& rAttribute : aAttributes) @@ -3518,7 +3523,7 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequenceadd(*aSubElementId, aValue); } - if (rElements.size() == 0) + if (nElements == 0) { pSerializer->singleElement(aElementId, pAttributes); } From 512ef23224987e3107e66241db3b42934e15a561 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 21 Nov 2024 13:57:14 +0500 Subject: [PATCH 065/373] tdf#163974: ignore nested footnotes on ODF import That is a valid, but unsupported, markup, that is explicitly mentioned in ODF 1.4 part 3 "Schema" sect. 6.3.4 "": Note: The schema allows for the inclusion of elements as a descendant of a child of the element. While this may be reasonable for note types, it is not reasonable for footnotes and endnotes. Conforming consumers need not support notes inside notes. (The "reasonable for note types" is obviously an editorial error from the time when ODF 1.1 text "reasonable for some future note types" was reviewed for ODF 1.2.) As the ODF also specifies, that a conforming consumer "need not interpret the semantics of all elements, attributes and attribute values" (ibid., sect. 2.4 "Consumer"), it is OK to silently drop this data, just as done for other similar cases. Change-Id: I0a417981087ebf225565628f14409661058d100d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176906 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- sw/qa/extras/odfimport/data/nested_footnote.fodt | 11 +++++++++++ sw/qa/extras/odfimport/odfimport.cxx | 15 +++++++++++++++ xmloff/source/text/XMLFootnoteImportContext.cxx | 14 +++++++++++++- xmloff/source/text/XMLFootnoteImportContext.hxx | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/odfimport/data/nested_footnote.fodt diff --git a/sw/qa/extras/odfimport/data/nested_footnote.fodt b/sw/qa/extras/odfimport/data/nested_footnote.fodt new file mode 100644 index 000000000000..812f4610926c --- /dev/null +++ b/sw/qa/extras/odfimport/data/nested_footnote.fodt @@ -0,0 +1,11 @@ + + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit.1 + Vestibulum consequat mi quis pretium semper.2 + Proin luctus orci ac neque venenatis, quis commodo dolor posuere. + + + \ No newline at end of file diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index fb8a065eba29..014c4011cff1 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -59,6 +59,7 @@ #include #include #include +#include #if defined(_WIN32) #include @@ -1624,6 +1625,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf162398) SwTransferable::PasteFormat(*pWrtShell, aDataHelper, SotClipboardFormatId::HTML); } +CPPUNIT_TEST_FIXTURE(Test, testTdf163974) +{ + // A document with a footnote inside a footnote must load normally, ignoring unsupported markup. + // Without the fix, this would fail to load. + createSwDoc("nested_footnote.fodt"); + + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell->HasFootnotes()); + SwSeqFieldList footnotes; + pWrtShell->GetSeqFootnoteList(footnotes); + // If we ever support the nested footnotes, this would naturally change + CPPUNIT_ASSERT_EQUAL(size_t(1), footnotes.Count()); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx index a73147ec09f1..fc9605bd8651 100644 --- a/xmloff/source/text/XMLFootnoteImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteImportContext.cxx @@ -19,6 +19,7 @@ #include "XMLFootnoteImportContext.hxx" +#include #include #include #include @@ -102,7 +103,16 @@ void XMLFootnoteImportContext::startFastElement( // save old cursor and install new one xOldCursor = rHelper.GetCursor(); Reference xText(xTextContent, UNO_QUERY); - rHelper.SetCursor(xText->createTextCursor()); + try + { + // May fail e.g. for a nested footnote, which is formally a valid ODF, but is not supported + rHelper.SetCursor(xText->createTextCursor()); + } + catch (css::uno::RuntimeException&) + { + TOOLS_WARN_EXCEPTION("xmloff.text", "skipping the footnote: caught"); + mbIsValid = false; + } // remember old list item and block (#89891#) and reset them // for the footnote @@ -132,6 +142,8 @@ void XMLFootnoteImportContext::endFastElement(sal_Int32 ) css::uno::Reference< css::xml::sax::XFastContextHandler > XMLFootnoteImportContext::createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { + if (!mbIsValid) + return {}; SvXMLImportContextRef xContext; switch(nElement) diff --git a/xmloff/source/text/XMLFootnoteImportContext.hxx b/xmloff/source/text/XMLFootnoteImportContext.hxx index d05b7b631c22..8321639bbd1a 100644 --- a/xmloff/source/text/XMLFootnoteImportContext.hxx +++ b/xmloff/source/text/XMLFootnoteImportContext.hxx @@ -42,6 +42,7 @@ class XMLFootnoteImportContext : public SvXMLImportContext /// old list item and block (#89891#) bool mbListContextPushed; + bool mbIsValid = true; /// text import helper; holds current XTextCursor (and XText) XMLTextImportHelper& rHelper; From a44a406de423b3d69183cc2e23f1e5f121518fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Wed, 21 Aug 2024 11:25:05 +0200 Subject: [PATCH 066/373] Make rendering more flexible, render fields in separate layer If the amster page has a field (like slide number) then render the objects containing fields into a separate master slide layer. Also change the rendering in such a way to be more flexible and has less conditions. So in the renderer it doesn't really matter if we are rendering a master slide or slide, what matters only is if the object is already rendered and if we need to stop rendering for some specified reason (like we encountered a field and need to stop rendering and need to switch to a new layer). Change-Id: I37ea2528427bbc1b3de938f960fb344866ee9399 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176911 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- .../data/SlideRenderingTest_WithFields.odp | Bin 0 -> 26683 bytes sd/qa/unit/tiledrendering/tiledrendering.cxx | 116 +++++++++++- sd/source/ui/inc/SlideshowLayerRenderer.hxx | 102 ++++++++++- sd/source/ui/tools/SlideshowLayerRenderer.cxx | 172 +++++++++--------- 4 files changed, 295 insertions(+), 95 deletions(-) create mode 100644 sd/qa/unit/tiledrendering/data/SlideRenderingTest_WithFields.odp diff --git a/sd/qa/unit/tiledrendering/data/SlideRenderingTest_WithFields.odp b/sd/qa/unit/tiledrendering/data/SlideRenderingTest_WithFields.odp new file mode 100644 index 0000000000000000000000000000000000000000..960adc4c5c55bcd1c7c63771e8fed2d283d15c8e GIT binary patch literal 26683 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 } +CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFields) +{ + // Check rendering of slideshow layers (as in the document): + // - master slide layer + // - main slide layer + + const bool bOutputPNG = false; // Control layer output to PNG files + + SdXImpressDocument* pXImpressDocument = createDoc("SlideRenderingTest_WithFields.odp"); + pXImpressDocument->initializeForTiledRendering(uno::Sequence()); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + CPPUNIT_ASSERT(pViewShell); + SdPage* pPage = pViewShell->GetActualPage(); + CPPUNIT_ASSERT(pPage); + sal_Int32 nViewWidth = 2000; + sal_Int32 nViewHeight = 2000; + CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(0, nViewWidth, nViewHeight, true, true)); + CPPUNIT_ASSERT_EQUAL(2000, nViewWidth); + CPPUNIT_ASSERT_EQUAL(1125, nViewHeight); + + const Color aTransparentColor(ColorAlpha, 0x00000000); + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + // TODO - check JSON content + // printf ("1 %s\n\n", rJsonMsg.toUtf8().getStr()); + + BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); + if (bOutputPNG) + { + SvFileStream aStream("/home/quikee/XXX_01.png", StreamMode::WRITE | StreamMode::TRUNC); + vcl::PngImageWriter aPNGWriter(aStream); + aPNGWriter.write(aBitmapEx); + } + + // top-left corner + CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(20, 20)); + + // bottom-left corner + CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(20, nViewHeight - 20)); + + // bottom-right corner + CPPUNIT_ASSERT_EQUAL(Color(0xff, 0xd0, 0x40), aBitmapEx.GetPixelColor(nViewWidth - 20, nViewHeight - 20)); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + // TODO - check JSON content + // printf ("2 %s\n\n", rJsonMsg.toUtf8().getStr()); + + BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); + if (bOutputPNG) + { + SvFileStream aStream("/home/quikee/XXX_02.png", StreamMode::WRITE | StreamMode::TRUNC); + vcl::PngImageWriter aPNGWriter(aStream); + aPNGWriter.write(aBitmapEx); + } + + // top-left corner + CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(20, 20)); + + // bottom-left corner + CPPUNIT_ASSERT_EQUAL(Color(0x90, 0x80, 0xff), aBitmapEx.GetPixelColor(20, nViewHeight - 20)); + + // bottom-right corner + CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(nViewWidth - 20, nViewHeight - 20)); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + // TODO - check JSON content + // printf ("3 %s\n\n", rJsonMsg.toUtf8().getStr()); + + BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); + if (bOutputPNG) + { + SvFileStream aStream("/home/quikee/XXX_03.png", StreamMode::WRITE | StreamMode::TRUNC); + vcl::PngImageWriter aPNGWriter(aStream); + aPNGWriter.write(aBitmapEx); + } + + // top-left corner + CPPUNIT_ASSERT_EQUAL(Color(0x00, 0x50, 0x90), aBitmapEx.GetPixelColor(20, 20)); + + // bottom-left corner + CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(20, nViewHeight - 20)); + + // bottom-right corner + CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(nViewWidth - 20, nViewHeight - 20)); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + } + + pXImpressDocument->postSlideshowCleanup(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx b/sd/source/ui/inc/SlideshowLayerRenderer.hxx index 2f51c6e39b76..7f26d9b23b52 100644 --- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx +++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx @@ -13,41 +13,125 @@ #include #include #include +#include class SdrPage; class SdrModel; +class SdrObject; class Size; namespace sd { struct RenderContext; -struct RenderOptions; -enum class SlideRenderStage +enum class RenderStage { Master, Slide }; +/** Holds rendering state, properties and switches through all rendering passes */ +struct RenderState +{ + RenderStage meStage = RenderStage::Master; + + sal_Int32 mnMasterIndex = 0; + bool mbStopRenderingWhenField = true; + + std::unordered_set maObjectsDone; + sal_Int32 mnIndex = 0; + + bool mbFirstObjectInPass = true; + bool mbPassHasOutput = false; + bool mbSkipAllInThisPass = false; + + sal_Int32 mnCurrentPass = 0; + + /// increments index depending on the current render stage + void incrementIndex() + { + if (meStage == RenderStage::Master) + mnMasterIndex++; + else + mnIndex++; + } + + /// returns the current stage as string + OString stageString() + { + if (meStage == RenderStage::Master) + return "MasterPage"_ostr; + return "DrawPage"_ostr; + } + + /// returns the current index depending on the current render stage + sal_Int32 currentIndex() + { + if (meStage == RenderStage::Master) + return mnMasterIndex; + return mnIndex; + } + + /// resets properties that are valid for one pass + void resetPass() + { + mbFirstObjectInPass = true; + mbPassHasOutput = false; + mbSkipAllInThisPass = false; + } + + /// return if there was no rendering output in the pass + bool noMoreOutput() + { + // no output and we don't skip anything + return !mbPassHasOutput && !mbSkipAllInThisPass; + } + + /// should include background in rendering + bool includeBackground() + { + // include background only if we are rendering the first pass + return mnCurrentPass == 0; + } + + bool isObjectAlreadyRendered(SdrObject* pObject) + { + return maObjectsDone.find(pObject) != maObjectsDone.end(); + } +}; + +/** Renders a slide */ class SD_DLLPUBLIC SlideshowLayerRenderer { +private: SdrPage& mrPage; SdrModel& mrModel; Size maSlideSize; + RenderState maRenderState; - std::deque maRenderStages; - - void cleanupRendering(RenderContext& rRenderContext); - void setupRendering(unsigned char* pBuffer, RenderContext& rRenderContext); - void createViewAndDraw(RenderContext& rRenderContext, RenderOptions const& rRenderOptions); + void createViewAndDraw(RenderContext& rRenderContext); + void writeJSON(OString& rJsonMsg); public: SlideshowLayerRenderer(SdrPage& rPage); + + /** Calculate and set the slide size depending on input desired size (in pixels) + * + * Input the desired size in pixels, and the actual size pixels will be caluclated + * depending on the size of the slide and the desired size. The size can differ, + * because the it must match the slide aspect ratio. + **/ Size calculateAndSetSizePixel(Size const& rDesiredSizePixel); + + /** Renders one layer + * + * The slide layer is rendered into the input buffer, which must be the byte size + * of the calcualted size in pixels * 4 (RGBA). + * The properties of the layer are written to the input string in JSON format. + * + * @returns false, if nothing was rendered and rendering is done */ bool render(unsigned char* pBuffer, OString& rJsonMsg); - bool renderMaster(unsigned char* pBuffer, OString& rJsonMsg); - bool renderSlide(unsigned char* pBuffer, OString& rJsonMsg); }; } // end of namespace sd diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index 486823b0aa9c..3e1297225d4c 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -24,13 +24,6 @@ namespace sd { -struct RenderOptions -{ - bool mbIncludeBackground = true; - bool mbSkipMainPageObjects = false; - bool mbSkipMasterPageObjects = false; -}; - struct RenderContext { SdrModel& mrModel; @@ -44,7 +37,7 @@ struct RenderContext , mrPage(rPage) , maVirtualDevice(DeviceFormat::WITHOUT_ALPHA) { - // Turn of spelling + // Turn off spelling SdrOutliner& rOutliner = mrModel.GetDrawOutliner(); mnSavedControlBits = rOutliner.GetControlWord(); rOutliner.SetControlWord(mnSavedControlBits & ~EEControlBits::ONLINESPELLING); @@ -77,14 +70,31 @@ struct RenderContext namespace { +bool hasFields(SdrObject* pObject) +{ + auto* pTextObject = dynamic_cast(pObject); + if (!pTextObject) + return false; + + OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject(); + if (pOutlinerParagraphObject) + { + const EditTextObject& rEditText = pOutlinerParagraphObject->GetTextObject(); + if (rEditText.IsFieldObject()) + return true; + } + return false; +} + +/** VOC redirector to control which object should be rendered and which not */ class ObjectRedirector : public sdr::contact::ViewObjectContactRedirector { protected: - RenderOptions maOptions; + RenderState& mrRenderState; public: - ObjectRedirector(RenderOptions const& rOptions) - : maOptions(rOptions) + ObjectRedirector(RenderState& rRenderState) + : mrRenderState(rRenderState) { } @@ -93,36 +103,62 @@ public: const sdr::contact::DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override { + if (mrRenderState.mbSkipAllInThisPass) + return; + SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject(); - SdrPage* pPage = pObject ? pObject->getSdrPageFromSdrObject() : nullptr; + // Check if we are rendering an object that is valid to render (exists, and not empty) + if (pObject == nullptr || pObject->IsEmptyPresObj()) + return; - if (pObject == nullptr || pPage == nullptr) + SdrPage* pPage = pObject->getSdrPageFromSdrObject(); + // Does the object have a page + if (pPage == nullptr) + return; + + // is the object visible and not hidden by any option + const bool bVisible + = pObject->getSdrPageFromSdrObject()->checkVisibility(rOriginal, rDisplayInfo, true); + + if (!bVisible) + return; + + // Check if we have already rendered the object + if (mrRenderState.isObjectAlreadyRendered(pObject)) + return; + + // Check if we are in correct stage + if (mrRenderState.meStage == RenderStage::Master && !pPage->IsMasterPage()) { - // Not a SdrObject or a object not connected to a page (object with no page) + if (mrRenderState.mbFirstObjectInPass) + { + // if this is the first object - change from master to slide + // means we are done with rendering of master layers + mrRenderState.meStage = RenderStage::Slide; + } + else + { + // if not, we have to stop rendering all further objects + mrRenderState.mbSkipAllInThisPass = true; + return; + } + } + + if (mrRenderState.meStage == RenderStage::Master && hasFields(pObject) + && mrRenderState.mbStopRenderingWhenField && !mrRenderState.mbFirstObjectInPass) + { + mrRenderState.mbStopRenderingWhenField = false; + mrRenderState.mbSkipAllInThisPass = true; return; } - if (maOptions.mbSkipMasterPageObjects && pPage->IsMasterPage()) - return; - - if (maOptions.mbSkipMainPageObjects && !pPage->IsMasterPage()) - return; - - const bool bDoCreateGeometry( - pObject->getSdrPageFromSdrObject()->checkVisibility(rOriginal, rDisplayInfo, true)); - - if (!bDoCreateGeometry - && (pObject->GetObjInventor() != SdrInventor::Default - || pObject->GetObjIdentifier() != SdrObjKind::Page)) - { - return; - } - - if (pObject->IsEmptyPresObj()) - return; - + // render the object sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence( rOriginal, rDisplayInfo, rVisitor); + + mrRenderState.mbFirstObjectInPass = false; + mrRenderState.maObjectsDone.insert(pObject); + mrRenderState.mbPassHasOutput = true; } }; @@ -148,8 +184,9 @@ SlideshowLayerRenderer::SlideshowLayerRenderer(SdrPage& rPage) , mrModel(rPage.getSdrModelFromSdrPage()) { if (!hasEmptyMaster(rPage)) - maRenderStages.emplace_back(SlideRenderStage::Master); - maRenderStages.emplace_back(SlideRenderStage::Slide); + maRenderState.meStage = RenderStage::Master; + else + maRenderState.meStage = RenderStage::Slide; } Size SlideshowLayerRenderer::calculateAndSetSizePixel(Size const& rDesiredSizePixel) @@ -161,8 +198,7 @@ Size SlideshowLayerRenderer::calculateAndSetSizePixel(Size const& rDesiredSizePi return maSlideSize; } -void SlideshowLayerRenderer::createViewAndDraw(RenderContext& rRenderContext, - RenderOptions const& rRenderOptions) +void SlideshowLayerRenderer::createViewAndDraw(RenderContext& rRenderContext) { SdrView aView(mrModel, rRenderContext.maVirtualDevice); aView.SetPageVisible(false); @@ -172,29 +208,24 @@ void SlideshowLayerRenderer::createViewAndDraw(RenderContext& rRenderContext, aView.SetGridVisible(false); aView.SetHlplVisible(false); aView.SetGlueVisible(false); - aView.setHideBackground(!rRenderOptions.mbIncludeBackground); + aView.setHideBackground(!maRenderState.includeBackground()); aView.ShowSdrPage(&mrPage); Size aPageSize(mrPage.GetSize()); Point aPoint; vcl::Region aRegion(::tools::Rectangle(aPoint, aPageSize)); - ObjectRedirector aRedirector(rRenderOptions); + ObjectRedirector aRedirector(maRenderState); aView.CompleteRedraw(rRenderContext.maVirtualDevice, aRegion, &aRedirector); } -bool SlideshowLayerRenderer::renderMaster(unsigned char* pBuffer, OString& rJsonMsg) +void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg) { - RenderOptions aRenderOptions; - aRenderOptions.mbSkipMainPageObjects = true; - - RenderContext aRenderContext(pBuffer, mrModel, mrPage, maSlideSize); - createViewAndDraw(aRenderContext, aRenderOptions); - ::tools::JsonWriter aJsonWriter; - aJsonWriter.put("group", "MasterPage"); + aJsonWriter.put("group", maRenderState.stageString()); + aJsonWriter.put("index", maRenderState.currentIndex()); aJsonWriter.put("slideHash", GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage))); - aJsonWriter.put("index", 0); + aJsonWriter.put("type", "bitmap"); { auto aContentNode = aJsonWriter.startNode("content"); @@ -203,47 +234,24 @@ bool SlideshowLayerRenderer::renderMaster(unsigned char* pBuffer, OString& rJson } rJsonMsg = aJsonWriter.finishAndGetAsOString(); - return true; -} - -bool SlideshowLayerRenderer::renderSlide(unsigned char* pBuffer, OString& rJsonMsg) -{ - RenderOptions aRenderOptions; - aRenderOptions.mbSkipMasterPageObjects = true; - - RenderContext aRenderContext(pBuffer, mrModel, mrPage, maSlideSize); - createViewAndDraw(aRenderContext, aRenderOptions); - - ::tools::JsonWriter aJsonWriter; - aJsonWriter.put("group", "DrawPage"); - aJsonWriter.put("slideHash", GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage))); - aJsonWriter.put("index", 0); - aJsonWriter.put("type", "bitmap"); - { - auto aContentNode = aJsonWriter.startNode("content"); - aJsonWriter.put("type", "%IMAGETYPE%"); - aJsonWriter.put("checksum", "%IMAGECHECKSUM%"); - } - rJsonMsg = aJsonWriter.finishAndGetAsOString(); - - return true; + maRenderState.incrementIndex(); } bool SlideshowLayerRenderer::render(unsigned char* pBuffer, OString& rJsonMsg) { - if (maRenderStages.empty()) + // Reset state + maRenderState.resetPass(); + + RenderContext aRenderContext(pBuffer, mrModel, mrPage, maSlideSize); + createViewAndDraw(aRenderContext); + + // Check if we are done rendering all passes + if (maRenderState.noMoreOutput()) return false; - auto eRenderStage = maRenderStages.front(); - maRenderStages.pop_front(); + writeJSON(rJsonMsg); - switch (eRenderStage) - { - case SlideRenderStage::Master: - return renderMaster(pBuffer, rJsonMsg); - case SlideRenderStage::Slide: - return renderSlide(pBuffer, rJsonMsg); - }; + maRenderState.mnCurrentPass++; return true; } From 75799dae6e85c1af047ae7051702b7913e2c0f28 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 20 Nov 2024 15:55:27 +0200 Subject: [PATCH 067/373] use default implementation for drawEPS so only the one that implements it needs to override it Change-Id: I19e79c5746dbbebbf5914922587016fd03a902d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176848 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/headless/SvpGraphicsBackend.cxx | 6 ------ vcl/inc/headless/SvpGraphicsBackend.hxx | 3 --- vcl/inc/qt5/QtGraphics.hxx | 3 --- vcl/inc/salgdi.hxx | 9 +++++---- vcl/inc/salgdiimpl.hxx | 9 +++++---- vcl/inc/skia/gdiimpl.hxx | 3 --- vcl/qt5/QtGraphics_GDI.cxx | 6 ------ vcl/skia/gdiimpl.cxx | 6 ------ vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 6 ------ vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 3 --- vcl/win/gdi/gdiimpl.cxx | 5 ----- vcl/win/gdi/gdiimpl.hxx | 6 ------ 12 files changed, 10 insertions(+), 55 deletions(-) diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index c1210be0e557..029e65820209 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -211,12 +211,6 @@ void SvpGraphicsBackend::invert(sal_uInt32 nPoints, const Point* pPtAry, SalInve m_rCairoCommon.invert(nPoints, pPtAry, nFlags, getAntiAlias()); } -bool SvpGraphicsBackend::drawEPS(tools::Long /*nX*/, tools::Long /*nY*/, tools::Long /*nWidth*/, - tools::Long /*nHeight*/, void* /*pPtr*/, sal_uInt32 /*nSize*/) -{ - return false; -} - bool SvpGraphicsBackend::blendBitmap(const SalTwoRect& /*rPosAry*/, const SalBitmap& /*rBitmap*/) { return false; diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx index a6f6f843482d..a631cb161e8b 100644 --- a/vcl/inc/headless/SvpGraphicsBackend.hxx +++ b/vcl/inc/headless/SvpGraphicsBackend.hxx @@ -102,9 +102,6 @@ public: void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; - bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, - void* pPtr, sal_uInt32 nSize) override; - bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index eb1a870bb09f..4c7deb5d3f68 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -131,9 +131,6 @@ public: void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; - bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, - void* pPtr, sal_uInt32 nSize) override; - bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 6b2c35a35e36..26daad069101 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -517,11 +517,12 @@ protected: virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0; + /// Only implemented by the macOS Quartz backend and the MS-Windows GDI backend. virtual bool drawEPS( - tools::Long nX, tools::Long nY, - tools::Long nWidth, tools::Long nHeight, - void* pPtr, - sal_uInt32 nSize ) = 0; + tools::Long /*nX*/, tools::Long /*nY*/, + tools::Long /*nWidth*/, tools::Long /*nHeight*/, + void* /*pPtr*/, + sal_uInt32 /*nSize*/ ) { return false; } /** Blend the bitmap with the current buffer */ virtual bool blendBitmap( diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index c79cf7ea14f3..4d76d9a41446 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -177,11 +177,12 @@ public: virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0; + /// Only implemented by the macOS Quartz backend and the MS-Windows GDI backend. virtual bool drawEPS( - tools::Long nX, tools::Long nY, - tools::Long nWidth, tools::Long nHeight, - void* pPtr, - sal_uInt32 nSize ) = 0; + tools::Long /*nX*/, tools::Long /*nY*/, + tools::Long /*nWidth*/, tools::Long /*nHeight*/, + void* /*pPtr*/, + sal_uInt32 /*nSize*/ ) { return false; } virtual bool blendBitmap( const SalTwoRect&, diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 7fad579d0db2..c261e4af97c1 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -149,9 +149,6 @@ public: virtual void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; - virtual bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, - void* pPtr, sal_uInt32 nSize) override; - /** Render bitmap with alpha channel @param rSourceBitmap diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index 8e76741c5f30..5f411e2ebf30 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -570,12 +570,6 @@ void QtGraphicsBackend::invert(sal_uInt32 /*nPoints*/, const Point* /*pPtAry*/, { } -bool QtGraphicsBackend::drawEPS(tools::Long /*nX*/, tools::Long /*nY*/, tools::Long /*nWidth*/, - tools::Long /*nHeight*/, void* /*pPtr*/, sal_uInt32 /*nSize*/) -{ - return false; -} - bool QtGraphicsBackend::blendBitmap(const SalTwoRect&, const SalBitmap& /*rBitmap*/) { return false; diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index aa5a49ba602b..815c52b119f2 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1595,12 +1595,6 @@ void SkiaSalGraphicsImpl::invert(sal_uInt32 nPoints, const Point* pPointArray, S invert(aPolygon, eFlags); } -bool SkiaSalGraphicsImpl::drawEPS(tools::Long, tools::Long, tools::Long, tools::Long, void*, - sal_uInt32) -{ - return false; -} - // Create SkImage from a bitmap and possibly an alpha mask (the usual VCL one-minus-alpha), // with the given target size. Result will be possibly cached, unless disabled. // Especially in raster mode scaling and alpha blending may be expensive if done repeatedly. diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index acc9fc295523..9e822047f14e 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -207,12 +207,6 @@ bool X11CairoSalGraphicsImpl::drawPolyPolygonBezier(sal_uInt32, const sal_uInt32 return false; } -bool X11CairoSalGraphicsImpl::drawEPS(tools::Long, tools::Long, tools::Long, tools::Long, void*, - sal_uInt32) -{ - return false; -} - bool X11CairoSalGraphicsImpl::blendBitmap(const SalTwoRect&, const SalBitmap&) { return false; } bool X11CairoSalGraphicsImpl::blendAlphaBitmap(const SalTwoRect&, const SalBitmap&, diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index f0376e3b0068..3a8948eedafe 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -161,9 +161,6 @@ public: const Point* const* pPtAry, const PolyFlags* const* pFlgAry) override; - bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, - void* pPtr, sal_uInt32 nSize) override; - /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */ bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX, const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index dbd3b15b2916..beb3834459ec 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -235,11 +235,6 @@ WinSalGraphicsImpl::~WinSalGraphicsImpl() } } -bool WinSalGraphicsImpl::drawEPS(tools::Long, tools::Long, tools::Long, tools::Long, void*, sal_uInt32) -{ - return false; -} - void WinSalGraphicsImpl::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) { HDC hSrcDC; diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 980454ebc303..da0aa7672b73 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -182,12 +182,6 @@ public: virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) override; - virtual bool drawEPS( - tools::Long nX, tools::Long nY, - tools::Long nWidth, tools::Long nHeight, - void* pPtr, - sal_uInt32 nSize ) override; - virtual bool blendBitmap( const SalTwoRect&, const SalBitmap& rBitmap ) override; From 7ebcea990c725752d40ff9e0de5f5eaa321f25d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sat, 2 Nov 2024 19:44:52 +0000 Subject: [PATCH 068/373] call PathSettings::initialize after utl::Bootstrap::reloadData MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and add setting 'BRAND_BASE_DIR' alongside existing 'UserInstallation' which necessitates moving this block after aAppPath is determined Done so that PathSettings will use the new locations set in bootstrap for UserInstallation directory and not the locations detected during preinit. So autotext can be found relative to the final UserInstallation dir. Change-Id: Ib6dadbec85a380475537027a8ce3972e31089711 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175960 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176905 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- desktop/source/lib/init.cxx | 61 +++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d6f209c2f1b8..f4e2c39f6d07 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -106,6 +106,7 @@ #include #include #include +#include #include #include #include @@ -7986,6 +7987,9 @@ static void preloadData() // Set user profile's path back to the original one rtl::Bootstrap::set(u"UserInstallation"_ustr, sUserPath); + + // Note that unotools::Bootstrap has initialized from the temp UserInstallation at this point + // see Bootstrap::reloadData for when it gets resynced } namespace { @@ -8177,29 +8181,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char if (eStage != PRE_INIT) comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib); - if (pUserProfileUrl && eStage != PRE_INIT) - { - OUString url( - pUserProfileUrl, strlen(pUserProfileUrl), RTL_TEXTENCODING_UTF8); - OUString path; - if (url.startsWithIgnoreAsciiCase("vnd.sun.star.pathname:", &path)) - { - OUString url2; - osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath( - path, url2); - if (e == osl::FileBase::E_None) - url = url2; - else - SAL_WARN("lok", "resolving <" << url << "> failed with " << +e); - } - rtl::Bootstrap::set(u"UserInstallation"_ustr, url); - if (eStage == SECOND_INIT) - { - comphelper::rng::reseed(); - utl::Bootstrap::reloadData(); - } - } - OUString aAppPath; if (pAppPath) { @@ -8231,6 +8212,40 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char if (osl::FileBase::getFileURLFromSystemPath(aAppPath, aAppURL) != osl::FileBase::E_None) return 0; + if (pUserProfileUrl && eStage != PRE_INIT) + { + OUString url( + pUserProfileUrl, strlen(pUserProfileUrl), RTL_TEXTENCODING_UTF8); + OUString path; + if (url.startsWithIgnoreAsciiCase("vnd.sun.star.pathname:", &path)) + { + OUString url2; + osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath( + path, url2); + if (e == osl::FileBase::E_None) + url = url2; + else + SAL_WARN("lok", "resolving <" << url << "> failed with " << +e); + } + + rtl::Bootstrap::set(u"UserInstallation"_ustr, url); + rtl::Bootstrap::set(u"BRAND_BASE_DIR"_ustr, aAppURL + "/.."); + if (eStage == SECOND_INIT) + { + comphelper::rng::reseed(); + + utl::Bootstrap::reloadData(); + + // Now that bootstrap User/Shared installation paths have been (re)set to the final + // location, reinitialize the PathSettings so $(userurl)/$(instdir) path variables + // will be expanded using these newly set paths and not the paths detected during + // preinit which used unorthodox throwaway temp locations + uno::Reference xPathSettings = util::thePathSettings::get(xContext); + uno::Reference xReInit(xPathSettings, uno::UNO_QUERY_THROW); + xReInit->initialize({}); + } + } + #ifdef IOS // A LibreOffice-using iOS app should have the ICU data file in the app bundle. Initialize ICU // to use that. From d22d862ce6abd28a5859571b465459489da430d8 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 21 Nov 2024 12:15:34 +0100 Subject: [PATCH 069/373] tdf#163486: PVS: Expression is always true Since commit 47a173edb603538521a035157efb6ef684238087 Author: Noel Grandin Date: Sat Sep 15 18:36:08 2018 +0200 use std::vector in PDFWriterImpl for encryption buffer V547 Expression 'buffOK' is always true. Change-Id: I66b0f4de18cfca398da0b4091d980b259f5e9dfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176916 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- vcl/source/gdi/pdfwriter_impl.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 88a9853ca392..5adb2e53358a 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1661,16 +1661,14 @@ bool PDFWriterImpl::writeBufferBytes( const void* pBuffer, sal_uInt64 nBytes ) } else { - bool buffOK = true; if (m_aPDFEncryptor.m_bEncryptThisStream) { /* implement the encryption part of the PDF spec encryption algorithm 3.1 */ m_vEncryptionBuffer.resize(nBytes); - if (buffOK) - rtl_cipher_encodeARCFOUR(m_aPDFEncryptor.m_aCipher, pBuffer, static_cast(nBytes), m_vEncryptionBuffer.data(), static_cast(nBytes)); + rtl_cipher_encodeARCFOUR(m_aPDFEncryptor.m_aCipher, pBuffer, static_cast(nBytes), m_vEncryptionBuffer.data(), static_cast(nBytes)); } - const void* pWriteBuffer = (m_aPDFEncryptor.m_bEncryptThisStream && buffOK) ? m_vEncryptionBuffer.data() : pBuffer; + const void* pWriteBuffer = m_aPDFEncryptor.m_bEncryptThisStream ? m_vEncryptionBuffer.data() : pBuffer; m_DocDigest.update(static_cast(pWriteBuffer), static_cast(nBytes)); if (m_aFile.write(pWriteBuffer, nBytes, nWritten) != osl::File::E_None) From 08143bf192a885e1adbde061bb7d68bc5c559e03 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 21 Nov 2024 11:51:05 +0200 Subject: [PATCH 070/373] no longer need this svtools/drawinglayer hack after commit 664ecbd8916478cdc28a9c793fbdb9359b3cac64 Author: Noel Grandin Date: Wed Nov 20 16:08:14 2024 +0200 remove OutDevSupportType::TransparentRect Change-Id: I57804ec9e9967c7082a1f657165d967d75b1dedf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176910 Reviewed-by: Noel Grandin Tested-by: Jenkins --- .../source/geometry/viewinformation2d.cxx | 33 ++++++------------- .../geometry/viewinformation2d.hxx | 1 - svtools/source/config/optionsdrawinglayer.cxx | 14 +------- 3 files changed, 11 insertions(+), 37 deletions(-) diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 296e34a0def2..6550831214db 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -48,12 +48,6 @@ constexpr OUStringLiteral g_PropertyName_UseAntiAliasing = u"UseAntiAliasing"; constexpr OUStringLiteral g_PropertyName_PixelSnapHairline = u"PixelSnapHairline"; } -namespace -{ -bool bForwardsAreInitialized(false); -bool bForwardPixelSnapHairline(true); -} - class ImpViewInformation2D { private: @@ -123,8 +117,13 @@ public: , mbEditViewActive(false) , mbReducedDisplayQuality(false) , mbUseAntiAliasing(ViewInformation2D::getGlobalAntiAliasing()) - , mbPixelSnapHairline(mbUseAntiAliasing && bForwardPixelSnapHairline) { + if (comphelper::IsFuzzing()) + mbPixelSnapHairline = false; + else + mbPixelSnapHairline + = mbUseAntiAliasing + && officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get(); } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } @@ -250,18 +249,11 @@ ViewInformation2D::ImplType& theGlobalDefault() ViewInformation2D::ViewInformation2D() : mpViewInformation2D(theGlobalDefault()) { - if (!bForwardsAreInitialized) - { - bForwardsAreInitialized = true; - if (!comphelper::IsFuzzing()) - { - bForwardPixelSnapHairline - = officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get(); - } - } - setUseAntiAliasing(ViewInformation2D::getGlobalAntiAliasing()); - setPixelSnapHairline(bForwardPixelSnapHairline); + if (!comphelper::IsFuzzing()) + setPixelSnapHairline( + getUseAntiAliasing() + && officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get()); } ViewInformation2D::ViewInformation2D(const ViewInformation2D&) = default; @@ -427,11 +419,6 @@ void ViewInformation2D::setGlobalAntiAliasing(bool bAntiAliasing, bool bTemporar } bool ViewInformation2D::getGlobalAntiAliasing() { return globalAntiAliasing(); } -void ViewInformation2D::forwardPixelSnapHairline(bool bPixelSnapHairline) -{ - bForwardPixelSnapHairline = bPixelSnapHairline; -} - ViewInformation2D createViewInformation2D(const css::uno::Sequence& rViewParameters) { diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx index 13d843aec15c..c86b7b7a9bf8 100644 --- a/include/drawinglayer/geometry/viewinformation2d.hxx +++ b/include/drawinglayer/geometry/viewinformation2d.hxx @@ -173,7 +173,6 @@ public: static void setGlobalAntiAliasing(bool bAntiAliasing, bool bTemporary); static bool getGlobalAntiAliasing(); - static void forwardPixelSnapHairline(bool bPixelSnapHairline); }; DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 277d716681f1..ff2740f17abf 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -43,9 +43,6 @@ Color GetStripeColorB() return Color(ColorTransparency, officecfg::Office::Common::Drawinglayer::StripeColorB::get()); } -static bool gbPixelSnapHairlineForwardInitial(false); -static bool gbPixelSnapHairlineForwardLast(true); - bool IsAntiAliasing() { return drawinglayer::geometry::ViewInformation2D::getGlobalAntiAliasing(); @@ -64,16 +61,7 @@ void SetAntiAliasing( bool bOn, bool bTemporary ) bool IsSnapHorVerLinesToDiscrete() { - const bool bRetval(IsAntiAliasing() && officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get()); - - if (!gbPixelSnapHairlineForwardInitial || gbPixelSnapHairlineForwardLast != bRetval) - { - gbPixelSnapHairlineForwardInitial = true; - gbPixelSnapHairlineForwardLast = bRetval; - drawinglayer::geometry::ViewInformation2D::forwardPixelSnapHairline(bRetval); - } - - return bRetval; + return IsAntiAliasing() && officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get(); } sal_uInt16 GetTransparentSelectionPercent() From 483a3db5204f36798811da8c36641be03104be63 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 19 Nov 2024 13:54:50 +0100 Subject: [PATCH 071/373] sw: layout: fix unhiding section containing multiple page breaks With multiple page breaks in a hidden section, the following frames were only moved on the first break, and with the second break the frames go out of order in SwSectionFrame::SwClientNotify(). Also handle multiple columns there. (regression from commit a97e245ba11598050e1800fde9ace796d20e9df2) Change-Id: I4120e72bf083f3bed75f9305fbd757efd55f0b3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176773 Tested-by: Jenkins Reviewed-by: Michael Stahl --- .../data/section-nested-with-pagebreaks.fodt | 148 ++++++++++++++++ sw/qa/extras/layout/layout4.cxx | 167 ++++++++++++++++++ sw/source/core/layout/sectfrm.cxx | 11 +- 3 files changed, 322 insertions(+), 4 deletions(-) create mode 100644 sw/qa/extras/layout/data/section-nested-with-pagebreaks.fodt diff --git a/sw/qa/extras/layout/data/section-nested-with-pagebreaks.fodt b/sw/qa/extras/layout/data/section-nested-with-pagebreaks.fodt new file mode 100644 index 000000000000..0ff4be45f1ee --- /dev/null +++ b/sw/qa/extras/layout/data/section-nested-with-pagebreaks.fodt @@ -0,0 +1,148 @@ + + + 2024-11-20T20:04:29.2958602962024-11-20T20:57:42.826429164PT7M57S6CIB_OfficeDev/6.4.0.29$Linux_X86_64 LibreOffice_project/5374b230ff33d77a7f81d56046759f218a160036 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Text before outer section + + 1 + 2 + 3 + 4 + + 5 + 6 + 7 + 8 + + Text following inner section + + Text following outer section + + + diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx index ca8d298c3a09..e2bdf093cf17 100644 --- a/sw/qa/extras/layout/layout4.cxx +++ b/sw/qa/extras/layout/layout4.cxx @@ -128,6 +128,173 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testHiddenSectionPageDescs) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testSectionPageBreaksWithNestedSectionWithColumns) +{ + createSwDoc("section-nested-with-pagebreaks.fodt"); + + auto xTextSectionsSupplier = mxComponent.queryThrow(); + auto xSections = xTextSectionsSupplier->getTextSections(); + CPPUNIT_ASSERT(xSections); + auto xSection1 = xSections->getByName(u"Section1"_ustr).queryThrow(); + auto xSection2 = xSections->getByName(u"Section2"_ustr).queryThrow(); + CPPUNIT_ASSERT(getProperty(xSection1, "IsVisible")); + CPPUNIT_ASSERT(getProperty(xSection2, "IsVisible")); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/section", 1); + assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt", 2); + assertXPath(pXmlDoc, "/root/page[2]/body/section", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/section[1]/txt/SwParaPortion/SwLineLayout", + "portion", u"3"); + assertXPath(pXmlDoc, "/root/page[3]/body/section", 2); + assertXPath(pXmlDoc, "/root/page[3]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[3]/body/section[1]/txt/SwParaPortion/SwLineLayout", + "portion", u"4"); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/column", 2); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/column/body/txt", 2); + assertXPath(pXmlDoc, + "/root/page[3]/body/section[2]/column/body/txt[2]/SwParaPortion/SwLineLayout", + "portion", u"6"); + assertXPath(pXmlDoc, "/root/page[4]/body/section", 2); + assertXPath(pXmlDoc, "/root/page[4]/body/section[1]/column/body/txt", 2); + assertXPath(pXmlDoc, "/root/page[4]/body/section[1]/column/body/txt", 2); + assertXPath( + pXmlDoc, + "/root/page[4]/body/section[1]/column[1]/body/txt[1]/SwParaPortion/SwLineLayout", + "portion", u"7"); + assertXPath( + pXmlDoc, + "/root/page[4]/body/section[1]/column[2]/body/txt[1]/SwParaPortion/SwLineLayout", + "portion", u"8"); + assertXPath(pXmlDoc, "/root/page[4]/body/section[2]/txt", 1); + assertXPath(pXmlDoc, "/root/page[4]/body/section[2]/txt/SwParaPortion/SwLineLayout", + "portion", u"Text following inner section"); + assertXPath(pXmlDoc, "/root/page[4]/body/txt[1]/SwParaPortion/SwLineLayout", "portion", + u"Text following outer section"); + } + + xSection1->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(false)); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2); + assertXPath(pXmlDoc, "/root/page[1]/body/section", 3); + assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt", 4); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/column", 2); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/column/body/txt", 4); + assertXPath(pXmlDoc, "/root/page[1]/body/section[3]/txt", 1); + assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/infos/bounds", "height", u"0"); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/infos/bounds", "height", u"0"); + assertXPath(pXmlDoc, "/root/page[1]/body/section[3]/infos/bounds", "height", u"0"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout", "portion", + u"Text following outer section"); + } + + xSection1->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(true)); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/section", 1); + assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt", 2); + assertXPath(pXmlDoc, "/root/page[2]/body/section", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/section[1]/txt/SwParaPortion/SwLineLayout", + "portion", u"3"); + assertXPath(pXmlDoc, "/root/page[3]/body/section", 2); + assertXPath(pXmlDoc, "/root/page[3]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[3]/body/section[1]/txt/SwParaPortion/SwLineLayout", + "portion", u"4"); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/column", 2); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/column/body/txt", 2); + assertXPath(pXmlDoc, + "/root/page[3]/body/section[2]/column/body/txt[2]/SwParaPortion/SwLineLayout", + "portion", u"6"); + assertXPath(pXmlDoc, "/root/page[4]/body/section", 2); + assertXPath(pXmlDoc, "/root/page[4]/body/section[1]/column/body/txt", 2); + assertXPath(pXmlDoc, "/root/page[4]/body/section[1]/column/body/txt", 2); + assertXPath( + pXmlDoc, + "/root/page[4]/body/section[1]/column[1]/body/txt[1]/SwParaPortion/SwLineLayout", + "portion", u"7"); + assertXPath( + pXmlDoc, + "/root/page[4]/body/section[1]/column[2]/body/txt[1]/SwParaPortion/SwLineLayout", + "portion", u"8"); + assertXPath(pXmlDoc, "/root/page[4]/body/section[2]/txt", 1); + assertXPath(pXmlDoc, "/root/page[4]/body/section[2]/txt/SwParaPortion/SwLineLayout", + "portion", u"Text following inner section"); + assertXPath(pXmlDoc, "/root/page[4]/body/txt[1]/SwParaPortion/SwLineLayout", "portion", + u"Text following outer section"); + } + + xSection2->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(false)); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/section", 1); + assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt", 2); + assertXPath(pXmlDoc, "/root/page[2]/body/section", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/section[1]/txt/SwParaPortion/SwLineLayout", + "portion", u"3"); + assertXPath(pXmlDoc, "/root/page[3]/body/section", 3); + assertXPath(pXmlDoc, "/root/page[3]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[3]/body/section[1]/txt/SwParaPortion/SwLineLayout", + "portion", u"4"); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/column", 2); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/column/body/txt", 4); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/infos/bounds", "height", u"0"); + assertXPath(pXmlDoc, "/root/page[3]/body/section[3]/txt", 1); + assertXPath(pXmlDoc, "/root/page[3]/body/section[3]/txt/SwParaPortion/SwLineLayout", + "portion", u"Text following inner section"); + assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/SwParaPortion/SwLineLayout", "portion", + u"Text following outer section"); + } + + xSection2->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(true)); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/section", 1); + assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt", 2); + assertXPath(pXmlDoc, "/root/page[2]/body/section", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/section[1]/txt/SwParaPortion/SwLineLayout", + "portion", u"3"); + assertXPath(pXmlDoc, "/root/page[3]/body/section", 2); + assertXPath(pXmlDoc, "/root/page[3]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[3]/body/section[1]/txt/SwParaPortion/SwLineLayout", + "portion", u"4"); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/column", 2); + assertXPath(pXmlDoc, "/root/page[3]/body/section[2]/column/body/txt", 2); + assertXPath(pXmlDoc, + "/root/page[3]/body/section[2]/column/body/txt[2]/SwParaPortion/SwLineLayout", + "portion", u"6"); + assertXPath(pXmlDoc, "/root/page[4]/body/section", 2); + assertXPath(pXmlDoc, "/root/page[4]/body/section[1]/column/body/txt", 2); + assertXPath(pXmlDoc, "/root/page[4]/body/section[1]/column/body/txt", 2); + assertXPath( + pXmlDoc, + "/root/page[4]/body/section[1]/column[1]/body/txt[1]/SwParaPortion/SwLineLayout", + "portion", u"7"); + assertXPath( + pXmlDoc, + "/root/page[4]/body/section[1]/column[2]/body/txt[1]/SwParaPortion/SwLineLayout", + "portion", u"8"); + assertXPath(pXmlDoc, "/root/page[4]/body/section[2]/txt", 1); + assertXPath(pXmlDoc, "/root/page[4]/body/section[2]/txt/SwParaPortion/SwLineLayout", + "portion", u"Text following inner section"); + assertXPath(pXmlDoc, "/root/page[4]/body/txt[1]/SwParaPortion/SwLineLayout", "portion", + u"Text following outer section"); + } +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf156725) { createSwDoc("tdf156725.fodt"); diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 18701702197d..d67c2b931650 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -2832,16 +2832,19 @@ void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) } else { - if (GetNext()) + if (pFollow->GetNext()) { - assert(GetNext()->IsFlowFrame()); - SwFlowFrame::CastFlowFrame(GetNext())->MoveSubTree(pLay, nullptr); + assert(pFollow->GetNext()->IsFlowFrame()); + SwFlowFrame::CastFlowFrame(pFollow->GetNext())->MoveSubTree(pLay, nullptr); } pFollow = new SwSectionFrame(*pFollow, false); SimpleFormat(); pFollow->InsertBehind(pLay, nullptr); pFollow->Init(); - SwFlowFrame::CastFlowFrame(pLowerFrame)->MoveSubTree(pFollow, nullptr); + SwLayoutFrame *const pTarget{pColumn + ? static_cast(static_cast(pFollow->Lower())->Lower()) + : pFollow}; + SwFlowFrame::CastFlowFrame(pLowerFrame)->MoveSubTree(pTarget, nullptr); } } } From fbfbd2f51ebc5ab239d06ded7931214b1c84a5fd Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 20 Nov 2024 19:30:54 +0100 Subject: [PATCH 072/373] sw: fix hiding/unhiding section via condition The problem was that when un-hiding a section, table rows that contained only empty paragraphs were not reformatted and remained at height 0. It turns out that the table row that became visible did so because the cells had a VertOrientation different from NONE and so SwContentNotify::ImplDestroy() invalidated the cells' printarea. However, the real problem isn't in the layout code at all, as it then turns out that the reason why anything is reformatted at all is that there are docinfo fields on the same page as the section and also in the paragraphs at the start of the section, and these get invalidated somehow after unhiding the section. Unhiding the section didn't actually invalidate anything in the layout because in ImplSetHiddenFlag() no change is detected, and that is because the section was first hidden by removing its (false) condition, which calls SwSection::SetSectionData() and that didn't call ImplSetHiddenFlag(), again relying on docinfo field update to trigger the relayouting. Change-Id: Ie5d9e4d5a0467c17c662f20f8d54aa6b22b382da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176914 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/docnode/section.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index c539c7531dc8..d9ac1d35ddd6 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -254,12 +254,14 @@ SwSection::~SwSection() void SwSection::SetSectionData(SwSectionData const& rData) { bool const bOldHidden( m_Data.IsHidden() ); + bool const bOldCondHidden{m_Data.IsCondHidden()}; m_Data = rData; // The next two may actually overwrite the m_Data.m_bProtect or EditInReadonly Flag // in Modify, which should result in same flag value as the old code! SetProtect(m_Data.IsProtectFlag()); SetEditInReadonly(m_Data.IsEditInReadonlyFlag()); - if (bOldHidden != m_Data.IsHidden()) // check if changed... + if (bOldHidden != m_Data.IsHidden() + || bOldCondHidden != m_Data.IsCondHidden()) // check if changed... { ImplSetHiddenFlag(m_Data.IsHidden(), m_Data.IsCondHidden()); } From 32eb29377c5bbf6a965357756d2813add2789053 Mon Sep 17 00:00:00 2001 From: Patrick Luby Date: Wed, 20 Nov 2024 20:16:30 -0500 Subject: [PATCH 073/373] tdf#163945 present drawable immediately It seems that -[MTLCommandBuffer presentDrawable:] doesn't immediately replace the previous drawable on screen so I assume that there is some default minimum display time for drawables. LibreOffice only invokes this method in a timer so let LibreOffice control the rate of window updates by presenting the drawable right now. Change-Id: Ibd8d72bd6ea0303f9582264791cc4356bda62c13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176879 Reviewed-by: Patrick Luby Tested-by: Jenkins --- external/skia/swap-buffers-rect.patch.1 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/external/skia/swap-buffers-rect.patch.1 b/external/skia/swap-buffers-rect.patch.1 index 0b02be761a50..0451725fdf22 100644 --- a/external/skia/swap-buffers-rect.patch.1 +++ b/external/skia/swap-buffers-rect.patch.1 @@ -11,9 +11,9 @@ diff -ur skia.org/tools/window/MetalWindowContext.h skia/tools/window/MetalWindo bool fValid; diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWindowContext.mm ---- skia.org/tools/window/MetalWindowContext.mm 2024-10-05 18:16:04.521814026 +0200 -+++ skia/tools/window/MetalWindowContext.mm 2024-10-05 18:17:31.670443188 +0200 -@@ -193,7 +193,7 @@ +--- skia.org/tools/window/MetalWindowContext.mm 2024-11-15 19:32:58 ++++ skia/tools/window/MetalWindowContext.mm 2024-11-20 19:02:09 +@@ -153,13 +153,21 @@ return surface; } @@ -22,6 +22,21 @@ diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWind id currentDrawable = (id)fDrawableHandle; id commandBuffer([*fShared->fQueue commandBuffer]); + commandBuffer.label = @"Present"; + +- [commandBuffer presentDrawable:currentDrawable]; ++ // tdf#163945 present drawable immediately ++ // It seems that -[MTLCommandBuffer presentDrawable:] doesn't ++ // immediately replace the previous drawable on screen so I ++ // assume that there is some default minimum display time for ++ // drawables. ++ // LibreOffice only invokes this method in a timer so let ++ // LibreOffice control the rate of window updates by presenting ++ // the drawable right now. ++ [commandBuffer presentDrawable:currentDrawable atTime:CACurrentMediaTime()]; + [commandBuffer commit]; + // ARC is off in sk_app, so we need to release the CF ref manually + CFRelease(fDrawableHandle); diff -ur skia.org/tools/window/unix/RasterWindowContext_unix.cpp skia/tools/window/unix/RasterWindowContext_unix.cpp --- skia.org/tools/window/unix/RasterWindowContext_unix.cpp 2024-10-05 18:16:04.521814026 +0200 +++ skia/tools/window/unix/RasterWindowContext_unix.cpp 2024-10-05 18:18:49.554847490 +0200 From 510467f5b2b9b9dc5ba0cd24b446dcd2c2e32acf Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 21 Nov 2024 12:27:22 +0100 Subject: [PATCH 074/373] tdf#163486: PVS: variable was assigned the same value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit 1a1e953ee33c213dc8b88dd96a69ca9fc5e42d50 Author: Gökçen Eraslan Date: Mon Jul 9 13:53:38 2012 +0300 We use hidden signatures for now. V1048 The 'sigHidden' variable was assigned the same value. Change-Id: If394032db0cc848864a640e45a0492eee28b5205 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176917 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- vcl/source/gdi/pdfwriter_impl.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 5adb2e53358a..9ce671e05f47 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -11874,7 +11874,6 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa if( nPageNr < 0 || o3tl::make_unsigned(nPageNr) >= m_aPages.size() ) return -1; - bool sigHidden(true); sal_Int32 nNewWidget = m_aWidgets.size(); m_aWidgets.emplace_back( ); @@ -12047,8 +12046,6 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa #if HAVE_FEATURE_NSS else if( rControl.getType() == PDFWriter::Signature) { - sigHidden = true; - rNewWidget.m_aRect = tools::Rectangle(0, 0, 0, 0); m_nSignatureObject = createObject(); @@ -12059,9 +12056,9 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa } #endif - // if control is a hidden signature, do not convert coordinates since we + // if control is a signature, do not convert coordinates since we // need /Rect [ 0 0 0 0 ] - if ( ! ( ( rControl.getType() == PDFWriter::Signature ) && sigHidden ) ) + if ( rControl.getType() != PDFWriter::Signature ) { // convert to default user space now, since the mapmode may change // note: create default appearances before m_aRect gets transformed From 3d7991d3f1c7c43bea404a7027e1dee92c1b1cf4 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 21 Nov 2024 14:31:08 +0100 Subject: [PATCH 075/373] tdf#163486: PVS V1043 global object variable is declared in header (xdef.hxx) ...Multiple copies of it will be created in all translation units that include this header file. Change-Id: Ie63ed8b12c5579e0ff5cb77e4709eb4526c1e7f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176924 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/svx/xdef.hxx | 112 +++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/include/svx/xdef.hxx b/include/svx/xdef.hxx index 6d06c22cb1fa..5cfdde78eab8 100644 --- a/include/svx/xdef.hxx +++ b/include/svx/xdef.hxx @@ -85,66 +85,66 @@ class XSecondaryFillColorItem; #define COL_DEFAULT_SHAPE_FILLING ::Color(0x729fcf) // light blue 2 #define COL_DEFAULT_SHAPE_STROKE ::Color(0x3465a4) // dark blue 1 -constexpr sal_uInt16 XATTR_START = 1000; +inline constexpr sal_uInt16 XATTR_START = 1000; -constexpr sal_uInt16 XATTR_LINE_FIRST (XATTR_START); // 1000 -constexpr TypedWhichId XATTR_LINESTYLE (XATTR_LINE_FIRST); // 1000 -constexpr TypedWhichId XATTR_LINEDASH (XATTR_LINE_FIRST + 1); // 1001 -constexpr TypedWhichId XATTR_LINEWIDTH (XATTR_LINE_FIRST + 2); // 1002 -constexpr TypedWhichId XATTR_LINECOLOR (XATTR_LINE_FIRST + 3); // 1003 -constexpr TypedWhichId XATTR_LINESTART (XATTR_LINE_FIRST + 4); // 1004 -constexpr TypedWhichId XATTR_LINEEND (XATTR_LINE_FIRST + 5); // 1005 -constexpr TypedWhichId XATTR_LINESTARTWIDTH (XATTR_LINE_FIRST + 6); // 1006 -constexpr TypedWhichId XATTR_LINEENDWIDTH (XATTR_LINE_FIRST + 7); // 1007 -constexpr TypedWhichId XATTR_LINESTARTCENTER (XATTR_LINE_FIRST + 8); // 1008 -constexpr TypedWhichId XATTR_LINEENDCENTER (XATTR_LINE_FIRST + 9); // 1009 -constexpr TypedWhichId XATTR_LINETRANSPARENCE (XATTR_LINE_FIRST + 10); // 1010 -constexpr TypedWhichId XATTR_LINEJOINT (XATTR_LINE_FIRST + 11); // 1011 -constexpr TypedWhichId XATTR_LINECAP (XATTR_LINE_FIRST + 12); // 1012 -constexpr sal_uInt16 XATTR_LINE_LAST (XATTR_LINECAP); // 1012 -constexpr TypedWhichId XATTRSET_LINE (XATTR_LINE_LAST + 1); // 1013 +inline constexpr sal_uInt16 XATTR_LINE_FIRST (XATTR_START); // 1000 +inline constexpr TypedWhichId XATTR_LINESTYLE (XATTR_LINE_FIRST); // 1000 +inline constexpr TypedWhichId XATTR_LINEDASH (XATTR_LINE_FIRST + 1); // 1001 +inline constexpr TypedWhichId XATTR_LINEWIDTH (XATTR_LINE_FIRST + 2); // 1002 +inline constexpr TypedWhichId XATTR_LINECOLOR (XATTR_LINE_FIRST + 3); // 1003 +inline constexpr TypedWhichId XATTR_LINESTART (XATTR_LINE_FIRST + 4); // 1004 +inline constexpr TypedWhichId XATTR_LINEEND (XATTR_LINE_FIRST + 5); // 1005 +inline constexpr TypedWhichId XATTR_LINESTARTWIDTH (XATTR_LINE_FIRST + 6); // 1006 +inline constexpr TypedWhichId XATTR_LINEENDWIDTH (XATTR_LINE_FIRST + 7); // 1007 +inline constexpr TypedWhichId XATTR_LINESTARTCENTER (XATTR_LINE_FIRST + 8); // 1008 +inline constexpr TypedWhichId XATTR_LINEENDCENTER (XATTR_LINE_FIRST + 9); // 1009 +inline constexpr TypedWhichId XATTR_LINETRANSPARENCE (XATTR_LINE_FIRST + 10); // 1010 +inline constexpr TypedWhichId XATTR_LINEJOINT (XATTR_LINE_FIRST + 11); // 1011 +inline constexpr TypedWhichId XATTR_LINECAP (XATTR_LINE_FIRST + 12); // 1012 +inline constexpr sal_uInt16 XATTR_LINE_LAST (XATTR_LINECAP); // 1012 +inline constexpr TypedWhichId XATTRSET_LINE (XATTR_LINE_LAST + 1); // 1013 -constexpr sal_uInt16 XATTR_FILL_FIRST (XATTRSET_LINE + 1); // 1014 -constexpr TypedWhichId XATTR_FILLSTYLE (XATTR_FILL_FIRST); // 1014 -constexpr TypedWhichId XATTR_FILLCOLOR (XATTR_FILL_FIRST + 1); // 1015 -constexpr TypedWhichId XATTR_FILLGRADIENT (XATTR_FILL_FIRST + 2); // 1016 -constexpr TypedWhichId XATTR_FILLHATCH (XATTR_FILL_FIRST + 3); // 1017 -constexpr TypedWhichId XATTR_FILLBITMAP (XATTR_FILL_FIRST + 4); // 1018 -constexpr TypedWhichId XATTR_FILLTRANSPARENCE (XATTR_FILL_FIRST + 5); // 1019 -constexpr TypedWhichId XATTR_GRADIENTSTEPCOUNT (XATTR_FILL_FIRST + 6); // 1020 -constexpr TypedWhichId XATTR_FILLBMP_TILE (XATTR_FILL_FIRST + 7); // 1021 -constexpr TypedWhichId XATTR_FILLBMP_POS (XATTR_FILL_FIRST + 8); // 1022 -constexpr TypedWhichId XATTR_FILLBMP_SIZEX (XATTR_FILL_FIRST + 9); // 1023 -constexpr TypedWhichId XATTR_FILLBMP_SIZEY (XATTR_FILL_FIRST + 10); // 1024 -constexpr TypedWhichId XATTR_FILLFLOATTRANSPARENCE (XATTR_FILL_FIRST + 11); // 1025 -constexpr TypedWhichId XATTR_SECONDARYFILLCOLOR (XATTR_FILL_FIRST + 12); // 1026 -constexpr TypedWhichId XATTR_FILLBMP_SIZELOG (XATTR_FILL_FIRST + 13); // 1027 -constexpr TypedWhichId XATTR_FILLBMP_TILEOFFSETX (XATTR_FILL_FIRST + 14); // 1028 -constexpr TypedWhichId XATTR_FILLBMP_TILEOFFSETY (XATTR_FILL_FIRST + 15); // 1029 -constexpr TypedWhichId XATTR_FILLBMP_STRETCH (XATTR_FILL_FIRST + 16); // 1030 -constexpr TypedWhichId XATTR_FILLBMP_POSOFFSETX (XATTR_FILL_FIRST + 17); // 1031 -constexpr TypedWhichId XATTR_FILLBMP_POSOFFSETY (XATTR_FILL_FIRST + 18); // 1032 -constexpr TypedWhichId XATTR_FILLBACKGROUND (XATTR_FILL_FIRST + 19); // 1033 -constexpr TypedWhichId XATTR_FILLUSESLIDEBACKGROUND (XATTR_FILL_FIRST + 20);// 1034 -constexpr sal_uInt16 XATTR_FILL_LAST (XATTR_FILLUSESLIDEBACKGROUND); // 1034 -constexpr TypedWhichId XATTRSET_FILL (XATTR_FILL_LAST + 1); // 1035 +inline constexpr sal_uInt16 XATTR_FILL_FIRST (XATTRSET_LINE + 1); // 1014 +inline constexpr TypedWhichId XATTR_FILLSTYLE (XATTR_FILL_FIRST); // 1014 +inline constexpr TypedWhichId XATTR_FILLCOLOR (XATTR_FILL_FIRST + 1); // 1015 +inline constexpr TypedWhichId XATTR_FILLGRADIENT (XATTR_FILL_FIRST + 2); // 1016 +inline constexpr TypedWhichId XATTR_FILLHATCH (XATTR_FILL_FIRST + 3); // 1017 +inline constexpr TypedWhichId XATTR_FILLBITMAP (XATTR_FILL_FIRST + 4); // 1018 +inline constexpr TypedWhichId XATTR_FILLTRANSPARENCE (XATTR_FILL_FIRST + 5); // 1019 +inline constexpr TypedWhichId XATTR_GRADIENTSTEPCOUNT (XATTR_FILL_FIRST + 6); // 1020 +inline constexpr TypedWhichId XATTR_FILLBMP_TILE (XATTR_FILL_FIRST + 7); // 1021 +inline constexpr TypedWhichId XATTR_FILLBMP_POS (XATTR_FILL_FIRST + 8); // 1022 +inline constexpr TypedWhichId XATTR_FILLBMP_SIZEX (XATTR_FILL_FIRST + 9); // 1023 +inline constexpr TypedWhichId XATTR_FILLBMP_SIZEY (XATTR_FILL_FIRST + 10); // 1024 +inline constexpr TypedWhichId XATTR_FILLFLOATTRANSPARENCE (XATTR_FILL_FIRST + 11); // 1025 +inline constexpr TypedWhichId XATTR_SECONDARYFILLCOLOR (XATTR_FILL_FIRST + 12); // 1026 +inline constexpr TypedWhichId XATTR_FILLBMP_SIZELOG (XATTR_FILL_FIRST + 13); // 1027 +inline constexpr TypedWhichId XATTR_FILLBMP_TILEOFFSETX (XATTR_FILL_FIRST + 14); // 1028 +inline constexpr TypedWhichId XATTR_FILLBMP_TILEOFFSETY (XATTR_FILL_FIRST + 15); // 1029 +inline constexpr TypedWhichId XATTR_FILLBMP_STRETCH (XATTR_FILL_FIRST + 16); // 1030 +inline constexpr TypedWhichId XATTR_FILLBMP_POSOFFSETX (XATTR_FILL_FIRST + 17); // 1031 +inline constexpr TypedWhichId XATTR_FILLBMP_POSOFFSETY (XATTR_FILL_FIRST + 18); // 1032 +inline constexpr TypedWhichId XATTR_FILLBACKGROUND (XATTR_FILL_FIRST + 19); // 1033 +inline constexpr TypedWhichId XATTR_FILLUSESLIDEBACKGROUND (XATTR_FILL_FIRST + 20);// 1034 +inline constexpr sal_uInt16 XATTR_FILL_LAST (XATTR_FILLUSESLIDEBACKGROUND); // 1034 +inline constexpr TypedWhichId XATTRSET_FILL (XATTR_FILL_LAST + 1); // 1035 -constexpr sal_uInt16 XATTR_TEXT_FIRST (XATTRSET_FILL + 1); // 1036 -constexpr TypedWhichId XATTR_FORMTXTSTYLE (XATTR_TEXT_FIRST); // 1036 -constexpr TypedWhichId XATTR_FORMTXTADJUST (XATTR_TEXT_FIRST + 1); // 1037 -constexpr TypedWhichId XATTR_FORMTXTDISTANCE (XATTR_TEXT_FIRST + 2); // 1038 -constexpr TypedWhichId XATTR_FORMTXTSTART (XATTR_TEXT_FIRST + 3); // 1039 -constexpr TypedWhichId XATTR_FORMTXTMIRROR (XATTR_TEXT_FIRST + 4); // 1040 -constexpr TypedWhichId XATTR_FORMTXTOUTLINE (XATTR_TEXT_FIRST + 5); // 1041 -constexpr TypedWhichId XATTR_FORMTXTSHADOW (XATTR_TEXT_FIRST + 6); // 1042 -constexpr TypedWhichId XATTR_FORMTXTSHDWCOLOR (XATTR_TEXT_FIRST + 7); // 1043 -constexpr TypedWhichId XATTR_FORMTXTSHDWXVAL (XATTR_TEXT_FIRST + 8); // 1044 -constexpr TypedWhichId XATTR_FORMTXTSHDWYVAL (XATTR_TEXT_FIRST + 9); // 1045 -constexpr TypedWhichId XATTR_FORMTXTHIDEFORM (XATTR_TEXT_FIRST + 10); // 1046 -constexpr TypedWhichId XATTR_FORMTXTSHDWTRANSP (XATTR_TEXT_FIRST + 11); // 1047 -constexpr sal_uInt16 XATTR_TEXT_LAST (XATTR_FORMTXTSHDWTRANSP);// 1047 +inline constexpr sal_uInt16 XATTR_TEXT_FIRST (XATTRSET_FILL + 1); // 1036 +inline constexpr TypedWhichId XATTR_FORMTXTSTYLE (XATTR_TEXT_FIRST); // 1036 +inline constexpr TypedWhichId XATTR_FORMTXTADJUST (XATTR_TEXT_FIRST + 1); // 1037 +inline constexpr TypedWhichId XATTR_FORMTXTDISTANCE (XATTR_TEXT_FIRST + 2); // 1038 +inline constexpr TypedWhichId XATTR_FORMTXTSTART (XATTR_TEXT_FIRST + 3); // 1039 +inline constexpr TypedWhichId XATTR_FORMTXTMIRROR (XATTR_TEXT_FIRST + 4); // 1040 +inline constexpr TypedWhichId XATTR_FORMTXTOUTLINE (XATTR_TEXT_FIRST + 5); // 1041 +inline constexpr TypedWhichId XATTR_FORMTXTSHADOW (XATTR_TEXT_FIRST + 6); // 1042 +inline constexpr TypedWhichId XATTR_FORMTXTSHDWCOLOR (XATTR_TEXT_FIRST + 7); // 1043 +inline constexpr TypedWhichId XATTR_FORMTXTSHDWXVAL (XATTR_TEXT_FIRST + 8); // 1044 +inline constexpr TypedWhichId XATTR_FORMTXTSHDWYVAL (XATTR_TEXT_FIRST + 9); // 1045 +inline constexpr TypedWhichId XATTR_FORMTXTHIDEFORM (XATTR_TEXT_FIRST + 10); // 1046 +inline constexpr TypedWhichId XATTR_FORMTXTSHDWTRANSP (XATTR_TEXT_FIRST + 11); // 1047 +inline constexpr sal_uInt16 XATTR_TEXT_LAST (XATTR_FORMTXTSHDWTRANSP);// 1047 -constexpr sal_uInt16 XATTR_END = XATTR_TEXT_LAST; // 1047 +inline constexpr sal_uInt16 XATTR_END = XATTR_TEXT_LAST; // 1047 #endif From 166dd64751616ee148c6a45796da9869525c59d4 Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Thu, 21 Nov 2024 15:36:48 +0100 Subject: [PATCH 076/373] Fix typos Change-Id: I98f88e799a9a5128677f26e0c740c0764ffc8d9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176934 Reviewed-by: Julien Nabet Tested-by: Julien Nabet --- sd/source/ui/inc/SlideshowLayerRenderer.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx b/sd/source/ui/inc/SlideshowLayerRenderer.hxx index 7f26d9b23b52..dfe697a5cf9c 100644 --- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx +++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx @@ -118,7 +118,7 @@ public: /** Calculate and set the slide size depending on input desired size (in pixels) * - * Input the desired size in pixels, and the actual size pixels will be caluclated + * Input the desired size in pixels, and the actual size pixels will be calculated * depending on the size of the slide and the desired size. The size can differ, * because the it must match the slide aspect ratio. **/ @@ -127,7 +127,7 @@ public: /** Renders one layer * * The slide layer is rendered into the input buffer, which must be the byte size - * of the calcualted size in pixels * 4 (RGBA). + * of the calculated size in pixels * 4 (RGBA). * The properties of the layer are written to the input string in JSON format. * * @returns false, if nothing was rendered and rendering is done */ From 19c61f4dc34c751235fadcba0d79c2c4da129c5c Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Wed, 20 Nov 2024 22:55:28 -0900 Subject: [PATCH 077/373] Resolves tdf#163971 - Unexpected sidebar opening in Math with Alt+2/3/4 shortcuts Change-Id: I0acb8fd2fc1b570a4cab3b3a6950a8e6294be316 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176895 Reviewed-by: Jim Raykowski Tested-by: Jenkins --- .../org/openoffice/Office/Accelerators.xcu | 96 +++++++++++++++---- 1 file changed, 78 insertions(+), 18 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index f673fea304eb..ac69b5939add 100644 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -340,24 +340,6 @@ Ctrl+Shift+u aka U_SHIFT_MOD1 under GTK/IBUS is for unicode key input .uno:SidebarDeck.PropertyDeck - - - L10N SHORTCUTS - NO TRANSLATE - .uno:SidebarDeck.StyleListDeck - - - - - L10N SHORTCUTS - NO TRANSLATE - .uno:SidebarDeck.GalleryDeck - - - - - L10N SHORTCUTS - NO TRANSLATE - .uno:SidebarDeck.NavigatorDeck - - @@ -601,6 +583,24 @@ Ctrl+Shift+u aka U_SHIFT_MOD1 under GTK/IBUS is for unicode key input + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.StyleListDeck + + + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.GalleryDeck + + + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.NavigatorDeck + + L10N SHORTCUTS - NO TRANSLATE @@ -1631,6 +1631,24 @@ Ctrl+Shift+u aka U_SHIFT_MOD1 under GTK/IBUS is for unicode key input + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.StyleListDeck + + + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.GalleryDeck + + + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.NavigatorDeck + + L10N SHORTCUTS - NO TRANSLATE @@ -2910,6 +2928,24 @@ Ctrl+Shift+u aka U_SHIFT_MOD1 under GTK/IBUS is for unicode key input + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.StyleListDeck + + + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.GalleryDeck + + + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.NavigatorDeck + + L10N SHORTCUTS - NO TRANSLATE @@ -3510,6 +3546,12 @@ Ctrl+Shift+u aka U_SHIFT_MOD1 under GTK/IBUS is for unicode key input + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.ElementsDeck + + L10N SHORTCUTS - NO TRANSLATE @@ -6018,6 +6060,24 @@ Ctrl+Shift+u aka U_SHIFT_MOD1 under GTK/IBUS is for unicode key input .uno:Grow + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.StyleListDeck + + + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.GalleryDeck + + + + + L10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.NavigatorDeck + + L10N SHORTCUTS - NO TRANSLATE From 6e8ca63a61e3314e91a9b20cf371dd76969bc669 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Tue, 19 Nov 2024 18:32:05 -0300 Subject: [PATCH 078/373] tdf#153600 Extended tips for Style General page Change-Id: I05ab2620aac82c07613ac01ec7cb57031e5a9eab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176805 Reviewed-by: Olivier Hallot Tested-by: Jenkins --- sfx2/uiconfig/ui/managestylepage.ui | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/sfx2/uiconfig/ui/managestylepage.ui b/sfx2/uiconfig/ui/managestylepage.ui index aea08f0ad332..716fa42788e8 100644 --- a/sfx2/uiconfig/ui/managestylepage.ui +++ b/sfx2/uiconfig/ui/managestylepage.ui @@ -88,6 +88,11 @@ False center True + + + Select an existing style that you want to follow the current style in your document. For paragraph styles, the next style is applied to an empty paragraph that is created when you press Enter at the end of an existing paragraph. For page styles, the next style is applied when a new page is created. + +
  • 1 @@ -100,6 +105,11 @@ True True False + + + Edit the properties of the next style. + +
    2 @@ -112,6 +122,11 @@ False center True + + + Select an existing style (or - None -) to provide its definitions to the current style. Use the other tabs to modify the inherited style. + +
    1 @@ -124,6 +139,11 @@ True True False + + + Edit the properties of the parent style. + +
    2 @@ -136,6 +156,11 @@ False center True + + + Displays the category for the current style. If you are creating or modifying a new style, select 'Custom Style' from the list. + +
    1 @@ -148,9 +173,14 @@ True False True + Any paragraph formatting changes in the document to a paragraph with this style are applied automatically to modify the paragraph style. True True - Any paragraph formatting changes in the document to a paragraph with this style are applied automatically to modify the paragraph style. + + + Updates the style when you apply direct formatting to a paragraph using this style in your document. The formatting of all paragraphs using this style is automatically updated. + +
    1 @@ -166,6 +196,11 @@ False 52 True + + + Enter a name for the style. + +
    1 From 89884a63e1f45f83fe2b95c4b56345cc0906f996 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 21 Nov 2024 16:09:21 +0100 Subject: [PATCH 079/373] tdf#163486: PVS V1043 global object variable is declared in header (chart2) Change-Id: I553e7ed4782341fa0a2e8e7d444f158bc18d770e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176943 Reviewed-by: Julien Nabet Tested-by: Jenkins --- .../source/inc/chartview/ChartSfxItemIds.hxx | 262 +++++++++--------- 1 file changed, 131 insertions(+), 131 deletions(-) diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx index a5099cc0c31a..7ddcf432cb1e 100644 --- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -37,171 +37,171 @@ class SdrAngleItem; // SCHATTR // can't this be changed to 0? -constexpr sal_uInt16 SCHATTR_START = 1; +inline constexpr sal_uInt16 SCHATTR_START = 1; -constexpr sal_uInt16 SCHATTR_DATADESCR_START (SCHATTR_START); -constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_NUMBER (SCHATTR_DATADESCR_START); -constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_PERCENTAGE (SCHATTR_DATADESCR_START + 1); -constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_CATEGORY (SCHATTR_DATADESCR_START + 2); -constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_SYMBOL (SCHATTR_DATADESCR_START + 3); -constexpr TypedWhichId SCHATTR_DATADESCR_WRAP_TEXT (SCHATTR_DATADESCR_START + 4); -constexpr TypedWhichId SCHATTR_DATADESCR_SEPARATOR (SCHATTR_DATADESCR_START + 5); -constexpr TypedWhichId SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 6); -constexpr TypedWhichId SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 7); -constexpr TypedWhichId SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 8); //percentage values should not be offered -constexpr TypedWhichId SCHATTR_DATADESCR_CUSTOM_LEADER_LINES (SCHATTR_DATADESCR_START + 9); -constexpr TypedWhichId SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 10); -constexpr TypedWhichId SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 11); -constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME (SCHATTR_DATADESCR_START + 12); -constexpr sal_uInt16 SCHATTR_DATADESCR_END (SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME); +inline constexpr sal_uInt16 SCHATTR_DATADESCR_START (SCHATTR_START); +inline constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_NUMBER (SCHATTR_DATADESCR_START); +inline constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_PERCENTAGE (SCHATTR_DATADESCR_START + 1); +inline constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_CATEGORY (SCHATTR_DATADESCR_START + 2); +inline constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_SYMBOL (SCHATTR_DATADESCR_START + 3); +inline constexpr TypedWhichId SCHATTR_DATADESCR_WRAP_TEXT (SCHATTR_DATADESCR_START + 4); +inline constexpr TypedWhichId SCHATTR_DATADESCR_SEPARATOR (SCHATTR_DATADESCR_START + 5); +inline constexpr TypedWhichId SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 6); +inline constexpr TypedWhichId SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 7); +inline constexpr TypedWhichId SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 8); //percentage values should not be offered +inline constexpr TypedWhichId SCHATTR_DATADESCR_CUSTOM_LEADER_LINES (SCHATTR_DATADESCR_START + 9); +inline constexpr TypedWhichId SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 10); +inline constexpr TypedWhichId SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 11); +inline constexpr TypedWhichId SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME (SCHATTR_DATADESCR_START + 12); +inline constexpr sal_uInt16 SCHATTR_DATADESCR_END (SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME); //legend -constexpr sal_uInt16 SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1); -constexpr TypedWhichId SCHATTR_LEGEND_POS (SCHATTR_LEGEND_START); -constexpr TypedWhichId SCHATTR_LEGEND_SHOW (SCHATTR_LEGEND_START + 1); -constexpr TypedWhichId SCHATTR_LEGEND_NO_OVERLAY (SCHATTR_LEGEND_START + 2); -constexpr sal_uInt16 SCHATTR_LEGEND_END (SCHATTR_LEGEND_NO_OVERLAY); +inline constexpr sal_uInt16 SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1); +inline constexpr TypedWhichId SCHATTR_LEGEND_POS (SCHATTR_LEGEND_START); +inline constexpr TypedWhichId SCHATTR_LEGEND_SHOW (SCHATTR_LEGEND_START + 1); +inline constexpr TypedWhichId SCHATTR_LEGEND_NO_OVERLAY (SCHATTR_LEGEND_START + 2); +inline constexpr sal_uInt16 SCHATTR_LEGEND_END (SCHATTR_LEGEND_NO_OVERLAY); //text -constexpr sal_uInt16 SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1); -constexpr TypedWhichId SCHATTR_TEXT_DEGREES (SCHATTR_TEXT_START); -constexpr TypedWhichId SCHATTR_TEXT_STACKED (SCHATTR_TEXT_START + 1); -constexpr sal_uInt16 SCHATTR_TEXT_END (SCHATTR_TEXT_STACKED); +inline constexpr sal_uInt16 SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1); +inline constexpr TypedWhichId SCHATTR_TEXT_DEGREES (SCHATTR_TEXT_START); +inline constexpr TypedWhichId SCHATTR_TEXT_STACKED (SCHATTR_TEXT_START + 1); +inline constexpr sal_uInt16 SCHATTR_TEXT_END (SCHATTR_TEXT_STACKED); // statistic -constexpr sal_uInt16 SCHATTR_STAT_START (SCHATTR_TEXT_END + 1); -constexpr TypedWhichId SCHATTR_STAT_AVERAGE (SCHATTR_STAT_START); -constexpr TypedWhichId SCHATTR_STAT_KIND_ERROR (SCHATTR_STAT_START + 1); -constexpr TypedWhichId SCHATTR_STAT_PERCENT (SCHATTR_STAT_START + 2); -constexpr TypedWhichId SCHATTR_STAT_BIGERROR (SCHATTR_STAT_START + 3); -constexpr TypedWhichId SCHATTR_STAT_CONSTPLUS (SCHATTR_STAT_START + 4); -constexpr TypedWhichId SCHATTR_STAT_CONSTMINUS (SCHATTR_STAT_START + 5); -constexpr TypedWhichId SCHATTR_STAT_INDICATE (SCHATTR_STAT_START + 6); -constexpr TypedWhichId SCHATTR_STAT_RANGE_POS (SCHATTR_STAT_START + 7); -constexpr TypedWhichId SCHATTR_STAT_RANGE_NEG (SCHATTR_STAT_START + 8); -constexpr TypedWhichId SCHATTR_STAT_ERRORBAR_TYPE (SCHATTR_STAT_START + 9); -constexpr sal_uInt16 SCHATTR_STAT_END (SCHATTR_STAT_ERRORBAR_TYPE); +inline constexpr sal_uInt16 SCHATTR_STAT_START (SCHATTR_TEXT_END + 1); +inline constexpr TypedWhichId SCHATTR_STAT_AVERAGE (SCHATTR_STAT_START); +inline constexpr TypedWhichId SCHATTR_STAT_KIND_ERROR (SCHATTR_STAT_START + 1); +inline constexpr TypedWhichId SCHATTR_STAT_PERCENT (SCHATTR_STAT_START + 2); +inline constexpr TypedWhichId SCHATTR_STAT_BIGERROR (SCHATTR_STAT_START + 3); +inline constexpr TypedWhichId SCHATTR_STAT_CONSTPLUS (SCHATTR_STAT_START + 4); +inline constexpr TypedWhichId SCHATTR_STAT_CONSTMINUS (SCHATTR_STAT_START + 5); +inline constexpr TypedWhichId SCHATTR_STAT_INDICATE (SCHATTR_STAT_START + 6); +inline constexpr TypedWhichId SCHATTR_STAT_RANGE_POS (SCHATTR_STAT_START + 7); +inline constexpr TypedWhichId SCHATTR_STAT_RANGE_NEG (SCHATTR_STAT_START + 8); +inline constexpr TypedWhichId SCHATTR_STAT_ERRORBAR_TYPE (SCHATTR_STAT_START + 9); +inline constexpr sal_uInt16 SCHATTR_STAT_END (SCHATTR_STAT_ERRORBAR_TYPE); // these attributes are for replacement of enum eChartStyle -constexpr sal_uInt16 SCHATTR_STYLE_START (SCHATTR_STAT_END + 1); +inline constexpr sal_uInt16 SCHATTR_STYLE_START (SCHATTR_STAT_END + 1); // for whole chart -constexpr TypedWhichId SCHATTR_STYLE_DEEP (SCHATTR_STYLE_START ); -constexpr TypedWhichId SCHATTR_STYLE_3D (SCHATTR_STYLE_START + 1); -constexpr TypedWhichId SCHATTR_STYLE_VERTICAL (SCHATTR_STYLE_START + 2); +inline constexpr TypedWhichId SCHATTR_STYLE_DEEP (SCHATTR_STYLE_START ); +inline constexpr TypedWhichId SCHATTR_STYLE_3D (SCHATTR_STYLE_START + 1); +inline constexpr TypedWhichId SCHATTR_STYLE_VERTICAL (SCHATTR_STYLE_START + 2); // also for series -constexpr TypedWhichId SCHATTR_STYLE_BASETYPE (SCHATTR_STYLE_START + 3);// Line,Area,...,Pie -constexpr TypedWhichId SCHATTR_STYLE_LINES (SCHATTR_STYLE_START + 4);// draw line -constexpr TypedWhichId SCHATTR_STYLE_PERCENT (SCHATTR_STYLE_START + 5); -constexpr TypedWhichId SCHATTR_STYLE_STACKED (SCHATTR_STYLE_START + 6); -constexpr TypedWhichId SCHATTR_STYLE_SPLINES (SCHATTR_STYLE_START + 7); +inline constexpr TypedWhichId SCHATTR_STYLE_BASETYPE (SCHATTR_STYLE_START + 3);// Line,Area,...,Pie +inline constexpr TypedWhichId SCHATTR_STYLE_LINES (SCHATTR_STYLE_START + 4);// draw line +inline constexpr TypedWhichId SCHATTR_STYLE_PERCENT (SCHATTR_STYLE_START + 5); +inline constexpr TypedWhichId SCHATTR_STYLE_STACKED (SCHATTR_STYLE_START + 6); +inline constexpr TypedWhichId SCHATTR_STYLE_SPLINES (SCHATTR_STYLE_START + 7); // also for data point -constexpr TypedWhichId SCHATTR_STYLE_SYMBOL (SCHATTR_STYLE_START + 8); -constexpr TypedWhichId SCHATTR_STYLE_SHAPE (SCHATTR_STYLE_START + 9); -constexpr sal_uInt16 SCHATTR_STYLE_END (SCHATTR_STYLE_SHAPE ); +inline constexpr TypedWhichId SCHATTR_STYLE_SYMBOL (SCHATTR_STYLE_START + 8); +inline constexpr TypedWhichId SCHATTR_STYLE_SHAPE (SCHATTR_STYLE_START + 9); +inline constexpr sal_uInt16 SCHATTR_STYLE_END (SCHATTR_STYLE_SHAPE ); -constexpr TypedWhichId SCHATTR_AXIS (SCHATTR_STYLE_END + 1); // see chtmodel.hxx defines CHART_AXIS_PRIMARY_X, etc. +inline constexpr TypedWhichId SCHATTR_AXIS (SCHATTR_STYLE_END + 1); // see chtmodel.hxx defines CHART_AXIS_PRIMARY_X, etc. //Re-mapped: -constexpr sal_uInt16 SCHATTR_AXIS_START (SCHATTR_AXIS + 1); +inline constexpr sal_uInt16 SCHATTR_AXIS_START (SCHATTR_AXIS + 1); //axis scale -constexpr TypedWhichId SCHATTR_AXISTYPE (SCHATTR_AXIS_START); -constexpr TypedWhichId SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 1); -constexpr TypedWhichId SCHATTR_AXIS_AUTO_MIN (SCHATTR_AXIS_START + 2); -constexpr TypedWhichId SCHATTR_AXIS_MIN (SCHATTR_AXIS_START + 3); -constexpr TypedWhichId SCHATTR_AXIS_AUTO_MAX (SCHATTR_AXIS_START + 4); -constexpr TypedWhichId SCHATTR_AXIS_MAX (SCHATTR_AXIS_START + 5); -constexpr TypedWhichId SCHATTR_AXIS_AUTO_STEP_MAIN (SCHATTR_AXIS_START + 6); -constexpr TypedWhichId SCHATTR_AXIS_STEP_MAIN (SCHATTR_AXIS_START + 7); -constexpr TypedWhichId SCHATTR_AXIS_MAIN_TIME_UNIT (SCHATTR_AXIS_START + 8); -constexpr TypedWhichId SCHATTR_AXIS_AUTO_STEP_HELP (SCHATTR_AXIS_START + 9); -constexpr TypedWhichId SCHATTR_AXIS_STEP_HELP (SCHATTR_AXIS_START + 10); -constexpr TypedWhichId SCHATTR_AXIS_HELP_TIME_UNIT (SCHATTR_AXIS_START + 11); -constexpr TypedWhichId SCHATTR_AXIS_AUTO_TIME_RESOLUTION (SCHATTR_AXIS_START + 12); -constexpr TypedWhichId SCHATTR_AXIS_TIME_RESOLUTION (SCHATTR_AXIS_START + 13); -constexpr TypedWhichId SCHATTR_AXIS_LOGARITHM (SCHATTR_AXIS_START + 14); -constexpr TypedWhichId SCHATTR_AXIS_AUTO_DATEAXIS (SCHATTR_AXIS_START + 15); -constexpr TypedWhichId SCHATTR_AXIS_ALLOW_DATEAXIS (SCHATTR_AXIS_START + 16); -constexpr TypedWhichId SCHATTR_AXIS_AUTO_ORIGIN (SCHATTR_AXIS_START + 17); -constexpr TypedWhichId SCHATTR_AXIS_ORIGIN (SCHATTR_AXIS_START + 18); +inline constexpr TypedWhichId SCHATTR_AXISTYPE (SCHATTR_AXIS_START); +inline constexpr TypedWhichId SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 1); +inline constexpr TypedWhichId SCHATTR_AXIS_AUTO_MIN (SCHATTR_AXIS_START + 2); +inline constexpr TypedWhichId SCHATTR_AXIS_MIN (SCHATTR_AXIS_START + 3); +inline constexpr TypedWhichId SCHATTR_AXIS_AUTO_MAX (SCHATTR_AXIS_START + 4); +inline constexpr TypedWhichId SCHATTR_AXIS_MAX (SCHATTR_AXIS_START + 5); +inline constexpr TypedWhichId SCHATTR_AXIS_AUTO_STEP_MAIN (SCHATTR_AXIS_START + 6); +inline constexpr TypedWhichId SCHATTR_AXIS_STEP_MAIN (SCHATTR_AXIS_START + 7); +inline constexpr TypedWhichId SCHATTR_AXIS_MAIN_TIME_UNIT (SCHATTR_AXIS_START + 8); +inline constexpr TypedWhichId SCHATTR_AXIS_AUTO_STEP_HELP (SCHATTR_AXIS_START + 9); +inline constexpr TypedWhichId SCHATTR_AXIS_STEP_HELP (SCHATTR_AXIS_START + 10); +inline constexpr TypedWhichId SCHATTR_AXIS_HELP_TIME_UNIT (SCHATTR_AXIS_START + 11); +inline constexpr TypedWhichId SCHATTR_AXIS_AUTO_TIME_RESOLUTION (SCHATTR_AXIS_START + 12); +inline constexpr TypedWhichId SCHATTR_AXIS_TIME_RESOLUTION (SCHATTR_AXIS_START + 13); +inline constexpr TypedWhichId SCHATTR_AXIS_LOGARITHM (SCHATTR_AXIS_START + 14); +inline constexpr TypedWhichId SCHATTR_AXIS_AUTO_DATEAXIS (SCHATTR_AXIS_START + 15); +inline constexpr TypedWhichId SCHATTR_AXIS_ALLOW_DATEAXIS (SCHATTR_AXIS_START + 16); +inline constexpr TypedWhichId SCHATTR_AXIS_AUTO_ORIGIN (SCHATTR_AXIS_START + 17); +inline constexpr TypedWhichId SCHATTR_AXIS_ORIGIN (SCHATTR_AXIS_START + 18); //axis position -constexpr sal_uInt16 SCHATTR_AXIS_POSITION_START (SCHATTR_AXIS_ORIGIN + 1); -constexpr TypedWhichId SCHATTR_AXIS_TICKS (SCHATTR_AXIS_POSITION_START); -constexpr TypedWhichId SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_POSITION_START + 1); -constexpr TypedWhichId SCHATTR_AXIS_POSITION (SCHATTR_AXIS_POSITION_START + 2); -constexpr TypedWhichId SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_POSITION_START + 3); -constexpr TypedWhichId SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_POSITION_START + 4); -constexpr TypedWhichId SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION (SCHATTR_AXIS_POSITION_START + 5); -constexpr TypedWhichId SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_POSITION_START + 6); -constexpr TypedWhichId SCHATTR_AXIS_MARK_POSITION (SCHATTR_AXIS_POSITION_START + 7); +inline constexpr sal_uInt16 SCHATTR_AXIS_POSITION_START (SCHATTR_AXIS_ORIGIN + 1); +inline constexpr TypedWhichId SCHATTR_AXIS_TICKS (SCHATTR_AXIS_POSITION_START); +inline constexpr TypedWhichId SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_POSITION_START + 1); +inline constexpr TypedWhichId SCHATTR_AXIS_POSITION (SCHATTR_AXIS_POSITION_START + 2); +inline constexpr TypedWhichId SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_POSITION_START + 3); +inline constexpr TypedWhichId SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_POSITION_START + 4); +inline constexpr TypedWhichId SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION (SCHATTR_AXIS_POSITION_START + 5); +inline constexpr TypedWhichId SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_POSITION_START + 6); +inline constexpr TypedWhichId SCHATTR_AXIS_MARK_POSITION (SCHATTR_AXIS_POSITION_START + 7); //axis label -constexpr sal_uInt16 SCHATTR_AXIS_LABEL_START (SCHATTR_AXIS_MARK_POSITION + 1); -constexpr TypedWhichId SCHATTR_AXIS_SHOWDESCR (SCHATTR_AXIS_LABEL_START); -constexpr TypedWhichId SCHATTR_AXIS_LABEL_ORDER (SCHATTR_AXIS_LABEL_START + 1); -constexpr TypedWhichId SCHATTR_AXIS_LABEL_OVERLAP (SCHATTR_AXIS_LABEL_START + 2); -constexpr TypedWhichId SCHATTR_AXIS_LABEL_BREAK (SCHATTR_AXIS_LABEL_START + 3); -constexpr sal_uInt16 SCHATTR_AXIS_LABEL_END (SCHATTR_AXIS_LABEL_BREAK); +inline constexpr sal_uInt16 SCHATTR_AXIS_LABEL_START (SCHATTR_AXIS_MARK_POSITION + 1); +inline constexpr TypedWhichId SCHATTR_AXIS_SHOWDESCR (SCHATTR_AXIS_LABEL_START); +inline constexpr TypedWhichId SCHATTR_AXIS_LABEL_ORDER (SCHATTR_AXIS_LABEL_START + 1); +inline constexpr TypedWhichId SCHATTR_AXIS_LABEL_OVERLAP (SCHATTR_AXIS_LABEL_START + 2); +inline constexpr TypedWhichId SCHATTR_AXIS_LABEL_BREAK (SCHATTR_AXIS_LABEL_START + 3); +inline constexpr sal_uInt16 SCHATTR_AXIS_LABEL_END (SCHATTR_AXIS_LABEL_BREAK); -constexpr sal_uInt16 SCHATTR_AXIS_END (SCHATTR_AXIS_LABEL_END); +inline constexpr sal_uInt16 SCHATTR_AXIS_END (SCHATTR_AXIS_LABEL_END); -constexpr TypedWhichId SCHATTR_SYMBOL_BRUSH (SCHATTR_AXIS_END + 1); -constexpr TypedWhichId SCHATTR_STOCK_VOLUME (SCHATTR_AXIS_END + 2); -constexpr TypedWhichId SCHATTR_STOCK_UPDOWN (SCHATTR_AXIS_END + 3); -constexpr TypedWhichId SCHATTR_SYMBOL_SIZE (SCHATTR_AXIS_END + 4); -constexpr TypedWhichId SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY (SCHATTR_AXIS_END + 5); +inline constexpr TypedWhichId SCHATTR_SYMBOL_BRUSH (SCHATTR_AXIS_END + 1); +inline constexpr TypedWhichId SCHATTR_STOCK_VOLUME (SCHATTR_AXIS_END + 2); +inline constexpr TypedWhichId SCHATTR_STOCK_UPDOWN (SCHATTR_AXIS_END + 3); +inline constexpr TypedWhichId SCHATTR_SYMBOL_SIZE (SCHATTR_AXIS_END + 4); +inline constexpr TypedWhichId SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY (SCHATTR_AXIS_END + 5); // non persistent items (binary format) -constexpr sal_uInt16 SCHATTR_CHARTTYPE_START (SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY + 1); +inline constexpr sal_uInt16 SCHATTR_CHARTTYPE_START (SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY + 1); // new from New Chart -constexpr TypedWhichId SCHATTR_BAR_OVERLAP (SCHATTR_CHARTTYPE_START ); -constexpr TypedWhichId SCHATTR_BAR_GAPWIDTH (SCHATTR_CHARTTYPE_START + 1); -constexpr TypedWhichId SCHATTR_BAR_CONNECT (SCHATTR_CHARTTYPE_START + 2); -constexpr TypedWhichId SCHATTR_NUM_OF_LINES_FOR_BAR (SCHATTR_CHARTTYPE_START + 3); -constexpr TypedWhichId SCHATTR_SPLINE_ORDER (SCHATTR_CHARTTYPE_START + 4); -constexpr TypedWhichId SCHATTR_SPLINE_RESOLUTION (SCHATTR_CHARTTYPE_START + 5); -constexpr TypedWhichId SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 6); -constexpr TypedWhichId SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 7); -constexpr TypedWhichId SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 8); -constexpr TypedWhichId SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 9); -constexpr TypedWhichId SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 10); -constexpr TypedWhichId SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 11); -constexpr TypedWhichId SCHATTR_HIDE_LEGEND_ENTRY (SCHATTR_CHARTTYPE_START + 12); +inline constexpr TypedWhichId SCHATTR_BAR_OVERLAP (SCHATTR_CHARTTYPE_START ); +inline constexpr TypedWhichId SCHATTR_BAR_GAPWIDTH (SCHATTR_CHARTTYPE_START + 1); +inline constexpr TypedWhichId SCHATTR_BAR_CONNECT (SCHATTR_CHARTTYPE_START + 2); +inline constexpr TypedWhichId SCHATTR_NUM_OF_LINES_FOR_BAR (SCHATTR_CHARTTYPE_START + 3); +inline constexpr TypedWhichId SCHATTR_SPLINE_ORDER (SCHATTR_CHARTTYPE_START + 4); +inline constexpr TypedWhichId SCHATTR_SPLINE_RESOLUTION (SCHATTR_CHARTTYPE_START + 5); +inline constexpr TypedWhichId SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 6); +inline constexpr TypedWhichId SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 7); +inline constexpr TypedWhichId SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 8); +inline constexpr TypedWhichId SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 9); +inline constexpr TypedWhichId SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 10); +inline constexpr TypedWhichId SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 11); +inline constexpr TypedWhichId SCHATTR_HIDE_LEGEND_ENTRY (SCHATTR_CHARTTYPE_START + 12); -constexpr sal_uInt16 SCHATTR_CHARTTYPE_END (SCHATTR_HIDE_LEGEND_ENTRY); +inline constexpr sal_uInt16 SCHATTR_CHARTTYPE_END (SCHATTR_HIDE_LEGEND_ENTRY); // items for transporting information to dialogs -constexpr sal_uInt16 SCHATTR_MISC_START (SCHATTR_CHARTTYPE_END + 1); -constexpr TypedWhichId SCHATTR_AXIS_FOR_ALL_SERIES (SCHATTR_MISC_START); -constexpr sal_uInt16 SCHATTR_MISC_END (SCHATTR_AXIS_FOR_ALL_SERIES); +inline constexpr sal_uInt16 SCHATTR_MISC_START (SCHATTR_CHARTTYPE_END + 1); +inline constexpr TypedWhichId SCHATTR_AXIS_FOR_ALL_SERIES (SCHATTR_MISC_START); +inline constexpr sal_uInt16 SCHATTR_MISC_END (SCHATTR_AXIS_FOR_ALL_SERIES); // regression curve -constexpr sal_uInt16 SCHATTR_REGRESSION_START (SCHATTR_MISC_END + 1); -constexpr TypedWhichId SCHATTR_REGRESSION_TYPE (SCHATTR_REGRESSION_START); -constexpr TypedWhichId SCHATTR_REGRESSION_SHOW_EQUATION (SCHATTR_REGRESSION_START + 1); -constexpr TypedWhichId SCHATTR_REGRESSION_SHOW_COEFF (SCHATTR_REGRESSION_START + 2); -constexpr TypedWhichId SCHATTR_REGRESSION_DEGREE (SCHATTR_REGRESSION_START + 3); -constexpr TypedWhichId SCHATTR_REGRESSION_PERIOD (SCHATTR_REGRESSION_START + 4); -constexpr TypedWhichId SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD (SCHATTR_REGRESSION_START + 5); -constexpr TypedWhichId SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD (SCHATTR_REGRESSION_START + 6); -constexpr TypedWhichId SCHATTR_REGRESSION_SET_INTERCEPT (SCHATTR_REGRESSION_START + 7); -constexpr TypedWhichId SCHATTR_REGRESSION_INTERCEPT_VALUE (SCHATTR_REGRESSION_START + 8); -constexpr TypedWhichId SCHATTR_REGRESSION_CURVE_NAME (SCHATTR_REGRESSION_START + 9); -constexpr TypedWhichId SCHATTR_REGRESSION_XNAME (SCHATTR_REGRESSION_START + 10); -constexpr TypedWhichId SCHATTR_REGRESSION_YNAME (SCHATTR_REGRESSION_START + 11); -constexpr TypedWhichId SCHATTR_REGRESSION_MOVING_TYPE (SCHATTR_REGRESSION_START + 12); -constexpr sal_uInt16 SCHATTR_REGRESSION_END (SCHATTR_REGRESSION_MOVING_TYPE); +inline constexpr sal_uInt16 SCHATTR_REGRESSION_START (SCHATTR_MISC_END + 1); +inline constexpr TypedWhichId SCHATTR_REGRESSION_TYPE (SCHATTR_REGRESSION_START); +inline constexpr TypedWhichId SCHATTR_REGRESSION_SHOW_EQUATION (SCHATTR_REGRESSION_START + 1); +inline constexpr TypedWhichId SCHATTR_REGRESSION_SHOW_COEFF (SCHATTR_REGRESSION_START + 2); +inline constexpr TypedWhichId SCHATTR_REGRESSION_DEGREE (SCHATTR_REGRESSION_START + 3); +inline constexpr TypedWhichId SCHATTR_REGRESSION_PERIOD (SCHATTR_REGRESSION_START + 4); +inline constexpr TypedWhichId SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD (SCHATTR_REGRESSION_START + 5); +inline constexpr TypedWhichId SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD (SCHATTR_REGRESSION_START + 6); +inline constexpr TypedWhichId SCHATTR_REGRESSION_SET_INTERCEPT (SCHATTR_REGRESSION_START + 7); +inline constexpr TypedWhichId SCHATTR_REGRESSION_INTERCEPT_VALUE (SCHATTR_REGRESSION_START + 8); +inline constexpr TypedWhichId SCHATTR_REGRESSION_CURVE_NAME (SCHATTR_REGRESSION_START + 9); +inline constexpr TypedWhichId SCHATTR_REGRESSION_XNAME (SCHATTR_REGRESSION_START + 10); +inline constexpr TypedWhichId SCHATTR_REGRESSION_YNAME (SCHATTR_REGRESSION_START + 11); +inline constexpr TypedWhichId SCHATTR_REGRESSION_MOVING_TYPE (SCHATTR_REGRESSION_START + 12); +inline constexpr sal_uInt16 SCHATTR_REGRESSION_END (SCHATTR_REGRESSION_MOVING_TYPE); -constexpr sal_uInt16 SCHATTR_DATA_TABLE_START (SCHATTR_REGRESSION_END + 1); -constexpr TypedWhichId SCHATTR_DATA_TABLE_HORIZONTAL_BORDER (SCHATTR_DATA_TABLE_START + 0); -constexpr TypedWhichId SCHATTR_DATA_TABLE_VERTICAL_BORDER (SCHATTR_DATA_TABLE_START + 1); -constexpr TypedWhichId SCHATTR_DATA_TABLE_OUTLINE (SCHATTR_DATA_TABLE_START + 2); -constexpr TypedWhichId SCHATTR_DATA_TABLE_KEYS (SCHATTR_DATA_TABLE_START + 3); -constexpr sal_uInt16 SCHATTR_DATA_TABLE_END (SCHATTR_DATA_TABLE_KEYS); +inline constexpr sal_uInt16 SCHATTR_DATA_TABLE_START (SCHATTR_REGRESSION_END + 1); +inline constexpr TypedWhichId SCHATTR_DATA_TABLE_HORIZONTAL_BORDER (SCHATTR_DATA_TABLE_START + 0); +inline constexpr TypedWhichId SCHATTR_DATA_TABLE_VERTICAL_BORDER (SCHATTR_DATA_TABLE_START + 1); +inline constexpr TypedWhichId SCHATTR_DATA_TABLE_OUTLINE (SCHATTR_DATA_TABLE_START + 2); +inline constexpr TypedWhichId SCHATTR_DATA_TABLE_KEYS (SCHATTR_DATA_TABLE_START + 3); +inline constexpr sal_uInt16 SCHATTR_DATA_TABLE_END (SCHATTR_DATA_TABLE_KEYS); -constexpr sal_uInt16 SCHATTR_END (SCHATTR_DATA_TABLE_END); +inline constexpr sal_uInt16 SCHATTR_END (SCHATTR_DATA_TABLE_END); // values for Items From 37a92f526ab48bc85171a17f303c642753f2f5c1 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 21 Nov 2024 15:48:45 +0100 Subject: [PATCH 080/373] postgresql: upgrade to 14.15 Downloaded from https://ftp.postgresql.org/pub/source/v14.15/postgresql-14.15.tar.bz2 Change-Id: I1dc53ff2cf487f36d0611913f59917c5c0097690 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176940 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- download.lst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download.lst b/download.lst index 6f0eee4f66b5..04de1629ef0e 100644 --- a/download.lst +++ b/download.lst @@ -585,8 +585,8 @@ POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -POSTGRESQL_SHA256SUM := 84727fbccdbd1efe01d8de64bc1b33095db773ad2457cefcedc2d8258ebc09d6 -POSTGRESQL_TARBALL := postgresql-14.14.tar.bz2 +POSTGRESQL_SHA256SUM := 02e891e314b4e9ee24cbd78028dab7c73f9c1ba3e30835bcbef71fe220401fc5 +POSTGRESQL_TARBALL := postgresql-14.15.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts From a88a4f49dd2ff21e477530fce93ef89c69b01278 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 21 Nov 2024 18:43:28 +0100 Subject: [PATCH 081/373] tdf#163486: PVS V1043 global object variable is declared in header (eeitem.hxx) Change-Id: I6d3445671f0a086a800c1239e105e7732c652eb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176953 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/editeng/eeitem.hxx | 130 ++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx index 92c7830af0cc..eb3c6a3e91e9 100644 --- a/include/editeng/eeitem.hxx +++ b/include/editeng/eeitem.hxx @@ -68,79 +68,79 @@ class SfxVoidItem; * as well. */ -constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END + 1); +inline constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END + 1); // Paragraph attributes: -constexpr sal_uInt16 EE_PARA_START (EE_ITEMS_START + 0); -constexpr TypedWhichId EE_PARA_WRITINGDIR (EE_PARA_START+0); -constexpr TypedWhichId EE_PARA_XMLATTRIBS (EE_PARA_START+1); -constexpr TypedWhichId EE_PARA_HANGINGPUNCTUATION (EE_PARA_START+2); -constexpr TypedWhichId EE_PARA_FORBIDDENRULES (EE_PARA_START+3); -constexpr TypedWhichId EE_PARA_ASIANCJKSPACING (EE_PARA_START+4); -constexpr TypedWhichId EE_PARA_NUMBULLET (EE_PARA_START+5); -constexpr TypedWhichId EE_PARA_HYPHENATE (EE_PARA_START+6); -constexpr TypedWhichId EE_PARA_HYPHENATE_NO_CAPS (EE_PARA_START+7); -constexpr TypedWhichId EE_PARA_HYPHENATE_NO_LAST_WORD (EE_PARA_START+8); -constexpr TypedWhichId EE_PARA_BULLETSTATE (EE_PARA_START+9); -constexpr TypedWhichId EE_PARA_OUTLLRSPACE (EE_PARA_START+10); -constexpr TypedWhichId EE_PARA_OUTLLEVEL (EE_PARA_START+11); -constexpr TypedWhichId EE_PARA_BULLET (EE_PARA_START+12); -constexpr TypedWhichId EE_PARA_LRSPACE (EE_PARA_START+13); -constexpr TypedWhichId EE_PARA_ULSPACE (EE_PARA_START+14); -constexpr TypedWhichId EE_PARA_SBL (EE_PARA_START+15); -constexpr TypedWhichId EE_PARA_JUST (EE_PARA_START+16); -constexpr TypedWhichId EE_PARA_TABS (EE_PARA_START+17); -constexpr TypedWhichId EE_PARA_JUST_METHOD (EE_PARA_START+18); -constexpr TypedWhichId EE_PARA_VER_JUST (EE_PARA_START+19); -constexpr sal_uInt16 EE_PARA_END (EE_PARA_START + 19); +inline constexpr sal_uInt16 EE_PARA_START (EE_ITEMS_START + 0); +inline constexpr TypedWhichId EE_PARA_WRITINGDIR (EE_PARA_START+0); +inline constexpr TypedWhichId EE_PARA_XMLATTRIBS (EE_PARA_START+1); +inline constexpr TypedWhichId EE_PARA_HANGINGPUNCTUATION (EE_PARA_START+2); +inline constexpr TypedWhichId EE_PARA_FORBIDDENRULES (EE_PARA_START+3); +inline constexpr TypedWhichId EE_PARA_ASIANCJKSPACING (EE_PARA_START+4); +inline constexpr TypedWhichId EE_PARA_NUMBULLET (EE_PARA_START+5); +inline constexpr TypedWhichId EE_PARA_HYPHENATE (EE_PARA_START+6); +inline constexpr TypedWhichId EE_PARA_HYPHENATE_NO_CAPS (EE_PARA_START+7); +inline constexpr TypedWhichId EE_PARA_HYPHENATE_NO_LAST_WORD (EE_PARA_START+8); +inline constexpr TypedWhichId EE_PARA_BULLETSTATE (EE_PARA_START+9); +inline constexpr TypedWhichId EE_PARA_OUTLLRSPACE (EE_PARA_START+10); +inline constexpr TypedWhichId EE_PARA_OUTLLEVEL (EE_PARA_START+11); +inline constexpr TypedWhichId EE_PARA_BULLET (EE_PARA_START+12); +inline constexpr TypedWhichId EE_PARA_LRSPACE (EE_PARA_START+13); +inline constexpr TypedWhichId EE_PARA_ULSPACE (EE_PARA_START+14); +inline constexpr TypedWhichId EE_PARA_SBL (EE_PARA_START+15); +inline constexpr TypedWhichId EE_PARA_JUST (EE_PARA_START+16); +inline constexpr TypedWhichId EE_PARA_TABS (EE_PARA_START+17); +inline constexpr TypedWhichId EE_PARA_JUST_METHOD (EE_PARA_START+18); +inline constexpr TypedWhichId EE_PARA_VER_JUST (EE_PARA_START+19); +inline constexpr sal_uInt16 EE_PARA_END (EE_PARA_START + 19); // Character attributes: -constexpr sal_uInt16 EE_CHAR_START (EE_PARA_END + 1); -constexpr TypedWhichId EE_CHAR_COLOR (EE_CHAR_START+0); -constexpr TypedWhichId EE_CHAR_FONTINFO (EE_CHAR_START+1); -constexpr TypedWhichId EE_CHAR_FONTHEIGHT (EE_CHAR_START+2); -constexpr TypedWhichId EE_CHAR_FONTWIDTH (EE_CHAR_START+3); -constexpr TypedWhichId EE_CHAR_WEIGHT (EE_CHAR_START+4); -constexpr TypedWhichId EE_CHAR_UNDERLINE (EE_CHAR_START+5); -constexpr TypedWhichId EE_CHAR_STRIKEOUT (EE_CHAR_START+6); -constexpr TypedWhichId EE_CHAR_ITALIC (EE_CHAR_START+7); -constexpr TypedWhichId EE_CHAR_OUTLINE (EE_CHAR_START+8); -constexpr TypedWhichId EE_CHAR_SHADOW (EE_CHAR_START+9); -constexpr TypedWhichId EE_CHAR_ESCAPEMENT (EE_CHAR_START+10); -constexpr TypedWhichId EE_CHAR_PAIRKERNING (EE_CHAR_START+11); -constexpr TypedWhichId EE_CHAR_KERNING (EE_CHAR_START+12); -constexpr TypedWhichId EE_CHAR_WLM (EE_CHAR_START+13); -constexpr TypedWhichId EE_CHAR_LANGUAGE (EE_CHAR_START+14); -constexpr TypedWhichId EE_CHAR_LANGUAGE_CJK (EE_CHAR_START+15); -constexpr TypedWhichId EE_CHAR_LANGUAGE_CTL (EE_CHAR_START+16); -constexpr TypedWhichId EE_CHAR_FONTINFO_CJK (EE_CHAR_START+17); -constexpr TypedWhichId EE_CHAR_FONTINFO_CTL (EE_CHAR_START+18); -constexpr TypedWhichId EE_CHAR_FONTHEIGHT_CJK (EE_CHAR_START+19); -constexpr TypedWhichId EE_CHAR_FONTHEIGHT_CTL (EE_CHAR_START+20); -constexpr TypedWhichId EE_CHAR_WEIGHT_CJK (EE_CHAR_START+21); -constexpr TypedWhichId EE_CHAR_WEIGHT_CTL (EE_CHAR_START+22); -constexpr TypedWhichId EE_CHAR_ITALIC_CJK (EE_CHAR_START+23); -constexpr TypedWhichId EE_CHAR_ITALIC_CTL (EE_CHAR_START+24); -constexpr TypedWhichId EE_CHAR_EMPHASISMARK (EE_CHAR_START+25); -constexpr TypedWhichId EE_CHAR_RELIEF (EE_CHAR_START+26); -constexpr TypedWhichId EE_CHAR_XMLATTRIBS (EE_CHAR_START+27); -constexpr TypedWhichId EE_CHAR_OVERLINE (EE_CHAR_START+28); -constexpr TypedWhichId EE_CHAR_CASEMAP (EE_CHAR_START+29); -constexpr TypedWhichId EE_CHAR_GRABBAG (EE_CHAR_START+30); -constexpr TypedWhichId EE_CHAR_BKGCOLOR (EE_CHAR_START+31); +inline constexpr sal_uInt16 EE_CHAR_START (EE_PARA_END + 1); +inline constexpr TypedWhichId EE_CHAR_COLOR (EE_CHAR_START+0); +inline constexpr TypedWhichId EE_CHAR_FONTINFO (EE_CHAR_START+1); +inline constexpr TypedWhichId EE_CHAR_FONTHEIGHT (EE_CHAR_START+2); +inline constexpr TypedWhichId EE_CHAR_FONTWIDTH (EE_CHAR_START+3); +inline constexpr TypedWhichId EE_CHAR_WEIGHT (EE_CHAR_START+4); +inline constexpr TypedWhichId EE_CHAR_UNDERLINE (EE_CHAR_START+5); +inline constexpr TypedWhichId EE_CHAR_STRIKEOUT (EE_CHAR_START+6); +inline constexpr TypedWhichId EE_CHAR_ITALIC (EE_CHAR_START+7); +inline constexpr TypedWhichId EE_CHAR_OUTLINE (EE_CHAR_START+8); +inline constexpr TypedWhichId EE_CHAR_SHADOW (EE_CHAR_START+9); +inline constexpr TypedWhichId EE_CHAR_ESCAPEMENT (EE_CHAR_START+10); +inline constexpr TypedWhichId EE_CHAR_PAIRKERNING (EE_CHAR_START+11); +inline constexpr TypedWhichId EE_CHAR_KERNING (EE_CHAR_START+12); +inline constexpr TypedWhichId EE_CHAR_WLM (EE_CHAR_START+13); +inline constexpr TypedWhichId EE_CHAR_LANGUAGE (EE_CHAR_START+14); +inline constexpr TypedWhichId EE_CHAR_LANGUAGE_CJK (EE_CHAR_START+15); +inline constexpr TypedWhichId EE_CHAR_LANGUAGE_CTL (EE_CHAR_START+16); +inline constexpr TypedWhichId EE_CHAR_FONTINFO_CJK (EE_CHAR_START+17); +inline constexpr TypedWhichId EE_CHAR_FONTINFO_CTL (EE_CHAR_START+18); +inline constexpr TypedWhichId EE_CHAR_FONTHEIGHT_CJK (EE_CHAR_START+19); +inline constexpr TypedWhichId EE_CHAR_FONTHEIGHT_CTL (EE_CHAR_START+20); +inline constexpr TypedWhichId EE_CHAR_WEIGHT_CJK (EE_CHAR_START+21); +inline constexpr TypedWhichId EE_CHAR_WEIGHT_CTL (EE_CHAR_START+22); +inline constexpr TypedWhichId EE_CHAR_ITALIC_CJK (EE_CHAR_START+23); +inline constexpr TypedWhichId EE_CHAR_ITALIC_CTL (EE_CHAR_START+24); +inline constexpr TypedWhichId EE_CHAR_EMPHASISMARK (EE_CHAR_START+25); +inline constexpr TypedWhichId EE_CHAR_RELIEF (EE_CHAR_START+26); +inline constexpr TypedWhichId EE_CHAR_XMLATTRIBS (EE_CHAR_START+27); +inline constexpr TypedWhichId EE_CHAR_OVERLINE (EE_CHAR_START+28); +inline constexpr TypedWhichId EE_CHAR_CASEMAP (EE_CHAR_START+29); +inline constexpr TypedWhichId EE_CHAR_GRABBAG (EE_CHAR_START+30); +inline constexpr TypedWhichId EE_CHAR_BKGCOLOR (EE_CHAR_START+31); -constexpr sal_uInt16 EE_CHAR_END (EE_CHAR_START + 31); +inline constexpr sal_uInt16 EE_CHAR_END (EE_CHAR_START + 31); -constexpr sal_uInt16 EE_FEATURE_START (EE_CHAR_END + 1); -constexpr sal_uInt16 EE_FEATURE_TAB (EE_FEATURE_START + 0); -constexpr sal_uInt16 EE_FEATURE_LINEBR (EE_FEATURE_TAB + 1); -constexpr sal_uInt16 EE_FEATURE_NOTCONV (EE_FEATURE_LINEBR + 1); -constexpr TypedWhichId EE_FEATURE_FIELD (EE_FEATURE_NOTCONV + 1); -constexpr sal_uInt16 EE_FEATURE_END (EE_FEATURE_FIELD + 0); +inline constexpr sal_uInt16 EE_FEATURE_START (EE_CHAR_END + 1); +inline constexpr sal_uInt16 EE_FEATURE_TAB (EE_FEATURE_START + 0); +inline constexpr sal_uInt16 EE_FEATURE_LINEBR (EE_FEATURE_TAB + 1); +inline constexpr sal_uInt16 EE_FEATURE_NOTCONV (EE_FEATURE_LINEBR + 1); +inline constexpr TypedWhichId EE_FEATURE_FIELD (EE_FEATURE_NOTCONV + 1); +inline constexpr sal_uInt16 EE_FEATURE_END (EE_FEATURE_FIELD + 0); -constexpr sal_uInt16 EE_ITEMS_END (EE_FEATURE_END); +inline constexpr sal_uInt16 EE_ITEMS_END (EE_FEATURE_END); -constexpr sal_uInt16 EDITITEMCOUNT (EE_ITEMS_END - EE_ITEMS_START + 1); +inline constexpr sal_uInt16 EDITITEMCOUNT (EE_ITEMS_END - EE_ITEMS_START + 1); #endif // _ INCLUDED_EDITENG_EEITEM_HXX From d4425ae2f4cf8a18a43bb54ed4228d75665516de Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Thu, 21 Nov 2024 19:52:29 +0100 Subject: [PATCH 082/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I94ef2c1465698dca75925845be0a4b4cdd9f40d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176959 Tested-by: Jenkins Reviewed-by: Julien Nabet --- cui/inc/strings.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/cui/inc/strings.hxx b/cui/inc/strings.hxx index 5b72f3873df4..870061ccbfa0 100644 --- a/cui/inc/strings.hxx +++ b/cui/inc/strings.hxx @@ -9,6 +9,4 @@ #pragma once -#define RID_SVXSTR_KEY_BASIC_PATH "BASIC" - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ From c5bf76720fc4f0962b47b702970d6d31c2905407 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Tue, 19 Nov 2024 17:16:23 +0100 Subject: [PATCH 083/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I5c109872713b51cde54ad4617627e72070163601 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176783 Tested-by: Jenkins Reviewed-by: Julien Nabet --- cui/inc/strings.hrc | 1 - 1 file changed, 1 deletion(-) diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index 3e204ef7a719..1674f7299f9a 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -26,7 +26,6 @@ #define RID_CUISTR_KEY_TEMPLATE_PATH NC_("RID_SVXSTR_KEY_TEMPLATE_PATH", "Templates") #define RID_CUISTR_KEY_GLOSSARY_PATH NC_("RID_SVXSTR_KEY_GLOSSARY_PATH", "AutoText") #define RID_CUISTR_KEY_DICTIONARY_PATH NC_("RID_SVXSTR_KEY_DICTIONARY_PATH", "Dictionaries") -#define RID_CUISTR_KEY_HELP_DIR NC_("RID_SVXSTR_KEY_HELP_DIR", "Help") #define RID_CUISTR_KEY_GALLERY_DIR NC_("RID_SVXSTR_KEY_GALLERY_DIR", "Gallery") #define RID_CUISTR_KEY_TEMP_PATH NC_("RID_SVXSTR_KEY_TEMP_PATH", "Temporary files") #define RID_CUISTR_KEY_CLASSIFICATION_PATH NC_("RID_SVXSTR_KEY_CLASSIFICATION_PATH", "Classification") From 1fbc7faa91181ae8ac240dfe8db704673c44a14d Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Thu, 21 Nov 2024 19:58:17 +0100 Subject: [PATCH 084/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Iced153f4258e2f27007cfbb7a63b78db7f6985dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176962 Reviewed-by: Julien Nabet Tested-by: Jenkins --- cui/source/inc/scriptdlg.hxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx index b1b014771dae..740f952ed94d 100644 --- a/cui/source/inc/scriptdlg.hxx +++ b/cui/source/inc/scriptdlg.hxx @@ -30,10 +30,6 @@ #include -#define OBJTYPE_METHOD 2L -#define OBJTYPE_SCRIPTCONTAINER 3L -#define OBJTYPE_SFROOT 4L - typedef std::unordered_map < OUString, OUString > Selection_hash; class SFEntry; From b2e60fb56e8f8f0b99fdaf3162034db19a80fd7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Nov 2024 14:49:59 +0000 Subject: [PATCH 085/373] ofz#380107559 fods2xlsfuzzer Null-dereference READ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in SvXMLStylesContext::FindStyleChildContext Change-Id: I384e8e36bc23b7d84b7ccda34e1ee29109e5f708 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176942 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sc/source/filter/xml/xmlcelli.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 1b9671fabd2f..17b2a1a6b3c6 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -843,10 +843,11 @@ void ScXMLTableRowCellContext::SetAnnotation(const ScAddress& rPos) /* Don't attempt to get the style from the SdrObject, as it might be a default assigned one. */ - auto pStyle = rXMLImport.GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext( - XmlStyleFamily::SD_GRAPHICS_ID, mxAnnotationData->maStyleName); + const SvXMLStylesContext* pStylesCtxt = rXMLImport.GetShapeImport()->GetAutoStylesContext(); + const SvXMLStyleContext* pStyle = pStylesCtxt ? pStylesCtxt->FindStyleChildContext( + XmlStyleFamily::SD_GRAPHICS_ID, mxAnnotationData->maStyleName) : nullptr; OUString aStyleName = pStyle ? pStyle->GetParentName() : mxAnnotationData->maStyleName; - assert(!rXMLImport.GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext( + assert(!pStylesCtxt || !pStylesCtxt->FindStyleChildContext( XmlStyleFamily::SD_GRAPHICS_ID, aStyleName)); aStyleName = rXMLImport.GetStyleDisplayName(XmlStyleFamily::SD_GRAPHICS_ID, aStyleName); From 6ca76f3e6fbb19ef4982b0c178879645e7f72c00 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Thu, 21 Nov 2024 00:53:28 +0100 Subject: [PATCH 086/373] Related: tdf#160536 - ooxml import export correctly cell protection property for Pivot tables cells. Change-Id: I1bff7a27cf169fd0876e361b22b4d7017f190b40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176897 Tested-by: Jenkins Reviewed-by: Balazs Varga --- sc/qa/unit/PivotTableFormatsImportExport.cxx | 35 +++++++++++- .../Pivot_Table_with_Cell_Protection.xlsx | Bin 0 -> 13797 bytes sc/source/core/data/table2.cxx | 51 ------------------ sc/source/filter/excel/xepivotxml.cxx | 31 ++++++----- sc/source/filter/inc/stylesbuffer.hxx | 10 +++- sc/source/filter/oox/stylesbuffer.cxx | 35 ++++++++++-- sc/source/filter/oox/stylesfragment.cxx | 3 +- 7 files changed, 94 insertions(+), 71 deletions(-) create mode 100644 sc/qa/unit/data/xlsx/pivot-table/Pivot_Table_with_Cell_Protection.xlsx diff --git a/sc/qa/unit/PivotTableFormatsImportExport.cxx b/sc/qa/unit/PivotTableFormatsImportExport.cxx index 22d56c0f11d6..437a25d5e7e6 100644 --- a/sc/qa/unit/PivotTableFormatsImportExport.cxx +++ b/sc/qa/unit/PivotTableFormatsImportExport.cxx @@ -57,6 +57,13 @@ Color getFontColor(ScDocument& rDoc, OUString const& rAddressString) return rItem.getColor(); } +bool getCellProtection(ScDocument& rDoc, OUString const& rAddressString) +{ + const ScPatternAttr* pPattern = rDoc.GetPattern(parseAddress(rDoc, rAddressString)); + const ScProtectionAttr& rItem = pPattern->GetItem(ATTR_PROTECTION); + return rItem.GetProtection(); +} + template OUString checkNonEmptyAddresses(ScDocument& rDoc, T const& rArrayOfAddresses) { OUString aString; @@ -66,7 +73,8 @@ template OUString checkNonEmptyAddresses(ScDocument& rDoc, T const& aAddress.Parse(rAddressString, rDoc); const ScPatternAttr* pPattern = rDoc.GetPattern(aAddress); if (pPattern->GetItem(ATTR_FONT_COLOR).getColor() != COL_BLACK - || pPattern->GetItem(ATTR_BACKGROUND).GetColor() != COL_TRANSPARENT) + || pPattern->GetItem(ATTR_BACKGROUND).GetColor() != COL_TRANSPARENT + || !pPattern->GetItem(ATTR_PROTECTION).GetProtection()) { aString += rAddressString + " "; } @@ -416,6 +424,31 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFormatsImportExport, assertTwoDataFieldColumns_WholeDataColumnSelected(*getScDoc()); } +static void assertFields_WithCellProtection(ScDocument& rDoc) +{ + CPPUNIT_ASSERT_EQUAL(false, getCellProtection(rDoc, u"F18"_ustr)); + CPPUNIT_ASSERT_EQUAL(false, getCellProtection(rDoc, u"F19"_ustr)); + CPPUNIT_ASSERT_EQUAL(false, getCellProtection(rDoc, u"F20"_ustr)); + CPPUNIT_ASSERT_EQUAL(false, getCellProtection(rDoc, u"G18"_ustr)); + CPPUNIT_ASSERT_EQUAL(false, getCellProtection(rDoc, u"G19"_ustr)); + CPPUNIT_ASSERT_EQUAL(false, getCellProtection(rDoc, u"G20"_ustr)); + + // Make sure the other cells have the font color or background set to default + std::vector aEmptyAddresses{ + u"F15"_ustr, u"G15"_ustr, u"F16"_ustr, u"G16"_ustr, + u"F17"_ustr, u"G17"_ustr, u"G21"_ustr, u"F21"_ustr, + }; + CPPUNIT_ASSERT_EQUAL(OUString(), checkNonEmptyAddresses(rDoc, aEmptyAddresses)); +} + +CPPUNIT_TEST_FIXTURE(ScPivotTableFormatsImportExport, Pivot_Table_with_Cell_Protection) +{ + createScDoc("xlsx/pivot-table/Pivot_Table_with_Cell_Protection.xlsx"); + assertFields_WithCellProtection(*getScDoc()); + saveAndReload(u"Calc Office Open XML"_ustr); + assertFields_WithCellProtection(*getScDoc()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/data/xlsx/pivot-table/Pivot_Table_with_Cell_Protection.xlsx b/sc/qa/unit/data/xlsx/pivot-table/Pivot_Table_with_Cell_Protection.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..d7966a2d9e32ab8efddb270fc3b9537310caab55 GIT binary patch literal 13797 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 ` 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 literal 0 HcmV?d00001 diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index d6397fb0af0d..388caa164806 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -433,20 +433,6 @@ void ScTable::DeleteArea( aCol[i].DeleteArea(nRow1, nRow2, nDelFlag, bBroadcast, pBroadcastSpans); } - // Do not set protected cell in a protected table - - if ( IsProtected() && (nDelFlag & InsertDeleteFlags::ATTRIB) ) - { - // Do not overwrite cell protection if we are in a Pivot table area and it's not protected - const ScDPObject* pDPObj = rDocument.GetDPAtArea(nTab, nCol1, nRow1, nCol2, nRow2); - if (!pDPObj || (pDPObj && !GetProtection()->isOptionEnabled(ScTableProtection::PIVOT_TABLES))) - { - ScPatternAttr aPattern(rDocument.getCellAttributeHelper()); - aPattern.GetItemSet().Put(ScProtectionAttr(false)); - ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern); - } - } - if( nDelFlag & InsertDeleteFlags::ATTRIB ) mpCondFormatList->DeleteArea( nCol1, nRow1, nCol2, nRow2 ); } @@ -474,29 +460,6 @@ void ScTable::DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMa if((nDelFlag & InsertDeleteFlags::ATTRIB) && rRange.aStart.Tab() == nTab) mpCondFormatList->DeleteArea( rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row() ); } - - // Do not set protected cell in a protected sheet - - if ( IsProtected() && (nDelFlag & InsertDeleteFlags::ATTRIB) ) - { - // Do not overwrite cell protection if we are in a Pivot table area and it's not protected - const ScRange& rRange = rMark.GetArea(); - const ScDPObject* pDPObj = rDocument.GetDPAtArea(nTab, - rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row()); - if (!pDPObj || (pDPObj && !GetProtection()->isOptionEnabled(ScTableProtection::PIVOT_TABLES))) - { - SfxItemSetFixed aSet(*rDocument.GetPool()); - aSet.Put(ScProtectionAttr(false)); - ScItemPoolCache aCache(rDocument.getCellAttributeHelper(), aSet); - ApplySelectionCache(aCache, rMark); - } - - SfxItemSetFixed aSet(*rDocument.GetPool()); - aSet.Put( ScProtectionAttr( false ) ); - ScItemPoolCache aCache(rDocument.getCellAttributeHelper(), aSet ); - ApplySelectionCache( aCache, rMark ); - } - // TODO: In the future we may want to check if the table has been // really modified before setting the stream invalid. SetStreamValid(false); @@ -787,20 +750,6 @@ void ScTable::CopyFromClip( pRowFlags->AndValue( j, ~CRFlags::ManualSize); } } - - // Do not set protected cell in a protected sheet - if (IsProtected() && (rCxt.getInsertFlag() & InsertDeleteFlags::ATTRIB)) - { - // Do not overwrite cell protection if we are in a Pivot table area and its not protected - const ScDPObject* pDPObj = rDocument.GetDPAtArea(nTab, nCol1, nRow1, nCol2, nRow2); - if (!pDPObj || (pDPObj && !GetProtection()->isOptionEnabled(ScTableProtection::PIVOT_TABLES))) - { - ScPatternAttr aPattern(rDocument.getCellAttributeHelper()); - aPattern.GetItemSet().Put(ScProtectionAttr(false)); - ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern); - } - } - // create deep copies for conditional formatting CopyConditionalFormat( nCol1, nRow1, nCol2, nRow2, nDx, nDy, pTable); } diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index ddccb1cd36f6..90f58aebc574 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -1241,25 +1241,28 @@ void XclExpXmlPivotTables::savePivotTableFormats(XclExpXmlStream& rStream, ScDPO pAttributeList->add(XML_fieldPosition, OString::number(*rFormat.oFieldPosition)); pPivotStream->startElement(XML_pivotArea, pAttributeList); } - pPivotStream->startElement(XML_references, XML_count, OString::number(rFormat.aSelections.size())); - for (sc::Selection const& rSelection : rFormat.getSelections()) + if (rFormat.aSelections.size()) { + pPivotStream->startElement(XML_references, XML_count, OString::number(rFormat.aSelections.size())); + for (sc::Selection const& rSelection : rFormat.getSelections()) { - auto pRefAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); - pRefAttributeList->add(XML_field, OString::number(sal_uInt32(rSelection.nField))); - pRefAttributeList->add(XML_count, "1"); - if (!rSelection.bSelected) // default is true - pRefAttributeList->add(XML_selected, "0"); - pPivotStream->startElement(XML_reference, pRefAttributeList); - } + { + auto pRefAttributeList = sax_fastparser::FastSerializerHelper::createAttrList(); + pRefAttributeList->add(XML_field, OString::number(sal_uInt32(rSelection.nField))); + pRefAttributeList->add(XML_count, "1"); + if (!rSelection.bSelected) // default is true + pRefAttributeList->add(XML_selected, "0"); + pPivotStream->startElement(XML_reference, pRefAttributeList); + } - for (sal_uInt32 nIndex : rSelection.nIndices) - { - pPivotStream->singleElement(XML_x, XML_v, OString::number(nIndex)); + for (sal_uInt32 nIndex : rSelection.nIndices) + { + pPivotStream->singleElement(XML_x, XML_v, OString::number(nIndex)); + } + pPivotStream->endElement(XML_reference); } - pPivotStream->endElement(XML_reference); + pPivotStream->endElement(XML_references); } - pPivotStream->endElement(XML_references); pPivotStream->endElement(XML_pivotArea); pPivotStream->endElement(XML_format); diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx index ec6f5800cb66..95ec8b8806ff 100644 --- a/sc/source/filter/inc/stylesbuffer.hxx +++ b/sc/source/filter/inc/stylesbuffer.hxx @@ -357,11 +357,14 @@ bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight class Protection : public WorkbookHelper { public: - explicit Protection( const WorkbookHelper& rHelper ); + explicit Protection( const WorkbookHelper& rHelper, bool bDxf ); /** Sets all attributes from the protection element. */ void importProtection( const AttributeList& rAttribs ); + /** Sets the protection attributes from the passed BIFF12 DXF record data. */ + void importDxfProtection( sal_Int32 nElement, SequenceInputStream& rStrm ); + /** Sets the protection attributes from the passed BIFF12 XF record data. */ void setBiff12Data( sal_uInt32 nFlags ); @@ -375,8 +378,11 @@ public: private: ProtectionModel maModel; /// Protection model data. ApiProtectionData maApiData; /// Protection data converted to API constants. + bool mbDxf; }; +typedef std::shared_ptr< Protection > ProtectionRef; + /** Contains XML attributes of a single border line. */ struct BorderLineModel { @@ -667,6 +673,8 @@ public: BorderRef const & createBorder( bool bAlwaysNew = true ); /** Creates a new empty fill object. */ FillRef const & createFill( bool bAlwaysNew = true ); + /** Creates a new empty protection object. */ + ProtectionRef const & createProtection( bool bAlwaysNew = true ); /** Inserts a new number format code. */ void importNumFmt( const AttributeList& rAttribs ); diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index f19425c9d9dd..ab0af4cd2149 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -183,6 +183,8 @@ const sal_uInt16 BIFF12_DXF_FONT_HEIGHT = 36; const sal_uInt16 BIFF12_DXF_FONT_SCHEME = 37; const sal_uInt16 BIFF12_DXF_NUMFMT_CODE = 38; const sal_uInt16 BIFF12_DXF_NUMFMT_ID = 41; +const sal_uInt16 BIFF12_DXF_CELL_LOCKED = 43; +const sal_uInt16 BIFF12_DXF_CELL_HIDDEN = 44; // BIFF12 CELLSTYLE flags const sal_uInt16 BIFF12_CELLSTYLE_BUILTIN = 0x0001; @@ -1368,8 +1370,9 @@ bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight (rLeft.maCellProt.IsPrintHidden == rRight.maCellProt.IsPrintHidden); } -Protection::Protection( const WorkbookHelper& rHelper ) : - WorkbookHelper( rHelper ) +Protection::Protection( const WorkbookHelper& rHelper, bool bDxf ) : + WorkbookHelper( rHelper ), + mbDxf( bDxf ) { } @@ -1379,6 +1382,23 @@ void Protection::importProtection( const AttributeList& rAttribs ) maModel.mbHidden = rAttribs.getBool( XML_hidden, false ); } +void Protection::importDxfProtection( sal_Int32 nElement, SequenceInputStream& rStrm ) +{ + SAL_WARN_IF( !mbDxf, "sc", "Protection::importDxfProtection - missing protection flag" ); + bool bFlag = rStrm.readuInt8() != 0; + switch( nElement ) + { + case XML_locked: + maModel.mbLocked = bFlag; + break; + case XML_hidden: + maModel.mbHidden = bFlag; + break; + default: + OSL_FAIL( "Protection::importDxfProtection - unexpected element identifier" ); + } +} + void Protection::setBiff12Data( sal_uInt32 nFlags ) { maModel.mbLocked = getFlag( nFlags, BIFF12_XF_LOCKED ); @@ -2005,7 +2025,7 @@ Xf::Xf( const WorkbookHelper& rHelper ) : WorkbookHelper( rHelper ), mnScNumFmt(0), maAlignment( rHelper ), - maProtection( rHelper ), + maProtection( rHelper, false ), meRotationRef( css::table::CellVertJustify2::STANDARD ), mpStyleSheet( nullptr ) { @@ -2341,6 +2361,13 @@ FillRef const & Dxf::createFill( bool bAlwaysNew ) return mxFill; } +ProtectionRef const & Dxf::createProtection( bool bAlwaysNew ) +{ + if ( bAlwaysNew || !mxProtection ) + mxProtection = std::make_shared( *this, true ); + return mxProtection; +} + void Dxf::importNumFmt( const AttributeList& rAttribs ) { // don't propagate number formats defined in Dxf entries @@ -2391,6 +2418,8 @@ void Dxf::importDxf( SequenceInputStream& rStrm ) case BIFF12_DXF_FONT_SCHEME: createFont( false )->importDxfScheme( rStrm ); break; case BIFF12_DXF_NUMFMT_CODE: aFmtCode = BiffHelper::readString( rStrm, false ); break; case BIFF12_DXF_NUMFMT_ID: nNumFmtId = rStrm.readuInt16(); break; + case BIFF12_DXF_CELL_LOCKED: createProtection( false )->importDxfProtection( XML_locked, rStrm ); break; + case BIFF12_DXF_CELL_HIDDEN: createProtection( false )->importDxfProtection( XML_hidden, rStrm ); break; } rStrm.seek( nRecEnd ); } diff --git a/sc/source/filter/oox/stylesfragment.cxx b/sc/source/filter/oox/stylesfragment.cxx index de6312b9649c..1d20b98519ff 100644 --- a/sc/source/filter/oox/stylesfragment.cxx +++ b/sc/source/filter/oox/stylesfragment.cxx @@ -151,8 +151,8 @@ ContextHandlerRef DxfContext::onCreateContext( sal_Int32 nElement, const Attribu case XLS_TOKEN( numFmt ): mxDxf->importNumFmt( rAttribs ); break; #if 0 case XLS_TOKEN( alignment ): mxDxf->importAlignment( rAttribs ); break; - case XLS_TOKEN( protection ): mxDxf->importProtection( rAttribs ); break; #endif + case XLS_TOKEN( protection ): mxDxf->createProtection()->importProtection( rAttribs ); break; } break; @@ -163,6 +163,7 @@ ContextHandlerRef DxfContext::onCreateContext( sal_Int32 nElement, const Attribu case XLS_TOKEN( border ): return new BorderContext( *this, mxDxf->createBorder() ); case XLS_TOKEN( fill ): return new FillContext( *this, mxDxf->createFill() ); case XLS_TOKEN( numFmt ): mxDxf->importNumFmt( rAttribs ); break; + case XLS_TOKEN( protection ): mxDxf->createProtection()->importProtection( rAttribs ); break; } break; } From 08c315e7b7a2198b36f956245453fad13f1ac6cc Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 21 Nov 2024 09:42:24 +0100 Subject: [PATCH 087/373] vcl: Don't use out param in addition to return value Let lcl_isValidPage simply return whether the tab item is "valid" and don't set the out param in addition, but let the callers do that, which is more straightforward. Change-Id: I35000d46899f457087c417e91ee1968aab7bd239 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176925 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/control/tabctrl.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 5e4c874d53bc..a4f968a5a5ab 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2275,11 +2275,9 @@ void NotebookbarTabControlBase::SetIconClickHdl( Link aHdl ) m_aIconClickHdl = aHdl; } -static bool lcl_isValidPage(const ImplTabItem& rItem, bool& bFound) +static bool lcl_isValidPage(const ImplTabItem& rItem) { - if (rItem.m_bVisible && rItem.m_bEnabled) - bFound = true; - return bFound; + return rItem.m_bVisible && rItem.m_bEnabled; } void NotebookbarTabControlBase::ImplActivateTabPage( bool bNext ) @@ -2291,14 +2289,20 @@ void NotebookbarTabControlBase::ImplActivateTabPage( bool bNext ) if (bNext) { for (nCurPos++; nCurPos < GetPageCount(); nCurPos++) - if (lcl_isValidPage(mpTabCtrlData->maItemList[nCurPos], bFound)) + if (lcl_isValidPage(mpTabCtrlData->maItemList[nCurPos])) + { + bFound = true; break; + } } else { for (nCurPos--; nCurPos >= 0; nCurPos--) - if (lcl_isValidPage(mpTabCtrlData->maItemList[nCurPos], bFound)) + if (lcl_isValidPage(mpTabCtrlData->maItemList[nCurPos])) + { + bFound = true; break; + } } if (!bFound) From 11e857374fb44a1a24fb07948e3ee300f09b6a11 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 21 Nov 2024 09:49:34 +0100 Subject: [PATCH 088/373] vcl: Simplify NotebookbarTabControlBase::ImplActivateTabPage a bit Only set new value for nCurPos if there's a valid new page instead of always doing it and then reverting back to the old value. Change-Id: I25f56e34da6260ee7c586fa25a88ff813f7c26f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176926 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/control/tabctrl.cxx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index a4f968a5a5ab..0cf5b5eac808 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2282,31 +2282,27 @@ static bool lcl_isValidPage(const ImplTabItem& rItem) void NotebookbarTabControlBase::ImplActivateTabPage( bool bNext ) { - const sal_uInt16 nOldPos = GetPagePos(GetCurPageId()); - bool bFound = false; - sal_Int32 nCurPos = nOldPos; + sal_Int32 nCurPos = GetPagePos(GetCurPageId()); if (bNext) { - for (nCurPos++; nCurPos < GetPageCount(); nCurPos++) - if (lcl_isValidPage(mpTabCtrlData->maItemList[nCurPos])) + for (sal_Int32 nPos = nCurPos + 1; nPos < GetPageCount(); nPos++) + if (lcl_isValidPage(mpTabCtrlData->maItemList[nPos])) { - bFound = true; + nCurPos = nPos; break; } } else { - for (nCurPos--; nCurPos >= 0; nCurPos--) - if (lcl_isValidPage(mpTabCtrlData->maItemList[nCurPos])) + for (sal_Int32 nPos = nCurPos - 1; nPos >= 0; nPos--) + if (lcl_isValidPage(mpTabCtrlData->maItemList[nPos])) { - bFound = true; + nCurPos = nPos; break; } } - if (!bFound) - nCurPos = nOldPos; SelectTabPage( TabControl::GetPageId( nCurPos ) ); } From 59cba4298dae0caf0f1ba72a830d8f4edf48756d Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 21 Nov 2024 12:16:18 +0100 Subject: [PATCH 089/373] notebookbar: Pass menu button as parent for its menu Use the Notebookbar menu button as parent for its menu. This also makes the button position be used as the reference. This allows to drop the now unused NotebookbarTabControlBase::GetHeaderHeight. Also, set the reference point to be at the bottom of the button, so the menu opens below it instead of approximately in the middle, which matches how other menu buttons behave. To test: Set "Tabbed" for the UI variant in "View" -> "User Interface", then click the "Hamburger menu" button in the notebookbar. Change-Id: I0717fad73ff7a42d2bdaaa53a73d055234003d3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176927 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- include/vcl/tabctrl.hxx | 1 - sfx2/source/notebookbar/NotebookbarTabControl.cxx | 6 ++++-- vcl/source/control/tabctrl.cxx | 5 ----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx index 9ac3b334497e..28987536ad9c 100644 --- a/include/vcl/tabctrl.hxx +++ b/include/vcl/tabctrl.hxx @@ -190,7 +190,6 @@ public: Control* GetOpenMenu(); virtual Size calculateRequisition() const override; - static sal_uInt16 GetHeaderHeight(); protected: virtual bool ImplPlaceTabs( tools::Long nWidth ) override; diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx index 6b08a6a56e33..b8a82b8bb00f 100644 --- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx +++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx @@ -349,8 +349,10 @@ IMPL_LINK(NotebookbarTabControl, OpenNotebookbarPopupMenu, NotebookBar*, pNotebo return; xPopupController->setPopupMenu(xPopupMenu); - Point aPos(pNotebookbar->GetSizePixel().getWidth(), NotebookbarTabControl::GetHeaderHeight() - ICON_SIZE + 10); - xPopupMenu->execute(pNotebookbar->GetComponentInterface(), + Control* pOpenMenuButton = GetOpenMenu(); + assert(pOpenMenuButton); + Point aPos(pOpenMenuButton->GetSizePixel().getWidth(), pOpenMenuButton->GetSizePixel().getHeight()); + xPopupMenu->execute(pOpenMenuButton->GetComponentInterface(), css::awt::Rectangle(aPos.X(), aPos.Y(), 1, 1), css::awt::PopupMenuDirection::EXECUTE_DOWN); diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 0cf5b5eac808..5aa5c831617c 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2306,11 +2306,6 @@ void NotebookbarTabControlBase::ImplActivateTabPage( bool bNext ) SelectTabPage( TabControl::GetPageId( nCurPos ) ); } -sal_uInt16 NotebookbarTabControlBase::GetHeaderHeight() -{ - return m_nHeaderHeight; -} - bool NotebookbarTabControlBase::ImplPlaceTabs( tools::Long nWidth ) { if ( nWidth <= 0 ) From d723ef639216c0e8e2b82f99bcf2eaf3d6a19c90 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 21 Nov 2024 14:04:00 +0100 Subject: [PATCH 090/373] notebookbar: Drop unnecessary static_cast Change-Id: If7aa91609409d3ad499a55348545d49d136d6606 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176928 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- sfx2/source/notebookbar/NotebookbarTabControl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx index b8a82b8bb00f..54279c69226e 100644 --- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx +++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx @@ -245,7 +245,7 @@ void NotebookbarTabControl::StateChanged(StateChangedType nStateChange) VclPtr pShortcuts = VclPtr::Create( this ); pShortcuts->Show(); - SetToolBox( static_cast( pShortcuts.get() ) ); + SetToolBox(pShortcuts.get()); SetIconClickHdl( LINK( this, NotebookbarTabControl, OpenNotebookbarPopupMenu ) ); m_pListener = new ChangedUIEventListener( this ); From de426177dcf08925b0a12b437ceb4d0a1eae006e Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 21 Nov 2024 14:36:47 +0100 Subject: [PATCH 091/373] notebookbar: Drop PriorityHBox::GetHiddenCount The method is only used in the PriorityMergedHBox subclass, which overrides the method anyway, so drop the base class implementation. Change-Id: If2c11377b1ca0ac0f3c6cd4fec9890cdcbbce0ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176929 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/inc/PriorityHBox.hxx | 2 -- vcl/inc/PriorityMergedHBox.hxx | 2 +- vcl/source/control/PriorityHBox.cxx | 11 ----------- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/vcl/inc/PriorityHBox.hxx b/vcl/inc/PriorityHBox.hxx index 8c5529ec8860..ee47b97e350a 100644 --- a/vcl/inc/PriorityHBox.hxx +++ b/vcl/inc/PriorityHBox.hxx @@ -37,8 +37,6 @@ protected: std::vector m_aSortedChildren; - virtual int GetHiddenCount() const; - virtual void GetChildrenWithPriorities(); public: diff --git a/vcl/inc/PriorityMergedHBox.hxx b/vcl/inc/PriorityMergedHBox.hxx index ed2f105f20f4..c464f0dbdc85 100644 --- a/vcl/inc/PriorityMergedHBox.hxx +++ b/vcl/inc/PriorityMergedHBox.hxx @@ -38,7 +38,7 @@ public: virtual void dispose() override; - int GetHiddenCount() const override; + int GetHiddenCount() const; Size calculateRequisition() const override; diff --git a/vcl/source/control/PriorityHBox.cxx b/vcl/source/control/PriorityHBox.cxx index c893cc8332eb..5b4b19660c4c 100644 --- a/vcl/source/control/PriorityHBox.cxx +++ b/vcl/source/control/PriorityHBox.cxx @@ -45,17 +45,6 @@ void PriorityHBox::Initialize() SetSizeFromParent(); } -int PriorityHBox::GetHiddenCount() const -{ - int nCount = 0; - - for (auto pWindow : m_aSortedChildren) - if (pWindow->IsHidden()) - nCount++; - - return nCount; -} - void PriorityHBox::SetSizeFromParent() { vcl::Window* pParent = GetParent(); From d3613d15e518c0c8cc4930c4bdf37219813fd665 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 21 Nov 2024 14:52:08 +0100 Subject: [PATCH 092/373] notebookbar: Simplify logic to detect whether hidden children The actual number of hidden children is not of interest here, only whether there is at least one, so stop iterating once the first hidden child is encountered. Change-Id: Ice1a7461d2bfd9d576109771cf93deb6a17ef975 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176930 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/PriorityMergedHBox.hxx | 2 +- vcl/source/control/PriorityMergedHBox.cxx | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/vcl/inc/PriorityMergedHBox.hxx b/vcl/inc/PriorityMergedHBox.hxx index c464f0dbdc85..087f09a75928 100644 --- a/vcl/inc/PriorityMergedHBox.hxx +++ b/vcl/inc/PriorityMergedHBox.hxx @@ -38,7 +38,7 @@ public: virtual void dispose() override; - int GetHiddenCount() const; + bool HasHiddenChildren() const; Size calculateRequisition() const override; diff --git a/vcl/source/control/PriorityMergedHBox.cxx b/vcl/source/control/PriorityMergedHBox.cxx index fd5aa5814dac..64fad5acb488 100644 --- a/vcl/source/control/PriorityMergedHBox.cxx +++ b/vcl/source/control/PriorityMergedHBox.cxx @@ -106,7 +106,7 @@ void PriorityMergedHBox::Resize() VclHBox::Resize(); - if (GetHiddenCount()) + if (HasHiddenChildren()) m_pButton->Show(); else m_pButton->Hide(); @@ -120,18 +120,16 @@ void PriorityMergedHBox::dispose() PriorityHBox::dispose(); } -int PriorityMergedHBox::GetHiddenCount() const +bool PriorityMergedHBox::HasHiddenChildren() const { - int nCount = 0; - for (int i = GetChildCount() - 1; i >= 0; i--) { vcl::Window* pWindow = GetChild(i); if (pWindow && pWindow->GetParent() == this && !pWindow->IsVisible()) - nCount++; + return true; } - return nCount; + return false; } Size PriorityMergedHBox::calculateRequisition() const From 0d3748e5fbfb2ac8dd60d491d566075938927237 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Thu, 21 Nov 2024 15:08:45 -0500 Subject: [PATCH 093/373] tdf#163598 editeng: avoid using fake outline depth Most implementations do not actually do anything meaningful with Get/SetDepth, so don't exception or accept their values. To fix the bug, I could have just checked for dynamic_cast (since it supports EE_PARA_OUTLLEVEL directly) but this way seemed more encompassing. The potential downside is that EE_PARA_OUTLLEVEL will be requested as a real property after GetPropertyValueHelper with some of these dummy providers, and who knows what UNO might do about that... IF this patch causes problems, then I need to implement Get/SetDepth in SvxEditEngineForwarder (or consider the dummy providers as SupportsOutlineDepth). Change-Id: I74bf5e39a13bb1d588c39634347eb0982bda66b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176981 Tested-by: Jenkins Reviewed-by: Justin Luth --- editeng/source/uno/unoedprx.cxx | 7 +++++++ editeng/source/uno/unofored.cxx | 6 ++++++ editeng/source/uno/unoforou.cxx | 5 +++++ editeng/source/uno/unotext.cxx | 11 +++++++++++ include/editeng/unoedprx.hxx | 1 + include/editeng/unoedsrc.hxx | 3 +++ include/editeng/unofored.hxx | 1 + include/editeng/unoforou.hxx | 1 + include/editeng/unotext.hxx | 1 + .../accessibility/AccessibleEmptyEditSource.cxx | 1 + svx/source/dialog/weldeditview.cxx | 1 + 11 files changed, 38 insertions(+) diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 15342e874753..8a0c6bd07445 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -1019,6 +1019,13 @@ bool SvxAccessibleTextAdapter::QuickFormatDoc( bool bFull ) return mpTextForwarder->QuickFormatDoc( bFull ); } +bool SvxAccessibleTextAdapter::SupportsOutlineDepth() const +{ + assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder"); + + return mpTextForwarder->SupportsOutlineDepth(); +} + sal_Int16 SvxAccessibleTextAdapter::GetDepth( sal_Int32 nPara ) const { assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder"); diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index c24f9ff965b1..0c4acc7c4541 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -465,6 +465,12 @@ bool SvxEditEngineForwarder::InsertText( const OUString& rStr, const ESelection& return true; } +bool SvxEditEngineForwarder::SupportsOutlineDepth() const +{ + // EditEngine does not support outline depth indirectly - directly supports EE_PARA_OUTLLEVEL + return false; +} + sal_Int16 SvxEditEngineForwarder::GetDepth( sal_Int32 ) const { // EditEngine does not support outline depth diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index a04885190050..43aaabffc536 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -431,6 +431,11 @@ bool SvxOutlinerForwarder::InsertText( const OUString& rStr, const ESelection& r return true; } +bool SvxOutlinerForwarder::SupportsOutlineDepth() const +{ + return true; +} + sal_Int16 SvxOutlinerForwarder::GetDepth( sal_Int32 nPara ) const { DBG_ASSERT( 0 <= nPara && nPara < GetParagraphCount(), "SvxOutlinerForwarder::GetDepth: Invalid paragraph index"); diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 64c00e802888..8bc101e5c2ed 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -535,6 +535,9 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry* SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr; if(pForwarder && pSelection) { + if (!pForwarder->SupportsOutlineDepth()) + return false; + sal_Int16 nLevel = sal_Int16(); if( aValue >>= nLevel ) { @@ -721,6 +724,9 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr; if(pForwarder && pSelection) { + if (!pForwarder->SupportsOutlineDepth()) + return false; + sal_Int16 nLevel = pForwarder->GetDepth( pSelection->nStartPara ); if( nLevel >= 0 ) aAny <<= nLevel; @@ -2516,6 +2522,11 @@ bool SvxDummyTextSource::QuickFormatDoc( bool ) return false; } +bool SvxDummyTextSource::SupportsOutlineDepth() const +{ + return false; +} + sal_Int16 SvxDummyTextSource::GetDepth( sal_Int32 ) const { return -1; diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx index b3cf3f89309c..783bd965ec8f 100644 --- a/include/editeng/unoedprx.hxx +++ b/include/editeng/unoedprx.hxx @@ -82,6 +82,7 @@ public: virtual bool Delete( const ESelection& ) override; virtual bool InsertText( const OUString&, const ESelection& ) override; virtual bool QuickFormatDoc( bool bFull = false ) override; + virtual bool SupportsOutlineDepth() const override; virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override; virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override; diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx index 45824a4e390e..c7fd58aa90af 100644 --- a/include/editeng/unoedsrc.hxx +++ b/include/editeng/unoedsrc.hxx @@ -400,6 +400,9 @@ public: */ virtual bool QuickFormatDoc( bool bFull = false ) = 0; + // Is able to use Outline depth functions (GetDepth and SetDepth) meaningfully + virtual bool SupportsOutlineDepth() const = 0; + /** Get the outline depth of given paragraph @param nPara diff --git a/include/editeng/unofored.hxx b/include/editeng/unofored.hxx index ca64ca8c891a..fdb61341378b 100644 --- a/include/editeng/unofored.hxx +++ b/include/editeng/unofored.hxx @@ -78,6 +78,7 @@ public: virtual bool Delete( const ESelection& ) override; virtual bool InsertText( const OUString&, const ESelection& ) override; virtual bool QuickFormatDoc( bool bFull = false ) override; + virtual bool SupportsOutlineDepth() const override; virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override; virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override; diff --git a/include/editeng/unoforou.hxx b/include/editeng/unoforou.hxx index 1909eb3f2f85..bcd1f39ab66a 100644 --- a/include/editeng/unoforou.hxx +++ b/include/editeng/unoforou.hxx @@ -98,6 +98,7 @@ public: virtual bool Delete( const ESelection& ) override final; virtual bool InsertText( const OUString&, const ESelection& ) override final; virtual bool QuickFormatDoc( bool bFull = false ) override final; + virtual bool SupportsOutlineDepth() const override final; virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override final; virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override final; virtual sal_Int32 GetNumberingStartValue( sal_Int32 nPara ) override final; diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index b5cecccbf625..4011fac9d479 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -226,6 +226,7 @@ public: virtual bool Delete( const ESelection& ) override; virtual bool InsertText( const OUString&, const ESelection& ) override; virtual bool QuickFormatDoc( bool bFull = false ) override; + virtual bool SupportsOutlineDepth() const override; virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override; virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override; diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index 619c3443a42a..a0601c234946 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -158,6 +158,7 @@ namespace accessibility bool Delete( const ESelection& ) override { return false; } bool InsertText( const OUString&, const ESelection& ) override { return false; } bool QuickFormatDoc( bool ) override { return true; } + bool SupportsOutlineDepth() const override { return false; } sal_Int16 GetDepth( sal_Int32 ) const override { return -1; } bool SetDepth( sal_Int32, sal_Int16 ) override { return true; } diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx index 2f1ff16a862d..7728379e47d9 100644 --- a/svx/source/dialog/weldeditview.cxx +++ b/svx/source/dialog/weldeditview.cxx @@ -412,6 +412,7 @@ public: virtual bool InsertText(const OUString&, const ESelection&) override; virtual bool QuickFormatDoc(bool bFull = false) override; + virtual bool SupportsOutlineDepth() const override { return false; }; virtual sal_Int16 GetDepth(sal_Int32 nPara) const override; virtual bool SetDepth(sal_Int32 nPara, sal_Int16 nNewDepth) override; From b61ae38fe4794e0e0ae8fd067b19d1f33dc75fda Mon Sep 17 00:00:00 2001 From: zdavis Date: Fri, 15 Nov 2024 06:07:30 +0000 Subject: [PATCH 094/373] tdf#143148 Use pragma once instead of include guards Change-Id: Ic6796c91318bc838804ec30790f52480734e9b7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176615 Reviewed-by: Ilmari Lauhakangas Tested-by: Jenkins --- include/codemaker/codemaker.hxx | 5 +---- include/codemaker/commonjava.hxx | 5 +---- include/codemaker/exceptiontree.hxx | 5 +---- include/codemaker/generatedtypeset.hxx | 5 +---- include/codemaker/options.hxx | 5 +---- include/codemaker/typemanager.hxx | 5 +---- include/codemaker/unotype.hxx | 5 +---- include/cppcanvas/basegfxfactory.hxx | 5 +---- include/cppcanvas/bitmap.hxx | 5 +---- include/cppcanvas/bitmapcanvas.hxx | 5 +---- include/cppcanvas/canvas.hxx | 5 +---- include/cppcanvas/canvasgraphic.hxx | 5 +---- include/cppcanvas/color.hxx | 5 +---- include/cppcanvas/customsprite.hxx | 5 +---- include/cppcanvas/polypolygon.hxx | 5 +---- include/cppcanvas/renderer.hxx | 5 +---- include/cppcanvas/sprite.hxx | 5 +---- include/cppcanvas/spritecanvas.hxx | 5 +---- include/cppcanvas/vclfactory.hxx | 5 +---- 19 files changed, 19 insertions(+), 76 deletions(-) diff --git a/include/codemaker/codemaker.hxx b/include/codemaker/codemaker.hxx index cf22b8a1f47f..163840e06f60 100644 --- a/include/codemaker/codemaker.hxx +++ b/include/codemaker/codemaker.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CODEMAKER_CODEMAKER_HXX -#define INCLUDED_CODEMAKER_CODEMAKER_HXX +#pragma once #include @@ -33,6 +32,4 @@ namespace codemaker rtl::OString convertString(rtl::OUString const& string); } -#endif // INCLUDED_CODEMAKER_CODEMAKER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/codemaker/commonjava.hxx b/include/codemaker/commonjava.hxx index daac32263cea..12a58e6da8b5 100644 --- a/include/codemaker/commonjava.hxx +++ b/include/codemaker/commonjava.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CODEMAKER_COMMONJAVA_HXX -#define INCLUDED_CODEMAKER_COMMONJAVA_HXX +#pragma once #include @@ -39,6 +38,4 @@ rtl::OString translateUnoToJavaIdentifier( } -#endif // INCLUDED_CODEMAKER_COMMONJAVA_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/codemaker/exceptiontree.hxx b/include/codemaker/exceptiontree.hxx index 46291e491746..13764714222f 100644 --- a/include/codemaker/exceptiontree.hxx +++ b/include/codemaker/exceptiontree.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX -#define INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX +#pragma once #include #include @@ -114,6 +113,4 @@ private: } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/codemaker/generatedtypeset.hxx b/include/codemaker/generatedtypeset.hxx index cc2827cb9aa7..9f64b6080855 100644 --- a/include/codemaker/generatedtypeset.hxx +++ b/include/codemaker/generatedtypeset.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX -#define INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX +#pragma once #include @@ -65,6 +64,4 @@ private: }; } -#endif // INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/codemaker/options.hxx b/include/codemaker/options.hxx index 803274901a4a..6107419636fe 100644 --- a/include/codemaker/options.hxx +++ b/include/codemaker/options.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CODEMAKER_OPTIONS_HXX -#define INCLUDED_CODEMAKER_OPTIONS_HXX +#pragma once #include #include @@ -67,6 +66,4 @@ protected: OptionMap m_options; }; -#endif // INCLUDED_CODEMAKER_OPTIONS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/codemaker/typemanager.hxx b/include/codemaker/typemanager.hxx index 7e312f3f8094..302e79e351d1 100644 --- a/include/codemaker/typemanager.hxx +++ b/include/codemaker/typemanager.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CODEMAKER_TYPEMANAGER_HXX -#define INCLUDED_CODEMAKER_TYPEMANAGER_HXX +#pragma once #include @@ -77,6 +76,4 @@ inline OUString b2u(std::string_view s) { return OStringToOUString(s, RTL_TEXTENCODING_UTF8); } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/codemaker/unotype.hxx b/include/codemaker/unotype.hxx index 606321873242..f7651cd95916 100644 --- a/include/codemaker/unotype.hxx +++ b/include/codemaker/unotype.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CODEMAKER_UNOTYPE_HXX -#define INCLUDED_CODEMAKER_UNOTYPE_HXX +#pragma once #include @@ -83,6 +82,4 @@ namespace codemaker::UnoType { } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/basegfxfactory.hxx b/include/cppcanvas/basegfxfactory.hxx index 611523066792..0bd75e4ed66d 100644 --- a/include/cppcanvas/basegfxfactory.hxx +++ b/include/cppcanvas/basegfxfactory.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_BASEGFXFACTORY_HXX -#define INCLUDED_CPPCANVAS_BASEGFXFACTORY_HXX +#pragma once #include #include @@ -71,6 +70,4 @@ namespace cppcanvas } -#endif // INCLUDED_CPPCANVAS_BASEGFXFACTORY_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/bitmap.hxx b/include/cppcanvas/bitmap.hxx index 1b163b82d479..d5b34d9285ed 100644 --- a/include/cppcanvas/bitmap.hxx +++ b/include/cppcanvas/bitmap.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_BITMAP_HXX -#define INCLUDED_CPPCANVAS_BITMAP_HXX +#pragma once #include #include @@ -65,6 +64,4 @@ namespace cppcanvas typedef std::shared_ptr< ::cppcanvas::Bitmap > BitmapSharedPtr; } -#endif // INCLUDED_CPPCANVAS_BITMAP_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/bitmapcanvas.hxx b/include/cppcanvas/bitmapcanvas.hxx index 9c3e7f843934..052092912ed1 100644 --- a/include/cppcanvas/bitmapcanvas.hxx +++ b/include/cppcanvas/bitmapcanvas.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_BITMAPCANVAS_HXX -#define INCLUDED_CPPCANVAS_BITMAPCANVAS_HXX +#pragma once #include #include @@ -44,6 +43,4 @@ namespace cppcanvas } -#endif // INCLUDED_CPPCANVAS_BITMAPCANVAS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/canvas.hxx b/include/cppcanvas/canvas.hxx index 2fce102824dd..c7fea3c63342 100644 --- a/include/cppcanvas/canvas.hxx +++ b/include/cppcanvas/canvas.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_CANVAS_HXX -#define INCLUDED_CPPCANVAS_CANVAS_HXX +#pragma once #include #include @@ -96,6 +95,4 @@ namespace cppcanvas } -#endif // INCLUDED_CPPCANVAS_CANVAS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/canvasgraphic.hxx b/include/cppcanvas/canvasgraphic.hxx index ebee831f0a3b..0a9c78ef2bef 100644 --- a/include/cppcanvas/canvasgraphic.hxx +++ b/include/cppcanvas/canvasgraphic.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_CANVASGRAPHIC_HXX -#define INCLUDED_CPPCANVAS_CANVASGRAPHIC_HXX +#pragma once #include #include @@ -75,6 +74,4 @@ namespace cppcanvas }; } -#endif // INCLUDED_CPPCANVAS_CANVASGRAPHIC_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/color.hxx b/include/cppcanvas/color.hxx index 500e5953e7cc..3682832c3dd1 100644 --- a/include/cppcanvas/color.hxx +++ b/include/cppcanvas/color.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_COLOR_HXX -#define INCLUDED_CPPCANVAS_COLOR_HXX +#pragma once #include @@ -65,6 +64,4 @@ namespace cppcanvas } -#endif // INCLUDED_CPPCANVAS_COLOR_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/customsprite.hxx b/include/cppcanvas/customsprite.hxx index abbd0c00bb05..52382c42b16d 100644 --- a/include/cppcanvas/customsprite.hxx +++ b/include/cppcanvas/customsprite.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_CUSTOMSPRITE_HXX -#define INCLUDED_CPPCANVAS_CUSTOMSPRITE_HXX +#pragma once #include #include @@ -39,6 +38,4 @@ namespace cppcanvas typedef std::shared_ptr< ::cppcanvas::CustomSprite > CustomSpriteSharedPtr; } -#endif // INCLUDED_CPPCANVAS_CUSTOMSPRITE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/polypolygon.hxx b/include/cppcanvas/polypolygon.hxx index 917ef4dafb04..04e3a61d3411 100644 --- a/include/cppcanvas/polypolygon.hxx +++ b/include/cppcanvas/polypolygon.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_POLYPOLYGON_HXX -#define INCLUDED_CPPCANVAS_POLYPOLYGON_HXX +#pragma once #include #include @@ -71,6 +70,4 @@ namespace cppcanvas typedef std::shared_ptr< ::cppcanvas::PolyPolygon > PolyPolygonSharedPtr; } -#endif // INCLUDED_CPPCANVAS_POLYPOLYGON_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/renderer.hxx b/include/cppcanvas/renderer.hxx index d71be2f09e89..036d974f4830 100644 --- a/include/cppcanvas/renderer.hxx +++ b/include/cppcanvas/renderer.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_RENDERER_HXX -#define INCLUDED_CPPCANVAS_RENDERER_HXX +#pragma once #include #include @@ -135,6 +134,4 @@ namespace cppcanvas typedef std::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr; } -#endif // INCLUDED_CPPCANVAS_RENDERER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/sprite.hxx b/include/cppcanvas/sprite.hxx index 3321eb6a03a3..3c1b82d38a74 100644 --- a/include/cppcanvas/sprite.hxx +++ b/include/cppcanvas/sprite.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_SPRITE_HXX -#define INCLUDED_CPPCANVAS_SPRITE_HXX +#pragma once namespace basegfx { @@ -91,6 +90,4 @@ namespace cppcanvas }; } -#endif // INCLUDED_CPPCANVAS_SPRITE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/spritecanvas.hxx b/include/cppcanvas/spritecanvas.hxx index c4d100dbedb9..bb7d3d2f70aa 100644 --- a/include/cppcanvas/spritecanvas.hxx +++ b/include/cppcanvas/spritecanvas.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_SPRITECANVAS_HXX -#define INCLUDED_CPPCANVAS_SPRITECANVAS_HXX +#pragma once #include #include @@ -58,6 +57,4 @@ namespace cppcanvas } -#endif // INCLUDED_CPPCANVAS_SPRITECANVAS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppcanvas/vclfactory.hxx b/include/cppcanvas/vclfactory.hxx index 73867626d3c0..3d6ab24482ee 100644 --- a/include/cppcanvas/vclfactory.hxx +++ b/include/cppcanvas/vclfactory.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CPPCANVAS_VCLFACTORY_HXX -#define INCLUDED_CPPCANVAS_VCLFACTORY_HXX +#pragma once #include #include @@ -82,6 +81,4 @@ namespace cppcanvas } -#endif // INCLUDED_CPPCANVAS_VCLFACTORY_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 68de311b3bafca98e6def64cf3dccf45acd2ba6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Tue, 5 Nov 2024 16:48:26 +0100 Subject: [PATCH 095/373] pdf: wrap more encryption specific code into PDFEncryptor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To make the code contained, so it is easier to add the new encryption method later. Change-Id: Ie3e3194c2148f6c3cb8ac58709fcd5f74e84a93a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176886 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- include/vcl/pdfwriter.hxx | 91 +++++----- vcl/inc/pdf/PDFEncryptor.hxx | 85 ++++----- vcl/inc/pdf/pdfwriter_impl.hxx | 9 +- vcl/source/gdi/pdfwriter.cxx | 6 +- vcl/source/gdi/pdfwriter_impl.cxx | 138 +++++++++++---- vcl/source/gdi/pdfwriter_impl2.cxx | 61 +------ vcl/source/pdf/PDFEncryptor.cxx | 265 +++++++++++++++-------------- 7 files changed, 329 insertions(+), 326 deletions(-) diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 981d89c4831e..a863b17c1879 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -73,6 +73,50 @@ class VCL_DLLPUBLIC PDFOutputStream virtual void write( const css::uno::Reference< css::io::XOutputStream >& xStream ) = 0; }; +/* The following structure describes the permissions used in PDF security */ +struct PDFEncryptionProperties +{ + //for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20. + bool CanPrintTheDocument; + bool CanModifyTheContent; + bool CanCopyOrExtract; + bool CanAddOrModify; + //for revision 3 (bit 128 security) only + bool CanFillInteractive; + bool CanExtractForAccessibility; + bool CanAssemble; + bool CanPrintFull; + + // encryption will only happen if EncryptionKey is not empty + // EncryptionKey is actually a construct out of OValue, UValue and DocumentIdentifier + // if these do not match, behavior is undefined, most likely an invalid PDF will be produced + // OValue, UValue, EncryptionKey and DocumentIdentifier can be computed from + // PDFDocInfo, Owner password and User password used the InitEncryption method which + // implements the algorithms described in the PDF reference chapter 3.5: Encryption + std::vector OValue; + std::vector UValue; + std::vector EncryptionKey; + std::vector DocumentIdentifier; + + //permission default set for 128 bit, accessibility only + PDFEncryptionProperties() : + CanPrintTheDocument ( false ), + CanModifyTheContent ( false ), + CanCopyOrExtract ( false ), + CanAddOrModify ( false ), + CanFillInteractive ( false ), + CanExtractForAccessibility ( true ), + CanAssemble ( false ), + CanPrintFull ( false ) + {} + + + bool Encrypt() const + { + return ! OValue.empty() && ! UValue.empty() && ! DocumentIdentifier.empty(); + } +}; + class PDFWriter { ScopedVclPtr xImplementation; @@ -523,51 +567,6 @@ public: LaunchAction }; -/* -The following structure describes the permissions used in PDF security - */ - struct PDFEncryptionProperties - { - - //for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20. - bool CanPrintTheDocument; - bool CanModifyTheContent; - bool CanCopyOrExtract; - bool CanAddOrModify; - //for revision 3 (bit 128 security) only - bool CanFillInteractive; - bool CanExtractForAccessibility; - bool CanAssemble; - bool CanPrintFull; - - // encryption will only happen if EncryptionKey is not empty - // EncryptionKey is actually a construct out of OValue, UValue and DocumentIdentifier - // if these do not match, behavior is undefined, most likely an invalid PDF will be produced - // OValue, UValue, EncryptionKey and DocumentIdentifier can be computed from - // PDFDocInfo, Owner password and User password used the InitEncryption method which - // implements the algorithms described in the PDF reference chapter 3.5: Encryption - std::vector OValue; - std::vector UValue; - std::vector EncryptionKey; - std::vector DocumentIdentifier; - - //permission default set for 128 bit, accessibility only - PDFEncryptionProperties() : - CanPrintTheDocument ( false ), - CanModifyTheContent ( false ), - CanCopyOrExtract ( false ), - CanAddOrModify ( false ), - CanFillInteractive ( false ), - CanExtractForAccessibility ( true ), - CanAssemble ( false ), - CanPrintFull ( false ) - {} - - - bool Encrypt() const - { return ! OValue.empty() && ! UValue.empty() && ! DocumentIdentifier.empty(); } - }; - struct PDFDocInfo { OUString Title; // document title @@ -649,7 +648,7 @@ The following structure describes the permissions used in PDF security sal_Int32 InitialPage; sal_Int32 OpenBookmarkLevels; // -1 means all levels - PDFWriter::PDFEncryptionProperties Encryption; + PDFEncryptionProperties Encryption; PDFWriter::PDFDocInfo DocumentInfo; bool SignPDF; diff --git a/vcl/inc/pdf/PDFEncryptor.hxx b/vcl/inc/pdf/PDFEncryptor.hxx index e1602f11723f..dca2255139e8 100644 --- a/vcl/inc/pdf/PDFEncryptor.hxx +++ b/vcl/inc/pdf/PDFEncryptor.hxx @@ -10,75 +10,54 @@ #pragma once -#include #include -#include +#include +#include + +namespace vcl +{ +struct PDFEncryptionProperties; +} +namespace com::sun::star::beans +{ +class XMaterialHolder; +} namespace vcl::pdf { class EncryptionHashTransporter; -constexpr sal_Int32 ENCRYPTED_PWD_SIZE = 32; - -// the maximum password length -constexpr sal_Int32 MD5_DIGEST_SIZE = 16; - -// security 128 bit -constexpr sal_Int32 SECUR_128BIT_KEY = 16; - -// maximum length of MD5 digest input, in step 2 of algorithm 3.1 -// PDF spec ver. 1.4: see there for details -constexpr sal_Int32 MAXIMUM_RC4_KEY_LENGTH = SECUR_128BIT_KEY + 3 + 2; - -void padPassword(std::u16string_view i_rPassword, sal_uInt8* o_pPaddedPW); - -/* algorithm 3.2: compute an encryption key */ -bool computeEncryptionKey(vcl::pdf::EncryptionHashTransporter*, - vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, - sal_Int32 i_nAccessPermissions); - -/* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */ -bool computeODictionaryValue(const sal_uInt8* i_pPaddedOwnerPassword, - const sal_uInt8* i_pPaddedUserPassword, - std::vector& io_rOValue, sal_Int32 i_nKeyLength); - -/* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */ -bool computeUDictionaryValue(vcl::pdf::EncryptionHashTransporter* i_pTransporter, - vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, - sal_Int32 i_nKeyLength, sal_Int32 i_nAccessPermissions); - -void computeDocumentIdentifier(std::vector& o_rIdentifier, - const vcl::PDFWriter::PDFDocInfo& i_rDocInfo, - const OString& i_rCString1, - const css::util::DateTime& rCreationMetaDate, OString& o_rCString2); - -sal_Int32 computeAccessPermissions(const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, - sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength); - class PDFEncryptor { +private: + /* the numerical value of the access permissions, according to PDF spec, must be signed */ + sal_Int32 m_nAccessPermissions = 0; + + /* The encryption key, formed with the user password according to algorithm 3.2, + * maximum length is 16 bytes + 3 + 2 for 128 bit security */ + + sal_Int32 m_nKeyLength = 0; // key length, 16 or 5 + sal_Int32 m_nRC4KeyLength = 0; // key length, 16 or 10, to be input to the algorithm 3.1 public: + PDFEncryptor(); + ~PDFEncryptor(); + /* used to cipher the stream data and for password management */ rtlCipher m_aCipher = nullptr; - /* pad string used for password in Standard security handler */ - static const sal_uInt8 s_nPadString[ENCRYPTED_PWD_SIZE]; - /* set to true if the following stream must be encrypted, used inside writeBuffer() */ bool m_bEncryptThisStream = false; - /* The encryption key, formed with the user password according to algorithm 3.2, - * maximum length is 16 bytes + 3 + 2 for 128 bit security */ - sal_Int32 m_nKeyLength = 0; // key length, 16 or 5 - sal_Int32 m_nRC4KeyLength = 0; // key length, 16 or 10, to be input to the algorithm 3.1 + sal_Int32 getAccessPermissions() { return m_nAccessPermissions; } + sal_Int32 getKeyLength() { return m_nKeyLength; } + sal_Int32 getRC4KeyLength() { return m_nRC4KeyLength; } - PDFEncryptor() - { - /* prepare the cypher engine */ - m_aCipher = rtl_cipher_createARCFOUR(rtl_Cipher_ModeStream); - } - - ~PDFEncryptor() { rtl_cipher_destroyARCFOUR(m_aCipher); } + static css::uno::Reference + initEncryption(const OUString& i_rOwnerPassword, const OUString& i_rUserPassword); + virtual bool prepareEncryption( + const css::uno::Reference& xEncryptionMaterialHolder, + PDFEncryptionProperties& rProperties); + void setupKeysAndCheck(PDFEncryptionProperties& rProperties); }; } diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index 2a1fb1febcae..82a04137942f 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -843,8 +843,6 @@ private: return nPosition; } - /* the numerical value of the access permissions, according to PDF spec, must be signed */ - sal_Int32 m_nAccessPermissions; /* string to hold the PDF creation date */ OString m_aCreationDateString; /* string to hold the PDF creation date, for PDF/A metadata */ @@ -857,7 +855,7 @@ private: /* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */ void checkAndEnableStreamEncryption( sal_Int32 nObject ) override; - void disableStreamEncryption() override { m_aPDFEncryptor.m_bEncryptThisStream = false; }; + void disableStreamEncryption() override { m_aPDFEncryptor.m_bEncryptThisStream = false; } /* */ void enableStringEncryption( sal_Int32 nObject ); @@ -1088,7 +1086,6 @@ private: pad a password according algorithm 3.2, step 1 */ void setupDocInfo(); - bool prepareEncryption( const css::uno::Reference< css::beans::XMaterialHolder >& ); // helper for playMetafile void implWriteGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, @@ -1109,10 +1106,6 @@ public: ~PDFWriterImpl() override; void dispose() override; - static css::uno::Reference< css::beans::XMaterialHolder > - initEncryption( const OUString& i_rOwnerPassword, - const OUString& i_rUserPassword ); - /* document structure */ void newPage( double nPageWidth , double nPageHeight, PDFWriter::Orientation eOrientation ); bool emit(); diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 999e8a7b708e..ee762e2fca47 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -469,11 +469,9 @@ std::set< PDFWriter::ErrorCode > const & PDFWriter::GetErrors() const } css::uno::Reference< css::beans::XMaterialHolder > -PDFWriter::InitEncryption( const OUString& i_rOwnerPassword, - const OUString& i_rUserPassword - ) +PDFWriter::InitEncryption(const OUString& i_rOwnerPassword, const OUString& i_rUserPassword) { - return PDFWriterImpl::initEncryption( i_rOwnerPassword, i_rUserPassword ); + return PDFEncryptor::initEncryption(i_rOwnerPassword, i_rUserPassword); } void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::PlayMetafileContext& i_rPlayContext, PDFExtOutDevData* i_pData ) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 9ce671e05f47..f86962425fb6 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -277,15 +277,6 @@ void appendDestinationName( const OUString& rString, OStringBuffer& rBuffer ) } } // end anonymous namespace -namespace vcl::pdf -{ -const sal_uInt8 PDFEncryptor::s_nPadString[32] = -{ - 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, - 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A -}; -} - namespace vcl { @@ -726,7 +717,106 @@ const char* getPDFVersionStr(PDFWriter::PDFVersion ePDFVersion) } } -} // end namespace +void computeDocumentIdentifier(std::vector& o_rIdentifier, + const vcl::PDFWriter::PDFDocInfo& i_rDocInfo, + const OString& i_rCString1, + const css::util::DateTime& rCreationMetaDate, OString& o_rCString2) +{ + o_rIdentifier.clear(); + + //build the document id + OString aInfoValuesOut; + OStringBuffer aID(1024); + if (!i_rDocInfo.Title.isEmpty()) + PDFWriter::AppendUnicodeTextString(i_rDocInfo.Title, aID); + if (!i_rDocInfo.Author.isEmpty()) + PDFWriter::AppendUnicodeTextString(i_rDocInfo.Author, aID); + if (!i_rDocInfo.Subject.isEmpty()) + PDFWriter::AppendUnicodeTextString(i_rDocInfo.Subject, aID); + if (!i_rDocInfo.Keywords.isEmpty()) + PDFWriter::AppendUnicodeTextString(i_rDocInfo.Keywords, aID); + if (!i_rDocInfo.Creator.isEmpty()) + PDFWriter::AppendUnicodeTextString(i_rDocInfo.Creator, aID); + if (!i_rDocInfo.Producer.isEmpty()) + PDFWriter::AppendUnicodeTextString(i_rDocInfo.Producer, aID); + + TimeValue aTVal, aGMT; + oslDateTime aDT; + aDT.NanoSeconds = rCreationMetaDate.NanoSeconds; + aDT.Seconds = rCreationMetaDate.Seconds; + aDT.Minutes = rCreationMetaDate.Minutes; + aDT.Hours = rCreationMetaDate.Hours; + aDT.Day = rCreationMetaDate.Day; + aDT.Month = rCreationMetaDate.Month; + aDT.Year = rCreationMetaDate.Year; + + osl_getSystemTime(&aGMT); + osl_getLocalTimeFromSystemTime(&aGMT, &aTVal); + OStringBuffer aCreationMetaDateString(64); + + // i59651: we fill the Metadata date string as well, if PDF/A is requested + // according to ISO 19005-1:2005 6.7.3 the date is corrected for + // local time zone offset UTC only, whereas Acrobat 8 seems + // to use the localtime notation only + // according to a recommendation in XMP Specification (Jan 2004, page 75) + // the Acrobat way seems the right approach + aCreationMetaDateString.append(char('0' + ((aDT.Year / 1000) % 10))); + aCreationMetaDateString.append(char('0' + ((aDT.Year / 100) % 10))); + aCreationMetaDateString.append(char('0' + ((aDT.Year / 10) % 10))); + aCreationMetaDateString.append(char('0' + ((aDT.Year) % 10))); + aCreationMetaDateString.append("-"); + aCreationMetaDateString.append(char('0' + ((aDT.Month / 10) % 10))); + aCreationMetaDateString.append(char('0' + ((aDT.Month) % 10))); + aCreationMetaDateString.append("-"); + aCreationMetaDateString.append(char('0' + ((aDT.Day / 10) % 10))); + aCreationMetaDateString.append(char('0' + ((aDT.Day) % 10))); + aCreationMetaDateString.append("T"); + aCreationMetaDateString.append(char('0' + ((aDT.Hours / 10) % 10))); + aCreationMetaDateString.append(char('0' + ((aDT.Hours) % 10))); + aCreationMetaDateString.append(":"); + aCreationMetaDateString.append(char('0' + ((aDT.Minutes / 10) % 10))); + aCreationMetaDateString.append(char('0' + ((aDT.Minutes) % 10))); + aCreationMetaDateString.append(":"); + aCreationMetaDateString.append(char('0' + ((aDT.Seconds / 10) % 10))); + aCreationMetaDateString.append(char('0' + ((aDT.Seconds) % 10))); + + sal_uInt32 nDelta = 0; + if (aGMT.Seconds > aTVal.Seconds) + { + nDelta = aGMT.Seconds - aTVal.Seconds; + aCreationMetaDateString.append("-"); + } + else if (aGMT.Seconds < aTVal.Seconds) + { + nDelta = aTVal.Seconds - aGMT.Seconds; + aCreationMetaDateString.append("+"); + } + else + { + aCreationMetaDateString.append("Z"); + } + if (nDelta) + { + aCreationMetaDateString.append(char('0' + ((nDelta / 36000) % 10))); + aCreationMetaDateString.append(char('0' + ((nDelta / 3600) % 10))); + aCreationMetaDateString.append(":"); + aCreationMetaDateString.append(char('0' + ((nDelta / 600) % 6))); + aCreationMetaDateString.append(char('0' + ((nDelta / 60) % 10))); + } + aID.append(i_rCString1.getStr(), i_rCString1.getLength()); + + aInfoValuesOut = aID.makeStringAndClear(); + o_rCString2 = aCreationMetaDateString.makeStringAndClear(); + + ::comphelper::Hash aDigest(::comphelper::HashType::MD5); + aDigest.update(reinterpret_cast(&aGMT), sizeof(aGMT)); + aDigest.update(reinterpret_cast(aInfoValuesOut.getStr()), + aInfoValuesOut.getLength()); + //the binary form of the doc id is needed for encryption stuff + o_rIdentifier = aDigest.finalize(); +} + +} // end anonymous namespace PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double nPageHeight, PDFWriter::Orientation eOrientation ) : @@ -1306,7 +1396,7 @@ double PDFPage::getHeight() const } PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, - const css::uno::Reference< css::beans::XMaterialHolder >& xEnc, + const css::uno::Reference< css::beans::XMaterialHolder >& xEncryptionMaterialHolder, PDFWriter& i_rOuterFace) : VirtualDevice(Application::GetDefaultDevice(), DeviceFormat::WITHOUT_ALPHA, OUTDEV_PDF), m_aMapMode( MapUnit::MapPoint, Point(), Fraction( 1, pointToPixel(1) ), Fraction( 1, pointToPixel(1) ) ), @@ -1327,7 +1417,6 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, m_aFile(m_aContext.URL), m_bOpen(false), m_DocDigest(::comphelper::HashType::MD5), - m_nAccessPermissions(0), m_rOuterFace( i_rOuterFace ) { m_aStructure.emplace_back( ); @@ -1363,25 +1452,12 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, // setup DocInfo setupDocInfo(); - if( xEnc.is() ) - prepareEncryption( xEnc ); + if (xEncryptionMaterialHolder.is()) + m_aPDFEncryptor.prepareEncryption(xEncryptionMaterialHolder, m_aContext.Encryption); - if( m_aContext.Encryption.Encrypt() ) + if (m_aContext.Encryption.Encrypt()) { - // sanity check - if( m_aContext.Encryption.OValue.size() != ENCRYPTED_PWD_SIZE || - m_aContext.Encryption.UValue.size() != ENCRYPTED_PWD_SIZE || - m_aContext.Encryption.EncryptionKey.size() != MAXIMUM_RC4_KEY_LENGTH - ) - { - // the field lengths are invalid ? This was not setup by initEncryption. - // do not encrypt after all - m_aContext.Encryption.OValue.clear(); - m_aContext.Encryption.UValue.clear(); - OSL_ENSURE( false, "encryption data failed sanity check, encryption disabled" ); - } - else // setup key lengths - m_nAccessPermissions = computeAccessPermissions(m_aContext.Encryption, m_aPDFEncryptor.m_nKeyLength, m_aPDFEncryptor.m_nRC4KeyLength); + m_aPDFEncryptor.setupKeysAndCheck(m_aContext.Encryption); } // write header @@ -1469,7 +1545,7 @@ void PDFWriterImpl::setupDocInfo() { std::vector< sal_uInt8 > aId; m_aCreationDateString = PDFWriter::GetDateTime(); - computeDocumentIdentifier( aId, m_aContext.DocumentInfo, m_aCreationDateString, m_aContext.DocumentInfo.ModificationDate, m_aCreationMetaDateString ); + computeDocumentIdentifier(aId, m_aContext.DocumentInfo, m_aCreationDateString, m_aContext.DocumentInfo.ModificationDate, m_aCreationMetaDateString); if( m_aContext.Encryption.DocumentIdentifier.empty() ) m_aContext.Encryption.DocumentIdentifier = std::move(aId); } @@ -6074,7 +6150,7 @@ sal_Int32 PDFWriterImpl::emitEncrypt() // emit the owner password, must not be encrypted aWriter.writeString("/O", reinterpret_cast(m_aContext.Encryption.OValue.data()), sal_Int32(m_aContext.Encryption.OValue.size())); aWriter.writeString("/U", reinterpret_cast(m_aContext.Encryption.UValue.data()), sal_Int32(m_aContext.Encryption.UValue.size())); - aWriter.write("/P", m_nAccessPermissions); + aWriter.write("/P", m_aPDFEncryptor.getAccessPermissions()); aWriter.endDict(); aWriter.endObject(); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 06bdee0ce538..75ccbe9f03a0 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1083,7 +1083,7 @@ void PDFWriterImpl::checkAndEnableStreamEncryption( sal_Int32 nObject ) return; m_aPDFEncryptor.m_bEncryptThisStream = true; - sal_Int32 i = m_aPDFEncryptor.m_nKeyLength; + sal_Int32 i = m_aPDFEncryptor.getKeyLength(); m_aContext.Encryption.EncryptionKey[i++] = static_cast(nObject); m_aContext.Encryption.EncryptionKey[i++] = static_cast( nObject >> 8 ); m_aContext.Encryption.EncryptionKey[i++] = static_cast( nObject >> 16 ); @@ -1094,7 +1094,7 @@ void PDFWriterImpl::checkAndEnableStreamEncryption( sal_Int32 nObject ) // the i+2 to take into account the generation number, always zero // initialize the RC4 with the key // key length: see algorithm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR(m_aPDFEncryptor.m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum.data(), m_aPDFEncryptor.m_nRC4KeyLength, nullptr, 0); + rtl_cipher_initARCFOUR(m_aPDFEncryptor.m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum.data(), m_aPDFEncryptor.getRC4KeyLength(), nullptr, 0); } void PDFWriterImpl::enableStringEncryption( sal_Int32 nObject ) @@ -1102,7 +1102,7 @@ void PDFWriterImpl::enableStringEncryption( sal_Int32 nObject ) if( !m_aContext.Encryption.Encrypt() ) return; - sal_Int32 i = m_aPDFEncryptor.m_nKeyLength; + sal_Int32 i = m_aPDFEncryptor.getKeyLength(); m_aContext.Encryption.EncryptionKey[i++] = static_cast(nObject); m_aContext.Encryption.EncryptionKey[i++] = static_cast( nObject >> 8 ); m_aContext.Encryption.EncryptionKey[i++] = static_cast( nObject >> 16 ); @@ -1113,60 +1113,7 @@ void PDFWriterImpl::enableStringEncryption( sal_Int32 nObject ) m_aContext.Encryption.EncryptionKey.data(), i+2, ::comphelper::HashType::MD5)); // initialize the RC4 with the key // key length: see algorithm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR(m_aPDFEncryptor.m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum.data(), m_aPDFEncryptor.m_nRC4KeyLength, nullptr, 0); -} - -/* init the encryption engine -1. init the document id, used both for building the document id and for building the encryption key(s) -2. build the encryption key following algorithms described in the PDF specification - */ -uno::Reference< beans::XMaterialHolder > PDFWriterImpl::initEncryption( const OUString& i_rOwnerPassword, - const OUString& i_rUserPassword - ) -{ - uno::Reference< beans::XMaterialHolder > xResult; - if( !i_rOwnerPassword.isEmpty() || !i_rUserPassword.isEmpty() ) - { - rtl::Reference pTransporter = new EncryptionHashTransporter; - xResult = pTransporter; - - // get padded passwords - sal_uInt8 aPadUPW[ENCRYPTED_PWD_SIZE], aPadOPW[ENCRYPTED_PWD_SIZE]; - padPassword( i_rOwnerPassword.isEmpty() ? i_rUserPassword : i_rOwnerPassword, aPadOPW ); - padPassword( i_rUserPassword, aPadUPW ); - - if( computeODictionaryValue( aPadOPW, aPadUPW, pTransporter->getOValue(), SECUR_128BIT_KEY ) ) - { - pTransporter->getUDigest()->update(aPadUPW, ENCRYPTED_PWD_SIZE); - } - else - xResult.clear(); - - // trash temporary padded cleartext PWDs - rtl_secureZeroMemory (aPadOPW, sizeof(aPadOPW)); - rtl_secureZeroMemory (aPadUPW, sizeof(aPadUPW)); - } - return xResult; -} - -bool PDFWriterImpl::prepareEncryption( const uno::Reference< beans::XMaterialHolder >& xEnc ) -{ - bool bSuccess = false; - EncryptionHashTransporter* pTransporter = EncryptionHashTransporter::getEncHashTransporter( xEnc ); - if( pTransporter ) - { - sal_Int32 nKeyLength = 0, nRC4KeyLength = 0; - sal_Int32 nAccessPermissions = computeAccessPermissions( m_aContext.Encryption, nKeyLength, nRC4KeyLength ); - m_aContext.Encryption.OValue = pTransporter->getOValue(); - bSuccess = computeUDictionaryValue( pTransporter, m_aContext.Encryption, nKeyLength, nAccessPermissions ); - } - if( ! bSuccess ) - { - m_aContext.Encryption.OValue.clear(); - m_aContext.Encryption.UValue.clear(); - m_aContext.Encryption.EncryptionKey.clear(); - } - return bSuccess; + rtl_cipher_initARCFOUR(m_aPDFEncryptor.m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum.data(), m_aPDFEncryptor.getRC4KeyLength(), nullptr, 0); } const tools::Long unsetRun[256] = diff --git a/vcl/source/pdf/PDFEncryptor.cxx b/vcl/source/pdf/PDFEncryptor.cxx index dc309fbbe59e..2c6d37296d42 100644 --- a/vcl/source/pdf/PDFEncryptor.cxx +++ b/vcl/source/pdf/PDFEncryptor.cxx @@ -10,16 +10,38 @@ #include #include -#include +#include +#include #include +#include +#include +#include + +using namespace css; namespace vcl::pdf { -/************************************************************* -begin i12626 methods +namespace +{ +// the maximum password length +constexpr sal_Int32 MD5_DIGEST_SIZE = 16; -Implements Algorithm 3.2, step 1 only -*/ +// security 128 bit +constexpr sal_Int32 SECUR_128BIT_KEY = 16; + +// maximum length of MD5 digest input, in step 2 of algorithm 3.1 +// PDF spec ver. 1.4: see there for details +constexpr sal_Int32 MAXIMUM_RC4_KEY_LENGTH = SECUR_128BIT_KEY + 3 + 2; + +constexpr sal_Int32 ENCRYPTED_PWD_SIZE = 32; + +/* pad string used for password in Standard security handler */ +constexpr const std::array s_nPadString + = { 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, + 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, + 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A }; + +/** Implements Algorithm 3.2, step 1 only */ void padPassword(std::u16string_view i_rPassword, sal_uInt8* o_pPaddedPW) { // get ansi-1252 version of the password string CHECKIT ! i12626 @@ -36,21 +58,19 @@ void padPassword(std::u16string_view i_rPassword, sal_uInt8* o_pPaddedPW) //pad it with standard byte string sal_Int32 i, y; for (i = nCurrentChar, y = 0; i < ENCRYPTED_PWD_SIZE; i++, y++) - o_pPaddedPW[i] = PDFEncryptor::s_nPadString[y]; + o_pPaddedPW[i] = s_nPadString[y]; } -/********************************** -Algorithm 3.2 Compute the encryption key used - -step 1 should already be done before calling, the paThePaddedPassword parameter should contain -the padded password and must be 32 byte long, the encryption key is returned into the paEncryptionKey parameter, -it will be 16 byte long for 128 bit security; for 40 bit security only the first 5 bytes are used - -TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec. - -*/ +/** Algorithm 3.2 Compute the encryption key used + * Step 1 should already be done before calling, the paThePaddedPassword parameter should contain + * the padded password and must be 32 byte long, the encryption key is returned into the + * paEncryptionKey parameter, it will be 16 byte long for 128 bit security; for 40 bit security + * only the first 5 bytes are used + * + * TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec. + */ bool computeEncryptionKey(EncryptionHashTransporter* i_pTransporter, - vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + vcl::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nAccessPermissions) { bool bSuccess = true; @@ -106,10 +126,10 @@ bool computeEncryptionKey(EncryptionHashTransporter* i_pTransporter, return bSuccess; } -/********************************** -Algorithm 3.3 Compute the encryption dictionary /O value, save into the class data member -the step numbers down here correspond to the ones in PDF v.1.4 specification -*/ +/** Algorithm 3.3 + * Compute the encryption dictionary /O value, save into the class data member the step + * numbers down here correspond to the ones in PDF v.1.4 specification + */ bool computeODictionaryValue(const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, std::vector& io_rOValue, sal_Int32 i_nKeyLength) @@ -170,10 +190,8 @@ bool computeODictionaryValue(const sal_uInt8* i_pPaddedOwnerPassword, rtl_cipher_encodeARCFOUR( aCipher, io_rOValue.data(), sal_Int32(io_rOValue.size()), // the data to be encrypted - io_rOValue.data(), - sal_Int32( - io_rOValue - .size())); // encrypted data, can be the same as the input, encrypt "in place" + io_rOValue.data(), sal_Int32(io_rOValue.size())); + // encrypted data, can be the same as the input, encrypt "in place" //step 8, store in class data member } } @@ -192,12 +210,14 @@ bool computeODictionaryValue(const sal_uInt8* i_pPaddedOwnerPassword, return bSuccess; } -/********************************** -Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into the class data member, revision 2 (40 bit) or 3 (128 bit) -*/ +/** Algorithms 3.4 and 3.5 + * + * Compute the encryption dictionary /U value, save into the class data member, + * revision 2 (40 bit) or 3 (128 bit) + */ bool computeUDictionaryValue(EncryptionHashTransporter* i_pTransporter, - vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, - sal_Int32 i_nKeyLength, sal_Int32 i_nAccessPermissions) + vcl::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nKeyLength, + sal_Int32 i_nAccessPermissions) { bool bSuccess = true; @@ -219,7 +239,7 @@ bool computeUDictionaryValue(EncryptionHashTransporter* i_pTransporter, for (sal_uInt32 i = MD5_DIGEST_SIZE; i < sal_uInt32(io_rProperties.UValue.size()); i++) io_rProperties.UValue[i] = 0; //steps 2 and 3 - aDigest.update(PDFEncryptor::s_nPadString, sizeof(PDFEncryptor::s_nPadString)); + aDigest.update(s_nPadString.data(), sizeof(s_nPadString)); aDigest.update(io_rProperties.DocumentIdentifier.data(), io_rProperties.DocumentIdentifier.size()); @@ -266,102 +286,7 @@ bool computeUDictionaryValue(EncryptionHashTransporter* i_pTransporter, return bSuccess; } -void computeDocumentIdentifier(std::vector& o_rIdentifier, - const vcl::PDFWriter::PDFDocInfo& i_rDocInfo, - const OString& i_rCString1, - const css::util::DateTime& rCreationMetaDate, OString& o_rCString2) -{ - o_rIdentifier.clear(); - - //build the document id - OString aInfoValuesOut; - OStringBuffer aID(1024); - if (!i_rDocInfo.Title.isEmpty()) - PDFWriter::AppendUnicodeTextString(i_rDocInfo.Title, aID); - if (!i_rDocInfo.Author.isEmpty()) - PDFWriter::AppendUnicodeTextString(i_rDocInfo.Author, aID); - if (!i_rDocInfo.Subject.isEmpty()) - PDFWriter::AppendUnicodeTextString(i_rDocInfo.Subject, aID); - if (!i_rDocInfo.Keywords.isEmpty()) - PDFWriter::AppendUnicodeTextString(i_rDocInfo.Keywords, aID); - if (!i_rDocInfo.Creator.isEmpty()) - PDFWriter::AppendUnicodeTextString(i_rDocInfo.Creator, aID); - if (!i_rDocInfo.Producer.isEmpty()) - PDFWriter::AppendUnicodeTextString(i_rDocInfo.Producer, aID); - - TimeValue aTVal, aGMT; - oslDateTime aDT; - aDT.NanoSeconds = rCreationMetaDate.NanoSeconds; - aDT.Seconds = rCreationMetaDate.Seconds; - aDT.Minutes = rCreationMetaDate.Minutes; - aDT.Hours = rCreationMetaDate.Hours; - aDT.Day = rCreationMetaDate.Day; - aDT.Month = rCreationMetaDate.Month; - aDT.Year = rCreationMetaDate.Year; - - osl_getSystemTime(&aGMT); - osl_getLocalTimeFromSystemTime(&aGMT, &aTVal); - OStringBuffer aCreationMetaDateString(64); - - // i59651: we fill the Metadata date string as well, if PDF/A is requested - // according to ISO 19005-1:2005 6.7.3 the date is corrected for - // local time zone offset UTC only, whereas Acrobat 8 seems - // to use the localtime notation only - // according to a recommendation in XMP Specification (Jan 2004, page 75) - // the Acrobat way seems the right approach - aCreationMetaDateString.append(OStringChar(static_cast('0' + ((aDT.Year / 1000) % 10))) - + OStringChar(static_cast('0' + ((aDT.Year / 100) % 10))) - + OStringChar(static_cast('0' + ((aDT.Year / 10) % 10))) - + OStringChar(static_cast('0' + ((aDT.Year) % 10))) + "-" - + OStringChar(static_cast('0' + ((aDT.Month / 10) % 10))) - + OStringChar(static_cast('0' + ((aDT.Month) % 10))) + "-" - + OStringChar(static_cast('0' + ((aDT.Day / 10) % 10))) - + OStringChar(static_cast('0' + ((aDT.Day) % 10))) + "T" - + OStringChar(static_cast('0' + ((aDT.Hours / 10) % 10))) - + OStringChar(static_cast('0' + ((aDT.Hours) % 10))) + ":" - + OStringChar(static_cast('0' + ((aDT.Minutes / 10) % 10))) - + OStringChar(static_cast('0' + ((aDT.Minutes) % 10))) - + ":" - + OStringChar(static_cast('0' + ((aDT.Seconds / 10) % 10))) - + OStringChar(static_cast('0' + ((aDT.Seconds) % 10)))); - - sal_uInt32 nDelta = 0; - if (aGMT.Seconds > aTVal.Seconds) - { - nDelta = aGMT.Seconds - aTVal.Seconds; - aCreationMetaDateString.append("-"); - } - else if (aGMT.Seconds < aTVal.Seconds) - { - nDelta = aTVal.Seconds - aGMT.Seconds; - aCreationMetaDateString.append("+"); - } - else - { - aCreationMetaDateString.append("Z"); - } - if (nDelta) - { - aCreationMetaDateString.append( - OStringChar(static_cast('0' + ((nDelta / 36000) % 10))) - + OStringChar(static_cast('0' + ((nDelta / 3600) % 10))) + ":" - + OStringChar(static_cast('0' + ((nDelta / 600) % 6))) - + OStringChar(static_cast('0' + ((nDelta / 60) % 10)))); - } - aID.append(i_rCString1.getStr(), i_rCString1.getLength()); - - aInfoValuesOut = aID.makeStringAndClear(); - o_rCString2 = aCreationMetaDateString.makeStringAndClear(); - - ::comphelper::Hash aDigest(::comphelper::HashType::MD5); - aDigest.update(reinterpret_cast(&aGMT), sizeof(aGMT)); - aDigest.update(reinterpret_cast(aInfoValuesOut.getStr()), - aInfoValuesOut.getLength()); - //the binary form of the doc id is needed for encryption stuff - o_rIdentifier = aDigest.finalize(); -} - -sal_Int32 computeAccessPermissions(const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, +sal_Int32 computeAccessPermissions(const vcl::PDFEncryptionProperties& i_rProperties, sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength) { /* @@ -388,6 +313,92 @@ sal_Int32 computeAccessPermissions(const vcl::PDFWriter::PDFEncryptionProperties return nAccessPermissions; } +} // end anonymous namespace + +PDFEncryptor::PDFEncryptor() +{ + /* prepare the cypher engine */ + m_aCipher = rtl_cipher_createARCFOUR(rtl_Cipher_ModeStream); +} + +PDFEncryptor::~PDFEncryptor() { rtl_cipher_destroyARCFOUR(m_aCipher); } + +/* init the encryption engine +1. init the document id, used both for building the document id and for building the encryption key(s) +2. build the encryption key following algorithms described in the PDF specification + */ +uno::Reference +PDFEncryptor::initEncryption(const OUString& i_rOwnerPassword, const OUString& i_rUserPassword) +{ + uno::Reference xResult; + if (!i_rOwnerPassword.isEmpty() || !i_rUserPassword.isEmpty()) + { + rtl::Reference pTransporter = new EncryptionHashTransporter; + xResult = pTransporter; + + // get padded passwords + sal_uInt8 aPadUPW[ENCRYPTED_PWD_SIZE], aPadOPW[ENCRYPTED_PWD_SIZE]; + padPassword(i_rOwnerPassword.isEmpty() ? i_rUserPassword : i_rOwnerPassword, aPadOPW); + padPassword(i_rUserPassword, aPadUPW); + + if (computeODictionaryValue(aPadOPW, aPadUPW, pTransporter->getOValue(), SECUR_128BIT_KEY)) + { + pTransporter->getUDigest()->update(aPadUPW, ENCRYPTED_PWD_SIZE); + } + else + xResult.clear(); + + // trash temporary padded cleartext PWDs + rtl_secureZeroMemory(aPadOPW, sizeof(aPadOPW)); + rtl_secureZeroMemory(aPadUPW, sizeof(aPadUPW)); + } + return xResult; +} + +bool PDFEncryptor::prepareEncryption( + const uno::Reference& xEncryptionMaterialHolder, + vcl::PDFEncryptionProperties& rProperties) +{ + bool bSuccess = false; + EncryptionHashTransporter* pTransporter + = EncryptionHashTransporter::getEncHashTransporter(xEncryptionMaterialHolder); + if (pTransporter) + { + sal_Int32 nKeyLength = 0, nRC4KeyLength = 0; + sal_Int32 nAccessPermissions + = computeAccessPermissions(rProperties, nKeyLength, nRC4KeyLength); + rProperties.OValue = pTransporter->getOValue(); + bSuccess + = computeUDictionaryValue(pTransporter, rProperties, nKeyLength, nAccessPermissions); + } + if (!bSuccess) + { + rProperties.OValue.clear(); + rProperties.UValue.clear(); + rProperties.EncryptionKey.clear(); + } + return bSuccess; +} + +void PDFEncryptor::setupKeysAndCheck(vcl::PDFEncryptionProperties& rProperties) +{ + // sanity check + if (rProperties.OValue.size() != ENCRYPTED_PWD_SIZE + || rProperties.UValue.size() != ENCRYPTED_PWD_SIZE + || rProperties.EncryptionKey.size() != MAXIMUM_RC4_KEY_LENGTH) + { + // the field lengths are invalid ? This was not setup by initEncryption. + // do not encrypt after all + rProperties.OValue.clear(); + rProperties.UValue.clear(); + OSL_ENSURE(false, "encryption data failed sanity check, encryption disabled"); + } + else // setup key lengths + { + m_nAccessPermissions = computeAccessPermissions(rProperties, m_nKeyLength, m_nRC4KeyLength); + } +} + } // end vcl::pdf /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 626c184f77e77227217a23694176f950b80b7c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Thu, 7 Nov 2024 14:07:37 +0100 Subject: [PATCH 096/373] crypto: add AES256 test, document Encrypt, Hash conv. function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds AES256 test of encryption and decryption - an example on how the Encrypt and Decrypt classes are used. Also add a convenience function for Hash, accepting vector of bytes as this is used in a lot of places. Change-Id: I9b395c7afb8fac45cae8d7d8bd983f5daaafd64b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176887 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- comphelper/qa/unit/CryptoTest.cxx | 44 ++++++++++++++++++++++++++++ include/comphelper/crypto/Crypto.hxx | 10 +++++++ include/comphelper/hash.hxx | 5 ++++ 3 files changed, 59 insertions(+) diff --git a/comphelper/qa/unit/CryptoTest.cxx b/comphelper/qa/unit/CryptoTest.cxx index 2b0dac47416f..b13887040667 100644 --- a/comphelper/qa/unit/CryptoTest.cxx +++ b/comphelper/qa/unit/CryptoTest.cxx @@ -33,10 +33,12 @@ public: void testCryptoHash(); void testRoundUp(); + void testEncrypt_AES256(); CPPUNIT_TEST_SUITE(CryptoTest); CPPUNIT_TEST(testCryptoHash); CPPUNIT_TEST(testRoundUp); + CPPUNIT_TEST(testEncrypt_AES256); CPPUNIT_TEST_SUITE_END(); }; @@ -95,6 +97,48 @@ void CryptoTest::testRoundUp() CPPUNIT_ASSERT_EQUAL(32, comphelper::roundUp(31, 16)); } +void CryptoTest::testEncrypt_AES256() +{ + std::vector key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + + std::vector iv = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + + std::vector original = { 's', 'e', 'c', 'r', 'e', 't', '\0' }; + + std::vector encrypted(original.size()); + + sal_uInt32 nWrittenSize = 0; + + comphelper::Encrypt aEncryptor(key, iv, comphelper::CryptoType::AES_256_CBC); + nWrittenSize = aEncryptor.update(encrypted, original); + + // nothing should be written as the size of the input is not a multiple of block size + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), nWrittenSize); + + original.resize(16, 0); // apply padding to make it multiple of block size + encrypted.resize(16, 0); + + CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), + comphelper::hashToString(original)); + + nWrittenSize = aEncryptor.update(encrypted, original); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); + + CPPUNIT_ASSERT_EQUAL(std::string("181fd8e8e33d2e0b06abc41c2b90f6e5"), + comphelper::hashToString(encrypted)); + + std::vector decrypted(encrypted.size()); + + comphelper::Decrypt aDecryptor(key, iv, comphelper::CryptoType::AES_256_CBC); + nWrittenSize = aDecryptor.update(decrypted, encrypted); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); + + CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), + comphelper::hashToString(decrypted)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(CryptoTest); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/comphelper/crypto/Crypto.hxx b/include/comphelper/crypto/Crypto.hxx index aba89642652a..b2530f02b558 100644 --- a/include/comphelper/crypto/Crypto.hxx +++ b/include/comphelper/crypto/Crypto.hxx @@ -75,11 +75,21 @@ public: std::vector& key); }; +/** Encrypt vector of bytes with AES encryption */ class COMPHELPER_DLLPUBLIC Encrypt final : public Crypto { public: + /** Initialize encryption for key, init vector and encryption type. + * + * key - encryption key, key size should be the same as block size + * iv - init vector: it can be empty - will not be used (init vector will be 0) + */ Encrypt(std::vector& key, std::vector& iv, CryptoType type); + /** Encrypt the input and write into output + * + * inputLength - size from the input to be encrypted (0 means to use the size of the vector) + */ sal_uInt32 update(std::vector& output, std::vector& input, sal_uInt32 inputLength = 0); }; diff --git a/include/comphelper/hash.hxx b/include/comphelper/hash.hxx index e148276abfb3..9567904e6080 100644 --- a/include/comphelper/hash.hxx +++ b/include/comphelper/hash.hxx @@ -61,6 +61,11 @@ public: void update(const unsigned char* pInput, size_t length); + void update(std::vector const& rInput) + { + update(rInput.data(), rInput.size()); + } + std::vector finalize(); static std::vector calculateHash(const unsigned char* pInput, size_t length, HashType eType); From 35f07a51850aeede7ef92dc2a2eae2326cff06a1 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Thu, 21 Nov 2024 17:18:41 +0100 Subject: [PATCH 097/373] tdf#148161 - Remove redundant attributes from configuration schema XML files Change-Id: I25b6dd6868ac8f24155d4c2d45333ef47557c9c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176950 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- officecfg/registry/schema/org/openoffice/Office/Common.xcs | 2 +- officecfg/registry/schema/org/openoffice/Office/Logging.xcs | 4 ++-- officecfg/registry/schema/org/openoffice/Setup.xcs | 4 ++-- .../registry/schema/org/openoffice/TypeDetection/Filter.xcs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 5fa9ec24c2f5..4ed3683d2fc3 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -585,7 +585,7 @@ specifies, on a per-application-type basis, certain defaults for layouting form controls
    - + specifies the default visual effect for form controls diff --git a/officecfg/registry/schema/org/openoffice/Office/Logging.xcs b/officecfg/registry/schema/org/openoffice/Office/Logging.xcs index a5ec755ea256..b5374d554296 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Logging.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Logging.xcs @@ -32,7 +32,7 @@ 2147483647 - + Specifies the UNO service name of the default handler for the logger. @@ -65,7 +65,7 @@ $(userurl)/$(loggername).log
    - + Specifies the UNO service name of the default formatter for the logger. diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs index 17e593a3e052..cabcf9ff7fc2 100644 --- a/officecfg/registry/schema/org/openoffice/Setup.xcs +++ b/officecfg/registry/schema/org/openoffice/Setup.xcs @@ -254,7 +254,7 @@ - + Specifies the version number of the previously used product for whats-new comparison. @@ -420,7 +420,7 @@ false - + diff --git a/officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs b/officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs index 5433e1349798..9b4259a03b20 100644 --- a/officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs +++ b/officecfg/registry/schema/org/openoffice/TypeDetection/Filter.xcs @@ -87,7 +87,7 @@ UI. - + Extension to use when exporting content using this filter. When this value is not given, it is inferred from the Type associated with From c06de26c4b83edad29a70a454dea20dcd0261a33 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 21 Nov 2024 16:17:16 +0200 Subject: [PATCH 098/373] tsan: make oslPipe thread-safe add a mutex around accesses of the internal data structures of oslPipeImpl, to prevent data-races Change-Id: Ia39961c0a3df0a5a5db31cc515d248d013998255 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176931 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sal/osl/unx/pipe.cxx | 50 +++++++++++++++++++++++++++++----------- sal/osl/unx/sockimpl.hxx | 2 ++ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx index 436f3086ded5..c4420731795d 100644 --- a/sal/osl/unx/pipe.cxx +++ b/sal/osl/unx/pipe.cxx @@ -82,12 +82,10 @@ static oslPipeError osl_PipeErrorFromNative(int nativeType) static oslPipe createPipeImpl() { - oslPipe pPipeImpl; - - pPipeImpl = static_cast< oslPipe >(calloc(1, sizeof(struct oslPipeImpl))); - if (!pPipeImpl) - return nullptr; + oslPipe pPipeImpl = new oslPipeImpl; + pPipeImpl->m_Socket = 0; + pPipeImpl->m_Name[0] = 0; pPipeImpl->m_nRefCount = 1; pPipeImpl->m_bClosed = false; #if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) @@ -100,8 +98,7 @@ static oslPipe createPipeImpl() static void destroyPipeImpl(oslPipe pImpl) { - if (pImpl) - free(pImpl); + delete pImpl; } oslPipe SAL_CALL osl_createPipe(rtl_uString *ustrPipeName, oslPipeOptions Options, oslSecurity Security) @@ -296,8 +293,7 @@ void SAL_CALL osl_releasePipe(oslPipe pPipe) if (osl_atomic_decrement(&(pPipe->m_nRefCount)) == 0) { - if (!pPipe->m_bClosed) - osl_closePipe(pPipe); + osl_closePipe(pPipe); destroyPipeImpl(pPipe); } @@ -311,6 +307,8 @@ void SAL_CALL osl_closePipe(oslPipe pPipe) if (!pPipe) return; + std::unique_lock aGuard(pPipe->m_Mutex); + if (pPipe->m_bClosed) return; @@ -373,13 +371,23 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe) if (!pPipe) return nullptr; - assert(pPipe->m_Name[0] != '\0'); // you cannot have an empty pipe name + int socket; + { + // dont hold lock while accepting, so it is possible to close a socket blocked in accept + std::unique_lock aGuard(pPipe->m_Mutex); + assert(pPipe->m_Name[0] != '\0'); // you cannot have an empty pipe name #if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) - pPipe->m_bIsAccepting = true; + pPipe->m_bIsAccepting = true; #endif - s = accept(pPipe->m_Socket, nullptr, nullptr); + socket = pPipe->m_Socket; + } + + + s = accept(socket, nullptr, nullptr); + + std::unique_lock aGuard(pPipe->m_Mutex); #if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) pPipe->m_bIsAccepting = false; @@ -435,7 +443,14 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe, return -1; } - sal_Int32 nRet = recv(pPipe->m_Socket, pBuffer, BytesToRead, 0); + int socket; + { + // dont hold lock while receiving, so it is possible to close a socket blocked in recv + std::unique_lock aGuard(pPipe->m_Mutex); + socket = pPipe->m_Socket; + } + + sal_Int32 nRet = recv(socket, pBuffer, BytesToRead, 0); SAL_WARN_IF(nRet < 0, "sal.osl.pipe", "recv() failed: " << UnixErrnoString(errno)); @@ -456,7 +471,14 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe, return -1; } - nRet = send(pPipe->m_Socket, pBuffer, BytesToSend, 0); + int socket; + { + // dont hold lock while sending, so it is possible to close a socket blocked in send + std::unique_lock aGuard(pPipe->m_Mutex); + socket = pPipe->m_Socket; + } + + nRet = send(socket, pBuffer, BytesToSend, 0); if (nRet <= 0) SAL_WARN("sal.osl.pipe", "send() failed: " << UnixErrnoString(errno)); diff --git a/sal/osl/unx/sockimpl.hxx b/sal/osl/unx/sockimpl.hxx index dc354db94a42..529aec7ff1eb 100644 --- a/sal/osl/unx/sockimpl.hxx +++ b/sal/osl/unx/sockimpl.hxx @@ -24,6 +24,7 @@ #include #include +#include #if defined(LINUX) || defined(FREEBSD) || defined(NETBSD) #define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1 @@ -45,6 +46,7 @@ struct oslSocketAddrImpl }; struct oslPipeImpl { + std::mutex m_Mutex; int m_Socket; char m_Name[sizeof sockaddr_un::sun_path]; oslInterlockedCount m_nRefCount; From cbc5fd0df45c88aaca32a283c67d38cbdf286da6 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 21 Nov 2024 20:52:18 +0100 Subject: [PATCH 099/373] tdf#163486: PVS V1043 global object variable is declared in header (svddef.hxx) Change-Id: If11d609ccf6bdaadfec6b3844e08589cb289aec3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176971 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/svx/svddef.hxx | 490 ++++++++++++++++++++--------------------- 1 file changed, 245 insertions(+), 245 deletions(-) diff --git a/include/svx/svddef.hxx b/include/svx/svddef.hxx index f54c872f6c8d..42747477ba89 100644 --- a/include/svx/svddef.hxx +++ b/include/svx/svddef.hxx @@ -179,279 +179,279 @@ class Svx3DTextureModeItem; class SvXMLAttrContainerItem; class SvxFrameDirectionItem; -constexpr sal_uInt16 SDRATTR_START (XATTR_START); /* 1000 */ -constexpr sal_uInt16 SDRATTR_SHADOW_FIRST (XATTR_END + 1); // 1048 -constexpr TypedWhichId SDRATTR_SHADOW (SDRATTR_SHADOW_FIRST+ 0); // 1048 -constexpr TypedWhichId SDRATTR_SHADOWCOLOR (SDRATTR_SHADOW_FIRST+ 1); // 1049 -constexpr TypedWhichId SDRATTR_SHADOWXDIST (SDRATTR_SHADOW_FIRST+ 2); // 1050 -constexpr TypedWhichId SDRATTR_SHADOWYDIST (SDRATTR_SHADOW_FIRST+ 3); // 1051 -constexpr TypedWhichId SDRATTR_SHADOWTRANSPARENCE (SDRATTR_SHADOW_FIRST+ 4); // 1052 -constexpr TypedWhichId SDRATTR_SHADOW3D (SDRATTR_SHADOW_FIRST+ 5); // 1053 -constexpr TypedWhichId SDRATTR_SHADOWPERSP (SDRATTR_SHADOW_FIRST+ 6); // 1054 -constexpr TypedWhichId SDRATTR_SHADOWSIZEX (SDRATTR_SHADOW_FIRST+ 7); // 1055 -constexpr TypedWhichId SDRATTR_SHADOWSIZEY (SDRATTR_SHADOW_FIRST+ 8); // 1056 -constexpr TypedWhichId SDRATTR_SHADOWBLUR (SDRATTR_SHADOW_FIRST+ 9); // 1057 -constexpr TypedWhichId SDRATTR_SHADOWALIGNMENT(SDRATTR_SHADOW_FIRST + 10); // 1058 -constexpr sal_uInt16 SDRATTR_SHADOW_LAST (SDRATTR_SHADOWALIGNMENT); // 1058 +inline constexpr sal_uInt16 SDRATTR_START (XATTR_START); /* 1000 */ +inline constexpr sal_uInt16 SDRATTR_SHADOW_FIRST (XATTR_END + 1); // 1048 +inline constexpr TypedWhichId SDRATTR_SHADOW (SDRATTR_SHADOW_FIRST+ 0); // 1048 +inline constexpr TypedWhichId SDRATTR_SHADOWCOLOR (SDRATTR_SHADOW_FIRST+ 1); // 1049 +inline constexpr TypedWhichId SDRATTR_SHADOWXDIST (SDRATTR_SHADOW_FIRST+ 2); // 1050 +inline constexpr TypedWhichId SDRATTR_SHADOWYDIST (SDRATTR_SHADOW_FIRST+ 3); // 1051 +inline constexpr TypedWhichId SDRATTR_SHADOWTRANSPARENCE (SDRATTR_SHADOW_FIRST+ 4); // 1052 +inline constexpr TypedWhichId SDRATTR_SHADOW3D (SDRATTR_SHADOW_FIRST+ 5); // 1053 +inline constexpr TypedWhichId SDRATTR_SHADOWPERSP (SDRATTR_SHADOW_FIRST+ 6); // 1054 +inline constexpr TypedWhichId SDRATTR_SHADOWSIZEX (SDRATTR_SHADOW_FIRST+ 7); // 1055 +inline constexpr TypedWhichId SDRATTR_SHADOWSIZEY (SDRATTR_SHADOW_FIRST+ 8); // 1056 +inline constexpr TypedWhichId SDRATTR_SHADOWBLUR (SDRATTR_SHADOW_FIRST+ 9); // 1057 +inline constexpr TypedWhichId SDRATTR_SHADOWALIGNMENT(SDRATTR_SHADOW_FIRST + 10); // 1058 +inline constexpr sal_uInt16 SDRATTR_SHADOW_LAST (SDRATTR_SHADOWALIGNMENT); // 1058 -constexpr sal_uInt16 SDRATTR_CAPTION_FIRST (SDRATTR_SHADOW_LAST + 1); // 1059 -constexpr TypedWhichId SDRATTR_CAPTIONTYPE (SDRATTR_CAPTION_FIRST+ 0); // 1059 -constexpr TypedWhichId SDRATTR_CAPTIONFIXEDANGLE (SDRATTR_CAPTION_FIRST+ 1); // 1060 -constexpr TypedWhichId SDRATTR_CAPTIONANGLE (SDRATTR_CAPTION_FIRST+ 2); // 1061 -constexpr TypedWhichId SDRATTR_CAPTIONGAP (SDRATTR_CAPTION_FIRST+ 3); // 1062 -constexpr TypedWhichId SDRATTR_CAPTIONESCDIR (SDRATTR_CAPTION_FIRST+ 4); // 1063 -constexpr TypedWhichId SDRATTR_CAPTIONESCISREL (SDRATTR_CAPTION_FIRST+ 5); // 1064 -constexpr TypedWhichId SDRATTR_CAPTIONESCREL (SDRATTR_CAPTION_FIRST+ 6); // 1065 -constexpr TypedWhichId SDRATTR_CAPTIONESCABS (SDRATTR_CAPTION_FIRST+ 7); // 1066 -constexpr TypedWhichId SDRATTR_CAPTIONLINELEN (SDRATTR_CAPTION_FIRST+ 8); // 1067 -constexpr TypedWhichId SDRATTR_CAPTIONFITLINELEN (SDRATTR_CAPTION_FIRST+ 9); // 1068 -constexpr sal_uInt16 SDRATTR_CAPTION_LAST (SDRATTR_CAPTIONFITLINELEN); // 1068 +inline constexpr sal_uInt16 SDRATTR_CAPTION_FIRST (SDRATTR_SHADOW_LAST + 1); // 1059 +inline constexpr TypedWhichId SDRATTR_CAPTIONTYPE (SDRATTR_CAPTION_FIRST+ 0); // 1059 +inline constexpr TypedWhichId SDRATTR_CAPTIONFIXEDANGLE (SDRATTR_CAPTION_FIRST+ 1); // 1060 +inline constexpr TypedWhichId SDRATTR_CAPTIONANGLE (SDRATTR_CAPTION_FIRST+ 2); // 1061 +inline constexpr TypedWhichId SDRATTR_CAPTIONGAP (SDRATTR_CAPTION_FIRST+ 3); // 1062 +inline constexpr TypedWhichId SDRATTR_CAPTIONESCDIR (SDRATTR_CAPTION_FIRST+ 4); // 1063 +inline constexpr TypedWhichId SDRATTR_CAPTIONESCISREL (SDRATTR_CAPTION_FIRST+ 5); // 1064 +inline constexpr TypedWhichId SDRATTR_CAPTIONESCREL (SDRATTR_CAPTION_FIRST+ 6); // 1065 +inline constexpr TypedWhichId SDRATTR_CAPTIONESCABS (SDRATTR_CAPTION_FIRST+ 7); // 1066 +inline constexpr TypedWhichId SDRATTR_CAPTIONLINELEN (SDRATTR_CAPTION_FIRST+ 8); // 1067 +inline constexpr TypedWhichId SDRATTR_CAPTIONFITLINELEN (SDRATTR_CAPTION_FIRST+ 9); // 1068 +inline constexpr sal_uInt16 SDRATTR_CAPTION_LAST (SDRATTR_CAPTIONFITLINELEN); // 1068 -constexpr sal_uInt16 SDRATTR_MISC_FIRST (SDRATTR_CAPTION_LAST + 1); // 1069 -constexpr TypedWhichId SDRATTR_CORNER_RADIUS (SDRATTR_MISC_FIRST + 0); // 1069 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_MINFRAMEHEIGHT (SDRATTR_MISC_FIRST + 1); // 1070 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_AUTOGROWHEIGHT (SDRATTR_MISC_FIRST + 2); // 1071 sal_Bool, def=sal_True -constexpr TypedWhichId SDRATTR_TEXT_FITTOSIZE (SDRATTR_MISC_FIRST + 3); // 1072 enum, def=css::drawing::TextFitToSizeType_NONE -constexpr TypedWhichId SDRATTR_TEXT_LEFTDIST (SDRATTR_MISC_FIRST + 4); // 1073 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_RIGHTDIST (SDRATTR_MISC_FIRST + 5); // 1074 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_UPPERDIST (SDRATTR_MISC_FIRST + 6); // 1075 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_LOWERDIST (SDRATTR_MISC_FIRST + 7); // 1076 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_VERTADJUST (SDRATTR_MISC_FIRST + 8); // 1077 enum, def=SDRTEXTVERTADJUST_TOP -constexpr TypedWhichId SDRATTR_TEXT_MAXFRAMEHEIGHT (SDRATTR_MISC_FIRST + 9); // 1078 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_MINFRAMEWIDTH (SDRATTR_MISC_FIRST +10); // 1079 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_MAXFRAMEWIDTH (SDRATTR_MISC_FIRST +11); // 1080 long, def=0 -constexpr TypedWhichId SDRATTR_TEXT_AUTOGROWWIDTH (SDRATTR_MISC_FIRST +12); // 1081 sal_Bool, def=sal_False -constexpr TypedWhichId SDRATTR_TEXT_HORZADJUST (SDRATTR_MISC_FIRST +13); // 1082 enum, def=SDRTEXTHORZADJUST_LEFT -constexpr TypedWhichId SDRATTR_TEXT_ANIKIND (SDRATTR_MISC_FIRST +14); // 1083 enum, def=SdrTextAniKind::NONE - Pool V2/V4 -constexpr TypedWhichId SDRATTR_TEXT_ANIDIRECTION (SDRATTR_MISC_FIRST +15); // 1084 enum, def=SdrTextAniDirection::Left - Pool V2/V4 -constexpr TypedWhichId SDRATTR_TEXT_ANISTARTINSIDE (SDRATTR_MISC_FIRST +16); // 1085 sal_Bool, def=sal_False - Pool V2/V4 -constexpr TypedWhichId SDRATTR_TEXT_ANISTOPINSIDE (SDRATTR_MISC_FIRST +17); // 1086 sal_Bool, def=sal_False - Pool V2/V4 -constexpr TypedWhichId SDRATTR_TEXT_ANICOUNT (SDRATTR_MISC_FIRST +18); // 1087 sal_uInt16, def=0 - Pool V2/V4 -constexpr TypedWhichId SDRATTR_TEXT_ANIDELAY (SDRATTR_MISC_FIRST +19); // 1088 sal_uInt16, def=0 - Pool V2/V4 -constexpr TypedWhichId SDRATTR_TEXT_ANIAMOUNT (SDRATTR_MISC_FIRST +20); // 1089 sal_uInt16, def=0 - Pool V2/V4 -constexpr TypedWhichId SDRATTR_TEXT_CONTOURFRAME (SDRATTR_MISC_FIRST +21); // 1090 Pool V2 -constexpr TypedWhichId SDRATTR_XMLATTRIBUTES (SDRATTR_MISC_FIRST +22); // 1091 Pool V2 -constexpr TypedWhichId SDRATTR_TEXT_USEFIXEDCELLHEIGHT (SDRATTR_MISC_FIRST +23); // 1092 Pool V2 -constexpr TypedWhichId SDRATTR_TEXT_WORDWRAP (SDRATTR_MISC_FIRST +24); // 1093 Pool V2 -constexpr TypedWhichId SDRATTR_TEXT_CHAINNEXTNAME (SDRATTR_MISC_FIRST +25); // 1094 Pool V2 -constexpr TypedWhichId SDRATTR_TEXT_CLIPVERTOVERFLOW (SDRATTR_MISC_FIRST +26); // 1095 -constexpr sal_uInt16 SDRATTR_MISC_LAST (SDRATTR_TEXT_CLIPVERTOVERFLOW); // 1095 +inline constexpr sal_uInt16 SDRATTR_MISC_FIRST (SDRATTR_CAPTION_LAST + 1); // 1069 +inline constexpr TypedWhichId SDRATTR_CORNER_RADIUS (SDRATTR_MISC_FIRST + 0); // 1069 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_MINFRAMEHEIGHT (SDRATTR_MISC_FIRST + 1); // 1070 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_AUTOGROWHEIGHT (SDRATTR_MISC_FIRST + 2); // 1071 sal_Bool, def=sal_True +inline constexpr TypedWhichId SDRATTR_TEXT_FITTOSIZE (SDRATTR_MISC_FIRST + 3); // 1072 enum, def=css::drawing::TextFitToSizeType_NONE +inline constexpr TypedWhichId SDRATTR_TEXT_LEFTDIST (SDRATTR_MISC_FIRST + 4); // 1073 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_RIGHTDIST (SDRATTR_MISC_FIRST + 5); // 1074 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_UPPERDIST (SDRATTR_MISC_FIRST + 6); // 1075 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_LOWERDIST (SDRATTR_MISC_FIRST + 7); // 1076 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_VERTADJUST (SDRATTR_MISC_FIRST + 8); // 1077 enum, def=SDRTEXTVERTADJUST_TOP +inline constexpr TypedWhichId SDRATTR_TEXT_MAXFRAMEHEIGHT (SDRATTR_MISC_FIRST + 9); // 1078 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_MINFRAMEWIDTH (SDRATTR_MISC_FIRST +10); // 1079 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_MAXFRAMEWIDTH (SDRATTR_MISC_FIRST +11); // 1080 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXT_AUTOGROWWIDTH (SDRATTR_MISC_FIRST +12); // 1081 sal_Bool, def=sal_False +inline constexpr TypedWhichId SDRATTR_TEXT_HORZADJUST (SDRATTR_MISC_FIRST +13); // 1082 enum, def=SDRTEXTHORZADJUST_LEFT +inline constexpr TypedWhichId SDRATTR_TEXT_ANIKIND (SDRATTR_MISC_FIRST +14); // 1083 enum, def=SdrTextAniKind::NONE - Pool V2/V4 +inline constexpr TypedWhichId SDRATTR_TEXT_ANIDIRECTION (SDRATTR_MISC_FIRST +15); // 1084 enum, def=SdrTextAniDirection::Left - Pool V2/V4 +inline constexpr TypedWhichId SDRATTR_TEXT_ANISTARTINSIDE (SDRATTR_MISC_FIRST +16); // 1085 sal_Bool, def=sal_False - Pool V2/V4 +inline constexpr TypedWhichId SDRATTR_TEXT_ANISTOPINSIDE (SDRATTR_MISC_FIRST +17); // 1086 sal_Bool, def=sal_False - Pool V2/V4 +inline constexpr TypedWhichId SDRATTR_TEXT_ANICOUNT (SDRATTR_MISC_FIRST +18); // 1087 sal_uInt16, def=0 - Pool V2/V4 +inline constexpr TypedWhichId SDRATTR_TEXT_ANIDELAY (SDRATTR_MISC_FIRST +19); // 1088 sal_uInt16, def=0 - Pool V2/V4 +inline constexpr TypedWhichId SDRATTR_TEXT_ANIAMOUNT (SDRATTR_MISC_FIRST +20); // 1089 sal_uInt16, def=0 - Pool V2/V4 +inline constexpr TypedWhichId SDRATTR_TEXT_CONTOURFRAME (SDRATTR_MISC_FIRST +21); // 1090 Pool V2 +inline constexpr TypedWhichId SDRATTR_XMLATTRIBUTES (SDRATTR_MISC_FIRST +22); // 1091 Pool V2 +inline constexpr TypedWhichId SDRATTR_TEXT_USEFIXEDCELLHEIGHT (SDRATTR_MISC_FIRST +23); // 1092 Pool V2 +inline constexpr TypedWhichId SDRATTR_TEXT_WORDWRAP (SDRATTR_MISC_FIRST +24); // 1093 Pool V2 +inline constexpr TypedWhichId SDRATTR_TEXT_CHAINNEXTNAME (SDRATTR_MISC_FIRST +25); // 1094 Pool V2 +inline constexpr TypedWhichId SDRATTR_TEXT_CLIPVERTOVERFLOW (SDRATTR_MISC_FIRST +26); // 1095 +inline constexpr sal_uInt16 SDRATTR_MISC_LAST (SDRATTR_TEXT_CLIPVERTOVERFLOW); // 1095 -constexpr sal_uInt16 SDRATTR_EDGE_FIRST (SDRATTR_MISC_LAST + 1); // 1096 -constexpr TypedWhichId SDRATTR_EDGEKIND (SDRATTR_EDGE_FIRST + 0); // 1096 -constexpr TypedWhichId SDRATTR_EDGENODE1HORZDIST (SDRATTR_EDGE_FIRST + 1); // 1097 -constexpr TypedWhichId SDRATTR_EDGENODE1VERTDIST (SDRATTR_EDGE_FIRST + 2); // 1098 -constexpr TypedWhichId SDRATTR_EDGENODE2HORZDIST (SDRATTR_EDGE_FIRST + 3); // 1099 -constexpr TypedWhichId SDRATTR_EDGENODE2VERTDIST (SDRATTR_EDGE_FIRST + 4); // 1100 -constexpr TypedWhichId SDRATTR_EDGENODE1GLUEDIST (SDRATTR_EDGE_FIRST + 5); // 1101 -constexpr TypedWhichId SDRATTR_EDGENODE2GLUEDIST (SDRATTR_EDGE_FIRST + 6); // 1102 -constexpr TypedWhichId SDRATTR_EDGELINEDELTACOUNT (SDRATTR_EDGE_FIRST + 7); // 1103 -constexpr TypedWhichId SDRATTR_EDGELINE1DELTA (SDRATTR_EDGE_FIRST + 8); // 1104 -constexpr TypedWhichId SDRATTR_EDGELINE2DELTA (SDRATTR_EDGE_FIRST + 9); // 1105 -constexpr TypedWhichId SDRATTR_EDGELINE3DELTA (SDRATTR_EDGE_FIRST +10); // 1106 -constexpr sal_uInt16 SDRATTR_EDGE_LAST (SDRATTR_EDGELINE3DELTA); // 1106 +inline constexpr sal_uInt16 SDRATTR_EDGE_FIRST (SDRATTR_MISC_LAST + 1); // 1096 +inline constexpr TypedWhichId SDRATTR_EDGEKIND (SDRATTR_EDGE_FIRST + 0); // 1096 +inline constexpr TypedWhichId SDRATTR_EDGENODE1HORZDIST (SDRATTR_EDGE_FIRST + 1); // 1097 +inline constexpr TypedWhichId SDRATTR_EDGENODE1VERTDIST (SDRATTR_EDGE_FIRST + 2); // 1098 +inline constexpr TypedWhichId SDRATTR_EDGENODE2HORZDIST (SDRATTR_EDGE_FIRST + 3); // 1099 +inline constexpr TypedWhichId SDRATTR_EDGENODE2VERTDIST (SDRATTR_EDGE_FIRST + 4); // 1100 +inline constexpr TypedWhichId SDRATTR_EDGENODE1GLUEDIST (SDRATTR_EDGE_FIRST + 5); // 1101 +inline constexpr TypedWhichId SDRATTR_EDGENODE2GLUEDIST (SDRATTR_EDGE_FIRST + 6); // 1102 +inline constexpr TypedWhichId SDRATTR_EDGELINEDELTACOUNT (SDRATTR_EDGE_FIRST + 7); // 1103 +inline constexpr TypedWhichId SDRATTR_EDGELINE1DELTA (SDRATTR_EDGE_FIRST + 8); // 1104 +inline constexpr TypedWhichId SDRATTR_EDGELINE2DELTA (SDRATTR_EDGE_FIRST + 9); // 1105 +inline constexpr TypedWhichId SDRATTR_EDGELINE3DELTA (SDRATTR_EDGE_FIRST +10); // 1106 +inline constexpr sal_uInt16 SDRATTR_EDGE_LAST (SDRATTR_EDGELINE3DELTA); // 1106 -constexpr sal_uInt16 SDRATTR_MEASURE_FIRST (SDRATTR_EDGE_LAST + 1); // 1107 -constexpr TypedWhichId SDRATTR_MEASUREKIND (SDRATTR_MEASURE_FIRST+ 0); // 1107 -constexpr TypedWhichId SDRATTR_MEASURETEXTHPOS (SDRATTR_MEASURE_FIRST+ 1); // 1108 -constexpr TypedWhichId SDRATTR_MEASURETEXTVPOS (SDRATTR_MEASURE_FIRST+ 2); // 1109 -constexpr TypedWhichId SDRATTR_MEASURELINEDIST (SDRATTR_MEASURE_FIRST+ 3); // 1110 -constexpr TypedWhichId SDRATTR_MEASUREHELPLINEOVERHANG (SDRATTR_MEASURE_FIRST+ 4); // 1111 -constexpr TypedWhichId SDRATTR_MEASUREHELPLINEDIST (SDRATTR_MEASURE_FIRST+ 5); // 1112 -constexpr TypedWhichId SDRATTR_MEASUREHELPLINE1LEN (SDRATTR_MEASURE_FIRST+ 6); // 1113 -constexpr TypedWhichId SDRATTR_MEASUREHELPLINE2LEN (SDRATTR_MEASURE_FIRST+ 7); // 1114 -constexpr TypedWhichId SDRATTR_MEASUREBELOWREFEDGE (SDRATTR_MEASURE_FIRST+ 8); // 1115 -constexpr TypedWhichId SDRATTR_MEASURETEXTROTA90 (SDRATTR_MEASURE_FIRST+ 9); // 1116 -constexpr TypedWhichId SDRATTR_MEASURETEXTUPSIDEDOWN (SDRATTR_MEASURE_FIRST+10); // 1117 -constexpr TypedWhichId SDRATTR_MEASUREOVERHANG (SDRATTR_MEASURE_FIRST+11); // 1118 -constexpr TypedWhichId SDRATTR_MEASUREUNIT (SDRATTR_MEASURE_FIRST+12); // 1119 -constexpr TypedWhichId SDRATTR_MEASURESCALE (SDRATTR_MEASURE_FIRST+13); // 1120 -constexpr TypedWhichId SDRATTR_MEASURESHOWUNIT (SDRATTR_MEASURE_FIRST+14); // 1121 -constexpr TypedWhichId SDRATTR_MEASUREFORMATSTRING (SDRATTR_MEASURE_FIRST+15); // 1122 -constexpr TypedWhichId SDRATTR_MEASURETEXTAUTOANGLE (SDRATTR_MEASURE_FIRST+16); // 1123 -constexpr TypedWhichId SDRATTR_MEASURETEXTAUTOANGLEVIEW (SDRATTR_MEASURE_FIRST+17); // 1124 -constexpr TypedWhichId SDRATTR_MEASURETEXTISFIXEDANGLE (SDRATTR_MEASURE_FIRST+18); // 1125 -constexpr TypedWhichId SDRATTR_MEASURETEXTFIXEDANGLE (SDRATTR_MEASURE_FIRST+19); // 1126 -constexpr TypedWhichId SDRATTR_MEASUREDECIMALPLACES (SDRATTR_MEASURE_FIRST+20); // 1127 -constexpr sal_uInt16 SDRATTR_MEASURE_LAST (SDRATTR_MEASUREDECIMALPLACES); // 1127 +inline constexpr sal_uInt16 SDRATTR_MEASURE_FIRST (SDRATTR_EDGE_LAST + 1); // 1107 +inline constexpr TypedWhichId SDRATTR_MEASUREKIND (SDRATTR_MEASURE_FIRST+ 0); // 1107 +inline constexpr TypedWhichId SDRATTR_MEASURETEXTHPOS (SDRATTR_MEASURE_FIRST+ 1); // 1108 +inline constexpr TypedWhichId SDRATTR_MEASURETEXTVPOS (SDRATTR_MEASURE_FIRST+ 2); // 1109 +inline constexpr TypedWhichId SDRATTR_MEASURELINEDIST (SDRATTR_MEASURE_FIRST+ 3); // 1110 +inline constexpr TypedWhichId SDRATTR_MEASUREHELPLINEOVERHANG (SDRATTR_MEASURE_FIRST+ 4); // 1111 +inline constexpr TypedWhichId SDRATTR_MEASUREHELPLINEDIST (SDRATTR_MEASURE_FIRST+ 5); // 1112 +inline constexpr TypedWhichId SDRATTR_MEASUREHELPLINE1LEN (SDRATTR_MEASURE_FIRST+ 6); // 1113 +inline constexpr TypedWhichId SDRATTR_MEASUREHELPLINE2LEN (SDRATTR_MEASURE_FIRST+ 7); // 1114 +inline constexpr TypedWhichId SDRATTR_MEASUREBELOWREFEDGE (SDRATTR_MEASURE_FIRST+ 8); // 1115 +inline constexpr TypedWhichId SDRATTR_MEASURETEXTROTA90 (SDRATTR_MEASURE_FIRST+ 9); // 1116 +inline constexpr TypedWhichId SDRATTR_MEASURETEXTUPSIDEDOWN (SDRATTR_MEASURE_FIRST+10); // 1117 +inline constexpr TypedWhichId SDRATTR_MEASUREOVERHANG (SDRATTR_MEASURE_FIRST+11); // 1118 +inline constexpr TypedWhichId SDRATTR_MEASUREUNIT (SDRATTR_MEASURE_FIRST+12); // 1119 +inline constexpr TypedWhichId SDRATTR_MEASURESCALE (SDRATTR_MEASURE_FIRST+13); // 1120 +inline constexpr TypedWhichId SDRATTR_MEASURESHOWUNIT (SDRATTR_MEASURE_FIRST+14); // 1121 +inline constexpr TypedWhichId SDRATTR_MEASUREFORMATSTRING (SDRATTR_MEASURE_FIRST+15); // 1122 +inline constexpr TypedWhichId SDRATTR_MEASURETEXTAUTOANGLE (SDRATTR_MEASURE_FIRST+16); // 1123 +inline constexpr TypedWhichId SDRATTR_MEASURETEXTAUTOANGLEVIEW (SDRATTR_MEASURE_FIRST+17); // 1124 +inline constexpr TypedWhichId SDRATTR_MEASURETEXTISFIXEDANGLE (SDRATTR_MEASURE_FIRST+18); // 1125 +inline constexpr TypedWhichId SDRATTR_MEASURETEXTFIXEDANGLE (SDRATTR_MEASURE_FIRST+19); // 1126 +inline constexpr TypedWhichId SDRATTR_MEASUREDECIMALPLACES (SDRATTR_MEASURE_FIRST+20); // 1127 +inline constexpr sal_uInt16 SDRATTR_MEASURE_LAST (SDRATTR_MEASUREDECIMALPLACES); // 1127 -constexpr sal_uInt16 SDRATTR_CIRC_FIRST (SDRATTR_MEASURE_LAST+ 1); // 1128 -constexpr TypedWhichId SDRATTR_CIRCKIND (SDRATTR_CIRC_FIRST+ 0); // 1128 -constexpr TypedWhichId SDRATTR_CIRCSTARTANGLE (SDRATTR_CIRC_FIRST+ 1); // 1129 -constexpr TypedWhichId SDRATTR_CIRCENDANGLE (SDRATTR_CIRC_FIRST+ 2); // 1130 -constexpr sal_uInt16 SDRATTR_CIRC_LAST (SDRATTR_CIRCENDANGLE); // 1130 +inline constexpr sal_uInt16 SDRATTR_CIRC_FIRST (SDRATTR_MEASURE_LAST+ 1); // 1128 +inline constexpr TypedWhichId SDRATTR_CIRCKIND (SDRATTR_CIRC_FIRST+ 0); // 1128 +inline constexpr TypedWhichId SDRATTR_CIRCSTARTANGLE (SDRATTR_CIRC_FIRST+ 1); // 1129 +inline constexpr TypedWhichId SDRATTR_CIRCENDANGLE (SDRATTR_CIRC_FIRST+ 2); // 1130 +inline constexpr sal_uInt16 SDRATTR_CIRC_LAST (SDRATTR_CIRCENDANGLE); // 1130 // Only for Interfacing, not yet implemented. / * + * V4 / -constexpr sal_uInt16 SDRATTR_NOTPERSIST_FIRST (SDRATTR_CIRC_LAST + 1); // 1131 -constexpr TypedWhichId SDRATTR_OBJMOVEPROTECT (SDRATTR_NOTPERSIST_FIRST+ 0); // 1131 sal_Bool, def=sal_False -constexpr TypedWhichId SDRATTR_OBJSIZEPROTECT (SDRATTR_NOTPERSIST_FIRST+ 1); // 1132 sal_Bool, def=sal_False -constexpr TypedWhichId SDRATTR_OBJPRINTABLE (SDRATTR_NOTPERSIST_FIRST+ 2); // 1133 sal_Bool, def=sal_True -constexpr TypedWhichId SDRATTR_LAYERID (SDRATTR_NOTPERSIST_FIRST+ 3); // 1134 sal_uInt16, def=0 -constexpr TypedWhichId SDRATTR_LAYERNAME (SDRATTR_NOTPERSIST_FIRST+ 4); // 1135 String, def="" -constexpr TypedWhichId SDRATTR_OBJECTNAME (SDRATTR_NOTPERSIST_FIRST+ 5); // 1136 String, def="" -constexpr TypedWhichId SDRATTR_ALLPOSITIONX (SDRATTR_NOTPERSIST_FIRST+ 6); // 1137 long, def=0 -constexpr TypedWhichId SDRATTR_ALLPOSITIONY (SDRATTR_NOTPERSIST_FIRST+ 7); // 1138 long, def=0 -constexpr TypedWhichId SDRATTR_ALLSIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+ 8); // 1139 long, def=0 -constexpr TypedWhichId SDRATTR_ALLSIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+ 9); // 1140 long, def=0 -constexpr TypedWhichId SDRATTR_ONEPOSITIONX (SDRATTR_NOTPERSIST_FIRST+10); // 1141 long, def=0 -constexpr TypedWhichId SDRATTR_ONEPOSITIONY (SDRATTR_NOTPERSIST_FIRST+11); // 1142 long, def=0 -constexpr TypedWhichId SDRATTR_ONESIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+12); // 1143 long, def=0 -constexpr TypedWhichId SDRATTR_ONESIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+13); // 1144 long, def=0 -constexpr TypedWhichId SDRATTR_LOGICSIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+14); // 1145 long, def=0 -constexpr TypedWhichId SDRATTR_LOGICSIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+15); // 1146 long, def=0 -constexpr TypedWhichId SDRATTR_ROTATEANGLE (SDRATTR_NOTPERSIST_FIRST+16); // 1147 long, def=0 -constexpr TypedWhichId SDRATTR_SHEARANGLE (SDRATTR_NOTPERSIST_FIRST+17); // 1148 long, def=0 -constexpr TypedWhichId SDRATTR_MOVEX (SDRATTR_NOTPERSIST_FIRST+18); // 1149 long, def=0 -constexpr TypedWhichId SDRATTR_MOVEY (SDRATTR_NOTPERSIST_FIRST+19); // 1150 long, def=0 -constexpr TypedWhichId SDRATTR_RESIZEXONE (SDRATTR_NOTPERSIST_FIRST+20); // 1151 long, def=0 -constexpr TypedWhichId SDRATTR_RESIZEYONE (SDRATTR_NOTPERSIST_FIRST+21); // 1152 long, def=0 -constexpr TypedWhichId SDRATTR_ROTATEONE (SDRATTR_NOTPERSIST_FIRST+22); // 1153 long, def=0 -constexpr TypedWhichId SDRATTR_HORZSHEARONE (SDRATTR_NOTPERSIST_FIRST+23); // 1154 long, def=0 -constexpr TypedWhichId SDRATTR_VERTSHEARONE (SDRATTR_NOTPERSIST_FIRST+24); // 1155 long, def=0 -constexpr TypedWhichId SDRATTR_RESIZEXALL (SDRATTR_NOTPERSIST_FIRST+25); // 1156 long, def=0 -constexpr TypedWhichId SDRATTR_RESIZEYALL (SDRATTR_NOTPERSIST_FIRST+26); // 1157 long, def=0 -constexpr TypedWhichId SDRATTR_ROTATEALL (SDRATTR_NOTPERSIST_FIRST+27); // 1158 long, def=0 -constexpr TypedWhichId SDRATTR_HORZSHEARALL (SDRATTR_NOTPERSIST_FIRST+28); // 1159 long, def=0 -constexpr TypedWhichId SDRATTR_VERTSHEARALL (SDRATTR_NOTPERSIST_FIRST+29); // 1160 long, def=0 -constexpr TypedWhichId SDRATTR_TRANSFORMREF1X (SDRATTR_NOTPERSIST_FIRST+30); // 1161 long, def=0 -constexpr TypedWhichId SDRATTR_TRANSFORMREF1Y (SDRATTR_NOTPERSIST_FIRST+31); // 1162 long, def=0 -constexpr TypedWhichId SDRATTR_TRANSFORMREF2X (SDRATTR_NOTPERSIST_FIRST+32); // 1163 long, def=0 -constexpr TypedWhichId SDRATTR_TRANSFORMREF2Y (SDRATTR_NOTPERSIST_FIRST+33); // 1164 long, def=0 -constexpr TypedWhichId SDRATTR_TEXTDIRECTION (SDRATTR_NOTPERSIST_FIRST+34); // 1165 long, def=0 -constexpr TypedWhichId SDRATTR_OBJVISIBLE (SDRATTR_NOTPERSIST_FIRST+35); // 1166 -constexpr sal_uInt16 SDRATTR_NOTPERSIST_LAST (SDRATTR_OBJVISIBLE); // 1166 +inline constexpr sal_uInt16 SDRATTR_NOTPERSIST_FIRST (SDRATTR_CIRC_LAST + 1); // 1131 +inline constexpr TypedWhichId SDRATTR_OBJMOVEPROTECT (SDRATTR_NOTPERSIST_FIRST+ 0); // 1131 sal_Bool, def=sal_False +inline constexpr TypedWhichId SDRATTR_OBJSIZEPROTECT (SDRATTR_NOTPERSIST_FIRST+ 1); // 1132 sal_Bool, def=sal_False +inline constexpr TypedWhichId SDRATTR_OBJPRINTABLE (SDRATTR_NOTPERSIST_FIRST+ 2); // 1133 sal_Bool, def=sal_True +inline constexpr TypedWhichId SDRATTR_LAYERID (SDRATTR_NOTPERSIST_FIRST+ 3); // 1134 sal_uInt16, def=0 +inline constexpr TypedWhichId SDRATTR_LAYERNAME (SDRATTR_NOTPERSIST_FIRST+ 4); // 1135 String, def="" +inline constexpr TypedWhichId SDRATTR_OBJECTNAME (SDRATTR_NOTPERSIST_FIRST+ 5); // 1136 String, def="" +inline constexpr TypedWhichId SDRATTR_ALLPOSITIONX (SDRATTR_NOTPERSIST_FIRST+ 6); // 1137 long, def=0 +inline constexpr TypedWhichId SDRATTR_ALLPOSITIONY (SDRATTR_NOTPERSIST_FIRST+ 7); // 1138 long, def=0 +inline constexpr TypedWhichId SDRATTR_ALLSIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+ 8); // 1139 long, def=0 +inline constexpr TypedWhichId SDRATTR_ALLSIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+ 9); // 1140 long, def=0 +inline constexpr TypedWhichId SDRATTR_ONEPOSITIONX (SDRATTR_NOTPERSIST_FIRST+10); // 1141 long, def=0 +inline constexpr TypedWhichId SDRATTR_ONEPOSITIONY (SDRATTR_NOTPERSIST_FIRST+11); // 1142 long, def=0 +inline constexpr TypedWhichId SDRATTR_ONESIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+12); // 1143 long, def=0 +inline constexpr TypedWhichId SDRATTR_ONESIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+13); // 1144 long, def=0 +inline constexpr TypedWhichId SDRATTR_LOGICSIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+14); // 1145 long, def=0 +inline constexpr TypedWhichId SDRATTR_LOGICSIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+15); // 1146 long, def=0 +inline constexpr TypedWhichId SDRATTR_ROTATEANGLE (SDRATTR_NOTPERSIST_FIRST+16); // 1147 long, def=0 +inline constexpr TypedWhichId SDRATTR_SHEARANGLE (SDRATTR_NOTPERSIST_FIRST+17); // 1148 long, def=0 +inline constexpr TypedWhichId SDRATTR_MOVEX (SDRATTR_NOTPERSIST_FIRST+18); // 1149 long, def=0 +inline constexpr TypedWhichId SDRATTR_MOVEY (SDRATTR_NOTPERSIST_FIRST+19); // 1150 long, def=0 +inline constexpr TypedWhichId SDRATTR_RESIZEXONE (SDRATTR_NOTPERSIST_FIRST+20); // 1151 long, def=0 +inline constexpr TypedWhichId SDRATTR_RESIZEYONE (SDRATTR_NOTPERSIST_FIRST+21); // 1152 long, def=0 +inline constexpr TypedWhichId SDRATTR_ROTATEONE (SDRATTR_NOTPERSIST_FIRST+22); // 1153 long, def=0 +inline constexpr TypedWhichId SDRATTR_HORZSHEARONE (SDRATTR_NOTPERSIST_FIRST+23); // 1154 long, def=0 +inline constexpr TypedWhichId SDRATTR_VERTSHEARONE (SDRATTR_NOTPERSIST_FIRST+24); // 1155 long, def=0 +inline constexpr TypedWhichId SDRATTR_RESIZEXALL (SDRATTR_NOTPERSIST_FIRST+25); // 1156 long, def=0 +inline constexpr TypedWhichId SDRATTR_RESIZEYALL (SDRATTR_NOTPERSIST_FIRST+26); // 1157 long, def=0 +inline constexpr TypedWhichId SDRATTR_ROTATEALL (SDRATTR_NOTPERSIST_FIRST+27); // 1158 long, def=0 +inline constexpr TypedWhichId SDRATTR_HORZSHEARALL (SDRATTR_NOTPERSIST_FIRST+28); // 1159 long, def=0 +inline constexpr TypedWhichId SDRATTR_VERTSHEARALL (SDRATTR_NOTPERSIST_FIRST+29); // 1160 long, def=0 +inline constexpr TypedWhichId SDRATTR_TRANSFORMREF1X (SDRATTR_NOTPERSIST_FIRST+30); // 1161 long, def=0 +inline constexpr TypedWhichId SDRATTR_TRANSFORMREF1Y (SDRATTR_NOTPERSIST_FIRST+31); // 1162 long, def=0 +inline constexpr TypedWhichId SDRATTR_TRANSFORMREF2X (SDRATTR_NOTPERSIST_FIRST+32); // 1163 long, def=0 +inline constexpr TypedWhichId SDRATTR_TRANSFORMREF2Y (SDRATTR_NOTPERSIST_FIRST+33); // 1164 long, def=0 +inline constexpr TypedWhichId SDRATTR_TEXTDIRECTION (SDRATTR_NOTPERSIST_FIRST+34); // 1165 long, def=0 +inline constexpr TypedWhichId SDRATTR_OBJVISIBLE (SDRATTR_NOTPERSIST_FIRST+35); // 1166 +inline constexpr sal_uInt16 SDRATTR_NOTPERSIST_LAST (SDRATTR_OBJVISIBLE); // 1166 // no SetItem for this -constexpr sal_uInt16 SDRATTR_GRAF_FIRST (SDRATTR_NOTPERSIST_LAST+1); // 1167 -constexpr TypedWhichId SDRATTR_GRAFRED (SDRATTR_GRAF_FIRST+0); // 1167 -constexpr TypedWhichId SDRATTR_GRAFGREEN (SDRATTR_GRAF_FIRST+1); // 1168 -constexpr TypedWhichId SDRATTR_GRAFBLUE (SDRATTR_GRAF_FIRST+2); // 1169 -constexpr TypedWhichId SDRATTR_GRAFLUMINANCE (SDRATTR_GRAF_FIRST+3); // 1170 -constexpr TypedWhichId SDRATTR_GRAFCONTRAST (SDRATTR_GRAF_FIRST+4); // 1171 -constexpr TypedWhichId SDRATTR_GRAFGAMMA (SDRATTR_GRAF_FIRST+5); // 1172 -constexpr TypedWhichId SDRATTR_GRAFTRANSPARENCE (SDRATTR_GRAF_FIRST+6); // 1173 -constexpr TypedWhichId SDRATTR_GRAFINVERT (SDRATTR_GRAF_FIRST+7); // 1174 -constexpr TypedWhichId SDRATTR_GRAFMODE (SDRATTR_GRAF_FIRST+8); // 1175 -constexpr TypedWhichId SDRATTR_GRAFCROP (SDRATTR_GRAF_FIRST+9); // 1176 -constexpr sal_uInt16 SDRATTR_GRAF_LAST (SDRATTR_GRAFCROP); // 1176 +inline constexpr sal_uInt16 SDRATTR_GRAF_FIRST (SDRATTR_NOTPERSIST_LAST+1); // 1167 +inline constexpr TypedWhichId SDRATTR_GRAFRED (SDRATTR_GRAF_FIRST+0); // 1167 +inline constexpr TypedWhichId SDRATTR_GRAFGREEN (SDRATTR_GRAF_FIRST+1); // 1168 +inline constexpr TypedWhichId SDRATTR_GRAFBLUE (SDRATTR_GRAF_FIRST+2); // 1169 +inline constexpr TypedWhichId SDRATTR_GRAFLUMINANCE (SDRATTR_GRAF_FIRST+3); // 1170 +inline constexpr TypedWhichId SDRATTR_GRAFCONTRAST (SDRATTR_GRAF_FIRST+4); // 1171 +inline constexpr TypedWhichId SDRATTR_GRAFGAMMA (SDRATTR_GRAF_FIRST+5); // 1172 +inline constexpr TypedWhichId SDRATTR_GRAFTRANSPARENCE (SDRATTR_GRAF_FIRST+6); // 1173 +inline constexpr TypedWhichId SDRATTR_GRAFINVERT (SDRATTR_GRAF_FIRST+7); // 1174 +inline constexpr TypedWhichId SDRATTR_GRAFMODE (SDRATTR_GRAF_FIRST+8); // 1175 +inline constexpr TypedWhichId SDRATTR_GRAFCROP (SDRATTR_GRAF_FIRST+9); // 1176 +inline constexpr sal_uInt16 SDRATTR_GRAF_LAST (SDRATTR_GRAFCROP); // 1176 -constexpr sal_uInt16 SDRATTR_3D_FIRST (SDRATTR_GRAF_LAST + 1); // 1177 +inline constexpr sal_uInt16 SDRATTR_3D_FIRST (SDRATTR_GRAF_LAST + 1); // 1177 -constexpr sal_uInt16 SDRATTR_3DOBJ_FIRST (SDRATTR_3D_FIRST); // 1177 -constexpr TypedWhichId SDRATTR_3DOBJ_PERCENT_DIAGONAL (SDRATTR_3DOBJ_FIRST + 0); // 1177 -constexpr TypedWhichId SDRATTR_3DOBJ_BACKSCALE (SDRATTR_3DOBJ_FIRST + 1); // 1178 -constexpr TypedWhichId SDRATTR_3DOBJ_DEPTH (SDRATTR_3DOBJ_FIRST + 2); // 1179 -constexpr TypedWhichId SDRATTR_3DOBJ_HORZ_SEGS (SDRATTR_3DOBJ_FIRST + 3); // 1180 -constexpr TypedWhichId SDRATTR_3DOBJ_VERT_SEGS (SDRATTR_3DOBJ_FIRST + 4); // 1181 -constexpr TypedWhichId SDRATTR_3DOBJ_END_ANGLE (SDRATTR_3DOBJ_FIRST + 5); // 1182 -constexpr TypedWhichId SDRATTR_3DOBJ_DOUBLE_SIDED (SDRATTR_3DOBJ_FIRST + 6); // 1183 -constexpr TypedWhichId SDRATTR_3DOBJ_NORMALS_KIND (SDRATTR_3DOBJ_FIRST + 7); // 1184 -constexpr TypedWhichId SDRATTR_3DOBJ_NORMALS_INVERT (SDRATTR_3DOBJ_FIRST + 8); // 1185 -constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_PROJ_X (SDRATTR_3DOBJ_FIRST + 9); // 1186 -constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_PROJ_Y (SDRATTR_3DOBJ_FIRST + 10); // 1187 -constexpr TypedWhichId SDRATTR_3DOBJ_SHADOW_3D (SDRATTR_3DOBJ_FIRST + 11); // 1188 -constexpr TypedWhichId SDRATTR_3DOBJ_MAT_COLOR (SDRATTR_3DOBJ_FIRST + 12); // 1189 -constexpr TypedWhichId SDRATTR_3DOBJ_MAT_EMISSION (SDRATTR_3DOBJ_FIRST + 13); // 1190 -constexpr TypedWhichId SDRATTR_3DOBJ_MAT_SPECULAR (SDRATTR_3DOBJ_FIRST + 14); // 1191 -constexpr TypedWhichId SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY (SDRATTR_3DOBJ_FIRST + 15); // 1192 -constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_KIND (SDRATTR_3DOBJ_FIRST + 16); // 1193 -constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_MODE (SDRATTR_3DOBJ_FIRST + 17); // 1194 -constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_FILTER (SDRATTR_3DOBJ_FIRST + 18); // 1195 +inline constexpr sal_uInt16 SDRATTR_3DOBJ_FIRST (SDRATTR_3D_FIRST); // 1177 +inline constexpr TypedWhichId SDRATTR_3DOBJ_PERCENT_DIAGONAL (SDRATTR_3DOBJ_FIRST + 0); // 1177 +inline constexpr TypedWhichId SDRATTR_3DOBJ_BACKSCALE (SDRATTR_3DOBJ_FIRST + 1); // 1178 +inline constexpr TypedWhichId SDRATTR_3DOBJ_DEPTH (SDRATTR_3DOBJ_FIRST + 2); // 1179 +inline constexpr TypedWhichId SDRATTR_3DOBJ_HORZ_SEGS (SDRATTR_3DOBJ_FIRST + 3); // 1180 +inline constexpr TypedWhichId SDRATTR_3DOBJ_VERT_SEGS (SDRATTR_3DOBJ_FIRST + 4); // 1181 +inline constexpr TypedWhichId SDRATTR_3DOBJ_END_ANGLE (SDRATTR_3DOBJ_FIRST + 5); // 1182 +inline constexpr TypedWhichId SDRATTR_3DOBJ_DOUBLE_SIDED (SDRATTR_3DOBJ_FIRST + 6); // 1183 +inline constexpr TypedWhichId SDRATTR_3DOBJ_NORMALS_KIND (SDRATTR_3DOBJ_FIRST + 7); // 1184 +inline constexpr TypedWhichId SDRATTR_3DOBJ_NORMALS_INVERT (SDRATTR_3DOBJ_FIRST + 8); // 1185 +inline constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_PROJ_X (SDRATTR_3DOBJ_FIRST + 9); // 1186 +inline constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_PROJ_Y (SDRATTR_3DOBJ_FIRST + 10); // 1187 +inline constexpr TypedWhichId SDRATTR_3DOBJ_SHADOW_3D (SDRATTR_3DOBJ_FIRST + 11); // 1188 +inline constexpr TypedWhichId SDRATTR_3DOBJ_MAT_COLOR (SDRATTR_3DOBJ_FIRST + 12); // 1189 +inline constexpr TypedWhichId SDRATTR_3DOBJ_MAT_EMISSION (SDRATTR_3DOBJ_FIRST + 13); // 1190 +inline constexpr TypedWhichId SDRATTR_3DOBJ_MAT_SPECULAR (SDRATTR_3DOBJ_FIRST + 14); // 1191 +inline constexpr TypedWhichId SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY (SDRATTR_3DOBJ_FIRST + 15); // 1192 +inline constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_KIND (SDRATTR_3DOBJ_FIRST + 16); // 1193 +inline constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_MODE (SDRATTR_3DOBJ_FIRST + 17); // 1194 +inline constexpr TypedWhichId SDRATTR_3DOBJ_TEXTURE_FILTER (SDRATTR_3DOBJ_FIRST + 18); // 1195 // #107245# New items for 3d objects use former range SDRATTR_3DOBJ_RESERVED_01 // up to SDRATTR_3DOBJ_RESERVED_05 -constexpr TypedWhichId SDRATTR_3DOBJ_SMOOTH_NORMALS (SDRATTR_3DOBJ_FIRST + 19); // 1196 -constexpr TypedWhichId SDRATTR_3DOBJ_SMOOTH_LIDS (SDRATTR_3DOBJ_FIRST + 20); // 1197 -constexpr TypedWhichId SDRATTR_3DOBJ_CHARACTER_MODE (SDRATTR_3DOBJ_FIRST + 21); // 1198 -constexpr TypedWhichId SDRATTR_3DOBJ_CLOSE_FRONT (SDRATTR_3DOBJ_FIRST + 22); // 1199 -constexpr TypedWhichId SDRATTR_3DOBJ_CLOSE_BACK (SDRATTR_3DOBJ_FIRST + 23); // 1200 +inline constexpr TypedWhichId SDRATTR_3DOBJ_SMOOTH_NORMALS (SDRATTR_3DOBJ_FIRST + 19); // 1196 +inline constexpr TypedWhichId SDRATTR_3DOBJ_SMOOTH_LIDS (SDRATTR_3DOBJ_FIRST + 20); // 1197 +inline constexpr TypedWhichId SDRATTR_3DOBJ_CHARACTER_MODE (SDRATTR_3DOBJ_FIRST + 21); // 1198 +inline constexpr TypedWhichId SDRATTR_3DOBJ_CLOSE_FRONT (SDRATTR_3DOBJ_FIRST + 22); // 1199 +inline constexpr TypedWhichId SDRATTR_3DOBJ_CLOSE_BACK (SDRATTR_3DOBJ_FIRST + 23); // 1200 // #i28528# // Added extra Item (Bool) for chart2 to be able to show reduced line geometry -constexpr TypedWhichId SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY (SDRATTR_3DOBJ_FIRST + 24); // 1201 +inline constexpr TypedWhichId SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY (SDRATTR_3DOBJ_FIRST + 24); // 1201 -constexpr sal_uInt16 SDRATTR_3DOBJ_LAST (SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY); // 1201 +inline constexpr sal_uInt16 SDRATTR_3DOBJ_LAST (SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY); // 1201 -constexpr sal_uInt16 SDRATTR_3DSCENE_FIRST (SDRATTR_3DOBJ_LAST + 1); // 1202 -constexpr TypedWhichId SDRATTR_3DSCENE_PERSPECTIVE (SDRATTR_3DSCENE_FIRST + 0); // 1202 -constexpr TypedWhichId SDRATTR_3DSCENE_DISTANCE (SDRATTR_3DSCENE_FIRST + 1); // 1203 -constexpr TypedWhichId SDRATTR_3DSCENE_FOCAL_LENGTH (SDRATTR_3DSCENE_FIRST + 2); // 1204 -constexpr TypedWhichId SDRATTR_3DSCENE_TWO_SIDED_LIGHTING (SDRATTR_3DSCENE_FIRST + 3); // 1205 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_1 (SDRATTR_3DSCENE_FIRST + 4); // 1206 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_2 (SDRATTR_3DSCENE_FIRST + 5); // 1207 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_3 (SDRATTR_3DSCENE_FIRST + 6); // 1208 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_4 (SDRATTR_3DSCENE_FIRST + 7); // 1209 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_5 (SDRATTR_3DSCENE_FIRST + 8); // 1210 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_6 (SDRATTR_3DSCENE_FIRST + 9); // 1211 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_7 (SDRATTR_3DSCENE_FIRST + 10); // 1212 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_8 (SDRATTR_3DSCENE_FIRST + 11); // 1213 -constexpr TypedWhichId SDRATTR_3DSCENE_AMBIENTCOLOR (SDRATTR_3DSCENE_FIRST + 12); // 1214 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_1 (SDRATTR_3DSCENE_FIRST + 13); // 1215 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_2 (SDRATTR_3DSCENE_FIRST + 14); // 1216 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_3 (SDRATTR_3DSCENE_FIRST + 15); // 1217 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_4 (SDRATTR_3DSCENE_FIRST + 16); // 1218 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_5 (SDRATTR_3DSCENE_FIRST + 17); // 1219 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_6 (SDRATTR_3DSCENE_FIRST + 18); // 1220 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_7 (SDRATTR_3DSCENE_FIRST + 19); // 1221 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_8 (SDRATTR_3DSCENE_FIRST + 20); // 1222 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_1 (SDRATTR_3DSCENE_FIRST + 21); // 1223 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_2 (SDRATTR_3DSCENE_FIRST + 22); // 1224 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_3 (SDRATTR_3DSCENE_FIRST + 23); // 1225 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_4 (SDRATTR_3DSCENE_FIRST + 24); // 1226 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_5 (SDRATTR_3DSCENE_FIRST + 25); // 1227 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_6 (SDRATTR_3DSCENE_FIRST + 26); // 1228 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_7 (SDRATTR_3DSCENE_FIRST + 27); // 1229 -constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_8 (SDRATTR_3DSCENE_FIRST + 28); // 1230 -constexpr TypedWhichId SDRATTR_3DSCENE_SHADOW_SLANT (SDRATTR_3DSCENE_FIRST + 29); // 1231 -constexpr TypedWhichId SDRATTR_3DSCENE_SHADE_MODE (SDRATTR_3DSCENE_FIRST + 30); // 1232 -constexpr sal_uInt16 SDRATTR_3DSCENE_LAST (SDRATTR_3DSCENE_SHADE_MODE); // 1232 -constexpr sal_uInt16 SDRATTR_3D_LAST (SDRATTR_3DSCENE_LAST); // 1232 +inline constexpr sal_uInt16 SDRATTR_3DSCENE_FIRST (SDRATTR_3DOBJ_LAST + 1); // 1202 +inline constexpr TypedWhichId SDRATTR_3DSCENE_PERSPECTIVE (SDRATTR_3DSCENE_FIRST + 0); // 1202 +inline constexpr TypedWhichId SDRATTR_3DSCENE_DISTANCE (SDRATTR_3DSCENE_FIRST + 1); // 1203 +inline constexpr TypedWhichId SDRATTR_3DSCENE_FOCAL_LENGTH (SDRATTR_3DSCENE_FIRST + 2); // 1204 +inline constexpr TypedWhichId SDRATTR_3DSCENE_TWO_SIDED_LIGHTING (SDRATTR_3DSCENE_FIRST + 3); // 1205 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_1 (SDRATTR_3DSCENE_FIRST + 4); // 1206 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_2 (SDRATTR_3DSCENE_FIRST + 5); // 1207 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_3 (SDRATTR_3DSCENE_FIRST + 6); // 1208 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_4 (SDRATTR_3DSCENE_FIRST + 7); // 1209 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_5 (SDRATTR_3DSCENE_FIRST + 8); // 1210 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_6 (SDRATTR_3DSCENE_FIRST + 9); // 1211 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_7 (SDRATTR_3DSCENE_FIRST + 10); // 1212 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTCOLOR_8 (SDRATTR_3DSCENE_FIRST + 11); // 1213 +inline constexpr TypedWhichId SDRATTR_3DSCENE_AMBIENTCOLOR (SDRATTR_3DSCENE_FIRST + 12); // 1214 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_1 (SDRATTR_3DSCENE_FIRST + 13); // 1215 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_2 (SDRATTR_3DSCENE_FIRST + 14); // 1216 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_3 (SDRATTR_3DSCENE_FIRST + 15); // 1217 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_4 (SDRATTR_3DSCENE_FIRST + 16); // 1218 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_5 (SDRATTR_3DSCENE_FIRST + 17); // 1219 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_6 (SDRATTR_3DSCENE_FIRST + 18); // 1220 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_7 (SDRATTR_3DSCENE_FIRST + 19); // 1221 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTON_8 (SDRATTR_3DSCENE_FIRST + 20); // 1222 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_1 (SDRATTR_3DSCENE_FIRST + 21); // 1223 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_2 (SDRATTR_3DSCENE_FIRST + 22); // 1224 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_3 (SDRATTR_3DSCENE_FIRST + 23); // 1225 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_4 (SDRATTR_3DSCENE_FIRST + 24); // 1226 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_5 (SDRATTR_3DSCENE_FIRST + 25); // 1227 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_6 (SDRATTR_3DSCENE_FIRST + 26); // 1228 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_7 (SDRATTR_3DSCENE_FIRST + 27); // 1229 +inline constexpr TypedWhichId SDRATTR_3DSCENE_LIGHTDIRECTION_8 (SDRATTR_3DSCENE_FIRST + 28); // 1230 +inline constexpr TypedWhichId SDRATTR_3DSCENE_SHADOW_SLANT (SDRATTR_3DSCENE_FIRST + 29); // 1231 +inline constexpr TypedWhichId SDRATTR_3DSCENE_SHADE_MODE (SDRATTR_3DSCENE_FIRST + 30); // 1232 +inline constexpr sal_uInt16 SDRATTR_3DSCENE_LAST (SDRATTR_3DSCENE_SHADE_MODE); // 1232 +inline constexpr sal_uInt16 SDRATTR_3D_LAST (SDRATTR_3DSCENE_LAST); // 1232 -constexpr sal_uInt16 SDRATTR_CUSTOMSHAPE_FIRST (SDRATTR_3D_LAST + 1); // 1233 -constexpr TypedWhichId SDRATTR_CUSTOMSHAPE_ENGINE (SDRATTR_CUSTOMSHAPE_FIRST + 0); // 1233 -constexpr TypedWhichId SDRATTR_CUSTOMSHAPE_DATA (SDRATTR_CUSTOMSHAPE_FIRST + 1); // 1234 -constexpr TypedWhichId SDRATTR_CUSTOMSHAPE_GEOMETRY (SDRATTR_CUSTOMSHAPE_FIRST + 2); // 1235 -constexpr sal_uInt16 SDRATTR_CUSTOMSHAPE_LAST (SDRATTR_CUSTOMSHAPE_GEOMETRY); // 1235 +inline constexpr sal_uInt16 SDRATTR_CUSTOMSHAPE_FIRST (SDRATTR_3D_LAST + 1); // 1233 +inline constexpr TypedWhichId SDRATTR_CUSTOMSHAPE_ENGINE (SDRATTR_CUSTOMSHAPE_FIRST + 0); // 1233 +inline constexpr TypedWhichId SDRATTR_CUSTOMSHAPE_DATA (SDRATTR_CUSTOMSHAPE_FIRST + 1); // 1234 +inline constexpr TypedWhichId SDRATTR_CUSTOMSHAPE_GEOMETRY (SDRATTR_CUSTOMSHAPE_FIRST + 2); // 1235 +inline constexpr sal_uInt16 SDRATTR_CUSTOMSHAPE_LAST (SDRATTR_CUSTOMSHAPE_GEOMETRY); // 1235 -constexpr sal_uInt16 SDRATTR_TABLE_FIRST (SDRATTR_CUSTOMSHAPE_LAST+1); // 1236 -constexpr TypedWhichId SDRATTR_TABLE_BORDER (SDRATTR_TABLE_FIRST+0); // 1236 -constexpr TypedWhichId SDRATTR_TABLE_BORDER_INNER (SDRATTR_TABLE_FIRST+1); // 1237 -constexpr TypedWhichId SDRATTR_TABLE_BORDER_TLBR (SDRATTR_TABLE_FIRST+2); // 1238 -constexpr TypedWhichId SDRATTR_TABLE_BORDER_BLTR (SDRATTR_TABLE_FIRST+3); // 1239 -constexpr TypedWhichId SDRATTR_TABLE_TEXT_ROTATION (SDRATTR_TABLE_FIRST+4); // 1240 -constexpr TypedWhichId SDRATTR_TABLE_CELL_GRABBAG (SDRATTR_TABLE_FIRST+5); // 1241 -constexpr sal_uInt16 SDRATTR_TABLE_LAST (SDRATTR_TABLE_CELL_GRABBAG); // 1241 +inline constexpr sal_uInt16 SDRATTR_TABLE_FIRST (SDRATTR_CUSTOMSHAPE_LAST+1); // 1236 +inline constexpr TypedWhichId SDRATTR_TABLE_BORDER (SDRATTR_TABLE_FIRST+0); // 1236 +inline constexpr TypedWhichId SDRATTR_TABLE_BORDER_INNER (SDRATTR_TABLE_FIRST+1); // 1237 +inline constexpr TypedWhichId SDRATTR_TABLE_BORDER_TLBR (SDRATTR_TABLE_FIRST+2); // 1238 +inline constexpr TypedWhichId SDRATTR_TABLE_BORDER_BLTR (SDRATTR_TABLE_FIRST+3); // 1239 +inline constexpr TypedWhichId SDRATTR_TABLE_TEXT_ROTATION (SDRATTR_TABLE_FIRST+4); // 1240 +inline constexpr TypedWhichId SDRATTR_TABLE_CELL_GRABBAG (SDRATTR_TABLE_FIRST+5); // 1241 +inline constexpr sal_uInt16 SDRATTR_TABLE_LAST (SDRATTR_TABLE_CELL_GRABBAG); // 1241 -constexpr sal_uInt16 SDRATTR_GLOW_FIRST (SDRATTR_TABLE_LAST+1); // 1242 -constexpr TypedWhichId SDRATTR_GLOW_RADIUS(SDRATTR_GLOW_FIRST+0); // 1242 -constexpr TypedWhichId SDRATTR_GLOW_COLOR (SDRATTR_GLOW_FIRST+1); // 1243 -constexpr TypedWhichId SDRATTR_GLOW_TRANSPARENCY(SDRATTR_GLOW_FIRST+2); // 1244 -constexpr sal_uInt16 SDRATTR_GLOW_LAST(SDRATTR_GLOW_TRANSPARENCY); // 1244 +inline constexpr sal_uInt16 SDRATTR_GLOW_FIRST (SDRATTR_TABLE_LAST+1); // 1242 +inline constexpr TypedWhichId SDRATTR_GLOW_RADIUS(SDRATTR_GLOW_FIRST+0); // 1242 +inline constexpr TypedWhichId SDRATTR_GLOW_COLOR (SDRATTR_GLOW_FIRST+1); // 1243 +inline constexpr TypedWhichId SDRATTR_GLOW_TRANSPARENCY(SDRATTR_GLOW_FIRST+2); // 1244 +inline constexpr sal_uInt16 SDRATTR_GLOW_LAST(SDRATTR_GLOW_TRANSPARENCY); // 1244 -constexpr sal_uInt16 SDRATTR_SOFTEDGE_FIRST(SDRATTR_GLOW_LAST+1); // 1245 -constexpr TypedWhichId SDRATTR_SOFTEDGE_RADIUS(SDRATTR_SOFTEDGE_FIRST+0); // 1245 -constexpr sal_uInt16 SDRATTR_SOFTEDGE_LAST(SDRATTR_SOFTEDGE_RADIUS); // 1245 +inline constexpr sal_uInt16 SDRATTR_SOFTEDGE_FIRST(SDRATTR_GLOW_LAST+1); // 1245 +inline constexpr TypedWhichId SDRATTR_SOFTEDGE_RADIUS(SDRATTR_SOFTEDGE_FIRST+0); // 1245 +inline constexpr sal_uInt16 SDRATTR_SOFTEDGE_LAST(SDRATTR_SOFTEDGE_RADIUS); // 1245 -constexpr sal_uInt16 SDRATTR_GLOW_TEXT_FIRST(SDRATTR_SOFTEDGE_LAST+1); // 1246 -constexpr TypedWhichId SDRATTR_GLOW_TEXT_RADIUS(SDRATTR_GLOW_TEXT_FIRST+0); // 1246 -constexpr TypedWhichId SDRATTR_GLOW_TEXT_COLOR(SDRATTR_GLOW_TEXT_FIRST+1); // 1247 -constexpr TypedWhichId SDRATTR_GLOW_TEXT_TRANSPARENCY(SDRATTR_GLOW_TEXT_FIRST+2);// 1248 -constexpr sal_uInt16 SDRATTR_GLOW_TEXT_LAST(SDRATTR_GLOW_TEXT_TRANSPARENCY); // 1248 +inline constexpr sal_uInt16 SDRATTR_GLOW_TEXT_FIRST(SDRATTR_SOFTEDGE_LAST+1); // 1246 +inline constexpr TypedWhichId SDRATTR_GLOW_TEXT_RADIUS(SDRATTR_GLOW_TEXT_FIRST+0); // 1246 +inline constexpr TypedWhichId SDRATTR_GLOW_TEXT_COLOR(SDRATTR_GLOW_TEXT_FIRST+1); // 1247 +inline constexpr TypedWhichId SDRATTR_GLOW_TEXT_TRANSPARENCY(SDRATTR_GLOW_TEXT_FIRST+2);// 1248 +inline constexpr sal_uInt16 SDRATTR_GLOW_TEXT_LAST(SDRATTR_GLOW_TEXT_TRANSPARENCY); // 1248 -constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_FIRST(SDRATTR_GLOW_TEXT_LAST+1); // 1249 -constexpr TypedWhichId SDRATTR_TEXTCOLUMNS_NUMBER(SDRATTR_TEXTCOLUMNS_FIRST+0); // 1249 -constexpr TypedWhichId SDRATTR_TEXTCOLUMNS_SPACING(SDRATTR_TEXTCOLUMNS_FIRST+1); // 1250 -constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_LAST(SDRATTR_TEXTCOLUMNS_SPACING); // 1250 +inline constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_FIRST(SDRATTR_GLOW_TEXT_LAST+1); // 1249 +inline constexpr TypedWhichId SDRATTR_TEXTCOLUMNS_NUMBER(SDRATTR_TEXTCOLUMNS_FIRST+0); // 1249 +inline constexpr TypedWhichId SDRATTR_TEXTCOLUMNS_SPACING(SDRATTR_TEXTCOLUMNS_FIRST+1); // 1250 +inline constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_LAST(SDRATTR_TEXTCOLUMNS_SPACING); // 1250 -constexpr sal_uInt16 SDRATTR_WRITINGMODE2_FIRST(SDRATTR_TEXTCOLUMNS_LAST+1);// 1251 -constexpr TypedWhichId SDRATTR_WRITINGMODE2(SDRATTR_WRITINGMODE2_FIRST+0); // 1251 -constexpr sal_uInt16 SDRATTR_WRITINGMODE2_LAST(SDRATTR_WRITINGMODE2); // 1251 +inline constexpr sal_uInt16 SDRATTR_WRITINGMODE2_FIRST(SDRATTR_TEXTCOLUMNS_LAST+1);// 1251 +inline constexpr TypedWhichId SDRATTR_WRITINGMODE2(SDRATTR_WRITINGMODE2_FIRST+0); // 1251 +inline constexpr sal_uInt16 SDRATTR_WRITINGMODE2_LAST(SDRATTR_WRITINGMODE2); // 1251 -constexpr sal_uInt16 SDRATTR_EDGEOOXMLCURVE_FIRST(SDRATTR_WRITINGMODE2_LAST+1);// 1252 -constexpr TypedWhichId SDRATTR_EDGEOOXMLCURVE(SDRATTR_EDGEOOXMLCURVE_FIRST+0); // 1252 -constexpr sal_uInt16 SDRATTR_EDGEOOXMLCURVE_LAST(SDRATTR_EDGEOOXMLCURVE); // 1252 +inline constexpr sal_uInt16 SDRATTR_EDGEOOXMLCURVE_FIRST(SDRATTR_WRITINGMODE2_LAST+1);// 1252 +inline constexpr TypedWhichId SDRATTR_EDGEOOXMLCURVE(SDRATTR_EDGEOOXMLCURVE_FIRST+0); // 1252 +inline constexpr sal_uInt16 SDRATTR_EDGEOOXMLCURVE_LAST(SDRATTR_EDGEOOXMLCURVE); // 1252 -constexpr sal_uInt16 SDRATTR_END (SDRATTR_EDGEOOXMLCURVE_LAST); // 1252 +inline constexpr sal_uInt16 SDRATTR_END (SDRATTR_EDGEOOXMLCURVE_LAST); // 1252 #endif // INCLUDED_SVX_SVDDEF_HXX From eecd78825061fb1ad51528b44cae96e559e88da8 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 22 Nov 2024 13:38:08 +0500 Subject: [PATCH 100/373] ReqIF: avoid 'type' attribute in 'ul' elements Change-Id: I028737cac0b89344be5df55f9b60046230603979 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176987 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- .../extras/htmlexport/data/ul_with_disc.fodt | 23 ++++++++++++ sw/qa/extras/htmlexport/htmlexport.cxx | 14 ++++++++ sw/source/filter/html/htmlnumwriter.cxx | 35 ++++++++++--------- 3 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 sw/qa/extras/htmlexport/data/ul_with_disc.fodt diff --git a/sw/qa/extras/htmlexport/data/ul_with_disc.fodt b/sw/qa/extras/htmlexport/data/ul_with_disc.fodt new file mode 100644 index 000000000000..b41da841cf61 --- /dev/null +++ b/sw/qa/extras/htmlexport/data/ul_with_disc.fodt @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + list header + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index a20b11ec41ef..8dbb4cff6a14 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1581,6 +1581,20 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedJPGShapeDirectly) assertXPath(pXmlDoc, "//reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:object", "type", u"image/png"); } + +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifNoTypeInUL) +{ + // Given a document with an unordered list: + createSwDoc("ul_with_disc.fodt"); + + // When exporting to XHTML: + ExportToReqif(); + + // Check that 'ul' element has no 'type' attribute + xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); + // Without the accompanying fix in place, this test would have failed + assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:ul/reqif-xhtml:li/reqif-xhtml:ul", "type"); +} } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index 046747754a38..7f09fd8ce8cc 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -187,24 +187,27 @@ SwHTMLWriter& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, // unordered list:
      sOut += OOO_STRING_SVTOOLS_HTML_unorderlist; - // determine the type by the bullet character - const char *pStr = nullptr; - switch( rNumFormat.GetBulletChar() ) + if (!rWrt.mbReqIF) // No 'type' attribute in ReqIF { - case HTML_BULLETCHAR_DISC: - pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_disc; - break; - case HTML_BULLETCHAR_CIRCLE: - pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_circle; - break; - case HTML_BULLETCHAR_SQUARE: - pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_square; - break; - } + // determine the type by the bullet character + const char* pStr = nullptr; + switch (rNumFormat.GetBulletChar()) + { + case HTML_BULLETCHAR_DISC: + pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_disc; + break; + case HTML_BULLETCHAR_CIRCLE: + pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_circle; + break; + case HTML_BULLETCHAR_SQUARE: + pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_square; + break; + } - if( pStr ) - { - sOut += OString::Concat(" " OOO_STRING_SVTOOLS_HTML_O_type "=\"") + pStr + "\""; + if (pStr) + { + sOut += OString::Concat(" " OOO_STRING_SVTOOLS_HTML_O_type "=\"") + pStr + "\""; + } } } else if( SVX_NUM_BITMAP == eType ) From 05565fc05798535e1771e97105e5fde660f2d1dd Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Fri, 22 Nov 2024 12:39:59 +0100 Subject: [PATCH 101/373] Update git submodules * Update helpcontent2 from branch 'master' to a6f1acf9c43c6d2de0de9d8d3e3fad2c849f1278 - Mute L10n on Change-Id: I268936d73e67b2108f92f1fa2bb2dbcb28955277 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/176975 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index 4eb5edf36d5b..a6f1acf9c43c 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 4eb5edf36d5bfa7f1dc90c09623086ade07b97b5 +Subproject commit a6f1acf9c43c6d2de0de9d8d3e3fad2c849f1278 From a3aa8acfede5adaaf5f8b783e826bac961a0f8e0 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Fri, 22 Nov 2024 08:50:37 -0300 Subject: [PATCH 102/373] Update git submodules * Update helpcontent2 from branch 'master' to 143fba581c7499e9e36971e52e18bada4a262be1 - Revisit Writer Navigator Help page. Change-Id: I1bdc2fe094bcc3d75d5e1442af458f018ee60f81 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/176973 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index a6f1acf9c43c..143fba581c74 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit a6f1acf9c43c6d2de0de9d8d3e3fad2c849f1278 +Subproject commit 143fba581c7499e9e36971e52e18bada4a262be1 From b1ce30df8b15de984209154df7f2710930fa8a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Thu, 7 Nov 2024 14:29:02 +0100 Subject: [PATCH 103/373] pdf: add initial test for PDF 2.0 (check using PDFium) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I43e6048d34ee9c51e0602cd671a73b19145a9c17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176888 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index ed035f6f8fb9..38e2109d3ef8 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -731,6 +731,46 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testVersion15) CPPUNIT_ASSERT_EQUAL(15, nFileVersion); } +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testVersion20) +{ + // Create an empty document. + mxComponent = loadFromDesktop("private:factory/swriter"); + + // Save as PDF. + uno::Reference xStorable(mxComponent, uno::UNO_QUERY); + uno::Sequence aFilterData = comphelper::InitPropertySequence( + { { "SelectPdfVersion", uno::Any(static_cast(20)) } }); + aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + aMediaDescriptor["FilterData"] <<= aFilterData; + xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + + // Parse the export result. + std::unique_ptr pPdfDocument = parsePDFExport(); + int nFileVersion = pPdfDocument->getFileVersion(); + CPPUNIT_ASSERT_EQUAL(20, nFileVersion); +} + +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testEncryptionRoundtrip) +{ + mxComponent = loadFromDesktop("private:factory/swriter"); + + // Save PDF + uno::Reference xStorable(mxComponent, uno::UNO_QUERY); + aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + uno::Sequence aFilterData = comphelper::InitPropertySequence( + { { "SelectPdfVersion", uno::Any(sal_Int32(20)) }, + { "EncryptFile", uno::Any(true) }, + { "DocumentOpenPassword", uno::Any(u"secret"_ustr) } }); + aMediaDescriptor["FilterData"] <<= aFilterData; + xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + + // Load the exported result in PDFium + std::unique_ptr pPdfDocument = parsePDFExport("secret"_ostr); + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); + int nFileVersion = pPdfDocument->getFileVersion(); + CPPUNIT_ASSERT_EQUAL(20, nFileVersion); +} + // Check round-trip of importing and exporting the PDF with PDFium filter, // which imports the PDF document as multiple PDFs as graphic object. // Each page in the document has one PDF graphic object which content is From 2088e585b6f7da1092fdede73d263854a01929d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Thu, 7 Nov 2024 14:35:18 +0100 Subject: [PATCH 104/373] pdf: move stream/string encryption into PDFEncryptor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie710e51faa7d65686d72a03d1ef4ca40dff8c27e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176889 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/inc/pdf/PDFEncryptor.hxx | 26 +++++++++++++++--- vcl/inc/pdf/pdfwriter_impl.hxx | 3 +-- vcl/source/gdi/pdfwriter_impl.cxx | 7 +++-- vcl/source/gdi/pdfwriter_impl2.cxx | 42 +++++++++--------------------- vcl/source/pdf/PDFEncryptor.cxx | 33 +++++++++++++++++++++++ 5 files changed, 72 insertions(+), 39 deletions(-) diff --git a/vcl/inc/pdf/PDFEncryptor.hxx b/vcl/inc/pdf/PDFEncryptor.hxx index dca2255139e8..a5fc3a17c054 100644 --- a/vcl/inc/pdf/PDFEncryptor.hxx +++ b/vcl/inc/pdf/PDFEncryptor.hxx @@ -12,16 +12,22 @@ #include #include -#include +#include +#include namespace vcl { struct PDFEncryptionProperties; } + namespace com::sun::star::beans { class XMaterialHolder; } +namespace com::sun::star::uno +{ +template class Reference; +} namespace vcl::pdf { @@ -38,6 +44,10 @@ private: sal_Int32 m_nKeyLength = 0; // key length, 16 or 5 sal_Int32 m_nRC4KeyLength = 0; // key length, 16 or 10, to be input to the algorithm 3.1 + + /* set to true if the following stream must be encrypted, used inside writeBuffer() */ + bool m_bEncryptThisStream = false; + public: PDFEncryptor(); ~PDFEncryptor(); @@ -45,19 +55,27 @@ public: /* used to cipher the stream data and for password management */ rtlCipher m_aCipher = nullptr; - /* set to true if the following stream must be encrypted, used inside writeBuffer() */ - bool m_bEncryptThisStream = false; - sal_Int32 getAccessPermissions() { return m_nAccessPermissions; } sal_Int32 getKeyLength() { return m_nKeyLength; } sal_Int32 getRC4KeyLength() { return m_nRC4KeyLength; } static css::uno::Reference initEncryption(const OUString& i_rOwnerPassword, const OUString& i_rUserPassword); + virtual bool prepareEncryption( const css::uno::Reference& xEncryptionMaterialHolder, PDFEncryptionProperties& rProperties); + void setupKeysAndCheck(PDFEncryptionProperties& rProperties); + + void setupEncryption(std::vector const& rEncryptionKey, sal_Int32 nObject); + void enableStreamEncryption(); + void disableStreamEncryption(); + + bool isStreamEncryptionEnabled() { return m_bEncryptThisStream; } + + void encrypt(const void* pInput, sal_uInt64 nInputSize, sal_uInt8* pOutput, + sal_uInt64 nOutputsSize); }; } diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index 82a04137942f..88267ed4b9f4 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -852,10 +852,9 @@ private: void addRoleMap(const OString& aAlias, PDFWriter::StructElement eType); - /* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */ void checkAndEnableStreamEncryption( sal_Int32 nObject ) override; - void disableStreamEncryption() override { m_aPDFEncryptor.m_bEncryptThisStream = false; } + void disableStreamEncryption() override; /* */ void enableStringEncryption( sal_Int32 nObject ); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index f86962425fb6..2641256b30c4 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1737,14 +1737,13 @@ bool PDFWriterImpl::writeBufferBytes( const void* pBuffer, sal_uInt64 nBytes ) } else { - if (m_aPDFEncryptor.m_bEncryptThisStream) + if (m_aPDFEncryptor.isStreamEncryptionEnabled()) { - /* implement the encryption part of the PDF spec encryption algorithm 3.1 */ m_vEncryptionBuffer.resize(nBytes); - rtl_cipher_encodeARCFOUR(m_aPDFEncryptor.m_aCipher, pBuffer, static_cast(nBytes), m_vEncryptionBuffer.data(), static_cast(nBytes)); + m_aPDFEncryptor.encrypt(pBuffer, nBytes, m_vEncryptionBuffer.data(), nBytes); } - const void* pWriteBuffer = m_aPDFEncryptor.m_bEncryptThisStream ? m_vEncryptionBuffer.data() : pBuffer; + const void* pWriteBuffer = m_aPDFEncryptor.isStreamEncryptionEnabled() ? m_vEncryptionBuffer.data() : pBuffer; m_DocDigest.update(static_cast(pWriteBuffer), static_cast(nBytes)); if (m_aFile.write(pWriteBuffer, nBytes, nWritten) != osl::File::E_None) diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 75ccbe9f03a0..354397af60df 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1077,43 +1077,27 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa // Encryption methods -void PDFWriterImpl::checkAndEnableStreamEncryption( sal_Int32 nObject ) +void PDFWriterImpl::checkAndEnableStreamEncryption(sal_Int32 nObject) { - if( !m_aContext.Encryption.Encrypt() ) + if (!m_aContext.Encryption.Encrypt()) return; - m_aPDFEncryptor.m_bEncryptThisStream = true; - sal_Int32 i = m_aPDFEncryptor.getKeyLength(); - m_aContext.Encryption.EncryptionKey[i++] = static_cast(nObject); - m_aContext.Encryption.EncryptionKey[i++] = static_cast( nObject >> 8 ); - m_aContext.Encryption.EncryptionKey[i++] = static_cast( nObject >> 16 ); - // the other location of m_nEncryptionKey is already set to 0, our fixed generation number - // do the MD5 hash - ::std::vector const nMD5Sum(::comphelper::Hash::calculateHash( - m_aContext.Encryption.EncryptionKey.data(), i+2, ::comphelper::HashType::MD5)); - // the i+2 to take into account the generation number, always zero - // initialize the RC4 with the key - // key length: see algorithm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR(m_aPDFEncryptor.m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum.data(), m_aPDFEncryptor.getRC4KeyLength(), nullptr, 0); + m_aPDFEncryptor.enableStreamEncryption(); + m_aPDFEncryptor.setupEncryption(m_aContext.Encryption.EncryptionKey, nObject); } -void PDFWriterImpl::enableStringEncryption( sal_Int32 nObject ) +void PDFWriterImpl::disableStreamEncryption() { - if( !m_aContext.Encryption.Encrypt() ) + m_aPDFEncryptor.disableStreamEncryption(); + +} + +void PDFWriterImpl::enableStringEncryption(sal_Int32 nObject) +{ + if (!m_aContext.Encryption.Encrypt()) return; - sal_Int32 i = m_aPDFEncryptor.getKeyLength(); - m_aContext.Encryption.EncryptionKey[i++] = static_cast(nObject); - m_aContext.Encryption.EncryptionKey[i++] = static_cast( nObject >> 8 ); - m_aContext.Encryption.EncryptionKey[i++] = static_cast( nObject >> 16 ); - // the other location of m_nEncryptionKey is already set to 0, our fixed generation number - // do the MD5 hash - // the i+2 to take into account the generation number, always zero - ::std::vector const nMD5Sum(::comphelper::Hash::calculateHash( - m_aContext.Encryption.EncryptionKey.data(), i+2, ::comphelper::HashType::MD5)); - // initialize the RC4 with the key - // key length: see algorithm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR(m_aPDFEncryptor.m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum.data(), m_aPDFEncryptor.getRC4KeyLength(), nullptr, 0); + m_aPDFEncryptor.setupEncryption(m_aContext.Encryption.EncryptionKey, nObject); } const tools::Long unsetRun[256] = diff --git a/vcl/source/pdf/PDFEncryptor.cxx b/vcl/source/pdf/PDFEncryptor.cxx index 2c6d37296d42..16b88ec160b0 100644 --- a/vcl/source/pdf/PDFEncryptor.cxx +++ b/vcl/source/pdf/PDFEncryptor.cxx @@ -380,6 +380,7 @@ bool PDFEncryptor::prepareEncryption( return bSuccess; } +/* this function implements part of the PDF spec algorithm 3.1 in encryption */ void PDFEncryptor::setupKeysAndCheck(vcl::PDFEncryptionProperties& rProperties) { // sanity check @@ -399,6 +400,38 @@ void PDFEncryptor::setupKeysAndCheck(vcl::PDFEncryptionProperties& rProperties) } } +void PDFEncryptor::enableStreamEncryption() { m_bEncryptThisStream = true; } + +void PDFEncryptor::disableStreamEncryption() { m_bEncryptThisStream = false; } + +void PDFEncryptor::setupEncryption(std::vector const& rEncryptionKey, sal_Int32 nObject) +{ + std::vector aKey(rEncryptionKey.begin(), rEncryptionKey.begin() + m_nKeyLength); + std::vector aObjectArray{ + sal_uInt8(nObject), sal_uInt8(nObject >> 8), sal_uInt8(nObject >> 16), + 0, // generation number, always zero + 0 // generation number, always zero + }; + aKey.insert(aKey.end(), aObjectArray.begin(), aObjectArray.end()); + + // do the MD5 hash + auto const nMD5Sum + = comphelper::Hash::calculateHash(aKey.data(), aKey.size(), ::comphelper::HashType::MD5); + + // initialize the RC4 with the key + // key length: see algorithm 3.1, step 4: (N+5) max 16 + rtl_cipher_initARCFOUR(m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum.data(), getRC4KeyLength(), + nullptr, 0); +} + +/* implement the encryption part of the PDF spec encryption algorithm 3.1 */ +void PDFEncryptor::encrypt(const void* pInput, sal_uInt64 nInputSize, sal_uInt8* pOutput, + sal_uInt64 nOutputsSize) +{ + rtl_cipher_encodeARCFOUR(m_aCipher, pInput, sal_Size(nInputSize), pOutput, + sal_Size(nOutputsSize)); +} + } // end vcl::pdf /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From e0a5ad2f8d45a1a7b552414bf0e16d3f5cb9ef02 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 10:58:03 +0100 Subject: [PATCH 105/373] LOKitSearchTest.cxx: use CPPUNIT_TEST_FIXTURE() Change-Id: I11af98e069be3a8b5ec88a55024bb767e6b2c543 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176991 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- sd/qa/unit/tiledrendering/LOKitSearchTest.cxx | 72 +++++-------------- 1 file changed, 17 insertions(+), 55 deletions(-) diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx index c77eaa6948d0..78892e7e352b 100644 --- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx +++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx @@ -39,43 +39,7 @@ public: virtual void setUp() override; virtual void tearDown() override; - void testSearch(); - void testSearchAll(); - void testSearchAllSelections(); - void testSearchAllNotifications(); - void testSearchAllFollowedBySearch(); - void testDontSearchInMasterPages(); - void testSearchInPDFNonExisting(); - void testSearchInPDF(); - void testSearchInPDFOnePDFObject(); - void testSearchInPDFInMultiplePages(); - void testSearchInPDFInMultiplePagesBackwards(); - void testSearchIn2MixedObjects(); - void testSearchIn6MixedObjects(); - void testReplace(); - void testReplaceAll(); - void testReplaceCombined(); - - CPPUNIT_TEST_SUITE(LOKitSearchTest); - CPPUNIT_TEST(testSearch); - CPPUNIT_TEST(testSearchAll); - CPPUNIT_TEST(testSearchAllSelections); - CPPUNIT_TEST(testSearchAllNotifications); - CPPUNIT_TEST(testSearchAllFollowedBySearch); - CPPUNIT_TEST(testDontSearchInMasterPages); - CPPUNIT_TEST(testSearchInPDFNonExisting); - CPPUNIT_TEST(testSearchInPDF); - CPPUNIT_TEST(testSearchInPDFOnePDFObject); - CPPUNIT_TEST(testSearchInPDFInMultiplePages); - CPPUNIT_TEST(testSearchInPDFInMultiplePagesBackwards); - CPPUNIT_TEST(testSearchIn2MixedObjects); - CPPUNIT_TEST(testSearchIn6MixedObjects); - CPPUNIT_TEST(testReplace); - CPPUNIT_TEST(testReplaceAll); - CPPUNIT_TEST(testReplaceCombined); - CPPUNIT_TEST_SUITE_END(); - -private: +protected: SdXImpressDocument* createDoc(const char* pName, const uno::Sequence& rArguments = uno::Sequence()); @@ -161,7 +125,7 @@ SdrObject* lclGetSelectedObject(sd::ViewShell* pViewShell) } // end anonymous namespace -void LOKitSearchTest::testSearch() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, Search) { SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -196,7 +160,7 @@ void LOKitSearchTest::testSearch() CPPUNIT_ASSERT_EQUAL(false, mpCallbackRecorder->m_bFound); } -void LOKitSearchTest::testSearchAll() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAll) { SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -216,7 +180,7 @@ void LOKitSearchTest::testSearchAll() CPPUNIT_ASSERT_EQUAL(static_cast(1), mpCallbackRecorder->m_nPart); } -void LOKitSearchTest::testSearchAllSelections() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAllSelections) { SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -229,7 +193,7 @@ void LOKitSearchTest::testSearchAllSelections() CPPUNIT_ASSERT_EQUAL(static_cast(2), mpCallbackRecorder->m_aSelection.size()); } -void LOKitSearchTest::testSearchAllNotifications() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAllNotifications) { SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -242,7 +206,7 @@ void LOKitSearchTest::testSearchAllNotifications() CPPUNIT_ASSERT(mpCallbackRecorder->m_nSelectionAfterSearchResult > 0); } -void LOKitSearchTest::testSearchAllFollowedBySearch() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAllFollowedBySearch) { SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -258,7 +222,7 @@ void LOKitSearchTest::testSearchAllFollowedBySearch() pXImpressDocument->getSelection(), "text/plain;charset=utf-8"_ostr)); } -void LOKitSearchTest::testDontSearchInMasterPages() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, DontSearchInMasterPages) { SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -270,7 +234,7 @@ void LOKitSearchTest::testDontSearchInMasterPages() CPPUNIT_ASSERT_EQUAL(false, mpCallbackRecorder->m_bFound); } -void LOKitSearchTest::testSearchInPDFNonExisting() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFNonExisting) { auto pPdfium = vcl::pdf::PDFiumLibrary::get(); if (!pPdfium) @@ -302,7 +266,7 @@ void LOKitSearchTest::testSearchInPDFNonExisting() CPPUNIT_ASSERT_EQUAL(false, mpCallbackRecorder->m_bFound); } -void LOKitSearchTest::testSearchInPDF() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDF) { auto pPdfium = vcl::pdf::PDFiumLibrary::get(); if (!pPdfium) @@ -354,7 +318,7 @@ void LOKitSearchTest::testSearchInPDF() mpCallbackRecorder->m_aSelection[0]); } -void LOKitSearchTest::testSearchInPDFOnePDFObject() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFOnePDFObject) { auto pPdfium = vcl::pdf::PDFiumLibrary::get(); if (!pPdfium) @@ -394,7 +358,7 @@ void LOKitSearchTest::testSearchInPDFOnePDFObject() CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount); } -void LOKitSearchTest::testSearchInPDFInMultiplePages() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFInMultiplePages) { auto pPdfium = vcl::pdf::PDFiumLibrary::get(); if (!pPdfium) @@ -489,7 +453,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePages() mpCallbackRecorder->m_aSearchResultSelection[0]); } -void LOKitSearchTest::testSearchInPDFInMultiplePagesBackwards() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFInMultiplePagesBackwards) { auto pPdfium = vcl::pdf::PDFiumLibrary::get(); if (!pPdfium) @@ -594,7 +558,7 @@ void LOKitSearchTest::testSearchInPDFInMultiplePagesBackwards() // Test searching in document with mixed objects. // We have 2 objects: 1. Text Object, 2. Graphic Object with PDF -void LOKitSearchTest::testSearchIn2MixedObjects() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchIn2MixedObjects) { auto pPdfium = vcl::pdf::PDFiumLibrary::get(); if (!pPdfium) @@ -684,7 +648,7 @@ void LOKitSearchTest::testSearchIn2MixedObjects() } // Test searching in document with mixed objects. We have 6 objects. -void LOKitSearchTest::testSearchIn6MixedObjects() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchIn6MixedObjects) { auto pPdfium = vcl::pdf::PDFiumLibrary::get(); if (!pPdfium) @@ -861,7 +825,7 @@ OUString getShapeText(SdXImpressDocument* pXImpressDocument, sal_uInt32 nPage, s } } -void LOKitSearchTest::testReplace() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, Replace) { SdXImpressDocument* pXImpressDocument = createDoc("ReplaceTest.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -890,7 +854,7 @@ void LOKitSearchTest::testReplace() CPPUNIT_ASSERT_EQUAL(u"bbb"_ustr, getShapeText(pXImpressDocument, 4, 0)); } -void LOKitSearchTest::testReplaceAll() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, ReplaceAll) { SdXImpressDocument* pXImpressDocument = createDoc("ReplaceTest.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -919,7 +883,7 @@ void LOKitSearchTest::testReplaceAll() CPPUNIT_ASSERT_EQUAL(u"bbb"_ustr, getShapeText(pXImpressDocument, 4, 0)); } -void LOKitSearchTest::testReplaceCombined() +CPPUNIT_TEST_FIXTURE(LOKitSearchTest, ReplaceCombined) { SdXImpressDocument* pXImpressDocument = createDoc("ReplaceTest.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -943,6 +907,4 @@ void LOKitSearchTest::testReplaceCombined() CPPUNIT_ASSERT_EQUAL(u"ccc"_ustr, getShapeText(pXImpressDocument, 4, 0)); } -CPPUNIT_TEST_SUITE_REGISTRATION(LOKitSearchTest); - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 17e7743d5fa5de8ddecad5bb35bf2ad644ded2b3 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 21 Nov 2024 21:18:34 +0100 Subject: [PATCH 106/373] sd: add CppunitTest_sd_lokit_search Change-Id: If4844f3f9a40495f3ceaf2603de5211b9f1555cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176972 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sd/CppunitTest_sd_lokit_search.mk | 71 +++++++++++++++++++ sd/CppunitTest_sd_tiledrendering.mk | 1 - sd/Module_sd.mk | 1 + sd/qa/unit/tiledrendering/LOKitSearchTest.cxx | 1 + 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 sd/CppunitTest_sd_lokit_search.mk diff --git a/sd/CppunitTest_sd_lokit_search.mk b/sd/CppunitTest_sd_lokit_search.mk new file mode 100644 index 000000000000..9e1652705628 --- /dev/null +++ b/sd/CppunitTest_sd_lokit_search.mk @@ -0,0 +1,71 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# 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/. +# +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,sd_lokit_search)) + +$(eval $(call gb_CppunitTest_use_common_precompiled_header,sd_lokit_search)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sd_lokit_search, \ + sd/qa/unit/tiledrendering/LOKitSearchTest \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sd_lokit_search, \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + sal \ + sfx \ + subsequenttest \ + svl \ + svt \ + svxcore \ + sd \ + test \ + unotest \ + vcl \ + tl \ + utl \ +)) + +$(eval $(call gb_CppunitTest_use_externals,sd_lokit_search,\ + boost_headers \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_set_include,sd_lokit_search,\ + -I$(SRCDIR)/sd/inc \ + -I$(SRCDIR)/sd/source/ui/inc \ + -I$(SRCDIR)/sd/qa/unit \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,sd_lokit_search)) + +$(eval $(call gb_CppunitTest_use_ure,sd_lokit_search)) +$(eval $(call gb_CppunitTest_use_vcl,sd_lokit_search)) + +$(eval $(call gb_CppunitTest_use_rdb,sd_lokit_search,services)) + +$(eval $(call gb_CppunitTest_use_configuration,sd_lokit_search)) + +$(eval $(call gb_CppunitTest_use_uiconfigs,sd_lokit_search, \ + modules/simpress \ + svx \ +)) + + +$(eval $(call gb_CppunitTest_add_arguments,sd_lokit_search, \ + -env:arg-env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sd/CppunitTest_sd_tiledrendering.mk b/sd/CppunitTest_sd_tiledrendering.mk index 1fcfbf881292..d5b44028ff05 100644 --- a/sd/CppunitTest_sd_tiledrendering.mk +++ b/sd/CppunitTest_sd_tiledrendering.mk @@ -14,7 +14,6 @@ $(eval $(call gb_CppunitTest_CppunitTest,sd_tiledrendering)) $(eval $(call gb_CppunitTest_use_common_precompiled_header,sd_tiledrendering)) $(eval $(call gb_CppunitTest_add_exception_objects,sd_tiledrendering, \ - sd/qa/unit/tiledrendering/LOKitSearchTest \ sd/qa/unit/tiledrendering/tiledrendering \ )) diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk index 29ffccbb89f5..1e442265c4cc 100644 --- a/sd/Module_sd.mk +++ b/sd/Module_sd.mk @@ -62,6 +62,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sd,\ CppunitTest_sd_svg_export_tests \ CppunitTest_sd_tiledrendering \ CppunitTest_sd_tiledrendering2 \ + CppunitTest_sd_lokit_search \ )) endif endif diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx index 78892e7e352b..0e8bd2ad3de6 100644 --- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx +++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx @@ -906,5 +906,6 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, ReplaceCombined) CPPUNIT_ASSERT_EQUAL(u"ccc"_ustr, getShapeText(pXImpressDocument, 3, 0)); CPPUNIT_ASSERT_EQUAL(u"ccc"_ustr, getShapeText(pXImpressDocument, 4, 0)); } +CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 51ca3c42adfa565b7658cf543ec9c27c5c349242 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 11:43:32 +0100 Subject: [PATCH 107/373] PVS: V547 Expression 'aUnoArgs.empty()' is always false Change-Id: I9283b59499fe7739f06d926357218ef7eb916a41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176997 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx index c998eeeccb2b..05de7afc6335 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx @@ -212,7 +212,7 @@ void recentUnoChanged( GtkWidget* pSelector, gpointer /* pItem */ ) if (aUnoArgs.empty()) return; - lok_doc_view_post_command(LOK_DOC_VIEW(pWindow->lokdocview), pUnoCmd, (aUnoArgs.empty() ? nullptr : aUnoArgs.c_str()), false); + lok_doc_view_post_command(LOK_DOC_VIEW(pWindow->lokdocview), pUnoCmd, aUnoArgs.c_str(), false); g_free(pUnoCmd); } From 1329b4fa5428c00ccbb201dc3a08880b0ed09573 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 11:50:44 +0100 Subject: [PATCH 108/373] PVS: V560 A part of conditional expression is always true !aTempContentText.empty(). Change-Id: If61fc09e7e19786ee055b78442b69f0147c8da75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176998 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 2 +- svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index 88cc3cf9bc61..7c697103c0bb 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -67,7 +67,7 @@ namespace drawinglayer::primitive2d getWordWrap())); // put text glow before, shape glow and shadow - if (!aTempContentText.empty() && !getSdrSTAttribute().getGlowText().isDefault()) + if (!getSdrSTAttribute().getGlowText().isDefault()) { // add text glow aTempContentText = createEmbeddedTextGlowPrimitive(std::move(aTempContentText), getSdrSTAttribute().getGlowText()); diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index cdfd75a88b98..e66285e6bb6e 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -103,7 +103,7 @@ namespace drawinglayer::primitive2d false)); // put text glow before, shape glow and shadow - if (!aTempContentText.empty() && !getSdrLFSTAttribute().getGlowText().isDefault()) + if (!getSdrLFSTAttribute().getGlowText().isDefault()) { // add text glow aTempContentText = createEmbeddedTextGlowPrimitive(std::move(aTempContentText), getSdrLFSTAttribute().getGlowText()); From f2cf4d91687fcebcad90a839dd5232a28b47e6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 22 Nov 2024 09:59:44 +0000 Subject: [PATCH 109/373] crashtesting: invalid iterator on load of forum-de-1233.odt docx export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit although the actual order doesn't change there is a Delete/Insert of the object in case the order should change. ::Insert will check if sorted and resort if not anyway, so presumably if we just skip the middle-men and resort here if we need to then that is equivalent, but without the invalidation for the already sorted case. #0 SwSortedObjs::Remove (this=0x510ed40, _rAnchoredObj=...) at core/sw/source/core/layout/sortedobjs.cxx:243 #1 0x00007fffce0af130 in SwSortedObjs::Update (this=0x510ed40, _rAnchoredObj=...) at core/sw/source/core/layout/sortedobjs.cxx:282 #2 0x00007fffcdf32c40 in SwAnchoredObject::UpdateObjInSortedList (this=0x51123c0) at core/sw/source/core/layout/anchoredobject.cxx:661 #3 0x00007fffcdf8fc38 in SwFlyFrame::SwClientNotify (this=0x5112260, rMod=..., rHint=...) at core/sw/source/core/layout/fly.cxx:859 #4 0x00007fffcdf9d1bf in SwFlyAtContentFrame::SwClientNotify (this=0x5112260, rMod=..., rHint=...) at core/sw/source/core/layout/flycnt.cxx:112 #5 0x00007fffcd65bca8 in SwModify::CallSwClientNotify (this=0x4e68da0, rHint=...) at core/sw/source/core/attr/calbck.cxx:311 #6 0x00007fffcd65bd71 in sw::BroadcastingModify::CallSwClientNotify (this=0x4e68da0, rHint=...) at core/sw/source/core/attr/calbck.cxx:316 #7 0x00007fffcd65b42f in SwModify::SwClientNotify (this=0x4e68da0, rHint=...) at core/sw/source/core/attr/calbck.cxx:302 #8 0x00007fffcd66771b in SwFormat::SwClientNotify (this=0x4e68da0, rHint=...) at core/sw/source/core/attr/format.cxx:300 #9 0x00007fffcdf4448a in SwFrameFormat::SwClientNotify (this=0x4e68da0, rMod=..., rHint=...) at core/sw/source/core/layout/atrfrm.cxx:2843 #10 0x00007fffcd65be1e in sw::ClientNotifyAttrChg (rModify=..., aSet=..., aOld=..., aNew=...) at core/sw/source/core/attr/calbck.cxx:325 #11 0x00007fffcd66948e in SwFormat::SetFormatAttr (this=0x4e68da0, rSet=SfxItemSet of pool 0x1bcebe0 with parent 0x4e68e68 and Which ranges: [(88, 141), (159, 159), (1014, 1034)] = {...}) at core/sw/source/core/attr/format.cxx:597 #12 0x00007fffce649a2c in SwXFrame::setPropertyValue (this=0x5e47b90, rPropertyName="Size", _rValue=uno::Any("com.sun.star.awt.Size": ...)) at core/sw/source/core/unocore/unoframe.cxx:1867 #13 0x00007fffcdc4d7ea in SwTextBoxHelper::syncProperty (pShape=0x4dce770, nWID=89, nMemberID=0 '\000', rValue=uno::Any("com.sun.star.awt.Size": ...), pObj=0x0) at core/sw/source/core/doc/textboxhelper.cxx:995 #14 0x00007fffcdf2e2d7 in SwAnchoredDrawObject::GetObjBoundRect (this=0x4e69dd0) at core/sw/source/core/layout/anchoreddrawobject.cxx:757 #15 0x00007fffcdf320ca in SwAnchoredObject::GetObjRectWithSpaces (this=0x4e69dd0) at core/sw/source/core/layout/anchoredobject.cxx:575 #16 0x00007fffcdf31eaa in SwAnchoredObject::InvalidateObjPosForConsiderWrapInfluence (this=0x4e69dd0) at core/sw/source/core/layout/anchoredobject.cxx:400 #17 0x00007fffcdf32be5 in SwAnchoredObject::UpdateObjInSortedList (this=0x510e530) at core/sw/source/core/layout/anchoredobject.cxx:654 #18 0x00007fffcdf8fc38 in SwFlyFrame::SwClientNotify (this=0x510e3d0, rMod=..., rHint=...) at core/sw/source/core/layout/fly.cxx:859 #19 0x00007fffcdf9d1bf in SwFlyAtContentFrame::SwClientNotify (this=0x510e3d0, rMod=..., rHint=...) at core/sw/source/core/layout/flycnt.cxx:112 #20 0x00007fffcd65bca8 in SwModify::CallSwClientNotify (this=0x4e364a0, rHint=...) at core/sw/source/core/attr/calbck.cxx:311 #21 0x00007fffcd65bd71 in sw::BroadcastingModify::CallSwClientNotify (this=0x4e364a0, rHint=...) at core/sw/source/core/attr/calbck.cxx:316 #22 0x00007fffcd65b42f in SwModify::SwClientNotify (this=0x4e364a0, rHint=...) at core/sw/source/core/attr/calbck.cxx:302 #23 0x00007fffcd66771b in SwFormat::SwClientNotify (this=0x4e364a0, rHint=...) at core/sw/source/core/attr/format.cxx:300 #24 0x00007fffcdf4448a in SwFrameFormat::SwClientNotify (this=0x4e364a0, rMod=..., rHint=...) at core/sw/source/core/layout/atrfrm.cxx:2843 #25 0x00007fffcd65be1e in sw::ClientNotifyAttrChg (rModify=..., aSet=..., aOld=..., aNew=...) at core/sw/source/core/attr/calbck.cxx:325 #26 0x00007fffcd66948e in SwFormat::SetFormatAttr (this=0x4e364a0, rSet=SfxItemSet of pool 0x1bcebe0 with parent 0x4e36568 and Which ranges: [(88, 141), (159, 159), (1014, 1034)] = {...}) at core/sw/source/core/attr/format.cxx:597 #27 0x00007fffce649a2c in SwXFrame::setPropertyValue (this=0x4a86e10, rPropertyName="Size", _rValue=uno::Any("com.sun.star.awt.Size": ...)) at core/sw/source/core/unocore/unoframe.cxx:1867 #28 0x00007fffcdc4d7ea in SwTextBoxHelper::syncProperty (pShape=0x4dc65f0, nWID=89, nMemberID=0 '\000', rValue=uno::Any("com.sun.star.awt.Size": ...), pObj=0x0) at core/sw/source/core/doc/textboxhelper.cxx:995 #29 0x00007fffcdf2e2d7 in SwAnchoredDrawObject::GetObjBoundRect (this=0x4e3a0d0) at core/sw/source/core/layout/anchoreddrawobject.cxx:757 #30 0x00007fffcdf320ca in SwAnchoredObject::GetObjRectWithSpaces (this=0x4e3a0d0) at core/sw/source/core/layout/anchoredobject.cxx:575 #31 0x00007fffcdf815b3 in (anonymous namespace)::IsNextContentFullPage (rThis=...) at core/sw/source/core/layout/flowfrm.cxx:217 #32 0x00007fffcdf81002 in SwFlowFrame::IsKeep (this=0x4e5a630, rKeep=..., rBreak=..., bCheckIfLastRowShouldKeep=false) at core/sw/source/core/layout/flowfrm.cxx:259 Change-Id: If2191e8b99d1b0347bab54a704013ce0a9a19410 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176992 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/core/layout/sortedobjs.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sw/source/core/layout/sortedobjs.cxx b/sw/source/core/layout/sortedobjs.cxx index e0c29d51801c..da3fba27598a 100644 --- a/sw/source/core/layout/sortedobjs.cxx +++ b/sw/source/core/layout/sortedobjs.cxx @@ -275,8 +275,10 @@ void SwSortedObjs::Update( SwAnchoredObject& _rAnchoredObj ) return; } - Remove( _rAnchoredObj ); - Insert( _rAnchoredObj ); + if (is_sorted()) + return; + + UpdateAll(); } void SwSortedObjs::UpdateAll() From 9ab81e7c44001ad86461673719cf1ac22f8932c5 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 11:59:18 +0100 Subject: [PATCH 110/373] PVS: V547 Expression '!aPropertyStates.empty()' is always true. Change-Id: Id71d10060c79d36095bbd952b89aa6af68a29a6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176999 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- xmloff/source/chart/SchXMLExport.cxx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index a1fac7424cf2..e2780ee0b684 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -3158,10 +3158,7 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( if( bExportContent ) { // add style name attribute - if( !aPropertyStates.empty()) - { - AddAutoStyleAttribute( aPropertyStates ); - } + AddAutoStyleAttribute( aPropertyStates ); SvXMLElementExport aRegressionExport( mrExport, XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, true, true ); if( bExportEquation ) @@ -3191,10 +3188,7 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( } else // autostyles { - if( !aPropertyStates.empty()) - { - CollectAutoStyle( std::move(aPropertyStates) ); - } + CollectAutoStyle( std::move(aPropertyStates) ); if( bExportEquation && !aEquationPropertyStates.empty()) { CollectAutoStyle( std::move(aEquationPropertyStates) ); From 568fcd66c53ec9fc5fa2ef8060a10085d48c36c8 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 12:02:24 +0100 Subject: [PATCH 111/373] PVS: V560 A part of conditional expression is always true: !rPolyPolygon.empty(). Change-Id: I61b79d0995cc08b70c2a39bdeb043a22722313e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177000 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- chart2/source/view/main/ShapeFactory.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 81d41e83bbc7..b821c1f5206a 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -1098,7 +1098,7 @@ rtl::Reference //so we need to translate the object via transformation matrix //Matrix for position - if (!rPolyPolygon.empty() && !rPolyPolygon[0].empty()) + if (!rPolyPolygon[0].empty()) { basegfx::B3DHomMatrix aM; aM.translate(0, 0, rPolyPolygon[0][0].PositionZ); From bf2c6653164073c542fd04e19a5f3dd7f934078a Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 21 Nov 2024 10:07:33 +0100 Subject: [PATCH 112/373] CppunitTest_sd_tiledrendering: factor out common code Change-Id: I8ba7871cd3ca7580230c31dedf468aaa8219241a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176915 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- .../unit/tiledrendering/CallbackRecorder.hxx | 152 ------- sd/qa/unit/tiledrendering/LOKitSearchTest.cxx | 370 +++++++---------- sd/qa/unit/tiledrendering/tiledrendering.cxx | 370 +---------------- sd/qa/unit/tiledrendering/tiledrendering2.cxx | 124 +----- .../tiledrenderingmodeltestbase.cxx | 389 ++++++++++++++++++ 5 files changed, 547 insertions(+), 858 deletions(-) delete mode 100644 sd/qa/unit/tiledrendering/CallbackRecorder.hxx create mode 100644 sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx diff --git a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx deleted file mode 100644 index ad64f5ab3924..000000000000 --- a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- 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/. - */ - -#pragma once - -#include - -#include -#include -#include -#include -#include -#include -#include - -using namespace css; - -namespace -{ -std::vector lcl_convertSeparated(std::u16string_view rString, sal_Unicode nSeparator) -{ - std::vector aRet; - - sal_Int32 nIndex = 0; - do - { - OUString aToken(o3tl::trim(o3tl::getToken(rString, 0, nSeparator, nIndex))); - if (!aToken.isEmpty()) - aRet.push_back(aToken); - } while (nIndex >= 0); - - return aRet; -} - -void lcl_convertRectangle(std::u16string_view rString, tools::Rectangle& rRectangle) -{ - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(rString); - CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); - rRectangle.SetLeft(aSeq[0].toInt32()); - rRectangle.SetTop(aSeq[1].toInt32()); - rRectangle.setWidth(aSeq[2].toInt32()); - rRectangle.setHeight(aSeq[3].toInt32()); -} -} - -struct CallbackRecorder -{ - CallbackRecorder() - : m_bFound(true) - , m_nPart(0) - , m_nSelectionBeforeSearchResult(0) - , m_nSelectionAfterSearchResult(0) - , m_nSearchResultCount(0) - , m_callbackWrapper(&callback, this) - { - } - - tools::Rectangle m_aInvalidation; - std::vector<::tools::Rectangle> m_aSelection; - bool m_bFound; - sal_Int32 m_nPart; - std::vector m_aSearchResultSelection; - std::vector m_aSearchResultPart; - int m_nSelectionBeforeSearchResult; - int m_nSelectionAfterSearchResult; - int m_nSearchResultCount; - /// For document size changed callback. - osl::Condition m_aDocumentSizeCondition; - TestLokCallbackWrapper m_callbackWrapper; - - static void callback(int nType, const char* pPayload, void* pData) - { - static_cast(pData)->processCallback(nType, pPayload); - } - - void processCallback(int nType, const char* pPayload) - { - switch (nType) - { - case LOK_CALLBACK_INVALIDATE_TILES: - { - OUString aPayload = OUString::createFromAscii(pPayload); - if (aPayload != "EMPTY" && m_aInvalidation.IsEmpty()) - lcl_convertRectangle(aPayload, m_aInvalidation); - } - break; - case LOK_CALLBACK_TEXT_SELECTION: - { - OUString aPayload = OUString::createFromAscii(pPayload); - m_aSelection.clear(); - for (const OUString& rString : lcl_convertSeparated(aPayload, u';')) - { - ::tools::Rectangle aRectangle; - lcl_convertRectangle(rString, aRectangle); - m_aSelection.push_back(aRectangle); - } - if (m_aSearchResultSelection.empty()) - ++m_nSelectionBeforeSearchResult; - else - ++m_nSelectionAfterSearchResult; - } - break; - case LOK_CALLBACK_SEARCH_NOT_FOUND: - { - m_bFound = false; - } - break; - case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: - { - m_aDocumentSizeCondition.set(); - } - break; - case LOK_CALLBACK_SET_PART: - { - OUString aPayload = OUString::createFromAscii(pPayload); - m_nPart = aPayload.toInt32(); - } - break; - case LOK_CALLBACK_SEARCH_RESULT_SELECTION: - { - m_nSearchResultCount++; - m_aSearchResultSelection.clear(); - m_aSearchResultPart.clear(); - boost::property_tree::ptree aTree; - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, aTree); - for (const boost::property_tree::ptree::value_type& rValue : - aTree.get_child("searchResultSelection")) - { - m_aSearchResultSelection.emplace_back( - rValue.second.get("rectangles").c_str()); - m_aSearchResultPart.push_back( - std::atoi(rValue.second.get("part").c_str())); - } - } - break; - } - } - - void registerCallbacksFor(SfxViewShell& rViewShell) - { - rViewShell.setLibreOfficeKitViewCallback(&m_callbackWrapper); - } -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx index 0e8bd2ad3de6..aff3deafc5be 100644 --- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx +++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx @@ -7,13 +7,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "CallbackRecorder.hxx" -#include +#include "tiledrenderingmodeltestbase.cxx" #include #include -#include #include #include #include @@ -28,61 +26,19 @@ using namespace css; -class LOKitSearchTest : public UnoApiTest +class LOKitSearchTest : public SdTiledRenderingTest { public: LOKitSearchTest() - : UnoApiTest(u"/sd/qa/unit/tiledrendering/data/"_ustr) + : SdTiledRenderingTest() { } - virtual void setUp() override; - virtual void tearDown() override; - protected: - SdXImpressDocument* createDoc(const char* pName, - const uno::Sequence& rArguments - = uno::Sequence()); void lcl_search(const OUString& rKey, bool bFindAll = false, bool bBackwards = false); void lcl_replace(const OUString& rKey, const OUString& rReplace, bool bAll = false); - - std::unique_ptr mpCallbackRecorder; }; -void LOKitSearchTest::setUp() -{ - UnoApiTest::setUp(); - - // prevent showing warning message box - setenv("OOX_NO_SMARTART_WARNING", "1", 1); - comphelper::LibreOfficeKit::setActive(true); - - mpCallbackRecorder = std::make_unique(); -} - -void LOKitSearchTest::tearDown() -{ - if (mxComponent.is()) - { - mxComponent->dispose(); - mxComponent.clear(); - } - - comphelper::LibreOfficeKit::setActive(false); - - UnoApiTest::tearDown(); -} - -SdXImpressDocument* -LOKitSearchTest::createDoc(const char* pName, const uno::Sequence& rArguments) -{ - loadFromFile(OUString::createFromAscii(pName)); - SdXImpressDocument* pImpressDocument = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pImpressDocument); - pImpressDocument->initializeForTiledRendering(rArguments); - return pImpressDocument; -} - void LOKitSearchTest::lcl_search(const OUString& rKey, bool bFindAll, bool bBackwards) { Scheduler::ProcessEventsToIdle(); @@ -129,7 +85,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, Search) { SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); uno::Reference xDrawPage( pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY); uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); @@ -143,28 +99,27 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, Search) CPPUNIT_ASSERT_EQUAL(u"bbb"_ustr, rEditView.GetSelected()); // Did the selection callback fire? - CPPUNIT_ASSERT_EQUAL(static_cast(1), mpCallbackRecorder->m_aSelection.size()); + CPPUNIT_ASSERT_EQUAL(static_cast(1), m_aSelection.size()); // Search for something on the second slide, and make sure that the set-part callback fired. lcl_search(u"bbb"_ustr); - CPPUNIT_ASSERT_EQUAL(static_cast(1), mpCallbackRecorder->m_nPart); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); + CPPUNIT_ASSERT_EQUAL(static_cast(1), m_nPart); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); // This was 0; should be 1 match for "find". - CPPUNIT_ASSERT_EQUAL(static_cast(1), - mpCallbackRecorder->m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(static_cast(1), m_aSearchResultSelection.size()); // Result is on the second slide. - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL(1, m_aSearchResultPart[0]); // This should trigger the not-found callback. lcl_search(u"ccc"_ustr); - CPPUNIT_ASSERT_EQUAL(false, mpCallbackRecorder->m_bFound); + CPPUNIT_ASSERT_EQUAL(false, m_bFound); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAll) { SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); lcl_search(u"match"_ustr, /*bFindAll=*/true); @@ -174,43 +129,43 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAll) pXImpressDocument->getSelection(), "text/plain;charset=utf-8"_ostr)); // We're on the first slide, search for something on the second slide and make sure we get a SET_PART. - mpCallbackRecorder->m_nPart = 0; + m_nPart = 0; lcl_search(u"second"_ustr, /*bFindAll=*/true); // This was 0: no SET_PART was emitted. - CPPUNIT_ASSERT_EQUAL(static_cast(1), mpCallbackRecorder->m_nPart); + CPPUNIT_ASSERT_EQUAL(static_cast(1), m_nPart); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAllSelections) { SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); lcl_search(u"third"_ustr, /*bFindAll=*/true); // Make sure this is found on the 3rd slide. - CPPUNIT_ASSERT_EQUAL(static_cast(2), mpCallbackRecorder->m_nPart); + CPPUNIT_ASSERT_EQUAL(static_cast(2), m_nPart); // This was 1: only the first match was highlighted. - CPPUNIT_ASSERT_EQUAL(static_cast(2), mpCallbackRecorder->m_aSelection.size()); + CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSelection.size()); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAllNotifications) { SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); lcl_search(u"third"_ustr, /*bFindAll=*/true); // Make sure that we get no notifications about selection changes during search. - CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_nSelectionBeforeSearchResult); + CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult); // But we do get the selection of the first hit. - CPPUNIT_ASSERT(mpCallbackRecorder->m_nSelectionAfterSearchResult > 0); + CPPUNIT_ASSERT(m_nSelectionAfterSearchResult > 0); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchAllFollowedBySearch) { SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); lcl_search(u"third"_ustr, /*bFindAll=*/true); lcl_search(u"match"_ustr /*,bFindAll=false*/); @@ -226,12 +181,12 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, DontSearchInMasterPages) { SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); // This should trigger the not-found callback ("date" is present only on // the master page) lcl_search(u"date"_ustr); - CPPUNIT_ASSERT_EQUAL(false, mpCallbackRecorder->m_bFound); + CPPUNIT_ASSERT_EQUAL(false, m_bFound); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFNonExisting) @@ -245,7 +200,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFNonExisting) SdXImpressDocument* pXImpressDocument = createDoc("PDFSearch.pdf"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); CPPUNIT_ASSERT(pViewShell); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); SdPage* pPage = pViewShell->GetActualPage(); CPPUNIT_ASSERT(pPage); @@ -263,7 +218,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFNonExisting) lcl_search(u"NonExisting"_ustr); - CPPUNIT_ASSERT_EQUAL(false, mpCallbackRecorder->m_bFound); + CPPUNIT_ASSERT_EQUAL(false, m_bFound); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDF) @@ -277,7 +232,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDF) SdXImpressDocument* pXImpressDocument = createDoc("PDFSearch.pdf"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); CPPUNIT_ASSERT(pViewShell); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); SdPage* pPage = pViewShell->GetActualPage(); CPPUNIT_ASSERT(pPage); @@ -296,26 +251,22 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDF) // Search lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(1, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL("3763, 1331, 1432, 483"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 484)), - mpCallbackRecorder->m_aSelection[0]); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL("3763, 1331, 1432, 483"_ostr, m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 484)), m_aSelection[0]); // Search again - same result lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(2, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL("3763, 1331, 1432, 483"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 484)), - mpCallbackRecorder->m_aSelection[0]); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL("3763, 1331, 1432, 483"_ostr, m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 484)), m_aSelection[0]); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFOnePDFObject) @@ -329,7 +280,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFOnePDFObject) SdXImpressDocument* pXImpressDocument = createDoc("OnePDFObject.odg"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); CPPUNIT_ASSERT(pViewShell); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); SdPage* pPage = pViewShell->GetActualPage(); CPPUNIT_ASSERT(pPage); @@ -348,14 +299,14 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFOnePDFObject) // Search down lcl_search(u"ABC"_ustr, false, false); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(1, m_nSearchResultCount); // Search up lcl_search(u"ABC"_ustr, false, true); // This caused a crash - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(2, m_nSearchResultCount); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFInMultiplePages) @@ -369,7 +320,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFInMultiplePages) SdXImpressDocument* pXImpressDocument = createDoc("PDFSearch.pdf"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); CPPUNIT_ASSERT(pViewShell); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); SdPage* pPage = pViewShell->GetActualPage(); CPPUNIT_ASSERT(pPage); @@ -390,67 +341,62 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFInMultiplePages) // Search for "him" lcl_search(u"him"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(1, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("9463, 3382, 1099, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("9463, 3382, 1099, 499"_ostr, m_aSearchResultSelection[0]); // Search for "him" lcl_search(u"him"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(2, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("5592, 5038, 1100, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("5592, 5038, 1100, 499"_ostr, m_aSearchResultSelection[0]); // Search for "him" lcl_search(u"him"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(3, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(3, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("9463, 1308, 1099, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(1, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("9463, 1308, 1099, 499"_ostr, m_aSearchResultSelection[0]); // Search for "him" lcl_search(u"him"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(4, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(4, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("5592, 2964, 1100, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(1, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("5592, 2964, 1100, 499"_ostr, m_aSearchResultSelection[0]); // Search for "him" - back to start lcl_search(u"him"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(5, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(5, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("9463, 3382, 1099, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("9463, 3382, 1099, 499"_ostr, m_aSearchResultSelection[0]); } CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFInMultiplePagesBackwards) @@ -464,7 +410,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFInMultiplePagesBackwards) SdXImpressDocument* pXImpressDocument = createDoc("PDFSearch.pdf"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); CPPUNIT_ASSERT(pViewShell); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); SdPage* pPage = pViewShell->GetActualPage(); CPPUNIT_ASSERT(pPage); @@ -493,67 +439,62 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchInPDFInMultiplePagesBackwards) // Search for "him" lcl_search(u"him"_ustr, /*FindAll*/ false, /*Backwards*/ true); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(1, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("5592, 5038, 1100, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("5592, 5038, 1100, 499"_ostr, m_aSearchResultSelection[0]); // Search for "him" lcl_search(u"him"_ustr, /*FindAll*/ false, /*Backwards*/ true); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(2, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("9463, 3382, 1099, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("9463, 3382, 1099, 499"_ostr, m_aSearchResultSelection[0]); // Search for "him" lcl_search(u"him"_ustr, /*FindAll*/ false, /*Backwards*/ true); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(3, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(3, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("5592, 2964, 1100, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(1, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("5592, 2964, 1100, 499"_ostr, m_aSearchResultSelection[0]); // Search for "him" lcl_search(u"him"_ustr, /*FindAll*/ false, /*Backwards*/ true); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(4, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(4, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("9463, 1308, 1099, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(1, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("9463, 1308, 1099, 499"_ostr, m_aSearchResultSelection[0]); // Search for "him" - back to start lcl_search(u"him"_ustr, /*FindAll*/ false, /*Backwards*/ true); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(5, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(5, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]); - CPPUNIT_ASSERT_EQUAL("5592, 5038, 1100, 499"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); + CPPUNIT_ASSERT_EQUAL("5592, 5038, 1100, 499"_ostr, m_aSearchResultSelection[0]); } // Test searching in document with mixed objects. @@ -571,7 +512,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchIn2MixedObjects) CPPUNIT_ASSERT(pViewShell); SdDrawDocument* pDocument = pXImpressDocument->GetDocShell()->GetDoc(); CPPUNIT_ASSERT(pDocument); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); // Check we have one page CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pDocument->GetSdPageCount(PageKind::Standard)); @@ -611,40 +552,37 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchIn2MixedObjects) lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(1, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL("3545, 3174, 740, 402"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL("3545, 3174, 740, 402"_ostr, m_aSearchResultSelection[0]); // Search next lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(2, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL("8412, 6385, 519, 174"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL("8412, 6385, 519, 174"_ostr, m_aSearchResultSelection[0]); // Search next again - we should get the first object again lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(3, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(3, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); - CPPUNIT_ASSERT_EQUAL("3545, 3174, 740, 402"_ostr, - mpCallbackRecorder->m_aSearchResultSelection[0]); + CPPUNIT_ASSERT_EQUAL("3545, 3174, 740, 402"_ostr, m_aSearchResultSelection[0]); } // Test searching in document with mixed objects. We have 6 objects. @@ -661,7 +599,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchIn6MixedObjects) CPPUNIT_ASSERT(pViewShell); SdDrawDocument* pDocument = pXImpressDocument->GetDocShell()->GetDoc(); CPPUNIT_ASSERT(pDocument); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); // Check we have one page CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pDocument->GetSdPageCount(PageKind::Standard)); @@ -736,81 +674,81 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, SearchIn6MixedObjects) // Object 1 lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(1, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); CPPUNIT_ASSERT_EQUAL(pPage->GetObj(0), lclGetSelectedObject(pViewShell)); // Object 2 lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(2, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); CPPUNIT_ASSERT_EQUAL(pPage->GetObj(1), lclGetSelectedObject(pViewShell)); // Object 3 lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(3, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(3, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); CPPUNIT_ASSERT_EQUAL(pPage->GetObj(2), lclGetSelectedObject(pViewShell)); // Object 3 again lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(4, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(4, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); CPPUNIT_ASSERT_EQUAL(pPage->GetObj(2), lclGetSelectedObject(pViewShell)); // Object 4 lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(5, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(5, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); CPPUNIT_ASSERT_EQUAL(pPage->GetObj(3), lclGetSelectedObject(pViewShell)); // Object 5 lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(6, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(6, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); CPPUNIT_ASSERT_EQUAL(pPage->GetObj(4), lclGetSelectedObject(pViewShell)); // Object 6 lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(7, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(7, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); CPPUNIT_ASSERT_EQUAL(pPage->GetObj(5), lclGetSelectedObject(pViewShell)); // Loop to Object 1 again lcl_search(u"ABC"_ustr); - CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound); - CPPUNIT_ASSERT_EQUAL(8, mpCallbackRecorder->m_nSearchResultCount); + CPPUNIT_ASSERT_EQUAL(true, m_bFound); + CPPUNIT_ASSERT_EQUAL(8, m_nSearchResultCount); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size()); - CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultSelection.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), m_aSearchResultPart.size()); CPPUNIT_ASSERT_EQUAL(pPage->GetObj(0), lclGetSelectedObject(pViewShell)); } namespace @@ -829,7 +767,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, Replace) { SdXImpressDocument* pXImpressDocument = createDoc("ReplaceTest.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); CPPUNIT_ASSERT_EQUAL(u"bbb"_ustr, getShapeText(pXImpressDocument, 0, 0)); CPPUNIT_ASSERT_EQUAL(u"Bbb bbb bbb bbb"_ustr, getShapeText(pXImpressDocument, 1, 0)); @@ -858,7 +796,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, ReplaceAll) { SdXImpressDocument* pXImpressDocument = createDoc("ReplaceTest.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); CPPUNIT_ASSERT_EQUAL(u"bbb"_ustr, getShapeText(pXImpressDocument, 0, 0)); CPPUNIT_ASSERT_EQUAL(u"Bbb bbb bbb bbb"_ustr, getShapeText(pXImpressDocument, 1, 0)); @@ -887,7 +825,7 @@ CPPUNIT_TEST_FIXTURE(LOKitSearchTest, ReplaceCombined) { SdXImpressDocument* pXImpressDocument = createDoc("ReplaceTest.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase()); + setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase()); lcl_replace(u"bbb"_ustr, u"aaa"_ustr, false); // select lcl_replace(u"bbb"_ustr, u"aaa"_ustr, false); // replace diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index cf228cf54b5c..49812ce6788f 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -7,14 +7,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include "tiledrenderingmodeltestbase.cxx" #include #include #include #include #include -#include #include #include #include @@ -31,19 +30,15 @@ #include #include #include -#include #include #include #include -#include #include #include #include #include #include -#include -#include #include #include #include @@ -54,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -71,207 +65,6 @@ static std::ostream& operator<<(std::ostream& os, ViewShellId id) return os; } -class SdTiledRenderingTest : public UnoApiXmlTest -{ -public: - SdTiledRenderingTest(); - virtual void setUp() override; - virtual void tearDown() override; - -protected: - SdXImpressDocument* createDoc(const char* pName, const uno::Sequence& rArguments = uno::Sequence()); - void setupLibreOfficeKitViewCallback(SfxViewShell& pViewShell); - static void callback(int nType, const char* pPayload, void* pData); - void callbackImpl(int nType, const char* pPayload); - xmlDocUniquePtr parseXmlDump(); - - ::tools::Rectangle m_aInvalidation; - std::vector<::tools::Rectangle> m_aSelection; - bool m_bFound; - sal_Int32 m_nPart; - std::vector m_aSearchResultSelection; - std::vector m_aSearchResultPart; - int m_nSelectionBeforeSearchResult; - int m_nSelectionAfterSearchResult; - - /// For document size changed callback. - osl::Condition m_aDocumentSizeCondition; - xmlBufferPtr m_pXmlBuffer; - TestLokCallbackWrapper m_callbackWrapper; -}; - -SdTiledRenderingTest::SdTiledRenderingTest() - : UnoApiXmlTest(u"/sd/qa/unit/tiledrendering/data/"_ustr), - m_bFound(true), - m_nPart(0), - m_nSelectionBeforeSearchResult(0), - m_nSelectionAfterSearchResult(0), - m_pXmlBuffer(nullptr), - m_callbackWrapper(&callback, this) -{ -} - -void SdTiledRenderingTest::setUp() -{ - UnoApiXmlTest::setUp(); - - // prevent showing warning message box - setenv("OOX_NO_SMARTART_WARNING", "1", 1); - comphelper::LibreOfficeKit::setActive(true); -} - -void SdTiledRenderingTest::tearDown() -{ - if (mxComponent.is()) - { - mxComponent->dispose(); - mxComponent.clear(); - } - - if (m_pXmlBuffer) - xmlBufferFree(m_pXmlBuffer); - - m_callbackWrapper.clear(); - comphelper::LibreOfficeKit::setActive(false); - - UnoApiXmlTest::tearDown(); -} - -SdXImpressDocument* SdTiledRenderingTest::createDoc(const char* pName, const uno::Sequence& rArguments) -{ - loadFromFile(OUString::createFromAscii(pName)); - SdXImpressDocument* pImpressDocument = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pImpressDocument); - pImpressDocument->initializeForTiledRendering(rArguments); - return pImpressDocument; -} - -void SdTiledRenderingTest::setupLibreOfficeKitViewCallback(SfxViewShell& pViewShell) -{ - pViewShell.setLibreOfficeKitViewCallback(&m_callbackWrapper); - m_callbackWrapper.setLOKViewId(SfxLokHelper::getView(&pViewShell)); -} - -void SdTiledRenderingTest::callback(int nType, const char* pPayload, void* pData) -{ - static_cast(pData)->callbackImpl(nType, pPayload); -} - -namespace -{ - -std::vector lcl_convertSeparated(std::u16string_view rString, sal_Unicode nSeparator) -{ - std::vector aRet; - - sal_Int32 nIndex = 0; - do - { - OUString aToken( o3tl::trim(o3tl::getToken(rString, 0, nSeparator, nIndex)) ); - if (!aToken.isEmpty()) - aRet.push_back(aToken); - } - while (nIndex >= 0); - - return aRet; -} - -void lcl_convertRectangle(std::u16string_view rString, ::tools::Rectangle& rRectangle) -{ - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(rString); - CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); - rRectangle.SetLeft(aSeq[0].toInt32()); - rRectangle.SetTop(aSeq[1].toInt32()); - rRectangle.setWidth(aSeq[2].toInt32()); - rRectangle.setHeight(aSeq[3].toInt32()); -} - -} // end anonymous namespace - -void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload) -{ - switch (nType) - { - case LOK_CALLBACK_INVALIDATE_TILES: - { - OUString aPayload = OUString::createFromAscii(pPayload); - if (aPayload != "EMPTY" && m_aInvalidation.IsEmpty()) - lcl_convertRectangle(aPayload, m_aInvalidation); - } - break; - case LOK_CALLBACK_TEXT_SELECTION: - { - OUString aPayload = OUString::createFromAscii(pPayload); - m_aSelection.clear(); - for (const OUString& rString : lcl_convertSeparated(aPayload, u';')) - { - ::tools::Rectangle aRectangle; - lcl_convertRectangle(rString, aRectangle); - m_aSelection.push_back(aRectangle); - } - if (m_aSearchResultSelection.empty()) - ++m_nSelectionBeforeSearchResult; - else - ++m_nSelectionAfterSearchResult; - } - break; - case LOK_CALLBACK_SEARCH_NOT_FOUND: - { - m_bFound = false; - } - break; - case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: - { - m_aDocumentSizeCondition.set(); - } - break; - case LOK_CALLBACK_SET_PART: - { - OUString aPayload = OUString::createFromAscii(pPayload); - m_nPart = aPayload.toInt32(); - } - break; - case LOK_CALLBACK_SEARCH_RESULT_SELECTION: - { - m_aSearchResultSelection.clear(); - m_aSearchResultPart.clear(); - boost::property_tree::ptree aTree; - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, aTree); - for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) - { - m_aSearchResultSelection.emplace_back(rValue.second.get("rectangles").c_str()); - m_aSearchResultPart.push_back(std::atoi(rValue.second.get("part").c_str())); - } - } - break; - } -} - -xmlDocUniquePtr SdTiledRenderingTest::parseXmlDump() -{ - if (m_pXmlBuffer) - xmlBufferFree(m_pXmlBuffer); - - // Create the xml writer. - m_pXmlBuffer = xmlBufferCreate(); - xmlTextWriterPtr pXmlWriter = xmlNewTextWriterMemory(m_pXmlBuffer, 0); - (void)xmlTextWriterStartDocument(pXmlWriter, nullptr, nullptr, nullptr); - - // Create the dump. - SdXImpressDocument* pImpressDocument = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pImpressDocument); - pImpressDocument->GetDoc()->dumpAsXml(pXmlWriter); - - // Delete the xml writer. - (void)xmlTextWriterEndDocument(pXmlWriter); - xmlFreeTextWriter(pXmlWriter); - - auto pCharBuffer = xmlBufferContent(m_pXmlBuffer); - SAL_INFO("test", "SdTiledRenderingTest::parseXmlDump: pCharBuffer is '" << pCharBuffer << "'"); - return xmlDocUniquePtr(xmlParseDoc(pCharBuffer)); -} - CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testCreateDestroy) { createDoc("dummy.odp"); @@ -765,167 +558,6 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testResizeTableColumn) pXmlDoc = nullptr; } -namespace { - -/// A view callback tracks callbacks invoked on one specific view. -class ViewCallback final -{ - SfxViewShell* mpViewShell; - int mnView; -public: - bool m_bGraphicSelectionInvalidated; - bool m_bGraphicViewSelectionInvalidated; - /// Our current part, to be able to decide if a view cursor/selection is relevant for us. - int m_nPart; - bool m_bCursorVisibleChanged; - bool m_bCursorVisible; - bool m_bViewLock; - bool m_bTilesInvalidated; - std::vector m_aInvalidations; - std::map m_aViewCursorInvalidations; - std::map m_aViewCursorVisibilities; - bool m_bViewSelectionSet; - boost::property_tree::ptree m_aCommentCallbackResult; - OString m_ShapeSelection; - std::map m_aStateChanges; - TestLokCallbackWrapper m_callbackWrapper; - - ViewCallback() - : m_bGraphicSelectionInvalidated(false), - m_bGraphicViewSelectionInvalidated(false), - m_nPart(0), - m_bCursorVisibleChanged(false), - m_bCursorVisible(false), - m_bViewLock(false), - m_bTilesInvalidated(false), - m_bViewSelectionSet(false), - m_callbackWrapper(&callback, this) - { - mpViewShell = SfxViewShell::Current(); - mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); - mnView = SfxLokHelper::getView(); - m_callbackWrapper.setLOKViewId( mnView ); - } - - ~ViewCallback() - { - SfxLokHelper::setView(mnView); - mpViewShell->setLibreOfficeKitViewCallback(nullptr); - } - - static void callback(int nType, const char* pPayload, void* pData) - { - static_cast(pData)->callbackImpl(nType, pPayload); - } - - void callbackImpl(int nType, const char* pPayload) - { - switch (nType) - { - case LOK_CALLBACK_INVALIDATE_TILES: - { - m_bTilesInvalidated = true; - OString text(pPayload); - if (!text.startsWith("EMPTY")) - { - uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); - CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); - tools::Rectangle aInvalidationRect; - aInvalidationRect.SetLeft(aSeq[0].toInt32()); - aInvalidationRect.SetTop(aSeq[1].toInt32()); - aInvalidationRect.setWidth(aSeq[2].toInt32()); - aInvalidationRect.setHeight(aSeq[3].toInt32()); - m_aInvalidations.push_back(aInvalidationRect); - } - } - break; - case LOK_CALLBACK_GRAPHIC_SELECTION: - { - m_bGraphicSelectionInvalidated = true; - m_ShapeSelection = OString(pPayload); - } - break; - case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - if (aTree.get_child("part").get_value() == m_nPart) - // Ignore callbacks which are for a different part. - m_bGraphicViewSelectionInvalidated = true; - } - break; - case LOK_CALLBACK_CURSOR_VISIBLE: - { - m_bCursorVisibleChanged = true; - m_bCursorVisible = (std::string_view("true") == pPayload); - } - break; - case LOK_CALLBACK_VIEW_LOCK: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - m_bViewLock = aTree.get_child("rectangle").get_value() != "EMPTY"; - } - break; - case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - int nViewId = aTree.get_child("viewId").get_value(); - m_aViewCursorInvalidations[nViewId] = true; - } - break; - case LOK_CALLBACK_VIEW_CURSOR_VISIBLE: - { - std::stringstream aStream(pPayload); - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - const int nViewId = aTree.get_child("viewId").get_value(); - m_aViewCursorVisibilities[nViewId] = std::string_view("true") == pPayload; - } - break; - case LOK_CALLBACK_TEXT_VIEW_SELECTION: - { - m_bViewSelectionSet = true; - } - break; - case LOK_CALLBACK_COMMENT: - { - m_aCommentCallbackResult.clear(); - std::stringstream aStream(pPayload); - boost::property_tree::read_json(aStream, m_aCommentCallbackResult); - m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment"); - } - break; - case LOK_CALLBACK_STATE_CHANGED: - { - std::stringstream aStream(pPayload); - if (!aStream.str().starts_with("{")) - { - break; - } - - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - auto it = aTree.find("commandName"); - if (it == aTree.not_found()) - { - break; - } - - std::string aCommandName = it->second.get_value(); - m_aStateChanges[aCommandName] = aTree; - } - break; - } - } -}; - -} - CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testViewCursors) { // Create two views. diff --git a/sd/qa/unit/tiledrendering/tiledrendering2.cxx b/sd/qa/unit/tiledrendering/tiledrendering2.cxx index a9b0b6e5b8ff..28860a293b41 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering2.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering2.cxx @@ -7,130 +7,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include "tiledrenderingmodeltestbase.cxx" -#include - -#include -#include -#include #include -#include #include -#include - -using namespace css; - -namespace -{ -/// Impress tests with comphelper::LibreOfficeKit::isActive() enabled, part 2. -class Test : public UnoApiXmlTest -{ -public: - Test(); - virtual void setUp() override; - virtual void tearDown() override; - -protected: - SdXImpressDocument* createDoc(const char* pName, - const uno::Sequence& rArguments = {}); -}; - -Test::Test() - : UnoApiXmlTest(u"/sd/qa/unit/tiledrendering/data/"_ustr) -{ -} - -void Test::setUp() -{ - UnoApiXmlTest::setUp(); - - comphelper::LibreOfficeKit::setActive(true); -} - -void Test::tearDown() -{ - if (mxComponent.is()) - { - mxComponent->dispose(); - mxComponent.clear(); - } - - comphelper::LibreOfficeKit::setActive(false); - - UnoApiXmlTest::tearDown(); -} - -SdXImpressDocument* Test::createDoc(const char* pName, - const uno::Sequence& rArguments) -{ - loadFromFile(OUString::createFromAscii(pName)); - SdXImpressDocument* pImpressDocument = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pImpressDocument); - pImpressDocument->initializeForTiledRendering(rArguments); - return pImpressDocument; -} - -/// A view callback tracks callbacks invoked on one specific view. -class ViewCallback final -{ - SfxViewShell* mpViewShell; - int mnView; - -public: - std::map m_aStateChanges; - TestLokCallbackWrapper m_callbackWrapper; - - ViewCallback() - : m_callbackWrapper(&callback, this) - { - mpViewShell = SfxViewShell::Current(); - mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); - mnView = SfxLokHelper::getView(); - m_callbackWrapper.setLOKViewId(mnView); - } - - ~ViewCallback() - { - SfxLokHelper::setView(mnView); - mpViewShell->setLibreOfficeKitViewCallback(nullptr); - } - - static void callback(int nType, const char* pPayload, void* pData) - { - static_cast(pData)->callbackImpl(nType, pPayload); - } - - void callbackImpl(int nType, const char* pPayload) - { - switch (nType) - { - case LOK_CALLBACK_STATE_CHANGED: - { - std::stringstream aStream(pPayload); - if (!aStream.str().starts_with("{")) - { - break; - } - - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - auto it = aTree.find("commandName"); - if (it == aTree.not_found()) - { - break; - } - - std::string aCommandName = it->second.get_value(); - m_aStateChanges[aCommandName] = aTree; - } - break; - } - } -}; - -CPPUNIT_TEST_FIXTURE(Test, testSidebarSwitchDeck) +CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSidebarSwitchDeck) { // Given an impress document, with a visible sidebar (ModifyPage deck): createDoc("dummy.odp"); @@ -153,7 +35,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSidebarSwitchDeck) it = aView.m_aStateChanges.find(".uno:MasterSlidesPanel"); CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); } -} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx b/sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx new file mode 100644 index 000000000000..8d134ae2143f --- /dev/null +++ b/sd/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx @@ -0,0 +1,389 @@ +/* -*- 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/. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace css; + +class SdTiledRenderingTest : public UnoApiXmlTest +{ +public: + SdTiledRenderingTest(); + virtual void setUp() override; + virtual void tearDown() override; + +protected: + SdXImpressDocument* createDoc(const char* pName, + const uno::Sequence& rArguments + = uno::Sequence()); + void setupLibreOfficeKitViewCallback(SfxViewShell& pViewShell); + static void callback(int nType, const char* pPayload, void* pData); + void callbackImpl(int nType, const char* pPayload); + xmlDocUniquePtr parseXmlDump(); + + ::tools::Rectangle m_aInvalidation; + std::vector<::tools::Rectangle> m_aSelection; + bool m_bFound; + sal_Int32 m_nPart; + std::vector m_aSearchResultSelection; + std::vector m_aSearchResultPart; + int m_nSelectionBeforeSearchResult; + int m_nSelectionAfterSearchResult; + int m_nSearchResultCount; + + /// For document size changed callback. + osl::Condition m_aDocumentSizeCondition; + xmlBufferPtr m_pXmlBuffer; + TestLokCallbackWrapper m_callbackWrapper; +}; + +SdTiledRenderingTest::SdTiledRenderingTest() + : UnoApiXmlTest(u"/sd/qa/unit/tiledrendering/data/"_ustr) + , m_bFound(true) + , m_nPart(0) + , m_nSelectionBeforeSearchResult(0) + , m_nSelectionAfterSearchResult(0) + , m_nSearchResultCount(0) + , m_pXmlBuffer(nullptr) + , m_callbackWrapper(&callback, this) +{ +} + +void SdTiledRenderingTest::setUp() +{ + UnoApiXmlTest::setUp(); + + // prevent showing warning message box + setenv("OOX_NO_SMARTART_WARNING", "1", 1); + comphelper::LibreOfficeKit::setActive(true); +} + +void SdTiledRenderingTest::tearDown() +{ + if (mxComponent.is()) + { + mxComponent->dispose(); + mxComponent.clear(); + } + + if (m_pXmlBuffer) + xmlBufferFree(m_pXmlBuffer); + + m_callbackWrapper.clear(); + comphelper::LibreOfficeKit::setActive(false); + + UnoApiXmlTest::tearDown(); +} + +SdXImpressDocument* +SdTiledRenderingTest::createDoc(const char* pName, + const uno::Sequence& rArguments) +{ + loadFromFile(OUString::createFromAscii(pName)); + SdXImpressDocument* pImpressDocument = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pImpressDocument); + pImpressDocument->initializeForTiledRendering(rArguments); + return pImpressDocument; +} + +void SdTiledRenderingTest::setupLibreOfficeKitViewCallback(SfxViewShell& pViewShell) +{ + pViewShell.setLibreOfficeKitViewCallback(&m_callbackWrapper); + m_callbackWrapper.setLOKViewId(SfxLokHelper::getView(&pViewShell)); +} + +void SdTiledRenderingTest::callback(int nType, const char* pPayload, void* pData) +{ + static_cast(pData)->callbackImpl(nType, pPayload); +} + +std::vector lcl_convertSeparated(std::u16string_view rString, sal_Unicode nSeparator) +{ + std::vector aRet; + + sal_Int32 nIndex = 0; + do + { + OUString aToken(o3tl::trim(o3tl::getToken(rString, 0, nSeparator, nIndex))); + if (!aToken.isEmpty()) + aRet.push_back(aToken); + } while (nIndex >= 0); + + return aRet; +} + +void lcl_convertRectangle(std::u16string_view rString, ::tools::Rectangle& rRectangle) +{ + uno::Sequence aSeq = comphelper::string::convertCommaSeparated(rString); + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); + rRectangle.SetLeft(aSeq[0].toInt32()); + rRectangle.SetTop(aSeq[1].toInt32()); + rRectangle.setWidth(aSeq[2].toInt32()); + rRectangle.setHeight(aSeq[3].toInt32()); +} + +void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload) +{ + switch (nType) + { + case LOK_CALLBACK_INVALIDATE_TILES: + { + OUString aPayload = OUString::createFromAscii(pPayload); + if (aPayload != "EMPTY" && m_aInvalidation.IsEmpty()) + lcl_convertRectangle(aPayload, m_aInvalidation); + } + break; + case LOK_CALLBACK_TEXT_SELECTION: + { + OUString aPayload = OUString::createFromAscii(pPayload); + m_aSelection.clear(); + for (const OUString& rString : lcl_convertSeparated(aPayload, u';')) + { + ::tools::Rectangle aRectangle; + lcl_convertRectangle(rString, aRectangle); + m_aSelection.push_back(aRectangle); + } + if (m_aSearchResultSelection.empty()) + ++m_nSelectionBeforeSearchResult; + else + ++m_nSelectionAfterSearchResult; + } + break; + case LOK_CALLBACK_SEARCH_NOT_FOUND: + { + m_bFound = false; + } + break; + case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: + { + m_aDocumentSizeCondition.set(); + } + break; + case LOK_CALLBACK_SET_PART: + { + OUString aPayload = OUString::createFromAscii(pPayload); + m_nPart = aPayload.toInt32(); + } + break; + case LOK_CALLBACK_SEARCH_RESULT_SELECTION: + { + m_nSearchResultCount++; + m_aSearchResultSelection.clear(); + m_aSearchResultPart.clear(); + boost::property_tree::ptree aTree; + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, aTree); + for (const boost::property_tree::ptree::value_type& rValue : + aTree.get_child("searchResultSelection")) + { + m_aSearchResultSelection.emplace_back( + rValue.second.get("rectangles").c_str()); + m_aSearchResultPart.push_back( + std::atoi(rValue.second.get("part").c_str())); + } + } + break; + } +} + +xmlDocUniquePtr SdTiledRenderingTest::parseXmlDump() +{ + if (m_pXmlBuffer) + xmlBufferFree(m_pXmlBuffer); + + // Create the xml writer. + m_pXmlBuffer = xmlBufferCreate(); + xmlTextWriterPtr pXmlWriter = xmlNewTextWriterMemory(m_pXmlBuffer, 0); + (void)xmlTextWriterStartDocument(pXmlWriter, nullptr, nullptr, nullptr); + + // Create the dump. + SdXImpressDocument* pImpressDocument = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pImpressDocument); + pImpressDocument->GetDoc()->dumpAsXml(pXmlWriter); + + // Delete the xml writer. + (void)xmlTextWriterEndDocument(pXmlWriter); + xmlFreeTextWriter(pXmlWriter); + + auto pCharBuffer = xmlBufferContent(m_pXmlBuffer); + SAL_INFO("test", "SdTiledRenderingTest::parseXmlDump: pCharBuffer is '" << pCharBuffer << "'"); + return xmlDocUniquePtr(xmlParseDoc(pCharBuffer)); +} + +/// A view callback tracks callbacks invoked on one specific view. +class ViewCallback final +{ + SfxViewShell* mpViewShell; + int mnView; + +public: + bool m_bGraphicSelectionInvalidated; + bool m_bGraphicViewSelectionInvalidated; + /// Our current part, to be able to decide if a view cursor/selection is relevant for us. + int m_nPart; + bool m_bCursorVisibleChanged; + bool m_bCursorVisible; + bool m_bViewLock; + bool m_bTilesInvalidated; + std::vector m_aInvalidations; + std::map m_aViewCursorInvalidations; + std::map m_aViewCursorVisibilities; + bool m_bViewSelectionSet; + boost::property_tree::ptree m_aCommentCallbackResult; + OString m_ShapeSelection; + std::map m_aStateChanges; + TestLokCallbackWrapper m_callbackWrapper; + + ViewCallback() + : m_bGraphicSelectionInvalidated(false) + , m_bGraphicViewSelectionInvalidated(false) + , m_nPart(0) + , m_bCursorVisibleChanged(false) + , m_bCursorVisible(false) + , m_bViewLock(false) + , m_bTilesInvalidated(false) + , m_bViewSelectionSet(false) + , m_callbackWrapper(&callback, this) + { + mpViewShell = SfxViewShell::Current(); + mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper); + mnView = SfxLokHelper::getView(); + m_callbackWrapper.setLOKViewId(mnView); + } + + ~ViewCallback() + { + SfxLokHelper::setView(mnView); + mpViewShell->setLibreOfficeKitViewCallback(nullptr); + } + + static void callback(int nType, const char* pPayload, void* pData) + { + static_cast(pData)->callbackImpl(nType, pPayload); + } + + void callbackImpl(int nType, const char* pPayload) + { + switch (nType) + { + case LOK_CALLBACK_INVALIDATE_TILES: + { + m_bTilesInvalidated = true; + OString text(pPayload); + if (!text.startsWith("EMPTY")) + { + uno::Sequence aSeq = comphelper::string::convertCommaSeparated( + OUString::createFromAscii(pPayload)); + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); + tools::Rectangle aInvalidationRect; + aInvalidationRect.SetLeft(aSeq[0].toInt32()); + aInvalidationRect.SetTop(aSeq[1].toInt32()); + aInvalidationRect.setWidth(aSeq[2].toInt32()); + aInvalidationRect.setHeight(aSeq[3].toInt32()); + m_aInvalidations.push_back(aInvalidationRect); + } + } + break; + case LOK_CALLBACK_GRAPHIC_SELECTION: + { + m_bGraphicSelectionInvalidated = true; + m_ShapeSelection = OString(pPayload); + } + break; + case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + if (aTree.get_child("part").get_value() == m_nPart) + // Ignore callbacks which are for a different part. + m_bGraphicViewSelectionInvalidated = true; + } + break; + case LOK_CALLBACK_CURSOR_VISIBLE: + { + m_bCursorVisibleChanged = true; + m_bCursorVisible = (std::string_view("true") == pPayload); + } + break; + case LOK_CALLBACK_VIEW_LOCK: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + m_bViewLock = aTree.get_child("rectangle").get_value() != "EMPTY"; + } + break; + case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + int nViewId = aTree.get_child("viewId").get_value(); + m_aViewCursorInvalidations[nViewId] = true; + } + break; + case LOK_CALLBACK_VIEW_CURSOR_VISIBLE: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + const int nViewId = aTree.get_child("viewId").get_value(); + m_aViewCursorVisibilities[nViewId] = std::string_view("true") == pPayload; + } + break; + case LOK_CALLBACK_TEXT_VIEW_SELECTION: + { + m_bViewSelectionSet = true; + } + break; + case LOK_CALLBACK_COMMENT: + { + m_aCommentCallbackResult.clear(); + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, m_aCommentCallbackResult); + m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment"); + } + break; + case LOK_CALLBACK_STATE_CHANGED: + { + std::stringstream aStream(pPayload); + if (!aStream.str().starts_with("{")) + { + break; + } + + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + auto it = aTree.find("commandName"); + if (it == aTree.not_found()) + { + break; + } + + std::string aCommandName = it->second.get_value(); + m_aStateChanges[aCommandName] = aTree; + } + break; + } + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 53872d4eee780dce8072800eb333c618ece37c32 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 12:05:57 +0100 Subject: [PATCH 113/373] PVS: V547 Expression '!aHandlePropVec.empty()' is always true. Change-Id: I1eaf7fbb481f061948d65e9b7e855d9a9261e3ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177001 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- filter/source/msfilter/msdffimp.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index c1b5ada846e4..60fa228f7f8c 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -2155,10 +2155,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt aHandlePropVec.push_back( aProp ); } } - if ( !aHandlePropVec.empty() ) - { - aHandlesRange[ i ] = comphelper::containerToSequence(aHandlePropVec); - } + aHandlesRange[ i ] = comphelper::containerToSequence(aHandlePropVec); } // pushing the whole Handles element aProp.Name = "Handles"; From 2bcaafd4a25e4875ab08114f5a8d198ad3a35212 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 12:20:36 +0100 Subject: [PATCH 114/373] PVS: V1048 The 'nConcurrency' variable was assigned the same value. Change-Id: I5819652b2f5ab491b7412e6cb4d0159f640297bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177012 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- forms/source/component/DatabaseForm.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index e68551c9fd5b..7cc92ac11c32 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -1120,8 +1120,6 @@ bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNotifie // we can't be updatable! if (m_bSubForm && !hasValidParent()) { - nConcurrency = ResultSetConcurrency::READ_ONLY; - // don't use any parameters if we don't have a valid parent m_aParameterManager.setAllParametersNull(); @@ -1131,8 +1129,6 @@ bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNotifie } else if (m_bAllowInsert || m_bAllowUpdate || m_bAllowDelete) nConcurrency = ResultSetConcurrency::UPDATABLE; - else - nConcurrency = ResultSetConcurrency::READ_ONLY; m_xAggregateSet->setPropertyValue( PROPERTY_RESULTSET_CONCURRENCY, Any( nConcurrency ) ); m_xAggregateSet->setPropertyValue( PROPERTY_RESULTSET_TYPE, Any( sal_Int32(ResultSetType::SCROLL_SENSITIVE) ) ); From 816b51c7a9cdd72eaa01f3c074ba5a8446917d19 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 12:48:41 +0100 Subject: [PATCH 115/373] PVS: V547 Expression 'bNoDictionaryAvailable' is always false MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit a50a2bf8e8c6084aeacb8d2db42e21f528410742 Author: Szymon Kłos Date: Thu Jan 24 11:22:22 2019 +0100 tdf#86731 Don't show 'start from beginning' when dictionary is missing Change-Id: Ib71051ddbb3318c74fb5020ec27560f1c6f73893 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177017 Reviewed-by: Szymon Kłos Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/inc/strings.hrc | 1 - sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index a6ce4cad0a5a..44b011cba6b7 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -945,7 +945,6 @@ #define STR_QUERY_SPELL_CONTINUE NC_("STR_QUERY_SPELL_CONTINUE", "Continue checking at beginning of document?") #define STR_SPELLING_COMPLETED NC_("STR_SPELLING_COMPLETED", "The spellcheck is complete.") -#define STR_DICTIONARY_UNAVAILABLE NC_("STR_DICTIONARY_UNAVAILABLE", "No dictionary available") /*-------------------------------------------------------------------- Description: strings for the types diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 6a865078af74..db9c5a84289f 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -401,7 +401,7 @@ The code below would only be part of the solution. if( aRet.empty() && bCloseMessage && !bNoDictionaryAvailable ) { LockFocusNotification( true ); - OUString sInfo( SwResId( bNoDictionaryAvailable ? STR_DICTIONARY_UNAVAILABLE : STR_SPELLING_COMPLETED ) ); + OUString sInfo( SwResId( STR_SPELLING_COMPLETED ) ); auto xSpellController = GetController(); // #i84610# std::unique_ptr xBox( From 2fa20173229c35de5432a7ad60a9c7e942aac37e Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 22 Nov 2024 10:40:25 +0100 Subject: [PATCH 116/373] tdf#163486: PVS V1043 global object variable is declared in header (include/) Change-Id: If6a656f47cb88dd218af660def31ece572a3b8ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176989 Reviewed-by: Julien Nabet Tested-by: Jenkins --- include/svx/svdtrans.hxx | 2 +- include/svx/svdtypes.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx index 2b32386e1004..1d490b1e1158 100644 --- a/include/svx/svdtrans.hxx +++ b/include/svx/svdtrans.hxx @@ -30,7 +30,7 @@ #include // That maximum shear angle -constexpr Degree100 SDRMAXSHEAR(8900); +inline constexpr Degree100 SDRMAXSHEAR(8900); class XPolygon; class XPolyPolygon; diff --git a/include/svx/svdtypes.hxx b/include/svx/svdtypes.hxx index 1009b0314923..41a3272d7c41 100644 --- a/include/svx/svdtypes.hxx +++ b/include/svx/svdtypes.hxx @@ -57,7 +57,7 @@ typedef o3tl::strong_int SdrLayerID; // If there is no layer when it should be identified, then // SdrLayerAdmin::GetLayerID(const String&) returns a value. -constexpr SdrLayerID SDRLAYER_NOTFOUND(-1); +inline constexpr SdrLayerID SDRLAYER_NOTFOUND(-1); /* * Repeat From de7e10f9dd823d3be8cb5a9f960c6b5a43e671f2 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 22 Nov 2024 10:42:00 +0100 Subject: [PATCH 117/373] tdf#163486: PVS V1043 global object variable is declared in header (sc) Change-Id: Ie328b5120bc879702db351555c9db5d6b661be41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176990 Reviewed-by: Julien Nabet Tested-by: Jenkins --- sc/inc/global.hxx | 26 +++---- sc/inc/scitems.hxx | 186 ++++++++++++++++++++++----------------------- 2 files changed, 106 insertions(+), 106 deletions(-) diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 616930567210..fd51ff15808b 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -84,15 +84,15 @@ const sal_uInt16 MAXZOOM = 400; const SCSIZE MAXSUBTOTAL = 3; // ~105.88 twip, i.e. about 2 times narrower than o3tl::Length::ch, which is 210 twip -constexpr auto TWIPS_PER_CHAR = o3tl::toTwips(1 / 13.6, o3tl::Length::in); +inline constexpr auto TWIPS_PER_CHAR = o3tl::toTwips(1 / 13.6, o3tl::Length::in); -constexpr sal_Int32 STD_COL_WIDTH = o3tl::convert(64, o3tl::Length::pt, o3tl::Length::twip); -constexpr sal_Int32 STD_EXTRA_WIDTH = o3tl::convert(2, o3tl::Length::mm, o3tl::Length::twip); +inline constexpr sal_Int32 STD_COL_WIDTH = o3tl::convert(64, o3tl::Length::pt, o3tl::Length::twip); +inline constexpr sal_Int32 STD_EXTRA_WIDTH = o3tl::convert(2, o3tl::Length::mm, o3tl::Length::twip); -constexpr sal_Int32 MAX_EXTRA_WIDTH = o3tl::convert(42, o3tl::Length::cm, o3tl::Length::twip); -constexpr sal_Int32 MAX_EXTRA_HEIGHT = o3tl::convert(42, o3tl::Length::cm, o3tl::Length::twip); -constexpr sal_Int32 MAX_COL_WIDTH = o3tl::convert(1, o3tl::Length::m, o3tl::Length::twip); -constexpr sal_Int32 MAX_ROW_HEIGHT = o3tl::convert(1, o3tl::Length::m, o3tl::Length::twip); +inline constexpr sal_Int32 MAX_EXTRA_WIDTH = o3tl::convert(42, o3tl::Length::cm, o3tl::Length::twip); +inline constexpr sal_Int32 MAX_EXTRA_HEIGHT = o3tl::convert(42, o3tl::Length::cm, o3tl::Length::twip); +inline constexpr sal_Int32 MAX_COL_WIDTH = o3tl::convert(1, o3tl::Length::m, o3tl::Length::twip); +inline constexpr sal_Int32 MAX_ROW_HEIGHT = o3tl::convert(1, o3tl::Length::m, o3tl::Length::twip); /* standard row height: text + margin - STD_ROWHEIGHT_DIFF */ #define STD_ROWHEIGHT_DIFF 23 @@ -207,11 +207,11 @@ namespace o3tl { // Layer id's for drawing. // These are both id's and positions. -constexpr SdrLayerID SC_LAYER_FRONT (0); -constexpr SdrLayerID SC_LAYER_BACK (1); -constexpr SdrLayerID SC_LAYER_INTERN (2); -constexpr SdrLayerID SC_LAYER_CONTROLS(3); -constexpr SdrLayerID SC_LAYER_HIDDEN (4); +inline constexpr SdrLayerID SC_LAYER_FRONT (0); +inline constexpr SdrLayerID SC_LAYER_BACK (1); +inline constexpr SdrLayerID SC_LAYER_INTERN (2); +inline constexpr SdrLayerID SC_LAYER_CONTROLS(3); +inline constexpr SdrLayerID SC_LAYER_HIDDEN (4); // link tables enum class ScLinkMode { @@ -463,7 +463,7 @@ struct ScImportParam // Formula data replacement character for a pair of parentheses at end of // function name, to force sorting parentheses before all other characters. // Collation may treat parentheses differently. -constexpr sal_Unicode cParenthesesReplacement = 0x0001; +inline constexpr sal_Unicode cParenthesesReplacement = 0x0001; struct InputHandlerFunctionNames { ScTypedCaseStrSet maFunctionData; diff --git a/sc/inc/scitems.hxx b/sc/inc/scitems.hxx index 1791ee9f7571..c2485993546e 100644 --- a/sc/inc/scitems.hxx +++ b/sc/inc/scitems.hxx @@ -99,110 +99,110 @@ class SvxSetItem; // Item-IDs for attributes: -constexpr sal_uInt16 ATTR_STARTINDEX(100); // begin of attributes +inline constexpr sal_uInt16 ATTR_STARTINDEX(100); // begin of attributes -constexpr sal_uInt16 ATTR_PATTERN_START(100); // begin of cell-attribute-pattern +inline constexpr sal_uInt16 ATTR_PATTERN_START(100); // begin of cell-attribute-pattern -constexpr TypedWhichId ATTR_FONT (100); // begin of cell-attributes -constexpr TypedWhichId ATTR_FONT_HEIGHT (101); -constexpr TypedWhichId ATTR_FONT_WEIGHT (102); -constexpr TypedWhichId ATTR_FONT_POSTURE (103); -constexpr TypedWhichId ATTR_FONT_UNDERLINE (104); -constexpr TypedWhichId ATTR_FONT_OVERLINE (105); -constexpr TypedWhichId ATTR_FONT_CROSSEDOUT (106); -constexpr TypedWhichId ATTR_FONT_CONTOUR (107); -constexpr TypedWhichId ATTR_FONT_SHADOWED (108); -constexpr TypedWhichId ATTR_FONT_COLOR (109); -constexpr TypedWhichId ATTR_FONT_LANGUAGE (110); -constexpr TypedWhichId ATTR_CJK_FONT (111); -constexpr TypedWhichId ATTR_CJK_FONT_HEIGHT (112); -constexpr TypedWhichId ATTR_CJK_FONT_WEIGHT (113); -constexpr TypedWhichId ATTR_CJK_FONT_POSTURE (114); -constexpr TypedWhichId ATTR_CJK_FONT_LANGUAGE (115); -constexpr TypedWhichId ATTR_CTL_FONT (116); -constexpr TypedWhichId ATTR_CTL_FONT_HEIGHT (117); -constexpr TypedWhichId ATTR_CTL_FONT_WEIGHT (118); -constexpr TypedWhichId ATTR_CTL_FONT_POSTURE (119); -constexpr TypedWhichId ATTR_CTL_FONT_LANGUAGE (120); -constexpr TypedWhichId ATTR_FONT_EMPHASISMARK (121); -constexpr TypedWhichId ATTR_USERDEF (122); // not saved in binary files -constexpr TypedWhichId ATTR_FONT_WORDLINE (123); -constexpr TypedWhichId ATTR_FONT_RELIEF (124); -constexpr TypedWhichId ATTR_HYPHENATE (125); -constexpr TypedWhichId ATTR_SCRIPTSPACE (126); -constexpr TypedWhichId ATTR_HANGPUNCTUATION (127); -constexpr TypedWhichId ATTR_FORBIDDEN_RULES (128); -constexpr TypedWhichId ATTR_HOR_JUSTIFY (129); -constexpr TypedWhichId ATTR_HOR_JUSTIFY_METHOD (130); -constexpr TypedWhichId ATTR_INDENT (131); -constexpr TypedWhichId ATTR_VER_JUSTIFY (132); -constexpr TypedWhichId ATTR_VER_JUSTIFY_METHOD (133); -constexpr TypedWhichId ATTR_STACKED (134); -constexpr TypedWhichId ATTR_ROTATE_VALUE (135); -constexpr TypedWhichId ATTR_ROTATE_MODE (136); -constexpr TypedWhichId ATTR_VERTICAL_ASIAN (137); -constexpr TypedWhichId ATTR_WRITINGDIR (138); -constexpr TypedWhichId ATTR_LINEBREAK (139); -constexpr TypedWhichId ATTR_SHRINKTOFIT (140); -constexpr TypedWhichId ATTR_BORDER_TLBR (141); -constexpr TypedWhichId ATTR_BORDER_BLTR (142); -constexpr TypedWhichId ATTR_MARGIN (143); -constexpr TypedWhichId ATTR_MERGE (144); -constexpr TypedWhichId ATTR_MERGE_FLAG (145); -constexpr TypedWhichId ATTR_VALUE_FORMAT (146); -constexpr TypedWhichId ATTR_LANGUAGE_FORMAT (147); -constexpr TypedWhichId ATTR_BACKGROUND (148); -constexpr TypedWhichId ATTR_PROTECTION (149); -constexpr TypedWhichId ATTR_BORDER (150); -constexpr TypedWhichId ATTR_BORDER_INNER (151); // inside, because of template-EditDialog -constexpr TypedWhichId ATTR_SHADOW (152); -constexpr TypedWhichId ATTR_VALIDDATA (153); -constexpr TypedWhichId ATTR_CONDITIONAL (154); -constexpr TypedWhichId ATTR_HYPERLINK (155); +inline constexpr TypedWhichId ATTR_FONT (100); // begin of cell-attributes +inline constexpr TypedWhichId ATTR_FONT_HEIGHT (101); +inline constexpr TypedWhichId ATTR_FONT_WEIGHT (102); +inline constexpr TypedWhichId ATTR_FONT_POSTURE (103); +inline constexpr TypedWhichId ATTR_FONT_UNDERLINE (104); +inline constexpr TypedWhichId ATTR_FONT_OVERLINE (105); +inline constexpr TypedWhichId ATTR_FONT_CROSSEDOUT (106); +inline constexpr TypedWhichId ATTR_FONT_CONTOUR (107); +inline constexpr TypedWhichId ATTR_FONT_SHADOWED (108); +inline constexpr TypedWhichId ATTR_FONT_COLOR (109); +inline constexpr TypedWhichId ATTR_FONT_LANGUAGE (110); +inline constexpr TypedWhichId ATTR_CJK_FONT (111); +inline constexpr TypedWhichId ATTR_CJK_FONT_HEIGHT (112); +inline constexpr TypedWhichId ATTR_CJK_FONT_WEIGHT (113); +inline constexpr TypedWhichId ATTR_CJK_FONT_POSTURE (114); +inline constexpr TypedWhichId ATTR_CJK_FONT_LANGUAGE (115); +inline constexpr TypedWhichId ATTR_CTL_FONT (116); +inline constexpr TypedWhichId ATTR_CTL_FONT_HEIGHT (117); +inline constexpr TypedWhichId ATTR_CTL_FONT_WEIGHT (118); +inline constexpr TypedWhichId ATTR_CTL_FONT_POSTURE (119); +inline constexpr TypedWhichId ATTR_CTL_FONT_LANGUAGE (120); +inline constexpr TypedWhichId ATTR_FONT_EMPHASISMARK (121); +inline constexpr TypedWhichId ATTR_USERDEF (122); // not saved in binary files +inline constexpr TypedWhichId ATTR_FONT_WORDLINE (123); +inline constexpr TypedWhichId ATTR_FONT_RELIEF (124); +inline constexpr TypedWhichId ATTR_HYPHENATE (125); +inline constexpr TypedWhichId ATTR_SCRIPTSPACE (126); +inline constexpr TypedWhichId ATTR_HANGPUNCTUATION (127); +inline constexpr TypedWhichId ATTR_FORBIDDEN_RULES (128); +inline constexpr TypedWhichId ATTR_HOR_JUSTIFY (129); +inline constexpr TypedWhichId ATTR_HOR_JUSTIFY_METHOD (130); +inline constexpr TypedWhichId ATTR_INDENT (131); +inline constexpr TypedWhichId ATTR_VER_JUSTIFY (132); +inline constexpr TypedWhichId ATTR_VER_JUSTIFY_METHOD (133); +inline constexpr TypedWhichId ATTR_STACKED (134); +inline constexpr TypedWhichId ATTR_ROTATE_VALUE (135); +inline constexpr TypedWhichId ATTR_ROTATE_MODE (136); +inline constexpr TypedWhichId ATTR_VERTICAL_ASIAN (137); +inline constexpr TypedWhichId ATTR_WRITINGDIR (138); +inline constexpr TypedWhichId ATTR_LINEBREAK (139); +inline constexpr TypedWhichId ATTR_SHRINKTOFIT (140); +inline constexpr TypedWhichId ATTR_BORDER_TLBR (141); +inline constexpr TypedWhichId ATTR_BORDER_BLTR (142); +inline constexpr TypedWhichId ATTR_MARGIN (143); +inline constexpr TypedWhichId ATTR_MERGE (144); +inline constexpr TypedWhichId ATTR_MERGE_FLAG (145); +inline constexpr TypedWhichId ATTR_VALUE_FORMAT (146); +inline constexpr TypedWhichId ATTR_LANGUAGE_FORMAT (147); +inline constexpr TypedWhichId ATTR_BACKGROUND (148); +inline constexpr TypedWhichId ATTR_PROTECTION (149); +inline constexpr TypedWhichId ATTR_BORDER (150); +inline constexpr TypedWhichId ATTR_BORDER_INNER (151); // inside, because of template-EditDialog +inline constexpr TypedWhichId ATTR_SHADOW (152); +inline constexpr TypedWhichId ATTR_VALIDDATA (153); +inline constexpr TypedWhichId ATTR_CONDITIONAL (154); +inline constexpr TypedWhichId ATTR_HYPERLINK (155); -constexpr sal_uInt16 ATTR_PATTERN_END(155); // end cell-attribute-pattern +inline constexpr sal_uInt16 ATTR_PATTERN_END(155); // end cell-attribute-pattern // page attributes -constexpr TypedWhichId ATTR_LRSPACE (156); // editor: PageDesc-TabPage -constexpr TypedWhichId ATTR_ULSPACE (157); -constexpr TypedWhichId ATTR_PAGE (158); -constexpr TypedWhichId ATTR_PAGE_PAPERBIN (159); -constexpr TypedWhichId ATTR_PAGE_SIZE (160); -constexpr TypedWhichId ATTR_PAGE_HORCENTER (161); -constexpr TypedWhichId ATTR_PAGE_VERCENTER (162); +inline constexpr TypedWhichId ATTR_LRSPACE (156); // editor: PageDesc-TabPage +inline constexpr TypedWhichId ATTR_ULSPACE (157); +inline constexpr TypedWhichId ATTR_PAGE (158); +inline constexpr TypedWhichId ATTR_PAGE_PAPERBIN (159); +inline constexpr TypedWhichId ATTR_PAGE_SIZE (160); +inline constexpr TypedWhichId ATTR_PAGE_HORCENTER (161); +inline constexpr TypedWhichId ATTR_PAGE_VERCENTER (162); -constexpr TypedWhichId ATTR_PAGE_ON (163); // editor: header/footer-page -constexpr TypedWhichId ATTR_PAGE_DYNAMIC (164); -constexpr TypedWhichId ATTR_PAGE_SHARED (165); -constexpr TypedWhichId ATTR_PAGE_SHARED_FIRST (166); +inline constexpr TypedWhichId ATTR_PAGE_ON (163); // editor: header/footer-page +inline constexpr TypedWhichId ATTR_PAGE_DYNAMIC (164); +inline constexpr TypedWhichId ATTR_PAGE_SHARED (165); +inline constexpr TypedWhichId ATTR_PAGE_SHARED_FIRST (166); -constexpr TypedWhichId ATTR_PAGE_NOTES (167); // editor: table -constexpr TypedWhichId ATTR_PAGE_GRID (168); -constexpr TypedWhichId ATTR_PAGE_HEADERS (169); -constexpr TypedWhichId ATTR_PAGE_CHARTS (170); -constexpr TypedWhichId ATTR_PAGE_OBJECTS (171); -constexpr TypedWhichId ATTR_PAGE_DRAWINGS (172); -constexpr TypedWhichId ATTR_PAGE_TOPDOWN (173); -constexpr TypedWhichId ATTR_PAGE_SCALE (174); -constexpr TypedWhichId ATTR_PAGE_SCALETOPAGES (175); -constexpr TypedWhichId ATTR_PAGE_FIRSTPAGENO (176); +inline constexpr TypedWhichId ATTR_PAGE_NOTES (167); // editor: table +inline constexpr TypedWhichId ATTR_PAGE_GRID (168); +inline constexpr TypedWhichId ATTR_PAGE_HEADERS (169); +inline constexpr TypedWhichId ATTR_PAGE_CHARTS (170); +inline constexpr TypedWhichId ATTR_PAGE_OBJECTS (171); +inline constexpr TypedWhichId ATTR_PAGE_DRAWINGS (172); +inline constexpr TypedWhichId ATTR_PAGE_TOPDOWN (173); +inline constexpr TypedWhichId ATTR_PAGE_SCALE (174); +inline constexpr TypedWhichId ATTR_PAGE_SCALETOPAGES (175); +inline constexpr TypedWhichId ATTR_PAGE_FIRSTPAGENO (176); -constexpr TypedWhichId ATTR_PAGE_HEADERLEFT (177); // contents of header/ -constexpr TypedWhichId ATTR_PAGE_FOOTERLEFT (178); // footer (left) -constexpr TypedWhichId ATTR_PAGE_HEADERRIGHT (179); // contents of header/ -constexpr TypedWhichId ATTR_PAGE_FOOTERRIGHT (180); // footer (right) -constexpr TypedWhichId ATTR_PAGE_HEADERFIRST (181); // contents of header/ -constexpr TypedWhichId ATTR_PAGE_FOOTERFIRST (182); // footer (first page) -constexpr TypedWhichId ATTR_PAGE_HEADERSET (183); // the corresponding sets -constexpr TypedWhichId ATTR_PAGE_FOOTERSET (184); +inline constexpr TypedWhichId ATTR_PAGE_HEADERLEFT (177); // contents of header/ +inline constexpr TypedWhichId ATTR_PAGE_FOOTERLEFT (178); // footer (left) +inline constexpr TypedWhichId ATTR_PAGE_HEADERRIGHT (179); // contents of header/ +inline constexpr TypedWhichId ATTR_PAGE_FOOTERRIGHT (180); // footer (right) +inline constexpr TypedWhichId ATTR_PAGE_HEADERFIRST (181); // contents of header/ +inline constexpr TypedWhichId ATTR_PAGE_FOOTERFIRST (182); // footer (first page) +inline constexpr TypedWhichId ATTR_PAGE_HEADERSET (183); // the corresponding sets +inline constexpr TypedWhichId ATTR_PAGE_FOOTERSET (184); -constexpr TypedWhichId ATTR_PAGE_FORMULAS (185); -constexpr TypedWhichId ATTR_PAGE_NULLVALS (186); +inline constexpr TypedWhichId ATTR_PAGE_FORMULAS (185); +inline constexpr TypedWhichId ATTR_PAGE_NULLVALS (186); -constexpr TypedWhichId ATTR_PAGE_SCALETO (187); // #i8868# scale printout to width/height +inline constexpr TypedWhichId ATTR_PAGE_SCALETO (187); // #i8868# scale printout to width/height -constexpr TypedWhichId ATTR_HIDDEN (188); +inline constexpr TypedWhichId ATTR_HIDDEN (188); -constexpr sal_uInt16 ATTR_ENDINDEX(ATTR_HIDDEN); // end of pool-range +inline constexpr sal_uInt16 ATTR_ENDINDEX(ATTR_HIDDEN); // end of pool-range // Dummy Slot-IDs for dialogs From b86368d712a67df4adb35011bf52286d9bd03724 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 22 Nov 2024 11:26:13 +0100 Subject: [PATCH 118/373] tdf#163486: PVS V1043 global object variable is declared in header (sw) Change-Id: I7d8375e822dabcceeaf25eaf4ba1f29ce7494337 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176996 Tested-by: Jenkins Reviewed-by: Julien Nabet --- sw/inc/hintids.hxx | 425 +++++++++++++++++++++--------------------- sw/inc/nodeoffset.hxx | 2 +- 2 files changed, 214 insertions(+), 213 deletions(-) diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 75d0f0e51a0a..546ef7019c08 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -193,62 +193,62 @@ inline constexpr OUString CH_TXT_ATR_SUBST_FIELDEND = u"]"_ustr; * Enums for the hints */ -constexpr sal_uInt16 HINT_BEGIN = 1; +inline constexpr sal_uInt16 HINT_BEGIN = 1; -constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN); +inline constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN); // Ranges for the IDs of the format-attributes. // Which-values for character-format attributes. -constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN); -constexpr TypedWhichId RES_CHRATR_CASEMAP(RES_CHRATR_BEGIN); // 1 -constexpr TypedWhichId RES_CHRATR_CHARSETCOLOR(2); -constexpr TypedWhichId RES_CHRATR_COLOR(3); -constexpr TypedWhichId RES_CHRATR_CONTOUR(4); -constexpr TypedWhichId RES_CHRATR_CROSSEDOUT(5); -constexpr TypedWhichId RES_CHRATR_ESCAPEMENT(6); -constexpr TypedWhichId RES_CHRATR_FONT(7); -constexpr TypedWhichId RES_CHRATR_FONTSIZE(8); -constexpr TypedWhichId RES_CHRATR_KERNING(9); -constexpr TypedWhichId RES_CHRATR_LANGUAGE(10); -constexpr TypedWhichId RES_CHRATR_POSTURE(11); -constexpr TypedWhichId RES_CHRATR_UNUSED1(12); -constexpr TypedWhichId RES_CHRATR_SHADOWED(13); -constexpr TypedWhichId RES_CHRATR_UNDERLINE(14); -constexpr TypedWhichId RES_CHRATR_WEIGHT(15); -constexpr TypedWhichId RES_CHRATR_WORDLINEMODE(16); -constexpr TypedWhichId RES_CHRATR_AUTOKERN(17); -constexpr TypedWhichId RES_CHRATR_BLINK(18); -constexpr TypedWhichId RES_CHRATR_NOHYPHEN(19); -constexpr TypedWhichId RES_CHRATR_UNUSED2(20); -constexpr TypedWhichId RES_CHRATR_BACKGROUND(21); -constexpr TypedWhichId RES_CHRATR_CJK_FONT(22); -constexpr TypedWhichId RES_CHRATR_CJK_FONTSIZE(23); -constexpr TypedWhichId RES_CHRATR_CJK_LANGUAGE(24); -constexpr TypedWhichId RES_CHRATR_CJK_POSTURE(25); -constexpr TypedWhichId RES_CHRATR_CJK_WEIGHT(26); -constexpr TypedWhichId RES_CHRATR_CTL_FONT(27); -constexpr TypedWhichId RES_CHRATR_CTL_FONTSIZE(28); -constexpr TypedWhichId RES_CHRATR_CTL_LANGUAGE(29); -constexpr TypedWhichId RES_CHRATR_CTL_POSTURE(30); -constexpr TypedWhichId RES_CHRATR_CTL_WEIGHT(31); -constexpr TypedWhichId RES_CHRATR_ROTATE(32); -constexpr TypedWhichId RES_CHRATR_EMPHASIS_MARK(33); -constexpr TypedWhichId RES_CHRATR_TWO_LINES(34); -constexpr TypedWhichId RES_CHRATR_SCALEW(35); -constexpr TypedWhichId RES_CHRATR_RELIEF(36); -constexpr TypedWhichId RES_CHRATR_HIDDEN(37); -constexpr TypedWhichId RES_CHRATR_OVERLINE(38); -constexpr TypedWhichId RES_CHRATR_RSID(39); -constexpr TypedWhichId RES_CHRATR_BOX(40); -constexpr TypedWhichId RES_CHRATR_SHADOW(41); -constexpr TypedWhichId RES_CHRATR_HIGHLIGHT(42); -constexpr TypedWhichId RES_CHRATR_GRABBAG(43); -constexpr TypedWhichId RES_CHRATR_BIDIRTL(44); -constexpr TypedWhichId RES_CHRATR_IDCTHINT(45); -constexpr sal_uInt16 RES_CHRATR_END(46); +inline constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN); +inline constexpr TypedWhichId RES_CHRATR_CASEMAP(RES_CHRATR_BEGIN); // 1 +inline constexpr TypedWhichId RES_CHRATR_CHARSETCOLOR(2); +inline constexpr TypedWhichId RES_CHRATR_COLOR(3); +inline constexpr TypedWhichId RES_CHRATR_CONTOUR(4); +inline constexpr TypedWhichId RES_CHRATR_CROSSEDOUT(5); +inline constexpr TypedWhichId RES_CHRATR_ESCAPEMENT(6); +inline constexpr TypedWhichId RES_CHRATR_FONT(7); +inline constexpr TypedWhichId RES_CHRATR_FONTSIZE(8); +inline constexpr TypedWhichId RES_CHRATR_KERNING(9); +inline constexpr TypedWhichId RES_CHRATR_LANGUAGE(10); +inline constexpr TypedWhichId RES_CHRATR_POSTURE(11); +inline constexpr TypedWhichId RES_CHRATR_UNUSED1(12); +inline constexpr TypedWhichId RES_CHRATR_SHADOWED(13); +inline constexpr TypedWhichId RES_CHRATR_UNDERLINE(14); +inline constexpr TypedWhichId RES_CHRATR_WEIGHT(15); +inline constexpr TypedWhichId RES_CHRATR_WORDLINEMODE(16); +inline constexpr TypedWhichId RES_CHRATR_AUTOKERN(17); +inline constexpr TypedWhichId RES_CHRATR_BLINK(18); +inline constexpr TypedWhichId RES_CHRATR_NOHYPHEN(19); +inline constexpr TypedWhichId RES_CHRATR_UNUSED2(20); +inline constexpr TypedWhichId RES_CHRATR_BACKGROUND(21); +inline constexpr TypedWhichId RES_CHRATR_CJK_FONT(22); +inline constexpr TypedWhichId RES_CHRATR_CJK_FONTSIZE(23); +inline constexpr TypedWhichId RES_CHRATR_CJK_LANGUAGE(24); +inline constexpr TypedWhichId RES_CHRATR_CJK_POSTURE(25); +inline constexpr TypedWhichId RES_CHRATR_CJK_WEIGHT(26); +inline constexpr TypedWhichId RES_CHRATR_CTL_FONT(27); +inline constexpr TypedWhichId RES_CHRATR_CTL_FONTSIZE(28); +inline constexpr TypedWhichId RES_CHRATR_CTL_LANGUAGE(29); +inline constexpr TypedWhichId RES_CHRATR_CTL_POSTURE(30); +inline constexpr TypedWhichId RES_CHRATR_CTL_WEIGHT(31); +inline constexpr TypedWhichId RES_CHRATR_ROTATE(32); +inline constexpr TypedWhichId RES_CHRATR_EMPHASIS_MARK(33); +inline constexpr TypedWhichId RES_CHRATR_TWO_LINES(34); +inline constexpr TypedWhichId RES_CHRATR_SCALEW(35); +inline constexpr TypedWhichId RES_CHRATR_RELIEF(36); +inline constexpr TypedWhichId RES_CHRATR_HIDDEN(37); +inline constexpr TypedWhichId RES_CHRATR_OVERLINE(38); +inline constexpr TypedWhichId RES_CHRATR_RSID(39); +inline constexpr TypedWhichId RES_CHRATR_BOX(40); +inline constexpr TypedWhichId RES_CHRATR_SHADOW(41); +inline constexpr TypedWhichId RES_CHRATR_HIGHLIGHT(42); +inline constexpr TypedWhichId RES_CHRATR_GRABBAG(43); +inline constexpr TypedWhichId RES_CHRATR_BIDIRTL(44); +inline constexpr TypedWhichId RES_CHRATR_IDCTHINT(45); +inline constexpr sal_uInt16 RES_CHRATR_END(46); // this Attribute used only in a TextNodes SwpAttr-Array -constexpr sal_uInt16 RES_TXTATR_BEGIN(RES_CHRATR_END); +inline constexpr sal_uInt16 RES_TXTATR_BEGIN(RES_CHRATR_END); /** text attributes with start and end. #i105453#: @@ -266,196 +266,197 @@ constexpr sal_uInt16 RES_TXTATR_BEGIN(RES_CHRATR_END); - INETFMT should precede CJK_RUBY (for UNO API it does not matter...) - META and METAFIELD must precede CJK_RUBY and INETFMT */ -constexpr sal_uInt16 RES_TXTATR_WITHEND_BEGIN(RES_TXTATR_BEGIN); -constexpr TypedWhichId RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN); // 46 -constexpr TypedWhichId RES_TXTATR_TOXMARK(47); -constexpr TypedWhichId RES_TXTATR_META(48); -constexpr TypedWhichId RES_TXTATR_METAFIELD(49); -constexpr TypedWhichId RES_TXTATR_AUTOFMT(50); -constexpr TypedWhichId RES_TXTATR_INETFMT(51); -constexpr TypedWhichId RES_TXTATR_CHARFMT(52); -constexpr TypedWhichId RES_TXTATR_CJK_RUBY(53); -constexpr TypedWhichId RES_TXTATR_UNKNOWN_CONTAINER(54); -constexpr TypedWhichId RES_TXTATR_INPUTFIELD(55); -constexpr TypedWhichId RES_TXTATR_CONTENTCONTROL(56); -constexpr sal_uInt16 RES_TXTATR_WITHEND_END(57); +inline constexpr sal_uInt16 RES_TXTATR_WITHEND_BEGIN(RES_TXTATR_BEGIN); +inline constexpr TypedWhichId RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN); // 46 +inline constexpr TypedWhichId RES_TXTATR_TOXMARK(47); +inline constexpr TypedWhichId RES_TXTATR_META(48); +inline constexpr TypedWhichId RES_TXTATR_METAFIELD(49); +inline constexpr TypedWhichId RES_TXTATR_AUTOFMT(50); +inline constexpr TypedWhichId RES_TXTATR_INETFMT(51); +inline constexpr TypedWhichId RES_TXTATR_CHARFMT(52); +inline constexpr TypedWhichId RES_TXTATR_CJK_RUBY(53); +inline constexpr TypedWhichId RES_TXTATR_UNKNOWN_CONTAINER(54); +inline constexpr TypedWhichId RES_TXTATR_INPUTFIELD(55); +inline constexpr TypedWhichId RES_TXTATR_CONTENTCONTROL(56); +inline constexpr sal_uInt16 RES_TXTATR_WITHEND_END(57); // all TextAttributes without an end -constexpr sal_uInt16 RES_TXTATR_NOEND_BEGIN(RES_TXTATR_WITHEND_END); -constexpr TypedWhichId RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN); // 57 -constexpr TypedWhichId RES_TXTATR_FLYCNT(58); -constexpr TypedWhichId RES_TXTATR_FTN(59); -constexpr TypedWhichId RES_TXTATR_ANNOTATION(60); -constexpr TypedWhichId RES_TXTATR_LINEBREAK(61); -constexpr TypedWhichId RES_TXTATR_DUMMY1(62); -constexpr sal_uInt16 RES_TXTATR_NOEND_END(63); -constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END); +inline constexpr sal_uInt16 RES_TXTATR_NOEND_BEGIN(RES_TXTATR_WITHEND_END); +inline constexpr TypedWhichId RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN); // 57 +inline constexpr TypedWhichId RES_TXTATR_FLYCNT(58); +inline constexpr TypedWhichId RES_TXTATR_FTN(59); +inline constexpr TypedWhichId RES_TXTATR_ANNOTATION(60); +inline constexpr TypedWhichId RES_TXTATR_LINEBREAK(61); +inline constexpr TypedWhichId RES_TXTATR_DUMMY1(62); +inline constexpr sal_uInt16 RES_TXTATR_NOEND_END(63); +inline constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END); -constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END); -constexpr TypedWhichId RES_PARATR_LINESPACING(RES_PARATR_BEGIN); // 63 -constexpr TypedWhichId RES_PARATR_ADJUST(64); -constexpr TypedWhichId RES_PARATR_SPLIT(65); -constexpr TypedWhichId RES_PARATR_ORPHANS(66); -constexpr TypedWhichId RES_PARATR_WIDOWS(67); -constexpr TypedWhichId RES_PARATR_TABSTOP(68); -constexpr TypedWhichId RES_PARATR_HYPHENZONE(69); -constexpr TypedWhichId RES_PARATR_DROP(70); -constexpr TypedWhichId RES_PARATR_REGISTER(71); -constexpr TypedWhichId RES_PARATR_NUMRULE(72); -constexpr TypedWhichId RES_PARATR_SCRIPTSPACE(73); -constexpr TypedWhichId RES_PARATR_HANGINGPUNCTUATION(74); -constexpr TypedWhichId RES_PARATR_FORBIDDEN_RULES(75); -constexpr TypedWhichId RES_PARATR_VERTALIGN(76); -constexpr TypedWhichId RES_PARATR_SNAPTOGRID(77); -constexpr TypedWhichId RES_PARATR_CONNECT_BORDER(78); -constexpr TypedWhichId RES_PARATR_OUTLINELEVEL(79); -constexpr TypedWhichId RES_PARATR_RSID(80); -constexpr TypedWhichId RES_PARATR_GRABBAG(81); -constexpr sal_uInt16 RES_PARATR_END(82); +inline constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END); +inline constexpr TypedWhichId RES_PARATR_LINESPACING(RES_PARATR_BEGIN); // 63 +inline constexpr TypedWhichId RES_PARATR_ADJUST(64); +inline constexpr TypedWhichId RES_PARATR_SPLIT(65); +inline constexpr TypedWhichId RES_PARATR_ORPHANS(66); +inline constexpr TypedWhichId RES_PARATR_WIDOWS(67); +inline constexpr TypedWhichId RES_PARATR_TABSTOP(68); +inline constexpr TypedWhichId RES_PARATR_HYPHENZONE(69); +inline constexpr TypedWhichId RES_PARATR_DROP(70); +inline constexpr TypedWhichId RES_PARATR_REGISTER(71); +inline constexpr TypedWhichId RES_PARATR_NUMRULE(72); +inline constexpr TypedWhichId RES_PARATR_SCRIPTSPACE(73); +inline constexpr TypedWhichId RES_PARATR_HANGINGPUNCTUATION(74); +inline constexpr TypedWhichId RES_PARATR_FORBIDDEN_RULES(75); +inline constexpr TypedWhichId RES_PARATR_VERTALIGN(76); +inline constexpr TypedWhichId RES_PARATR_SNAPTOGRID(77); +inline constexpr TypedWhichId RES_PARATR_CONNECT_BORDER(78); +inline constexpr TypedWhichId RES_PARATR_OUTLINELEVEL(79); +inline constexpr TypedWhichId RES_PARATR_RSID(80); +inline constexpr TypedWhichId RES_PARATR_GRABBAG(81); +inline constexpr sal_uInt16 RES_PARATR_END(82); // list attributes for paragraphs. // intentionally these list attributes are not contained in paragraph styles -constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END); -constexpr TypedWhichId RES_PARATR_LIST_ID(RES_PARATR_LIST_BEGIN); // 82 -constexpr TypedWhichId RES_PARATR_LIST_LEVEL(83); -constexpr TypedWhichId RES_PARATR_LIST_ISRESTART(84); -constexpr TypedWhichId RES_PARATR_LIST_RESTARTVALUE(85); -constexpr TypedWhichId RES_PARATR_LIST_ISCOUNTED(86); -constexpr TypedWhichId +inline constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END); +inline constexpr TypedWhichId RES_PARATR_LIST_ID(RES_PARATR_LIST_BEGIN); // 82 +inline constexpr TypedWhichId RES_PARATR_LIST_LEVEL(83); +inline constexpr TypedWhichId RES_PARATR_LIST_ISRESTART(84); +inline constexpr TypedWhichId RES_PARATR_LIST_RESTARTVALUE(85); +inline constexpr TypedWhichId RES_PARATR_LIST_ISCOUNTED(86); +inline constexpr TypedWhichId RES_PARATR_LIST_AUTOFMT(87); //TypedWhichId(87) -constexpr sal_uInt16 RES_PARATR_LIST_END(88); +inline constexpr sal_uInt16 RES_PARATR_LIST_END(88); -constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END); -constexpr TypedWhichId RES_FILL_ORDER(RES_FRMATR_BEGIN); -constexpr TypedWhichId RES_FRM_SIZE(89); -constexpr TypedWhichId RES_PAPER_BIN(90); -constexpr TypedWhichId RES_MARGIN_FIRSTLINE(91); -constexpr TypedWhichId RES_MARGIN_TEXTLEFT(92); -constexpr TypedWhichId RES_MARGIN_RIGHT(93); -constexpr TypedWhichId RES_MARGIN_LEFT(94); -constexpr TypedWhichId RES_MARGIN_GUTTER(95); -constexpr TypedWhichId RES_MARGIN_GUTTER_RIGHT(96); -constexpr TypedWhichId RES_LR_SPACE(97); -constexpr TypedWhichId RES_UL_SPACE(98); -constexpr TypedWhichId RES_PAGEDESC(99); -constexpr TypedWhichId RES_BREAK(100); -constexpr TypedWhichId RES_CNTNT(101); -constexpr TypedWhichId RES_HEADER(102); -constexpr TypedWhichId RES_FOOTER(103); -constexpr TypedWhichId RES_PRINT(104); -constexpr TypedWhichId RES_OPAQUE(105); -constexpr TypedWhichId RES_PROTECT(106); -constexpr TypedWhichId RES_SURROUND(107); -constexpr TypedWhichId RES_VERT_ORIENT(108); -constexpr TypedWhichId RES_HORI_ORIENT(109); -constexpr TypedWhichId RES_ANCHOR(110); -constexpr TypedWhichId RES_BACKGROUND(111); -constexpr TypedWhichId RES_BOX(112); -constexpr TypedWhichId RES_SHADOW(113); -constexpr TypedWhichId RES_FRMMACRO(114); -constexpr TypedWhichId RES_COL(115); -constexpr TypedWhichId RES_KEEP(116); -constexpr TypedWhichId RES_URL(117); -constexpr TypedWhichId RES_EDIT_IN_READONLY(118); -constexpr TypedWhichId RES_LAYOUT_SPLIT(119); -constexpr TypedWhichId RES_CHAIN(120); -constexpr TypedWhichId RES_TEXTGRID(121); -constexpr TypedWhichId RES_LINENUMBER(122); -constexpr TypedWhichId RES_FTN_AT_TXTEND(123); -constexpr TypedWhichId RES_END_AT_TXTEND(124); -constexpr TypedWhichId RES_COLUMNBALANCE(125); -constexpr TypedWhichId RES_FRAMEDIR(126); -constexpr TypedWhichId RES_HEADER_FOOTER_EAT_SPACING(127); -constexpr TypedWhichId RES_ROW_SPLIT(128); -constexpr TypedWhichId RES_FLY_SPLIT(129); -constexpr TypedWhichId RES_FOLLOW_TEXT_FLOW(130); -constexpr TypedWhichId RES_COLLAPSING_BORDERS(131); -constexpr TypedWhichId RES_WRAP_INFLUENCE_ON_OBJPOS(132); -constexpr TypedWhichId RES_AUTO_STYLE(133); -constexpr TypedWhichId RES_FRMATR_STYLE_NAME(134); -constexpr TypedWhichId RES_FRMATR_CONDITIONAL_STYLE_NAME(135); -constexpr TypedWhichId RES_FRMATR_GRABBAG(136); -constexpr TypedWhichId RES_TEXT_VERT_ADJUST(137); -constexpr TypedWhichId RES_BACKGROUND_FULL_SIZE(138); -constexpr TypedWhichId RES_RTL_GUTTER(139); -constexpr TypedWhichId RES_DECORATIVE(140); -constexpr TypedWhichId RES_WRAP_TEXT_AT_FLY_START(141); -constexpr sal_uInt16 RES_FRMATR_END(142); +inline constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END); +inline constexpr TypedWhichId RES_FILL_ORDER(RES_FRMATR_BEGIN); +inline constexpr TypedWhichId RES_FRM_SIZE(89); +inline constexpr TypedWhichId RES_PAPER_BIN(90); +inline constexpr TypedWhichId RES_MARGIN_FIRSTLINE(91); +inline constexpr TypedWhichId RES_MARGIN_TEXTLEFT(92); +inline constexpr TypedWhichId RES_MARGIN_RIGHT(93); +inline constexpr TypedWhichId RES_MARGIN_LEFT(94); +inline constexpr TypedWhichId RES_MARGIN_GUTTER(95); +inline constexpr TypedWhichId RES_MARGIN_GUTTER_RIGHT(96); +inline constexpr TypedWhichId RES_LR_SPACE(97); +inline constexpr TypedWhichId RES_UL_SPACE(98); +inline constexpr TypedWhichId RES_PAGEDESC(99); +inline constexpr TypedWhichId RES_BREAK(100); +inline constexpr TypedWhichId RES_CNTNT(101); +inline constexpr TypedWhichId RES_HEADER(102); +inline constexpr TypedWhichId RES_FOOTER(103); +inline constexpr TypedWhichId RES_PRINT(104); +inline constexpr TypedWhichId RES_OPAQUE(105); +inline constexpr TypedWhichId RES_PROTECT(106); +inline constexpr TypedWhichId RES_SURROUND(107); +inline constexpr TypedWhichId RES_VERT_ORIENT(108); +inline constexpr TypedWhichId RES_HORI_ORIENT(109); +inline constexpr TypedWhichId RES_ANCHOR(110); +inline constexpr TypedWhichId RES_BACKGROUND(111); +inline constexpr TypedWhichId RES_BOX(112); +inline constexpr TypedWhichId RES_SHADOW(113); +inline constexpr TypedWhichId RES_FRMMACRO(114); +inline constexpr TypedWhichId RES_COL(115); +inline constexpr TypedWhichId RES_KEEP(116); +inline constexpr TypedWhichId RES_URL(117); +inline constexpr TypedWhichId RES_EDIT_IN_READONLY(118); +inline constexpr TypedWhichId RES_LAYOUT_SPLIT(119); +inline constexpr TypedWhichId RES_CHAIN(120); +inline constexpr TypedWhichId RES_TEXTGRID(121); +inline constexpr TypedWhichId RES_LINENUMBER(122); +inline constexpr TypedWhichId RES_FTN_AT_TXTEND(123); +inline constexpr TypedWhichId RES_END_AT_TXTEND(124); +inline constexpr TypedWhichId RES_COLUMNBALANCE(125); +inline constexpr TypedWhichId RES_FRAMEDIR(126); +inline constexpr TypedWhichId RES_HEADER_FOOTER_EAT_SPACING(127); +inline constexpr TypedWhichId RES_ROW_SPLIT(128); +inline constexpr TypedWhichId RES_FLY_SPLIT(129); +inline constexpr TypedWhichId RES_FOLLOW_TEXT_FLOW(130); +inline constexpr TypedWhichId RES_COLLAPSING_BORDERS(131); +inline constexpr TypedWhichId RES_WRAP_INFLUENCE_ON_OBJPOS(132); +inline constexpr TypedWhichId RES_AUTO_STYLE(133); +inline constexpr TypedWhichId RES_FRMATR_STYLE_NAME(134); +inline constexpr TypedWhichId RES_FRMATR_CONDITIONAL_STYLE_NAME(135); +inline constexpr TypedWhichId RES_FRMATR_GRABBAG(136); +inline constexpr TypedWhichId RES_TEXT_VERT_ADJUST(137); +inline constexpr TypedWhichId RES_BACKGROUND_FULL_SIZE(138); +inline constexpr TypedWhichId RES_RTL_GUTTER(139); +inline constexpr TypedWhichId RES_DECORATIVE(140); +inline constexpr TypedWhichId RES_WRAP_TEXT_AT_FLY_START(141); +inline constexpr sal_uInt16 RES_FRMATR_END(142); -constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END); -constexpr TypedWhichId RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN); -constexpr TypedWhichId RES_GRFATR_CROPGRF(143); +inline constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END); +inline constexpr TypedWhichId RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN); +inline constexpr TypedWhichId RES_GRFATR_CROPGRF(143); -constexpr TypedWhichId RES_GRFATR_ROTATION(144); -constexpr TypedWhichId RES_GRFATR_LUMINANCE(145); -constexpr TypedWhichId RES_GRFATR_CONTRAST(146); -constexpr TypedWhichId RES_GRFATR_CHANNELR(147); -constexpr TypedWhichId RES_GRFATR_CHANNELG(148); -constexpr TypedWhichId RES_GRFATR_CHANNELB(149); -constexpr TypedWhichId RES_GRFATR_GAMMA(150); -constexpr TypedWhichId RES_GRFATR_INVERT(151); -constexpr TypedWhichId RES_GRFATR_TRANSPARENCY(152); -constexpr TypedWhichId RES_GRFATR_DRAWMODE(153); +inline constexpr TypedWhichId RES_GRFATR_ROTATION(144); +inline constexpr TypedWhichId RES_GRFATR_LUMINANCE(145); +inline constexpr TypedWhichId RES_GRFATR_CONTRAST(146); +inline constexpr TypedWhichId RES_GRFATR_CHANNELR(147); +inline constexpr TypedWhichId RES_GRFATR_CHANNELG(148); +inline constexpr TypedWhichId RES_GRFATR_CHANNELB(149); +inline constexpr TypedWhichId RES_GRFATR_GAMMA(150); +inline constexpr TypedWhichId RES_GRFATR_INVERT(151); +inline constexpr TypedWhichId RES_GRFATR_TRANSPARENCY(152); +inline constexpr TypedWhichId RES_GRFATR_DRAWMODE(153); -constexpr TypedWhichId RES_GRFATR_DUMMY4(154); -constexpr TypedWhichId RES_GRFATR_DUMMY5(155); -constexpr sal_uInt16 RES_GRFATR_END(156); +inline constexpr TypedWhichId RES_GRFATR_DUMMY4(154); +inline constexpr TypedWhichId RES_GRFATR_DUMMY5(155); +inline constexpr sal_uInt16 RES_GRFATR_END(156); -constexpr sal_uInt16 RES_BOXATR_BEGIN(RES_GRFATR_END); -constexpr TypedWhichId RES_BOXATR_FORMAT(RES_BOXATR_BEGIN); -constexpr TypedWhichId RES_BOXATR_FORMULA(157); -constexpr TypedWhichId RES_BOXATR_VALUE(158); -constexpr sal_uInt16 RES_BOXATR_END(159); +inline constexpr sal_uInt16 RES_BOXATR_BEGIN(RES_GRFATR_END); +inline constexpr TypedWhichId RES_BOXATR_FORMAT(RES_BOXATR_BEGIN); +inline constexpr TypedWhichId RES_BOXATR_FORMULA(157); +inline constexpr TypedWhichId RES_BOXATR_VALUE(158); +inline constexpr sal_uInt16 RES_BOXATR_END(159); -constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END); -constexpr TypedWhichId RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN); -constexpr sal_uInt16 RES_UNKNOWNATR_END(160); +inline constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END); +inline constexpr TypedWhichId + RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN); +inline constexpr sal_uInt16 RES_UNKNOWNATR_END(160); -constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END); +inline constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END); // Format IDs -constexpr sal_uInt16 RES_FMT_BEGIN(RES_UNKNOWNATR_END); -constexpr TypedWhichId RES_CHRFMT(RES_FMT_BEGIN); -constexpr TypedWhichId RES_FRMFMT(161); -constexpr TypedWhichId RES_FLYFRMFMT(162); -constexpr TypedWhichId RES_TXTFMTCOLL(163); -constexpr TypedWhichId RES_GRFFMTCOLL(164); -constexpr TypedWhichId RES_DRAWFRMFMT(165); -constexpr TypedWhichId RES_CONDTXTFMTCOLL(166); -constexpr sal_uInt16 RES_FMT_END(167); +inline constexpr sal_uInt16 RES_FMT_BEGIN(RES_UNKNOWNATR_END); +inline constexpr TypedWhichId RES_CHRFMT(RES_FMT_BEGIN); +inline constexpr TypedWhichId RES_FRMFMT(161); +inline constexpr TypedWhichId RES_FLYFRMFMT(162); +inline constexpr TypedWhichId RES_TXTFMTCOLL(163); +inline constexpr TypedWhichId RES_GRFFMTCOLL(164); +inline constexpr TypedWhichId RES_DRAWFRMFMT(165); +inline constexpr TypedWhichId RES_CONDTXTFMTCOLL(166); +inline constexpr sal_uInt16 RES_FMT_END(167); // ID's for Messages in the Formats -constexpr sal_uInt16 RES_FORMAT_MSG_BEGIN(RES_FMT_END); -constexpr TypedWhichId RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN); // 167 -constexpr TypedWhichId RES_FMT_CHG(168); -constexpr TypedWhichId RES_ATTRSET_CHG(169); -constexpr TypedWhichId RES_UPDATE_ATTR(170); -constexpr TypedWhichId RES_HIDDENPARA_PRINT(178); -constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181); +inline constexpr sal_uInt16 RES_FORMAT_MSG_BEGIN(RES_FMT_END); +inline constexpr TypedWhichId RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN); // 167 +inline constexpr TypedWhichId RES_FMT_CHG(168); +inline constexpr TypedWhichId RES_ATTRSET_CHG(169); +inline constexpr TypedWhichId RES_UPDATE_ATTR(170); +inline constexpr TypedWhichId RES_HIDDENPARA_PRINT(178); +inline constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181); // empty -constexpr sal_uInt16 RES_FORMAT_MSG_END(190); +inline constexpr sal_uInt16 RES_FORMAT_MSG_END(190); // An ID for the RTF-reader. The stylesheets are treated like attributes, // i.e. there is a StyleSheet-attribute. To avoid collision with other // Which()-values, the value is listed here. (The help system too defines // new attributes!) -constexpr sal_uInt16 RES_FLTRATTR_BEGIN(RES_FORMAT_MSG_END); -constexpr TypedWhichId RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN); -constexpr TypedWhichId RES_FLTR_ANCHOR(191); -constexpr TypedWhichId RES_FLTR_NUMRULE(192); -constexpr TypedWhichId RES_FLTR_TOX(193); -constexpr TypedWhichId RES_FLTR_REDLINE(194); -constexpr TypedWhichId RES_FLTR_ANNOTATIONMARK(195); -constexpr TypedWhichId RES_FLTR_RDFMARK(196); -constexpr sal_uInt16 RES_FLTRATTR_END(197); +inline constexpr sal_uInt16 RES_FLTRATTR_BEGIN(RES_FORMAT_MSG_END); +inline constexpr TypedWhichId RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN); +inline constexpr TypedWhichId RES_FLTR_ANCHOR(191); +inline constexpr TypedWhichId RES_FLTR_NUMRULE(192); +inline constexpr TypedWhichId RES_FLTR_TOX(193); +inline constexpr TypedWhichId RES_FLTR_REDLINE(194); +inline constexpr TypedWhichId RES_FLTR_ANNOTATIONMARK(195); +inline constexpr TypedWhichId RES_FLTR_RDFMARK(196); +inline constexpr sal_uInt16 RES_FLTRATTR_END(197); -constexpr sal_uInt16 RES_TBX_DUMMY(RES_FLTRATTR_END + 1); +inline constexpr sal_uInt16 RES_TBX_DUMMY(RES_FLTRATTR_END + 1); -constexpr TypedWhichId HINT_END(RES_TBX_DUMMY); +inline constexpr TypedWhichId HINT_END(RES_TBX_DUMMY); // Error recognition!! -constexpr sal_uInt16 INVALID_HINT(HINT_END); -constexpr sal_uInt16 RES_WHICHHINT_END(HINT_END); +inline constexpr sal_uInt16 INVALID_HINT(HINT_END); +inline constexpr sal_uInt16 RES_WHICHHINT_END(HINT_END); inline bool isATR(const sal_uInt16 nWhich) { diff --git a/sw/inc/nodeoffset.hxx b/sw/inc/nodeoffset.hxx index f6deac6609b0..e905d63add24 100644 --- a/sw/inc/nodeoffset.hxx +++ b/sw/inc/nodeoffset.hxx @@ -31,7 +31,7 @@ template inline SwNodeOffset operator-(SwNodeOffset a, inline SwNodeOffset abs(const SwNodeOffset& a) { return a > SwNodeOffset(0) ? a : -a; } inline SwNodeOffset min(const SwNodeOffset& a, const SwNodeOffset& b) { return a > b ? a : b; } -constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32); +inline constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32); SW_DLLPUBLIC std::ostream& operator<<(std::ostream& s, const SwNodeOffset& index); From e85d48c90ec647665be7eb8e76a98ec3feadd5ce Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Fri, 22 Nov 2024 13:37:01 +0100 Subject: [PATCH 119/373] Fix typos Change-Id: I49cf90c401243c9606372735ad160f5f2b63b603 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177026 Reviewed-by: Julien Nabet Tested-by: Julien Nabet --- sal/osl/unx/pipe.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx index c4420731795d..c9c8cc31c705 100644 --- a/sal/osl/unx/pipe.cxx +++ b/sal/osl/unx/pipe.cxx @@ -373,7 +373,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe) int socket; { - // dont hold lock while accepting, so it is possible to close a socket blocked in accept + // don't hold lock while accepting, so it is possible to close a socket blocked in accept std::unique_lock aGuard(pPipe->m_Mutex); assert(pPipe->m_Name[0] != '\0'); // you cannot have an empty pipe name @@ -445,7 +445,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe, int socket; { - // dont hold lock while receiving, so it is possible to close a socket blocked in recv + // don't hold lock while receiving, so it is possible to close a socket blocked in recv std::unique_lock aGuard(pPipe->m_Mutex); socket = pPipe->m_Socket; } @@ -473,7 +473,7 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe, int socket; { - // dont hold lock while sending, so it is possible to close a socket blocked in send + // don't hold lock while sending, so it is possible to close a socket blocked in send std::unique_lock aGuard(pPipe->m_Mutex); socket = pPipe->m_Socket; } From a57d16d5243cc8b89f0ba9f345bda15685d9f6b5 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 12:30:06 +0100 Subject: [PATCH 120/373] PVS: V1048 The 'bTestAllowed' variable was assigned the same value. Change-Id: I8322b68ce93adedbcb5ae2462b5ed1868d3552db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177013 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/source/filter/ww8/ww8par2.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 0f5e7129b5f0..dc2a4ed4f77a 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -470,10 +470,7 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd, //in tables) if (nCellLevel == m_nInTable) { - - if (!m_nInTable) - bTestAllowed = true; - else + if (m_nInTable) { if (!m_xTableDesc) { From 026e52441be266a3cbe9e2e19d9ff0c4c568542b Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 13:11:08 +0100 Subject: [PATCH 121/373] sw: no need to pass a bool as a reference Change-Id: I62aabd66d368856959be032d866888b82b018dd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177018 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/inc/ndtxt.hxx | 3 +-- sw/source/core/txtnode/ndtxt.cxx | 4 +++- .../docvw/OutlineContentVisibilityWin.cxx | 3 +-- sw/source/uibase/docvw/edtwin.cxx | 3 +-- sw/source/uibase/shells/basesh.cxx | 12 +++------- sw/source/uibase/wrtsh/wrtsh1.cxx | 23 +++++-------------- 6 files changed, 15 insertions(+), 33 deletions(-) diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 9b3736e69ac2..74dc4ef031cb 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -655,10 +655,9 @@ public: /** * @brief GetAttrOutlineContentVisible - * @param bOutlineContentVisibleAttr the value stored in RES_PARATR_GRABBAG for 'OutlineContentVisibleAttr' * @return true if 'OutlineContentVisibleAttr' is found in RES_PARATR_GRABBAG */ - void GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr); + bool GetAttrOutlineContentVisible(); void SetAttrOutlineContentVisible(bool bVisible); bool IsEmptyListStyleDueToSetOutlineLevelAttr() const { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;} diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 3c4c4fbd4561..16df75aec25a 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -4201,12 +4201,14 @@ void SwTextNode::SetAttrOutlineLevel(int nLevel) } } -void SwTextNode::GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr) +bool SwTextNode::GetAttrOutlineContentVisible() { + bool bOutlineContentVisibleAttr = true; const SfxGrabBagItem & rGrabBagItem = GetAttr(RES_PARATR_GRABBAG); auto it = rGrabBagItem.GetGrabBag().find(u"OutlineContentVisibleAttr"_ustr); if (it != rGrabBagItem.GetGrabBag().end()) it->second >>= bOutlineContentVisibleAttr; + return bOutlineContentVisibleAttr; } void SwTextNode::SetAttrOutlineContentVisible(bool bVisible) diff --git a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx index eebc0e905f14..9c7bf7d4b08e 100644 --- a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx +++ b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx @@ -115,8 +115,7 @@ void SwOutlineContentVisibilityWin::Set() (void)rOutlineNodes.Seek_Entry(pTextNode, &m_nOutlinePos); // set symbol displayed on button - bool bVisible = true; - const_cast(pTextNode)->GetAttrOutlineContentVisible(bVisible); + bool bVisible = const_cast(pTextNode)->GetAttrOutlineContentVisible(); SetSymbol(bVisible ? ButtonSymbol::HIDE : ButtonSymbol::SHOW); // set quick help diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 4736ef280a51..7680cc4ebb0e 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -7072,8 +7072,7 @@ void SwEditWin::ToggleOutlineContentVisibility(const size_t nOutlinePos, const b if (!bSubs || rSh.GetViewOptions()->IsTreatSubOutlineLevelsAsContent()) { SwNode* pNode = rSh.GetNodes().GetOutLineNds()[nOutlinePos]; - bool bVisible = true; - pNode->GetTextNode()->GetAttrOutlineContentVisible(bVisible); + bool bVisible = pNode->GetTextNode()->GetAttrOutlineContentVisible(); pNode->GetTextNode()->SetAttrOutlineContentVisible(!bVisible); } else if (bSubs) diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index d5c0a4eac9f3..b7012e9274d7 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -221,16 +221,12 @@ void SwBaseShell::ExecDelete(SfxRequest &rReq) SwNodeIndex aIdx(rSh.GetCursor()->GetPointNode()); if (aIdx.GetNode().IsTextNode()) { - bool bVisible = true; - aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible); - if (!bVisible) + if (!aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible()) break; ++aIdx; if (aIdx.GetNode().IsTextNode()) { - bVisible = true; - aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible); - if (!bVisible) + if (!aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible()) break; } } @@ -250,9 +246,7 @@ void SwBaseShell::ExecDelete(SfxRequest &rReq) SwNodeIndex aIdx(rSh.GetCursor()->GetPointNode()); if (aIdx.GetNode().IsTextNode()) { - bool bVisible = true; - aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible); - if (!bVisible) + if (!aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible()) break; --aIdx; if (aIdx.GetNode().IsContentNode() && diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 0e980c9f262d..c9651cec90f3 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -153,9 +153,7 @@ static bool lcl_IsAllowed(const SwWrtShell* rSh) if (pTextNode && pTextNode->IsOutline()) { // disallow if this is an outline node having folded content - bool bVisible = true; - pTextNode->GetAttrOutlineContentVisible(bVisible); - if (!bVisible) + if (!pTextNode->GetAttrOutlineContentVisible()) return false; } } @@ -1262,9 +1260,7 @@ static bool lcl_FoldedOutlineNodeEndOfParaSplit(SwWrtShell *pThis) SwTextNode* pTextNode = pThis->GetCursor()->GetPointNode().GetTextNode(); if (pTextNode && pTextNode->IsOutline()) { - bool bVisible = true; - pTextNode->GetAttrOutlineContentVisible(bVisible); - if (!bVisible) + if (!pTextNode->GetAttrOutlineContentVisible()) { const SwNodes& rNodes = pThis->GetNodes(); const SwOutlineNodes& rOutlineNodes = rNodes.GetOutLineNds(); @@ -2568,9 +2564,7 @@ void SwWrtShell::MakeOutlineContentVisible(const size_t nPos, bool bMakeVisible, if (pNd->IsTextNode() && pNd->GetTextNode()->IsOutline()) { SwTextNode* pTextNd = pNd->GetTextNode(); - bool bOutlineContentVisibleAttr = true; - pTextNd->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); - if (!bOutlineContentVisibleAttr) + if (!pTextNd->GetAttrOutlineContentVisible()) { SwOutlineNodes::size_type iPos; if (rOutlineNodes.Seek_Entry(pTextNd, &iPos)) @@ -2597,8 +2591,7 @@ void SwWrtShell::InvalidateOutlineContentVisibility() for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos) { bool bIsOutlineContentVisible = IsOutlineContentVisible(nPos); - bool bOutlineContentVisibleAttr = true; - rOutlineNds[nPos]->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); + bool bOutlineContentVisibleAttr = rOutlineNds[nPos]->GetTextNode()->GetAttrOutlineContentVisible(); if (!bIsOutlineContentVisible && bOutlineContentVisibleAttr) MakeOutlineContentVisible(nPos); else if (bIsOutlineContentVisible && !bOutlineContentVisibleAttr) @@ -2622,9 +2615,7 @@ void SwWrtShell::MakeAllFoldedOutlineContentVisible(bool bMakeVisible) std::vector aFoldedOutlineNodeArray; for (SwNode* pNd: GetNodes().GetOutLineNds()) { - bool bOutlineContentVisibleAttr = true; - pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); - if (!bOutlineContentVisibleAttr) + if (!pNd->GetTextNode()->GetAttrOutlineContentVisible()) { aFoldedOutlineNodeArray.push_back(pNd); pNd->GetTextNode()->SetAttrOutlineContentVisible(true); @@ -2666,9 +2657,7 @@ void SwWrtShell::MakeAllFoldedOutlineContentVisible(bool bMakeVisible) bool SwWrtShell::GetAttrOutlineContentVisible(const size_t nPos) const { - bool bVisibleAttr = true; - GetNodes().GetOutLineNds()[nPos]->GetTextNode()->GetAttrOutlineContentVisible(bVisibleAttr); - return bVisibleAttr; + return GetNodes().GetOutLineNds()[nPos]->GetTextNode()->GetAttrOutlineContentVisible(); } bool SwWrtShell::HasFoldedOutlineContentSelected() const From 97c0797cf379cca6056b8ab34499b56c7f01fd9b Mon Sep 17 00:00:00 2001 From: Patrick Luby Date: Fri, 22 Nov 2024 13:43:25 +0100 Subject: [PATCH 122/373] Revert "tdf#163945 present drawable immediately" This reverts commit 32eb29377c5bbf6a965357756d2813add2789053. Reason for revert: Original commit did not fix tdf#163945 Change-Id: Ie66edde40ed44f89bb28043db074fab7e6e06a49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177025 Tested-by: Jenkins Reviewed-by: Patrick Luby --- external/skia/swap-buffers-rect.patch.1 | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/external/skia/swap-buffers-rect.patch.1 b/external/skia/swap-buffers-rect.patch.1 index 0451725fdf22..0b02be761a50 100644 --- a/external/skia/swap-buffers-rect.patch.1 +++ b/external/skia/swap-buffers-rect.patch.1 @@ -11,9 +11,9 @@ diff -ur skia.org/tools/window/MetalWindowContext.h skia/tools/window/MetalWindo bool fValid; diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWindowContext.mm ---- skia.org/tools/window/MetalWindowContext.mm 2024-11-15 19:32:58 -+++ skia/tools/window/MetalWindowContext.mm 2024-11-20 19:02:09 -@@ -153,13 +153,21 @@ +--- skia.org/tools/window/MetalWindowContext.mm 2024-10-05 18:16:04.521814026 +0200 ++++ skia/tools/window/MetalWindowContext.mm 2024-10-05 18:17:31.670443188 +0200 +@@ -193,7 +193,7 @@ return surface; } @@ -22,21 +22,6 @@ diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWind id currentDrawable = (id)fDrawableHandle; id commandBuffer([*fShared->fQueue commandBuffer]); - commandBuffer.label = @"Present"; - -- [commandBuffer presentDrawable:currentDrawable]; -+ // tdf#163945 present drawable immediately -+ // It seems that -[MTLCommandBuffer presentDrawable:] doesn't -+ // immediately replace the previous drawable on screen so I -+ // assume that there is some default minimum display time for -+ // drawables. -+ // LibreOffice only invokes this method in a timer so let -+ // LibreOffice control the rate of window updates by presenting -+ // the drawable right now. -+ [commandBuffer presentDrawable:currentDrawable atTime:CACurrentMediaTime()]; - [commandBuffer commit]; - // ARC is off in sk_app, so we need to release the CF ref manually - CFRelease(fDrawableHandle); diff -ur skia.org/tools/window/unix/RasterWindowContext_unix.cpp skia/tools/window/unix/RasterWindowContext_unix.cpp --- skia.org/tools/window/unix/RasterWindowContext_unix.cpp 2024-10-05 18:16:04.521814026 +0200 +++ skia/tools/window/unix/RasterWindowContext_unix.cpp 2024-10-05 18:18:49.554847490 +0200 From a680e71b50e8957674f432a6b8c7adb1ee0cd70d Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 22 Nov 2024 11:23:17 +0100 Subject: [PATCH 123/373] tdf#163486: PVS V1043 global object variable is declared in header (starmath) Change-Id: Ieb038d21f27c7d31362be44b71fd13e2932fcf69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176995 Tested-by: Jenkins Reviewed-by: Julien Nabet --- starmath/inc/mathml/starmathdatabase.hxx | 312 +++++++++++------------ 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/starmath/inc/mathml/starmathdatabase.hxx b/starmath/inc/mathml/starmathdatabase.hxx index 3af9b009b5d0..65d7d3394535 100644 --- a/starmath/inc/mathml/starmathdatabase.hxx +++ b/starmath/inc/mathml/starmathdatabase.hxx @@ -28,173 +28,173 @@ // HTML // https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_Keywords /* CSS Level 1 */ -constexpr Color COL_SM_BLACK(0x000000); -constexpr Color COL_SM_SILVER(0xC0C0C0); -constexpr Color COL_SM_GRAY(0x808080); -constexpr Color COL_SM_WHITE(0xFFFFFF); -constexpr Color COL_SM_MAROON(0x800000); -constexpr Color COL_SM_RED(0xFF0000); -constexpr Color COL_SM_PURPLE(0x800080); -constexpr Color COL_SM_FUCHSIA(0xFF00FF); -constexpr Color COL_SM_GREEN(0x008000); -constexpr Color COL_SM_LIME(0x00FF00); -constexpr Color COL_SM_OLIVE(0x808000); -constexpr Color COL_SM_YELLOW(0xFFFF00); -constexpr Color COL_SM_NAVY(0x000080); -constexpr Color COL_SM_BLUE(0x0000FF); -constexpr Color COL_SM_TEAL(0x008080); -constexpr Color COL_SM_AQUA(0x00FFFF); +inline constexpr Color COL_SM_BLACK(0x000000); +inline constexpr Color COL_SM_SILVER(0xC0C0C0); +inline constexpr Color COL_SM_GRAY(0x808080); +inline constexpr Color COL_SM_WHITE(0xFFFFFF); +inline constexpr Color COL_SM_MAROON(0x800000); +inline constexpr Color COL_SM_RED(0xFF0000); +inline constexpr Color COL_SM_PURPLE(0x800080); +inline constexpr Color COL_SM_FUCHSIA(0xFF00FF); +inline constexpr Color COL_SM_GREEN(0x008000); +inline constexpr Color COL_SM_LIME(0x00FF00); +inline constexpr Color COL_SM_OLIVE(0x808000); +inline constexpr Color COL_SM_YELLOW(0xFFFF00); +inline constexpr Color COL_SM_NAVY(0x000080); +inline constexpr Color COL_SM_BLUE(0x0000FF); +inline constexpr Color COL_SM_TEAL(0x008080); +inline constexpr Color COL_SM_AQUA(0x00FFFF); /* CSS Level 2 */ -constexpr Color COL_SM_ORANGE(0xFFA500); +inline constexpr Color COL_SM_ORANGE(0xFFA500); /* CSS Level 3 */ -constexpr Color COL_SM_ALICEBLUE(0xF0F8FF); -constexpr Color COL_SM_ANTIQUEWHITE(0xFAEBD7); -constexpr Color COL_SM_AQUAMARINE(0x7FFFD4); -constexpr Color COL_SM_AZURE(0xF0FFFF); -constexpr Color COL_SM_BEIGE(0xF5F5DC); -constexpr Color COL_SM_BISQUE(0xFFE4C4); -constexpr Color COL_SM_BLANCHEDALMOND(0xFFEBCD); -constexpr Color COL_SM_BLUEVIOLET(0x8A2BE2); -constexpr Color COL_SM_BROWN(0xA52A2A); -constexpr Color COL_SM_BURLYWOOD(0xDEB887); -constexpr Color COL_SM_CADETBLUE(0x5F9EA0); -constexpr Color COL_SM_CHARTREUSE(0x7FFF00); -constexpr Color COL_SM_CHOCOLATE(0xD2691E); -constexpr Color COL_SM_CORAL(0xFF7F50); -constexpr Color COL_SM_CORNFLOWERBLUE(0x6495ED); -constexpr Color COL_SM_CORNSILK(0xFFF8DC); -constexpr Color COL_SM_CRIMSON(0xDC143C); -constexpr Color COL_SM_CYAN(0x00FFFF); -constexpr Color COL_SM_DARKBLUE(0x00008B); -constexpr Color COL_SM_DARKCYAN(0x008B8B); -constexpr Color COL_SM_DARKGOLDENROD(0xB8860B); -constexpr Color COL_SM_DARKGRAY(0xA9A9A9); -constexpr Color COL_SM_DARKGREEN(0x006400); -constexpr Color COL_SM_DARKGREY(0xA9A9A9); -constexpr Color COL_SM_DARKKHAKI(0xBDB76B); -constexpr Color COL_SM_DARKMAGENTA(0x8B008B); -constexpr Color COL_SM_DARKOLIVEGREEN(0x556B2F); -constexpr Color COL_SM_DARKORANGE(0xFF8C00); -constexpr Color COL_SM_DARKORCHID(0x9932CC); -constexpr Color COL_SM_DARKRED(0x8B0000); -constexpr Color COL_SM_DARKSALMON(0xE9967A); -constexpr Color COL_SM_DARKSEAGREEN(0x8FBC8F); -constexpr Color COL_SM_DARKSLATEBLUE(0x483D8B); -constexpr Color COL_SM_DARKSLATEGRAY(0x2F4F4F); -constexpr Color COL_SM_DARKSLATEGREY(0x2F4F4F); -constexpr Color COL_SM_DARKTURQUOISE(0x00CED1); -constexpr Color COL_SM_DARKVIOLET(0x9400D3); -constexpr Color COL_SM_DEEPPINK(0xFF1493); -constexpr Color COL_SM_DEEPSKYBLUE(0x00BFFF); -constexpr Color COL_SM_DIMGRAY(0x696969); -constexpr Color COL_SM_DIMGREY(0x696969); -constexpr Color COL_SM_DODGERBLUE(0x1E90FF); -constexpr Color COL_SM_FIREBRICK(0xB22222); -constexpr Color COL_SM_FLORALWHITE(0xFFFAF0); -constexpr Color COL_SM_FORESTGREEN(0x228B22); -constexpr Color COL_SM_GAINSBORO(0xDCDCDC); -constexpr Color COL_SM_GHOSTWHITE(0xF8F8FF); -constexpr Color COL_SM_GOLD(0xFFD700); -constexpr Color COL_SM_GOLDENROD(0xDAA520); -constexpr Color COL_SM_GREENYELLOW(0xADFF2F); -constexpr Color COL_SM_GREY(0x808080); -constexpr Color COL_SM_HONEYDEW(0xF0FFF0); -constexpr Color COL_SM_HOTPINK(0xFF69B4); -constexpr Color COL_SM_INDIANRED(0xCD5C5C); -constexpr Color COL_SM_INDIGO(0x4B0082); -constexpr Color COL_SM_IVORY(0xFFFFF0); -constexpr Color COL_SM_KHAKI(0xF0E68C); -constexpr Color COL_SM_LAVENDER(0xE6E6FA); -constexpr Color COL_SM_LAVENDERBLUSH(0xFFF0F5); -constexpr Color COL_SM_LAWNGREEN(0x7CFC00); -constexpr Color COL_SM_LEMONCHIFFON(0xFFFACD); -constexpr Color COL_SM_LIGHTBLUE(0xADD8E6); -constexpr Color COL_SM_LIGHTCORAL(0xF08080); -constexpr Color COL_SM_LIGHTCYAN(0xE0FFFF); -constexpr Color COL_SM_LIGHTGOLDENRODYELLOW(0xFAFAD2); -constexpr Color COL_SM_LIGHTGRAY(0xD3D3D3); -constexpr Color COL_SM_LIGHTGREEN(0x90EE90); -constexpr Color COL_SM_LIGHTGREY(0xD3D3D3); -constexpr Color COL_SM_LIGHTPINK(0xFFB6C1); -constexpr Color COL_SM_LIGHTSALMON(0xFFA07A); -constexpr Color COL_SM_LIGHTSEAGREEN(0x20B2AA); -constexpr Color COL_SM_LIGHTSKYBLUE(0x87CEFA); -constexpr Color COL_SM_LIGHTSLATEGRAY(0x778899); -constexpr Color COL_SM_LIGHTSLATEGREY(0x778899); -constexpr Color COL_SM_LIGHTSTEELBLUE(0xB0C4DE); -constexpr Color COL_SM_LIGHTYELLOW(0xFFFFE0); -constexpr Color COL_SM_LIMEGREEN(0x32CD32); -constexpr Color COL_SM_LINEN(0xFAF0E6); -constexpr Color COL_SM_MAGENTA(0xFF00FF); -constexpr Color COL_SM_MEDIUMAQUAMARINE(0x66CDAA); -constexpr Color COL_SM_MEDIUMBLUE(0x0000CD); -constexpr Color COL_SM_MEDIUMORCHID(0xBA55D3); -constexpr Color COL_SM_MEDIUMPURPLE(0x9370DB); -constexpr Color COL_SM_MEDIUMSEAGREEN(0x3CB371); -constexpr Color COL_SM_MEDIUMSLATEBLUE(0x7B68EE); -constexpr Color COL_SM_MEDIUMSPRINGGREEN(0x00FA9A); -constexpr Color COL_SM_MEDIUMTURQUOISE(0x48D1CC); -constexpr Color COL_SM_MEDIUMVIOLETRED(0xC71585); -constexpr Color COL_SM_MIDNIGHTBLUE(0x191970); -constexpr Color COL_SM_MINTCREAM(0xF5FFFA); -constexpr Color COL_SM_MISTYROSE(0xFFE4E1); -constexpr Color COL_SM_MOCCASIN(0xFFE4B5); -constexpr Color COL_SM_NAVAJOWHITE(0xFFDEAD); -constexpr Color COL_SM_OLDLACE(0xFDF5E6); -constexpr Color COL_SM_OLIVEDRAB(0x6B8E23); -constexpr Color COL_SM_ORANGERED(0xFF4500); -constexpr Color COL_SM_ORCHID(0xDA70D6); -constexpr Color COL_SM_PALEGOLDENROD(0xEEE8AA); -constexpr Color COL_SM_PALEGREEN(0x98FB98); -constexpr Color COL_SM_PALETURQUOISE(0xAFEEEE); -constexpr Color COL_SM_PALEVIOLETRED(0xDB7093); -constexpr Color COL_SM_PAPAYAWHIP(0xFFEFD5); -constexpr Color COL_SM_PEACHPUFF(0xFFDAB9); -constexpr Color COL_SM_PERU(0xCD853F); -constexpr Color COL_SM_PINK(0xFFC0CB); -constexpr Color COL_SM_PLUM(0xDDA0DD); -constexpr Color COL_SM_POWDERBLUE(0xB0E0E6); -constexpr Color COL_SM_ROSYBROWN(0xBC8F8F); -constexpr Color COL_SM_ROYALBLUE(0x4169E1); -constexpr Color COL_SM_SADDLEBROWN(0x8B4513); -constexpr Color COL_SM_SALMON(0xFA8072); -constexpr Color COL_SM_SANDYBROWN(0xF4A460); -constexpr Color COL_SM_SEAGREEN(0x2E8B57); -constexpr Color COL_SM_SEASHELL(0xFFF5EE); -constexpr Color COL_SM_SIENNA(0xA0522D); -constexpr Color COL_SM_SKYBLUE(0x87CEEB); -constexpr Color COL_SM_SLATEBLUE(0x6A5ACD); -constexpr Color COL_SM_SLATEGRAY(0x708090); -constexpr Color COL_SM_SLATEGREY(0x708090); -constexpr Color COL_SM_SNOW(0xFFFAFA); -constexpr Color COL_SM_SPRINGGREEN(0x00FF7F); -constexpr Color COL_SM_STEELBLUE(0x4682B4); -constexpr Color COL_SM_TAN(0xD2B48C); -constexpr Color COL_SM_THISTLE(0xD8BFD8); -constexpr Color COL_SM_TOMATO(0xFF6347); -constexpr Color COL_SM_TURQUOISE(0x40E0D0); -constexpr Color COL_SM_VIOLET(0xEE82EE); -constexpr Color COL_SM_WHEAT(0xF5DEB3); -constexpr Color COL_SM_WHITESMOKE(0xF5F5F5); -constexpr Color COL_SM_YELLOWGREEN(0x9ACD32); +inline constexpr Color COL_SM_ALICEBLUE(0xF0F8FF); +inline constexpr Color COL_SM_ANTIQUEWHITE(0xFAEBD7); +inline constexpr Color COL_SM_AQUAMARINE(0x7FFFD4); +inline constexpr Color COL_SM_AZURE(0xF0FFFF); +inline constexpr Color COL_SM_BEIGE(0xF5F5DC); +inline constexpr Color COL_SM_BISQUE(0xFFE4C4); +inline constexpr Color COL_SM_BLANCHEDALMOND(0xFFEBCD); +inline constexpr Color COL_SM_BLUEVIOLET(0x8A2BE2); +inline constexpr Color COL_SM_BROWN(0xA52A2A); +inline constexpr Color COL_SM_BURLYWOOD(0xDEB887); +inline constexpr Color COL_SM_CADETBLUE(0x5F9EA0); +inline constexpr Color COL_SM_CHARTREUSE(0x7FFF00); +inline constexpr Color COL_SM_CHOCOLATE(0xD2691E); +inline constexpr Color COL_SM_CORAL(0xFF7F50); +inline constexpr Color COL_SM_CORNFLOWERBLUE(0x6495ED); +inline constexpr Color COL_SM_CORNSILK(0xFFF8DC); +inline constexpr Color COL_SM_CRIMSON(0xDC143C); +inline constexpr Color COL_SM_CYAN(0x00FFFF); +inline constexpr Color COL_SM_DARKBLUE(0x00008B); +inline constexpr Color COL_SM_DARKCYAN(0x008B8B); +inline constexpr Color COL_SM_DARKGOLDENROD(0xB8860B); +inline constexpr Color COL_SM_DARKGRAY(0xA9A9A9); +inline constexpr Color COL_SM_DARKGREEN(0x006400); +inline constexpr Color COL_SM_DARKGREY(0xA9A9A9); +inline constexpr Color COL_SM_DARKKHAKI(0xBDB76B); +inline constexpr Color COL_SM_DARKMAGENTA(0x8B008B); +inline constexpr Color COL_SM_DARKOLIVEGREEN(0x556B2F); +inline constexpr Color COL_SM_DARKORANGE(0xFF8C00); +inline constexpr Color COL_SM_DARKORCHID(0x9932CC); +inline constexpr Color COL_SM_DARKRED(0x8B0000); +inline constexpr Color COL_SM_DARKSALMON(0xE9967A); +inline constexpr Color COL_SM_DARKSEAGREEN(0x8FBC8F); +inline constexpr Color COL_SM_DARKSLATEBLUE(0x483D8B); +inline constexpr Color COL_SM_DARKSLATEGRAY(0x2F4F4F); +inline constexpr Color COL_SM_DARKSLATEGREY(0x2F4F4F); +inline constexpr Color COL_SM_DARKTURQUOISE(0x00CED1); +inline constexpr Color COL_SM_DARKVIOLET(0x9400D3); +inline constexpr Color COL_SM_DEEPPINK(0xFF1493); +inline constexpr Color COL_SM_DEEPSKYBLUE(0x00BFFF); +inline constexpr Color COL_SM_DIMGRAY(0x696969); +inline constexpr Color COL_SM_DIMGREY(0x696969); +inline constexpr Color COL_SM_DODGERBLUE(0x1E90FF); +inline constexpr Color COL_SM_FIREBRICK(0xB22222); +inline constexpr Color COL_SM_FLORALWHITE(0xFFFAF0); +inline constexpr Color COL_SM_FORESTGREEN(0x228B22); +inline constexpr Color COL_SM_GAINSBORO(0xDCDCDC); +inline constexpr Color COL_SM_GHOSTWHITE(0xF8F8FF); +inline constexpr Color COL_SM_GOLD(0xFFD700); +inline constexpr Color COL_SM_GOLDENROD(0xDAA520); +inline constexpr Color COL_SM_GREENYELLOW(0xADFF2F); +inline constexpr Color COL_SM_GREY(0x808080); +inline constexpr Color COL_SM_HONEYDEW(0xF0FFF0); +inline constexpr Color COL_SM_HOTPINK(0xFF69B4); +inline constexpr Color COL_SM_INDIANRED(0xCD5C5C); +inline constexpr Color COL_SM_INDIGO(0x4B0082); +inline constexpr Color COL_SM_IVORY(0xFFFFF0); +inline constexpr Color COL_SM_KHAKI(0xF0E68C); +inline constexpr Color COL_SM_LAVENDER(0xE6E6FA); +inline constexpr Color COL_SM_LAVENDERBLUSH(0xFFF0F5); +inline constexpr Color COL_SM_LAWNGREEN(0x7CFC00); +inline constexpr Color COL_SM_LEMONCHIFFON(0xFFFACD); +inline constexpr Color COL_SM_LIGHTBLUE(0xADD8E6); +inline constexpr Color COL_SM_LIGHTCORAL(0xF08080); +inline constexpr Color COL_SM_LIGHTCYAN(0xE0FFFF); +inline constexpr Color COL_SM_LIGHTGOLDENRODYELLOW(0xFAFAD2); +inline constexpr Color COL_SM_LIGHTGRAY(0xD3D3D3); +inline constexpr Color COL_SM_LIGHTGREEN(0x90EE90); +inline constexpr Color COL_SM_LIGHTGREY(0xD3D3D3); +inline constexpr Color COL_SM_LIGHTPINK(0xFFB6C1); +inline constexpr Color COL_SM_LIGHTSALMON(0xFFA07A); +inline constexpr Color COL_SM_LIGHTSEAGREEN(0x20B2AA); +inline constexpr Color COL_SM_LIGHTSKYBLUE(0x87CEFA); +inline constexpr Color COL_SM_LIGHTSLATEGRAY(0x778899); +inline constexpr Color COL_SM_LIGHTSLATEGREY(0x778899); +inline constexpr Color COL_SM_LIGHTSTEELBLUE(0xB0C4DE); +inline constexpr Color COL_SM_LIGHTYELLOW(0xFFFFE0); +inline constexpr Color COL_SM_LIMEGREEN(0x32CD32); +inline constexpr Color COL_SM_LINEN(0xFAF0E6); +inline constexpr Color COL_SM_MAGENTA(0xFF00FF); +inline constexpr Color COL_SM_MEDIUMAQUAMARINE(0x66CDAA); +inline constexpr Color COL_SM_MEDIUMBLUE(0x0000CD); +inline constexpr Color COL_SM_MEDIUMORCHID(0xBA55D3); +inline constexpr Color COL_SM_MEDIUMPURPLE(0x9370DB); +inline constexpr Color COL_SM_MEDIUMSEAGREEN(0x3CB371); +inline constexpr Color COL_SM_MEDIUMSLATEBLUE(0x7B68EE); +inline constexpr Color COL_SM_MEDIUMSPRINGGREEN(0x00FA9A); +inline constexpr Color COL_SM_MEDIUMTURQUOISE(0x48D1CC); +inline constexpr Color COL_SM_MEDIUMVIOLETRED(0xC71585); +inline constexpr Color COL_SM_MIDNIGHTBLUE(0x191970); +inline constexpr Color COL_SM_MINTCREAM(0xF5FFFA); +inline constexpr Color COL_SM_MISTYROSE(0xFFE4E1); +inline constexpr Color COL_SM_MOCCASIN(0xFFE4B5); +inline constexpr Color COL_SM_NAVAJOWHITE(0xFFDEAD); +inline constexpr Color COL_SM_OLDLACE(0xFDF5E6); +inline constexpr Color COL_SM_OLIVEDRAB(0x6B8E23); +inline constexpr Color COL_SM_ORANGERED(0xFF4500); +inline constexpr Color COL_SM_ORCHID(0xDA70D6); +inline constexpr Color COL_SM_PALEGOLDENROD(0xEEE8AA); +inline constexpr Color COL_SM_PALEGREEN(0x98FB98); +inline constexpr Color COL_SM_PALETURQUOISE(0xAFEEEE); +inline constexpr Color COL_SM_PALEVIOLETRED(0xDB7093); +inline constexpr Color COL_SM_PAPAYAWHIP(0xFFEFD5); +inline constexpr Color COL_SM_PEACHPUFF(0xFFDAB9); +inline constexpr Color COL_SM_PERU(0xCD853F); +inline constexpr Color COL_SM_PINK(0xFFC0CB); +inline constexpr Color COL_SM_PLUM(0xDDA0DD); +inline constexpr Color COL_SM_POWDERBLUE(0xB0E0E6); +inline constexpr Color COL_SM_ROSYBROWN(0xBC8F8F); +inline constexpr Color COL_SM_ROYALBLUE(0x4169E1); +inline constexpr Color COL_SM_SADDLEBROWN(0x8B4513); +inline constexpr Color COL_SM_SALMON(0xFA8072); +inline constexpr Color COL_SM_SANDYBROWN(0xF4A460); +inline constexpr Color COL_SM_SEAGREEN(0x2E8B57); +inline constexpr Color COL_SM_SEASHELL(0xFFF5EE); +inline constexpr Color COL_SM_SIENNA(0xA0522D); +inline constexpr Color COL_SM_SKYBLUE(0x87CEEB); +inline constexpr Color COL_SM_SLATEBLUE(0x6A5ACD); +inline constexpr Color COL_SM_SLATEGRAY(0x708090); +inline constexpr Color COL_SM_SLATEGREY(0x708090); +inline constexpr Color COL_SM_SNOW(0xFFFAFA); +inline constexpr Color COL_SM_SPRINGGREEN(0x00FF7F); +inline constexpr Color COL_SM_STEELBLUE(0x4682B4); +inline constexpr Color COL_SM_TAN(0xD2B48C); +inline constexpr Color COL_SM_THISTLE(0xD8BFD8); +inline constexpr Color COL_SM_TOMATO(0xFF6347); +inline constexpr Color COL_SM_TURQUOISE(0x40E0D0); +inline constexpr Color COL_SM_VIOLET(0xEE82EE); +inline constexpr Color COL_SM_WHEAT(0xF5DEB3); +inline constexpr Color COL_SM_WHITESMOKE(0xF5F5F5); +inline constexpr Color COL_SM_YELLOWGREEN(0x9ACD32); /* CSS Level 4 */ -constexpr Color COL_SM_REBECCAPURPLE(0x663399); +inline constexpr Color COL_SM_REBECCAPURPLE(0x663399); /* dvipsnames */ // For now only five colors. // In a future all of them. // https://www.overleaf.com/learn/latex/Using_colours_in_LaTeX -constexpr Color COL_SM_DIV_APRICOT(0xFFB781); -constexpr Color COL_SM_DIV_AQUAMARINE(0x1BBEC1); -constexpr Color COL_SM_DIV_BITTERSWEET(0xCF4B16); -constexpr Color COL_SM_DIV_BLACK(0xCF4B16); -constexpr Color COL_SM_DIV_BLUE(0x102694); +inline constexpr Color COL_SM_DIV_APRICOT(0xFFB781); +inline constexpr Color COL_SM_DIV_AQUAMARINE(0x1BBEC1); +inline constexpr Color COL_SM_DIV_BITTERSWEET(0xCF4B16); +inline constexpr Color COL_SM_DIV_BLACK(0xCF4B16); +inline constexpr Color COL_SM_DIV_BLUE(0x102694); /* Iconic colors */ // https://design.ubuntu.com/brand/colour-palette/ -constexpr Color COL_SM_UBUNTU_ORANGE(0xE95420); +inline constexpr Color COL_SM_UBUNTU_ORANGE(0xE95420); // https://www.debian.org/logos/ Picked from SVG logo -constexpr Color COL_SM_DEBIAN_MAGENTA(0xA80030); +inline constexpr Color COL_SM_DEBIAN_MAGENTA(0xA80030); // https://libreoffice.org/ -constexpr Color COL_SM_LO_GREEN(0x00A500); +inline constexpr Color COL_SM_LO_GREEN(0x00A500); namespace starmathdatabase { From 180a99d9ffe156a79a0d49bd0d5bd9c5d5f05ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Fri, 30 Aug 2024 16:56:59 +0200 Subject: [PATCH 124/373] Render objects that are in an animation as a separate layer Change-Id: I4220b8398e75589bd54b67942cf987244b1d0b0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177035 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- .../data/SlideRenderingTest_Animations.odp | Bin 0 -> 15242 bytes sd/qa/unit/tiledrendering/tiledrendering.cxx | 134 +++++++++++++----- sd/source/ui/inc/SlideshowLayerRenderer.hxx | 7 + sd/source/ui/tools/SlideshowLayerRenderer.cxx | 79 +++++++++++ 4 files changed, 181 insertions(+), 39 deletions(-) create mode 100644 sd/qa/unit/tiledrendering/data/SlideRenderingTest_Animations.odp diff --git a/sd/qa/unit/tiledrendering/data/SlideRenderingTest_Animations.odp b/sd/qa/unit/tiledrendering/data/SlideRenderingTest_Animations.odp new file mode 100644 index 0000000000000000000000000000000000000000..b827e0a94cf6e72fe4da97afd8d6081371dabbd8 GIT binary patch literal 15242 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 pBuffer, + unsigned nViewWidth, unsigned nViewHeight, const char* sJSON) +{ + (void)step; + (void)pBuffer; + (void)nViewWidth; + (void)nViewHeight; + (void)sJSON; + +#if false + printf ("%u %s\n\n", step, sJSON); + + BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); + + OUString sFileName = "/tmp/slideshow_" + OUString::number(step) + ".png"; + SvFileStream aStream(sFileName, StreamMode::WRITE | StreamMode::TRUNC); + vcl::PngImageWriter aPNGWriter(aStream); + aPNGWriter.write(aBitmapEx); +#endif +} + +} + static std::ostream& operator<<(std::ostream& os, ViewShellId id) { os << static_cast(id); @@ -2754,8 +2780,6 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering) // - master slide layer // - main slide layer - const bool bOutputPNG = false; // Control layer output to PNG files - SdXImpressDocument* pXImpressDocument = createDoc("SlideRenderingTest.odp"); pXImpressDocument->initializeForTiledRendering(uno::Sequence()); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -2776,15 +2800,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering) CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); // TODO - check JSON content - // printf ("1 %s\n\n", rJsonMsg.toUtf8().getStr()); BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); - if (bOutputPNG) - { - SvFileStream aStream("/home/quikee/XXX_01.png", StreamMode::WRITE | StreamMode::TRUNC); - vcl::PngImageWriter aPNGWriter(aStream); - aPNGWriter.write(aBitmapEx); - } + debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); // top-left corner CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(20, 20)); @@ -2803,15 +2821,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering) CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); // TODO - check JSON content - // printf ("2 %s\n\n", rJsonMsg.toUtf8().getStr()); + debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); - if (bOutputPNG) - { - SvFileStream aStream("/home/quikee/XXX_02.png", StreamMode::WRITE | StreamMode::TRUNC); - vcl::PngImageWriter aPNGWriter(aStream); - aPNGWriter.write(aBitmapEx); - } // top-left corner CPPUNIT_ASSERT_EQUAL(Color(0x00, 0x50, 0x90), aBitmapEx.GetPixelColor(20, 20)); @@ -2838,8 +2850,6 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie // - master slide layer // - main slide layer - const bool bOutputPNG = false; // Control layer output to PNG files - SdXImpressDocument* pXImpressDocument = createDoc("SlideRenderingTest_WithFields.odp"); pXImpressDocument->initializeForTiledRendering(uno::Sequence()); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -2860,15 +2870,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); // TODO - check JSON content - // printf ("1 %s\n\n", rJsonMsg.toUtf8().getStr()); + debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); - if (bOutputPNG) - { - SvFileStream aStream("/home/quikee/XXX_01.png", StreamMode::WRITE | StreamMode::TRUNC); - vcl::PngImageWriter aPNGWriter(aStream); - aPNGWriter.write(aBitmapEx); - } // top-left corner CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(20, 20)); @@ -2887,15 +2891,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); // TODO - check JSON content - // printf ("2 %s\n\n", rJsonMsg.toUtf8().getStr()); + debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); - if (bOutputPNG) - { - SvFileStream aStream("/home/quikee/XXX_02.png", StreamMode::WRITE | StreamMode::TRUNC); - vcl::PngImageWriter aPNGWriter(aStream); - aPNGWriter.write(aBitmapEx); - } // top-left corner CPPUNIT_ASSERT_EQUAL(aTransparentColor, aBitmapEx.GetPixelColor(20, 20)); @@ -2914,15 +2912,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); // TODO - check JSON content - // printf ("3 %s\n\n", rJsonMsg.toUtf8().getStr()); + debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); BitmapEx aBitmapEx = vcl::bitmap::CreateFromData(pBuffer.data(), nViewWidth, nViewHeight, nViewWidth * 4, /*nBitsPerPixel*/32, true, true); - if (bOutputPNG) - { - SvFileStream aStream("/home/quikee/XXX_03.png", StreamMode::WRITE | StreamMode::TRUNC); - vcl::PngImageWriter aPNGWriter(aStream); - aPNGWriter.write(aBitmapEx); - } // top-left corner CPPUNIT_ASSERT_EQUAL(Color(0x00, 0x50, 0x90), aBitmapEx.GetPixelColor(20, 20)); @@ -2944,6 +2936,70 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie pXImpressDocument->postSlideshowCleanup(); } +CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animations) +{ + SdXImpressDocument* pXImpressDocument = createDoc("SlideRenderingTest_Animations.odp"); + pXImpressDocument->initializeForTiledRendering(uno::Sequence()); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + CPPUNIT_ASSERT(pViewShell); + SdPage* pPage = pViewShell->GetActualPage(); + CPPUNIT_ASSERT(pPage); + sal_Int32 nViewWidth = 2000; + sal_Int32 nViewHeight = 2000; + CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(0, nViewWidth, nViewHeight, true, true)); + CPPUNIT_ASSERT_EQUAL(2000, nViewWidth); + CPPUNIT_ASSERT_EQUAL(1125, nViewHeight); + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + // TODO - check JSON content + debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + // TODO - check JSON content + debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + // TODO - check JSON content + debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + // TODO - check JSON content + debugWriteImageToFile(4, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + } + + pXImpressDocument->postSlideshowCleanup(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx b/sd/source/ui/inc/SlideshowLayerRenderer.hxx index dfe697a5cf9c..805541e3e857 100644 --- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx +++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx @@ -40,6 +40,7 @@ struct RenderState bool mbStopRenderingWhenField = true; std::unordered_set maObjectsDone; + std::unordered_set maInAnimation; sal_Int32 mnIndex = 0; bool mbFirstObjectInPass = true; @@ -99,6 +100,11 @@ struct RenderState { return maObjectsDone.find(pObject) != maObjectsDone.end(); } + + bool isObjectInAnimation(SdrObject* pObject) + { + return maInAnimation.find(pObject) != maInAnimation.end(); + } }; /** Renders a slide */ @@ -112,6 +118,7 @@ private: void createViewAndDraw(RenderContext& rRenderContext); void writeJSON(OString& rJsonMsg); + void setupAnimations(); public: SlideshowLayerRenderer(SdrPage& rPage); diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index 3e1297225d4c..6d8b4c08dc22 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -22,6 +22,18 @@ #include #include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace ::com::sun::star; + namespace sd { struct RenderContext @@ -144,6 +156,11 @@ public: } } + if (mrRenderState.isObjectInAnimation(pObject)) + { + mrRenderState.mbSkipAllInThisPass = true; + } + if (mrRenderState.meStage == RenderStage::Master && hasFields(pObject) && mrRenderState.mbStopRenderingWhenField && !mrRenderState.mbFirstObjectInPass) { @@ -187,6 +204,68 @@ SlideshowLayerRenderer::SlideshowLayerRenderer(SdrPage& rPage) maRenderState.meStage = RenderStage::Master; else maRenderState.meStage = RenderStage::Slide; + + setupAnimations(); +} + +void SlideshowLayerRenderer::setupAnimations() +{ + auto* pSdPage = dynamic_cast(&mrPage); + + if (!pSdPage) + return; + + std::vector> aAnimationVector; + anim::create_deep_vector(pSdPage->getAnimationNode(), aAnimationVector); + + for (uno::Reference const& rNode : aAnimationVector) + { + switch (rNode->getType()) + { + // filter out the most obvious + case animations::AnimationNodeType::CUSTOM: + case animations::AnimationNodeType::ANIMATE: + case animations::AnimationNodeType::SET: + case animations::AnimationNodeType::ANIMATEMOTION: + case animations::AnimationNodeType::ANIMATECOLOR: + case animations::AnimationNodeType::ANIMATETRANSFORM: + case animations::AnimationNodeType::TRANSITIONFILTER: + case animations::AnimationNodeType::ANIMATEPHYSICS: + { + uno::Reference xAnimate(rNode, uno::UNO_QUERY); + if (xAnimate.is()) + { + uno::Any aAny = xAnimate->getTarget(); + + uno::Reference xShape; + if ((aAny >>= xShape) && xShape.is()) + { + SvxShape* pShape = comphelper::getFromUnoTunnel(xShape); + if (pShape) + { + maRenderState.maInAnimation.insert(pShape->GetSdrObject()); + } + } + else // if target is not a shape + { + presentation::ParagraphTarget aParagraphTarget; + if ((aAny >>= aParagraphTarget) && aParagraphTarget.Shape.is()) + { + //sal_Int32 nParagraph = aParagraphTarget.Paragraph; + + xShape = aParagraphTarget.Shape; + + SvxShape* pShape = comphelper::getFromUnoTunnel(xShape); + if (pShape) + { + maRenderState.maInAnimation.insert(pShape->GetSdrObject()); + } + } + } + } + } + } + } } Size SlideshowLayerRenderer::calculateAndSetSizePixel(Size const& rDesiredSizePixel) From f3a302043b2392cf7dcdd5dfe6e418c8e12a6eda Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 12:33:23 +0100 Subject: [PATCH 125/373] PVS: V1048 The 'bRet' variable was assigned the same value Change-Id: Idbd94e0eb49819f737a90bcb161cd3dd88f24221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177014 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/source/filter/ww8/ww8par6.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index d405e293658b..2a229d831a25 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -1549,14 +1549,12 @@ bool SwWW8ImplReader::SetShadow(SvxShadowItem& rShadow, const short *pSizeArray, if (bRet) { rShadow.SetColor(COL_BLACK); - //i120718 + //i120718 short nVal = aRightBrc.DetermineBorderProperties(); - //End if (nVal < 0x10) nVal = 0x10; rShadow.SetWidth(nVal); rShadow.SetLocation(SvxShadowLocation::BottomRight); - bRet = true; } return bRet; } From c80cbceeed44132320811d9e5f265417447bab5c Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 14:05:28 +0100 Subject: [PATCH 126/373] PVS: V547 Expression '!aPropertyStates.empty()' is always true. Identified by M. Kaganski Change-Id: I02c3ab0ec29367ebc2e73586044d729eab24231d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177029 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- xmloff/source/chart/SchXMLExport.cxx | 65 +++++++++++++--------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index e2780ee0b684..4e3fa02b7651 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -3152,47 +3152,44 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( } } - if( !aPropertyStates.empty() || bExportEquation ) + // write element + if( bExportContent ) { - // write element - if( bExportContent ) + // add style name attribute + AddAutoStyleAttribute( aPropertyStates ); + + SvXMLElementExport aRegressionExport( mrExport, XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, true, true ); + if( bExportEquation ) { - // add style name attribute - AddAutoStyleAttribute( aPropertyStates ); + mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_EQUATION, (bShowEquation ? XML_TRUE : XML_FALSE) ); + mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_R_SQUARE, (bShowRSquared ? XML_TRUE : XML_FALSE) ); - SvXMLElementExport aRegressionExport( mrExport, XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, true, true ); - if( bExportEquation ) + // export position + chart2::RelativePosition aRelativePosition; + if( xEquationProperties->getPropertyValue( u"RelativePosition"_ustr ) >>= aRelativePosition ) { - mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_EQUATION, (bShowEquation ? XML_TRUE : XML_FALSE) ); - mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_R_SQUARE, (bShowRSquared ? XML_TRUE : XML_FALSE) ); - - // export position - chart2::RelativePosition aRelativePosition; - if( xEquationProperties->getPropertyValue( u"RelativePosition"_ustr ) >>= aRelativePosition ) - { - double fX = aRelativePosition.Primary * rPageSize.Width; - double fY = aRelativePosition.Secondary * rPageSize.Height; - awt::Point aPos; - aPos.X = static_cast< sal_Int32 >( ::rtl::math::round( fX )); - aPos.Y = static_cast< sal_Int32 >( ::rtl::math::round( fY )); - addPosition( aPos ); - } - - if( !aEquationPropertyStates.empty()) - { - AddAutoStyleAttribute( aEquationPropertyStates ); - } - - SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_EQUATION, true, true ); + double fX = aRelativePosition.Primary * rPageSize.Width; + double fY = aRelativePosition.Secondary * rPageSize.Height; + awt::Point aPos; + aPos.X = static_cast< sal_Int32 >( ::rtl::math::round( fX )); + aPos.Y = static_cast< sal_Int32 >( ::rtl::math::round( fY )); + addPosition( aPos ); } + + if( !aEquationPropertyStates.empty()) + { + AddAutoStyleAttribute( aEquationPropertyStates ); + } + + SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_EQUATION, true, true ); } - else // autostyles + } + else // autostyles + { + CollectAutoStyle( std::move(aPropertyStates) ); + if( bExportEquation && !aEquationPropertyStates.empty()) { - CollectAutoStyle( std::move(aPropertyStates) ); - if( bExportEquation && !aEquationPropertyStates.empty()) - { - CollectAutoStyle( std::move(aEquationPropertyStates) ); - } + CollectAutoStyle( std::move(aEquationPropertyStates) ); } } } From ea1d0a62d9b9790c235044a754604166ec5df6d4 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 22 Nov 2024 14:40:50 +0100 Subject: [PATCH 127/373] sw: do not paint hidden frames' borders SwFrame::PaintSwFrameShadowAndBorder() is called by upper's SwFrame::PaintSwFrameBackground() so it needs another check. (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f) Change-Id: Ic7ac28e4af8e0abf4970d87edb40a79ad4d25156 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177032 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/layout/paintfrm.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 5e1bb1392638..1120879e707a 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -5532,6 +5532,11 @@ void SwFrame::PaintSwFrameShadowAndBorder( return; } + if (!getFramePrintArea().HasArea()) + { // hidden text frame, may be called by upper from PaintSwFrameBackground() + return; + } + const bool bLine = rAttrs.IsLine(); const bool bShadow = rAttrs.GetShadow().GetLocation() != SvxShadowLocation::NONE; From 90c25e59124deb8fc2d282f828dd95bfd899024c Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 22 Nov 2024 15:31:40 +0100 Subject: [PATCH 128/373] PVS: V547 Expression 'bComplete' is always true. Since commit 47527821f32f9b5890b39b4031f5962f5cb46646 Author: Bjoern Michaelsen Date: Mon Nov 16 22:17:07 2020 +0100 SwGrfNode: Remove graphic arrived hack Change-Id: I7c0a3b0208d2da06781be6b69e04e9958b762870 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177036 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/source/core/doc/notxtfrm.cxx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 6a310a478221..fb20220cf9f3 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -772,8 +772,6 @@ void SwNoTextFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint SwContentFrame::SwClientNotify(rModify, rHint); - bool bComplete = true; - switch( nWhich ) { case RES_OBJECTDYING: @@ -840,11 +838,8 @@ void SwNoTextFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint return; } - if( bComplete ) - { - InvalidatePrt(); - SetCompletePaint(); - } + InvalidatePrt(); + SetCompletePaint(); } static void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, vcl::RenderContext const * pOut ) From e49e878d824b5f3c2c1b919fa2e95a037273a327 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Fri, 22 Nov 2024 17:42:36 +0100 Subject: [PATCH 129/373] Update git submodules * Update translations from branch 'master' to 318e92fb60edf7a9889cac87bd0489123553ce1d - update translations for master/25.2.0 alpha1 and force-fix errors using pocheck Change-Id: Ie52bd18e7f82e90d5095b195ffbf6bbc4f84e254 --- translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations b/translations index 8f5f1e8348d6..318e92fb60ed 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit 8f5f1e8348d605be128fcfa742e6fb92d52e758f +Subproject commit 318e92fb60edf7a9889cac87bd0489123553ce1d From 351e6e17e08ee2fe03143be825318687cb904342 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Fri, 22 Nov 2024 17:48:14 +0100 Subject: [PATCH 130/373] Update git submodules * Update translations from branch 'master' to 096ea211364abd9f3a59671796e3aabb093faf54 - add translation files for Santali (Ol-Chiki) (sat-Olck) Change-Id: Ic6efa6bfeee7fbd70c8fd629e3e7f87c8e840f8d --- translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations b/translations index 318e92fb60ed..096ea211364a 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit 318e92fb60edf7a9889cac87bd0489123553ce1d +Subproject commit 096ea211364abd9f3a59671796e3aabb093faf54 From 2fe487b20e373e09498ece248ed9e30b1cd3bf8a Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Fri, 22 Nov 2024 17:53:15 +0100 Subject: [PATCH 131/373] add Santali (Ol-Chiki) languagepack (sat-Olck) Change-Id: I6cdc09f1c44acf3c7e2d8b24ccb5a73f175acbc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177043 Tested-by: Jenkins Reviewed-by: Christian Lohmaier --- scp2/source/ooo/module_langpack.ulf | 6 ++++++ solenv/inc/langlist.mk | 1 + 2 files changed, 7 insertions(+) diff --git a/scp2/source/ooo/module_langpack.ulf b/scp2/source/ooo/module_langpack.ulf index af10f8007e1b..090c7190f096 100644 --- a/scp2/source/ooo/module_langpack.ulf +++ b/scp2/source/ooo/module_langpack.ulf @@ -718,6 +718,12 @@ en-US = "Santali" [STR_DESC_MODULE_LANGPACK_SAT] en-US = "Installs the Santali user interface" +[STR_NAME_MODULE_LANGPACK_SAT_OLCK] +en-US = "Santali (Ol-Chiki)" + +[STR_DESC_MODULE_LANGPACK_SAT_OLCK] +en-US = "Installs the Santali (Ol-Chiki) user interface" + [STR_NAME_MODULE_LANGPACK_SD] en-US = "Sindhi" diff --git a/solenv/inc/langlist.mk b/solenv/inc/langlist.mk index 40f78cc5547b..9f4fe3c76dac 100644 --- a/solenv/inc/langlist.mk +++ b/solenv/inc/langlist.mk @@ -106,6 +106,7 @@ ru \ rw \ sa-IN \ sat \ +sat-Olck \ sd \ sr-Latn \ si \ From 0c7c2716db83a0afeb1859b5fde3e44cf61b5fc5 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 22 Nov 2024 10:07:15 +0200 Subject: [PATCH 132/373] loplugin:methodcycles found cycle FmEntryData::FmEntryData(const FmEntryData &) svx/source/inc/fmexpl.hxx:148 FmFormData::FmFormData(const FmFormData &) svx/source/inc/fmexpl.hxx:230 FmControlData::FmControlData(const FmControlData &) svx/source/inc/fmexpl.hxx:252 std::unique_ptr FmEntryData::Clone() svx/source/inc/fmexpl.hxx:161 Change-Id: I2bef463f62b4513c473bb99eb999a97e99f5e602 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176993 Reviewed-by: Noel Grandin Tested-by: Jenkins --- svx/source/form/fmexpl.cxx | 46 -------------------------------------- svx/source/inc/fmexpl.hxx | 6 ----- 2 files changed, 52 deletions(-) diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx index 59fa0f638188..4394201511d0 100644 --- a/svx/source/form/fmexpl.cxx +++ b/svx/source/form/fmexpl.cxx @@ -168,26 +168,6 @@ void FmEntryData::newObject( const css::uno::Reference< css::uno::XInterface >& } -FmEntryData::FmEntryData( const FmEntryData& rEntryData ) -{ - pChildList.reset( new FmEntryDataList() ); - aText = rEntryData.GetText(); - m_aNormalImage = rEntryData.GetNormalImage(); - pParent = rEntryData.GetParent(); - - FmEntryData* pChildData; - size_t nEntryCount = rEntryData.GetChildList()->size(); - for( size_t i = 0; i < nEntryCount; i++ ) - { - pChildData = rEntryData.GetChildList()->at( i ); - std::unique_ptr pNewChildData = pChildData->Clone(); - pChildList->insert( std::move(pNewChildData), size_t(-1) ); - } - - m_xNormalizedIFace = rEntryData.m_xNormalizedIFace; - m_xProperties = rEntryData.m_xProperties; - m_xChild = rEntryData.m_xChild; -} @@ -242,19 +222,6 @@ FmFormData::~FmFormData() { } -FmFormData::FmFormData( const FmFormData& rFormData ) - :FmEntryData( rFormData ) -{ - m_xForm = rFormData.GetFormIface(); -} - - -std::unique_ptr FmFormData::Clone() -{ - return std::unique_ptr(new FmFormData( *this )); -} - - bool FmFormData::IsEqualWithoutChildren( FmEntryData* pEntryData ) { if(this == pEntryData) @@ -291,19 +258,6 @@ FmControlData::~FmControlData() } -FmControlData::FmControlData( const FmControlData& rControlData ) - :FmEntryData( rControlData ) -{ - m_xFormComponent = rControlData.GetFormComponent(); -} - - -std::unique_ptr FmControlData::Clone() -{ - return std::unique_ptr(new FmControlData( *this )); -} - - OUString FmControlData::GetImage() const { // Default-Image diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx index ca69f4de3ff4..8028c7eb3aa9 100644 --- a/svx/source/inc/fmexpl.hxx +++ b/svx/source/inc/fmexpl.hxx @@ -145,7 +145,6 @@ protected: public: FmEntryData( FmEntryData* pParentData, const css::uno::Reference< css::uno::XInterface >& _rIFace ); - FmEntryData( const FmEntryData& rEntryData ); virtual ~FmEntryData(); void SetText( const OUString& rText ){ aText = rText; } @@ -158,7 +157,6 @@ public: FmEntryDataList* GetChildList() const { return pChildList.get(); } virtual bool IsEqualWithoutChildren( FmEntryData* pEntryData ); - virtual std::unique_ptr Clone() = 0; // note that the interface returned is normalized, i.e. querying the given XInterface of the object // for XInterface must return the interface itself. @@ -227,13 +225,11 @@ class FmFormData final : public FmEntryData public: FmFormData(const css::uno::Reference< css::form::XForm >& _rxForm, FmFormData* _pParent); - FmFormData( const FmFormData& rFormData ); virtual ~FmFormData() override; const css::uno::Reference< css::form::XForm >& GetFormIface() const { return m_xForm; } virtual bool IsEqualWithoutChildren( FmEntryData* pEntryData ) override; - virtual std::unique_ptr Clone() override; }; @@ -249,12 +245,10 @@ public: const css::uno::Reference< css::form::XFormComponent >& _rxComponent, FmFormData* _pParent ); - FmControlData( const FmControlData& rControlData ); virtual ~FmControlData() override; const css::uno::Reference< css::form::XFormComponent >& GetFormComponent() const { return m_xFormComponent; } virtual bool IsEqualWithoutChildren( FmEntryData* pEntryData ) override; - virtual std::unique_ptr Clone() override; void ModelReplaced(const css::uno::Reference< css::form::XFormComponent >& _rxNew); }; From d1e8e430db41e1b3e90332e6826ba71ccb8c6971 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 22 Nov 2024 12:17:55 +0200 Subject: [PATCH 133/373] loplugin:unusedfields Change-Id: I9ee946ceabf59e4126db938d6abda446fcf9ce36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176994 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/sfx2/basedlgs.hxx | 1 - sc/source/ui/inc/duplicaterecordsdlg.hxx | 1 - sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx | 1 - sd/source/ui/inc/SlideTransitionPane.hxx | 3 --- sd/source/ui/tools/SlideshowLayerRenderer.cxx | 4 +--- sfx2/source/dialog/basedlgs.cxx | 2 -- slideshow/source/engine/slide/slideimpl.cxx | 9 --------- 7 files changed, 1 insertion(+), 20 deletions(-) diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index 4f7cd0f29c8f..b962ce611612 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -129,7 +129,6 @@ protected: std::unique_ptr m_xSfxPage; std::unique_ptr m_xContainer; std::unique_ptr m_xOKBtn; - std::unique_ptr m_xHelpBtn; void CreateOutputItemSet(const SfxItemSet& rInput); void SetInputSet(const SfxItemSet* pInSet) { m_pInputSet = pInSet; } diff --git a/sc/source/ui/inc/duplicaterecordsdlg.hxx b/sc/source/ui/inc/duplicaterecordsdlg.hxx index c0bee041465c..cee462cebdbb 100644 --- a/sc/source/ui/inc/duplicaterecordsdlg.hxx +++ b/sc/source/ui/inc/duplicaterecordsdlg.hxx @@ -63,7 +63,6 @@ private: std::unique_ptr m_xRecordsLabel; std::unique_ptr m_xOkBtn; - std::unique_ptr m_xHelpBtn; uno::Sequence>& mrCellData; ScRange& mrRange; diff --git a/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx b/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx index dbe3c050c370..b626236e0823 100644 --- a/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx +++ b/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx @@ -42,7 +42,6 @@ ScDuplicateRecordsDlg::ScDuplicateRecordsDlg(weld::Window* pParent, , m_xAllChkBtn(m_xBuilder->weld_check_button("allcheckbtn")) , m_xRecordsLabel(m_xBuilder->weld_label("records")) , m_xOkBtn(m_xBuilder->weld_button("okbtn")) - , m_xHelpBtn(m_xBuilder->weld_button("helpbutton")) , mrCellData(rData) , mrRange(rRange) , mrViewData(rViewData) diff --git a/sd/source/ui/inc/SlideTransitionPane.hxx b/sd/source/ui/inc/SlideTransitionPane.hxx index 0a7eeed88ef4..d7fc32a67686 100644 --- a/sd/source/ui/inc/SlideTransitionPane.hxx +++ b/sd/source/ui/inc/SlideTransitionPane.hxx @@ -138,9 +138,6 @@ private: std::vector maSoundList; mutable OUString maCurrentSoundFile; - // How many variants each transition set has - std::map< OUString, int > m_aNumVariants; - Timer maLateInitTimer; }; diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index 6d8b4c08dc22..dc219fe4d20a 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -39,14 +39,12 @@ namespace sd struct RenderContext { SdrModel& mrModel; - SdrPage& mrPage; EEControlBits mnSavedControlBits; ScopedVclPtrInstance maVirtualDevice; RenderContext(unsigned char* pBuffer, SdrModel& rModel, SdrPage& rPage, Size const& rSlideSize) : mrModel(rModel) - , mrPage(rPage) , maVirtualDevice(DeviceFormat::WITHOUT_ALPHA) { // Turn off spelling @@ -58,7 +56,7 @@ struct RenderContext maVirtualDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(rSlideSize, Fraction(1.0), Point(), pBuffer); - Size aPageSize(mrPage.GetSize()); + Size aPageSize(rPage.GetSize()); MapMode aMapMode(MapUnit::Map100thMM); const Fraction aFracX(rSlideSize.Width(), diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 0a1ab15b2a51..ab0a747bbb16 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -233,7 +233,6 @@ SfxSingleTabDialogController::SfxSingleTabDialogController(weld::Widget *pParent , m_pInputSet(pSet) , m_xContainer(m_xDialog->weld_content_area()) , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr)) - , m_xHelpBtn(m_xBuilder->weld_button(u"help"_ustr)) { m_xOKBtn->connect_clicked(LINK(this, SfxSingleTabDialogController, OKHdl_Impl)); } @@ -244,7 +243,6 @@ SfxSingleTabDialogController::SfxSingleTabDialogController(weld::Widget *pParent , m_pInputSet(pSet) , m_xContainer(m_xBuilder->weld_container(rContainerId)) , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr)) - , m_xHelpBtn(m_xBuilder->weld_button(u"help"_ustr)) { m_xOKBtn->connect_clicked(LINK(this, SfxSingleTabDialogController, OKHdl_Impl)); } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 6e758c995711..1f5f7dd43c6e 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -208,7 +208,6 @@ private: std::shared_ptr mpMPShapesFunctor; std::shared_ptr mpShapesFunctor; std::unordered_map< BitmapChecksum, BitmapEx > maBitmapMap; - std::vector maJsonMsgList; std::unordered_map maAnimatedShapeVisibilityMap; sal_uInt32 mnMPLayerIndex; @@ -385,7 +384,6 @@ void LOKSlideRenderer::renderBackgroundImpl(VirtualDevice& rDevice) appendImageInfoPlaceholder(aJsonWriter); msLastJsonMessage = aJsonWriter.finishAndGetAsOString(); - maJsonMsgList.push_back(msLastJsonMessage); // clean up rDevice.Erase(); @@ -411,7 +409,6 @@ void LOKSlideRenderer::renderMasterPageImpl(VirtualDevice& rDevice) msLastPlaceholder = ""; msLastJsonMessage = aJsonWriter.finishAndGetAsOString(); - maJsonMsgList.push_back(msLastJsonMessage); ++mnMPLayerIndex; return; } @@ -461,7 +458,6 @@ void LOKSlideRenderer::renderMasterPageImpl(VirtualDevice& rDevice) } bDoRendering = false; msLastJsonMessage = aJsonWriter.finishAndGetAsOString(); - maJsonMsgList.push_back(msLastJsonMessage); ++mnMPLayerIndex; return; } @@ -472,7 +468,6 @@ void LOKSlideRenderer::renderMasterPageImpl(VirtualDevice& rDevice) renderLayerImpl(rDevice, aJsonWriter); } msLastJsonMessage = aJsonWriter.finishAndGetAsOString(); - maJsonMsgList.push_back(msLastJsonMessage); mbMasterPageRenderingDone = true; } @@ -516,7 +511,6 @@ void LOKSlideRenderer::renderTextFieldsImpl(VirtualDevice& rDevice) appendImageInfoPlaceholder(aJsonWriter); } msLastJsonMessage = aJsonWriter.finishAndGetAsOString(); - maJsonMsgList.push_back(msLastJsonMessage); // clean up rDevice.Erase(); @@ -558,7 +552,6 @@ void LOKSlideRenderer::renderDrawPageImpl(VirtualDevice& rDevice) renderAnimatedShapeImpl(rDevice, mpDPLastAnimatedShape, aJsonWriter); mpDPLastAnimatedShape.reset(); msLastJsonMessage = aJsonWriter.finishAndGetAsOString(); - maJsonMsgList.push_back(msLastJsonMessage); ++mnDPLayerIndex; return; } @@ -630,7 +623,6 @@ void LOKSlideRenderer::renderDrawPageImpl(VirtualDevice& rDevice) renderAnimatedShapeImpl(rDevice, pShape, aJsonWriter); } msLastJsonMessage = aJsonWriter.finishAndGetAsOString(); - maJsonMsgList.push_back(msLastJsonMessage); ++mnDPLayerIndex; return; } @@ -641,7 +633,6 @@ void LOKSlideRenderer::renderDrawPageImpl(VirtualDevice& rDevice) renderLayerImpl(rDevice, aJsonWriter); } msLastJsonMessage = aJsonWriter.finishAndGetAsOString(); - maJsonMsgList.push_back(msLastJsonMessage); mbDrawPageRenderingDone = true; } From 437aaf54c6076c19aad80fdede7202b8083c07f0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 22 Nov 2024 14:38:02 +0200 Subject: [PATCH 134/373] loplugin:unusedmethods Change-Id: I24666a7746f8920ddf84731f204f3e1a5b9b0c85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177024 Tested-by: Jenkins Reviewed-by: Noel Grandin --- package/inc/ByteGrabber.hxx | 1 - package/source/zipapi/ByteGrabber.cxx | 7 ------- sc/inc/cellform.hxx | 5 ----- sc/inc/document.hxx | 7 ------- sc/inc/scabstdlg.hxx | 2 -- sc/source/core/tool/cellform.cxx | 12 ------------ sc/source/ui/attrdlg/scdlgfact.cxx | 5 ----- sc/source/ui/attrdlg/scdlgfact.hxx | 1 - sd/inc/Annotation.hxx | 1 - sd/source/core/annotations/Annotation.cxx | 8 -------- vcl/inc/qt5/QtFrame.hxx | 1 - vcl/inc/qt5/QtTools.hxx | 1 - vcl/inc/salframe.hxx | 5 ----- vcl/inc/unx/gtk/gtkframe.hxx | 1 - vcl/qt5/QtFrame.cxx | 2 -- vcl/unx/gtk3/gtkframe.cxx | 7 ------- 16 files changed, 66 deletions(-) diff --git a/package/inc/ByteGrabber.hxx b/package/inc/ByteGrabber.hxx index 8a695338563e..ea7e6867a4bc 100644 --- a/package/inc/ByteGrabber.hxx +++ b/package/inc/ByteGrabber.hxx @@ -44,7 +44,6 @@ public: /// @throws css::io::BufferSizeExceededException /// @throws css::io::IOException /// @throws css::uno::RuntimeException - sal_Int32 readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ); sal_Int32 readBytes( sal_Int8* aData, sal_Int32 nBytesToRead ); // XSeekable /// @throws css::lang::IllegalArgumentException diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index cd9e201dba0b..7d7c77a0228f 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -56,13 +56,6 @@ void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& xNe assert(mpByteReader); } -// XInputStream chained -sal_Int32 ByteGrabber::readBytes( uno::Sequence< sal_Int8 >& aData, - sal_Int32 nBytesToRead ) -{ - return xStream->readBytes(aData, nBytesToRead ); -} - sal_Int32 ByteGrabber::readBytes( sal_Int8* aData, sal_Int32 nBytesToRead ) { diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx index 5227001a76e3..f5585a87da86 100644 --- a/sc/inc/cellform.hxx +++ b/sc/inc/cellform.hxx @@ -44,11 +44,6 @@ public: const Color** ppColor, ScInterpreterContext* pContext, bool bNullVals = true, bool bFormula = false ); - static svl::SharedString GetInputSharedString( - const ScRefCellValue& rCell, sal_uInt32 nFormat, ScInterpreterContext* pContext, - const ScDocument& rDoc, svl::SharedStringPool& rStrPool, - bool bFiltering = false, bool bForceSystemLocale = false ); - // Similar to GetInputSharedString, but can be used to visit the source of the // svl::SharedString to avoid reference counting overhead template diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 9f9a79eb024f..bf3d15092e68 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -233,13 +233,6 @@ struct ScConditionEasyDialogData sal_Int32 EntryIndex = -1; OUString Formula; - ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged, const OUString& formula = "") - : Mode(mode) - , IsManaged(isManaged) - , Formula(formula) - { - } - ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged, sal_Int32 formatKey, sal_Int32 entryIndex, const OUString& formula = "") : Mode(mode) diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 957c9605a116..1d297a58f22b 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -96,8 +96,6 @@ public: virtual void ShowEasyConditionalDialog(bool isEdit = false) = 0; virtual void SetModified() = 0; - - virtual ScConditionalFormat* GetCondFormatSelected() = 0; }; class AbstractScDataPilotDatabaseDlg :public VclAbstractDialog diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index 4b3349053fd0..d2933814ce8d 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -168,18 +168,6 @@ OUString ScCellFormat::GetInputString( } } -svl::SharedString ScCellFormat::GetInputSharedString( - const ScRefCellValue& rCell, sal_uInt32 nFormat, ScInterpreterContext* pContext, const ScDocument& rDoc, - svl::SharedStringPool& rStrPool, - bool bFiltering, bool bForceSystemLocale ) -{ - return visitInputSharedString(rCell, nFormat, pContext, rDoc, rStrPool, - bFiltering, bForceSystemLocale, - [](const svl::SharedString& arg) { - return arg; - }); -} - OUString ScCellFormat::GetOutputString( ScDocument& rDoc, const ScAddress& rPos, const ScRefCellValue& rCell ) { if (rCell.isEmpty()) diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index af95b1e025fa..9f8c1a32bae2 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -734,11 +734,6 @@ void AbstractScCondFormatManagerDlg_Impl::SetModified() return m_xDlg->SetModified(); } -ScConditionalFormat* AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected() -{ - return m_xDlg->GetCondFormatSelected(); -} - void AbstractScCondFormatManagerDlg_Impl::ShowEasyConditionalDialog(bool isEdit) { m_xDlg->ShowEasyConditionalDialog(isEdit); diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index d7dab5e4c4b8..77cd3e217cf7 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -115,7 +115,6 @@ public: virtual std::unique_ptr GetConditionalFormatList() override; virtual bool CondFormatsChanged() const override; virtual void SetModified() override; - virtual ScConditionalFormat* GetCondFormatSelected() override; virtual void ShowEasyConditionalDialog(bool isEdit = false) override; }; diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 616888357894..64380ba7f033 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -46,7 +46,6 @@ namespace sd { rtl::Reference createAnnotation(SdPage* pPage); -rtl::Reference createAnnotationAndAddToPage(SdPage* pPage); std::unique_ptr CreateUndoInsertOrRemoveAnnotation(rtl::Reference& xAnnotation, bool bInsert); diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 3036ded07e8c..a376b804bd97 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -70,14 +70,6 @@ rtl::Reference createAnnotation(SdPage* pPage) return rtl::Reference(new Annotation(comphelper::getProcessComponentContext(), pPage)); } -/** Creates an annotation and adds it to the page */ -rtl::Reference createAnnotationAndAddToPage(SdPage* pPage) -{ - rtl::Reference xAnnotation = createAnnotation(pPage); - pPage->addAnnotation(xAnnotation, -1); - return xAnnotation; -} - Annotation::Annotation(const uno::Reference& context, SdrPage* pPage) : sdr::annotation::Annotation(context, pPage) { diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx index 7867467b7bcf..efb534825e29 100644 --- a/vcl/inc/qt5/QtFrame.hxx +++ b/vcl/inc/qt5/QtFrame.hxx @@ -184,7 +184,6 @@ public: virtual void GetWorkArea(AbsoluteScreenPixelRectangle& rRect) override; virtual SalFrame* GetParent() const override; virtual void SetModal(bool bModal) override; - virtual bool GetModal() const override; virtual void SetWindowState(const vcl::WindowData*) override; virtual bool GetWindowState(vcl::WindowData*) override; virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override; diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx index 6877b7b5d985..c1b2b75fff5f 100644 --- a/vcl/inc/qt5/QtTools.hxx +++ b/vcl/inc/qt5/QtTools.hxx @@ -155,7 +155,6 @@ QImage toQImage(const Image& rImage); QMessageBox::Icon vclMessageTypeToQtIcon(VclMessageType eType); QString vclMessageTypeToQtTitle(VclMessageType eType); -int qtResponseTypeToVclResponseType(int ret); /** Converts a string potentially containing a '~' character to indicate an accelerator * to the Qt variant using '&' for the accelerator. diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index 0ea3fce1565b..8b239491d469 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -265,11 +265,6 @@ public: { } - virtual bool GetModal() const - { - return false; - } - // return true to indicate tooltips are shown natively, false otherwise virtual bool ShowTooltip(const OUString& /*rHelpText*/, const tools::Rectangle& /*rHelpArea*/) { diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 5fbf4413105c..b8b10691843b 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -606,7 +606,6 @@ public: virtual void PositionByToolkit(const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override; virtual void SetModal(bool bModal) override; - virtual bool GetModal() const override; void HideTooltip(); void BlockTooltip(); void UnblockTooltip(); diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 9bbed032c334..d993c63e7762 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -626,8 +626,6 @@ void QtFrame::SetModal(bool bModal) }); } -bool QtFrame::GetModal() const { return isWindow() && windowHandle()->isModal(); } - void QtFrame::SetWindowState(const vcl::WindowData* pState) { QtInstance& rQtInstance = GetQtInstance(); diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 42243c60e965..f101834627c5 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -3132,13 +3132,6 @@ void GtkSalFrame::SetModal(bool bModal) gtk_window_set_modal(GTK_WINDOW(m_pWindow), bModal); } -bool GtkSalFrame::GetModal() const -{ - if (!m_pWindow) - return false; - return gtk_window_get_modal(GTK_WINDOW(m_pWindow)); -} - gboolean GtkSalFrame::signalTooltipQuery(GtkWidget*, gint /*x*/, gint /*y*/, gboolean /*keyboard_mode*/, GtkTooltip *tooltip, gpointer frame) From 36c2ce13445d4326d97237a23ad3e517320360e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Nov 2024 09:29:19 +0000 Subject: [PATCH 135/373] cid#1608081 silence Overflowed array index write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I40d4207eafe46736a122e07c56f6db94cb517697 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177044 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- desktop/unx/source/start.c | 1 + 1 file changed, 1 insertion(+) diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c index a8d6b9ff0139..ee4358bc904d 100644 --- a/desktop/unx/source/start.c +++ b/desktop/unx/source/start.c @@ -516,6 +516,7 @@ static ProgressStatus read_percent(ChildInfo const *info, int *pPercent) memmove(pBuffer, pNext, nNotProcessed); /* read data */ + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 ssize_t nThisRead = read(child_info_get_status_fd(info), pBuffer + nNotProcessed, BUFFER_LEN - nNotProcessed); From d7cfb08c1ff7bfe0da477783fc2c0fbb661b8b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 21 Nov 2024 08:54:48 +0000 Subject: [PATCH 136/373] cid#1634864 avoid Missing move assignment operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and cid#1634866 Missing move assignment operator Change-Id: Iaf588bdd9185da6afeee26eea0607e72a9792bab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177045 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/core/unocore/unoport.cxx | 2 +- sw/source/core/unocore/unotbl.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index ce9f2bfb5698..54c58c112207 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -52,7 +52,7 @@ using namespace ::com::sun::star; void SwXTextPortion::init(const SwUnoCursor* pPortionCursor) { - m_pUnoCursor = pPortionCursor->GetDoc().CreateUnoCursor(*pPortionCursor->GetPoint()); + m_pUnoCursor.reset(pPortionCursor->GetDoc().CreateUnoCursor(*pPortionCursor->GetPoint())); if (pPortionCursor->HasMark()) { m_pUnoCursor->SetMark(); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 3d3f52d60516..d2c31d2474b7 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1454,7 +1454,7 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFrameFormat, SwTableBox c SwDoc* pDoc = m_pFrameFormat->GetDoc(); const SwStartNode* pSttNd = pBox->GetSttNd(); SwPosition aPos(*pSttNd); - m_pUnoCursor = pDoc->CreateUnoCursor(aPos, true); + m_pUnoCursor.reset(pDoc->CreateUnoCursor(aPos, true)); m_pUnoCursor->Move( fnMoveForward, GoInNode ); SwUnoTableCursor& rTableCursor = dynamic_cast(*m_pUnoCursor); rTableCursor.MakeBoxSels(); @@ -1465,7 +1465,7 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTabl , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR)) { StartListening(m_pFrameFormat->GetNotifier()); - m_pUnoCursor = pTableSelection->GetDoc().CreateUnoCursor(*pTableSelection->GetPoint(), true); + m_pUnoCursor.reset(pTableSelection->GetDoc().CreateUnoCursor(*pTableSelection->GetPoint(), true)); if(pTableSelection->HasMark()) { m_pUnoCursor->SetMark(); From bbad3358168d81df38d7afa1ba61f6569c4bfc19 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Fri, 22 Nov 2024 21:06:27 +0100 Subject: [PATCH 137/373] bump product version to 25.2.0.0.alpha1+ Change-Id: If5be3912a516f279ada6f6b5d82b927701a0ac16 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6b978af0342b..ebfff94178b5 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([LibreOffice],[25.2.0.0.alpha0+],[],[],[http://documentfoundation.org/]) +AC_INIT([LibreOffice],[25.2.0.0.alpha1+],[],[],[http://documentfoundation.org/]) dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard From 869fff459cbee6a2edadd5c24f2b65c199712de6 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Fri, 22 Nov 2024 12:11:07 +0100 Subject: [PATCH 138/373] Related: tdf#160517 - chart odf: import/export formatted chart titles No need to check chart title paragraph style name and ID, since its never exists. follow-up of: d7214aba95bbdcbd40e87ef50fc66f2e2ec4f5ff 6fdad723729a458eaff7ca509cb202ad355832be Change-Id: Ieffe3026adc848cfbf3a847b4f876b5aa2e2a026 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177011 Reviewed-by: Noel Grandin Reviewed-by: Balazs Varga Tested-by: Jenkins --- .../source/chart/SchXMLParagraphContext.cxx | 39 +------------------ .../source/chart/SchXMLParagraphContext.hxx | 4 -- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx index c585946e217a..c3d8608a9c52 100644 --- a/xmloff/source/chart/SchXMLParagraphContext.cxx +++ b/xmloff/source/chart/SchXMLParagraphContext.cxx @@ -104,50 +104,13 @@ void SchXMLParagraphContext::characters( const OUString& rChars ) SchXMLTitleParaContext::SchXMLTitleParaContext( SvXMLImport& rImport, std::vector>& rParaText) : SvXMLImportContext( rImport ), - mrParaText( rParaText ), - mpId( nullptr ) + mrParaText( rParaText ) { } SchXMLTitleParaContext::~SchXMLTitleParaContext() {} -void SchXMLTitleParaContext::startFastElement( - sal_Int32 /*nElement*/, - const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) -{ - // remember the id. It is used for storing the original cell range string in - // a local table (cached data) - if( !mpId ) - return; - - bool bHaveXmlId( false ); - - for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) - { - switch(aIter.getToken()) - { - case XML_ELEMENT(TEXT, XML_STYLE_NAME): - maStyleName = aIter.toString(); - break; - case XML_ELEMENT(XML, XML_ID): - (*mpId) = aIter.toString(); - bHaveXmlId = true; - break; - case XML_ELEMENT(TEXT, XML_ID): - { // text:id shall be ignored if xml:id exists - if (!bHaveXmlId) - { - (*mpId) = aIter.toString(); - } - break; - } - default: - XMLOFF_WARN_UNKNOWN("xmloff", aIter); - } - } -} - void SchXMLTitleParaContext::endFastElement(sal_Int32 ) { if (!maBuffer.isEmpty()) diff --git a/xmloff/source/chart/SchXMLParagraphContext.hxx b/xmloff/source/chart/SchXMLParagraphContext.hxx index 4f344e5793f8..f0e06893b8ce 100644 --- a/xmloff/source/chart/SchXMLParagraphContext.hxx +++ b/xmloff/source/chart/SchXMLParagraphContext.hxx @@ -54,7 +54,6 @@ class SchXMLTitleParaContext : public SvXMLImportContext { private: std::vector>& mrParaText; - OUString* mpId; OUStringBuffer maBuffer; OUString maStyleName; @@ -63,9 +62,6 @@ public: std::vector>& rParaText); virtual ~SchXMLTitleParaContext() override; - virtual void SAL_CALL startFastElement( - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual void SAL_CALL characters( const OUString& rChars ) override; From 10f3e7f602e68f83f851f4c5179cfd4c40d1c09e Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Sat, 23 Nov 2024 02:38:29 +1030 Subject: [PATCH 139/373] tdf#163486: PVS V1028 Possible overflow. Consider casting operands, ...not the result. Change-Id: I4ba8afa5989aea906000bb9c4059855015055002 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177042 Tested-by: Jenkins Reviewed-by: Aron Budea --- sw/source/core/docnode/ndtbl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 8909fe540c32..39608e359739 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -355,7 +355,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTableOpts, // If the ColumnArray has a wrong count, ignore it! if( pColArr && - static_cast(nCols + ( text::HoriOrientation::NONE == eAdjust ? 2 : 1 )) != pColArr->size() ) + static_cast(nCols) + ( text::HoriOrientation::NONE == eAdjust ? 2 : 1 ) != pColArr->size() ) pColArr = nullptr; } From e777bda2398e2507bca7e13582f23cad0d2d8689 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 14 Nov 2024 12:57:50 +0500 Subject: [PATCH 140/373] Simplify a bit Change-Id: I6cb0d64119b859446e015eccb6438396960f351e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177068 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- cui/source/options/treeopt.cxx | 164 +++++++++++---------------------- 1 file changed, 56 insertions(+), 108 deletions(-) diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 15a6b2803021..ea1d8010d138 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1712,20 +1712,16 @@ OUString OfaTreeOptionsDialog::getCurrentFactory_Impl( const Reference< XFrame > void OfaTreeOptionsDialog::generalOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) ) { setGroupName(u"ProductName", CuiResId(SID_GENERAL_OPTIONS_RES[0].first)); - nGroup = AddGroup(CuiResId(SID_GENERAL_OPTIONS_RES[0].first), nullptr, nullptr, SID_GENERAL_OPTIONS ); - const sal_uInt16 nEnd = static_cast(std::size(SID_GENERAL_OPTIONS_RES)); + sal_uInt16 nGroup = AddGroup(CuiResId(SID_GENERAL_OPTIONS_RES[0].first), nullptr, nullptr, SID_GENERAL_OPTIONS ); - for (sal_uInt16 i = 1; i < nEnd; ++i) + for (size_t i = 1; i < std::size(SID_GENERAL_OPTIONS_RES); ++i) { OUString sNewTitle = CuiResId(SID_GENERAL_OPTIONS_RES[i].first); - nPageId = SID_GENERAL_OPTIONS_RES[i].second; + sal_uInt16 nPageId = SID_GENERAL_OPTIONS_RES[i].second; if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; @@ -1750,17 +1746,14 @@ void OfaTreeOptionsDialog::generalOptions(const std::vector& vPageId void OfaTreeOptionsDialog::loadAndSaveOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) ) { setGroupName( u"LoadSave", CuiResId(SID_FILTER_DLG_RES[0].first) ); - nGroup = AddGroup( CuiResId(SID_FILTER_DLG_RES[0].first), nullptr, nullptr, SID_FILTER_DLG ); + sal_uInt16 nGroup = AddGroup( CuiResId(SID_FILTER_DLG_RES[0].first), nullptr, nullptr, SID_FILTER_DLG ); for ( size_t i = 1; i < std::size(SID_FILTER_DLG_RES); ++i ) { - nPageId = static_cast(SID_FILTER_DLG_RES[i].second); + sal_uInt16 nPageId = SID_FILTER_DLG_RES[i].second; if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) { if (!vPageId.empty()) @@ -1777,18 +1770,14 @@ void OfaTreeOptionsDialog::loadAndSaveOptions(const std::vector& vPa void OfaTreeOptionsDialog::languageOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - - SvtCTLOptions aCTLLanguageOptions; if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) ) { setGroupName(u"LanguageSettings", CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first)); - nGroup = AddGroup(CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first), nullptr, nullptr, SID_LANGUAGE_OPTIONS ); + sal_uInt16 nGroup = AddGroup(CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first), nullptr, nullptr, SID_LANGUAGE_OPTIONS ); for (size_t i = 1; i < std::size(SID_LANGUAGE_OPTIONS_RES); ++i) { - nPageId = static_cast(SID_LANGUAGE_OPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_LANGUAGE_OPTIONS_RES[i].second; if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; @@ -1817,33 +1806,28 @@ void OfaTreeOptionsDialog::languageOptions(const std::vector& vPageI void OfaTreeOptionsDialog::writerOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; - SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - - OUString aFactory = getCurrentFactory_Impl( m_xFrame ); - DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" ); - - SvtModuleOptions aModuleOpt; - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER)) { // text document + OUString aFactory = getCurrentFactory_Impl(m_xFrame); + DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); if ( aFactory == "com.sun.star.text.TextDocument" || aFactory == "com.sun.star.text.WebDocument" || aFactory == "com.sun.star.text.GlobalDocument" ) { - SfxModule* pSwMod = SfxApplication::GetModule(SfxToolsModule::Writer); + SvtOptionsDialogOptions aOptionsDlgOpt; if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) ) { if ( aFactory == "com.sun.star.text.WebDocument" ) setGroupName( u"WriterWeb", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) ); else setGroupName( u"Writer", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) ); - nGroup = AddGroup(CuiResId(SID_SW_EDITOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_EDITOPTIONS ); + SfxModule* pSwMod = SfxApplication::GetModule(SfxToolsModule::Writer); + sal_uInt16 nGroup = AddGroup(CuiResId(SID_SW_EDITOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_EDITOPTIONS ); SvtCTLOptions aCTLLanguageOptions; for ( size_t i = 1; i < std::size(SID_SW_EDITOPTIONS_RES); ++i ) { - nPageId = static_cast(SID_SW_EDITOPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_SW_EDITOPTIONS_RES[i].second; if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || SvtCJKOptions::IsCJKFontEnabled() ) && @@ -1877,30 +1861,24 @@ void OfaTreeOptionsDialog::writerOptions(const std::vector& vPageId) void OfaTreeOptionsDialog::writerWebOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; - SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - - OUString aFactory = getCurrentFactory_Impl( m_xFrame ); - DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" ); - - SvtModuleOptions aModuleOpt; - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER)) { // text document + OUString aFactory = getCurrentFactory_Impl(m_xFrame); + DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); if ( aFactory == "com.sun.star.text.TextDocument" || aFactory == "com.sun.star.text.WebDocument" || aFactory == "com.sun.star.text.GlobalDocument" ) { - SfxModule* pSwMod = SfxApplication::GetModule(SfxToolsModule::Writer); - // HTML documents + SvtOptionsDialogOptions aOptionsDlgOpt; if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) ) { - nGroup = AddGroup(CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS ); + SfxModule* pSwMod = SfxApplication::GetModule(SfxToolsModule::Writer); + sal_uInt16 nGroup = AddGroup(CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS ); for( size_t i = 1; i < std::size(SID_SW_ONLINEOPTIONS_RES); ++i ) { - nPageId = static_cast(SID_SW_ONLINEOPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_SW_ONLINEOPTIONS_RES[i].second; if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) { if (!vPageId.empty()) @@ -1931,28 +1909,22 @@ void OfaTreeOptionsDialog::writerWebOptions(const std::vector& vPage void OfaTreeOptionsDialog::calcOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; - SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - - OUString aFactory = getCurrentFactory_Impl( m_xFrame ); - DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" ); - - SvtModuleOptions aModuleOpt; // Calc options - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::CALC)) { + OUString aFactory = getCurrentFactory_Impl(m_xFrame); + DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); if ( aFactory == "com.sun.star.sheet.SpreadsheetDocument" ) { + SvtOptionsDialogOptions aOptionsDlgOpt; if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) ) { SfxModule* pScMod = SfxApplication::GetModule( SfxToolsModule::Calc ); setGroupName( u"Calc", CuiResId(SID_SC_EDITOPTIONS_RES[0].first) ); - nGroup = AddGroup( CuiResId(SID_SC_EDITOPTIONS_RES[0].first), pScMod, pScMod, SID_SC_EDITOPTIONS ); - const sal_uInt16 nCount = static_cast(std::size(SID_SC_EDITOPTIONS_RES)); - for ( sal_uInt16 i = 1; i < nCount; ++i ) + sal_uInt16 nGroup = AddGroup( CuiResId(SID_SC_EDITOPTIONS_RES[0].first), pScMod, pScMod, SID_SC_EDITOPTIONS ); + for (size_t i = 1; i < std::size(SID_SC_EDITOPTIONS_RES); ++i) { - nPageId = static_cast(SID_SC_EDITOPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_SC_EDITOPTIONS_RES[i].second; if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; @@ -1971,28 +1943,22 @@ void OfaTreeOptionsDialog::calcOptions(const std::vector& vPageId) void OfaTreeOptionsDialog::impressOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; - SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - - OUString aFactory = getCurrentFactory_Impl( m_xFrame ); - DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" ); - SvtModuleOptions aModuleOpt; - // Impress options - SfxModule* pSdMod = SfxApplication::GetModule( SfxToolsModule::Draw ); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::IMPRESS)) { + OUString aFactory = getCurrentFactory_Impl(m_xFrame); + DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); if ( aFactory == "com.sun.star.presentation.PresentationDocument" ) { + SvtOptionsDialogOptions aOptionsDlgOpt; if ( !lcl_isOptionHidden( SID_SD_EDITOPTIONS, aOptionsDlgOpt ) ) { + SfxModule* pSdMod = SfxApplication::GetModule(SfxToolsModule::Draw); setGroupName( u"Impress", CuiResId(SID_SD_EDITOPTIONS_RES[0].first) ); - nGroup = AddGroup( CuiResId(SID_SD_EDITOPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_EDITOPTIONS ); - const sal_uInt16 nCount = static_cast(std::size(SID_SD_EDITOPTIONS_RES)); - for ( sal_uInt16 i = 1; i < nCount; ++i ) + sal_uInt16 nGroup = AddGroup( CuiResId(SID_SD_EDITOPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_EDITOPTIONS ); + for (size_t i = 1; i < std::size(SID_SD_EDITOPTIONS_RES); ++i) { - nPageId = static_cast(SID_SD_EDITOPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_SD_EDITOPTIONS_RES[i].second; if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; @@ -2011,28 +1977,22 @@ void OfaTreeOptionsDialog::impressOptions(const std::vector& vPageId void OfaTreeOptionsDialog::drawOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; - SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - - OUString aFactory = getCurrentFactory_Impl( m_xFrame ); - DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" ); - SvtModuleOptions aModuleOpt; - // Draw options - SfxModule* pSdMod = SfxApplication::GetModule(SfxToolsModule::Draw); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ) + if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DRAW)) { + OUString aFactory = getCurrentFactory_Impl(m_xFrame); + DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); if ( aFactory == "com.sun.star.drawing.DrawingDocument" ) { + SvtOptionsDialogOptions aOptionsDlgOpt; if ( !lcl_isOptionHidden( SID_SD_GRAPHIC_OPTIONS, aOptionsDlgOpt ) ) { + SfxModule* pSdMod = SfxApplication::GetModule(SfxToolsModule::Draw); setGroupName( u"Draw", CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first) ); - nGroup = AddGroup( CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS ); - const sal_uInt16 nCount = static_cast(std::size(SID_SD_GRAPHIC_OPTIONS_RES)); - for ( sal_uInt16 i = 1; i < nCount; ++i ) + sal_uInt16 nGroup = AddGroup( CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS ); + for (size_t i = 1; i < std::size(SID_SD_GRAPHIC_OPTIONS_RES); ++i) { - nPageId = static_cast(SID_SD_GRAPHIC_OPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_SD_GRAPHIC_OPTIONS_RES[i].second; if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; @@ -2052,27 +2012,22 @@ void OfaTreeOptionsDialog::drawOptions(const std::vector& vPageId) void OfaTreeOptionsDialog::mathOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; - SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - - OUString aFactory = getCurrentFactory_Impl( m_xFrame ); - DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" ); - SvtModuleOptions aModuleOpt; - // Math options - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) ) + if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::MATH)) { + OUString aFactory = getCurrentFactory_Impl(m_xFrame); + DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); if ( aFactory == "com.sun.star.formula.FormulaProperties" ) { + SvtOptionsDialogOptions aOptionsDlgOpt; if ( !lcl_isOptionHidden( SID_SM_EDITOPTIONS, aOptionsDlgOpt ) ) { SfxModule* pSmMod = SfxApplication::GetModule(SfxToolsModule::Math); setGroupName( u"Math", CuiResId(SID_SM_EDITOPTIONS_RES[0].first) ); - nGroup = AddGroup(CuiResId(SID_SM_EDITOPTIONS_RES[0].first), pSmMod, pSmMod, SID_SM_EDITOPTIONS ); + sal_uInt16 nGroup = AddGroup(CuiResId(SID_SM_EDITOPTIONS_RES[0].first), pSmMod, pSmMod, SID_SM_EDITOPTIONS ); for ( size_t i = 1; i < std::size(SID_SM_EDITOPTIONS_RES); ++i ) { - nPageId = static_cast(SID_SM_EDITOPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_SM_EDITOPTIONS_RES[i].second; if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) { if (!vPageId.empty()) @@ -2092,10 +2047,7 @@ void OfaTreeOptionsDialog::mathOptions(const std::vector& vPageId) void OfaTreeOptionsDialog::databaseOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; - SvtModuleOptions aModuleOpt; // Database - needed only if there is an application which integrates with databases @@ -2106,10 +2058,10 @@ void OfaTreeOptionsDialog::databaseOptions(const std::vector& vPageI ) ) { setGroupName( u"Base", CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first) ); - nGroup = AddGroup( CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first), nullptr, nullptr, SID_SB_STARBASEOPTIONS ); + sal_uInt16 nGroup = AddGroup( CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first), nullptr, nullptr, SID_SB_STARBASEOPTIONS ); for ( size_t i = 1; i < std::size(SID_SB_STARBASEOPTIONS_RES); ++i ) { - nPageId = static_cast(SID_SB_STARBASEOPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_SB_STARBASEOPTIONS_RES[i].second; if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) { if (!vPageId.empty()) @@ -2126,17 +2078,15 @@ void OfaTreeOptionsDialog::databaseOptions(const std::vector& vPageI void OfaTreeOptionsDialog::chartOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) ) { setGroupName( u"Charts", CuiResId(SID_SCH_EDITOPTIONS_RES[0].first) ); - nGroup = AddGroup( CuiResId(SID_SCH_EDITOPTIONS_RES[0].first), nullptr, nullptr, SID_SCH_EDITOPTIONS ); + sal_uInt16 nGroup = AddGroup( CuiResId(SID_SCH_EDITOPTIONS_RES[0].first), nullptr, nullptr, SID_SCH_EDITOPTIONS ); for ( size_t i = 1; i < std::size(SID_SCH_EDITOPTIONS_RES); ++i ) { - nPageId = static_cast(SID_SCH_EDITOPTIONS_RES[i].second); + sal_uInt16 nPageId = SID_SCH_EDITOPTIONS_RES[i].second; if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) { if (!vPageId.empty()) @@ -2153,19 +2103,17 @@ void OfaTreeOptionsDialog::chartOptions(const std::vector& vPageId) void OfaTreeOptionsDialog::internetOptions(const std::vector& vPageId) { - sal_uInt16 nGroup = 0; SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 nPageId = 0; if ( lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) ) return; setGroupName(u"Internet", CuiResId(SID_INET_DLG_RES[0].first)); - nGroup = AddGroup(CuiResId(SID_INET_DLG_RES[0].first), nullptr, nullptr, SID_INET_DLG ); + sal_uInt16 nGroup = AddGroup(CuiResId(SID_INET_DLG_RES[0].first), nullptr, nullptr, SID_INET_DLG ); for ( size_t i = 1; i < std::size(SID_INET_DLG_RES); ++i ) { - nPageId = static_cast(SID_INET_DLG_RES[i].second); + sal_uInt16 nPageId = SID_INET_DLG_RES[i].second; if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; #if defined(_WIN32) From fec1501374860983d837d482cd175d80f4635b6f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 14 Nov 2024 14:20:52 +0500 Subject: [PATCH 141/373] Use specific SvtModuleOptions::Is*Installed for clarity Change-Id: Ibe64b9fcccf33471d96bb0fb1aa896cb456657f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177069 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- basctl/source/basicide/basobj2.cxx | 2 +- basctl/source/basicide/basobj3.cxx | 2 +- cui/source/dialogs/hlmailtp.cxx | 3 +- cui/source/options/optcolor.cxx | 10 ++--- cui/source/options/optfltr.cxx | 10 ++--- cui/source/options/optpath.cxx | 2 +- cui/source/options/optsave.cxx | 10 ++--- cui/source/options/treeopt.cxx | 18 ++++---- dbaccess/source/ui/app/AppController.cxx | 7 ++-- desktop/source/app/app.cxx | 34 +++++++-------- desktop/source/app/officeipcthread.cxx | 8 ++-- .../source/propctrlr/formcomponenthandler.cxx | 6 +-- include/unotools/moduleoptions.hxx | 16 +++---- sc/source/filter/excel/xiescher.cxx | 2 +- sc/source/ui/drawfunc/fuins2.cxx | 6 +-- sc/source/ui/unoobj/TablePivotCharts.cxx | 2 +- sc/source/ui/unoobj/chartuno.cxx | 2 +- sc/source/ui/view/cellsh2.cxx | 2 +- sc/source/ui/view/tabvwsh2.cxx | 2 +- sc/source/ui/view/tabvwshb.cxx | 6 +-- sd/source/ui/app/sddll.cxx | 18 +++++--- sd/source/ui/app/sdmod1.cxx | 2 +- sd/source/ui/view/drviews7.cxx | 6 +-- sd/source/ui/view/viewshe2.cxx | 6 +-- sfx2/source/appl/appserv.cxx | 9 ++-- sfx2/source/appl/sfxhelp.cxx | 16 +++---- sfx2/source/dialog/backingwindow.cxx | 24 +++++------ sfx2/source/doc/objserv.cxx | 4 +- sfx2/source/doc/templatedlg.cxx | 8 ++-- sfx2/source/view/viewfrm.cxx | 2 +- svx/source/form/fmshell.cxx | 4 +- svx/source/form/fmvwimp.cxx | 2 +- sw/source/filter/basflt/iodetect.cxx | 2 +- sw/source/filter/basflt/shellio.cxx | 3 +- sw/source/uibase/app/docsh.cxx | 7 +--- sw/source/uibase/app/swdll.cxx | 8 ++-- sw/source/uibase/app/swmodule.cxx | 5 ++- sw/source/uibase/shells/tabsh.cxx | 2 +- sw/source/uibase/shells/textsh.cxx | 8 ++-- sw/source/uibase/uiview/view0.cxx | 2 +- sw/source/uibase/uiview/viewstat.cxx | 2 +- unotools/source/config/moduleoptions.cxx | 42 ------------------- 42 files changed, 143 insertions(+), 189 deletions(-) diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index 48c09c039388..c0b54a51885e 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -238,7 +238,7 @@ OUString ChooseMacro(weld::Window* pParent, SbMethod* pMethod = nullptr; MacroChooser aChooser(pParent, xDocFrame); - if ( bChooseOnly || !SvtModuleOptions::IsBasicIDE() ) + if (bChooseOnly || !SvtModuleOptions::IsBasicIDEInstalled()) aChooser.SetMode(MacroChooser::ChooseOnly); if ( !bChooseOnly && rxLimitToDocument.is() ) diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index f8af9e037b60..8e1eaf40c79f 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -375,7 +375,7 @@ tools::Long HandleBasicError( StarBASIC const * pBasic ) tools::Long nRet = 0; Shell* pShell = nullptr; - if ( SvtModuleOptions::IsBasicIDE() ) + if (SvtModuleOptions::IsBasicIDEInstalled()) { BasicManager* pBasMgr = FindBasicManager( pBasic ); if ( pBasMgr ) diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx index 73904ed34258..3f27aaa70f4c 100644 --- a/cui/source/dialogs/hlmailtp.cxx +++ b/cui/source/dialogs/hlmailtp.cxx @@ -51,8 +51,7 @@ SvxHyperlinkMailTp::SvxHyperlinkMailTp(weld::Container* pParent, SvxHpLinkDlg* p m_xBtAdrBook->connect_clicked( LINK ( this, SvxHyperlinkMailTp, ClickAdrBookHdl_Impl ) ); m_xCbbReceiver->connect_changed( LINK ( this, SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl) ); - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) || - comphelper::LibreOfficeKit::isActive() ) + if (!SvtModuleOptions().IsDataBaseInstalled() || comphelper::LibreOfficeKit::isActive()) m_xBtAdrBook->hide(); } diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index 67cb2462b0d2..8e008e2c8069 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -676,15 +676,15 @@ bool ColorConfigWindow_Impl::IsGroupVisible (Group eGroup) const { case Group_Writer: case Group_Html: - return aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::WRITER); + return aModuleOptions.IsWriterInstalled(); case Group_Calc: - return aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::CALC); + return aModuleOptions.IsCalcInstalled(); case Group_Draw: return - aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::DRAW) || - aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::IMPRESS); + aModuleOptions.IsDrawInstalled() || + aModuleOptions.IsImpressInstalled(); case Group_Sql: - return aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::DATABASE); + return aModuleOptions.IsDataBaseInstalled(); default: return true; } diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index efda65e1ad26..14bb0c9463f0 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -331,16 +331,16 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet* ) SvtModuleOptions aModuleOpt; // int the same sequence as the enums of MSFltrPg2_CheckBoxEntries - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) ) + if (aModuleOpt.IsMathInstalled()) InsertEntry( sChgToFromMath, MSFltrPg2_CheckBoxEntries::Math ); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (aModuleOpt.IsWriterInstalled()) InsertEntry( sChgToFromWriter, MSFltrPg2_CheckBoxEntries::Writer ); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + if (aModuleOpt.IsCalcInstalled()) InsertEntry( sChgToFromCalc, MSFltrPg2_CheckBoxEntries::Calc ); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + if (aModuleOpt.IsImpressInstalled()) InsertEntry( sChgToFromImpress, MSFltrPg2_CheckBoxEntries::Impress ); InsertEntry( sChgToFromSmartArt, MSFltrPg2_CheckBoxEntries::SmartArt, false ); - if (aModuleOpt.IsModuleInstalled(SvtModuleOptions::EModule::DRAW)) + if (aModuleOpt.IsDrawInstalled()) { InsertEntry(sChgToFromVisio, MSFltrPg2_CheckBoxEntries::Visio, false); InsertEntry(sChgToFromPDF, MSFltrPg2_CheckBoxEntries::PDF, false); diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index d11aab9e7eaf..97f9c5535cb8 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -247,7 +247,7 @@ void SvxPathTabPage::Reset( const SfxItemSet* ) { // only writer uses autotext if ( static_cast(i) == SvtPathOptions::Paths::AutoText - && !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + && !SvtModuleOptions().IsWriterInstalled()) continue; TranslateId pId; diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index 907ece3e51bd..effa144bd761 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -140,7 +140,7 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p m_xBackupCB->connect_toggled(LINK(this, SvxSaveTabPage, BackupClickHdl_Impl)); SvtModuleOptions aModuleOpt; - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) ) + if (!aModuleOpt.IsMathInstalled()) { m_xSaveAsLB->remove_id(OUString::number(APP_MATH)); m_xDocTypeLB->remove_id(OUString::number(APP_MATH)); @@ -151,7 +151,7 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p pImpl->aDefaultReadonlyArr[APP_MATH] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::MATH); } - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ) + if (!aModuleOpt.IsDrawInstalled()) { m_xSaveAsLB->remove_id(OUString::number(APP_DRAW)); m_xDocTypeLB->remove_id(OUString::number(APP_DRAW)); @@ -162,7 +162,7 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p pImpl->aDefaultReadonlyArr[APP_DRAW] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::DRAW); } - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + if (!aModuleOpt.IsImpressInstalled()) { m_xSaveAsLB->remove_id(OUString::number(APP_IMPRESS)); m_xDocTypeLB->remove_id(OUString::number(APP_IMPRESS)); @@ -173,7 +173,7 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p pImpl->aDefaultReadonlyArr[APP_IMPRESS] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::IMPRESS); } - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + if (!aModuleOpt.IsCalcInstalled()) { m_xSaveAsLB->remove_id(OUString::number(APP_CALC)); m_xDocTypeLB->remove_id(OUString::number(APP_CALC)); @@ -184,7 +184,7 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p pImpl->aDefaultReadonlyArr[APP_CALC] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::CALC); } - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (!aModuleOpt.IsWriterInstalled()) { m_xSaveAsLB->remove_id(OUString::number(APP_WRITER)); m_xSaveAsLB->remove_id(OUString::number(APP_WRITER_WEB)); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index ea1d8010d138..f5d6a9eaf040 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1806,7 +1806,7 @@ void OfaTreeOptionsDialog::languageOptions(const std::vector& vPageI void OfaTreeOptionsDialog::writerOptions(const std::vector& vPageId) { - if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER)) + if (SvtModuleOptions().IsWriterInstalled()) { // text document OUString aFactory = getCurrentFactory_Impl(m_xFrame); @@ -1861,7 +1861,7 @@ void OfaTreeOptionsDialog::writerOptions(const std::vector& vPageId) void OfaTreeOptionsDialog::writerWebOptions(const std::vector& vPageId) { - if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER)) + if (SvtModuleOptions().IsWriterInstalled()) { // text document OUString aFactory = getCurrentFactory_Impl(m_xFrame); @@ -1910,7 +1910,7 @@ void OfaTreeOptionsDialog::writerWebOptions(const std::vector& vPage void OfaTreeOptionsDialog::calcOptions(const std::vector& vPageId) { // Calc options - if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::CALC)) + if (SvtModuleOptions().IsCalcInstalled()) { OUString aFactory = getCurrentFactory_Impl(m_xFrame); DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); @@ -1944,7 +1944,7 @@ void OfaTreeOptionsDialog::calcOptions(const std::vector& vPageId) void OfaTreeOptionsDialog::impressOptions(const std::vector& vPageId) { // Impress options - if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::IMPRESS)) + if (SvtModuleOptions().IsImpressInstalled()) { OUString aFactory = getCurrentFactory_Impl(m_xFrame); DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); @@ -1978,7 +1978,7 @@ void OfaTreeOptionsDialog::impressOptions(const std::vector& vPageId void OfaTreeOptionsDialog::drawOptions(const std::vector& vPageId) { // Draw options - if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DRAW)) + if (SvtModuleOptions().IsDrawInstalled()) { OUString aFactory = getCurrentFactory_Impl(m_xFrame); DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); @@ -2013,7 +2013,7 @@ void OfaTreeOptionsDialog::drawOptions(const std::vector& vPageId) void OfaTreeOptionsDialog::mathOptions(const std::vector& vPageId) { // Math options - if (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::MATH)) + if (SvtModuleOptions().IsMathInstalled()) { OUString aFactory = getCurrentFactory_Impl(m_xFrame); DBG_ASSERT(GetModuleIdentifier(m_xFrame) == aFactory, "This should not happen"); @@ -2052,9 +2052,9 @@ void OfaTreeOptionsDialog::databaseOptions(const std::vector& vPageI // Database - needed only if there is an application which integrates with databases if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) && - ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) - || aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) - || aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) + ( aModuleOpt.IsDataBaseInstalled() + || aModuleOpt.IsWriterInstalled() + || aModuleOpt.IsCalcInstalled() ) ) { setGroupName( u"Base", CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first) ); diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index ed10f38e660b..741dc7afeeb8 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -598,11 +598,10 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const case SID_NEWDOC: case SID_APP_NEW_FORM: case ID_DOCUMENT_CREATE_REPWIZ: - aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER); + aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsWriterInstalled(); break; case SID_APP_NEW_REPORT: - aReturn.bEnabled = !isDataSourceReadOnly() - && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER); + aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsWriterInstalled(); if ( aReturn.bEnabled ) { Reference< XContentEnumerationAccess > xEnumAccess(m_xContext->getServiceManager(), UNO_QUERY); @@ -670,7 +669,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const case SID_REPORT_CREATE_REPWIZ_PRE_SEL: case SID_APP_NEW_REPORT_PRE_SEL: aReturn.bEnabled = !isDataSourceReadOnly() - && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER) + && SvtModuleOptions().IsWriterInstalled() && getContainer()->isALeafSelected(); if ( aReturn.bEnabled ) { diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index ec7d7f30a0c8..cb4a4de7db9e 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2177,13 +2177,13 @@ void Desktop::OpenClients() SvtModuleOptions aOpt; // Support command line parameters to start a module (as preselection) - if ( rArgs.IsWriter() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (rArgs.IsWriter() && aOpt.IsWriterInstalled()) aRequest.aModule = aOpt.GetFactoryName( SvtModuleOptions::EFactory::WRITER ); - else if ( rArgs.IsCalc() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + else if (rArgs.IsCalc() && aOpt.IsCalcInstalled()) aRequest.aModule = aOpt.GetFactoryName( SvtModuleOptions::EFactory::CALC ); - else if ( rArgs.IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + else if (rArgs.IsImpress() && aOpt.IsImpressInstalled()) aRequest.aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::IMPRESS ); - else if ( rArgs.IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ) + else if (rArgs.IsDraw() && aOpt.IsDrawInstalled()) aRequest.aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::DRAW ); } @@ -2230,21 +2230,21 @@ void Desktop::OpenDefault() if ( rArgs.HasModuleParam() ) { // Support new command line parameters to start a module - if ( rArgs.IsWriter() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (rArgs.IsWriter() && aOpt.IsWriterInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITER ); - else if ( rArgs.IsCalc() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + else if (rArgs.IsCalc() && aOpt.IsCalcInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::CALC ); - else if ( rArgs.IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + else if (rArgs.IsImpress() && aOpt.IsImpressInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::IMPRESS ); - else if ( rArgs.IsBase() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + else if (rArgs.IsBase() && aOpt.IsDataBaseInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::DATABASE ); - else if ( rArgs.IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ) + else if (rArgs.IsDraw() && aOpt.IsDrawInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::DRAW ); - else if ( rArgs.IsMath() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) ) + else if (rArgs.IsMath() && aOpt.IsMathInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::MATH ); - else if ( rArgs.IsGlobal() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + else if (rArgs.IsGlobal() && aOpt.IsModuleInstalled(SvtModuleOptions::EModule::GLOBAL)) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITERGLOBAL ); - else if ( rArgs.IsWeb() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + else if (rArgs.IsWeb() && aOpt.IsModuleInstalled(SvtModuleOptions::EModule::WEB)) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITERWEB ); } @@ -2257,15 +2257,15 @@ void Desktop::OpenDefault() } // Old way to create a default document - if ( aOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (aOpt.IsWriterInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITER ); - else if ( aOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + else if (aOpt.IsCalcInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::CALC ); - else if ( aOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + else if (aOpt.IsImpressInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::IMPRESS ); - else if ( aOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + else if (aOpt.IsDataBaseInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::DATABASE ); - else if ( aOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ) + else if (aOpt.IsDrawInstalled()) aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::DRAW ); else return; diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 274a822fcc30..4029546fd666 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -1089,13 +1089,13 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { SvtModuleOptions aOpt; // Support command line parameters to start a module (as preselection) - if ( aCmdLineArgs->IsWriter() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (aCmdLineArgs->IsWriter() && aOpt.IsWriterInstalled()) pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::EFactory::WRITER ); - else if ( aCmdLineArgs->IsCalc() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + else if (aCmdLineArgs->IsCalc() && aOpt.IsCalcInstalled()) pRequest->aModule = aOpt.GetFactoryName( SvtModuleOptions::EFactory::CALC ); - else if ( aCmdLineArgs->IsImpress() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + else if (aCmdLineArgs->IsImpress() && aOpt.IsImpressInstalled()) pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::IMPRESS ); - else if ( aCmdLineArgs->IsDraw() && aOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ) + else if (aCmdLineArgs->IsDraw() && aOpt.IsDrawInstalled()) pRequest->aModule= aOpt.GetFactoryName( SvtModuleOptions::EFactory::DRAW ); } diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 0f97ef6ec418..aa224fd18981 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -853,13 +853,13 @@ namespace pcr case PROPERTY_ID_LISTSOURCE: // no cursor source if no Base is installed. - if ( SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + if (SvtModuleOptions().IsDataBaseInstalled()) const_cast< FormComponentPropertyHandler* >( this )->m_bHaveListSource = true; break; case PROPERTY_ID_COMMAND: // no cursor source if no Base is installed. - if ( SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + if (SvtModuleOptions().IsDataBaseInstalled()) const_cast< FormComponentPropertyHandler* >( this )->m_bHaveCommand = true; break; } // switch ( nPropId ) @@ -2283,7 +2283,7 @@ namespace pcr // no data properties if no Base is installed. if ( ( nPropertyUIFlags & PROP_FLAG_DATA_PROPERTY ) != 0 ) - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + if (!SvtModuleOptions().IsDataBaseInstalled()) return true; if ((nPropertyUIFlags & PROP_FLAG_REPORT_INVISIBLE) != 0 && isReportModel()) diff --git a/include/unotools/moduleoptions.hxx b/include/unotools/moduleoptions.hxx index 8aa9860ceb1a..1599473faa02 100644 --- a/include/unotools/moduleoptions.hxx +++ b/include/unotools/moduleoptions.hxx @@ -155,14 +155,14 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtModuleOptions final : public utl::de OUString GetDefaultModuleName() const; - bool IsMath () const; - bool IsChart () const; - bool IsCalc () const; - bool IsDraw () const; - bool IsWriter () const; - bool IsImpress () const; - static bool IsBasicIDE () { return true; } - bool IsDataBase () const; + bool IsMathInstalled() const { return IsModuleInstalled(EModule::MATH); } + bool IsChartInstalled() const { return IsModuleInstalled(EModule::CHART); } + bool IsCalcInstalled() const { return IsModuleInstalled(EModule::CALC); } + bool IsDrawInstalled() const { return IsModuleInstalled(EModule::DRAW); } + bool IsWriterInstalled() const { return IsModuleInstalled(EModule::WRITER); } + bool IsImpressInstalled() const { return IsModuleInstalled(EModule::IMPRESS); } + static bool IsBasicIDEInstalled() { return true; } + bool IsDataBaseInstalled() const { return IsModuleInstalled(EModule::DATABASE); } css::uno::Sequence < OUString > GetAllServiceNames(); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 2f1ceadc0735..81edde0ac3cb 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -1760,7 +1760,7 @@ rtl::Reference XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rD { rtl::Reference xSdrObj; ScDocShell* pDocShell = GetDocShell(); - if( rDffConv.SupportsOleObjects() && SvtModuleOptions().IsChart() && pDocShell && mxChart && !mxChart->IsPivotChart() ) + if( rDffConv.SupportsOleObjects() && SvtModuleOptions().IsChartInstalled() && pDocShell && mxChart && !mxChart->IsPivotChart() ) { // create embedded chart object OUString aEmbObjName; diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index a5fb251b7ef0..9705a405b641 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -243,7 +243,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* } else if ( nSlot == SID_INSERT_SMATH ) { - if ( SvtModuleOptions().IsMath() ) + if ( SvtModuleOptions().IsMathInstalled() ) { xObj = rViewShell.GetViewFrame().GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_SM_CLASSID_60 ).GetByteSequence(), aName ); rReq.AppendItem( SfxGlobalNameItem( SID_INSERT_OBJECT, SvGlobalName( SO3_SM_CLASSID_60 ) ) ); @@ -345,7 +345,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* } // initialize chart ? - if ( SvtModuleOptions().IsChart() && SotExchange::IsChart( SvGlobalName( xObj->getClassID() ) ) ) + if ( SvtModuleOptions().IsChartInstalled() && SotExchange::IsChart( SvGlobalName( xObj->getClassID() ) ) ) lcl_ChartInit(xObj, &rViewSh.GetViewData(), OUString(), false); ScViewData& rData = rViewSh.GetViewData(); @@ -419,7 +419,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV if( ! rReq.IsAPI() ) rReq.Done(); - if (!SvtModuleOptions().IsChart()) + if (!SvtModuleOptions().IsChartInstalled()) return; // BM/IHA -- diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx index 2142a006e8e1..c08c5aa78bc4 100644 --- a/sc/source/ui/unoobj/TablePivotCharts.cxx +++ b/sc/source/ui/unoobj/TablePivotCharts.cxx @@ -94,7 +94,7 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName, uno::Reference xObject; - if (SvtModuleOptions().IsChart()) + if (SvtModuleOptions().IsChartInstalled()) xObject = m_pDocShell->GetEmbeddedObjectContainer().CreateEmbeddedObject(SvGlobalName(SO3_SCH_CLASSID).GetByteSequence(), aName); if (!xObject.is()) diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index ab5bcb19a12c..c0d88b031789 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -172,7 +172,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, ScRangeListRef xNewRanges( pList ); uno::Reference < embed::XEmbeddedObject > xObj; - if ( SvtModuleOptions().IsChart() ) + if ( SvtModuleOptions().IsChartInstalled() ) xObj = pDocShell->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_SCH_CLASSID ).GetByteSequence(), aName ); if ( !xObj.is() ) return; diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 1a3aa891ffde..f6577c7f16b5 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -1175,7 +1175,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) case SID_VIEW_DATA_SOURCE_BROWSER: { - if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DATABASE)) + if (!SvtModuleOptions().IsDataBaseInstalled()) rSet.Put(SfxVisibilityItem(nWhich, false)); else // get state (BoolItem) from SfxViewFrame diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index 8ff41cc374bd..d0bff87ee629 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -399,7 +399,7 @@ void ScTabViewShell::GetDrawState(SfxItemSet &rSet) case SID_DRAW_CHART: { bool bOle = GetViewFrame().GetFrame().IsInPlace(); - if ( bOle || !SvtModuleOptions().IsChart() ) + if ( bOle || !SvtModuleOptions().IsChartInstalled() ) rSet.DisableItem( nWhich ); } break; diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 3b1bf47dc238..ae82a7b74a9f 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -231,7 +231,7 @@ void ScTabViewShell::ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb) // attach listener to selection changes in chart that affect cell // ranges, so those can be highlighted // note: do that after DoVerb, so that the chart controller exists - if ( SvtModuleOptions().IsChart() ) + if ( SvtModuleOptions().IsChartInstalled() ) { SvGlobalName aObjClsId ( xObj->getClassID() ); if (SotExchange::IsChart( aObjClsId )) @@ -603,12 +603,12 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) switch ( nWhich ) { case SID_INSERT_DIAGRAM: - if ( bOle || bTabProt || !SvtModuleOptions().IsChart() || bShared ) + if ( bOle || bTabProt || !SvtModuleOptions().IsChartInstalled() || bShared ) rSet.DisableItem( nWhich ); break; case SID_INSERT_SMATH: - if ( bOle || bTabProt || !SvtModuleOptions().IsMath() || bShared ) + if ( bOle || bTabProt || !SvtModuleOptions().IsMathInstalled() || bShared ) rSet.DisableItem( nWhich ); break; diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index d65bee2ad2c1..78646f8c049e 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -87,7 +87,10 @@ using namespace ::com::sun::star; // Register all Factories void SdDLL::RegisterFactorys() { - if (comphelper::IsFuzzing() || SvtModuleOptions().IsImpress()) + std::optional oOpts; + if (!comphelper::IsFuzzing()) + oOpts.emplace(); + if (!oOpts || oOpts->IsImpressInstalled()) { ::sd::ImpressViewShellBase::RegisterFactory ( ::sd::IMPRESS_FACTORY_ID); @@ -110,7 +113,7 @@ void SdDLL::RegisterFactorys() ::sd::PRESENTATION_FACTORY_ID); } } - if (!comphelper::IsFuzzing() && SvtModuleOptions().IsDraw()) + if (oOpts && oOpts->IsDrawInstalled()) { ::sd::GraphicViewShellBase::RegisterFactory (::sd::DRAW_FACTORY_ID); } @@ -224,24 +227,27 @@ void SdDLL::Init() SfxObjectFactory* pDrawFact = nullptr; SfxObjectFactory* pImpressFact = nullptr; - if (comphelper::IsFuzzing() || SvtModuleOptions().IsImpress()) + std::optional oOptions; + if (!comphelper::IsFuzzing()) + oOptions.emplace(); + if (!oOptions || oOptions->IsImpressInstalled()) pImpressFact = &::sd::DrawDocShell::Factory(); - if (!comphelper::IsFuzzing() && SvtModuleOptions().IsDraw()) + if (oOptions && oOptions->IsDrawInstalled()) pDrawFact = &::sd::GraphicDocShell::Factory(); auto pUniqueModule = std::make_unique(pImpressFact, pDrawFact); SdModule* pModule = pUniqueModule.get(); SfxApplication::SetModule(SfxToolsModule::Draw, std::move(pUniqueModule)); - if (!comphelper::IsFuzzing() && SvtModuleOptions().IsImpress()) + if (oOptions && oOptions->IsImpressInstalled()) { // Register the Impress shape types in order to make the shapes accessible. ::accessibility::RegisterImpressShapeTypes (); ::sd::DrawDocShell::Factory().SetDocumentServiceName( u"com.sun.star.presentation.PresentationDocument"_ustr ); } - if (!comphelper::IsFuzzing() && SvtModuleOptions().IsDraw()) + if (oOptions && oOptions->IsDrawInstalled()) { ::sd::GraphicDocShell::Factory().SetDocumentServiceName( u"com.sun.star.drawing.DrawingDocument"_ustr ); } diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index ea2b09e3f285..44d075df36d0 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -479,7 +479,7 @@ SfxFrame* SdModule::CreateFromTemplate(const OUString& rTemplatePath, const Refe SfxFrame* SdModule::ExecuteNewDocument( SfxRequest const & rReq ) { SfxFrame* pFrame = nullptr; - if ( SvtModuleOptions().IsImpress() ) + if (SvtModuleOptions().IsImpressInstalled()) { Reference< XFrame > xTargetFrame; const SfxUnoFrameItem* pFrmItem = rReq.GetArg(SID_FILLFRAME); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 3e8ad0a7c922..753c34b01e4e 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1287,16 +1287,16 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) // are the modules available? - if (!SvtModuleOptions().IsCalc()) + if (!SvtModuleOptions().IsCalcInstalled()) { // remove menu entry if module is not available rSet.Put( SfxVisibilityItem( SID_ATTR_TABLE, false ) ); } - if (!SvtModuleOptions().IsChart()) + if (!SvtModuleOptions().IsChartInstalled()) { rSet.DisableItem( SID_INSERT_DIAGRAM ); } - if (!SvtModuleOptions().IsMath()) + if (!SvtModuleOptions().IsMathInstalled()) { rSet.DisableItem( SID_INSERT_MATH ); } diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 0e0b52c5dd0b..3c2e70b37184 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -707,7 +707,7 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb) if( aName == "StarChart" || aName == "StarOrg" ) { - if( SvtModuleOptions().IsChart() ) + if( SvtModuleOptions().IsChartInstalled() ) { aClass = SvGlobalName( SO3_SCH_CLASSID ); bChangeDefaultsForChart = true; @@ -715,12 +715,12 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb) } else if( aName == "StarCalc" ) { - if( SvtModuleOptions().IsCalc() ) + if( SvtModuleOptions().IsCalcInstalled() ) aClass = SvGlobalName( SO3_SC_CLASSID ); } else if( aName == "StarMath" ) { - if( SvtModuleOptions().IsMath() ) + if( SvtModuleOptions().IsMathInstalled() ) aClass = SvGlobalName( SO3_SM_CLASSID ); } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index ef91f54e70e0..cc65220c8fb5 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1319,7 +1319,7 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) switch(nWhich) { case SID_TEMPLATE_ADDRESSBOOKSOURCE: - if ( !SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DATABASE) ) + if (!SvtModuleOptions().IsDataBaseInstalled()) rSet.Put(SfxVisibilityItem(nWhich, false)); break; case SID_QUITAPP: @@ -1930,8 +1930,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) case SID_NEWSD : { - SvtModuleOptions aModuleOpt; - if ( !aModuleOpt.IsImpress() ) + if (!SvtModuleOptions().IsImpressInstalled()) { std::unique_ptr xBox(Application::CreateMessageDialog(rReq.GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, @@ -1999,9 +1998,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) void SfxApplication::OfaState_Impl(SfxItemSet &rSet) { - SvtModuleOptions aModuleOpt; - - if( !aModuleOpt.IsWriter()) + if (!SvtModuleOptions().IsWriterInstalled()) { rSet.DisableItem( FN_LABEL ); rSet.DisableItem( FN_BUSINESS_CARD ); diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index f64023d2e18c..13793dd6e9df 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -358,21 +358,21 @@ static OUString getDefaultModule_Impl() { OUString sDefaultModule; SvtModuleOptions aModOpt; - if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (aModOpt.IsWriterInstalled()) sDefaultModule = "swriter"; - else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + else if (aModOpt.IsCalcInstalled()) sDefaultModule = "scalc"; - else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + else if (aModOpt.IsImpressInstalled()) sDefaultModule = "simpress"; - else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ) + else if (aModOpt.IsDrawInstalled()) sDefaultModule = "sdraw"; - else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) ) + else if (aModOpt.IsMathInstalled()) sDefaultModule = "smath"; - else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::CHART ) ) + else if (aModOpt.IsChartInstalled()) sDefaultModule = "schart"; - else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::BASIC ) ) + else if (SvtModuleOptions::IsBasicIDEInstalled()) sDefaultModule = "sbasic"; - else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + else if (aModOpt.IsDataBaseInstalled()) sDefaultModule = "sdatabase"; else { diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index b16a0abce44a..41783bea9950 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -291,22 +291,22 @@ void BackingWindow::initControls() // collect the URLs of the entries in the File/New menu SvtModuleOptions aModuleOptions; - if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::WRITER)) + if (aModuleOptions.IsWriterInstalled()) mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_WRITER; - if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::CALC)) + if (aModuleOptions.IsCalcInstalled()) mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_CALC; - if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::IMPRESS)) + if (aModuleOptions.IsImpressInstalled()) mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_IMPRESS; - if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::DRAW)) + if (aModuleOptions.IsDrawInstalled()) mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_DRAW; - if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::DATABASE)) + if (aModuleOptions.IsDataBaseInstalled()) mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_DATABASE; - if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::MATH)) + if (aModuleOptions.IsMathInstalled()) mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_MATH; mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_OTHER; @@ -433,12 +433,12 @@ void BackingWindow::checkInstalledModules() { SvtModuleOptions aModuleOpt; - mxWriterAllButton->set_sensitive( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER )); - mxCalcAllButton->set_sensitive( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ); - mxImpressAllButton->set_sensitive( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ); - mxDrawAllButton->set_sensitive( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ); - mxMathAllButton->set_sensitive(aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH )); - mxDBAllButton->set_sensitive(aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE )); + mxWriterAllButton->set_sensitive(aModuleOpt.IsWriterInstalled()); + mxCalcAllButton->set_sensitive(aModuleOpt.IsCalcInstalled()); + mxImpressAllButton->set_sensitive(aModuleOpt.IsImpressInstalled()); + mxDrawAllButton->set_sensitive(aModuleOpt.IsDrawInstalled()); + mxMathAllButton->set_sensitive(aModuleOpt.IsMathInstalled()); + mxDBAllButton->set_sensitive(aModuleOpt.IsDataBaseInstalled()); } bool BackingWindow::PreNotify(NotifyEvent& rNEvt) diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 42a27a66106d..25a541691921 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -817,7 +817,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_AUTOREDACTDOC: { // Actual redaction takes place on a newly generated Draw document - if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DRAW)) + if (!SvtModuleOptions().IsDrawInstalled()) { std::unique_ptr xBox(Application::CreateMessageDialog( pDialogParent, VclMessageType::Warning, VclButtonsType::Ok, @@ -853,7 +853,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) uno::Reference< lang::XComponent > xSourceDoc( xModel ); // Actual redaction takes place on a newly generated Draw document - if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DRAW)) + if (!SvtModuleOptions().IsDrawInstalled()) { std::unique_ptr xBox(Application::CreateMessageDialog( pDialogParent, VclMessageType::Warning, VclButtonsType::Ok, diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 57493759b16c..e65dfa88f2db 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -911,10 +911,10 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(std::u16string_view sCatego // add filters of modules which are installed SvtModuleOptions aModuleOpt; - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) ) + if (aModuleOpt.IsWriterInstalled()) sFilterExt += "*.ott;*.stw;*.oth;*.dotx;*.dot"; - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) ) + if (aModuleOpt.IsCalcInstalled()) { if ( !sFilterExt.isEmpty() ) sFilterExt += ";"; @@ -922,7 +922,7 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(std::u16string_view sCatego sFilterExt += "*.ots;*.stc;*.xltx;*.xlt"; } - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) ) + if (aModuleOpt.IsImpressInstalled()) { if ( !sFilterExt.isEmpty() ) sFilterExt += ";"; @@ -930,7 +930,7 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(std::u16string_view sCatego sFilterExt += "*.otp;*.sti;*.pot;*.potx"; } - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) ) + if (aModuleOpt.IsDrawInstalled()) { if ( !sFilterExt.isEmpty() ) sFilterExt += ";"; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 99826bb65af9..8df6931536de 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3513,7 +3513,7 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) const SfxBoolItem* pShowItem = rReq.GetArg(nSID); if ( nSID == SID_VIEW_DATA_SOURCE_BROWSER ) { - if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DATABASE)) + if (!SvtModuleOptions().IsDataBaseInstalled()) return; Reference < XFrame > xFrame = GetFrame().GetFrameInterface(); Reference < XFrame > xBeamer( xFrame->findFrame( u"_beamer"_ustr, FrameSearchFlag::CHILDREN ) ); diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 2cedf38ba9b1..d88eb91fb3ec 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -797,7 +797,7 @@ void FmFormShell::GetState(SfxItemSet &rSet) break; case SID_FM_USE_WIZARDS: - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + if (!SvtModuleOptions().IsDataBaseInstalled()) rSet.Put( SfxVisibilityItem( nWhich, false ) ); else if (!GetFormModel()) rSet.DisableItem( nWhich ); @@ -819,7 +819,7 @@ void FmFormShell::GetState(SfxItemSet &rSet) case SID_FM_NAVIGATIONBAR: case SID_FM_DBGRID: - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + if (!SvtModuleOptions().IsDataBaseInstalled()) { rSet.Put( SfxVisibilityItem( nWhich, false ) ); break; diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 204bc81fef44..9f639657f385 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -992,7 +992,7 @@ void FmXFormView::onCreatedFormObject( FmFormObj const & _rFormObject ) // #i46898# no wizards if there is no Base installed - currently, all wizards are // database related - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + if (!SvtModuleOptions().IsDataBaseInstalled()) return; if ( m_nControlWizardEvent ) diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx index 9afe8ddca42e..ac857a806b55 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -34,7 +34,7 @@ using namespace ::com::sun::star; static bool IsDocShellRegistered() { - return SvtModuleOptions().IsWriter(); + return SvtModuleOptions().IsWriterInstalled(); } SwIoDetect aFilterDetect[] = diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 85e5a8dd9525..88cef06127e7 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -497,8 +497,7 @@ SwDoc* Reader::GetTemplateDoc(SwDoc& rDoc) // we cannot create a SwDocShell. We could create a // SwWebDocShell however, because this exists always // for the help. - SvtModuleOptions aModuleOptions; - if (aModuleOptions.IsWriter()) + if (SvtModuleOptions().IsWriterInstalled()) { rtl::Reference pDocSh = new SwDocShell(SfxObjectCreateMode::INTERNAL); SfxObjectShellLock xDocSh = pDocSh.get(); diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 63a2c8f08a9e..0e4545a83027 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -1040,11 +1040,8 @@ void SwDocShell::GetState(SfxItemSet& rSet) case FN_ABSTRACT_STARIMPRESS: case FN_OUTLINE_TO_IMPRESS: - { - SvtModuleOptions aMOpt; - if (!aMOpt.IsImpress() || GetObjectShell()->isExportLocked()) - rSet.DisableItem( nWhich ); - } + if (!SvtModuleOptions().IsImpressInstalled() || GetObjectShell()->isExportLocked()) + rSet.DisableItem(nWhich); [[fallthrough]]; case FN_ABSTRACT_NEWDOC: case FN_OUTLINE_TO_CLIPBOARD: diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx index ec258cac6dd6..89f7b0b6cd71 100644 --- a/sw/source/uibase/app/swdll.cxx +++ b/sw/source/uibase/app/swdll.cxx @@ -86,12 +86,12 @@ SwDLL::SwDLL() if ( SfxApplication::GetModule(SfxToolsModule::Writer) ) // Module already active return; - std::unique_ptr xOpt; + std::optional oOpt; if (!comphelper::IsFuzzing()) - xOpt.reset(new SvtModuleOptions); + oOpt.emplace(); SfxObjectFactory* pDocFact = nullptr; SfxObjectFactory* pGlobDocFact = nullptr; - if (!xOpt || xOpt->IsWriter()) + if (!oOpt || oOpt->IsWriterInstalled()) { pDocFact = &SwDocShell::Factory(); pGlobDocFact = &SwGlobalDocShell::Factory(); @@ -105,7 +105,7 @@ SwDLL::SwDLL() pWDocFact->SetDocumentServiceName(u"com.sun.star.text.WebDocument"_ustr); - if (!xOpt || xOpt->IsWriter()) + if (!oOpt || oOpt->IsWriterInstalled()) { pGlobDocFact->SetDocumentServiceName(u"com.sun.star.text.GlobalDocument"_ustr); pDocFact->SetDocumentServiceName(u"com.sun.star.text.TextDocument"_ustr); diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 001f9fe25fe8..737fe747a112 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -212,13 +212,14 @@ void SwDLL::RegisterFactories() { // These Id's must not be changed. Through these Id's the View (resume Documentview) // is created by Sfx. - if (comphelper::IsFuzzing() || SvtModuleOptions().IsWriter()) + SvtModuleOptions aOptions; + if (comphelper::IsFuzzing() || aOptions.IsWriterInstalled()) SwView::RegisterFactory ( SFX_INTERFACE_SFXDOCSH ); #if HAVE_FEATURE_DESKTOP SwWebView::RegisterFactory ( SFX_INTERFACE_SFXMODULE ); - if (comphelper::IsFuzzing() || SvtModuleOptions().IsWriter()) + if (comphelper::IsFuzzing() || aOptions.IsWriterInstalled()) { SwSrcView::RegisterFactory ( SfxInterfaceId(6) ); SwPagePreview::RegisterFactory ( SfxInterfaceId(7) ); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 97589cd2c7b6..581e494cb3c7 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -1466,7 +1466,7 @@ void SwTableShell::GetState(SfxItemSet &rSet) case SID_INSERT_DIAGRAM: { SvtModuleOptions aMOpt; - if ( !aMOpt.IsMath() || rSh.IsTableComplexForChart() ) + if ( !aMOpt.IsMathInstalled() || rSh.IsTableComplexForChart() ) rSet.DisableItem(nSlot); } break; diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 4696335884aa..dfd5591b6e46 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -373,8 +373,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) break; case SID_INSERT_DIAGRAM: { - SvtModuleOptions aMOpt; - if ( !aMOpt.IsChart() ) + if (!SvtModuleOptions().IsChartInstalled()) break; if(!rReq.IsAPI()) { @@ -621,7 +620,6 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) SfxWhichIter aIter( rSet ); SwWrtShell &rSh = GetShell(); sal_uInt16 nWhich = aIter.FirstWhich(); - SvtModuleOptions aMOpt; SfxObjectCreateMode eCreateMode = GetView().GetDocShell()->GetCreateMode(); const bool bCursorInHidden = rSh.IsInHiddenRange(/*bSelect=*/false); @@ -641,7 +639,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) break; case SID_INSERT_DIAGRAM: - if( !aMOpt.IsChart() + if (!SvtModuleOptions().IsChartInstalled() || GetShell().CursorInsideInputField() || eCreateMode == SfxObjectCreateMode::EMBEDDED || bCursorInHidden ) @@ -651,7 +649,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) break; case FN_INSERT_SMA: - if( !aMOpt.IsMath() + if (!SvtModuleOptions().IsMathInstalled() || eCreateMode == SfxObjectCreateMode::EMBEDDED || bCursorInHidden || rSh.CursorInsideInputField() ) diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index fcf35ac29f4d..0a0e21a28e68 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -72,7 +72,7 @@ using namespace ::com::sun::star; SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default") { - if (comphelper::IsFuzzing() || SvtModuleOptions().IsWriter()) + if (comphelper::IsFuzzing() || SvtModuleOptions().IsWriterInstalled()) { SFX_VIEW_REGISTRATION(SwDocShell); SFX_VIEW_REGISTRATION(SwGlobalDocShell); diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 45267fc42651..d1e3f102f967 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -513,7 +513,7 @@ void SwView::GetState(SfxItemSet &rSet) rSet.DisableItem(nWhich); break; case SID_VIEW_DATA_SOURCE_BROWSER: - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ) + if (!SvtModuleOptions().IsDataBaseInstalled()) rSet.Put( SfxVisibilityItem( nWhich, false ) ); else rSet.Put( SfxBoolItem( nWhich, GetViewFrame().HasChildWindow( SID_BROWSER ) ) ); diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 4ffb97839100..ed1ef95e8dbd 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -875,48 +875,6 @@ void SvtModuleOptions::SetFactoryDefaultFilter( EFactory eFactory, m_pImpl->SetFactoryDefaultFilter( eFactory, sFilter ); } -bool SvtModuleOptions::IsMath() const -{ - // doesn't need mutex, never modified - return m_pImpl->IsModuleInstalled( EModule::MATH ); -} - -bool SvtModuleOptions::IsChart() const -{ - // doesn't need mutex, never modified - return m_pImpl->IsModuleInstalled( EModule::CHART ); -} - -bool SvtModuleOptions::IsCalc() const -{ - // doesn't need mutex, never modified - return m_pImpl->IsModuleInstalled( EModule::CALC ); -} - -bool SvtModuleOptions::IsDraw() const -{ - // doesn't need mutex, never modified - return m_pImpl->IsModuleInstalled( EModule::DRAW ); -} - -bool SvtModuleOptions::IsWriter() const -{ - std::unique_lock aGuard( impl_GetOwnStaticMutex() ); - return m_pImpl->IsModuleInstalled( EModule::WRITER ); -} - -bool SvtModuleOptions::IsImpress() const -{ - // doesn't need mutex, never modified - return m_pImpl->IsModuleInstalled( EModule::IMPRESS ); -} - -bool SvtModuleOptions::IsDataBase() const -{ - // doesn't need mutex, never modified - return m_pImpl->IsModuleInstalled( EModule::DATABASE ); -} - OUString SvtModuleOptions::GetModuleName( EModule eModule ) const { switch( eModule ) From 16a5ae7c90a3349854fb3975b435c24f08c0a51c Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 06:48:38 +0100 Subject: [PATCH 142/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Iac23bad883f54bd980d051fe74474efdcd2572a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177063 Reviewed-by: Julien Nabet Tested-by: Jenkins --- include/rtl/textcvt.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/rtl/textcvt.h b/include/rtl/textcvt.h index 14d374c16f6d..277c0f846435 100644 --- a/include/rtl/textcvt.h +++ b/include/rtl/textcvt.h @@ -89,7 +89,6 @@ SAL_DLLPUBLIC void SAL_CALL rtl_resetTextToUnicodeContext( rtl_TextToUnicodeConv #define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL ((sal_uInt32)0x0002) #define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL ((sal_uInt32)0x0002) // Misspelled constant, kept for backwards compatibility: -#define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ((sal_uInt32)0x0004) #define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL ((sal_uInt32)0x0004) #define RTL_TEXTTOUNICODE_INFO_UNDEFINED ((sal_uInt32)0x0008) #define RTL_TEXTTOUNICODE_INFO_MBUNDEFINED ((sal_uInt32)0x0010) From aee4e184119512dc407d8a3696653b57d3d9a54f Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 06:52:09 +0100 Subject: [PATCH 143/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I7206e5ac7f525d810505230ef4dcdaa5fff3fbf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177065 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/sal/config.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/sal/config.h b/include/sal/config.h index f666fed23897..4bf1f6c00225 100644 --- a/include/sal/config.h +++ b/include/sal/config.h @@ -29,7 +29,6 @@ #endif #ifdef _WIN32 -#define SAL_W32 #define SAL_DLLEXTENSION ".dll" #define SAL_EXEEXTENSION ".exe" #define SAL_PATHSEPARATOR ';' From a3ad37edf25efa8d9039abdcc08401ca08882b4d Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 08:03:25 +0100 Subject: [PATCH 144/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I171b90858f58c4afa8984f55864712e8b7a93b2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177088 Reviewed-by: Julien Nabet Tested-by: Jenkins --- include/svtools/htmlcfg.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/svtools/htmlcfg.hxx b/include/svtools/htmlcfg.hxx index 259c7e965887..d907ef8dc671 100644 --- a/include/svtools/htmlcfg.hxx +++ b/include/svtools/htmlcfg.hxx @@ -20,8 +20,6 @@ #include -#define HTML_FONT_COUNT 7 - // !!!be aware!!!: the following defines are _not_ used as values in the configuration file // this is because of compatibility reasons #define HTML_CFG_MSIE 0 // Internet Explorer From 6e828489da09ce4bf96e255e496510d37833f33e Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 23 Nov 2024 11:02:07 +0500 Subject: [PATCH 145/373] tdf#162195: use SwFrame::IsHiddenNow when building index Before commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1 (tdf#159565 prerequisite: make hidden sections have zero-height frames, 2024-02-15), the hidden sections were absent from layout, so didn't appear in the SwTOXBaseSection::Update* functions. Now they are zero-height, but present, so their visibility must be taken into account explicitly. Change-Id: I95cc72b383a99e1f65152579c5458e253a3f60ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177079 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- .../data/IndexElementsInHiddenSections.fodt | 63 +++++++++++++++ sw/qa/extras/uiwriter/uiwriter9.cxx | 43 ++++++++++ sw/source/core/doc/doctxm.cxx | 79 ++++++++++++------- sw/source/core/tox/tox.cxx | 3 + 4 files changed, 158 insertions(+), 30 deletions(-) create mode 100644 sw/qa/extras/uiwriter/data/IndexElementsInHiddenSections.fodt diff --git a/sw/qa/extras/uiwriter/data/IndexElementsInHiddenSections.fodt b/sw/qa/extras/uiwriter/data/IndexElementsInHiddenSections.fodt new file mode 100644 index 000000000000..5fb3d809404f --- /dev/null +++ b/sw/qa/extras/uiwriter/data/IndexElementsInHiddenSections.fodt @@ -0,0 +1,63 @@ + + + + + + + + + + + Table of Contents + + + + + + + + + + + + + + + Section Visible + foo + + + + + + + + + Section Hidden + bar + + A level-1 entry + + CustomTOCStyle paragraph + + + + + + + + + + Index of Tables + + + + + + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 2be321ebb14d..2de82268ae84 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -852,6 +852,49 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159023) CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162195) +{ + // Given a document, which has some index entries in a hidden section + createSwDoc("IndexElementsInHiddenSections.fodt"); + + auto xIndexSupplier(mxComponent.queryThrow()); + auto xIndexes = xIndexSupplier->getDocumentIndexes(); + CPPUNIT_ASSERT(xIndexes); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexes->getCount()); // A ToC and a table index + + auto xToC(xIndexes->getByIndex(0).queryThrow()); + xToC->update(); + // Without the fix, all the elements from the hidden section appeared in the index + CPPUNIT_ASSERT_EQUAL(u"Table of Contents" SAL_NEWLINE_STRING "Section Visible\t1"_ustr, + xToC->getAnchor()->getString()); + + auto xTables(xIndexes->getByIndex(1).queryThrow()); + xTables->update(); + // Without the fix, all the elements from the hidden section appeared in the index + CPPUNIT_ASSERT_EQUAL(u"Index of Tables" SAL_NEWLINE_STRING "Table1\t1"_ustr, + xTables->getAnchor()->getString()); + + // Show the hidden section + auto xTextSectionsSupplier = mxComponent.queryThrow(); + auto xSections = xTextSectionsSupplier->getTextSections(); + CPPUNIT_ASSERT(xSections); + auto xSection + = xSections->getByName(u"Section Hidden"_ustr).queryThrow(); + xSection->setPropertyValue(u"IsVisible"_ustr, css::uno::Any(true)); + + xToC->update(); + CPPUNIT_ASSERT_EQUAL(u"Table of Contents" SAL_NEWLINE_STRING + "Section Visible\t1" SAL_NEWLINE_STRING + "Section Hidden\t1" SAL_NEWLINE_STRING "entry\t1" SAL_NEWLINE_STRING + "CustomTOCStyle paragraph\t1"_ustr, + xToC->getAnchor()->getString()); + + xTables->update(); + CPPUNIT_ASSERT_EQUAL(u"Index of Tables" SAL_NEWLINE_STRING "Table1\t1" SAL_NEWLINE_STRING + "Table2\t1"_ustr, + xTables->getAnchor()->getString()); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 48762a68203d..6a523914dc43 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1375,6 +1375,48 @@ void SwTOXBaseSection::UpdateMarks(const SwTOXInternational& rIntl, } } +static SwContentFrame* useContentNodeForIndex(const SwContentNode* node, bool fromChapter, + const SwTextNode* chapter, const SwRootFrame* layout) +{ + if (!node) + return nullptr; + if (!node->HasWriterListeners()) + return nullptr; + if (!node->GetNodes().IsDocNodes()) + return nullptr; + if (layout && layout->HasMergedParas() && node->GetRedlineMergeFlag() == SwNode::Merge::Hidden) + return nullptr; + auto pFrame = node->getLayoutFrame(layout); + if (!pFrame) + return nullptr; + if (fromChapter && !IsHeadingContained(chapter, *node)) + return nullptr; + if (pFrame->IsHiddenNow()) + return nullptr; + + return pFrame; +} + +static bool useTextNodeForIndex(const SwTextNode* node, int maxLevel, bool fromChapter, + const SwTextNode* chapter, const SwRootFrame* layout) +{ + auto pTextFrame = static_cast(useContentNodeForIndex(node, fromChapter, chapter, layout)); + if (!pTextFrame) + return false; + if (node->Len() == 0) + return false; + if (maxLevel >= 0 && node->GetAttrOutlineLevel() > maxLevel) + return false; + if (node->IsHiddenByParaField()) + return false; + if (node->HasHiddenCharAttribute(true)) + return false; + if (layout && layout->HasMergedParas() && pTextFrame->GetTextNodeForParaProps() != node) + return false; + + return true; +} + /// Generate table of contents from outline void SwTOXBaseSection::UpdateOutline( const SwTextNode* pOwnChapterNode, SwRootFrame const*const pLayout) @@ -1387,14 +1429,7 @@ void SwTOXBaseSection::UpdateOutline( const SwTextNode* pOwnChapterNode, { ::SetProgressState( 0, pDoc->GetDocShell() ); SwTextNode* pTextNd = pOutlineNode->GetTextNode(); - if( pTextNd && pTextNd->Len() && pTextNd->HasWriterListeners() && - o3tl::make_unsigned( pTextNd->GetAttrOutlineLevel()) <= GetLevel() && - pTextNd->getLayoutFrame(pLayout) && - !pTextNd->IsHiddenByParaField() && - !pTextNd->HasHiddenCharAttribute( true ) && - (!pLayout || !pLayout->HasMergedParas() - || static_cast(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps() == pTextNd) && - ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pTextNd) )) + if (useTextNodeForIndex(pTextNd, GetLevel(), IsFromChapter(), pOwnChapterNode, pLayout)) { InsertSorted(MakeSwTOXSortTabBase(pLayout, *pTextNd, SwTOXElement::OutlineLevel)); } @@ -1405,6 +1440,7 @@ void SwTOXBaseSection::UpdateOutline( const SwTextNode* pOwnChapterNode, void SwTOXBaseSection::UpdateTemplate(const SwTextNode* pOwnChapterNode, SwRootFrame const*const pLayout) { + int nMaxLevel = SwTOXBase::GetType() == TOX_CONTENT ? GetLevel() : -1; SwDoc* pDoc = GetFormat()->GetDoc(); for(sal_uInt16 i = 0; i < MAXLEVEL; i++) { @@ -1429,15 +1465,7 @@ void SwTOXBaseSection::UpdateTemplate(const SwTextNode* pOwnChapterNode, { ::SetProgressState( 0, pDoc->GetDocShell() ); - if (pTextNd->GetText().getLength() && - pTextNd->getLayoutFrame(pLayout) && - pTextNd->GetNodes().IsDocNodes() && - // tdf#40142 - consider level settings of the various text nodes - (TOX_CONTENT != SwTOXBase::GetType() || - o3tl::make_unsigned(pTextNd->GetAttrOutlineLevel()) <= GetLevel()) && - (!pLayout || !pLayout->HasMergedParas() - || static_cast(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps() == pTextNd) && - (!IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pTextNd))) + if (useTextNodeForIndex(pTextNd, nMaxLevel, IsFromChapter(), pOwnChapterNode, pLayout)) { InsertSorted(MakeSwTOXSortTabBase(pLayout, *pTextNd, SwTOXElement::Template, i + 1)); } @@ -1463,9 +1491,7 @@ void SwTOXBaseSection::UpdateSequence(const SwTextNode* pOwnChapterNode, SwTextNode& rTextNode = pTextField->GetTextNode(); ::SetProgressState( 0, pDoc->GetDocShell() ); - if (rTextNode.GetText().getLength() && - rTextNode.getLayoutFrame(pLayout) && - ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, rTextNode)) + if (useTextNodeForIndex(&rTextNode, -1, IsFromChapter(), pOwnChapterNode, pLayout) && (!pLayout || !pLayout->IsHideRedlines() || !sw::IsFieldDeletedInModel(pDoc->getIDocumentRedlineAccess(), *pTextField))) { @@ -1506,8 +1532,7 @@ void SwTOXBaseSection::UpdateAuthorities(const SwTOXInternational& rIntl, const SwTextNode& rTextNode = pFormatField->GetTextField()->GetTextNode(); ::SetProgressState( 0, pDoc->GetDocShell() ); - if (rTextNode.GetText().getLength() && - rTextNode.getLayoutFrame(pLayout) && + if (useTextNodeForIndex(&rTextNode, -1, false, nullptr, pLayout) && (!pLayout || !pLayout->IsHideRedlines() || !sw::IsFieldDeletedInModel(pDoc->getIDocumentRedlineAccess(), *pTextField))) { @@ -1655,10 +1680,7 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType, } } - if (pCNd->getLayoutFrame(pLayout) - && (!pLayout || !pLayout->HasMergedParas() - || pCNd->GetRedlineMergeFlag() != SwNode::Merge::Hidden) - && ( !IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pCNd))) + if (useContentNodeForIndex(pCNd, IsFromChapter(), pOwnChapterNode, pLayout)) { std::unique_ptr pNew( MakeSwTOXSortTabBase( pLayout, *pCNd, eMyType, @@ -1695,10 +1717,7 @@ void SwTOXBaseSection::UpdateTable(const SwTextNode* pOwnChapterNode, while( nullptr != ( pCNd = SwNodes::GoNext( &aContentIdx ) ) && aContentIdx.GetIndex() < pTableNd->EndOfSectionIndex() ) { - if (pCNd->getLayoutFrame(pLayout) - && (!pLayout || !pLayout->HasMergedParas() - || pCNd->GetRedlineMergeFlag() != SwNode::Merge::Hidden) - && (!IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pCNd))) + if (useContentNodeForIndex(pCNd, IsFromChapter(), pOwnChapterNode, pLayout)) { std::unique_ptr pNew(new SwTOXTable( *pCNd )); if( IsLevelFromChapter() && TOX_TABLES != SwTOXBase::GetType()) diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index 0c5818ee9cd3..9f1d5c90312e 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -197,6 +197,9 @@ void SwTOXMark::Notify(const SfxHint& rHint) // Check for being hidden by hidden redlines if (pLayout && pLayout->HasMergedParas() && sw::IsMarkHintHidden(*pLayout, rNode, rTextMark)) return; + // Check for being hidden by hidden sections + if (auto pFrame(rNode.getLayoutFrame(pLayout)); !pFrame || pFrame->IsHiddenNow()) + return; pCollectLayoutHint->m_rMarks.push_back(rTextMark); } } From 929875a43179c0ef136bab7bf86024f9348f8488 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 05:59:49 +0100 Subject: [PATCH 146/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I23379077766af9c04357bd098b132a03a9b35877 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177061 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/filter/msfilter/svdfppt.hxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index 5c77580e4507..e92ef0a13c25 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -175,9 +175,6 @@ enum class TSS_Type : unsigned { const int nMaxPPTLevels = 10; -// Object IDs for StarDraw UserData -#define PPT_OBJECTINFO_ID (1) - struct MSFILTER_DLLPUBLIC PptDocumentAtom { Size aSlidesPageSize; // page size of the slides in 576DPI From d784c1a5ec9f80e94895ef1726450d06364f195c Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Thu, 21 Nov 2024 19:56:47 +0100 Subject: [PATCH 147/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Ifbdf8e07aa8085e465df45b48fe54345f0ad56e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176961 Tested-by: Jenkins Reviewed-by: Julien Nabet --- cui/source/inc/helpids.h | 1 - 1 file changed, 1 deletion(-) diff --git a/cui/source/inc/helpids.h b/cui/source/inc/helpids.h index 8f9af7fd9570..44e7a862df73 100644 --- a/cui/source/inc/helpids.h +++ b/cui/source/inc/helpids.h @@ -24,7 +24,6 @@ inline constexpr OUString HID_OPTIONS_COLORCONFIG_SAVE_SCHEME = u"CUI_HID_OPTIONS_COLORCONFIG_SAVE_SCHEME"_ustr; inline constexpr OUString HID_OFA_FONT_SUBST_CLB = u"CUI_HID_OFA_FONT_SUBST_CLB"_ustr; inline constexpr OUString HID_DBPATH_CTL_PATH = u"CUI_HID_DBPATH_CTL_PATH"_ustr; -#define HID_DBPATH_HEADERBAR "CUI_HID_DBPATH_HEADERBAR" inline constexpr OUString HID_OFADLG_TREELISTBOX = u"CUI_HID_OFADLG_TREELISTBOX"_ustr; inline constexpr OUString HID_SVX_CONFIG_TOOLBAR = u"CUI_HID_SVX_CONFIG_TOOLBAR"_ustr; inline constexpr OUString HID_SVX_CONFIG_TOOLBAR_CONTENTS From 4ece715160515af7b10980f8f94acddc2e92ed06 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 06:59:03 +0100 Subject: [PATCH 148/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Ic07d9b5e5ed5c486f2fefbd535b4209a1a62eae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177066 Reviewed-by: Julien Nabet Tested-by: Julien Nabet --- include/sfx2/sfxsids.hrc | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 411a00782c02..6dbd397f8922 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -190,9 +190,6 @@ class SvxZoomItem; #define SID_FILTER_DATA TypedWhichId(SID_SFX_START + 1375) -#define SID_EXPLORER_FILEPROPS_START (SID_SFX_START + 1390) -// SID_EXPLORER_FILEPROPS_END (SID_SFX_START + 1399) - #define SID_ATTR_ZOOM TypedWhichId(SID_SVX_START + 0) #define SID_EXPLORER_PROPS_START TypedWhichId(SID_SFX_START + 1410) From 061b9dc1f5f6d31abcce192663bf6a101237fdcf Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Thu, 21 Nov 2024 20:24:22 +0100 Subject: [PATCH 149/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Iae168766fdfcbf4c68aa0770b0c42e96a61001c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176964 Tested-by: Jenkins Reviewed-by: Julien Nabet --- editeng/inc/editeng.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/editeng/inc/editeng.hxx b/editeng/inc/editeng.hxx index 5b831efa3b5e..d7f95561eabb 100644 --- a/editeng/inc/editeng.hxx +++ b/editeng/inc/editeng.hxx @@ -19,8 +19,6 @@ #pragma once -#define MN_WORDLANGUAGE 998 -#define MN_PARALANGUAGE 999 #define MN_ALTSTART 1000 #define MN_AUTOSTART 2000 #define MN_DICTSTART 3000 From 29091962399dfae3707b1bbd981ce037c97684ec Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 23 Nov 2024 09:38:02 +0500 Subject: [PATCH 150/373] tdf#164005: make sure to initialize locales before use of Hyphenator Change-Id: I23ab742801ab00b68e4f8c5e7bc415c401e28c37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177076 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- .../source/hyphenator/hyphen/hyphenimp.cxx | 14 +++++++++----- .../source/hyphenator/hyphen/hyphenimp.hxx | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index cc35bf3aa84d..c528318dc33d 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -108,7 +108,7 @@ PropertyHelper_Hyphenation& Hyphenator::GetPropHelper_Impl() return *pPropHelper; } -Sequence< Locale > SAL_CALL Hyphenator::getLocales() +void Hyphenator::ensureLocales() { MutexGuard aGuard( GetLinguMutex() ); @@ -212,17 +212,19 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() aSuppLocales.realloc(0); } } +} +Sequence< Locale > SAL_CALL Hyphenator::getLocales() +{ + MutexGuard aGuard(GetLinguMutex()); + ensureLocales(); return aSuppLocales; } sal_Bool SAL_CALL Hyphenator::hasLocale(const Locale& rLocale) { MutexGuard aGuard( GetLinguMutex() ); - - if (!aSuppLocales.hasElements()) - getLocales(); - + ensureLocales(); return comphelper::findValue(aSuppLocales, rLocale) != -1; } @@ -658,6 +660,7 @@ Reference < XHyphenatedWord > SAL_CALL Hyphenator::queryAlternativeSpelling( sal_Int16 nIndex, const css::uno::Sequence< css::beans::PropertyValue >& aProperties ) { + ensureLocales(); // Firstly we allow only one plus character before the hyphen to avoid to miss the right break point: for (int extrachar = 1; extrachar <= 2; extrachar++) { @@ -686,6 +689,7 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const aWord, Sequence< sal_Int16 >() ); } + ensureLocales(); int k = -1; for (size_t j = 0; j < mvDicts.size(); ++j) { diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx index 45ebca112544..f60639ff2aa6 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx @@ -119,6 +119,8 @@ private: static OUString makeLowerCase(const OUString&, CharClass const *); static OUString makeUpperCase(const OUString&, CharClass const *); static OUString makeInitCap(const OUString&, CharClass const *); + + void ensureLocales(); }; #endif From 9c14ec81b6c25c7932964382f306dadfefeda518 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 23 Nov 2024 09:52:53 +0500 Subject: [PATCH 151/373] tdf#164006: Only use original word's positions, ignore extra encoded length The encoding of the string passed to Hunspell/hyphen service depends on the encoding of the dictionary itself. When the usual UTF-8 encoding is used, the resulting octet string may be longer than the original UTF-16 code unit count. In that case, the length of the buffer receiving the positions will be longer, respectively. But on return, the buffer will only contain data in positions corresponding to the characters, not code units (it is unclear if we even need to pass buffer that large). So just as the following loop only iterates up to nWord length, the calculation of hyphen count must use its length, too, not the length of encWord. I suspect that the use of UTF-16 code units as hyphen positions is wrong; it will break in SMP surrogate pairs. The proper would be to iterate code points. However, I don't have data to test, so let it be TODO/LATER. Change-Id: Ieed5e696e03cb22e3b48fabc14537372bbe74363 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177077 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index c528318dc33d..46071a987f5c 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -785,7 +785,8 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const sal_Int32 nHyphCount = 0; - for ( sal_Int32 i = 0; i < encWord.getLength(); i++) + // FIXME: shouldn't we iterate code points instead? + for (sal_Int32 i = 0; i < nWord.getLength(); i++) { if (hyphens[i]&1) nHyphCount++; From f3bacd7b2ae909d39916eb9a31dd1b4994118d8f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 22 Nov 2024 23:39:27 +0100 Subject: [PATCH 152/373] tdf#130857 qt weld: Implement QtInstanceDialog::weld_content_area When this method gets called the first time, insert a widget with a QVBoxLayout at the beginning of the dialog's layout, remember and return that. On subsequent call, return the same one. Initially, handle the case where the dialog's layout is a QBoxLayout (subclass), which is the case for the "File" -> "Printer Settings" -> "Options" dialog in Writer. This should be easy to extend for other layouts as well when needed. For now, assert when another layout is used, so it will become clear when working on adding support for another dialog that needs this. Change-Id: Ia41a87f8cf62666efc91c05f25dae5fccb3da41d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177054 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/inc/qt5/QtInstanceDialog.hxx | 1 + vcl/qt5/QtInstanceDialog.cxx | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/vcl/inc/qt5/QtInstanceDialog.hxx b/vcl/inc/qt5/QtInstanceDialog.hxx index e47849cc9bd7..5c8a6d0981ab 100644 --- a/vcl/inc/qt5/QtInstanceDialog.hxx +++ b/vcl/inc/qt5/QtInstanceDialog.hxx @@ -18,6 +18,7 @@ class QtInstanceDialog : public QtInstanceWindow, public virtual weld::Dialog Q_OBJECT std::unique_ptr m_pDialog; + QWidget* m_pContentArea; // the DialogController/Dialog/function passed to the runAsync variants std::shared_ptr m_xRunAsyncDialogController; diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx index 7a4ca77ad70f..c1be1db313c0 100644 --- a/vcl/qt5/QtInstanceDialog.cxx +++ b/vcl/qt5/QtInstanceDialog.cxx @@ -19,6 +19,7 @@ const char* const QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE = "response-code" QtInstanceDialog::QtInstanceDialog(QDialog* pDialog) : QtInstanceWindow(pDialog) , m_pDialog(pDialog) + , m_pContentArea(nullptr) , m_aRunAsyncFunc(nullptr) { } @@ -148,8 +149,22 @@ void QtInstanceDialog::set_default_response(int) { assert(false && "Not implemen std::unique_ptr QtInstanceDialog::weld_content_area() { - assert(false && "Not implemented yet"); - return nullptr; + if (!m_pContentArea) + { + if (QBoxLayout* pBoxLayout = qobject_cast(m_pDialog->layout())) + { + // insert an extra widget and layout at beginning of the dialog's layout + m_pContentArea = new QWidget; + m_pContentArea->setLayout(new QVBoxLayout); + pBoxLayout->insertWidget(0, m_pContentArea); + } + else + { + assert(false && "Dialog has layout that's not supported (yet)"); + } + } + + return std::make_unique(m_pContentArea); } void QtInstanceDialog::dialogFinished(int nResult) From f928b97cfa9ab335a6be75bd993f335cfd666673 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 23 Nov 2024 00:16:53 +0100 Subject: [PATCH 153/373] tdf#130857 qt weld: Handle invalid ID in QtInstanceNotebook::get_page If QtInstanceNotebook::get_page gets called with and ID that none of the existing pages actually have, return nullptr early and don't try to QtInstanceContainer instance for the null widget, which would trigger an assert when nullptr is passed to the QtInstanceWidget base class ctor. Calling QtInstanceNotebook::get_page with an ID for which no page exists yet is what SfxTabDialogController::AddTabPage does explicitly before asserting a page to assert that there isn't such a page yet. SalInstanceNotebook::get_page and GtkInstanceNotebook also have specific handling for that case. Change-Id: Ib2044fd4c9f986f2252afed5754a6383f940e5e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177055 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/qt5/QtInstanceNotebook.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vcl/qt5/QtInstanceNotebook.cxx b/vcl/qt5/QtInstanceNotebook.cxx index 6c28ce5c87e4..c8da18d5f5d6 100644 --- a/vcl/qt5/QtInstanceNotebook.cxx +++ b/vcl/qt5/QtInstanceNotebook.cxx @@ -155,6 +155,9 @@ weld::Container* QtInstanceNotebook::get_page(const OUString& rIdent) const pWidget = m_pTabWidget->widget(nIndex); }); + if (!pWidget) + return nullptr; + if (!m_aPageContainerInstances.contains(pWidget)) m_aPageContainerInstances.emplace(pWidget, std::make_unique(pWidget)); From 3e65d085efa2f2d2a8a51e57b752a8ffb2e7624d Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 23 Nov 2024 00:57:37 +0100 Subject: [PATCH 154/373] tdf#130857 qt weld: Call checkbox toggled handler Change-Id: I0943a2d8e35acea8e1af97bdd151bba65b0af24a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177056 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/CustomTarget_qt5_moc.mk | 1 + vcl/CustomTarget_qt6_moc.mk | 1 + vcl/inc/qt5/QtInstanceCheckButton.hxx | 6 +++++- vcl/qt5/QtInstanceCheckButton.cxx | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk index efa4fd9e16fd..a819d4008307 100644 --- a/vcl/CustomTarget_qt5_moc.mk +++ b/vcl/CustomTarget_qt5_moc.mk @@ -14,6 +14,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \ $(gb_CustomTarget_workdir)/vcl/qt5/QtFilePicker.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtFrame.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstance.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceCheckButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceComboBox.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceContainer.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDialog.moc \ diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk index 69fc48db7ae5..cb53e819835e 100644 --- a/vcl/CustomTarget_qt6_moc.mk +++ b/vcl/CustomTarget_qt6_moc.mk @@ -14,6 +14,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \ $(gb_CustomTarget_workdir)/vcl/qt6/QtFilePicker.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtFrame.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstance.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceCheckButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceComboBox.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceContainer.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDialog.moc \ diff --git a/vcl/inc/qt5/QtInstanceCheckButton.hxx b/vcl/inc/qt5/QtInstanceCheckButton.hxx index 43db65c96a72..a13c883ac310 100644 --- a/vcl/inc/qt5/QtInstanceCheckButton.hxx +++ b/vcl/inc/qt5/QtInstanceCheckButton.hxx @@ -14,8 +14,12 @@ #include #include -class QtInstanceCheckButton : public QtInstanceWidget, public virtual weld::CheckButton +class QtInstanceCheckButton : public QObject, + public QtInstanceWidget, + public virtual weld::CheckButton { + Q_OBJECT + QCheckBox* m_pCheckBox; public: diff --git a/vcl/qt5/QtInstanceCheckButton.cxx b/vcl/qt5/QtInstanceCheckButton.cxx index f4590d393444..835dcd356196 100644 --- a/vcl/qt5/QtInstanceCheckButton.cxx +++ b/vcl/qt5/QtInstanceCheckButton.cxx @@ -8,6 +8,7 @@ */ #include +#include #include @@ -16,6 +17,7 @@ QtInstanceCheckButton::QtInstanceCheckButton(QCheckBox* pCheckBox) , m_pCheckBox(pCheckBox) { assert(m_pCheckBox); + connect(m_pCheckBox, &QCheckBox::toggled, this, [&] { signal_toggled(); }); } void QtInstanceCheckButton::set_active(bool bActive) From df39550839451ab6ad9b1fd722beb56c43bd5aa3 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 23 Nov 2024 01:11:38 +0100 Subject: [PATCH 155/373] tdf#130857 qt weld: Hide widget marked for deletion Add a helper method QtBuilder::deleteObject that takes care of marking no longer needed objects for deletion and use it in the 3 places so far calling QObject::deleteLater themselves. If the object marked for deletion is a widget, hide it as well, as it could otherwise still be "in the way". This was seen wit the edit (QLineEdit) of the editable combobox in the "File" -> "Properties" dialog, "General" tab (in a WIP branch for adding support for that dialog), where the unnecessary edit was shown on top of the combobox, hiding the combobox content + dropdown button. Change-Id: Ie299b80824c94d40cfac9f7962c9bd4ba95b446d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177057 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/inc/qt5/QtBuilder.hxx | 1 + vcl/qt5/QtBuilder.cxx | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx index 6f0459d55b0d..dd31c9999c42 100644 --- a/vcl/inc/qt5/QtBuilder.hxx +++ b/vcl/inc/qt5/QtBuilder.hxx @@ -84,6 +84,7 @@ public: virtual void set_response(std::u16string_view sID, short nResponse) override; private: + static void deleteObject(QObject* pObject); void setProperties(QObject* obj, stringmap& rProps); static void setLabelProperties(QLabel& rLabel, stringmap& rProps); void setSpinButtonProperties(QDoubleSpinBox& rSpinBox, stringmap& rProps); diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 044e3ea9d421..d73800d02d0d 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -348,7 +348,7 @@ void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std // an editable GtkComboBox has an internal GtkEntry child, // but QComboBox doesn't need a separate widget for it, so // delete it - pCurrentChild->deleteLater(); + deleteObject(pCurrentChild); } if (sType == "label") @@ -362,8 +362,7 @@ void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std // For QGroupBox, the title can be set directly. Therefore, take over the // title from the label and delete the separate label widget again pGroupBox->setTitle(pLabel->text()); - pLabel->setParent(nullptr); - pLabel->deleteLater(); + deleteObject(pLabel); } } } @@ -526,6 +525,13 @@ void QtBuilder::set_response(std::u16string_view sID, short nResponse) pPushButton->setProperty(QtInstanceMessageDialog::PROPERTY_VCL_RESPONSE_CODE, int(nResponse)); } +void QtBuilder::deleteObject(QObject* pObject) +{ + if (pObject->isWidgetType()) + static_cast(pObject)->hide(); + pObject->deleteLater(); +} + void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) { if (QMessageBox* pMessageBox = qobject_cast(pObject)) @@ -604,7 +610,7 @@ void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) // parentless GtkImage in .ui file is only used for setting button // image, so the object is no longer needed after doing so if (!pImageLabel->parent()) - pImageLabel->deleteLater(); + deleteObject(pImageLabel); } else if (rKey == u"label") { From 9579907205ee0f060fe5f9fa1ded3504c474860c Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Thu, 21 Nov 2024 20:36:22 +0100 Subject: [PATCH 156/373] Spelling mistake in code Change-Id: I9db111c16865a2b7514e62a21a66d5497cda91fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176966 Tested-by: Jenkins Reviewed-by: Julien Nabet --- extensions/inc/strings.hrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/inc/strings.hrc b/extensions/inc/strings.hrc index a14f66ef78a2..17e2ad7caa76 100644 --- a/extensions/inc/strings.hrc +++ b/extensions/inc/strings.hrc @@ -253,7 +253,7 @@ #define RID_STR_HEADERBACKGROUNDCOLOR NC_("RID_STR_HEADERBACKGROUNDCOLOR", "Header background color") #define RID_STR_HEADERTEXTCOLOR NC_("RID_STR_HEADERTEXTCOLOR", "Header text color") #define RID_STR_ACTIVESELECTIONBACKGROUNDCOLOR NC_("RID_STR_ACTIVESELECTIONBACKGROUNDCOLOR", "Active selection background color") -#define RID_STR_ACTIVESELECTIONTEXTCOLOR NC_("ID_STR_ACTIVESELECTIONTEXTCOLOR", "Active selection text color") +#define RID_STR_ACTIVESELECTIONTEXTCOLOR NC_("RID_STR_ACTIVESELECTIONTEXTCOLOR", "Active selection text color") #define RID_STR_INACTIVESELECTIONBACKGROUNDCOLOR NC_("RID_STR_INACTIVESELECTIONBACKGROUNDCOLOR", "Inactive selection background color") #define RID_STR_INACTIVESELECTIONTEXTCOLOR NC_("RID_STR_INACTIVESELECTIONTEXTCOLOR", "Inactive selection text color") #define RID_STR_STANDARD NC_("RID_STR_STANDARD", "Default") From 89c431aa997293023e09919c8f7bb5b54a544029 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 09:42:03 +0100 Subject: [PATCH 157/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I1e460b817dd876977e520251b6a79d9fb9c283d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177100 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/svx/grfcrop.hxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/svx/grfcrop.hxx b/include/svx/grfcrop.hxx index ff17e66e0c03..615a750a1c01 100644 --- a/include/svx/grfcrop.hxx +++ b/include/svx/grfcrop.hxx @@ -23,9 +23,6 @@ #include #include -#define GRFCROP_VERSION_SWDEFAULT 0 -#define GRFCROP_VERSION_MOVETOSVX 1 - class SVXCORE_DLLPUBLIC SvxGrfCrop : public SfxPoolItem { sal_Int32 m_nLeft, m_nRight, m_nTop, m_nBottom; From c4338ba8560331b7a8f8a147b6447f7067793022 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 09:32:48 +0100 Subject: [PATCH 158/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I38b932ab81842b5f209d89ef5229d61e10f3ffd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177097 Reviewed-by: Julien Nabet Tested-by: Jenkins --- include/svx/cuicharmap.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/svx/cuicharmap.hxx b/include/svx/cuicharmap.hxx index 0d95eb198e04..006cdba0a402 100644 --- a/include/svx/cuicharmap.hxx +++ b/include/svx/cuicharmap.hxx @@ -35,8 +35,6 @@ using namespace ::com::sun::star; class SubsetMap; -#define CHARMAP_MAXLEN 32 - namespace svx { struct SvxShowCharSetItem; From 3f2d10e2a526602aa82e74fdcde305f448a272c7 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 05:56:26 +0100 Subject: [PATCH 159/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Id5d1b36ba734c3cf10b83f472ab5afe3a142a464 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177060 Reviewed-by: Julien Nabet Tested-by: Jenkins --- include/editeng/ulspitem.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx index 59e92f4b691b..2658033614a4 100644 --- a/include/editeng/ulspitem.hxx +++ b/include/editeng/ulspitem.hxx @@ -30,8 +30,6 @@ This item describes the Upper- and Lower space of a page or paragraph. */ -#define ULSPACE_16_VERSION (sal_uInt16(0x0001)) - class EDITENG_DLLPUBLIC SvxULSpaceItem final : public SfxPoolItem { sal_uInt16 nUpper; // Upper space From c6fd44d819f77d499aa939e29c5206f04ac731f3 Mon Sep 17 00:00:00 2001 From: Simon Chenery Date: Fri, 22 Nov 2024 13:46:53 +0100 Subject: [PATCH 160/373] tdf#158237 Use C++20 contains() instead of find() and end() Change-Id: Ib0ed8868b94c1470768a95fb26767cf25fe4bf8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177028 Reviewed-by: Julien Nabet Tested-by: Julien Nabet --- shell/source/win32/ooofilereader/metainforeader.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/source/win32/ooofilereader/metainforeader.cxx b/shell/source/win32/ooofilereader/metainforeader.cxx index 9eab4d5e01d2..e4295311df72 100644 --- a/shell/source/win32/ooofilereader/metainforeader.cxx +++ b/shell/source/win32/ooofilereader/metainforeader.cxx @@ -121,7 +121,7 @@ CMetaInfoReader::~CMetaInfoReader() */ bool CMetaInfoReader::hasTag(const std::wstring& TagName) const { - return ( m_AllMetaInfo.find(TagName) != m_AllMetaInfo.end()); + return ( m_AllMetaInfo.contains(TagName) ); } /** Get a specific tag content, compound tags will be returned as comma separated list. @@ -146,7 +146,7 @@ std::wstring CMetaInfoReader::getTagData( const std::wstring& TagName) */ bool CMetaInfoReader::hasTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName) { - return ( m_AllMetaInfo[TagName].second.find( AttributeName) != m_AllMetaInfo[TagName].second.end() ); + return ( m_AllMetaInfo[TagName].second.contains( AttributeName) ); } /** Get a specific attribute content. From f57f05e574ff628a8aa8c341c8a16d759b4b3640 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 09:39:14 +0100 Subject: [PATCH 161/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I01cc9d30499783e531777eb17e332490afab4d6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177098 Reviewed-by: Julien Nabet Tested-by: Jenkins --- include/svx/gallery.hxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/svx/gallery.hxx b/include/svx/gallery.hxx index d668bf9e668e..b03b31a5d322 100644 --- a/include/svx/gallery.hxx +++ b/include/svx/gallery.hxx @@ -89,9 +89,6 @@ #define RID_GALLERY_THEME_TRANSPORT (RID_GALLERY_THEME_START + 43) #define RID_GALLERY_THEME_TXTSHAPES (RID_GALLERY_THEME_START + 44) -#define RID_GALLERY_THEME_FIRST RID_GALLERY_THEME_3D -#define RID_GALLERY_THEME_LAST RID_GALLERY_THEME_TXTSHAPES - class SdrModel; class Graphic; class BitmapEx; From 291420684981050e0daff00456def227ae9c0515 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 09:40:37 +0100 Subject: [PATCH 162/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Ided473c985f8bdca007d3da34f92e42fb5080f54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177099 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/svx/galmisc.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx index 3403b4e32db6..be4e0330b0e3 100644 --- a/include/svx/galmisc.hxx +++ b/include/svx/galmisc.hxx @@ -73,9 +73,7 @@ enum class GalleryGraphicImportRet #define GALLERY_PROGRESS_RANGE 10000 -#define GALLERY_FG_COLOR Application::GetSettings().GetStyleSettings().GetWindowTextColor() #define GALLERY_BG_COLOR Application::GetSettings().GetStyleSettings().GetWindowColor() -#define GALLERY_DLG_COLOR Application::GetSettings().GetStyleSettings().GetDialogColor() class SvStream; class Graphic; From bdb5f278a7418cc428f64563585f95e2a305e761 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Fri, 22 Nov 2024 20:55:38 +0100 Subject: [PATCH 163/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Id74c10f5965d97bf24b49fc9ee777bf7b0ad251d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177051 Reviewed-by: Julien Nabet Tested-by: Jenkins --- include/avmedia/mediawindow.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx index 90e252bffafe..cb1aa115e294 100644 --- a/include/avmedia/mediawindow.hxx +++ b/include/avmedia/mediawindow.hxx @@ -28,8 +28,6 @@ #include #include -#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0 - namespace com::sun::star::frame { class XDispatchProvider; } namespace com::sun::star::graphic { class XGraphic; } namespace com::sun::star::media { From 2a3e7a751cb910bac0d8b7392658c77dfb8655c9 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Fri, 22 Nov 2024 20:59:04 +0100 Subject: [PATCH 164/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: If150b8fec5350cb513550711a61923cc1a273a80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177052 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/comphelper/accessibleselectionhelper.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/comphelper/accessibleselectionhelper.hxx b/include/comphelper/accessibleselectionhelper.hxx index 12842bf4bcb2..78bdabcae611 100644 --- a/include/comphelper/accessibleselectionhelper.hxx +++ b/include/comphelper/accessibleselectionhelper.hxx @@ -27,8 +27,6 @@ #include #define ACCESSIBLE_SELECTION_CHILD_ALL (sal_Int32(-1)) -#define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2) - namespace comphelper { From d4bc4d9e9f6af7d13c54be38f59f1f330b7adfdc Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Thu, 21 Nov 2024 20:25:26 +0100 Subject: [PATCH 165/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I3207e070fba8407fd8475c8d774b3a500cae8e17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176965 Tested-by: Jenkins Reviewed-by: Julien Nabet --- editeng/source/editeng/impedit.hxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index a76d50855d9c..8f722c660c6a 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -88,9 +88,6 @@ namespace editeng { #define MAXCHARSINPARA 0x3FFF-CHARPOSGROW // Max 16K, because WYSIWYG array #define LINE_SEP '\x0A' -#define ATTRSPECIAL_WHOLEWORD 1 -#define ATTRSPECIAL_EDGE 2 - struct CursorFlags { bool bTextOnly : 1 = false; From f66d3e550246eca42012392e270c4660957597d6 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Thu, 21 Nov 2024 20:11:19 +0100 Subject: [PATCH 166/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I183330f8c2e947d6c8dffbcabc7da6c115e08a8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176963 Tested-by: Jenkins Reviewed-by: Julien Nabet --- editeng/inc/editattr.hxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx index 985a586c7fe3..b416acfe2279 100644 --- a/editeng/inc/editattr.hxx +++ b/editeng/inc/editattr.hxx @@ -52,7 +52,6 @@ class OutputDevice; class SvxCaseMapItem; class SfxGrabBagItem; -#define CH_FEATURE_OLD (sal_uInt8) 0xFF #define CH_FEATURE u'\x0001' #define CH_SOFTHYPHEN u'\x00AD' @@ -61,8 +60,6 @@ class SfxGrabBagItem; // => To determine the DefMetric simply use GetMetric(0) #define DEF_METRIC 0 - - // bFeature: Attribute must not expand/shrink, length is always 1 // bEdge: Attribute will not expand, if you want to expand just on the edge class EditCharAttrib From 9d862186c0e0ecb7f5948f0fd84160ce26aecdcc Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Fri, 22 Nov 2024 18:41:35 +0100 Subject: [PATCH 167/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I161af7b70421a819f5ecb6b95867e6fa142fe3ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177046 Reviewed-by: Julien Nabet Tested-by: Jenkins --- filter/source/config/cache/constant.hxx | 1 - 1 file changed, 1 deletion(-) diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx index a371fccf406e..b2d53224a3be 100644 --- a/filter/source/config/cache/constant.hxx +++ b/filter/source/config/cache/constant.hxx @@ -86,7 +86,6 @@ inline constexpr OUString CFGSET_CONTENTHANDLERS = u"ContentHandlers"_ustr; */ inline constexpr OUString CFGDIRECTKEY_OFFICELOCALE = u"/org.openoffice.Setup/L10N/ooLocale"_ustr; inline constexpr OUString CFGDIRECTKEY_DEFAULTFRAMELOADER = u"/org.openoffice.TypeDetection.Misc/Defaults/DefaultFrameLoader"_ustr; -#define CFGDIRECTKEY_PRODUCTNAME "/org.openoffice.Setup/Product/ooName" // Note that these flag bits have parallel names in // comphelper/inc/comphelper/documentconstants.hxx . See that file for From 56b32b808b8c6f231b1a594d2e5316f33ab171b6 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Fri, 22 Nov 2024 06:41:16 +0100 Subject: [PATCH 168/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I95b7b249082f5c2755ca54a0656912011d2cb116 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176983 Tested-by: Jenkins Reviewed-by: Julien Nabet --- filter/source/graphicfilter/icgm/chart.hxx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/filter/source/graphicfilter/icgm/chart.hxx b/filter/source/graphicfilter/icgm/chart.hxx index ef77ace0e22f..3a8e8d946382 100644 --- a/filter/source/graphicfilter/icgm/chart.hxx +++ b/filter/source/graphicfilter/icgm/chart.hxx @@ -24,14 +24,6 @@ #include #include -/* FILE TYPE CONSTANTS: */ -#define BULCHART 32 /* Bullet chart file. */ -/* the following were added although SPC doesn't have a #define */ -/* for them... */ -#define AUTOTTLCHT 95 /* Autobuild TTL CHT */ -#define AUTOBULCHT 96 /* Autobuild BUL CHT */ -#define AUTOTABCHT 97 /* Autobuild TAB CHT */ - typedef struct TextEntry { sal_uInt16 nTypeOfText; From 23392c3c12e5558358188a94d7bb3d53730ed92d Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Fri, 22 Nov 2024 18:59:24 +0100 Subject: [PATCH 169/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I0a6d9a12f3e6d84ad4ba665ba16dd05fb6f9786f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177048 Reviewed-by: Julien Nabet Tested-by: Jenkins --- framework/inc/protocols.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/framework/inc/protocols.h b/framework/inc/protocols.h index bbadb7e71888..7ba3d41de394 100644 --- a/framework/inc/protocols.h +++ b/framework/inc/protocols.h @@ -35,8 +35,6 @@ namespace framework{ a real visible component. */ -// indicates a loadable content in general! -#define SPECIALPROTOCOL_PRIVATE "private:" // indicates loading of components using a model directly #define SPECIALPROTOCOL_PRIVATE_OBJECT u"private:object" // indicates loading of components using a stream only From d2adf4b1d32069bdec0655e86269034670eb1fea Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Tue, 19 Nov 2024 17:11:30 +0100 Subject: [PATCH 170/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I93494b4dec546d48b7dced2f1a6c774177c99c86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176782 Tested-by: Jenkins Reviewed-by: Julien Nabet --- chart2/source/controller/inc/TabPageNotifiable.hxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/chart2/source/controller/inc/TabPageNotifiable.hxx b/chart2/source/controller/inc/TabPageNotifiable.hxx index c0b53972e546..16450f28f781 100644 --- a/chart2/source/controller/inc/TabPageNotifiable.hxx +++ b/chart2/source/controller/inc/TabPageNotifiable.hxx @@ -20,11 +20,6 @@ #include -// color to use as foreground for an invalid range -#define RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR COL_WHITE -// color to use as background for an invalid range -#define RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR Color(0xff6563) - class BuilderPage; namespace chart From c1a9fa9b2c783057c70045ef926fd7481e60e9ae Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Fri, 22 Nov 2024 18:45:05 +0100 Subject: [PATCH 171/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I377154880c52685e5b1588221d631c51967c490a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177047 Reviewed-by: Julien Nabet Tested-by: Jenkins --- filter/source/svg/svgfilter.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 916bd9d263ad..29b0a7d29374 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -51,8 +51,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star; using namespace ::com::sun::star::xml::sax; -#define SVG_EXPORT_ALLPAGES ((sal_Int32)-1) - namespace com::sun::star::frame { class XController; } // Placeholder tag used into the ImplWriteActions method to filter text placeholder fields From d33b24d62f8b84b4da2c53b9f5e42fe147645425 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Fri, 22 Nov 2024 19:02:28 +0100 Subject: [PATCH 172/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: I9b27cfb715f6cd0a9b6ea21da9cb24fc8d8ec739 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177050 Tested-by: Julien Nabet Reviewed-by: Julien Nabet --- hwpfilter/source/hpara.h | 1 - 1 file changed, 1 deletion(-) diff --git a/hwpfilter/source/hpara.h b/hwpfilter/source/hpara.h index 53c35a2ccb7f..b057edcb816b 100644 --- a/hwpfilter/source/hpara.h +++ b/hwpfilter/source/hpara.h @@ -53,7 +53,6 @@ enum }; class HWPPara; -#define FIXED_SPACING_BIT (0x8000) struct LineInfo { From ee331d51c84b0d6fcbd65810843ab6c836d9dea9 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 15 Nov 2024 12:43:10 +0500 Subject: [PATCH 173/373] Reduce copying of ScEditEngineDefaulter's SfxItemSet Change-Id: Ifea96f2cf586b4e5b63761e2f03944dade764430 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177073 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- sc/inc/editutil.hxx | 16 +++++--- sc/source/core/data/column2.cxx | 14 +++---- sc/source/core/data/documen2.cxx | 6 +-- sc/source/core/data/documen8.cxx | 10 ++--- sc/source/core/tool/editutil.cxx | 40 ++++++++++++------- sc/source/ui/Accessibility/AccessibleText.cxx | 14 +++---- sc/source/ui/dbgui/csvgrid.cxx | 32 +++++++-------- sc/source/ui/unoobj/textuno.cxx | 24 +++++------ sc/source/ui/view/gridwin.cxx | 8 ++-- sc/source/ui/view/printfun.cxx | 8 ++-- sc/source/ui/view/viewfun4.cxx | 6 +-- 11 files changed, 97 insertions(+), 81 deletions(-) diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx index 247f1cc783ae..0173b4aa7f26 100644 --- a/sc/inc/editutil.hxx +++ b/sc/inc/editutil.hxx @@ -130,8 +130,8 @@ public: ScEditEngineDefaulter( const ScEditEngineDefaulter& rOrg ); virtual ~ScEditEngineDefaulter() override; - /// Creates a copy of SfxItemSet if bRememberCopy set - void SetDefaults( const SfxItemSet& rDefaults, bool bRememberCopy = true ); + /// Creates a copy of SfxItemSet + void SetDefaults( const SfxItemSet& rDefaults ); /// Becomes the owner of the SfxItemSet void SetDefaults( std::unique_ptr pDefaults ); @@ -148,13 +148,15 @@ public: void SetTextCurrentDefaults( const EditTextObject& rTextObject ); /// Current defaults are not applied, new defaults are applied void SetTextNewDefaults( const EditTextObject& rTextObject, - const SfxItemSet& rDefaults, bool bRememberCopy = true ); + std::unique_ptr pDefaults ); + /// New defaults are applied, but not stored + void SetTextTempDefaults( const EditTextObject& rTextObject, + const SfxItemSet& rDefaults ); /// SetText and apply defaults already set void SetTextCurrentDefaults( const OUString& rText ); /// Current defaults are not applied, new defaults are applied - void SetTextNewDefaults( const OUString& rText, - const SfxItemSet& rDefaults ); + void SetTextNewDefaults( const OUString& rText, std::unique_ptr pDefaults ); /// Paragraph attributes that are not defaults are copied to /// character attributes and all paragraph attributes reset @@ -163,6 +165,10 @@ public: /// Re-apply existing defaults if set, same as in SetText, /// but without EnableUndo/SetUpdateMode. void RepeatDefaults(); + +private: + /// Apply the passed defaults, without storing them + void ApplyDefaults(const SfxItemSet& rNewSet); }; // for field commands (or just fields?) in a table diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index e99933785860..e0e5505da9aa 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -415,22 +415,22 @@ tools::Long ScColumn::GetNeededSize( pDev->SetMapMode( aHMMMode ); pEngine->SetRefDevice( pDev ); rDocument.ApplyAsianEditSettings( *pEngine ); - SfxItemSet aSet( pEngine->GetEmptyItemSet() ); + auto pSet = std::make_unique(pEngine->GetEmptyItemSet()); if ( ScStyleSheet* pPreviewStyle = rDocument.GetPreviewCellStyle( nCol, nRow, nTab ) ) { ScPatternAttr aPreviewPattern( *pPattern ); aPreviewPattern.SetStyleSheet(pPreviewStyle); - aPreviewPattern.FillEditItemSet( &aSet, pCondSet ); + aPreviewPattern.FillEditItemSet(pSet.get(), pCondSet); } else { SfxItemSet* pFontSet = rDocument.GetPreviewFont( nCol, nRow, nTab ); - pPattern->FillEditItemSet( &aSet, pFontSet ? pFontSet : pCondSet ); + pPattern->FillEditItemSet(pSet.get(), pFontSet ? pFontSet : pCondSet); } // no longer needed, are set with the text (is faster) // pEngine->SetDefaults( pSet ); - if ( aSet.Get(EE_PARA_HYPHENATE).GetValue() ) { + if ( pSet->Get(EE_PARA_HYPHENATE).GetValue() ) { css::uno::Reference xXHyphenator( LinguMgr::GetHyphenator() ); pEngine->SetHyphenator( xXHyphenator ); @@ -483,7 +483,7 @@ tools::Long ScColumn::GetNeededSize( if (aCell.getType() == CELLTYPE_EDIT) { - pEngine->SetTextNewDefaults(*aCell.getEditText(), std::move(aSet)); + pEngine->SetTextNewDefaults(*aCell.getEditText(), std::move(pSet)); } else { @@ -493,9 +493,9 @@ tools::Long ScColumn::GetNeededSize( rOptions.bFormula); if (!aString.isEmpty()) - pEngine->SetTextNewDefaults(aString, std::move(aSet)); + pEngine->SetTextNewDefaults(aString, std::move(pSet)); else - pEngine->SetDefaults(std::move(aSet)); + pEngine->SetDefaults(std::move(pSet)); } bool bEngineVertical = pEngine->IsEffectivelyVertical(); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index dc6441a3e29b..225eac4502c2 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -519,9 +519,9 @@ ScNoteEditEngine& ScDocument::GetNoteEngine() mpNoteEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM)); ApplyAsianEditSettings( *mpNoteEngine ); const SfxItemSet& rItemSet(getCellAttributeHelper().getDefaultCellAttribute().GetItemSet()); - SfxItemSet aEEItemSet( mpNoteEngine->GetEmptyItemSet() ); - ScPatternAttr::FillToEditItemSet( aEEItemSet, rItemSet ); - mpNoteEngine->SetDefaults( std::move(aEEItemSet) ); // edit engine takes ownership + auto pEEItemSet = std::make_unique(mpNoteEngine->GetEmptyItemSet()); + ScPatternAttr::FillToEditItemSet(*pEEItemSet, rItemSet); + mpNoteEngine->SetDefaults(std::move(pEEItemSet)); // edit engine takes ownership } return *mpNoteEngine; } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 5fb5eec14acc..75a3763f6fcc 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -1246,19 +1246,19 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, Transliteratio // defaults from cell attributes must be set so right language is used const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab ); - SfxItemSet aDefaults( pEngine->GetEmptyItemSet() ); + auto pDefaults = std::make_unique( pEngine->GetEmptyItemSet() ); if ( ScStyleSheet* pPreviewStyle = GetPreviewCellStyle( nCol, nRow, nTab ) ) { ScPatternAttr aPreviewPattern( *pPattern ); aPreviewPattern.SetStyleSheet(pPreviewStyle); - aPreviewPattern.FillEditItemSet( &aDefaults ); + aPreviewPattern.FillEditItemSet(pDefaults.get()); } else { SfxItemSet* pFontSet = GetPreviewFont( nCol, nRow, nTab ); - pPattern->FillEditItemSet( &aDefaults, pFontSet ); + pPattern->FillEditItemSet(pDefaults.get(), pFontSet); } - pEngine->SetDefaults( std::move(aDefaults) ); + pEngine->SetDefaults(std::move(pDefaults)); if (aCell.getType() == CELLTYPE_STRING) pEngine->SetTextCurrentDefaults(aCell.getSharedString()->getString()); else if (aCell.getEditText()) @@ -1280,7 +1280,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, Transliteratio if ( aTester.NeedsObject() ) { // remove defaults (paragraph attributes) before creating text object - pEngine->SetDefaults( std::make_unique( pEngine->GetEmptyItemSet() ) ); + pEngine->SetDefaults(pEngine->GetEmptyItemSet()); // The cell will take ownership of the text object instance. SetEditText(ScAddress(nCol,nRow,nTab), pEngine->CreateTextObject()); diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 3c3dac0ee4e9..69eb8a1a8181 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -562,13 +562,8 @@ ScEditEngineDefaulter::~ScEditEngineDefaulter() { } -void ScEditEngineDefaulter::SetDefaults( const SfxItemSet& rSet, bool bRememberCopy ) +void ScEditEngineDefaulter::ApplyDefaults(const SfxItemSet& rNewSet) { - if ( bRememberCopy ) - { - m_pDefaults = std::make_unique( rSet ); - } - const SfxItemSet& rNewSet = bRememberCopy ? *m_pDefaults : rSet; bool bUndo = IsUndoEnabled(); EnableUndo( false ); bool bUpdateMode = SetUpdateLayout( false ); @@ -583,11 +578,16 @@ void ScEditEngineDefaulter::SetDefaults( const SfxItemSet& rSet, bool bRememberC EnableUndo( true ); } +void ScEditEngineDefaulter::SetDefaults(const SfxItemSet& rSet) +{ + SetDefaults(std::make_unique(rSet)); +} + void ScEditEngineDefaulter::SetDefaults( std::unique_ptr pSet ) { m_pDefaults = std::move(pSet); if ( m_pDefaults ) - SetDefaults( *m_pDefaults, false ); + ApplyDefaults(*m_pDefaults); } void ScEditEngineDefaulter::SetDefaultItem( const SfxPoolItem& rItem ) @@ -597,7 +597,7 @@ void ScEditEngineDefaulter::SetDefaultItem( const SfxPoolItem& rItem ) m_pDefaults = std::make_unique( GetEmptyItemSet() ); } m_pDefaults->Put( rItem ); - SetDefaults( *m_pDefaults, false ); + ApplyDefaults(*m_pDefaults); } const SfxItemSet& ScEditEngineDefaulter::GetDefaults() @@ -614,17 +614,27 @@ void ScEditEngineDefaulter::SetTextCurrentDefaults( const EditTextObject& rTextO bool bUpdateMode = SetUpdateLayout( false ); SetText( rTextObject ); if ( m_pDefaults ) - SetDefaults( *m_pDefaults, false ); + ApplyDefaults(*m_pDefaults); if ( bUpdateMode ) SetUpdateLayout( true ); } -void ScEditEngineDefaulter::SetTextNewDefaults( const EditTextObject& rTextObject, - const SfxItemSet& rSet, bool bRememberCopy ) +void ScEditEngineDefaulter::SetTextNewDefaults(const EditTextObject& rTextObject, + std::unique_ptr pDefaults) { bool bUpdateMode = SetUpdateLayout( false ); SetText( rTextObject ); - SetDefaults( rSet, bRememberCopy ); + SetDefaults(std::move(pDefaults)); + if ( bUpdateMode ) + SetUpdateLayout( true ); +} + +void ScEditEngineDefaulter::SetTextTempDefaults(const EditTextObject& rTextObject, + const SfxItemSet& rSet) +{ + bool bUpdateMode = SetUpdateLayout( false ); + SetText( rTextObject ); + ApplyDefaults(rSet); if ( bUpdateMode ) SetUpdateLayout( true ); } @@ -634,17 +644,17 @@ void ScEditEngineDefaulter::SetTextCurrentDefaults( const OUString& rText ) bool bUpdateMode = SetUpdateLayout( false ); SetText( rText ); if ( m_pDefaults ) - SetDefaults( *m_pDefaults, false ); + ApplyDefaults(*m_pDefaults); if ( bUpdateMode ) SetUpdateLayout( true ); } void ScEditEngineDefaulter::SetTextNewDefaults( const OUString& rText, - const SfxItemSet& rSet ) + std::unique_ptr pDefaults ) { bool bUpdateMode = SetUpdateLayout( false ); SetText( rText ); - SetDefaults( rSet ); + SetDefaults(std::move(pDefaults)); if ( bUpdateMode ) SetUpdateLayout( true ); } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 3413772e4707..98a69698f5fe 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1143,15 +1143,15 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder() pCellAttributeDefault = &pTmp->getDefaultCellAttribute(); } - SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() ); - pCellAttributeDefault->FillEditItemSet( &aDefaults ); + auto pDefaults = std::make_unique(pHdrEngine->GetEmptyItemSet()); + pCellAttributeDefault->FillEditItemSet(pDefaults.get()); // FillEditItemSet adjusts font height to 1/100th mm, // but for header/footer twips is needed, as in the PatternAttr: - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ); - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); - aDefaults.Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) ); - pHdrEngine->SetDefaults( aDefaults ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); + pDefaults->Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) ); + pHdrEngine->SetDefaults(std::move(pDefaults)); ScHeaderFieldData aData; if (mpViewShell) diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 869dde5ca95b..fde4197b9ac8 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -285,37 +285,37 @@ void ScCsvGrid::InitFonts() ::GetDefaultFonts( aLatinItem, aAsianItem, aComplexItem ); // create item set for defaults - SfxItemSet aDefSet( mpEditEngine->GetEmptyItemSet() ); - EditEngine::SetFontInfoInItemSet( aDefSet, maMonoFont ); - aDefSet.Put( aAsianItem ); - aDefSet.Put( aComplexItem ); + auto pDefSet = std::make_unique(mpEditEngine->GetEmptyItemSet()); + EditEngine::SetFontInfoInItemSet(*pDefSet, maMonoFont); + pDefSet->Put(aAsianItem); + pDefSet->Put(aComplexItem); // set Asian/Complex font size to height of character in Latin font sal_uLong nFontHt = static_cast< sal_uLong >( maMonoFont.GetFontSize().Height() ); - aDefSet.Put( SvxFontHeightItem( nFontHt, 100, EE_CHAR_FONTHEIGHT_CJK ) ); - aDefSet.Put( SvxFontHeightItem( nFontHt, 100, EE_CHAR_FONTHEIGHT_CTL ) ); + pDefSet->Put(SvxFontHeightItem(nFontHt, 100, EE_CHAR_FONTHEIGHT_CJK)); + pDefSet->Put(SvxFontHeightItem(nFontHt, 100, EE_CHAR_FONTHEIGHT_CTL)); // copy other items from default font - const SfxPoolItem& rWeightItem = aDefSet.Get( EE_CHAR_WEIGHT ); + const SfxPoolItem& rWeightItem = pDefSet->Get(EE_CHAR_WEIGHT); std::unique_ptr pNewItem(rWeightItem.Clone()); pNewItem->SetWhich(EE_CHAR_WEIGHT_CJK); - aDefSet.Put( *pNewItem ); + pDefSet->Put(*pNewItem); pNewItem->SetWhich(EE_CHAR_WEIGHT_CTL); - aDefSet.Put( *pNewItem ); - const SfxPoolItem& rItalicItem = aDefSet.Get( EE_CHAR_ITALIC ); + pDefSet->Put(*pNewItem); + const SfxPoolItem& rItalicItem = pDefSet->Get(EE_CHAR_ITALIC); pNewItem.reset(rItalicItem.Clone()); pNewItem->SetWhich(EE_CHAR_ITALIC_CJK); - aDefSet.Put( *pNewItem ); + pDefSet->Put(*pNewItem); pNewItem->SetWhich(EE_CHAR_ITALIC_CTL); - aDefSet.Put( *pNewItem ); - const SfxPoolItem& rLangItem = aDefSet.Get( EE_CHAR_LANGUAGE ); + pDefSet->Put(*pNewItem); + const SfxPoolItem& rLangItem = pDefSet->Get(EE_CHAR_LANGUAGE); pNewItem.reset(rLangItem.Clone()); pNewItem->SetWhich(EE_CHAR_LANGUAGE_CJK); - aDefSet.Put( *pNewItem ); + pDefSet->Put(*pNewItem); pNewItem->SetWhich(EE_CHAR_LANGUAGE_CTL); - aDefSet.Put( *pNewItem ); + pDefSet->Put(*pNewItem); - mpEditEngine->SetDefaults( aDefSet ); + mpEditEngine->SetDefaults(std::move(pDefSet)); InvalidateGfx(); } diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 30b67d411f9f..2e1b14c39a47 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -190,14 +190,14 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder() pCellAttributeDefault = &pTmp->getDefaultCellAttribute(); } - SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() ); - pCellAttributeDefault->FillEditItemSet( &aDefaults ); + auto pDefaults = std::make_unique(pHdrEngine->GetEmptyItemSet()); + pCellAttributeDefault->FillEditItemSet(pDefaults.get()); // FillEditItemSet adjusts font height to 1/100th mm, // but for header/footer twips is needed, as in the PatternAttr: - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ) ; - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); - pHdrEngine->SetDefaults( aDefaults ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ) ; + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); + pHdrEngine->SetDefaults(std::move(pDefaults)); ScHeaderFieldData aData; ScHeaderFooterTextObj::FillDummyFieldData( aData ); @@ -799,19 +799,19 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() { ScDocument& rDoc = pDocShell->GetDocument(); - SfxItemSet aDefaults( pEditEngine->GetEmptyItemSet() ); + auto pDefaults = std::make_unique(pEditEngine->GetEmptyItemSet()); if( const ScPatternAttr* pPattern = rDoc.GetPattern( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) { - pPattern->FillEditItemSet( &aDefaults ); - pPattern->FillEditParaItems( &aDefaults ); // including alignment etc. (for reading) + pPattern->FillEditItemSet(pDefaults.get()); + pPattern->FillEditParaItems(pDefaults.get()); // including alignment etc. (for reading) } ScRefCellValue aCell(rDoc, aCellPos); if (aCell.getType() == CELLTYPE_EDIT) { const EditTextObject* pObj = aCell.getEditText(); - pEditEngine->SetTextNewDefaults(*pObj, aDefaults); + pEditEngine->SetTextNewDefaults(*pObj, std::move(pDefaults)); } else { @@ -826,9 +826,9 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() // pEditEngine->SetTextNewDefaults() is passed an empty string // and pEditEngine->GetText() is empty string. if (!aText.isEmpty() || !pEditEngine->GetText().isEmpty()) - pEditEngine->SetTextNewDefaults(aText, aDefaults); + pEditEngine->SetTextNewDefaults(aText, std::move(pDefaults)); else - pEditEngine->SetDefaults(aDefaults); + pEditEngine->SetDefaults(std::move(pDefaults)); } } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 81c8a67e0ad6..5bb1f8f4c3fb 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5792,10 +5792,10 @@ std::shared_ptr createEditEngine( ScDocShell* pDocSh, const S ScSizeDeviceProvider aProv(pDocSh); pEngine->SetRefDevice(aProv.GetDevice()); pEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM)); - SfxItemSet aDefault = pEngine->GetEmptyItemSet(); - rPat.FillEditItemSet(&aDefault); - aDefault.Put( SvxAdjustItem(toSvxAdjust(rPat), EE_PARA_JUST) ); - pEngine->SetDefaults(aDefault); + auto pDefault = std::make_unique(pEngine->GetEmptyItemSet()); + rPat.FillEditItemSet(pDefault.get()); + pDefault->Put(SvxAdjustItem(toSvxAdjust(rPat), EE_PARA_JUST)); + pEngine->SetDefaults(std::move(pDefault)); return pEngine; } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index ec1458323e9c..898bf636ff14 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -782,7 +782,7 @@ tools::Long ScPrintFunc::TextHeight( const EditTextObject* pObject ) if (!pObject) return 0; - pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); + pEditEngine->SetTextTempDefaults(*pObject, *pEditDefaults); return static_cast(pEditEngine->GetTextHeight()); } @@ -1877,7 +1877,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart if (pObject) { pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) ); - pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); + pEditEngine->SetTextTempDefaults(*pObject, *pEditDefaults); Point aDraw = aStart; tools::Long nDif = aPaperSize.Height() - static_cast(pEditEngine->GetTextHeight()); if (nDif > 0) @@ -1891,7 +1891,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart if (pObject) { pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) ); - pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); + pEditEngine->SetTextTempDefaults(*pObject, *pEditDefaults); Point aDraw = aStart; tools::Long nDif = aPaperSize.Height() - static_cast(pEditEngine->GetTextHeight()); if (nDif > 0) @@ -1905,7 +1905,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart if (pObject) { pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) ); - pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); + pEditEngine->SetTextTempDefaults(*pObject, *pEditDefaults); Point aDraw = aStart; tools::Long nDif = aPaperSize.Height() - static_cast(pEditEngine->GetTextHeight()); if (nDif > 0) diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 835c526f7f0b..0edb654f2249 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -362,12 +362,12 @@ void ScViewFunc::DoThesaurus() pThesaurusEngine->SetRefDevice(GetViewData().GetActiveWin()->GetOutDev()); pThesaurusEngine->SetSpeller(xSpeller); MakeEditView(pThesaurusEngine.get(), nCol, nRow ); - SfxItemSet aEditDefaults(pThesaurusEngine->GetEmptyItemSet()); const ScPatternAttr* pPattern = rDoc.GetPattern(nCol, nRow, nTab); if (pPattern) { - pPattern->FillEditItemSet( &aEditDefaults ); - pThesaurusEngine->SetDefaults( aEditDefaults ); + auto pEditDefaults = std::make_unique(pThesaurusEngine->GetEmptyItemSet()); + pPattern->FillEditItemSet(pEditDefaults.get()); + pThesaurusEngine->SetDefaults(std::move(pEditDefaults)); } if (aOldText.getType() == CELLTYPE_EDIT) From fa706421c9a981df11814cd845fe901181c49974 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 15 Nov 2024 13:04:58 +0500 Subject: [PATCH 174/373] Avoid new string allocations, when only checking if empty Change-Id: I35a44dedd27b5c3470ed035e64ec0461d8d0cbdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177074 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- dbaccess/source/ui/app/DocumentInfoPreview.cxx | 2 +- include/editeng/editeng.hxx | 2 +- sc/source/ui/unoobj/textuno.cxx | 2 +- sc/source/ui/view/editsh.cxx | 5 ++--- sd/source/ui/func/fuinsfil.cxx | 4 ++-- sd/source/ui/view/NotesPanelView.cxx | 2 +- sw/source/uibase/docvw/AnnotationWin2.cxx | 4 ++-- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dbaccess/source/ui/app/DocumentInfoPreview.cxx b/dbaccess/source/ui/app/DocumentInfoPreview.cxx index ed7f9f862c97..f12de3fbe515 100644 --- a/dbaccess/source/ui/app/DocumentInfoPreview.cxx +++ b/dbaccess/source/ui/app/DocumentInfoPreview.cxx @@ -119,7 +119,7 @@ namespace void ODocumentInfoPreview::insertEntry( std::u16string_view title, OUString const & value) { - if (!m_xEditEngine->GetText().isEmpty()) { + if (m_xEditEngine->HasText()) { m_xEditEngine->QuickInsertText(u"\n\n"_ustr, InsertAtEnd(*m_xEditEngine)); } diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index f78aefc5cffa..ef1ec563d3b5 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -194,7 +194,6 @@ private: SAL_DLLPRIVATE void HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos); SAL_DLLPRIVATE void HandleEndPasteOrDrop(PasteOrDropInfos& rInfos); - SAL_DLLPRIVATE bool HasText() const; SAL_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const; SAL_DLLPRIVATE void SetInSelectionMode(bool b); @@ -278,6 +277,7 @@ public: SAL_DLLPRIVATE void SetMinColumnWrapHeight(tools::Long nVal); + bool HasText() const; OUString GetText( LineEnd eEnd = LINEEND_LF ) const; OUString GetText( const ESelection& rSelection ) const; sal_Int32 GetTextLen() const; diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 2e1b14c39a47..89d2ffc11af3 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -825,7 +825,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() // Note: CppunitTest_sc_macros_test testTdf116127 will fail if // pEditEngine->SetTextNewDefaults() is passed an empty string // and pEditEngine->GetText() is empty string. - if (!aText.isEmpty() || !pEditEngine->GetText().isEmpty()) + if (!aText.isEmpty() || pEditEngine->HasText()) pEditEngine->SetTextNewDefaults(aText, std::move(pDefaults)); else pEditEngine->SetDefaults(std::move(pDefaults)); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index ce39cd33d9a9..3fa202c29a3f 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -347,10 +347,9 @@ void ScEditShell::Execute( SfxRequest& rReq ) EditView* pActiveView = pHdl->GetActiveView(); if( pActiveView ) { - OUString sInput = rEngine.GetText(); ESelection aSel( pActiveView->GetSelection() ); - if( aSel.HasRange() ) - sInput = pActiveView->GetSelected(); + OUString sInput(aSel.HasRange() ? pActiveView->GetSelected() + : rEngine.GetText()); if( aSel.nStartPos > aSel.nEndPos ) aSel.nEndPos = aSel.nStartPos; diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 8b67b00424b1..46253dad1467 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -441,7 +441,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) ErrCode nErr = aOutliner.Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() ); - if (nErr || aOutliner.GetEditEngine().GetText().isEmpty()) + if (nErr || !aOutliner.GetEditEngine().HasText()) { std::unique_ptr xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); @@ -586,7 +586,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) ErrCode nErr = aOutliner.Read(*pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes()); - if (nErr || aOutliner.GetEditEngine().GetText().isEmpty()) + if (nErr || !aOutliner.GetEditEngine().HasText()) { std::unique_ptr xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); diff --git a/sd/source/ui/view/NotesPanelView.cxx b/sd/source/ui/view/NotesPanelView.cxx index 05ef63aeb3fd..037fb0809cf5 100644 --- a/sd/source/ui/view/NotesPanelView.cxx +++ b/sd/source/ui/view/NotesPanelView.cxx @@ -214,7 +214,7 @@ void NotesPanelView::onLoseFocus() SdrTextObj* pNotesTextObj = getNotesTextObj(); if (pNotesTextObj) { - if (maOutliner.GetEditEngine().GetText().getLength() == 0) + if (!maOutliner.GetEditEngine().HasText()) { // if the notes are empty restore the placeholder text and state. SdPage* pPage = dynamic_cast(pNotesTextObj->getSdrPageFromSdrObject()); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index b3634148e7fe..4979045c48dd 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1026,7 +1026,7 @@ void SwAnnotationWin::DeactivatePostIt() if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) GetOutlinerView()->SetBackgroundColor(COL_TRANSPARENT); - if (!mnDeleteEventId && !IsReadOnlyOrProtected() && mpOutliner->GetEditEngine().GetText().isEmpty()) + if (!mnDeleteEventId && !IsReadOnlyOrProtected() && !mpOutliner->GetEditEngine().HasText()) { mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true ); } @@ -1059,7 +1059,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot) const bool bReply = nSlot == FN_REPLY; // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note // will be created - if (!mrMgr.IsAnswer() && !mpOutliner->GetEditEngine().GetText().isEmpty()) + if (!mrMgr.IsAnswer() && mpOutliner->GetEditEngine().HasText()) { OutlinerParaObject aPara(GetOutlinerView()->GetEditView().CreateTextObject()); mrMgr.RegisterAnswer(aPara); From 662c6a6d70bab6b1a6ae8048457907be97f447ca Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Tue, 19 Nov 2024 18:18:01 -0900 Subject: [PATCH 175/373] related tdf#157255: add DisableLayerHighlighting expert setting This allows the layer objects overlay to not be done when the value set for DisableLayerHighlighting is less than the number of objects in the layer of the tab which the mouse is hovered over in the layer bar. Change-Id: Ie49ecb11bfb029ada57824c0acbbd133e1fe83b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176809 Reviewed-by: Jim Raykowski Tested-by: Jenkins Reviewed-by: Heiko Tietze --- .../schema/org/openoffice/Office/Draw.xcs | 7 ++++++ sd/inc/strings.hrc | 1 + sd/source/ui/dlg/LayerTabBar.cxx | 25 ++++++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Draw.xcs b/officecfg/registry/schema/org/openoffice/Office/Draw.xcs index dc6fa42f9e04..0cb747cf8cc2 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Draw.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Draw.xcs @@ -417,6 +417,13 @@ 2 + + + Defines the maximum number of objects in a layer (0 - 65535) before hovering the mouse pointer over a layer tab of the layer bar does not cause the layer objects in the view to be highlighted. + + 65535 + diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc index e8a6fe8683e1..16174a94f76f 100644 --- a/sd/inc/strings.hrc +++ b/sd/inc/strings.hrc @@ -80,6 +80,7 @@ #define STR_POPUP_DELETE_SNAPPOINT NC_("STR_POPUP_DELETE_SNAPPOINT", "Delete Snap Point") #define STR_IMPRESS NC_("STR_IMPRESS", "StarImpress 4.0") #define STR_LAYER NC_("STR_LAYER", "Layer") +#define STR_LAYER_HIGHLIGHTING_DISABLED NC_("STR_LAYER_HIGHLIGHTING_DISABLED", "Layer highlighting is disabled for this layer. The number of layer objects exceeds the number set for DisableLayerHighlighting (%1).") #define STR_UNDO_DELETEPAGES NC_("STR_UNDO_DELETEPAGES", "Delete slides") #define STR_UNDO_DELETEPAGES_DRAW NC_("STR_UNDO_DELETEPAGES_DRAW", "Delete pages") #define STR_UNDO_INSERTPAGES NC_("STR_UNDO_INSERTPAGES", "Insert slides") diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx index 01c0ffc09173..0955b8551805 100644 --- a/sd/source/ui/dlg/LayerTabBar.cxx +++ b/sd/source/ui/dlg/LayerTabBar.cxx @@ -45,6 +45,8 @@ #include #include +#include + namespace sd { /** @@ -167,14 +169,20 @@ void LayerTabBar::BringLayerObjectsToAttention(const sal_uInt16 nPageId) m_aBringLayerObjectsToAttentionDelayTimer.Stop(); + if (m_xOverlayObject && m_xOverlayObject->getOverlayManager()) + m_xOverlayObject->getOverlayManager()->remove(*m_xOverlayObject); + m_nBringLayerObjectsToAttentionLastPageId = nPageId; std::vector aRanges; if (nPageId != 0) { + sal_uInt16 nDisableLayerObjectsOverlay + = officecfg::Office::Draw::Misc::DisableLayerHighlighting::get(); OUString aLayerName(GetLayerName(nPageId)); - if (pDrViewSh->GetView()->GetSdrPageView()->IsLayerVisible(aLayerName)) + if (nDisableLayerObjectsOverlay > 0 // don't show tooltip message when 0 - meaning feature is turned off + && pDrViewSh->GetView()->GetSdrPageView()->IsLayerVisible(aLayerName)) { SdrLayerAdmin& rLayerAdmin = pDrViewSh->GetDoc()->GetLayerAdmin(); SdrObjListIter aIter(pDrViewSh->GetActualPage(), SdrIterMode::DeepWithGroups); @@ -191,7 +199,18 @@ void LayerTabBar::BringLayerObjectsToAttention(const sal_uInt16 nPageId) { ::tools::Rectangle aRect(pObj->GetLogicRect()); if (!aRect.IsEmpty()) + { aRanges.emplace_back(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + if (aRanges.size() > nDisableLayerObjectsOverlay) + { + OUString sHelpText = SdResId(STR_LAYER_HIGHLIGHTING_DISABLED); + sHelpText = sHelpText.replaceFirst( + "%1", OUString::number(nDisableLayerObjectsOverlay)); + SetQuickHelpText(sHelpText); + m_xOverlayObject.reset(); + return; + } + } // skip over objects in groups if (pObj->IsGroupObject()) { @@ -207,8 +226,8 @@ void LayerTabBar::BringLayerObjectsToAttention(const sal_uInt16 nPageId) } } - if (m_xOverlayObject && m_xOverlayObject->getOverlayManager()) - m_xOverlayObject->getOverlayManager()->remove(*m_xOverlayObject); + SetQuickHelpText(u""_ustr); + if (aRanges.empty()) m_xOverlayObject.reset(); else From a1e7302a65554efdc339f0e0808965a7ab11fe0d Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 23 Nov 2024 10:10:36 +0500 Subject: [PATCH 176/373] GetAttrOutlineContentVisible may be const Change-Id: If94b948ddcc2fac9bce254947b78afc1c6f0383e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177078 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/inc/ndtxt.hxx | 2 +- sw/source/core/txtnode/ndtxt.cxx | 2 +- sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 74dc4ef031cb..8c7e32662aa6 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -657,7 +657,7 @@ public: * @brief GetAttrOutlineContentVisible * @return true if 'OutlineContentVisibleAttr' is found in RES_PARATR_GRABBAG */ - bool GetAttrOutlineContentVisible(); + bool GetAttrOutlineContentVisible() const; void SetAttrOutlineContentVisible(bool bVisible); bool IsEmptyListStyleDueToSetOutlineLevelAttr() const { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;} diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 16df75aec25a..f9cc2b4f82af 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -4201,7 +4201,7 @@ void SwTextNode::SetAttrOutlineLevel(int nLevel) } } -bool SwTextNode::GetAttrOutlineContentVisible() +bool SwTextNode::GetAttrOutlineContentVisible() const { bool bOutlineContentVisibleAttr = true; const SfxGrabBagItem & rGrabBagItem = GetAttr(RES_PARATR_GRABBAG); diff --git a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx index 9c7bf7d4b08e..34f4f92ac992 100644 --- a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx +++ b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx @@ -115,7 +115,7 @@ void SwOutlineContentVisibilityWin::Set() (void)rOutlineNodes.Seek_Entry(pTextNode, &m_nOutlinePos); // set symbol displayed on button - bool bVisible = const_cast(pTextNode)->GetAttrOutlineContentVisible(); + bool bVisible = pTextNode->GetAttrOutlineContentVisible(); SetSymbol(bVisible ? ButtonSymbol::HIDE : ButtonSymbol::SHOW); // set quick help From 5166efaa646fdb53345009529ba2005abf9fb6c2 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 14 Nov 2024 17:24:47 +0500 Subject: [PATCH 177/373] Turn SC_MOD macro to a function Change-Id: I5fc11037902bc6200fdaf4749260efe8e658bdce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177070 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sc/inc/scmod.hxx | 4 +- sc/qa/unit/helper/sorthelper.hxx | 5 +- sc/qa/unit/jumbosheets-test.cxx | 10 ++- sc/qa/unit/subsequent_export_test3.cxx | 2 +- sc/qa/unit/subsequent_filters_test4.cxx | 13 ++-- sc/qa/unit/ucalc_formula.cxx | 2 +- sc/qa/unit/uicalc/uicalc.cxx | 24 +++--- sc/qa/unit/uicalc/uicalc2.cxx | 2 +- sc/source/core/data/documen2.cxx | 4 +- sc/source/core/data/documen3.cxx | 2 +- sc/source/core/data/documen7.cxx | 2 +- sc/source/core/data/documen8.cxx | 2 +- sc/source/core/data/document.cxx | 10 +-- sc/source/core/data/drwlayer.cxx | 2 +- sc/source/core/data/funcdesc.cxx | 2 +- sc/source/core/data/global.cxx | 13 ++-- sc/source/core/data/patattr.cxx | 6 +- sc/source/core/data/table1.cxx | 4 +- sc/source/core/data/table5.cxx | 5 +- sc/source/core/tool/addincfg.cxx | 2 +- sc/source/core/tool/addincol.cxx | 4 +- sc/source/core/tool/chgtrack.cxx | 10 +-- sc/source/core/tool/detfunc.cxx | 2 +- sc/source/core/tool/editutil.cxx | 4 +- sc/source/core/tool/viewopti.cxx | 2 +- sc/source/filter/oox/workbookfragment.cxx | 5 +- .../ui/Accessibility/AccessibleCsvControl.cxx | 4 +- .../ui/Accessibility/AccessibleDocument.cxx | 2 +- .../ui/Accessibility/AccessibleEditObject.cxx | 2 +- .../Accessibility/AccessibleSpreadsheet.cxx | 6 +- sc/source/ui/Accessibility/AccessibleText.cxx | 2 +- sc/source/ui/app/drwtrans.cxx | 4 +- sc/source/ui/app/inputhdl.cxx | 41 +++++----- sc/source/ui/app/inputwin.cxx | 50 ++++++------ sc/source/ui/app/lnktrans.cxx | 3 +- sc/source/ui/app/rfindlst.cxx | 2 +- sc/source/ui/app/scdll.cxx | 4 +- sc/source/ui/app/scmod.cxx | 9 ++- sc/source/ui/app/seltrans.cxx | 4 +- sc/source/ui/app/transobj.cxx | 4 +- sc/source/ui/dbgui/PivotLayoutDialog.cxx | 2 +- sc/source/ui/dbgui/csvgrid.cxx | 2 +- sc/source/ui/dbgui/validate.cxx | 2 +- sc/source/ui/docshell/dbdocfun.cxx | 2 +- sc/source/ui/docshell/docfunc.cxx | 2 +- sc/source/ui/docshell/docsh.cxx | 46 +++++------ sc/source/ui/docshell/docsh3.cxx | 8 +- sc/source/ui/docshell/docsh4.cxx | 22 +++--- sc/source/ui/docshell/docsh6.cxx | 4 +- sc/source/ui/docshell/externalrefmgr.cxx | 2 +- sc/source/ui/docshell/sizedev.cxx | 2 +- sc/source/ui/drawfunc/fuins2.cxx | 2 +- sc/source/ui/drawfunc/fusel.cxx | 4 +- sc/source/ui/formdlg/dwfunctr.cxx | 5 +- sc/source/ui/formdlg/formula.cxx | 21 +++-- sc/source/ui/inc/validate.hxx | 2 +- sc/source/ui/miscdlgs/acredlin.cxx | 2 +- sc/source/ui/miscdlgs/anyrefdg.cxx | 11 +-- sc/source/ui/miscdlgs/autofmt.cxx | 2 +- .../ui/miscdlgs/onlyactivesheetsaveddlg.cxx | 2 +- sc/source/ui/miscdlgs/warnbox.cxx | 4 +- sc/source/ui/navipi/content.cxx | 10 +-- sc/source/ui/navipi/navipi.cxx | 6 +- sc/source/ui/optdlg/opredlin.cxx | 7 +- sc/source/ui/optdlg/tpprint.cxx | 2 +- sc/source/ui/optdlg/tpview.cxx | 7 +- sc/source/ui/uitest/uiobject.cxx | 4 +- sc/source/ui/undo/undostyl.cxx | 2 +- sc/source/ui/unoobj/appluno.cxx | 8 +- sc/source/ui/unoobj/confuno.cxx | 2 +- sc/source/ui/unoobj/docuno.cxx | 30 +++---- sc/source/ui/unoobj/textuno.cxx | 2 +- sc/source/ui/unoobj/viewuno.cxx | 4 +- sc/source/ui/vba/vbaapplication.cxx | 9 ++- sc/source/ui/view/cellsh1.cxx | 16 ++-- sc/source/ui/view/cellsh2.cxx | 6 +- sc/source/ui/view/cellsh3.cxx | 16 ++-- sc/source/ui/view/cellsh4.cxx | 4 +- sc/source/ui/view/colrowba.cxx | 8 +- sc/source/ui/view/drawvie4.cxx | 2 +- sc/source/ui/view/drawview.cxx | 4 +- sc/source/ui/view/editsh.cxx | 14 ++-- sc/source/ui/view/formatsh.cxx | 6 +- sc/source/ui/view/gridwin.cxx | 78 +++++++++---------- sc/source/ui/view/gridwin4.cxx | 19 +++-- sc/source/ui/view/hdrcont.cxx | 19 ++--- sc/source/ui/view/output.cxx | 30 +++---- sc/source/ui/view/output2.cxx | 5 +- sc/source/ui/view/preview.cxx | 8 +- sc/source/ui/view/prevwsh.cxx | 4 +- sc/source/ui/view/printfun.cxx | 8 +- sc/source/ui/view/reffact.cxx | 2 +- sc/source/ui/view/select.cxx | 17 ++-- sc/source/ui/view/spelldialog.cxx | 2 +- sc/source/ui/view/tabcont.cxx | 16 ++-- sc/source/ui/view/tabview.cxx | 4 +- sc/source/ui/view/tabview2.cxx | 4 +- sc/source/ui/view/tabview3.cxx | 41 +++++----- sc/source/ui/view/tabview4.cxx | 15 ++-- sc/source/ui/view/tabview5.cxx | 2 +- sc/source/ui/view/tabvwsh2.cxx | 5 +- sc/source/ui/view/tabvwsh3.cxx | 10 +-- sc/source/ui/view/tabvwsh4.cxx | 23 +++--- sc/source/ui/view/tabvwsh5.cxx | 2 +- sc/source/ui/view/tabvwsha.cxx | 20 +++-- sc/source/ui/view/tabvwshb.cxx | 4 +- sc/source/ui/view/tabvwshc.cxx | 11 +-- sc/source/ui/view/tabvwshd.cxx | 2 +- sc/source/ui/view/tabvwshe.cxx | 4 +- sc/source/ui/view/viewdata.cxx | 10 +-- sc/source/ui/view/viewfun3.cxx | 6 +- sc/source/ui/view/viewfun4.cxx | 4 +- sc/source/ui/view/viewfun5.cxx | 2 +- sc/source/ui/view/viewfun6.cxx | 2 +- sc/source/ui/view/viewfun7.cxx | 3 +- sc/source/ui/view/viewfunc.cxx | 12 +-- vbahelper/source/vbahelper/vbahelper.cxx | 2 +- 117 files changed, 504 insertions(+), 490 deletions(-) diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 59b1d2bf18a4..3811a9334fa6 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -241,9 +241,9 @@ public: SC_DLLPUBLIC void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller); SC_DLLPUBLIC void CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments); -}; -#define SC_MOD() ( static_cast(SfxApplication::GetModule(SfxToolsModule::Calc)) ) + static auto get() { return static_cast(SfxApplication::GetModule(SfxToolsModule::Calc)); } +}; void global_InitAppOptions(); diff --git a/sc/qa/unit/helper/sorthelper.hxx b/sc/qa/unit/helper/sorthelper.hxx index 5a37c29ddf0f..dc337953fb97 100644 --- a/sc/qa/unit/helper/sorthelper.hxx +++ b/sc/qa/unit/helper/sorthelper.hxx @@ -26,10 +26,11 @@ public: } static bool changeTo(bool bSortRefUpdate) { - ScInputOptions aInputOptions = SC_MOD()->GetInputOptions(); + ScModule* mod = ScModule::get(); + ScInputOptions aInputOptions = mod->GetInputOptions(); bool bRet = aInputOptions.GetSortRefUpdate(); aInputOptions.SetSortRefUpdate(bSortRefUpdate); - SC_MOD()->SetInputOptions(aInputOptions); + mod->SetInputOptions(aInputOptions); return bRet; } virtual ~SortTypeSetter() COVERITY_NOEXCEPT_FALSE diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 31c9fdfd5e7b..f6f2752be477 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -332,16 +332,18 @@ void ScJumboSheetsTest::setUp() //Init before GetDefaultsOptions ScDLL::Init(); - ScDefaultsOptions aDefaultsOption = SC_MOD()->GetDefaultsOptions(); + ScModule* mod = ScModule::get(); + ScDefaultsOptions aDefaultsOption = mod->GetDefaultsOptions(); aDefaultsOption.SetInitJumboSheets(true); - SC_MOD()->SetDefaultsOptions(aDefaultsOption); + mod->SetDefaultsOptions(aDefaultsOption); } void ScJumboSheetsTest::tearDown() { - ScDefaultsOptions aDefaultsOption = SC_MOD()->GetDefaultsOptions(); + ScModule* mod = ScModule::get(); + ScDefaultsOptions aDefaultsOption = mod->GetDefaultsOptions(); aDefaultsOption.SetInitJumboSheets(false); - SC_MOD()->SetDefaultsOptions(aDefaultsOption); + mod->SetDefaultsOptions(aDefaultsOption); UnoApiXmlTest::tearDown(); } diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index 959b73e21d33..50ea02c22c0e 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -446,7 +446,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testTrackChangesSimpleXLSX) } aTest; - SvtUserOptions& rUserOpt = SC_MOD()->GetUserOptions(); + SvtUserOptions& rUserOpt = ScModule::get()->GetUserOptions(); rUserOpt.SetToken(UserOptToken::FirstName, u"Export"_ustr); rUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index 3c24cf4a8a21..72a5b1bd2a53 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -1808,8 +1808,9 @@ void testSortWithSheetExternalReferencesODS_Impl(ScDocShell& rDocSh, SCROW nRow1 // Document contains cached external references. CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testSortWithSheetExternalReferencesODS) { + ScModule* mod = ScModule::get(); // We reset the SortRefUpdate value back to the original in tearDown(). - ScInputOptions aInputOption = SC_MOD()->GetInputOptions(); + ScInputOptions aInputOption = mod->GetInputOptions(); bool bUpdateReferenceOnSort = aInputOption.GetSortRefUpdate(); createScDoc("ods/sort-with-sheet-external-references.ods"); @@ -1822,7 +1823,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testSortWithSheetExternalReferencesODS) // modes. aInputOption.SetSortRefUpdate(true); - SC_MOD()->SetInputOptions(aInputOption); + mod->SetInputOptions(aInputOption); // Sort A15:D20 with relative row references. UpdateReferenceOnSort==true // With in-sheet relative references. @@ -1834,7 +1835,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testSortWithSheetExternalReferencesODS) pDoc->CalcAll(); aInputOption.SetSortRefUpdate(false); - SC_MOD()->SetInputOptions(aInputOption); + mod->SetInputOptions(aInputOption); // Sort A15:D20 with relative row references. UpdateReferenceOnSort==false // Without in-sheet relative references. @@ -1848,7 +1849,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testSortWithSheetExternalReferencesODS) // modes. aInputOption.SetSortRefUpdate(true); - SC_MOD()->SetInputOptions(aInputOption); + mod->SetInputOptions(aInputOption); // Sort A23:D28 with absolute row references. UpdateReferenceOnSort==true // With in-sheet relative references. @@ -1859,7 +1860,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testSortWithSheetExternalReferencesODS) pDoc->CalcAll(); aInputOption.SetSortRefUpdate(false); - SC_MOD()->SetInputOptions(aInputOption); + mod->SetInputOptions(aInputOption); // Sort A23:D28 with absolute row references. UpdateReferenceOnSort==false // With in-sheet relative references. @@ -1868,7 +1869,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testSortWithSheetExternalReferencesODS) if (bUpdateReferenceOnSort != aInputOption.GetSortRefUpdate()) { aInputOption.SetSortRefUpdate(bUpdateReferenceOnSort); - SC_MOD()->SetInputOptions(aInputOption); + mod->SetInputOptions(aInputOption); } } diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 23af64ecafea..40d2c6f174de 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -36,7 +36,7 @@ using ::std::endl; namespace { void setExpandRefs(bool bExpand) { - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aOpt = pMod->GetInputOptions(); aOpt.SetExpandRefs(bExpand); pMod->SetInputOptions(aOpt); diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 76d55137e98b..82f9c296b1f1 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -234,7 +234,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf151886) // change UseEnglishFuncName to true ScDocShell* pDocSh = getScDocShell(); - ScFormulaOptions aFormulaOptions = SC_MOD()->GetFormulaOptions(); + ScFormulaOptions aFormulaOptions = ScModule::get()->GetFormulaOptions(); bool bOldStatus = aFormulaOptions.GetUseEnglishFuncName(); aFormulaOptions.SetUseEnglishFuncName(true); pDocSh->SetFormulaOptions(aFormulaOptions); @@ -297,7 +297,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf162087) // change UseEnglishFuncName to true ScDocShell* pDocSh = getScDocShell(); - ScFormulaOptions aFormulaOptions = SC_MOD()->GetFormulaOptions(); + ScFormulaOptions aFormulaOptions = ScModule::get()->GetFormulaOptions(); bool bOldStatus = aFormulaOptions.GetUseEnglishFuncName(); aFormulaOptions.SetUseEnglishFuncName(true); pDocSh->SetFormulaOptions(aFormulaOptions); @@ -903,7 +903,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146795) ScDocument* pDoc = getScDoc(); // Disable replace cell warning - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetReplaceCellsWarn(); aInputOption.SetReplaceCellsWarn(false); @@ -947,7 +947,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf147744) ScDocument* pDoc = getScDoc(); // Disable replace cell warning - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetReplaceCellsWarn(); aInputOption.SetReplaceCellsWarn(false); @@ -1151,7 +1151,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf153669) ScDocument* pDoc = getScDoc(); // Disable replace cell warning - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetReplaceCellsWarn(); aInputOption.SetReplaceCellsWarn(false); @@ -1197,7 +1197,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf100582) ScDocument* pDoc = getScDoc(); // Disable replace cell warning - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetReplaceCellsWarn(); aInputOption.SetReplaceCellsWarn(false); @@ -1240,7 +1240,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf145640) ScDocument* pDoc = getScDoc(); // Enable sorting with update reference - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetSortRefUpdate(); aInputOption.SetSortRefUpdate(true); @@ -1273,7 +1273,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf97215) ScDocument* pDoc = getScDoc(); // Enable sorting with update reference - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetSortRefUpdate(); aInputOption.SetSortRefUpdate(true); @@ -1331,7 +1331,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf92963) ScDocument* pDoc = getScDoc(); // Disable replace cell warning - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetReplaceCellsWarn(); aInputOption.SetReplaceCellsWarn(false); @@ -1484,7 +1484,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf120660) ScDocument* pDoc = getScDoc(); // Disable replace cell warning - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetReplaceCellsWarn(); aInputOption.SetReplaceCellsWarn(false); @@ -2072,7 +2072,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458) createScDoc(); ScDocShell* pDocSh = getScDocShell(); - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); sal_uInt16 bOldStatus = aInputOption.GetMoveDir(); @@ -2317,7 +2317,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf163019) ScDocument* pDoc = getScDoc(); // Disable replace cell warning - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetReplaceCellsWarn(); aInputOption.SetReplaceCellsWarn(false); diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 8a23aa88dd2e..83bf9fcd36f5 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -581,7 +581,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf118207) ScDocument* pDoc = getScDoc(); // Disable replace cell warning - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); ScInputOptions aInputOption = pMod->GetInputOptions(); bool bOldStatus = aInputOption.GetReplaceCellsWarn(); aInputOption.SetReplaceCellsWarn(false); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 225eac4502c2..2fe0a63ec09a 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -100,8 +100,8 @@ ScSheetLimits ScSheetLimits::CreateDefault() { #if HAVE_FEATURE_JUMBO_SHEETS bool jumboSheets = false; - if( SC_MOD()) - jumboSheets = SC_MOD()->GetDefaultsOptions().GetInitJumboSheets(); + if (ScModule* mod = ScModule::get()) + jumboSheets = mod->GetDefaultsOptions().GetInitJumboSheets(); else assert(o3tl::IsRunningUnitTest()); if (jumboSheets) diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 788f16a135d9..602d3b573535 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1036,7 +1036,7 @@ void ScDocument::UpdateReference( std::unique_ptr pExpandRefsSwitch; if (rCxt.isInserted()) - pExpandRefsSwitch.reset(new sc::ExpandRefsSwitch(*this, SC_MOD()->GetInputOptions().GetExpandRefs())); + pExpandRefsSwitch.reset(new sc::ExpandRefsSwitch(*this, ScModule::get()->GetInputOptions().GetExpandRefs())); size_t nFirstTab, nLastTab; if (rCxt.meMode == URM_COPY) diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index 96f9edd7edbc..6d9f29d83bee 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -593,7 +593,7 @@ void ScDocument::UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode, { bool bExpandRefsOld = IsExpandRefs(); if ( eUpdateRefMode == URM_INSDEL && (nDx > 0 || nDy > 0 || nDz > 0) ) - SetExpandRefs( SC_MOD()->GetInputOptions().GetExpandRefs() ); + SetExpandRefs(ScModule::get()->GetInputOptions().GetExpandRefs()); if ( pBASM ) pBASM->UpdateBroadcastAreas( eUpdateRefMode, rRange, nDx, nDy, nDz ); SetExpandRefs( bExpandRefsOld ); diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 75a3763f6fcc..ca19d460c720 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -199,7 +199,7 @@ OutputDevice* ScDocument::GetRefDevice(bool bForceVirtDev) { // Create printer like ref device, see Writer... OutputDevice* pRefDevice = nullptr; - if ( !bForceVirtDev && SC_MOD()->GetInputOptions().GetTextWysiwyg() ) + if (!bForceVirtDev && ScModule::get()->GetInputOptions().GetTextWysiwyg()) { pRefDevice = GetPrinter(); SAL_WARN_IF(!pRefDevice, "sc", "unable to get a printer, fallback to virdev"); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 4b55f0889a0a..36f37a7ee8de 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -161,7 +161,7 @@ void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck ) return; // Get Custom prefix - const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions(); + const ScDefaultsOptions& rOpt = ScModule::get()->GetDefaultsOptions(); OUString aString = rOpt.GetInitTabPrefix() + OUString::number(nTab+1); if ( _bNeedsNameCheck ) CreateValidTabName( aString ); // no doubles @@ -385,7 +385,7 @@ void ScDocument::CreateValidTabName(OUString& rName) const // Find new one // Get Custom prefix - const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions(); + const ScDefaultsOptions& rOpt = ScModule::get()->GetDefaultsOptions(); const OUString& aStrTable = rOpt.GetInitTabPrefix(); bool bOk = false; @@ -428,7 +428,7 @@ void ScDocument::CreateValidTabNames(std::vector& aNames, SCTAB nCount aNames.clear();//ensure that the vector is empty // Get Custom prefix - const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions(); + const ScDefaultsOptions& rOpt = ScModule::get()->GetDefaultsOptions(); const OUString& aStrTable = rOpt.GetInitTabPrefix(); OUStringBuffer rName; @@ -493,8 +493,8 @@ bool ScDocument::InsertTab( { // auto-accept any in-process input to prevent move the cell into next sheet in online. if (comphelper::LibreOfficeKit::isActive()) - if (!SC_MOD()->IsFormulaMode()) - SC_MOD()->InputEnterHandler(); + if (ScModule* mod = ScModule::get(); !mod->IsFormulaMode()) + mod->InputEnterHandler(); SCTAB nTabCount = GetTableCount(); bool bValid = ValidTab(nTabCount); diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index c60ac1814551..102b4564df54 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -307,7 +307,7 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, OUString _aName ) : rAdmin.NewLayer(u"hidden"_ustr, SC_LAYER_HIDDEN.get()); // Set link for URL-Fields - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); Outliner& rOutliner = GetDrawOutliner(); rOutliner.SetCalcFieldValueHdl( LINK( pScMod, ScModule, CalcFieldValueHdl ) ); rOutliner.SetStyleSheetPool(static_cast(GetStyleSheetPool())); diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index 49f0dbfd9eba..6ca1b262792c 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -1139,7 +1139,7 @@ const formula::IFunctionCategory* ScFunctionMgr::getCategory(sal_uInt32 nCategor void ScFunctionMgr::fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const { - const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions(); + const ScAppOptions& rAppOpt = ScModule::get()->GetAppOptions(); sal_uInt16 nLRUFuncCount = std::min( rAppOpt.GetLRUFuncListCount(), sal_uInt16(LRU_MAX) ); sal_uInt16* pLRUListIds = rAppOpt.GetLRUFuncList(); _rLastRUFunctions.clear(); diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 903faa6207d0..ad62505d2f54 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -625,7 +625,7 @@ OUString ScGlobal::GetCharsetString( rtl_TextEncoding eVal ) bool ScGlobal::HasStarCalcFunctionList() { - OUString lang = Translate::getLanguage(SC_MOD()->GetResLocale()); + OUString lang = Translate::getLanguage(ScModule::get()->GetResLocale()); auto list = xStarCalcFunctionList.find(lang); return list != xStarCalcFunctionList.end(); } @@ -633,20 +633,21 @@ bool ScGlobal::HasStarCalcFunctionList() ScFunctionList* ScGlobal::GetStarCalcFunctionList() { assert(!bThreadedGroupCalcInProgress); - OUString lang = Translate::getLanguage(SC_MOD()->GetResLocale()); + ScModule* mod = ScModule::get(); + OUString lang = Translate::getLanguage(mod->GetResLocale()); if (auto list = xStarCalcFunctionList.find(lang); list != xStarCalcFunctionList.end()) { return xStarCalcFunctionList[lang].get(); } xStarCalcFunctionList.emplace( - lang, new ScFunctionList(SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName())); + lang, new ScFunctionList(mod->GetFormulaOptions().GetUseEnglishFuncName())); return xStarCalcFunctionList[lang].get(); } ScFunctionMgr* ScGlobal::GetStarCalcFunctionMgr() { assert(!bThreadedGroupCalcInProgress); - OUString lang = Translate::getLanguage(SC_MOD()->GetResLocale()); + OUString lang = Translate::getLanguage(ScModule::get()->GetResLocale()); if (auto list = xStarCalcFunctionMgr.find(lang); list != xStarCalcFunctionMgr.end()) { return xStarCalcFunctionMgr[lang].get(); @@ -663,13 +664,13 @@ void ScGlobal::ResetFunctionList() xStarCalcFunctionList.clear(); // Building new names also needs InputHandler data to be refreshed. maInputHandlerFunctionNames.clear(); - maInputHandlerFunctionNames.emplace(Translate::getLanguage(SC_MOD()->GetResLocale()), + maInputHandlerFunctionNames.emplace(Translate::getLanguage(ScModule::get()->GetResLocale()), InputHandlerFunctionNames()); } const InputHandlerFunctionNames& ScGlobal::GetInputHandlerFunctionNames() { - OUString lang = Translate::getLanguage(SC_MOD()->GetResLocale()); + OUString lang = Translate::getLanguage(ScModule::get()->GetResLocale()); if (maInputHandlerFunctionNames.find(lang) == maInputHandlerFunctionNames.end()) { maInputHandlerFunctionNames.emplace(lang, InputHandlerFunctionNames()); diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index fddc861cb2e0..59c5753633f0 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -766,7 +766,7 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS aBackColor = *pBackConfigColor; } else - aBackColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + aBackColor = ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; } else { @@ -792,7 +792,7 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS { // pTextConfigColor can be used to avoid repeated lookup of the configured color aSysTextColor = *pTextConfigColor; - if (SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor == COL_AUTO) + if (ScModule::get()->GetColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor == COL_AUTO) { if ( aBackColor.IsDark() && aSysTextColor.IsDark() ) aSysTextColor = COL_WHITE; @@ -802,7 +802,7 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS } else { - aSysTextColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + aSysTextColor = ScModule::get()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; } if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current()) diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index b61701ecb2db..7b3c0aea4c1d 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -645,7 +645,7 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bC SCROW nMaxY = 0; SCCOL i; - bool bSkipEmpty = SC_MOD()->GetPrintOptions().GetSkipEmpty(); + bool bSkipEmpty = ScModule::get()->GetPrintOptions().GetSkipEmpty(); for (i=0; iGetPrintOptions().GetSkipEmpty(); + bool bSkipEmpty = ScModule::get()->GetPrintOptions().GetSkipEmpty(); for (i=nStartCol; i<=nEndCol && i < aCol.size(); i++) // Test attribute { diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 62f02ca66b1b..16ac890b7c5d 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -69,7 +69,8 @@ void ScTable::UpdatePageBreaks(const ScRange* pUserArea) return; // Always update breaks if force breaks option has changed - if (mbPageBreaksValid && mbForceBreaks == SC_MOD()->GetPrintOptions().GetForceBreaks()) + if (mbPageBreaksValid + && mbForceBreaks == ScModule::get()->GetPrintOptions().GetForceBreaks()) return; } @@ -123,7 +124,7 @@ void ScTable::UpdatePageBreaks(const ScRange* pUserArea) // get bSkipColBreaks/bSkipRowBreaks flags: // fdo#40788 - print range scale settings can cause manual breaks to be // ignored (see below). This behaviour may now be set by the user. - mbForceBreaks = SC_MOD()->GetPrintOptions().GetForceBreaks(); + mbForceBreaks = ScModule::get()->GetPrintOptions().GetForceBreaks(); bool bSkipColBreaks = false; bool bSkipRowBreaks = false; diff --git a/sc/source/core/tool/addincfg.cxx b/sc/source/core/tool/addincfg.cxx index 3f09b7defdc9..389c4f097058 100644 --- a/sc/source/core/tool/addincfg.cxx +++ b/sc/source/core/tool/addincfg.cxx @@ -46,7 +46,7 @@ void ScAddInCfg::Notify(const uno::Sequence&) // function list must also be rebuilt, but can't be modified while function // autopilot is open (function list for autopilot is then still old) - if (SC_MOD()->GetCurRefDlgId() != SID_OPENDLG_FUNCTION) + if (ScModule::get()->GetCurRefDlgId() != SID_OPENDLG_FUNCTION) ScGlobal::ResetFunctionList(); } diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index 385f61509e8e..ce960a9f7a96 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -369,7 +369,7 @@ void ScUnoAddInCollection::ReadConfiguration() { // called only from Initialize - ScAddInCfg& rAddInConfig = SC_MOD()->GetAddInCfg(); + ScAddInCfg& rAddInConfig = ScModule::get()->GetAddInCfg(); // Additional, temporary config item for the display names and // compatibility names. @@ -1073,7 +1073,7 @@ static const ScAddInArgDesc* lcl_FindArgDesc( const ScUnoAddInFuncData& rFuncDat void ScUnoAddInCollection::UpdateFromAddIn( const uno::Reference& xInterface, std::u16string_view rServiceName ) { - const bool bEnglishFunctionNames = SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName(); + const bool bEnglishFunctionNames = ScModule::get()->GetFormulaOptions().GetUseEnglishFuncName(); uno::Reference xLoc( xInterface, uno::UNO_QUERY ); if ( xLoc.is() ) // optional in new add-ins xLoc->setLocale( Application::GetSettings().GetUILanguageTag().getLocale()); diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 034899d082e6..f5ccfd579afb 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -2004,7 +2004,7 @@ ScChangeTrack::ScChangeTrack( ScDocument& rDocP ) : rDoc( rDocP ) { Init(); - SC_MOD()->GetUserOptions().AddListener(this); + ScModule::get()->GetUserOptions().AddListener(this); ppContentSlots.reset( new ScChangeActionContent* [ mnContentSlots ] ); memset( ppContentSlots.get(), 0, mnContentSlots * sizeof( ScChangeActionContent* ) ); @@ -2016,14 +2016,14 @@ ScChangeTrack::ScChangeTrack( ScDocument& rDocP, std::set&& aTempUserC rDoc( rDocP ) { Init(); - SC_MOD()->GetUserOptions().AddListener(this); + ScModule::get()->GetUserOptions().AddListener(this); ppContentSlots.reset( new ScChangeActionContent* [ mnContentSlots ] ); memset( ppContentSlots.get(), 0, mnContentSlots * sizeof( ScChangeActionContent* ) ); } ScChangeTrack::~ScChangeTrack() { - SC_MOD()->GetUserOptions().RemoveListener(this); + ScModule::get()->GetUserOptions().RemoveListener(this); DtorClear(); } @@ -2171,7 +2171,7 @@ void ScChangeTrack::ConfigurationChanged( utl::ConfigurationBroadcaster*, Config void ScChangeTrack::CreateAuthorName() { - const SvtUserOptions& rUserOptions = SC_MOD()->GetUserOptions(); + const SvtUserOptions& rUserOptions = ScModule::get()->GetUserOptions(); OUString aFirstName(rUserOptions.GetFirstName()); OUString aLastName(rUserOptions.GetLastName()); if (aFirstName.isEmpty() && aLastName.isEmpty()) @@ -3209,7 +3209,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction* pAct, bool bUndo ) // Formula cells ExpandRefs synchronized to the ones in the Document! bool bOldExpandRefs = rDoc.IsExpandRefs(); if ( (!bUndo && pAct->IsInsertType()) || (bUndo && pAct->IsDeleteType()) ) - rDoc.SetExpandRefs( SC_MOD()->GetInputOptions().GetExpandRefs() ); + rDoc.SetExpandRefs(ScModule::get()->GetInputOptions().GetExpandRefs()); if ( pAct->IsDeleteType() ) { diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 6f8648435aa4..e5babdbdbc54 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1635,7 +1635,7 @@ void ScDetectiveFunc::InitializeColors() { // may be called several times to update colors from configuration - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); nArrowColor = rColorCfg.GetColorValue(svtools::CALCDETECTIVE).nColor; nErrorColor = rColorCfg.GetColorValue(svtools::CALCDETECTIVEERROR).nColor; nCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor; diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 69eb8a1a8181..a52094cda538 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -244,7 +244,7 @@ OUString ScEditUtil::GetCellFieldValue( if (ppTextColor) { - *ppTextColor = SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor; + *ppTextColor = ScModule::get()->GetColorConfig().GetColorValue(eEntry).nColor; if (comphelper::LibreOfficeKit::isActive()) ScModule::IsLOKViewInDarkMode() ? *ppTextColor = Color(0x1D99F3) : *ppTextColor = Color(0x000080); } @@ -418,7 +418,7 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF pPattern->GetItem( ATTR_VERTICAL_ASIAN ).GetValue(); if ( eJust == SvxCellVerJustify::Top || - ( bForceToTop && ( SC_MOD()->GetInputOptions().GetTextWysiwyg() || bAsianVertical ) ) ) + ( bForceToTop && ( ScModule::get()->GetInputOptions().GetTextWysiwyg() || bAsianVertical ) ) ) nDifY = nTopMargin; else { diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx index 5e7c1d19e57d..657fee90dc2c 100644 --- a/sc/source/core/tool/viewopti.cxx +++ b/sc/source/core/tool/viewopti.cxx @@ -70,7 +70,7 @@ bool ScGridOptions::operator==( const ScGridOptions& rCpy ) const ScViewRenderingOptions::ScViewRenderingOptions() : sColorSchemeName(u"Default"_ustr) - , aDocCol(SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor) + , aDocCol(ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor) { } diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 14584891a21d..805c175f6456 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -598,11 +598,12 @@ void WorkbookFragment::recalcFormulaCells() // Always perform selected action in the future. std::shared_ptr batch(comphelper::ConfigurationChanges::create()); officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(0), batch); - ScFormulaOptions aOpt = SC_MOD()->GetFormulaOptions(); + ScModule* mod = ScModule::get(); + ScFormulaOptions aOpt = mod->GetFormulaOptions(); aOpt.SetOOXMLRecalcOptions(bHardRecalc ? RECALC_ALWAYS : RECALC_NEVER); /* XXX is this really supposed to set the ScModule options? * Not the ScDocShell options? */ - SC_MOD()->SetFormulaOptions(aOpt); + mod->SetFormulaOptions(aOpt); batch->commit(); } diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx index 47c15602f174..af0fb44c256a 100644 --- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx +++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx @@ -787,7 +787,7 @@ sal_Int32 SAL_CALL ScAccessibleCsvGrid::getBackground( ) { SolarMutexGuard aGuard; ensureAlive(); - return sal_Int32(SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor); + return sal_Int32(ScModule::get()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor); } // XAccessibleContext --------------------------------------------------------- @@ -1271,7 +1271,7 @@ sal_Int32 SAL_CALL ScAccessibleCsvCell::getBackground( ) { SolarMutexGuard aGuard; ensureAlive(); - return sal_Int32(SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor); + return sal_Int32(ScModule::get()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor); } // XAccessibleContext ----------------------------------------------------- diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 0d5639e8de29..e6f474a606df 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -2218,7 +2218,7 @@ sal_Int32 SAL_CALL ScAccessibleDocument::getBackground( ) { SolarMutexGuard aGuard; IsObjectValid(); - return sal_Int32(SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor); + return sal_Int32(ScModule::get()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx index 9a7d2e6809af..d903b9d43218 100644 --- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx +++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx @@ -375,7 +375,7 @@ void ScAccessibleEditObject::CreateTextHelper() mpTextHelper = std::make_unique<::accessibility::AccessibleTextHelper>(std::move(pEditSrc)); mpTextHelper->SetEventSource(this); - const ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); + const ScInputHandler* pInputHdl = ScModule::get()->GetInputHdl(); if ( pInputHdl && pInputHdl->IsEditMode() ) { mpTextHelper->SetFocus(); diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 9023902a4106..838ac9393cd7 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -495,7 +495,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint { ScViewData& rViewData = mpViewShell->GetViewData(); - m_bFormulaMode = rViewData.IsRefMode() || SC_MOD()->IsFormulaMode(); + m_bFormulaMode = rViewData.IsRefMode() || ScModule::get()->IsFormulaMode(); if ( m_bFormulaMode ) { NotifyRefMode(); @@ -1088,7 +1088,7 @@ sal_Int32 SAL_CALL ScAccessibleSpreadsheet::getBackground( ) { SolarMutexGuard aGuard; IsObjectValid(); - return sal_Int32(SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor); + return sal_Int32(ScModule::get()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor); } //===== XAccessibleContext ============================================== @@ -1706,7 +1706,7 @@ sal_Int64 ScAccessibleSpreadsheet::GetAccessibleIndexFormula( sal_Int32 nRow, sa bool ScAccessibleSpreadsheet::IsFormulaMode() { ScViewData& rViewData = mpViewShell->GetViewData(); - m_bFormulaMode = rViewData.IsRefMode() || SC_MOD()->IsFormulaMode(); + m_bFormulaMode = rViewData.IsRefMode() || ScModule::get()->IsFormulaMode(); return m_bFormulaMode ; } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 98a69698f5fe..cea5fd635b7a 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1139,7 +1139,7 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder() { // no access to ScDocument, use temporary CellAttributeHelper. // also see ScHeaderFooterTextData::GetTextForwarder for more comments - pTmp.reset(new CellAttributeHelper(SC_MOD()->GetPool())); + pTmp.reset(new CellAttributeHelper(ScModule::get()->GetPool())); pCellAttributeDefault = &pTmp->getDefaultCellAttribute(); } diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index c6dd8a773f8d..f4e3ca9fa10e 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -215,7 +215,7 @@ ScDrawTransferObj::~ScDrawTransferObj() { SolarMutexGuard aSolarGuard; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (pScMod && pScMod->GetDragData().pDrawTransfer == this) { OSL_FAIL("ScDrawTransferObj wasn't released"); @@ -568,7 +568,7 @@ void ScDrawTransferObj::DragFinished( sal_Int8 nDropAction ) m_pDragSourceView->DeleteMarked(); } - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if ( pScMod->GetDragData().pDrawTransfer == this ) pScMod->ResetDragObject(); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 560567fc82c4..2b1ab51fc6d4 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -359,7 +359,7 @@ static inline void incPos( const sal_Unicode c, sal_Int32& rPos, ESelection& rSe void ScInputHandler::InitRangeFinder( const OUString& rFormula ) { DeleteRangeFinder(); - if ( !pActiveViewSh || !SC_MOD()->GetInputOptions().GetRangeFinder() ) + if (!pActiveViewSh || !ScModule::get()->GetInputOptions().GetRangeFinder()) return; ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); @@ -563,7 +563,7 @@ void ScInputHandler::UpdateLokReferenceMarks() { nAdditionalMarks = 1; - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); Color aRefColor( rColorCfg.GetColorValue( svtools::CALCREFERENCE ).nColor ); tools::Long nX1 = rViewData.GetRefStartX(); tools::Long nX2 = rViewData.GetRefEndX(); @@ -879,8 +879,8 @@ ScInputHandler::~ScInputHandler() if (!mbDocumentDisposing) // inplace EnterHandler(); // Finish input - if (SC_MOD()->GetRefInputHdl() == this) - SC_MOD()->SetRefInputHdl(nullptr); + if (ScModule* mod = ScModule::get(); mod->GetRefInputHdl() == this) + mod->SetRefInputHdl(nullptr); if ( pInputWin && pInputWin->GetInputHandler() == this ) pInputWin->SetInputHandler( nullptr ); @@ -905,7 +905,7 @@ void ScInputHandler::UpdateRefDevice() if (!mpEditEngine) return; - bool bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg(); + bool bTextWysiwyg = ScModule::get()->GetInputOptions().GetTextWysiwyg(); if ( bTextWysiwyg && pActiveViewSh ) mpEditEngine->SetRefDevice( pActiveViewSh->GetViewData().GetDocument().GetPrinter() ); else @@ -1041,7 +1041,7 @@ void ScInputHandler::GetFormulaData() maFormulaChar = rFunctionNames.maFunctionChar; // Increase suggestion priority of MRU formulas - const ScAppOptions& rOpt = SC_MOD()->GetAppOptions(); + const ScAppOptions& rOpt = ScModule::get()->GetAppOptions(); const sal_uInt16 nMRUCount = rOpt.GetLRUFuncListCount(); const sal_uInt16* pMRUList = rOpt.GetLRUFuncList(); for (sal_uInt16 i = 0; i < nMRUCount; i++) @@ -2307,6 +2307,7 @@ void ScInputHandler::ViewShellGone(const ScTabViewShell* pViewSh) // Executed sy pLastPattern = nullptr; } + ScModule* mod = ScModule::get(); if ( pViewSh == pRefViewSh ) { //! The input from the EnterHandler does not arrive anymore @@ -2315,7 +2316,7 @@ void ScInputHandler::ViewShellGone(const ScTabViewShell* pViewSh) // Executed sy bFormulaMode = false; pRefViewSh = nullptr; SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) ); - SC_MOD()->SetRefInputHdl(nullptr); + mod->SetRefInputHdl(nullptr); if (pInputWin) pInputWin->SetFormulaMode(false); UpdateAutoCorrFlag(); @@ -2329,7 +2330,7 @@ void ScInputHandler::ViewShellGone(const ScTabViewShell* pViewSh) // Executed sy pActiveViewSh = nullptr; } - if ( SC_MOD()->GetInputOptions().GetTextWysiwyg() ) + if (mod->GetInputOptions().GetTextWysiwyg()) UpdateRefDevice(); // Don't keep old document's printer as RefDevice } @@ -2601,7 +2602,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn // For transparent cell background, the document background color must be used. Color aBackCol = pPattern->GetItem( ATTR_BACKGROUND ).GetColor(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if ( aBackCol.IsTransparent() || Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) aBackCol = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; @@ -2653,7 +2654,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn UpdateAdjust( cTyped ); - if ( SC_MOD()->GetAppOptions().GetAutoComplete() ) + if (ScModule::get()->GetAppOptions().GetAutoComplete()) GetColData(); if (!cTyped && !bCreatingFuncView && StartsLikeFormula(aStr)) @@ -2886,7 +2887,7 @@ void ScInputHandler::UpdateFormulaMode() bFormulaMode = true; pRefViewSh = pActiveViewSh; pSfxApp->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) ); - ScModule* pMod = SC_MOD(); + ScModule* pMod = ScModule::get(); pMod->SetRefInputHdl(this); if (pInputWin) pInputWin->SetFormulaMode(true); @@ -2909,7 +2910,7 @@ void ScInputHandler::UpdateFormulaMode() bFormulaMode = false; pRefViewSh = nullptr; pSfxApp->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) ); - SC_MOD()->SetRefInputHdl(nullptr); + ScModule::get()->SetRefInputHdl(nullptr); if (pInputWin) pInputWin->SetFormulaMode(false); UpdateAutoCorrFlag(); @@ -3355,7 +3356,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL mpEditEngine->ClearSpellErrors(); pObject = mpEditEngine->CreateTextObject(); } - else if (SC_MOD()->GetAppOptions().GetAutoComplete()) // Adjust Upper/Lower case + else if (ScModule::get()->GetAppOptions().GetAutoComplete()) // Adjust Upper/Lower case { // Perform case-matching only when the typed text is partial. if (pColumnData && aAutoSearch.getLength() < aString.getLength()) @@ -3380,7 +3381,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL bFormulaMode = false; pSfxApp->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) ); - SC_MOD()->SetRefInputHdl(nullptr); + ScModule::get()->SetRefInputHdl(nullptr); if (pInputWin) pInputWin->SetFormulaMode(false); UpdateAutoCorrFlag(); @@ -3520,7 +3521,7 @@ void ScInputHandler::CancelHandler() } bFormulaMode = false; SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) ); - SC_MOD()->SetRefInputHdl(nullptr); + ScModule::get()->SetRefInputHdl(nullptr); if (pInputWin) pInputWin->SetFormulaMode(false); UpdateAutoCorrFlag(); @@ -3818,7 +3819,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false if (pActiveViewSh) pActiveViewSh->FindNextUnprot( bShift, true ); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); const ScInputOptions& rOpt = pScMod->GetInputOptions(); const bool bKit = comphelper::LibreOfficeKit::isActive(); @@ -3866,7 +3867,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false if (pActiveViewSh) pActiveViewSh->MoveCursorEnter( bShift && !bControl ); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); const ScInputOptions& rOpt = pScMod->GetInputOptions(); const bool bKit = comphelper::LibreOfficeKit::isActive(); @@ -4019,7 +4020,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false } // AutoInput: - if ( bUsed && SC_MOD()->GetAppOptions().GetAutoComplete() ) + if (bUsed && ScModule::get()->GetAppOptions().GetAutoComplete()) { bUseTab = false; if (pFormulaData) @@ -4278,7 +4279,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, if ( pState && pActiveViewSh ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScTabViewShell* pScTabViewShell = dynamic_cast(pScMod->GetViewShell()); @@ -4482,7 +4483,7 @@ void ScInputHandler::ResetDelayTimer() IMPL_LINK_NOARG( ScInputHandler, DelayTimer, Timer*, void ) { - if ( !(nullptr == pLastState || SC_MOD()->IsFormulaMode() || SC_MOD()->IsRefDialogOpen())) + if (!(nullptr == pLastState || ScModule::get()->IsFormulaMode() || ScModule::get()->IsRefDialogOpen())) return; //! New method at ScModule to query if function autopilot is open diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 7a6db430cf98..03e5777471b0 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -250,7 +250,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) : aWndPos ->Show(); mxTextWindow->Show(); - pInputHdl = SC_MOD()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set + pInputHdl = ScModule::get()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set if (pInputHdl) pInputHdl->SetInputWindow( this ); @@ -337,7 +337,7 @@ void ScInputWindow::SetInputHandler( ScInputHandler* pNew ) void ScInputWindow::Select() { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ToolBox::Select(); ToolBoxItemId curItemId = GetCurItemId(); @@ -380,7 +380,7 @@ void ScInputWindow::Select() void ScInputWindow::StartFormula() { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); mxTextWindow->StartEditEngine(); if ( pScMod->IsEditMode() ) // Isn't if e.g. protected { @@ -531,7 +531,7 @@ void ScInputWindow::SetFuncString( const OUString& rString, bool bDoEdit ) EnableButtons( pViewFrm && !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ); mxTextWindow->StartEditEngine(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if ( !pScMod->IsEditMode() ) return; @@ -669,7 +669,7 @@ void ScInputWindow::SwitchToTextWin() // used for shift-ctrl-F2 mxTextWindow->StartEditEngine(); - if ( SC_MOD()->IsEditMode() ) + if (ScModule::get()->IsEditMode()) { mxTextWindow->TextGrabFocus(); EditView* pView = mxTextWindow->GetEditView(); @@ -823,7 +823,7 @@ void ScInputWindow::MouseButtonUp( const MouseEvent& rMEvt ) void ScInputWindow::AutoSum( bool& bRangeFinder, bool& bSubTotal, OpCode eCode ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScTabViewShell* pViewSh = dynamic_cast( SfxViewShell::Current() ); if ( !pViewSh ) return; @@ -1105,7 +1105,7 @@ void ScInputBarGroup::NumLinesChanged() TriggerToolboxLayout(); // Restore focus to input line(s) if necessary - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(); if ( pHdl && pHdl->IsTopMode() ) mxTextWndGroup->TextGrabFocus(); } @@ -1571,7 +1571,7 @@ void ScTextWnd::InitEditEngine() // If the Cell contains URLFields, they need to be taken over into the entry row, // or else the position is not correct anymore bool bFilled = false; - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(); if ( pHdl ) //! Test if it's the right InputHdl? bFilled = pHdl->GetTextAndFields(static_cast(*m_xEditEngine)); @@ -1660,7 +1660,7 @@ bool ScTextWnd::MouseMove( const MouseEvent& rMEvt ) bool ScTextWnd::CanFocus() const { - return SC_MOD()->IsEditMode(); + return ScModule::get()->IsEditMode(); } void ScTextWnd::UpdateFocus() @@ -1705,10 +1705,10 @@ bool ScTextWnd::MouseButtonUp( const MouseEvent& rMEvt ) Application::GetSettings().GetMouseSettings().GetMiddleButtonAction() == MouseMiddleButtonAction::PasteSelection ) { // EditView may have pasted from selection - SC_MOD()->InputChanged( m_xEditView.get() ); + ScModule::get()->InputChanged(m_xEditView.get()); } else - SC_MOD()->InputSelection( m_xEditView.get() ); + ScModule::get()->InputSelection(m_xEditView.get()); } return bRet; } @@ -1721,7 +1721,7 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) CommandEventId nCommand = rCEvt.GetCommand(); if (m_xEditView) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScTabViewShell* pStartViewSh = ScTabViewShell::GetActiveViewShell(); // don't modify the font defaults here - the right defaults are @@ -1753,13 +1753,14 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) } else if ( nCommand == CommandEventId::EndExtTextInput ) { + ScModule* mod = ScModule::get(); if (bFormulaMode) { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = mod->GetInputHdl(); if (pHdl) pHdl->InputCommand(rCEvt); } - SC_MOD()->InputChanged( m_xEditView.get() ); + mod->InputChanged(m_xEditView.get()); } else if ( nCommand == CommandEventId::CursorPos ) { @@ -1813,7 +1814,7 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) //pass alt press/release to parent impl } else - SC_MOD()->InputChanged( m_xEditView.get() ); + ScModule::get()->InputChanged(m_xEditView.get()); } if ( comphelper::LibreOfficeKit::isActive() && nCommand == CommandEventId::CursorPos ) @@ -1827,8 +1828,9 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) if (!m_xEditView) return true; + ScModule* mod = ScModule::get(); // if we focus input after "Accept Formula" command, we need to notify to get it working - SC_MOD()->InputChanged(m_xEditView.get()); + mod->InputChanged(m_xEditView.get()); // information about paragraph is in additional data // information about position in a paragraph in a Mouse Pos @@ -1844,7 +1846,7 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) nPosEnd = m_xEditView->GetPosNoField(nParaEnd, aSelectionStartEnd.Y()); m_xEditView->SetSelection(ESelection(nParaStart, nPosStart, nParaEnd, nPosEnd)); - SC_MOD()->InputSelection( m_xEditView.get() ); + mod->InputSelection(m_xEditView.get()); bConsumed = true; } @@ -1870,7 +1872,7 @@ bool ScTextWnd::KeyInput(const KeyEvent& rKEvt) { bool bUsed = true; bInputMode = true; - if (!SC_MOD()->InputKeyEvent( rKEvt )) + if (!ScModule::get()->InputKeyEvent(rKEvt)) { bUsed = false; ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); @@ -1924,7 +1926,7 @@ IMPL_LINK_NOARG(ScTextWnd, ModifyHdl, LinkParamNone*, void) { if (m_xEditView && !bInputMode) { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(); // Use the InputHandler's InOwnChange flag to prevent calling InputChanged // while an InputHandler method is modifying the EditEngine content @@ -1951,7 +1953,7 @@ void ScTextWnd::StopEditEngine( bool bAll ) if (!maAccTextDatas.empty()) maAccTextDatas.back()->EndEdit(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (!bAll) pScMod->InputSelection( m_xEditView.get() ); @@ -2384,7 +2386,7 @@ void ScPosWnd::FillFunctions() m_xWidget->freeze(); OUString aFirstName; - const ScAppOptions& rOpt = SC_MOD()->GetAppOptions(); + const ScAppOptions& rOpt = ScModule::get()->GetAppOptions(); sal_uInt16 nMRUCount = rOpt.GetLRUFuncListCount(); const sal_uInt16* pMRUList = rOpt.GetLRUFuncList(); if (pMRUList) @@ -2572,7 +2574,7 @@ void ScPosWnd::DoEnter() { if ( bFormulaMode ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if ( aText == ScResId(STR_FUNCTIONLIST_MORE) ) { // Function AutoPilot @@ -2673,7 +2675,7 @@ void ScPosWnd::DoEnter() { SfxViewFrame& rViewFrm = pViewSh->GetViewFrame(); SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId ); - SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); + ScModule::get()->SetRefDialog(nId, pWnd == nullptr); } } } @@ -2744,7 +2746,7 @@ void ScPosWnd::ReleaseFocus_Impl() HideTip(); SfxViewShell* pCurSh = SfxViewShell::Current(); - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( dynamic_cast( pCurSh ) ); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(dynamic_cast(pCurSh)); if ( pHdl && pHdl->IsTopMode() ) { // Focus back in input row? diff --git a/sc/source/ui/app/lnktrans.cxx b/sc/source/ui/app/lnktrans.cxx index 1ff48e7fe705..156c271dd887 100644 --- a/sc/source/ui/app/lnktrans.cxx +++ b/sc/source/ui/app/lnktrans.cxx @@ -67,8 +67,7 @@ bool ScLinkTransferObj::GetData( void ScLinkTransferObj::DragFinished( sal_Int8 nDropAction ) { - ScModule* pScMod = SC_MOD(); - pScMod->ResetDragObject(); + ScModule::get()->ResetDragObject(); TransferDataContainer::DragFinished( nDropAction ); } diff --git a/sc/source/ui/app/rfindlst.cxx b/sc/source/ui/app/rfindlst.cxx index be521f65dea8..ff5973fb65f0 100644 --- a/sc/source/ui/app/rfindlst.cxx +++ b/sc/source/ui/app/rfindlst.cxx @@ -38,7 +38,7 @@ ScRangeFindList::ScRangeFindList(OUString aName) : bHidden( false ), nIndexColor( 0 ) { - bIsDark = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor.IsDark(); + bIsDark = ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor.IsDark(); } Color ScRangeFindList::Insert( const ScRangeFindData &rNew ) diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 8d8cc74a31b1..694e7afdb666 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -89,12 +89,12 @@ OUString ScResId(TranslateId aId) { - return Translate::get(aId, SC_MOD()->GetResLocale()); + return Translate::get(aId, ScModule::get()->GetResLocale()); } OUString ScResId(TranslateNId aContextSingularPlural, int nCardinality) { - return Translate::nget(aContextSingularPlural, nCardinality, SC_MOD()->GetResLocale()); + return Translate::nget(aContextSingularPlural, nCardinality, ScModule::get()->GetResLocale()); } void ScDLL::Init() diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 94843dd1f3a0..e5f940bbbe34 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -795,7 +795,7 @@ void ScModule::SetAppOptions( const ScAppOptions& rOpt ) void global_InitAppOptions() { - SC_MOD()->GetAppOptions(); + ScModule::get()->GetAppOptions(); } const ScAppOptions& ScModule::GetAppOptions() @@ -2332,21 +2332,22 @@ bool ScModule::HasThesaurusLanguage( LanguageType nLang ) std::optional ScModule::CreateStyleFamilies() { SfxStyleFamilies aStyleFamilies; + std::locale resLocale = ScModule::get()->GetResLocale(); aStyleFamilies.emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para, ScResId(STR_STYLE_FAMILY_CELL), BMP_STYLES_FAMILY_CELL, - RID_CELLSTYLEFAMILY, SC_MOD()->GetResLocale())); + RID_CELLSTYLEFAMILY, resLocale)); aStyleFamilies.emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Page, ScResId(STR_STYLE_FAMILY_PAGE), BMP_STYLES_FAMILY_PAGE, - RID_PAGESTYLEFAMILY, SC_MOD()->GetResLocale())); + RID_PAGESTYLEFAMILY, resLocale)); aStyleFamilies.emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Frame, ScResId(STR_STYLE_FAMILY_GRAPHICS), BMP_STYLES_FAMILY_GRAPHICS, - RID_GRAPHICSTYLEFAMILY, SC_MOD()->GetResLocale())); + RID_GRAPHICSTYLEFAMILY, resLocale)); return aStyleFamilies; } diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx index cb83f310951a..29563cc55d46 100644 --- a/sc/source/ui/app/seltrans.cxx +++ b/sc/source/ui/app/seltrans.cxx @@ -149,7 +149,7 @@ ScSelectionTransferObj::ScSelectionTransferObj( ScTabView* pSource, ScSelectionT ScSelectionTransferObj::~ScSelectionTransferObj() { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (pScMod && pScMod->GetSelectionTransfer() == this) { // this is reached when the object wasn't really copied to the selection @@ -405,7 +405,7 @@ void ScSelectionTransferObj::ObjectReleased() ForgetView(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if ( pScMod->GetSelectionTransfer() == this ) pScMod->SetSelectionTransfer( nullptr ); diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 0d926b980fc2..16a93d557461 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -181,7 +181,7 @@ ScTransferObj::~ScTransferObj() SolarMutexGuard aSolarGuard; bool bIsDisposing = comphelper::LibreOfficeKit::isActive() && !ScTabViewShell::GetActiveViewShell(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (pScMod && !bIsDisposing && pScMod->GetDragData().pCellTransfer == this) { OSL_FAIL("ScTransferObj wasn't released"); @@ -601,7 +601,7 @@ void ScTransferObj::DragFinished( sal_Int8 nDropAction ) } } - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if ( pScMod && pScMod->GetDragData().pCellTransfer == this ) pScMod->ResetDragObject(); diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index 682dd3ea8411..675eb9313c95 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -479,7 +479,7 @@ void ScPivotLayoutDialog::ApplyChanges() SetDispatcherLock(false); SwitchToDocument(); - sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhichIDFromSlotID(SID_PIVOT_TABLE); + sal_uInt16 nWhichPivot = ScModule::get()->GetPool().GetWhichIDFromSlotID(SID_PIVOT_TABLE); ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet); mpViewData->GetViewShell()->SetDialogDPObject(std::make_unique(maPivotTableObject)); diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index fde4197b9ac8..1066a7deb281 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -134,7 +134,7 @@ void ScCsvGrid::Init() { OSL_PRECOND(!mpColorConfig, "the object has already been initialized"); - mpColorConfig = &SC_MOD()->GetColorConfig(); + mpColorConfig = &ScModule::get()->GetColorConfig(); InitColors(); mpColorConfig->AddListener(this); } diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 4e17921701e2..bacbe29e3af3 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -865,7 +865,7 @@ bool ScValidationDlg::EnterRefStatus() if (pWnd && pWnd->GetController().get() != this) pWnd = nullptr; - SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); + ScModule::get()->SetRefDialog(nId, pWnd == nullptr); return true; } diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 1ded38ed6eda..357ad17417e6 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -522,7 +522,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, return false; } - const ScInputOptions aInputOption = SC_MOD()->GetInputOptions(); + const ScInputOptions aInputOption = ScModule::get()->GetInputOptions(); const bool bUpdateRefs = aInputOption.GetSortRefUpdate(); // Adjust aLocalParam cols/rows to used data area. Keep sticky top row or diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index dccbb6d224e7..d94763e9baba 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1154,7 +1154,7 @@ void ScDocFunc::NotifyInputHandler( const ScAddress& rPos ) if ( !(pViewSh && pViewSh->GetViewData().GetDocShell() == &rDocShell) ) return; - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHdl = ScModule::get()->GetInputHdl(); if ( pInputHdl && pInputHdl->GetCursorPos() == rPos ) { bool bIsEditMode(pInputHdl->IsEditMode()); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d3e184eb2029..1756c5d2b3ca 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -250,7 +250,7 @@ void ScDocShell::DoEnterHandler() { ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); if (pViewSh && pViewSh->GetViewData().GetDocShell() == this) - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); } SCTAB ScDocShell::GetSaveTab() @@ -540,9 +540,10 @@ bool ScDocShell::GetRecalcRowHeightsMode() : static_cast(RECALC_NEVER), batch); - ScFormulaOptions aOpt = SC_MOD()->GetFormulaOptions(); + ScModule* mod = ScModule::get(); + ScFormulaOptions aOpt = mod->GetFormulaOptions(); aOpt.SetReCalcOptiRowHeights(bHardRecalc ? RECALC_ALWAYS : RECALC_NEVER); - SC_MOD()->SetFormulaOptions(aOpt); + mod->SetFormulaOptions(aOpt); batch->commit(); } @@ -618,11 +619,12 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css // Always perform selected action in the future. std::shared_ptr batch(comphelper::ConfigurationChanges::create()); officecfg::Office::Calc::Formula::Load::ODFRecalcMode::set(sal_Int32(0), batch); - ScFormulaOptions aOpt = SC_MOD()->GetFormulaOptions(); + ScModule* mod = ScModule::get(); + ScFormulaOptions aOpt = mod->GetFormulaOptions(); aOpt.SetODFRecalcOptions(bHardRecalc ? RECALC_ALWAYS : RECALC_NEVER); /* XXX is this really supposed to set the ScModule options? * Not the ScDocShell options? */ - SC_MOD()->SetFormulaOptions(aOpt); + mod->SetFormulaOptions(aOpt); batch->commit(); } @@ -782,7 +784,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) { #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT // the readonly documents should not be opened in shared mode - if ( HasSharedXMLFlagSet() && !SC_MOD()->IsInSharedDocLoading() && !IsReadOnly() ) + if ( HasSharedXMLFlagSet() && !ScModule::get()->IsInSharedDocLoading() && !IsReadOnly() ) { if ( SwitchToShared( true, false ) ) { @@ -815,10 +817,10 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) #endif #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT - if ( IsDocShared() && !SC_MOD()->IsInSharedDocLoading() + if (ScModule* mod = ScModule::get(); IsDocShared() && !mod->IsInSharedDocLoading() && !comphelper::LibreOfficeKit::isActive() ) { - ScAppOptions aAppOptions = SC_MOD()->GetAppOptions(); + ScAppOptions aAppOptions = mod->GetAppOptions(); if ( aAppOptions.GetShowSharedDocumentWarning() ) { MessageWithCheck aWarningBox(ScDocShell::GetActiveDialogParent(), @@ -829,7 +831,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) if (bChecked) { aAppOptions.SetShowSharedDocumentWarning(false); - SC_MOD()->SetAppOptions( aAppOptions ); + mod->SetAppOptions(aAppOptions); } } } @@ -886,7 +888,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) case SfxEventHintId::SaveDoc: { #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT - if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() ) + if (ScModule* mod = ScModule::get(); IsDocShared() && !mod->IsInSharedDocSaving()) { bool bSuccess = false; bool bRetry = true; @@ -1023,9 +1025,9 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) pValues[aValues.getLength() - 1].Value = pEncryptionItem->GetValue(); } - SC_MOD()->SetInSharedDocSaving( true ); + mod->SetInSharedDocSaving(true); GetModel()->storeToURL( GetSharedFileURL(), aValues ); - SC_MOD()->SetInSharedDocSaving( false ); + mod->SetInSharedDocSaving(false); if ( bChangedViewSettings ) { @@ -1066,7 +1068,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) catch ( uno::Exception& ) { TOOLS_WARN_EXCEPTION( "sc", "SfxEventHintId::SaveDoc" ); - SC_MOD()->SetInSharedDocSaving( false ); + mod->SetInSharedDocSaving(false); try { @@ -1167,7 +1169,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) uno::Any aWorkbook; aWorkbook <<= mxAutomationWorkbookObject; uno::Sequence< uno::Any > aArgs{ aWorkbook }; - SC_MOD()->CallAutomationApplicationEventSinks( u"NewWorkbook"_ustr, aArgs ); + ScModule::get()->CallAutomationApplicationEventSinks(u"NewWorkbook"_ustr, aArgs); } break; case SfxEventHintId::OpenDoc: @@ -1175,7 +1177,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) uno::Any aWorkbook; aWorkbook <<= mxAutomationWorkbookObject; uno::Sequence< uno::Any > aArgs{ aWorkbook }; - SC_MOD()->CallAutomationApplicationEventSinks( u"WorkbookOpen"_ustr, aArgs ); + ScModule::get()->CallAutomationApplicationEventSinks(u"WorkbookOpen"_ustr, aArgs); } break; default: @@ -1870,7 +1872,7 @@ void popFileName(OUString& rPath) void ScDocShell::TerminateEditing() { // Commit any cell changes before saving. - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); } bool ScDocShell::SaveAs( SfxMedium& rMedium ) @@ -2638,7 +2640,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) if (m_pDocument->GetTableCount() > 1) { - if (!rMed.GetErrorIgnoreWarning() && SC_MOD()->GetInputOptions().GetWarnActiveSheet()) + if (!rMed.GetErrorIgnoreWarning() && ScModule::get()->GetInputOptions().GetWarnActiveSheet()) { if (ScTabViewShell* pViewShell = GetBestViewShell()) pViewShell->ExecuteOnlyActiveSheetSavedDlg(); @@ -2741,7 +2743,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) bRet = true; if (m_pDocument->GetTableCount() > 1) - if (!rMed.GetErrorIgnoreWarning() && SC_MOD()->GetInputOptions().GetWarnActiveSheet()) + if (!rMed.GetErrorIgnoreWarning() && ScModule::get()->GetInputOptions().GetWarnActiveSheet()) rMed.SetError(SCWARN_EXPORT_ASCII); } } @@ -2843,7 +2845,7 @@ bool ScDocShell::QuerySlotExecutable( sal_uInt16 nSlotId ) bool ScDocShell::PrepareClose( bool bUI ) { - if(SC_MOD()->GetCurRefDlgId()>0) + if (ScModule::get()->GetCurRefDlgId() > 0) { SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); if( pFrame ) @@ -2966,7 +2968,7 @@ ScDocShell::ScDocShell( const SfxModelFlags i_nSfxCreationFlags, const std::shar m_nDocumentLock ( 0 ), m_nCanUpdate (css::document::UpdateDocMode::ACCORDING_TO_CONFIG) { - SetPool( &SC_MOD()->GetPool() ); + SetPool(&ScModule::get()->GetPool()); m_bIsInplace = (GetCreateMode() == SfxObjectCreateMode::EMBEDDED); // Will be reset if not in place @@ -3075,7 +3077,7 @@ void ScDocShell::SetDocumentModified() ScDetOpList* pList = m_pDocument->GetDetOpList(); if ( pList && ( m_pDocument->IsDetectiveDirty() || pList->HasAddError() ) && - pList->Count() && !IsInUndo() && SC_MOD()->GetAppOptions().GetDetectiveAuto() ) + pList->Count() && !IsInUndo() && ScModule::get()->GetAppOptions().GetDetectiveAuto() ) { GetDocFunc().DetectiveRefresh(true); // sal_True = caused by automatic update } @@ -3126,7 +3128,7 @@ void ScDocShell::SetDrawModified() m_pDocument->UpdateChartListenerCollection(); SfxGetpApp()->Broadcast(SfxHint( SfxHintId::ScDrawChanged )); // Navigator } - SC_MOD()->AnythingChanged(); + ScModule::get()->AnythingChanged(); } void ScDocShell::SetInUndo(bool bSet) diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index e8f40c8b2bdc..cff0de599843 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -385,7 +385,7 @@ void ScDocShell::CalcOutputFactor() return; } - bool bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg(); + bool bTextWysiwyg = ScModule::get()->GetInputOptions().GetTextWysiwyg(); if (bTextWysiwyg) { m_nPrtToScreenFactor = 1.0; @@ -431,7 +431,7 @@ void ScDocShell::InitOptions(bool bForLoading) // called from InitNew and L LanguageType nDefLang, nCjkLang, nCtlLang; ScModule::GetSpellSettings( nDefLang, nCjkLang, nCtlLang ); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScDocOptions aDocOpt = pScMod->GetDocOptions(); ScFormulaOptions aFormulaOpt = pScMod->GetFormulaOptions(); @@ -513,10 +513,10 @@ sal_uInt16 ScDocShell::SetPrinter( VclPtr const & pNewPrinter, SfxPr CalcOutputFactor(); */ - if ( SC_MOD()->GetInputOptions().GetTextWysiwyg() ) + ScModule* pScMod = ScModule::get(); + if (pScMod->GetInputOptions().GetTextWysiwyg()) UpdateFontList(); - ScModule* pScMod = SC_MOD(); SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this ); while (pFrame) { diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 9b8a00a3ea4d..8253bec2869b 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -146,7 +146,7 @@ ScLkUpdMode ScDocShell::GetLinkUpdateModeState() const nSet = GetDocument().GetLinkMode(); if (nSet == LM_UNKNOWN) { - ScAppOptions aAppOptions = SC_MOD()->GetAppOptions(); + ScAppOptions aAppOptions = ScModule::get()->GetAppOptions(); nSet = aAppOptions.GetLinkMode(); } } @@ -417,7 +417,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) break; } - if (SC_MOD()->IsEditMode()) + if (ScModule::get()->IsEditMode()) { if (EditView* pEditView = pViewData->GetEditView(pViewData->GetActivePart())) { @@ -979,14 +979,15 @@ void ScDocShell::Execute( SfxRequest& rReq ) { EnableSharedSettings( true ); - SC_MOD()->SetInSharedDocSaving( true ); + ScModule* mod = ScModule::get(); + mod->SetInSharedDocSaving(true); if ( !SwitchToShared( true, true ) ) { // TODO/LATER: what should be done in case the switch has failed? // for example in case the user has cancelled the saveAs operation } - SC_MOD()->SetInSharedDocSaving( false ); + mod->SetInSharedDocSaving(false); InvalidateName(); GetUndoManager()->Clear(); @@ -1108,7 +1109,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) catch ( uno::Exception& ) { TOOLS_WARN_EXCEPTION( "sc", "SID_SHARE_DOC" ); - SC_MOD()->SetInSharedDocSaving( false ); + ScModule::get()->SetInSharedDocSaving(false); try { @@ -1295,7 +1296,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) { if ( ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell() ) { - ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewSh); + ScInputHandler* pInputHandler = ScModule::get()->GetInputHdl(pViewSh); if ( pInputHandler ) pInputHandler->UpdateSpellSettings(); @@ -1611,7 +1612,7 @@ void ScDocShell::DoRecalc( bool bApi ) ScDocShellRecalcGuard aGuard(*m_pDocument); bool bDone = false; ScTabViewShell* pSh = GetBestViewShell(); - ScInputHandler* pHdl = ( pSh ? SC_MOD()->GetInputHdl( pSh ) : nullptr ); + ScInputHandler* pHdl = (pSh ? ScModule::get()->GetInputHdl(pSh) : nullptr); if ( pSh ) { if ( pHdl && pHdl->IsInputMode() && pHdl->IsFormulaMode() && !bApi ) @@ -2896,9 +2897,10 @@ void ScDocShell::EnableSharedSettings( bool bEnable ) uno::Reference< frame::XModel > ScDocShell::LoadSharedDocument() { uno::Reference< frame::XModel > xModel; + ScModule* mod = ScModule::get(); try { - SC_MOD()->SetInSharedDocLoading( true ); + mod->SetInSharedDocLoading(true); uno::Reference< frame::XDesktop2 > xLoader = frame::Desktop::create( ::comphelper::getProcessComponentContext() ); uno::Sequence aArgs{ comphelper::makePropertyValue(u"Hidden"_ustr, true) }; @@ -2925,12 +2927,12 @@ uno::Reference< frame::XModel > ScDocShell::LoadSharedDocument() xModel.set( xLoader->loadComponentFromURL( GetSharedFileURL(), u"_blank"_ustr, 0, aArgs ), uno::UNO_QUERY_THROW ); - SC_MOD()->SetInSharedDocLoading( false ); + mod->SetInSharedDocLoading(false); } catch ( uno::Exception& ) { OSL_FAIL( "ScDocShell::LoadSharedDocument(): caught exception" ); - SC_MOD()->SetInSharedDocLoading( false ); + mod->SetInSharedDocLoading(false); try { uno::Reference< util::XCloseable > xClose( xModel, uno::UNO_QUERY_THROW ); diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index f82b9da9fa82..a453d51793f0 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -438,7 +438,7 @@ void ScDocShell::SetFormulaOptions( const ScFormulaOptions& rOpt, bool bForLoadi { bool bForceInit = bInitOnce; bInitOnce = false; - if (bForceInit || rOpt.GetUseEnglishFuncName() != SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName()) + if (bForceInit || rOpt.GetUseEnglishFuncName() != ScModule::get()->GetFormulaOptions().GetUseEnglishFuncName()) { // This needs to be called first since it may re-initialize the entire // opcode map. @@ -479,7 +479,7 @@ void ScDocShell::CheckConfigOptions() OUString aDecSep = ScGlobal::getLocaleData().getNumDecimalSep(); OUString aDecSepAlt = ScGlobal::getLocaleData().getNumDecimalSepAlt(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); const ScFormulaOptions& rOpt=pScMod->GetFormulaOptions(); const OUString& aSepArg = rOpt.GetFormulaSepArg(); const OUString& aSepArrRow = rOpt.GetFormulaSepArrayRow(); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 6e078d63041e..a5b7fd9e6f49 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -935,7 +935,7 @@ namespace { OUString getFirstSheetName() { // Get Custom prefix. - const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions(); + const ScDefaultsOptions& rOpt = ScModule::get()->GetDefaultsOptions(); // Form sheet name identical to the first generated sheet name when // creating an internal document, e.g. 'Sheet1'. return rOpt.GetInitTabPrefix() + "1"; diff --git a/sc/source/ui/docshell/sizedev.cxx b/sc/source/ui/docshell/sizedev.cxx index 65e03375bb7a..c6e040bbb654 100644 --- a/sc/source/ui/docshell/sizedev.cxx +++ b/sc/source/ui/docshell/sizedev.cxx @@ -27,7 +27,7 @@ ScSizeDeviceProvider::ScSizeDeviceProvider( ScDocShell* pDocSh ) { - bool bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg(); + bool bTextWysiwyg = ScModule::get()->GetInputOptions().GetTextWysiwyg(); if ( bTextWysiwyg ) { pDevice = pDocSh->GetPrinter(); diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 9705a405b641..a44532a05907 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -271,7 +271,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr pDlg( - pFact->CreateInsertObjectDialog( rViewShell.GetFrameWeld(), SC_MOD()->GetSlotPool()->GetSlot(nSlot)->GetCommand(), + pFact->CreateInsertObjectDialog( rViewShell.GetFrameWeld(), ScModule::get()->GetSlotPool()->GetSlot(nSlot)->GetCommand(), xStorage, &aServerLst )); if ( pDlg ) { diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index 7d0174380722..6bb680cd49a2 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -441,7 +441,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) } } - if (SC_MOD()->GetIsWaterCan()) + if (ScModule::get()->GetIsWaterCan()) { auto pStyleSheet = rViewData.GetDocument().GetStyleSheetPool()->GetActualStyleSheet(); if (pStyleSheet && pStyleSheet->GetFamily() == SfxStyleFamily::Frame) @@ -454,7 +454,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) if (pIPClient) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF; if ( pIPClient->IsObjectInPlaceActive() && !bUnoRefDialog ) diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index f88bab70740c..fb7fa43ba54c 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -188,8 +188,7 @@ void ScFunctionWin::UpdateLRUList() { if (pFuncDesc && pFuncDesc->nFIndex!=0) { - ScModule* pScMod = SC_MOD(); - pScMod->InsertEntryToLRUList(pFuncDesc->nFIndex); + ScModule::get()->InsertEntryToLRUList(pFuncDesc->nFIndex); } } @@ -388,7 +387,7 @@ void ScFunctionWin::DoEnter(bool bDoubleOrEnter) if(!aString.isEmpty()) { OUString aFirstArgStr; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScTabViewShell* pViewSh = dynamic_cast( pCurSh ); ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh ); if(!pScMod->IsEditMode()) diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index e92de5aca844..9af2adbe7472 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -63,7 +63,7 @@ ScFormulaDlg::ScFormulaDlg(SfxBindings* pB, SfxChildWindow* pCW, , m_pViewShell( nullptr ) { m_aHelper.SetDialog(m_xDialog.get()); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); pScMod->InputEnterHandler(); m_pViewShell = nullptr; @@ -94,7 +94,7 @@ ScFormulaDlg::ScFormulaDlg(SfxBindings* pB, SfxChildWindow* pCW, m_xOpCodeMapper.set(ScServiceProvider::MakeInstance(ScServiceProvider::Type::OPCODEMAPPER, m_pDoc->GetDocumentShell()), uno::UNO_QUERY); - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(m_pViewShell); + ScInputHandler* pInputHdl = pScMod->GetInputHdl(m_pViewShell); assert(pInputHdl && "Missing input handler :-/"); @@ -185,7 +185,7 @@ void ScFormulaDlg::notifyChange() void ScFormulaDlg::fill() { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScFormEditData* pData = static_cast(getFormEditData()); notifyChange(); OUString rStrExp; @@ -239,7 +239,7 @@ ScFormulaDlg::~ScFormulaDlg() COVERITY_NOEXCEPT_FALSE if (pData) // close doesn't destroy; { //set back reference input handler - SC_MOD()->SetRefInputHdl(nullptr); + ScModule::get()->SetRefInputHdl(nullptr); StoreFormEditData(pData); } @@ -499,8 +499,7 @@ void ScFormulaDlg::SaveLRUEntry(const ScFuncDesc* pFuncDescP) { if (pFuncDescP && pFuncDescP->nFIndex!=0) { - ScModule* pScMod = SC_MOD(); - pScMod->InsertEntryToLRUList(pFuncDescP->nFIndex); + ScModule::get()->InsertEntryToLRUList(pFuncDescP->nFIndex); } } @@ -582,7 +581,7 @@ void ScFormulaDlg::clear() m_pDoc = nullptr; //restore reference inputhandler - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); pScMod->SetRefInputHdl(nullptr); // force Enable() of edit line @@ -626,7 +625,7 @@ formula::FormEditData* ScFormulaDlg::getFormEditData() const } void ScFormulaDlg::setCurrentFormula(const OUString& _sReplacement) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); { //fdo#69971 We need the EditEngine Modification handler of the inputbar that we //are feeding to be disabled while this dialog is open. Otherwise we end up in @@ -648,13 +647,11 @@ void ScFormulaDlg::setCurrentFormula(const OUString& _sReplacement) } void ScFormulaDlg::setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) { - ScModule* pScMod = SC_MOD(); - pScMod->InputSetSelection( _nStart, _nEnd ); + ScModule::get()->InputSetSelection(_nStart, _nEnd); } void ScFormulaDlg::getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const { - ScModule* pScMod = SC_MOD(); - pScMod->InputGetSelection( _nStart, _nEnd ); + ScModule::get()->InputGetSelection(_nStart, _nEnd); } OUString ScFormulaDlg::getCurrentFormula() const { diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index b6a642ba3758..5fdbdc7568ce 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -165,7 +165,7 @@ public: virtual ~ScValidationDlg() override; static std::shared_ptr Find1AliveObject(const weld::Window *pAncestor) { - return SC_MOD()->Find1RefWindow(SLOTID, pAncestor); + return ScModule::get()->Find1RefWindow(SLOTID, pAncestor); } ScTabViewShell *GetTabViewShell() { diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index b93d10aec8fc..9a14f39a57ca 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -805,7 +805,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, RefHandle, SvxTPFilter*, void) { sal_uInt16 nId =ScSimpleRefDlgWrapper::GetChildWindowId(); - SC_MOD()->SetRefDialog( nId, true ); + ScModule::get()->SetRefDialog(nId, true); SfxViewFrame& rViewFrm = pViewData->GetViewShell()->GetViewFrame(); ScSimpleRefDlgWrapper* pWnd = static_cast(rViewFrm.GetChildWindow( nId )); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 579a61ee23a9..18f3260718b0 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -53,7 +53,7 @@ ScFormulaReferenceHelper::ScFormulaReferenceHelper(IAnyRefDialog* _pDlg,SfxBindi , m_nRefTab(0) , m_bHighlightRef(false) { - ScInputOptions aInputOption=SC_MOD()->GetInputOptions(); + ScInputOptions aInputOption = ScModule::get()->GetInputOptions(); m_bEnableColorRef=aInputOption.GetRangeFinder(); } @@ -68,7 +68,7 @@ void ScFormulaReferenceHelper::dispose() HideReference(); enableInput( true ); - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHdl = ScModule::get()->GetInputHdl(); if ( pInputHdl ) pInputHdl->ResetDelayTimer(); // stop the timer for disabling the input line @@ -444,7 +444,7 @@ void ScFormulaReferenceHelper::DoClose( sal_uInt16 nId ) if (pMyDisp) pMyViewFrm = pMyDisp->GetFrame(); } - SC_MOD()->SetRefDialog( nId, false, pMyViewFrm ); + ScModule::get()->SetRefDialog(nId, false, pMyViewFrm); pSfxApp->Broadcast( SfxHint( SfxHintId::ScKillEditView ) ); @@ -589,7 +589,8 @@ bool ScRefHandler::EnterRefMode() { if( m_bInRefMode ) return false; - SC_MOD()->InputEnterHandler(); + ScModule* mod = ScModule::get(); + mod->InputEnterHandler(); ScTabViewShell* pScViewShell = nullptr; @@ -617,7 +618,7 @@ bool ScRefHandler::EnterRefMode() if ( pParentDoc ) m_aDocName = pParentDoc->GetTitle(); - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(pScViewShell); + ScInputHandler* pInputHdl = mod->GetInputHdl(pScViewShell); OSL_ENSURE( pInputHdl, "Missing input handler :-/" ); diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index 61727c62919e..a8dbe981d386 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -499,7 +499,7 @@ void ScAutoFmtPreview::DoPaint(vcl::RenderContext& rRenderContext) Size aWndSize(GetOutputSizePixel()); vcl::Font aFont(aVD->GetFont()); - const Color& aBackCol = SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor; + const Color& aBackCol = ScModule::get()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor; tools::Rectangle aRect(Point(), aWndSize); aFont.SetTransparent( true ); diff --git a/sc/source/ui/miscdlgs/onlyactivesheetsaveddlg.cxx b/sc/source/ui/miscdlgs/onlyactivesheetsaveddlg.cxx index 6941616309ce..e22c32959740 100644 --- a/sc/source/ui/miscdlgs/onlyactivesheetsaveddlg.cxx +++ b/sc/source/ui/miscdlgs/onlyactivesheetsaveddlg.cxx @@ -31,7 +31,7 @@ ScOnlyActiveSheetSavedDlg::ScOnlyActiveSheetSavedDlg(weld::Window* pParent) short ScOnlyActiveSheetSavedDlg::run() { short nRet = RET_YES; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); assert(pScMod); if (pScMod->GetInputOptions().GetWarnActiveSheet()) { diff --git a/sc/source/ui/miscdlgs/warnbox.cxx b/sc/source/ui/miscdlgs/warnbox.cxx index 60119df4f028..c52d012a3cd5 100644 --- a/sc/source/ui/miscdlgs/warnbox.cxx +++ b/sc/source/ui/miscdlgs/warnbox.cxx @@ -35,12 +35,12 @@ ScReplaceWarnBox::ScReplaceWarnBox(weld::Window* pParent) short ScReplaceWarnBox::run() { short nRet = RET_YES; - if (SC_MOD()->GetInputOptions().GetReplaceCellsWarn()) + ScModule* pScMod = ScModule::get(); + if (pScMod->GetInputOptions().GetReplaceCellsWarn()) { nRet = MessageDialogController::run(); if (!m_xWarningOnBox->get_active()) { - ScModule* pScMod = SC_MOD(); ScInputOptions aInputOpt(pScMod->GetInputOptions()); aInputOpt.SetReplaceCellsWarn(false); pScMod->SetInputOptions(aInputOpt); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index c0e06a0f2b01..51e7347b7254 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -195,7 +195,7 @@ void ScContentTree::InitRoot( ScContentId nType ) //It does not work in the constructor, that is why it is here. if (!m_pResLocaleForLOK) { - m_pResLocaleForLOK = std::make_unique(SC_MOD()->GetResLocale()); + m_pResLocaleForLOK = std::make_unique(ScModule::get()->GetResLocale()); } aName = Translate::get(SCSTR_CONTENT_ARY[static_cast(nType)], *m_pResLocaleForLOK); } @@ -1177,7 +1177,7 @@ static bool lcl_DoDragObject( ScDocShell* pSrcShell, std::u16string_view rName, pTransferObj->SetDragSourceObj( *pObject, nTab ); pTransferObj->SetDragSourceFlags(ScDragSrc::Navigator); - SC_MOD()->SetDragObject( nullptr, pTransferObj.get() ); + ScModule::get()->SetDragObject(nullptr, pTransferObj.get()); rtl::Reference xHelper(pTransferObj); rTreeView.enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK); @@ -1217,7 +1217,7 @@ static bool lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDra pTransferObj->SetDragSource( pSrcShell, aMark ); pTransferObj->SetDragSourceFlags( nFlags ); - SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D + ScModule::get()->SetDragObject(pTransferObj.get(), nullptr); // for internal D&D rtl::Reference xHelper(pTransferObj); rTreeView.enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK); @@ -1236,7 +1236,7 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool) bool bDisallow = true; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScContentId nType; sal_uLong nChild; @@ -1372,7 +1372,7 @@ void ScContentTree::SetRootType( ScContentId nNew ) nRootType = nNew; Refresh(); - ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); + ScNavipiCfg& rCfg = ScModule::get()->GetNavipiCfg(); rCfg.SetRootType( nRootType ); } } diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 1710937db9d9..d75d7088e81c 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -375,7 +375,7 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, weld::Widget* pParent, SfxNaviga m_xDragModeMenu->connect_activate(LINK(this, ScNavigatorDlg, MenuSelectHdl)); m_xTbxCmd2->connect_menu_toggled(LINK(this, ScNavigatorDlg, ToolBoxDropdownClickHdl)); - ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); + ScNavipiCfg& rCfg = ScModule::get()->GetNavipiCfg(); nDropMode = rCfg.GetDragMode(); m_xLbDocuments->set_size_request(42, -1); // set a nominal width so it takes width of surroundings @@ -579,7 +579,7 @@ void ScNavigatorDlg::SetDropMode(sal_uInt16 nNew) { nDropMode = nNew; UpdateButtons(); - ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); + ScNavipiCfg& rCfg = ScModule::get()->GetNavipiCfg(); rCfg.SetDragMode(nDropMode); } @@ -808,7 +808,7 @@ void ScNavigatorDlg::SetListMode(NavListMode eMode) if (eMode != NAV_LMODE_NONE) { - ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); + ScNavipiCfg& rCfg = ScModule::get()->GetNavipiCfg(); rCfg.SetListMode( static_cast(eMode) ); } diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx index dd2045a4b67b..650e5b78fb12 100644 --- a/sc/source/ui/optdlg/opredlin.cxx +++ b/sc/source/ui/optdlg/opredlin.cxx @@ -79,7 +79,8 @@ OUString ScRedlineOptionsTabPage::GetAllStrings() bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) { - ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); + ScModule* mod = ScModule::get(); + ScAppOptions aAppOptions = mod->GetAppOptions(); Color nNew = m_xContentColorLB->GetSelectEntryColor(); aAppOptions.SetTrackContentColor(nNew); @@ -93,7 +94,7 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) nNew = m_xRemoveColorLB->GetSelectEntryColor(); aAppOptions.SetTrackDeleteColor(nNew); - SC_MOD()->SetAppOptions(aAppOptions); + mod->SetAppOptions(aAppOptions); // repaint (if everything would be done by Items (how it should be), // this wouldn't be necessary) @@ -106,7 +107,7 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) void ScRedlineOptionsTabPage::Reset( const SfxItemSet* /* rSet */ ) { - ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); + ScAppOptions aAppOptions = ScModule::get()->GetAppOptions(); Color nColor = aAppOptions.GetTrackContentColor(); m_xContentColorLB->SelectEntry(nColor); diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx index 80facba4ae9c..a87b93b25804 100644 --- a/sc/source/ui/optdlg/tpprint.cxx +++ b/sc/source/ui/optdlg/tpprint.cxx @@ -65,7 +65,7 @@ void ScTpPrintOptions::Reset( const SfxItemSet* rCoreSet ) else { // when called from print dialog and no options set, use configuration - aOptions = SC_MOD()->GetPrintOptions(); + aOptions = ScModule::get()->GetPrintOptions(); } if ( const SfxBoolItem* pItem = rCoreSet->GetItemIfSet( SID_PRINT_SELECTEDSHEET, false)) diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index c105b5bfd194..f3871b9c7659 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -599,9 +599,10 @@ bool ScTpLayoutOptions::FillItemSet( SfxItemSet* rCoreSet ) { if(pDoc) pDoc->SetLinkMode(nSet); - ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); + ScModule* mod = ScModule::get(); + ScAppOptions aAppOptions = mod->GetAppOptions(); aAppOptions.SetLinkMode(nSet ); - SC_MOD()->SetAppOptions(aAppOptions); + mod->SetAppOptions(aAppOptions); bRet = true; } if (m_xAlignCB->get_state_changed_from_saved()) @@ -731,7 +732,7 @@ void ScTpLayoutOptions::Reset( const SfxItemSet* rCoreSet ) if(nSet==LM_UNKNOWN) { - ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); + ScAppOptions aAppOptions = ScModule::get()->GetAppOptions(); nSet=aAppOptions.GetLinkMode(); } diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index 134d5c256e37..0148f8f4f52e 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -99,7 +99,7 @@ StringMap ScGridWinUIObject::get_state() nCol = 0; aMap[u"CurrentRowHasData"_ustr] = OUString::boolean( rDoc.GetPrintAreaHor( mxGridWindow->getViewData().GetTabNo(), nRow, nRow, nCol ) ); - ScAppOptions aOpt = SC_MOD()->GetAppOptions(); + ScAppOptions aOpt = ScModule::get()->GetAppOptions(); aMap[u"Zoom"_ustr] = OUString::number( aOpt.GetZoom() ); return aMap; } @@ -334,9 +334,9 @@ void ScGridWinUIObject::execute(const OUString& rAction, OUString aVal = itr->second; sal_Int32 nVal = aVal.toInt32(); ScTabViewShell* pViewShell = getViewShell(); - ScModule* pScMod = SC_MOD(); if( nVal ) { + ScModule* pScMod = ScModule::get(); ScAppOptions aNewOpt = pScMod->GetAppOptions(); aNewOpt.SetZoom( nVal ); pScMod->SetAppOptions( aNewOpt ); diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx index 2dfa827f8c10..99bfb2f68d62 100644 --- a/sc/source/ui/undo/undostyl.cxx +++ b/sc/source/ui/undo/undostyl.cxx @@ -109,7 +109,7 @@ static void lcl_DocStyleChanged( ScDocument* pDoc, const SfxStyleSheetBase* pSty Fraction aZoom(1,1); pDoc->StyleSheetChanged( pStyle, bRemoved, pVDev, nPPTX, nPPTY, aZoom, aZoom ); - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(); if (pHdl) pHdl->ForgetLastPattern(); } diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx index bda4c87b1f54..3efb02f574f1 100644 --- a/sc/source/ui/unoobj/appluno.cxx +++ b/sc/source/ui/unoobj/appluno.cxx @@ -137,7 +137,7 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( { SolarMutexGuard aGuard; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScAppOptions aAppOpt(pScMod->GetAppOptions()); ScInputOptions aInpOpt(pScMod->GetInputOptions()); bool bSaveApp = false; @@ -288,7 +288,7 @@ uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aProp SolarMutexGuard aGuard; uno::Any aRet; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScAppOptions aAppOpt = pScMod->GetAppOptions(); const ScInputOptions& aInpOpt = pScMod->GetInputOptions(); // print options aren't loaded until needed @@ -364,7 +364,7 @@ ScRecentFunctionsObj_get_implementation(css::uno::XComponentContext*, css::uno:: uno::Sequence SAL_CALL ScRecentFunctionsObj::getRecentFunctionIds() { SolarMutexGuard aGuard; - const ScAppOptions& rOpt = SC_MOD()->GetAppOptions(); + const ScAppOptions& rOpt = ScModule::get()->GetAppOptions(); sal_uInt16 nCount = rOpt.GetLRUFuncListCount(); const sal_uInt16* pFuncs = rOpt.GetLRUFuncList(); if (pFuncs) @@ -389,7 +389,7 @@ void SAL_CALL ScRecentFunctionsObj::setRecentFunctionIds( for (sal_uInt16 i=0; i(pAry[i]); //! check for valid values? - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScAppOptions aNewOpts(pScMod->GetAppOptions()); aNewOpts.SetLRUFuncList(pFuncs.get(), nCount); pScMod->SetAppOptions(aNewOpts); diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 7adf05662b9d..6e6fa79defcf 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -196,7 +196,7 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( break; case css::document::LinkUpdateModes::GLOBAL_SETTING: default: - eMode = SC_MOD()->GetAppOptions().GetLinkMode(); + eMode = ScModule::get()->GetAppOptions().GetLinkMode(); break; } rDoc.SetLinkMode( eMode ); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 81e6e039e3f7..20c33cb669e0 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -255,7 +255,7 @@ public: ScPrintUIOptions::ScPrintUIOptions() { - const ScPrintOptions& rPrintOpt = SC_MOD()->GetPrintOptions(); + const ScPrintOptions& rPrintOpt = ScModule::get()->GetPrintOptions(); sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1; bool bSuppress = rPrintOpt.GetSkipEmpty(); @@ -340,7 +340,7 @@ void ScPrintUIOptions::SetDefaults() { // re-initialize the default values from print options - const ScPrintOptions& rPrintOpt = SC_MOD()->GetPrintOptions(); + const ScPrintOptions& rPrintOpt = ScModule::get()->GetPrintOptions(); sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1; bool bSuppress = rPrintOpt.GetSkipEmpty(); @@ -864,7 +864,7 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY) if (aChartHelper.setTextSelection(nType, nX, nY)) return; - ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell); + ScInputHandler* pInputHandler = ScModule::get()->GetInputHdl(pViewShell); ScDrawView* pDrawView = pViewData->GetScDrawView(); bool bHandled = false; @@ -1099,7 +1099,7 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int if (ScTabViewShell* pViewShell = pViewData->GetViewShell()) pViewShell->SyncGridWindowMapModeFromDrawMapMode(); // sync zoom to Input Handler like ScTabViewShell::Activate does - if (ScInputHandler* pHdl = SC_MOD()->GetInputHdl()) + if (ScInputHandler* pHdl = ScModule::get()->GetInputHdl()) pHdl->SetRefScale(pViewData->GetZoomX(), pViewData->GetZoomY()); // refresh our view's take on other view's cursors & selections @@ -1293,8 +1293,7 @@ void ScModelObj::getPostItsPos(tools::JsonWriter& rJsonWriter) void ScModelObj::completeFunction(const OUString& rFunctionName) { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); - if (pHdl) + if (ScInputHandler* pHdl = ScModule::get()->GetInputHdl()) { assert(!rFunctionName.isEmpty()); pHdl->LOKPasteFunctionData(rFunctionName); @@ -1320,10 +1319,11 @@ void ScModelObj::initializeForTiledRendering(const css::uno::SequenceGetAppOptions()); + ScAppOptions aAppOptions(mod->GetAppOptions()); aAppOptions.SetAutoComplete(true); - SC_MOD()->SetAppOptions(aAppOptions); + mod->SetAppOptions(aAppOptions); OUString sThemeName; OUString sBackgroundThemeName; @@ -1343,10 +1343,10 @@ void ScModelObj::initializeForTiledRendering(const css::uno::SequenceGetInputOptions()); + ScInputOptions aInputOptions(mod->GetInputOptions()); aInputOptions.SetTextWysiwyg(true); aInputOptions.SetReplaceCellsWarn(false); - SC_MOD()->SetInputOptions(aInputOptions); + mod->SetInputOptions(aInputOptions); if (pDocShell) pDocShell->CalcOutputFactor(); @@ -3905,9 +3905,10 @@ void ScModelObj::enableAutomaticDeviceSelection(sal_Bool bForce) ScCalcConfig aConfig = ScInterpreter::GetGlobalConfig(); aConfig.mbOpenCLAutoSelect = true; ScInterpreter::SetGlobalConfig(aConfig); - ScFormulaOptions aOptions = SC_MOD()->GetFormulaOptions(); + ScModule* mod = ScModule::get(); + ScFormulaOptions aOptions = mod->GetFormulaOptions(); aOptions.SetCalcConfig(aConfig); - SC_MOD()->SetFormulaOptions(aOptions); + mod->SetFormulaOptions(aOptions); #if !HAVE_FEATURE_OPENCL (void) bForce; #else @@ -3920,9 +3921,10 @@ void ScModelObj::disableAutomaticDeviceSelection() ScCalcConfig aConfig = ScInterpreter::GetGlobalConfig(); aConfig.mbOpenCLAutoSelect = false; ScInterpreter::SetGlobalConfig(aConfig); - ScFormulaOptions aOptions = SC_MOD()->GetFormulaOptions(); + ScModule* mod = ScModule::get(); + ScFormulaOptions aOptions = mod->GetFormulaOptions(); aOptions.SetCalcConfig(aConfig); - SC_MOD()->SetFormulaOptions(aOptions); + mod->SetFormulaOptions(aOptions); } void ScModelObj::selectOpenCLDevice( sal_Int32 nPlatform, sal_Int32 nDevice ) diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 89d2ffc11af3..a55cd8880c58 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -186,7 +186,7 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder() // and gets set in ScTabViewObj::SelectionChanged() by // ScFormatShell::ScFormatShell which calls // SetPool( &pTabViewShell->GetPool() ); - pTmp.reset(new CellAttributeHelper(SC_MOD()->GetPool())); + pTmp.reset(new CellAttributeHelper(ScModule::get()->GetPool())); pCellAttributeDefault = &pTmp->getDefaultCellAttribute(); } diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index ab0bf810ee0b..6003c9f7e0ac 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -1422,7 +1422,7 @@ void ScTabViewObj::SetZoom(sal_Int16 nZoom) { if (!pViewSh->GetViewData().IsPagebreakMode()) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScAppOptions aNewOpt(pScMod->GetAppOptions()); aNewOpt.SetZoom( nZoom ); aNewOpt.SetZoomType( pViewSh->GetViewData().GetView()->GetZoomType() ); @@ -1851,7 +1851,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( { rViewData.SetFormulaBarLines(nIntVal); // Notify formula bar about changed lines - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHdl = ScModule::get()->GetInputHdl(); if (pInputHdl) { ScInputWindow* pInputWin = pInputHdl->GetInputWindow(); diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 3d15627aa7c5..03955113b200 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -148,7 +148,7 @@ ScVbaApplication::AddSink( const uno::Reference< XSink >& xSink ) ScDLL::Init(); } // No harm in potentially calling this several times - SC_MOD()->RegisterAutomationApplicationEventsCaller( uno::Reference< XSinkCaller >(this) ); + ScModule::get()->RegisterAutomationApplicationEventsCaller(uno::Reference(this)); mvSinks.push_back(xSink); return mvSinks.size(); } @@ -932,7 +932,7 @@ ScVbaApplication::setShowWindowsInTaskbar( sal_Bool bSet ) sal_Bool SAL_CALL ScVbaApplication::getIteration() { - return SC_MOD()->GetDocOptions().IsIter(); + return ScModule::get()->GetDocOptions().IsIter(); } void SAL_CALL @@ -954,9 +954,10 @@ ScVbaApplication::setIteration( sal_Bool bSet ) xProps->setPropertyValue( SC_UNO_ITERENABLED, uno::Any( bSet ) ); } } - ScDocOptions aOpts( SC_MOD()->GetDocOptions() ); + ScModule* mod = ScModule::get(); + ScDocOptions aOpts(mod->GetDocOptions()); aOpts.SetIter( bSet ); - SC_MOD()->SetDocOptions( aOpts ); + mod->SetDocOptions(aOpts); } void SAL_CALL diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 4b2fc7b99203..328cee53267e 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -211,7 +211,7 @@ void HandleConditionalFormat(sal_uInt32 nIndex, bool bCondFormatDlg, bool bConta SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame(); SfxChildWindow* pWnd = rViewFrm.GetChildWindow(nId); - SC_MOD()->SetRefDialog(nId, pWnd == nullptr); + ScModule::get()->SetRefDialog(nId, pWnd == nullptr); } } @@ -272,7 +272,7 @@ void DeleteCells(ScTabViewShell* pTabViewShell, SfxRequest &rReq, DelCellCmd eCm void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); SfxBindings& rBindings = pTabViewShell->GetViewFrame().GetBindings(); const SfxItemSet* pReqArgs = rReq.GetArgs(); @@ -3186,7 +3186,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const SfxInt32Item* param5 = rReq.GetArg(FN_PARAM_5); SCROW table = param5 ? param5->GetValue() : 0; - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHdl = pScMod->GetInputHdl(); if (param3 && param4 && pInputHdl) { @@ -3201,7 +3201,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScRange aRef( colStart, rowStart, rData.GetRefStartZ(), colEnd, rowEnd, rData.GetRefEndZ() ); - SC_MOD()->SetReference( aRef, rData.GetDocument(), &rData.GetMarkData() ); + pScMod->SetReference( aRef, rData.GetDocument(), &rData.GetMarkData() ); pInputHdl->UpdateLokReferenceMarks(); } @@ -3419,7 +3419,7 @@ void ErrorOrRunPivotLayoutDialog(TranslateId pSrcErrorId, void ScCellShell::ExecuteDataPilotDialog() { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); ScViewData& rData = GetViewData(); ScDocument& rDoc = rData.GetDocument(); @@ -3604,12 +3604,10 @@ void ScCellShell::ExecuteXMLSourceDialog() if (!pTabViewShell) return; - ScModule* pScMod = SC_MOD(); - sal_uInt16 nId = ScXMLSourceDlgWrapper::GetChildWindowId(); SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame(); SfxChildWindow* pWnd = rViewFrame.GetChildWindow(nId); - pScMod->SetRefDialog(nId, pWnd == nullptr); + ScModule::get()->SetRefDialog(nId, pWnd == nullptr); } void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) @@ -3721,7 +3719,7 @@ void ScCellShell::ExecuteFillSingleEdit() aInit = aCell.getString(&rDoc); } - SC_MOD()->SetInputMode(SC_INPUT_TABLE, &aInit); + ScModule::get()->SetInputMode(SC_INPUT_TABLE, &aInit); } CellShell_Impl::CellShell_Impl() : diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index f6577c7f16b5..38a2e62ac177 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -215,12 +215,12 @@ namespace ScValidationRegisteredDlg(weld::Window* pParent, std::shared_ptr xDlg) : m_xDlg(std::move(xDlg)) { - SC_MOD()->RegisterRefController(static_cast(ScValidationDlg::SLOTID), m_xDlg, pParent); + ScModule::get()->RegisterRefController(static_cast(ScValidationDlg::SLOTID), m_xDlg, pParent); } ~ScValidationRegisteredDlg() { m_xDlg->Close(); - SC_MOD()->UnregisterRefController(static_cast(ScValidationDlg::SLOTID), m_xDlg); + ScModule::get()->UnregisterRefController(static_cast(ScValidationDlg::SLOTID), m_xDlg); } }; } @@ -230,7 +230,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); sal_uInt16 nSlotId = rReq.GetSlot(); const SfxItemSet* pReqArgs = rReq.GetArgs(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index c4dbfe89833d..2e36d876bf33 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -156,7 +156,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); SfxBindings& rBindings = pTabViewShell->GetViewFrame().GetBindings(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); const SfxItemSet* pReqArgs = rReq.GetArgs(); sal_uInt16 nSlot = rReq.GetSlot(); @@ -284,7 +284,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) if (pReqArgs->HasItem(FN_PARAM_1, &pDontCommitItem)) bCommit = !(static_cast(pDontCommitItem)->GetValue()); - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pTabViewShell ); + ScInputHandler* pHdl = pScMod->GetInputHdl(pTabViewShell); if (bCommit) { pTabViewShell->EnterData( GetViewData().GetCurX(), @@ -295,7 +295,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else if (pHdl) { - SC_MOD()->SetInputMode(SC_INPUT_TABLE); + pScMod->SetInputMode(SC_INPUT_TABLE); EditView* pTableView = pHdl->GetActiveView(); pHdl->DataChanging(); @@ -303,7 +303,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) pTableView->getEditEngine().SetText(aStr); pHdl->DataChanged(); - SC_MOD()->SetInputMode(SC_INPUT_NONE); + pScMod->SetInputMode(SC_INPUT_NONE); } if ( !pHdl || !pHdl->IsInEnterHandler() ) @@ -750,7 +750,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) else { ScViewData& rData = GetViewData(); - FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eMetric = pScMod->GetAppOptions().GetAppMetric(); sal_uInt16 nCurHeight = rData.GetDocument(). GetRowHeight( rData.GetCurY(), rData.GetTabNo() ); @@ -793,7 +793,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else { - FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eMetric = pScMod->GetAppOptions().GetAppMetric(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); VclPtr pDlg(pFact->CreateScMetricInputDlg( @@ -855,7 +855,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else { - FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eMetric = pScMod->GetAppOptions().GetAppMetric(); ScViewData& rData = GetViewData(); sal_uInt16 nCurHeight = rData.GetDocument(). GetColWidth( rData.GetCurX(), @@ -898,7 +898,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else { - FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eMetric = pScMod->GetAppOptions().GetAppMetric(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); VclPtr pDlg(pFact->CreateScMetricInputDlg( diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx index bacbf2b98f90..754c5077e93a 100644 --- a/sc/source/ui/view/cellsh4.cxx +++ b/sc/source/ui/view/cellsh4.cxx @@ -415,12 +415,12 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq ) break; case SID_SETINPUTMODE: - SC_MOD()->SetInputMode( SC_INPUT_TABLE ); + ScModule::get()->SetInputMode(SC_INPUT_TABLE); break; case SID_FOCUS_INPUTLINE: { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pTabViewShell ); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(pTabViewShell); if (pHdl) { ScInputWindow* pWin = pHdl->GetInputWindow(); diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx index ab9e82282e12..58311147d5e2 100644 --- a/sc/source/ui/view/colrowba.cxx +++ b/sc/source/ui/view/colrowba.cxx @@ -41,7 +41,7 @@ static OUString lcl_MetricString( tools::Long nTwips, std::u16string_view rText return ScResId(STR_TIP_HIDE); else { - FieldUnit eUserMet = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eUserMet = ScModule::get()->GetAppOptions().GetAppMetric(); sal_Int64 nUserVal = vcl::ConvertValue( nTwips*100, 1, 2, FieldUnit::TWIP, eUserMet ); @@ -181,8 +181,7 @@ void ScColBar::SelectWindow() bool ScColBar::IsDisabled() const { - ScModule* pScMod = SC_MOD(); - return pScMod->IsModalMode(); + return ScModule::get()->IsModalMode(); } bool ScColBar::ResizeAllowed() const @@ -341,8 +340,7 @@ void ScRowBar::SelectWindow() bool ScRowBar::IsDisabled() const { - ScModule* pScMod = SC_MOD(); - return pScMod->IsModalMode(); + return ScModule::get()->IsModalMode(); } bool ScRowBar::ResizeAllowed() const diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index d6aba90aec66..df5615741958 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -97,7 +97,7 @@ void ScDrawView::BeginDrag( vcl::Window* pWindow, const Point& rStartPos ) pTransferObj->SetDrawPersist(aDragShellRef); // keep persist for ole objects alive pTransferObj->SetDragSource( this ); // copies selection - SC_MOD()->SetDragObject( nullptr, pTransferObj.get() ); // for internal D&D + ScModule::get()->SetDragObject(nullptr, pTransferObj.get()); // for internal D&D pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); } diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 8a6670d4f419..b0c5e396322e 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -359,6 +359,7 @@ void ScDrawView::MarkListHasChanged() ScTabViewShell* pViewSh = pViewData->GetViewShell(); const SdrMarkList& rMarkList = GetMarkedObjectList(); + ScModule* pScMod = ScModule::get(); // #i110829# remove the cell selection only if drawing objects are selected if ( !bInConstruct && rMarkList.GetMarkCount() ) @@ -366,12 +367,11 @@ void ScDrawView::MarkListHasChanged() pViewSh->Unmark(); // remove cell selection // end cell edit mode if drawing objects are selected - SC_MOD()->InputEnterHandler(); + pScMod->InputEnterHandler(); } // deactivate IP - ScModule* pScMod = SC_MOD(); bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF; ScClient* pClient = static_cast( pViewSh->GetIPClient() ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 3fa202c29a3f..f514a75e5402 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -121,7 +121,7 @@ ScEditShell::~ScEditShell() ScInputHandler* ScEditShell::GetMyInputHdl() { - return SC_MOD()->GetInputHdl( rViewData.GetViewShell() ); + return ScModule::get()->GetInputHdl(rViewData.GetViewShell()); } void ScEditShell::SetEditView(EditView* pView) @@ -287,7 +287,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) pDlg.disposeAndClear(); // while the dialog was open, edit mode may have been stopped - if (!SC_MOD()->IsInputMode()) + if (!ScModule::get()->IsInputMode()) return; if (nFormat != SotClipboardFormatId::NONE) @@ -427,7 +427,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) ScViewUtil::ExecuteCharMap(rItem, *rViewData.GetViewShell()); // while the dialog was open, edit mode may have been stopped - if (!SC_MOD()->IsInputMode()) + if (!ScModule::get()->IsInputMode()) return; } @@ -474,7 +474,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) // pDlg is needed below // while the dialog was open, edit mode may have been stopped - if (!SC_MOD()->IsInputMode()) + if (!ScModule::get()->IsInputMode()) return; if ( nRet == BTN_PASTE_NAME ) @@ -519,7 +519,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) // pDlg is needed below // while the dialog was open, edit mode may have been stopped - if (!SC_MOD()->IsInputMode()) + if (!ScModule::get()->IsInputMode()) return; if ( nRet == RET_OK ) @@ -573,7 +573,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) SvxLinkInsertMode eMode = pHyper->GetInsertMode(); bool bCellLinksOnly - = (SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel() + = (ScModule::get()->GetAppOptions().GetLinksInsertedLikeMSExcel() && rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat()) || comphelper::LibreOfficeKit::isActive(); @@ -779,7 +779,7 @@ void ScEditShell::GetState( SfxItemSet& rSet ) { SvxHyperlinkItem aHLinkItem; bool bCellLinksOnly - = (SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel() + = (ScModule::get()->GetAppOptions().GetLinksInsertedLikeMSExcel() && rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat()) || comphelper::LibreOfficeKit::isActive(); std::unique_ptr aSvxFieldDataPtr(GetURLField()); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 14040f8c7168..e8f1baf7e745 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -239,7 +239,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScTabViewShell* pTabViewShell = GetViewData().GetViewShell(); const SfxItemSet* pReqArgs = rReq.GetArgs(); sal_uInt16 nSlot = rReq.GetSlot(); @@ -1905,7 +1905,7 @@ void ScFormatShell::ExecuteTextDirection( const SfxRequest& rReq ) if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) ) { bEditMode=true; - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); pTabViewShell->UpdateInputHandler(); } sal_uInt16 nSlot = rReq.GetSlot(); @@ -1934,7 +1934,7 @@ void ScFormatShell::ExecuteTextDirection( const SfxRequest& rReq ) break; } if (bEditMode) - SC_MOD()->SetInputMode( SC_INPUT_TABLE ); + ScModule::get()->SetInputMode(SC_INPUT_TABLE); } void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet ) diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 5bb1f8f4c3fb..3a7447e170c0 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -511,7 +511,7 @@ IMPL_LINK( ScGridWindow, PopupSpellingHdl, SpellCallbackInfo&, rInfo, void ) else //IGNOREWORD, ADDTODICTIONARY, WORDLANGUAGE, PARALANGUAGE { // The spelling status of the word has changed. Close the cell to reset the caches - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(mrViewData.GetViewShell()); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(mrViewData.GetViewShell()); if (pHdl) pHdl->EnterHandler(); } @@ -1658,8 +1658,7 @@ void ScGridWindow::FilterSelect( sal_uLong nSel ) void ScGridWindow::ExecDataSelect( SCCOL nCol, SCROW nRow, const OUString& rStr ) { - ScModule* pScMod = SC_MOD(); - ScInputHandler* pViewHdl = pScMod->GetInputHdl(mrViewData.GetViewShell()); + ScInputHandler* pViewHdl = ScModule::get()->GetInputHdl(mrViewData.GetViewShell()); if (pViewHdl && mrViewData.HasEditView(mrViewData.GetActivePart())) pViewHdl->CancelHandler(); @@ -1862,7 +1861,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta bEEMouse = false; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (pScMod->IsModalMode(mrViewData.GetSfxDocShell())) return; @@ -2085,7 +2084,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta if (!bAutoFilterDisable && pRealPosAttr->HasAutoFilter()) { - SC_MOD()->InputEnterHandler(); + pScMod->InputEnterHandler(); if (DoAutoFilterButton(nPosX, nRealPosY, rMEvt)) return; } @@ -2247,7 +2246,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) return; // nothing more should happen here } - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (pScMod->IsModalMode(mrViewData.GetSfxDocShell())) return; @@ -2785,7 +2784,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) if (rMEvt.IsLeaveWindow() && mpNoteMarker && !mpNoteMarker->IsByKeyboard()) HideNoteMarker(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (pScMod->IsModalMode(mrViewData.GetSfxDocShell())) return; @@ -2909,7 +2908,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) } } - bool bWater = SC_MOD()->GetIsWaterCan() || mrViewData.GetView()->HasPaintBrush(); + bool bWater = pScMod->GetIsWaterCan() || mrViewData.GetView()->HasPaintBrush(); if (bWater) SetPointer( PointerStyle::Fill ); @@ -3082,7 +3081,7 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt ) if ( rTEvt.IsTrackingCanceled() ) // Cancel everything... { - if (!mrViewData.GetView()->IsInActivatePart() && !SC_MOD()->IsRefDialogOpen()) + if (!mrViewData.GetView()->IsInActivatePart() && !ScModule::get()->IsRefDialogOpen()) { if (bDPMouse) bDPMouse = false; // Paint for each bDragRect @@ -3109,7 +3108,7 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt ) bool bRefMode = mrViewData.IsRefMode(); if (bRefMode) - SC_MOD()->EndReference(); // Do not let the Dialog remain minimized + ScModule::get()->EndReference(); // Do not let the Dialog remain minimized } } else if ( rTEvt.IsTrackingEnded() ) @@ -3144,7 +3143,7 @@ void ScGridWindow::StartDrag( sal_Int8 /* nAction */, const Point& rPosPixel ) mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow ); // don't remove the edit view while switching views - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); pScMod->SetInEditCommand( true ); pEditView->Command( aDragEvent ); @@ -3196,7 +3195,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) return; } - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); OSL_ENSURE( nCmd != CommandEventId::StartDrag, "ScGridWindow::Command called with CommandEventId::StartDrag" ); if (nCmd == CommandEventId::ModKeyChange) @@ -3304,7 +3303,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) if (bDisable) return; - if (nCmd != CommandEventId::ContextMenu || SC_MOD()->GetIsWaterCan()) + if (nCmd != CommandEventId::ContextMenu || pScMod->GetIsWaterCan()) return; bool bMouse = rCEvt.IsMouseEvent(); @@ -3545,7 +3544,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S if ( mrViewData.HasEditView(eWhich) ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); SCCOL nEditStartCol = mrViewData.GetEditViewCol(); //! change to GetEditStartCol after calcrtl is integrated SCROW nEditStartRow = mrViewData.GetEditViewRow(); SCCOL nEditEndCol = mrViewData.GetEditEndCol(); @@ -3728,24 +3727,25 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) #endif - if( SC_MOD()->IsRefDialogOpen() ) + ScModule* mod = ScModule::get(); + if( mod->IsRefDialogOpen() ) { if( !rKeyCode.GetModifier() && (rKeyCode.GetCode() == KEY_F2) ) { - SC_MOD()->EndReference(); + mod->EndReference(); } else if( mrViewData.GetViewShell()->MoveCursorKeyInput( rKEvt ) ) { ScRange aRef( mrViewData.GetRefStartX(), mrViewData.GetRefStartY(), mrViewData.GetRefStartZ(), mrViewData.GetRefEndX(), mrViewData.GetRefEndY(), mrViewData.GetRefEndZ() ); - SC_MOD()->SetReference( aRef, mrViewData.GetDocument() ); + mod->SetReference(aRef, mrViewData.GetDocument()); } mrViewData.GetViewShell()->SelectionChanged(); return ; } else if( rKeyCode.GetCode() == KEY_RETURN && mrViewData.IsPasteMode() - && SC_MOD()->GetInputOptions().GetEnterPasteMode() ) + && mod->GetInputOptions().GetEnterPasteMode() ) { ScTabViewShell* pTabViewShell = mrViewData.GetViewShell(); ScClipUtil::PasteFromClipboard( mrViewData, pTabViewShell, true ); @@ -3849,8 +3849,7 @@ OUString ScGridWindow::GetSurroundingText() const bool bEditView = mrViewData.HasEditView(eWhich); if (bEditView) { - ScModule* pScMod = SC_MOD(); - ScInputHandler* pHdl = pScMod->GetInputHdl(mrViewData.GetViewShell()); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(mrViewData.GetViewShell()); if (pHdl) return pHdl->GetSurroundingText(); } @@ -3870,8 +3869,7 @@ Selection ScGridWindow::GetSurroundingTextSelection() const bool bEditView = mrViewData.HasEditView(eWhich); if (bEditView) { - ScModule* pScMod = SC_MOD(); - ScInputHandler* pHdl = pScMod->GetInputHdl(mrViewData.GetViewShell()); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(mrViewData.GetViewShell()); if (pHdl) return pHdl->GetSurroundingTextSelection(); } @@ -3891,8 +3889,7 @@ bool ScGridWindow::DeleteSurroundingText(const Selection& rSelection) bool bEditView = mrViewData.HasEditView(eWhich); if (bEditView) { - ScModule* pScMod = SC_MOD(); - ScInputHandler* pHdl = pScMod->GetInputHdl(mrViewData.GetViewShell()); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(mrViewData.GetViewShell()); if (pHdl) return pHdl->DeleteSurroundingText(rSelection); } @@ -4231,7 +4228,7 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt, const ScD sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) { - const ScDragData& rData = SC_MOD()->GetDragData(); + const ScDragData& rData = ScModule::get()->GetDragData(); if ( rEvt.mbLeaving ) { DrawMarkDropObj( nullptr ); @@ -4885,7 +4882,7 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) { DrawMarkDropObj( nullptr ); // drawing layer - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); const ScDragData& rData = pScMod->GetDragData(); if (rData.pCellTransfer) return ExecutePrivateDrop( rEvt, rData ); @@ -5022,7 +5019,7 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel ) } } - ScSelectionTransferObj* pOwnSelection = SC_MOD()->GetSelectionTransfer(); + ScSelectionTransferObj* pOwnSelection = ScModule::get()->GetSelectionTransfer(); if ( pOwnSelection ) { // within Calc @@ -5076,7 +5073,7 @@ void ScGridWindow::UpdateEditViewPos() // hide EditView? bool bHide = ( nEndColIsFormulaMode() ) + if (ScModule::get()->IsFormulaMode()) if ( mrViewData.GetTabNo() != mrViewData.GetRefTabNo() ) bHide = true; @@ -5351,7 +5348,7 @@ void ScGridWindow::GetFocus() if (pViewShell->HasAccessibilityObjects()) pViewShell->BroadcastAccessibility(ScAccGridWinFocusGotHint(eWhich)); - if ( !SC_MOD()->IsFormulaMode() ) + if (!ScModule::get()->IsFormulaMode()) { pViewShell->UpdateInputHandler(); // StopMarking(); // If Dialog (error), because then no ButtonUp @@ -5377,7 +5374,7 @@ bool ScGridWindow::HitRangeFinder( const Point& rMouse, RfCorner& rCorner, sal_uInt16* pIndex, SCCOL* pAddX, SCROW* pAddY) { bool bFound = false; - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( mrViewData.GetViewShell() ); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(mrViewData.GetViewShell()); if (pHdl) { ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList(); @@ -5611,7 +5608,7 @@ static void lcl_PaintRefChanged( ScDocShell* pDocSh, const ScRange& rOldUn, cons void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( mrViewData.GetViewShell() ); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(mrViewData.GetViewShell()); if (!pHdl) return; ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList(); @@ -6329,7 +6326,7 @@ void ScGridWindow::UpdateCopySourceOverlay() return; if (!mrViewData.ShowPasteSource()) return; - if (!SC_MOD()->GetInputOptions().GetEnterPasteMode()) + if (!ScModule::get()->GetInputOptions().GetEnterPasteMode()) return; rtl::Reference xOverlayManager = getOverlayManager(); if (!xOverlayManager.is()) @@ -6698,10 +6695,11 @@ void ScGridWindow::UpdateCursorOverlay() if (xOverlayManager.is()) { - Color aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; + ScModule* mod = ScModule::get(); + Color aCursorColor = mod->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; if (mrViewData.GetActivePart() != eWhich) // non-active pane uses a different color. - aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; + aCursorColor = mod->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; std::vector< basegfx::B2DRange > aRanges; const basegfx::B2DHomMatrix aTransform(GetOutDev()->GetInverseViewTransformation()); @@ -6860,7 +6858,7 @@ void ScGridWindow::UpdateSelectionOverlay() pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY"_ostr); SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "EMPTY"_ostr); - ScInputHandler* pViewHdl = SC_MOD()->GetInputHdl(pViewShell); + ScInputHandler* pViewHdl = ScModule::get()->GetInputHdl(pViewShell); if (!pViewHdl || !pViewHdl->IsEditMode()) { std::vector aReferenceMarks; @@ -6907,8 +6905,9 @@ void ScGridWindow::UpdateHighlightOverlay() } } - const Color aBackgroundColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; - Color aHighlightColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; + ScModule* mod = ScModule::get(); + const Color aBackgroundColor = mod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + Color aHighlightColor = mod->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; aHighlightColor.Merge(aBackgroundColor, 100); std::unique_ptr pOverlay(new sdr::overlay::OverlaySelection( @@ -7032,10 +7031,11 @@ void ScGridWindow::UpdateAutoFillOverlay() aRBInner.transform(aTransform); aRangesInner.push_back(aRBInner); - Color aHandleColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; + ScModule* mod = ScModule::get(); + Color aHandleColor = mod->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; if (mrViewData.GetActivePart() != eWhich) // non-active pane uses a different color. - aHandleColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; + aHandleColor = mod->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; std::unique_ptr pOverlayInner(new sdr::overlay::OverlaySelection( sdr::overlay::OverlayType::Solid, diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index b329e897d87c..7a13917fd917 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -456,8 +456,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod if (comphelper::LibreOfficeKit::isActive()) return; - ScModule* pScMod = SC_MOD(); - bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg(); + bool bTextWysiwyg = ScModule::get()->GetInputOptions().GetTextWysiwyg(); if (mrViewData.IsMinimized()) return; @@ -706,7 +705,7 @@ void ScGridWindow::DrawEditView(OutputDevice &rDevice, EditView *pEditView) void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, bool bLogicText) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScDocument& rDoc = mrViewData.GetDocument(); const ScViewOptions& rOpts = mrViewData.GetOptions(); bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); @@ -737,7 +736,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aOutputData.SetShowNullValues ( rOpts.GetOption( VOPT_NULLVALS ) ); aOutputData.SetShowFormulas ( rOpts.GetOption( VOPT_FORMULAS ) ); aOutputData.SetShowSpellErrors ( pCurTabViewShell && pCurTabViewShell->IsAutoSpell() ); - aOutputData.SetMarkClipped ( SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCTEXTOVERFLOW).bIsVisible ); + aOutputData.SetMarkClipped ( pScMod->GetColorConfig().GetColorValue(svtools::CALCTEXTOVERFLOW).bIsVisible ); aOutputData.SetUseStyleColor( true ); // always set in table view @@ -768,10 +767,10 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI if (officecfg::Office::Calc::Content::Display::EditCellBackgroundHighlighting::get()) { - Color aDocColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + Color aDocColor = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; if (!getViewData().GetMarkData().IsMarked() && mrViewData.GetEditHighlight()) { - Color aHighlightColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; + Color aHighlightColor = pScMod->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; aHighlightColor.Merge(aDocColor, 100); aDocColor = aHighlightColor; } @@ -1754,7 +1753,7 @@ void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) { ScTabView* pTabView = mrViewData.GetView(); ScTabViewShell* pViewShell = mrViewData.GetViewShell(); - ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell); + ScInputHandler* pInputHandler = ScModule::get()->GetInputHdl(pViewShell); if (pInputHandler && pInputHandler->IsInputMode()) { @@ -1844,7 +1843,7 @@ void ScGridWindow::DrawHiddenIndicator( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW n { ScDocument& rDoc = mrViewData.GetDocument(); SCTAB nTab = mrViewData.GetTabNo(); - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); const svtools::ColorConfigValue aColorValue = rColorCfg.GetColorValue(svtools::CALCHIDDENROWCOL); if (aColorValue.bIsVisible) { rRenderContext.SetLineColor(aColorValue.nColor); @@ -1883,7 +1882,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScDocument& rDoc = mrViewData.GetDocument(); SCTAB nTab = mrViewData.GetTabNo(); Size aWinSize = GetOutputSizePixel(); - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); Color aManual( rColorCfg.GetColorValue(svtools::CALCPAGEBREAKMANUAL).nColor ); Color aAutomatic( rColorCfg.GetColorValue(svtools::CALCPAGEBREAK).nColor ); @@ -2614,7 +2613,7 @@ void ScGridWindow::DataChanged( const DataChangedEvent& rDCEvt ) // EditEngine BackgroundColor has to be changed if ( mrViewData.IsActive() ) { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(); if (pHdl) pHdl->ForgetLastPattern(); } diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 7b7e18f2e644..ee8a90f92d70 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -146,7 +146,7 @@ void ScHeaderControl::DoPaint( SCCOLROW nStart, SCCOLROW nEnd ) void ScHeaderControl::SetMark( bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd ) { - bool bEnabled = SC_MOD()->GetInputOptions().GetMarkHeader(); //! cache? + bool bEnabled = ScModule::get()->GetInputOptions().GetMarkHeader(); //! cache? if (!bEnabled) bNewSet = false; @@ -243,7 +243,8 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools else SetTextColor((bBoldSet && !bHighContrast) ? aSelTextColor : aTextColor); - Color aSelLineColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; + ScModule* mod = ScModule::get(); + Color aSelLineColor = mod->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; aSelLineColor.Merge( COL_BLACK, 0xe0 ); // darken just a little bit bool bLayoutRTL = IsLayoutRTL(); @@ -336,7 +337,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools if ( nLineEnd * nLayoutSign < nPEnd * nLayoutSign ) { - GetOutDev()->SetFillColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::APPBACKGROUND).nColor ); + GetOutDev()->SetFillColor( mod->GetColorConfig().GetColorValue(svtools::APPBACKGROUND).nColor ); if ( bVertical ) aFillRect = tools::Rectangle( 0, nLineEnd+nLayoutSign, nBarSize-1, nPEnd ); else @@ -367,7 +368,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools { // background for selection GetOutDev()->SetLineColor(); - Color aColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; + Color aColor = mod->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; // merging the highlightcolor (which is used if accent does not exist) with the background // fails in many cases such as Breeze Dark (highlight is too close to background) and // Breeze Light (font color is white and not readable anymore) @@ -714,7 +715,7 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt ) return; if ( ! rMEvt.IsLeft() ) return; - if ( SC_MOD()->IsFormulaMode() ) + if (ScModule::get()->IsFormulaMode()) { if( !pTabView ) return; @@ -802,9 +803,9 @@ void ScHeaderControl::MouseButtonUp( const MouseEvent& rMEvt ) if ( IsDisabled() ) return; - if ( SC_MOD()->IsFormulaMode() ) + if (ScModule* mod = ScModule::get(); mod->IsFormulaMode()) { - SC_MOD()->EndReference(); + mod->EndReference(); bInRefMode = false; return; } @@ -863,7 +864,7 @@ void ScHeaderControl::MouseMove( const MouseEvent& rMEvt ) return; } - if ( bInRefMode && rMEvt.IsLeft() && SC_MOD()->IsFormulaMode() ) + if (bInRefMode && rMEvt.IsLeft() && ScModule::get()->IsFormulaMode()) { if( !pTabView ) return; @@ -940,7 +941,7 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt ) SelectWindow(); // also deselects drawing objects, stops draw text edit if ( rViewData.HasEditView( rViewData.GetActivePart() ) ) - SC_MOD()->InputEnterHandler(); // always end edit mode + ScModule::get()->InputEnterHandler(); // always end edit mode bool bBorder; SCCOLROW nPos = GetMousePos(rCEvt.GetMousePosPixel(), bBorder ); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 89ca5150b9cb..2fa575982783 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -85,7 +85,7 @@ const Color nAuthorColor[ SC_AUTHORCOLORCOUNT ] = { // Helper class for color assignment to avoid repeated lookups for the same user ScActionColorChanger::ScActionColorChanger( const ScChangeTrack& rTrack ) : - rOpt( SC_MOD()->GetAppOptions() ), + rOpt( ScModule::get()->GetAppOptions() ), rUsers( rTrack.GetUserCollection() ), nLastUserIndex( 0 ), nColor( COL_BLACK ) @@ -291,7 +291,7 @@ void ScOutputData::SetSyntaxMode( bool bNewMode ) mbSyntaxMode = bNewMode; if ( bNewMode && !mxValueColor ) { - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); mxValueColor = rColorCfg.GetColorValue( svtools::CALCVALUE ).nColor; mxTextColor = rColorCfg.GetColorValue( svtools::CALCTEXT ).nColor; mxFormulaColor = rColorCfg.GetColorValue( svtools::CALCFORMULA ).nColor; @@ -388,7 +388,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool // break all the drawing by one change. // So until that happens, we need to special case. bool bWorksInPixels = bMetaFile; - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); Color aSheetBGColor = rColorCfg.GetColorValue(::svtools::DOCCOLOR).nColor; if ( eType == OUTTYPE_WINDOW ) @@ -873,7 +873,7 @@ void ScOutputData::DrawDocumentBackground() if ( !bSolidBackground ) return; - Color aBgColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor ); + Color aBgColor(ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor); mpDev->SetLineColor(aBgColor); mpDev->SetFillColor(aBgColor); @@ -1110,7 +1110,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) tools::Long nPosY = nScrY; - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); Color aProtectedColor( rColorCfg.GetColorValue( svtools::CALCPROTECTEDBACKGROUND ).nColor ); auto pProtectedBackground = std::make_shared( aProtectedColor, ATTR_BACKGROUND ); @@ -1263,7 +1263,7 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot bool bCellContrast = mbUseStyleColor && rStyleSettings.GetHighContrastMode(); Color aAutoTextColor; if ( bCellContrast ) - aAutoTextColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + aAutoTextColor = ScModule::get()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; tools::Long nInitPosX = nScrX; if ( bLayoutRTL ) @@ -1410,7 +1410,7 @@ void ScOutputData::DrawClear() tools::Long nOneY = aOnePixel.Height(); // (called only for ScGridWindow) - Color aBgColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor ); + Color aBgColor(ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor); if (bMetaFile) nOneX = nOneY = 0; @@ -1490,7 +1490,7 @@ void ScOutputData::DrawFrame(vcl::RenderContext& rRenderContext) } else if ( bCellContrast ) { - aSingleColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + aSingleColor = ScModule::get()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; bUseSingleColor = true; } @@ -2493,13 +2493,14 @@ void ScOutputData::DrawNoteMarks(vcl::RenderContext& rRenderContext) if (!mpDoc->ColHidden(nX, nTab) && mpDoc->GetNote(nX, pRowInfo[nArrY].nRowNo, nTab) && (bIsMerged || (!pInfo->bHOverlapped && !pInfo->bVOverlapped))) { - rRenderContext.SetLineColor(SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCGRID).nColor); + ScModule* mod = ScModule::get(); + rRenderContext.SetLineColor(mod->GetColorConfig().GetColorValue(svtools::CALCGRID).nColor); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); if ( mbUseStyleColor && rStyleSettings.GetHighContrastMode() ) - rRenderContext.SetFillColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); + rRenderContext.SetFillColor( mod->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); else - rRenderContext.SetFillColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCOMMENTS).nColor ); + rRenderContext.SetFillColor( mod->GetColorConfig().GetColorValue(svtools::CALCCOMMENTS).nColor ); tools::Long nMarkX = nPosX + ( pRowInfo[0].basicCellInfo(nX).nWidth - 1) * nLayoutSign; if ( bIsMerged || pInfo->bMerged ) @@ -2566,7 +2567,7 @@ void ScOutputData::DrawFormulaMarks(vcl::RenderContext& rRenderContext) const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); if ( mbUseStyleColor && rStyleSettings.GetHighContrastMode() ) - rRenderContext.SetFillColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); + rRenderContext.SetFillColor( ScModule::get()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); else rRenderContext.SetFillColor(COL_LIGHTBLUE); @@ -2711,8 +2712,9 @@ void ScOutputData::DrawClipMarks() if (!bAnyClipped) return; - Color aArrowFillCol( SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCTEXTOVERFLOW).nColor ); - const bool bIsDarkBackground = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor.IsDark(); + ScModule* mod = ScModule::get(); + Color aArrowFillCol(mod->GetColorConfig().GetColorValue(svtools::CALCTEXTOVERFLOW).nColor); + const bool bIsDarkBackground = mod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor.IsDark(); DrawModeFlags nOldDrawMode = mpDev->GetDrawMode(); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 7ecfb387ab7a..421edaafcc5f 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -223,11 +223,10 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, bool bPTL) : nRepeatPos( -1 ), nRepeatChar( 0x0 ) { - ScModule* pScMod = SC_MOD(); bCellContrast = pOutput->mbUseStyleColor && Application::GetSettings().GetStyleSettings().GetHighContrastMode(); - const svtools::ColorConfig& rColorConfig = pScMod->GetColorConfig(); + const svtools::ColorConfig& rColorConfig = ScModule::get()->GetColorConfig(); aBackConfigColor = rColorConfig.GetColorValue(svtools::DOCCOLOR).nColor; aTextConfigColor = rColorConfig.GetColorValue(svtools::FONTCOLOR).nColor; } @@ -2545,7 +2544,7 @@ static Color GetConfBackgroundColor() { if (const ScTabViewShell* pTabViewShellBg = ScTabViewShell::GetActiveViewShell()) return pTabViewShellBg->GetViewRenderingData().GetDocColor(); - return SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + return ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; } void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor) diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index c8b3ed2a7ae0..dc34e4722421 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -227,7 +227,7 @@ void ScPreview::CalcPages() // PrintOptions is passed to PrintFunc for SkipEmpty flag, // but always all sheets are used (there is no selected sheet) - ScPrintOptions aOptions = SC_MOD()->GetPrintOptions(); + ScPrintOptions aOptions = ScModule::get()->GetPrintOptions(); while (nStart > static_cast(nPages.size())) nPages.push_back(0); @@ -341,7 +341,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) bool bDoPrint = ( pFillLocation == nullptr ); bool bValidPage = ( nPageNo < nTotalPages ); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig(); Color aBackColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor ); @@ -573,7 +573,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) if ( !bValidPage ) return; - Color aBorderColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); + Color aBorderColor(ScModule::get()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor); // draw border @@ -1294,7 +1294,7 @@ void ScPreview::MouseMove( const MouseEvent& rMEvt ) if ( nPageNo < nTotalPages ) { - ScPrintOptions aOptions = SC_MOD()->GetPrintOptions(); + ScPrintOptions aOptions = ScModule::get()->GetPrintOptions(); std::unique_ptr> pPrintFunc; if (bStateValid) diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index ec56b1fabed7..329a9b46df40 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -129,7 +129,7 @@ void ScPreviewShell::Construct( vcl::Window* pParent ) pPreview = VclPtr::Create( pParent, pDocShell, this ); - SetPool( &SC_MOD()->GetPool() ); + SetPool(&ScModule::get()->GetPool()); SetWindow( pPreview ); StartListening(*pDocShell, DuplicateHandling::Prevent); StartListening(*SfxGetpApp(), DuplicateHandling::Prevent); // #i62045# #i62046# application is needed for Calc's own hints @@ -543,7 +543,7 @@ void ScPreviewShell::Activate(bool bMDI) if (bMDI) { // InputHdl is now mostly Null, no more assertion! - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHdl = ScModule::get()->GetInputHdl(); if ( pInputHdl ) pInputHdl->NotifyChange( nullptr ); } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 898bf636ff14..e02254251ae7 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -1658,7 +1658,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, Color aGridColor( COL_BLACK ); if ( bUseStyleColor ) - aGridColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + aGridColor = ScModule::get()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; aOutputData.SetGridColor( aGridColor ); if ( !pPrinter ) @@ -2011,7 +2011,7 @@ tools::Long ScPrintFunc::PrintNotes( tools::Long nPageNo, tools::Long nNoteStart Color aBackgroundColor( COL_WHITE ); if ( bUseStyleColor ) - aBackgroundColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + aBackgroundColor = ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; pDev->SetMapMode(aOffsetMode); pDev->SetLineColor(); @@ -2080,7 +2080,7 @@ void ScPrintFunc::PrintPage( tools::Long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX Color aBackgroundColor( COL_WHITE ); if ( bUseStyleColor ) - aBackgroundColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + aBackgroundColor = ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; pDev->SetMapMode(aOffsetMode); pDev->SetLineColor(); @@ -2338,7 +2338,7 @@ void ScPrintFunc::PrintPage( tools::Long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX Color aGridColor( COL_BLACK ); if ( bUseStyleColor ) - aGridColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + aGridColor = ScModule::get()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; if (aTableParam.bHeaders) { diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 999f0402d0a6..bf08a5d2fe4c 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -157,7 +157,7 @@ ScSimpleRefDlgWrapper::ScSimpleRefDlgWrapper( vcl::Window* pParentP, if (!GetController()) { - SC_MOD()->SetRefDialog( nId, false ); + ScModule::get()->SetRefDialog(nId, false); } } diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index 7d744f32246c..28ee0bc4cc77 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -163,7 +163,7 @@ void ScViewFunctionSet::BeginDrag() nPosY = m_pViewData->GetCurY(); } - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); bool bRefMode = pScMod->IsFormulaMode(); if (bRefMode) return; @@ -212,7 +212,7 @@ void ScViewFunctionSet::BeginDrag() if (comphelper::LibreOfficeKit::isActive()) pWindow->LocalStartDrag(); - SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D + pScMod->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D pTransferObj->StartDrag( pWindow, nDragActions ); return; // dragging started @@ -224,7 +224,7 @@ void ScViewFunctionSet::CreateAnchor() { if (m_bAnchor) return; - bool bRefMode = SC_MOD()->IsFormulaMode(); + bool bRefMode = ScModule::get()->IsFormulaMode(); if (bRefMode) SetAnchor( m_pViewData->GetRefStartX(), m_pViewData->GetRefStartY() ); else @@ -233,7 +233,7 @@ void ScViewFunctionSet::CreateAnchor() void ScViewFunctionSet::SetAnchor( SCCOL nPosX, SCROW nPosY ) { - bool bRefMode = SC_MOD()->IsFormulaMode(); + bool bRefMode = ScModule::get()->IsFormulaMode(); ScTabView* pView = m_pViewData->GetView(); SCTAB nTab = m_pViewData->GetTabNo(); @@ -280,7 +280,7 @@ void ScViewFunctionSet::DestroyAnchor() if (m_pViewData->IsAnyFillMode()) return; - bool bRefMode = SC_MOD()->IsFormulaMode(); + bool bRefMode = ScModule::get()->IsFormulaMode(); if (bRefMode) m_pViewData->GetView()->DoneRefMode( true ); else @@ -464,7 +464,6 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll return false; } - ScModule* pScMod = SC_MOD(); ScTabViewShell* pViewShell = m_pViewData->GetViewShell(); bool bRefMode = pViewShell && pViewShell->IsRefInputMode(); @@ -488,7 +487,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll if (bRefMode) { // if no input is possible from this doc, don't move the reference cursor around - if ( !pScMod->IsModalMode(m_pViewData->GetSfxDocShell()) && (!CheckRefBounds(nPosX, nPosY) || SfxLokHelper::getDeviceFormFactor() != LOKDeviceFormFactor::MOBILE)) + if ( !ScModule::get()->IsModalMode(m_pViewData->GetSfxDocShell()) && (!CheckRefBounds(nPosX, nPosY) || SfxLokHelper::getDeviceFormFactor() != LOKDeviceFormFactor::MOBILE)) { if (!m_bAnchor) { @@ -742,7 +741,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll bool ScViewFunctionSet::IsSelectionAtPoint( const Point& rPointPixel ) { - bool bRefMode = SC_MOD()->IsFormulaMode(); + bool bRefMode = ScModule::get()->IsFormulaMode(); if (bRefMode) return false; @@ -771,7 +770,7 @@ void ScViewFunctionSet::DeselectAll() if (m_pViewData->IsAnyFillMode()) return; - bool bRefMode = SC_MOD()->IsFormulaMode(); + bool bRefMode = ScModule::get()->IsFormulaMode(); if (bRefMode) { m_pViewData->GetView()->DoneRefMode(); diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index 015f1bf5c7e2..8beba2e2d291 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -173,7 +173,7 @@ void ScSpellDialogChildWindow::Init() // exit edit mode - TODO support spelling in edit mode if( mpViewData->HasEditView( mpViewData->GetActivePart() ) ) - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); mxOldSel.reset( new ScSelectionState( *mpViewData ) ); diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index d6ba1e499a66..aa2ed2895ba1 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -181,7 +181,7 @@ SCTAB ScTabControl::GetPrivatDropPos(const Point& rPos ) void ScTabControl::MouseButtonDown( const MouseEvent& rMEvt ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if ( !pScMod->IsModalMode() && !pScMod->IsFormulaMode() && !IsInEditMode() ) { // activate View @@ -228,7 +228,7 @@ void ScTabControl::AddTabClick() // Insert a new sheet at the right end, with default name. ScDocument& rDoc = pViewData->GetDocument(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (!rDoc.IsDocEditable() || pScMod->IsTableLocked()) return; @@ -252,7 +252,7 @@ void ScTabControl::Select() nSelPageIdByMouse (i.e. if called from keyboard). */ nMouseClickPageId = TabBar::PAGE_NOT_FOUND; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScDocument& rDoc = pViewData->GetDocument(); ScMarkData& rMark = pViewData->GetMarkData(); SCTAB nCount = rDoc.GetTableCount(); @@ -445,7 +445,7 @@ void ScTabControl::SwitchToPageId(sal_uInt16 nId) void ScTabControl::Command( const CommandEvent& rCEvt ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScTabViewShell* pViewSh = pViewData->GetViewShell(); bool bDisable = pScMod->IsFormulaMode() || pScMod->IsModalMode(); @@ -471,7 +471,7 @@ void ScTabControl::Command( const CommandEvent& rCEvt ) void ScTabControl::StartDrag( sal_Int8 /* nAction */, const Point& rPosPixel ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); bool bDisable = pScMod->IsFormulaMode() || pScMod->IsModalMode(); if (!bDisable) @@ -512,7 +512,7 @@ void ScTabControl::DoDrag() pTransferObj->SetSourceCursorPos( pViewData->GetCurX(), pViewData->GetCurY() ); vcl::Window* pWindow = pViewData->GetActiveWin(); - SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D + ScModule::get()->SetDragObject(pTransferObj.get(), nullptr); // for internal D&D pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); } @@ -541,7 +541,7 @@ sal_Int8 ScTabControl::ExecuteDrop( const ExecuteDropEvent& rEvt ) EndSwitchPage(); ScDocument& rDoc = pViewData->GetDocument(); - const ScDragData& rData = SC_MOD()->GetDragData(); + const ScDragData& rData = ScModule::get()->GetDragData(); if ( rData.pCellTransfer && (rData.pCellTransfer->GetDragSourceFlags() & ScDragSrc::Table) && rData.pCellTransfer->GetSourceDocument() == &rDoc ) { @@ -580,7 +580,7 @@ sal_Int8 ScTabControl::AcceptDrop( const AcceptDropEvent& rEvt ) } const ScDocument& rDoc = pViewData->GetDocument(); - const ScDragData& rData = SC_MOD()->GetDragData(); + const ScDragData& rData = ScModule::get()->GetDragData(); if ( rData.pCellTransfer && (rData.pCellTransfer->GetDragSourceFlags() & ScDragSrc::Table) && rData.pCellTransfer->GetSourceDocument() == &rDoc ) { diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 363bd1d54113..abc5528ff926 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -131,7 +131,7 @@ void ScCornerButton::Resize() void ScCornerButton::MouseButtonDown( const MouseEvent& rMEvt ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); bool bDisable = pScMod->IsFormulaMode() || pScMod->IsModalMode(); if (!bDisable) { @@ -962,7 +962,7 @@ void ScTabView::SetZoomPercentFromCommand(sal_uInt16 nZoomPercent) { // scroll wheel doesn't set the AppOptions default - bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); + bool bSyncZoom = ScModule::get()->GetAppOptions().GetSynchronizeZoom(); SetZoomType(SvxZoomType::PERCENT, bSyncZoom); Fraction aFract(nZoomPercent, 100); SetZoom(aFract, aFract, bSyncZoom); diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index d5be3d5b5956..7f78e9575e83 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -832,7 +832,7 @@ void ScTabView::GetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, ScFollowMode eM SCCOL nCurX = aViewData.GetCurX(); SCROW nCurY = aViewData.GetCurY(); - ScModule* pScModule = SC_MOD(); + ScModule* pScModule = ScModule::get(); bool bLegacyCellSelection = pScModule->GetInputOptions().GetLegacyCellSelection(); bool bIncrementallyExpandToDocLimits(false); @@ -1640,7 +1640,7 @@ IMPL_STATIC_LINK_NOARG(ScTabView, InstallLOKNotifierHdl, void*, vcl::ILibreOffic void ScTabView::ErrorMessage(TranslateId pGlobStrId) { - if ( SC_MOD()->IsInExecuteDrop() ) + if (ScModule::get()->IsInExecuteDrop()) { // #i28468# don't show error message when called from Drag&Drop, silently abort instead return; diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 7c32cee3c7bf..68642aee1c24 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -166,14 +166,15 @@ void ScTabView::ClickCursor( SCCOL nPosX, SCROW nPosY, bool bControl ) SCTAB nTab = aViewData.GetTabNo(); rDoc.SkipOverlapped(nPosX, nPosY, nTab); - bool bRefMode = SC_MOD()->IsFormulaMode(); + ScModule* mod = ScModule::get(); + bool bRefMode = mod->IsFormulaMode(); if ( bRefMode ) { DoneRefMode(); if (bControl) - SC_MOD()->AddRefEntry(); + mod->AddRefEntry(); InitRefMode( nPosX, nPosY, nTab, SC_REFTYPE_REF ); } @@ -471,7 +472,7 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) static bool lcl_IsRefDlgActive(SfxViewFrame& rViewFrm) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); if (!pScMod->IsRefDialogOpen()) return false; @@ -496,7 +497,7 @@ void ScTabView::CheckSelectionTransfer() if ( !aViewData.IsActive() ) // only for active view return; - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScSelectionTransferObj* pOld = pScMod->GetSelectionTransfer(); rtl::Reference pNew = ScSelectionTransferObj::CreateFromView( this ); if ( !pNew ) @@ -648,7 +649,7 @@ void ScTabView::SelectionChanged(bool bFromPaste) void ScTabView::CursorPosChanged() { - bool bRefMode = SC_MOD()->IsFormulaMode(); + bool bRefMode = ScModule::get()->IsFormulaMode(); if ( !bRefMode ) // check that RefMode works when switching sheets aViewData.GetDocShell()->Broadcast( SfxHint( SfxHintId::ScKillEditView ) ); @@ -833,7 +834,7 @@ void ScTabView::TestHintWindow() nRow >= aViewData.GetPosY(WhichV(eWhich)) && aPos.X() < aWinSize.Width() && aPos.Y() < aWinSize.Height() ) { - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor; // create HintWindow, determines its size by itself ScOverlayHint* pOverlay = new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont()); @@ -1273,7 +1274,7 @@ void ScTabView::MoveCursorAbs( SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, // marks first and then formula mode. ScMarkData& rMark = aViewData.GetMarkData(); bool bMarked = rMark.IsMarked() || rMark.IsMultiMarked(); - if (bMarked && !SC_MOD()->IsFormulaMode()) + if (bMarked && !ScModule::get()->IsFormulaMode()) { rMark.ResetMark(); DoneBlockMode(); @@ -1441,7 +1442,7 @@ void ScTabView::MoveCursorScreen( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, void ScTabView::MoveCursorEnter( bool bShift ) // bShift -> up/down { - const ScInputOptions& rOpt = SC_MOD()->GetInputOptions(); + const ScInputOptions& rOpt = ScModule::get()->GetInputOptions(); if (!rOpt.GetMoveSelection()) { aViewData.UpdateInputHandler(true); @@ -1662,7 +1663,7 @@ void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier) if ((nModifier & KEY_SHIFT) == KEY_SHIFT) bMoveIsShift = true; - if ( SC_MOD()->IsFormulaMode() ) + if (ScModule::get()->IsFormulaMode()) { DoneRefMode( nModifier != 0 ); InitRefMode( nCol, 0, nTab, SC_REFTYPE_REF ); @@ -1689,7 +1690,7 @@ void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier) if ((nModifier & KEY_SHIFT) == KEY_SHIFT) bMoveIsShift = true; - if ( SC_MOD()->IsFormulaMode() ) + if (ScModule::get()->IsFormulaMode()) { DoneRefMode( nModifier != 0 ); InitRefMode( 0, nRow, nTab, SC_REFTYPE_REF ); @@ -1947,7 +1948,7 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa // so the handling of notes still has the sheet selected on which the notes are. DrawDeselectAll(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); bool bRefMode = pScMod->IsFormulaMode(); if ( !bRefMode ) // query, so that RefMode works when switching sheet { @@ -2242,7 +2243,7 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW void ScTabView::UpdateEditView() { - if (aViewData.GetTabNo() != aViewData.GetRefTabNo() && SC_MOD()->IsFormulaMode()) + if (aViewData.GetTabNo() != aViewData.GetRefTabNo() && ScModule::get()->IsFormulaMode()) return; ScSplitPos eActive = aViewData.GetActivePart(); @@ -2360,7 +2361,7 @@ void ScTabView::KillEditView( bool bNoPaint ) bool bGrabFocus = false; if (aViewData.IsActive()) { - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHdl = ScModule::get()->GetInputHdl(); if ( pInputHdl ) { ScInputWindow* pInputWin = pInputHdl->GetInputWindow(); @@ -2543,7 +2544,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO aStart.AdjustX( -nLayoutSign ); // include change marks aStart.AdjustY( -1 ); - bool bMarkClipped = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCTEXTOVERFLOW).bIsVisible; + bool bMarkClipped = ScModule::get()->GetColorConfig().GetColorValue(svtools::CALCTEXTOVERFLOW).bIsVisible; if (bMarkClipped) { // ScColumn::IsEmptyData has to be optimized for this @@ -2630,7 +2631,7 @@ void ScTabView::PaintRangeFinderEntry (const ScRangeFindData* pData, const SCTAB void ScTabView::PaintRangeFinder( tools::Long nNumber ) { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( aViewData.GetViewShell() ); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(aViewData.GetViewShell()); if (!pHdl) return; @@ -2954,7 +2955,7 @@ void ScTabView::ActivateView( bool bActivate, bool bFirst ) if (!bActivate) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); bool bRefMode = pScMod->IsFormulaMode(); // don't cancel reference input, to allow reference @@ -2963,7 +2964,7 @@ void ScTabView::ActivateView( bool bActivate, bool bFirst ) if (!bRefMode) { // pass view to GetInputHdl, this view may not be current anymore - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(aViewData.GetViewShell()); + ScInputHandler* pHdl = pScMod->GetInputHdl(aViewData.GetViewShell()); if (pHdl) pHdl->EnterHandler(); } @@ -3022,7 +3023,7 @@ void ScTabView::ActivatePart( ScSplitPos eWhich ) bInActivatePart = true; - bool bRefMode = SC_MOD()->IsFormulaMode(); + bool bRefMode = ScModule::get()->IsFormulaMode(); // the HasEditView call during SetCursor would fail otherwise if ( aViewData.HasEditView(eOld) && !bRefMode ) @@ -3168,7 +3169,7 @@ tools::Long ScTabView::GetGridHeight( ScVSplitPos eWhich ) void ScTabView::UpdateInputLine() { - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); } void ScTabView::SyncGridWindowMapModeFromDrawMapMode() @@ -3187,7 +3188,7 @@ void ScTabView::SyncGridWindowMapModeFromDrawMapMode() void ScTabView::ZoomChanged() { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(aViewData.GetViewShell()); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(aViewData.GetViewShell()); if (pHdl) pHdl->SetRefScale( aViewData.GetZoomX(), aViewData.GetZoomY() ); diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index 082c275fe113..3b75cef9aba5 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -162,7 +162,7 @@ void ScTabView::DoneRefMode( bool bContinue ) { ScDocument& rDoc = aViewData.GetDocument(); if ( aViewData.GetRefType() == SC_REFTYPE_REF && bContinue ) - SC_MOD()->AddRefEntry(); + ScModule::get()->AddRefEntry(); bool bWasRef = aViewData.IsRefMode(); aViewData.SetRefMode( false, SC_REFTYPE_NONE ); @@ -188,13 +188,13 @@ void ScTabView::DoneRefMode( bool bContinue ) void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) { ScDocument& rDoc = aViewData.GetDocument(); + ScModule* pScMod = ScModule::get(); if (!aViewData.IsRefMode()) { // This will happen, when first at a reference dialog with Control in // the table is clicked. Then append the new reference to the old content: - ScModule* pScMod = SC_MOD(); if (pScMod->IsFormulaMode()) pScMod->AddRefEntry(); @@ -238,7 +238,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) ScRange aRef( nStartX, nStartY, aViewData.GetRefStartZ(), nEndX, nEndY, aViewData.GetRefEndZ() ); - SC_MOD()->SetReference( aRef, rDoc, &rMark ); + pScMod->SetReference(aRef, rDoc, &rMark); ShowRefTip(); } else if ( eType == SC_REFTYPE_EMBED_LT || eType == SC_REFTYPE_EMBED_RB ) @@ -258,7 +258,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) if (aRect.GetDiff( nPaintStartX, nPaintStartY, nPaintEndX, nPaintEndY )) PaintArea( nPaintStartX, nPaintStartY, nPaintEndX, nPaintEndY, ScUpdateMode::Marks ); - ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHandler = pScMod->GetInputHdl(); if (pInputHandler) { pInputHandler->UpdateLokReferenceMarks(); @@ -363,6 +363,7 @@ void ScTabView::InitRefMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eT aViewData.SetRefStart( nCurX, nCurY, nCurZ ); aViewData.SetRefEnd( nCurX, nCurY, nCurZ ); + ScModule* mod = ScModule::get(); if (nCurZ == aViewData.GetTabNo()) { SCCOL nStartX = nCurX; @@ -376,10 +377,10 @@ void ScTabView::InitRefMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eT // SetReference without Merge-Adjustment ScRange aRef( nCurX,nCurY,nCurZ, nCurX,nCurY,nCurZ ); - SC_MOD()->SetReference( aRef, rDoc, &rMark ); + mod->SetReference( aRef, rDoc, &rMark ); } - ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHandler = mod->GetInputHdl(); if (pInputHandler) { pInputHandler->UpdateLokReferenceMarks(); @@ -532,7 +533,7 @@ void ScTabView::UpdateScrollBars( HeaderType eHeaderType ) if ( aViewData.IsActive() ) { if (UpdateVisibleRange()) - SC_MOD()->AnythingChanged(); // if visible area has changed + ScModule::get()->AnythingChanged(); // if visible area has changed } } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 4404dbe3b44b..6d293ea3f0d5 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -142,7 +142,7 @@ ScTabView::~ScTabView() sal_uInt16 i; // remove selection object - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScSelectionTransferObj* pOld = pScMod->GetSelectionTransfer(); if ( pOld && pOld->GetView() == this ) { diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index d0bff87ee629..545f8ce8841a 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -70,7 +70,8 @@ void ScTabViewShell::WindowChanged() void ScTabViewShell::ExecDraw(SfxRequest& rReq) { - SC_MOD()->InputEnterHandler(); + ScModule* mod = ScModule::get(); + mod->InputEnterHandler(); UpdateInputHandler(); MakeDrawLayer(); @@ -319,7 +320,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) return; // Create default drawing objects via keyboard - const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions(); + const ScAppOptions& rAppOpt = mod->GetAppOptions(); sal_uInt32 nDefaultObjectSizeWidth = rAppOpt.GetDefaultObjectSizeWidth(); sal_uInt32 nDefaultObjectSizeHeight = rAppOpt.GetDefaultObjectSizeHeight(); diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 44813b6c53bc..8d5888a5b5f3 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -180,7 +180,7 @@ void ScTabViewShell::FinishProtectTable() void ScTabViewShell::ExecProtectTable( SfxRequest& rReq ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); const SfxItemSet* pReqArgs = rReq.GetArgs(); ScDocument& rDoc = GetViewData().GetDocument(); SCTAB nTab = GetViewData().GetTabNo(); @@ -289,7 +289,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { SfxViewFrame& rThisFrame = GetViewFrame(); SfxBindings& rBindings = rThisFrame.GetBindings(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); const SfxItemSet* pReqArgs = rReq.GetArgs(); sal_uInt16 nSlot = rReq.GetSlot(); @@ -1007,7 +1007,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) nNew = std::min(MAXZOOM, basegfx::zoomtools::zoomIn(nOld)); if ( nNew != nOld) { - bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); + bool bSyncZoom = pScMod->GetAppOptions().GetSynchronizeZoom(); SetZoomType(SvxZoomType::PERCENT, bSyncZoom); Fraction aFract(nNew, 100); SetZoom(aFract, aFract, bSyncZoom); @@ -1027,7 +1027,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_ATTR_ZOOM: // status row case FID_SCALE: { - bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); + bool bSyncZoom = pScMod->GetAppOptions().GetSynchronizeZoom(); SvxZoomType eOldZoomType = GetZoomType(); SvxZoomType eNewZoomType = eOldZoomType; const Fraction& rOldY = GetViewData().GetZoomY(); // Y is shown @@ -1128,7 +1128,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_ATTR_ZOOMSLIDER: { const SfxPoolItem* pItem = nullptr; - bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); + bool bSyncZoom = pScMod->GetAppOptions().GetSynchronizeZoom(); if ( pReqArgs && pReqArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem) == SfxItemState::SET ) { const sal_uInt16 nCurrentZoom = static_cast(pItem)->GetValue(); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index cd8daaea3ec3..46ed26d6b808 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -115,7 +115,7 @@ void ScTabViewShell::Activate(bool bMDI) if ( bMDI ) { // for input row (ClearCache) - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); pScMod->ViewShellChanged(/*bStopEditing=*/ !comphelper::LibreOfficeKit::isActive()); ActivateView( true, bFirstActivate ); @@ -246,7 +246,7 @@ void ScTabViewShell::Deactivate(bool bMDI) SfxViewShell::Deactivate(bMDI); bIsActive = false; - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(this); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(this); if( bMDI && !comphelper::LibreOfficeKit::isActive()) { @@ -293,7 +293,7 @@ bool ScTabViewShell::PrepareClose(bool bUI) // Call EnterHandler even in formula mode here, // so a formula change in an embedded object isn't lost // (ScDocShell::PrepareClose isn't called then). - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( this ); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(this); if ( pHdl && pHdl->IsInputMode() ) { pHdl->EnterHandler(); @@ -1183,7 +1183,7 @@ void ScTabViewShell::StartSimpleRefDialog( sal_uInt16 nId = ScSimpleRefDlgWrapper::GetChildWindowId(); - SC_MOD()->SetRefDialog( nId, true, &rViewFrm ); + ScModule::get()->SetRefDialog(nId, true, &rViewFrm); ScSimpleRefDlgWrapper* pWnd = static_cast(rViewFrm.GetChildWindow( nId )); if (!pWnd) @@ -1216,7 +1216,7 @@ void ScTabViewShell::StopSimpleRefDialog() bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); SfxViewFrame& rThisFrame = GetViewFrame(); if ( rThisFrame.GetChildWindow( SID_OPENDLG_FUNCTION ) ) @@ -1511,7 +1511,8 @@ void ScTabViewShell::Construct( TriState nForceDesignMode ) SetName(u"View"_ustr); // for SBX Color aColBlack( COL_BLACK ); - SetPool( &SC_MOD()->GetPool() ); + ScModule* mod = ScModule::get(); + SetPool(&mod->GetPool()); SetWindow( GetActiveWin() ); pCurFrameLine.reset( new ::editeng::SvxBorderLine(&aColBlack, 20, SvxBorderLineStyle::SOLID) ); @@ -1602,7 +1603,7 @@ void ScTabViewShell::Construct( TriState nForceDesignMode ) if ( pDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) { // Get the customized initial tab count - const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions(); + const ScDefaultsOptions& rOpt = mod->GetDefaultsOptions(); SCTAB nInitTabCount = rOpt.GetInitTabCount(); for (SCTAB i=1; iGetCurRefDlgId()==0) + if(mod->GetCurRefDlgId()==0) { pFirst->GetDispatcher()->Execute( SID_UPDATETABLINKS, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); @@ -1667,7 +1668,7 @@ void ScTabViewShell::Construct( TriState nForceDesignMode ) { if ( !pFirst ) pFirst = &GetViewFrame(); - if(SC_MOD()->GetCurRefDlgId()==0) + if(mod->GetCurRefDlgId()==0) { pFirst->GetDispatcher()->Execute( SID_REIMPORT_AFTER_LOAD, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); @@ -2041,7 +2042,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame& rViewFrame, m_pDragData(new ScDragData), m_pScCondFormatDlgItem() { - const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions(); + const ScAppOptions& rAppOpt = ScModule::get()->GetAppOptions(); // if switching back from print preview, // restore the view settings that were active when creating the preview @@ -2165,7 +2166,7 @@ ScTabViewShell::~ScTabViewShell() EndListening(GetViewFrame()); EndListening(*SfxGetpApp()); // #i62045# #i62046# needed now - SfxViewShell no longer does it - SC_MOD()->ViewShellGone(this); + ScModule::get()->ViewShellGone(this); RemoveSubShell(); // all SetWindow(nullptr); diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx index 43d889dc5f64..ba947d7aa43c 100644 --- a/sc/source/ui/view/tabvwsh5.cxx +++ b/sc/source/ui/view/tabvwsh5.cxx @@ -224,7 +224,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) case SfxHintId::ScRefModeChanged: { - bool bRefMode = SC_MOD()->IsFormulaMode(); + bool bRefMode = ScModule::get()->IsFormulaMode(); if (!bRefMode) StopRefMode(); else diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 2fc2d2d576d2..b796a05d9821 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -84,7 +84,7 @@ using namespace com::sun::star; bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode ) { - sal_uInt32 nFuncs = SC_MOD()->GetAppOptions().GetStatusFunc(); + sal_uInt32 nFuncs = ScModule::get()->GetAppOptions().GetStatusFunc(); ScViewData& rViewData = GetViewData(); ScMarkData& rMark = rViewData.GetMarkData(); bool bIgnoreError = (rMark.IsMarked() || rMark.IsMultiMarked()); @@ -532,7 +532,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) break; case FID_TOGGLEHIDDENCOLROW: - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig(); rSet.Put( SfxBoolItem( nWhich, rColorCfg.GetColorValue(svtools::CALCHIDDENROWCOL).bIsVisible) ); break; @@ -647,8 +647,7 @@ const OUString* ScTabViewShell::GetEditString() const bool ScTabViewShell::IsRefInputMode() const { - ScModule* pScMod = SC_MOD(); - if ( pScMod ) + if (ScModule* pScMod = ScModule::get()) { if( pScMod->IsRefDialogOpen() ) return pScMod->IsFormulaMode(); @@ -693,8 +692,7 @@ void ScTabViewShell::ExecuteInputDirect() { if ( !IsRefInputMode() ) { - ScModule* pScMod = SC_MOD(); - if ( pScMod ) + if (ScModule* pScMod = ScModule::get()) { pScMod->InputEnterHandler(); } @@ -703,7 +701,7 @@ void ScTabViewShell::ExecuteInputDirect() void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bStopEditing /* = sal_True */ ) { - ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : ScModule::get()->GetInputHdl(); if ( pHdl ) { @@ -800,7 +798,7 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt void ScTabViewShell::UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust ) { - if( ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : SC_MOD()->GetInputHdl() ) + if( ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : ScModule::get()->GetInputHdl() ) pHdl->UpdateCellAdjust( eJust ); } @@ -824,7 +822,7 @@ void ScTabViewShell::ExecuteSave( SfxRequest& rReq ) // to save immediately without committing any erroneous input in possibly // a cell with validation rules. After save is complete the user // can continue editing. - SC_MOD()->InputEnterHandler(ScEnterMode::NORMAL, bLOKActive /* bBeforeSavingInLOK */); + ScModule::get()->InputEnterHandler(ScEnterMode::NORMAL, bLOKActive /* bBeforeSavingInLOK */); if (bLOKActive) { @@ -949,7 +947,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) ScDocShell* pDocSh = GetViewData().GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); ScMarkData& rMark = GetViewData().GetMarkData(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); SdrObject* pEditObject = GetDrawView()->GetTextEditObject(); OutlinerView* pOLV = GetDrawView()->GetTextEditOutlinerView(); ESelection aSelection = pOLV ? pOLV->GetSelection() : ESelection(); @@ -1828,7 +1826,7 @@ void ScTabViewShell::GetStyleState( SfxItemSet& rSet ) case SID_STYLE_WATERCAN: { - rSet.Put( SfxBoolItem( nSlotId, SC_MOD()->GetIsWaterCan() ) ); + rSet.Put(SfxBoolItem(nSlotId, ScModule::get()->GetIsWaterCan())); } break; diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index ae82a7b74a9f..4b00ce224bda 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -310,7 +310,7 @@ void ScTabViewShell::DeactivateOle() { // deactivate inplace editing if currently active - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF; ScClient* pClient = static_cast(GetIPClient()); @@ -371,7 +371,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) sal_uInt16 nSlot = rReq.GetSlot(); if (nSlot != SID_OBJECTRESIZE ) { - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); UpdateInputHandler(); } diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 7904290b6d5b..4cf74a88295b 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -90,7 +90,8 @@ void ScTabViewShell::SetCurRefDlgId( sal_uInt16 nNew ) //ugly hack to call Define Name from Manage Names void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialogController* pDialog) { - sal_uInt16 nSlotId = SC_MOD()->GetCurRefDlgId(); + ScModule* mod = ScModule::get(); + sal_uInt16 nSlotId = mod->GetCurRefDlgId(); if( nSlotId == FID_ADD_NAME ) { static_cast(pDialog)->GetNewData(maName, maScope); @@ -99,7 +100,7 @@ void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialogController* pDialo SfxViewFrame& rViewFrm = GetViewFrame(); SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId ); - SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); + mod->SetRefDialog( nId, pWnd == nullptr ); } else if (nSlotId == FID_DEFINE_NAME) { @@ -110,7 +111,7 @@ void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialogController* pDialo SfxViewFrame& rViewFrm = GetViewFrame(); SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId ); - SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); + mod->SetRefDialog( nId, pWnd == nullptr ); } } @@ -122,7 +123,7 @@ std::shared_ptr ScTabViewShell::CreateRefDialogCont // only open dialog when called through ScModule::SetRefDialog, // so that it does not re appear for instance after a crash (#42341#). - if ( SC_MOD()->GetCurRefDlgId() != nSlotId ) + if (ScModule::get()->GetCurRefDlgId() != nSlotId) return nullptr; if ( nCurRefDlgId != nSlotId ) @@ -465,7 +466,7 @@ void ScTabViewShell::afterCallbackRegistered() UpdateInputHandler(true, false); - ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : ScModule::get()->GetInputHdl(); if (pHdl) { ScInputWindow* pInputWindow = pHdl->GetInputWindow(); diff --git a/sc/source/ui/view/tabvwshd.cxx b/sc/source/ui/view/tabvwshd.cxx index 52d97d1a25a9..b874d46bb1cc 100644 --- a/sc/source/ui/view/tabvwshd.cxx +++ b/sc/source/ui/view/tabvwshd.cxx @@ -32,7 +32,7 @@ weld::Window* ScTabViewShell::GetDialogParent() { // if a ref-input dialog is open, use it as parent // (necessary when a slot is executed from the dialog's OK handler) - if (nCurRefDlgId && nCurRefDlgId == SC_MOD()->GetCurRefDlgId()) + if (nCurRefDlgId && nCurRefDlgId == ScModule::get()->GetCurRefDlgId()) { SfxViewFrame& rViewFrm = GetViewFrame(); if (rViewFrm.HasChildWindow(nCurRefDlgId)) diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index 0a8b80fe2b68..ee66fe18f8b4 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -143,7 +143,7 @@ void ScTabViewShell::InsertURL( const OUString& rName, const OUString& rURL, con } else { - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); InsertURLButton( rName, rURL, rTarget, nullptr ); } } @@ -167,7 +167,7 @@ void ScTabViewShell::InsertURLField( const OUString& rName, const OUString& rURL SvxFieldItem aURLItem( aURLField, EE_FEATURE_FIELD ); ScViewData& rViewData = GetViewData(); - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScInputHandler* pHdl = pScMod->GetInputHdl( rViewData.GetViewShell() ); bool bSelectFirst = false; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 0917ed676773..09e5f834ed44 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1662,6 +1662,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, if (bLOKPrintTwips) notifyCellCursorAt(GetViewShell(), nNewX, nNewY, aPTwipsRect); + ScModule* pScMod = ScModule::get(); if ( bActive && eWhich == GetActivePart() ) { // keep the part that has the active edit view available after @@ -1763,7 +1764,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, Size aPaperSizePTwips(nSizeXPTwips, nSizeYPTwips); // In the LOK case the following code can make the cell background and visible area larger // than needed which makes selecting the adjacent right cell impossible in some cases. - if ( bBreak && !bAsianVertical && SC_MOD()->GetInputOptions().GetTextWysiwyg() && !bLOKActive ) + if (bBreak && !bAsianVertical && pScMod->GetInputOptions().GetTextWysiwyg() && !bLOKActive) { // if text is formatted for printer, use the exact same paper width // (and same line breaks) as for output. @@ -1847,7 +1848,6 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, // background color of the cell Color aBackCol = pPattern->GetItem(ATTR_BACKGROUND).GetColor(); - ScModule* pScMod = SC_MOD(); if ( aBackCol.IsTransparent() ) { aBackCol = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; @@ -3650,7 +3650,7 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt ) rTabSett.maSplitPos, MapMode( MapUnit::MapTwip ) ); //! Zoom? // the test for use of printer metrics for text formatting here // effectively results in the nFactor = 1.0 regardless of the Option setting. - if( pDocShell && SC_MOD()->GetInputOptions().GetTextWysiwyg()) + if (pDocShell && ScModule::get()->GetInputOptions().GetTextWysiwyg()) { double nFactor = pDocShell->GetOutputFactor(); aPixel.setX( static_cast( aPixel.X() * nFactor + 0.5 ) ); @@ -3926,7 +3926,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence { SetFormulaBarLines(nFormulaBarLineCount); // Notify formula bar about changed lines - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pInputHdl = ScModule::get()->GetInputHdl(); if (pInputHdl) { ScInputWindow* pInputWin = pInputHdl->GetInputWindow(); @@ -4148,7 +4148,7 @@ void ScViewData::UpdateOutlinerFlags( Outliner& rOutl ) const nCntrl &= ~EEControlBits::ONLINESPELLING; rOutl.SetControlWord(nCntrl); - rOutl.SetCalcFieldValueHdl( LINK( SC_MOD(), ScModule, CalcFieldValueHdl ) ); + rOutl.SetCalcFieldValueHdl(LINK(ScModule::get(), ScModule, CalcFieldValueHdl)); // don't call GetSpellChecker if online spelling isn't enabled. // The language for AutoCorrect etc. is taken from the pool defaults diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 3100441093b7..f485ea2d9439 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1171,7 +1171,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, bool bAskIfNotEmpty = bAllowDialogs && ( nFlags & InsertDeleteFlags::CONTENTS ) && nFunction == ScPasteFunc::NONE && - SC_MOD()->GetInputOptions().GetReplaceCellsWarn(); + ScModule::get()->GetInputOptions().GetReplaceCellsWarn(); if ( bAskIfNotEmpty ) { ScRangeList aTestRanges(aUserRange); @@ -1555,7 +1555,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(InsertDeleteFlags nFlags, ScDocument* bool bAskIfNotEmpty = bAllowDialogs && (nFlags & InsertDeleteFlags::CONTENTS) && - nFunction == ScPasteFunc::NONE && SC_MOD()->GetInputOptions().GetReplaceCellsWarn(); + nFunction == ScPasteFunc::NONE && ScModule::get()->GetInputOptions().GetReplaceCellsWarn(); if (bAskIfNotEmpty) { @@ -1723,7 +1723,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges( bool bAskIfNotEmpty = bAllowDialogs && (nFlags & InsertDeleteFlags::CONTENTS) && - nFunction == ScPasteFunc::NONE && SC_MOD()->GetInputOptions().GetReplaceCellsWarn(); + nFunction == ScPasteFunc::NONE && ScModule::get()->GetInputOptions().GetReplaceCellsWarn(); if (bAskIfNotEmpty) { diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 0edb654f2249..324b42d77c0b 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -329,7 +329,7 @@ void ScViewFunc::DoThesaurus() { GetViewData().GetEditView(eWhich, pEditView, nCol, nRow); pEditSel.reset(new ESelection(pEditView->GetSelection())); - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); GetViewData().GetBindings().Update(); // otherwise the Sfx becomes mixed-up... } else @@ -454,7 +454,7 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam ) if (bIsEditMode) // edit mode active { rViewData.GetEditView(eWhich, pEditView, nCol, nRow); - SC_MOD()->InputEnterHandler(); + ScModule::get()->InputEnterHandler(); } else { diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 86840978f6fb..3786db723629 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -747,7 +747,7 @@ bool ScViewFunc::PasteDataFormatFormattedText( SotClipboardFormatId nFormatId, VclPtr pDlg( pFact->CreateScImportAsciiDlg(pParent ? pParent->GetFrameWeld() : nullptr, OUString(), pStrm.get(), SC_PASTETEXT)); - bAllowDialogs = bAllowDialogs && !SC_MOD()->IsInExecuteDrop(); + bAllowDialogs = bAllowDialogs && !ScModule::get()->IsInExecuteDrop(); pDlg->StartExecuteAsync([this, pDlg, &rDoc, pStrm=std::move(pStrm), nFormatId, pStrBuffer=std::move(pStrBuffer), diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index 510ab6f0ab51..0c614b80aa8c 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -276,7 +276,7 @@ void ScViewFunc::InsertCurrentTime(SvNumFormatType nReqFmt, const OUString& rUnd { ScViewData& rViewData = GetViewData(); - ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl( rViewData.GetViewShell()); + ScInputHandler* pInputHdl = ScModule::get()->GetInputHdl(rViewData.GetViewShell()); bool bInputMode = (pInputHdl && pInputHdl->IsInputMode()); ScDocShell* pDocSh = rViewData.GetDocShell(); diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index bb693fa86d31..697ba07cc1af 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -92,8 +92,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, bool bNegativePage = GetViewData().GetDocument().IsNegativePage( GetViewData().GetTabNo() ); SdrView* pDragEditView = nullptr; - ScModule* pScMod = SC_MOD(); - const ScDragData& rData = pScMod->GetDragData(); + const ScDragData& rData = ScModule::get()->GetDragData(); ScDrawTransferObj* pDrawTrans = rData.pDrawTransfer; if (pDrawTrans) { diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 955076030e4d..a32a996ec339 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -192,7 +192,7 @@ void collectUIInformation(std::map&& aParameters, const OUSt void ScViewFunc::StartFormatArea() { // anything to do? - if ( !SC_MOD()->GetInputOptions().GetExtendFormat() ) + if (!ScModule::get()->GetInputOptions().GetExtendFormat()) return; // start only with single cell (marked or cursor position) @@ -214,7 +214,7 @@ void ScViewFunc::StartFormatArea() bool ScViewFunc::TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrChanged ) { // anything to do? - if ( !SC_MOD()->GetInputOptions().GetExtendFormat() ) + if (!ScModule::get()->GetInputOptions().GetExtendFormat()) return false; // Test: treat input with numberformat (bAttrChanged) always as new Attribute @@ -495,7 +495,7 @@ namespace // update list of recent functions with all functions that // are not within parentheses - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); ScAppOptions aAppOpt = pScMod->GetAppOptions(); bool bOptChanged = false; @@ -1662,7 +1662,7 @@ void ScViewFunc::RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) pDocSh->PostPaint( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left ); aModificator.SetDocumentModified(); - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(); if (pHdl) pHdl->ForgetLastPattern(); } @@ -1688,7 +1688,7 @@ void ScViewFunc::UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) pDocSh->PostPaint( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left ); aModificator.SetDocumentModified(); - ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); + ScInputHandler* pHdl = ScModule::get()->GetInputHdl(); if (pHdl) pHdl->ForgetLastPattern(); } @@ -2637,7 +2637,7 @@ void ScViewFunc::SetMarkedWidthOrHeight( bool bWidth, ScSizeMode eMode, sal_uInt void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) { - ScModule* pScMod = SC_MOD(); + ScModule* pScMod = ScModule::get(); bool bAnyEdit = pScMod->IsInputMode(); SCCOL nCol = GetViewData().GetCurX(); SCROW nRow = GetViewData().GetCurY(); diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 285d8d64d790..04ee85e3c2bf 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -401,7 +401,7 @@ void PrintOutHelper( SfxViewShell const * pViewShell, const uno::Any& From, cons if ( !pViewFrame->GetFrame().IsInPlace() ) { // #TODO is this necessary ( calc specific ) -// SC_MOD()->InputEnterHandler(); +// ScModule::get()->InputEnterHandler(); pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SfxCallMode::SYNCHRON ); WaitUntilPreviewIsClosed( pViewFrame ); } From 2ca32d2905aaf42ca3feaae04a55500c708fe8ad Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 14 Nov 2024 18:53:16 +0500 Subject: [PATCH 178/373] Turn SW_MOD macro to a function Change-Id: Ide1f6fd2fc8a80b31353a14e416505a2349cea2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177071 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/inc/swmodule.hxx | 7 ++--- sw/qa/core/attr/attr.cxx | 2 +- sw/qa/extras/htmlexport/htmlexport.cxx | 4 +-- .../tiledrenderingmodeltestbase.cxx | 2 +- sw/qa/extras/uiwriter/uiwriter.cxx | 5 ++-- sw/qa/extras/ww8export/ww8export.cxx | 2 +- sw/qa/uibase/uiview/uiview.cxx | 2 +- sw/source/core/access/accdoc.cxx | 2 +- sw/source/core/access/accpara.cxx | 2 +- sw/source/core/bastyp/calc.cxx | 2 +- sw/source/core/bastyp/init.cxx | 2 +- sw/source/core/doc/DocumentRedlineManager.cxx | 4 +-- sw/source/core/doc/DocumentSettingManager.cxx | 4 +-- sw/source/core/doc/doc.cxx | 10 +++---- sw/source/core/doc/doccomp.cxx | 7 ++--- sw/source/core/doc/docfmt.cxx | 4 +-- sw/source/core/doc/doclay.cxx | 4 +-- sw/source/core/doc/docredln.cxx | 6 ++--- sw/source/core/fields/docufld.cxx | 9 ++++--- sw/source/core/layout/frmtool.cxx | 2 +- sw/source/core/layout/paintfrm.cxx | 4 +-- sw/source/core/text/frmpaint.cxx | 4 +-- sw/source/core/text/inftxt.cxx | 4 +-- sw/source/core/text/redlnitr.cxx | 6 ++--- sw/source/core/text/txtfld.cxx | 4 +-- sw/source/core/text/txtftn.cxx | 4 +-- sw/source/core/txtnode/swfont.cxx | 8 +++--- sw/source/core/txtnode/txtedt.cxx | 2 +- sw/source/filter/html/wrthtml.cxx | 5 ++-- sw/source/filter/ww8/docxattributeoutput.cxx | 6 ++--- sw/source/filter/ww8/docxtableexport.cxx | 4 +-- sw/source/filter/ww8/rtfattributeoutput.cxx | 4 +-- sw/source/filter/ww8/rtfexport.cxx | 2 +- sw/source/filter/ww8/wrtw8sty.cxx | 2 +- sw/source/filter/ww8/wrtww8.cxx | 2 +- sw/source/filter/xml/xmlexp.cxx | 2 +- sw/source/ui/chrdlg/swuiccoll.cxx | 2 +- sw/source/ui/config/optload.cxx | 10 +++---- sw/source/ui/config/optpage.cxx | 14 +++++----- sw/source/ui/dbui/dbinsdlg.cxx | 2 +- sw/source/ui/envelp/mailmrge.cxx | 2 +- sw/source/ui/fldui/flddb.cxx | 2 +- sw/source/ui/frmdlg/cption.cxx | 4 +-- sw/source/ui/index/cnttab.cxx | 4 +-- sw/source/ui/misc/linenum.cxx | 2 +- sw/source/ui/misc/outline.cxx | 2 +- sw/source/ui/table/autoformatpreview.cxx | 3 ++- sw/source/ui/table/colwd.cxx | 2 +- sw/source/ui/table/convert.cxx | 2 +- sw/source/ui/table/instable.cxx | 2 +- sw/source/ui/table/rowht.cxx | 2 +- sw/source/ui/vba/vbaapplication.cxx | 2 +- sw/source/uibase/app/docsh.cxx | 27 ++++++++++--------- sw/source/uibase/app/docsh2.cxx | 8 +++--- sw/source/uibase/app/docshini.cxx | 18 +++++++------ sw/source/uibase/app/docst.cxx | 4 +-- sw/source/uibase/app/mainwn.cxx | 8 +++--- sw/source/uibase/app/swdll.cxx | 2 +- sw/source/uibase/app/swmodul1.cxx | 18 ++++++------- sw/source/uibase/app/swmodule.cxx | 8 +++--- sw/source/uibase/dbui/dbmgr.cxx | 4 +-- sw/source/uibase/dochdl/swdtflvr.cxx | 17 +++++------- sw/source/uibase/docvw/AnnotationWin2.cxx | 4 +-- sw/source/uibase/docvw/PostItMgr.cxx | 2 +- sw/source/uibase/docvw/edtdd.cxx | 6 ++--- sw/source/uibase/docvw/edtwin.cxx | 4 +-- sw/source/uibase/docvw/edtwin2.cxx | 2 +- sw/source/uibase/docvw/edtwin3.cxx | 2 +- sw/source/uibase/docvw/romenu.cxx | 6 ++--- sw/source/uibase/docvw/srcedtw.cxx | 2 +- sw/source/uibase/envelp/envimg.cxx | 2 +- sw/source/uibase/envelp/labimg.cxx | 2 +- sw/source/uibase/lingu/olmenu.cxx | 4 +-- sw/source/uibase/misc/redlndlg.cxx | 8 +++--- sw/source/uibase/shells/annotsh.cxx | 4 +-- sw/source/uibase/shells/basesh.cxx | 6 ++--- sw/source/uibase/shells/drawsh.cxx | 2 +- sw/source/uibase/shells/drwbassh.cxx | 2 +- sw/source/uibase/shells/drwtxtex.cxx | 4 +-- sw/source/uibase/shells/drwtxtsh.cxx | 2 +- sw/source/uibase/shells/frmsh.cxx | 5 ++-- sw/source/uibase/shells/grfsh.cxx | 5 ++-- sw/source/uibase/shells/tabsh.cxx | 6 ++--- sw/source/uibase/shells/textsh.cxx | 2 +- sw/source/uibase/shells/textsh1.cxx | 7 ++--- sw/source/uibase/sidebar/TableEditPanel.cxx | 6 ++--- sw/source/uibase/uiview/pview.cxx | 9 ++++--- sw/source/uibase/uiview/uivwimp.cxx | 4 +-- sw/source/uibase/uiview/view.cxx | 21 +++++++-------- sw/source/uibase/uiview/view0.cxx | 2 +- sw/source/uibase/uiview/view1.cxx | 3 +-- sw/source/uibase/uiview/view2.cxx | 2 +- sw/source/uibase/uiview/viewdlg2.cxx | 2 +- sw/source/uibase/uiview/viewmdi.cxx | 10 ++++--- sw/source/uibase/uiview/viewprt.cxx | 6 ++--- sw/source/uibase/uiview/viewstat.cxx | 2 +- sw/source/uibase/uno/unomod.cxx | 19 ++++++------- sw/source/uibase/uno/unomodule.cxx | 9 ++++--- sw/source/uibase/uno/unotxdoc.cxx | 14 +++++----- sw/source/uibase/utlui/content.cxx | 4 +-- sw/source/uibase/utlui/navipi.cxx | 4 +-- sw/source/uibase/utlui/uitool.cxx | 8 +++--- sw/source/uibase/utlui/unotools.cxx | 6 ++--- sw/source/uibase/web/wview.cxx | 2 +- sw/source/uibase/wrtsh/wrtsh1.cxx | 7 ++--- 105 files changed, 278 insertions(+), 267 deletions(-) diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 334faf772738..c77fa3d0d7b7 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -251,11 +251,12 @@ public: SW_DLLPUBLIC void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller); void CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments); + +// Access to SwModule + static auto get() { return static_cast(SfxApplication::GetModule(SfxToolsModule::Writer)); } }; -// Access to SwModule, the View and the shell. - -#define SW_MOD() ( static_cast(SfxApplication::GetModule(SfxToolsModule::Writer))) +// Access to the View and the shell. SAL_RET_MAYBENULL SW_DLLPUBLIC SwView* GetActiveView(); SAL_RET_MAYBENULL SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell(); diff --git a/sw/qa/core/attr/attr.cxx b/sw/qa/core/attr/attr.cxx index fcb68493875f..fbacf044cb48 100644 --- a/sw/qa/core/attr/attr.cxx +++ b/sw/qa/core/attr/attr.cxx @@ -39,7 +39,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSwAttrSet) dispatchCommand(mxComponent, u".uno:Cut"_ustr, {}); dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); rtl::Reference xTransferable(new SwTransferable(*pWrtShell)); - SwModule* pMod = SW_MOD(); + SwModule* pMod = SwModule::get(); SwTransferable* pOldTransferable = pMod->m_pXSelection; pMod->m_pXSelection = xTransferable.get(); diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 8dbb4cff6a14..fa6b75e9da92 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -101,8 +101,8 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testFdo86857) CPPUNIT_TEST_FIXTURE(HtmlExportTest, testCharacterBorder) { // FIXME if padding-top gets exported as inches, not cms, we get rounding errors. - SwGlobals::ensure(); // make sure that SW_MOD() is not 0 - SwMasterUsrPref* pPref = const_cast(SW_MOD()->GetUsrPref(false)); + SwGlobals::ensure(); // make sure that SwModule::get() is not 0 + SwMasterUsrPref* pPref = const_cast(SwModule::get()->GetUsrPref(false)); FieldUnit eUnit = pPref->GetMetric(); pPref->SetMetric(FieldUnit::CM); comphelper::ScopeGuard g([pPref, eUnit]() { pPref->SetMetric(eUnit); }); diff --git a/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx b/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx index 62d41e0a63b0..a53770b06cc3 100644 --- a/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx +++ b/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx @@ -84,7 +84,7 @@ void SwTiledRenderingTest::setUp() SwModelTestBase::setUp(); SwGlobals::ensure(); - SW_MOD()->ClearRedlineAuthors(); + SwModule::get()->ClearRedlineAuthors(); comphelper::LibreOfficeKit::setActive(true); } diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index be9cb4d7416f..dd683c11acce 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1874,7 +1874,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf68183) // First disable RSID and check if indeed no such attribute is inserted. createSwDoc(); SwDoc* pDoc = getSwDoc(); - SW_MOD()->GetModuleConfig()->SetStoreRsid(false); + SwModule* mod = SwModule::get(); + mod->GetModuleConfig()->SetStoreRsid(false); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert2(u"X"_ustr); @@ -1884,7 +1885,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf68183) CPPUNIT_ASSERT_EQUAL(false, pTextNode->GetSwAttrSet().HasItem(RES_PARATR_RSID)); // Then enable storing of RSID and make sure that the attribute is inserted. - SW_MOD()->GetModuleConfig()->SetStoreRsid(true); + mod->GetModuleConfig()->SetStoreRsid(true); pWrtShell->DelToStartOfLine(); pWrtShell->Insert2(u"X"_ustr); diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 9ac1e8321bef..c62078af50d0 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -1503,7 +1503,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf94386) SfxItemSet aSet(pWrtShell->GetView().GetCurShell()->GetPool(), svl::Items); aSet.Put(SwEnvItem()); SfxRequest aRequest(FN_ENVELOP, SfxCallMode::SYNCHRON, aSet); - SW_MOD()->ExecOther(aRequest); + SwModule::get()->ExecOther(aRequest); } saveAndReload(u"MS Word 97"_ustr); diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx index a7453f0b8f6e..531d4d351432 100644 --- a/sw/qa/uibase/uiview/uiview.cxx +++ b/sw/qa/uibase/uiview/uiview.cxx @@ -124,7 +124,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testKeepRatio) comphelper::ScopeGuard g([pWrtShell, pViewOption] { SwViewOption aViewOption(*pViewOption); aViewOption.SetKeepRatio(false); - SW_MOD()->ApplyUsrPref(aViewOption, &pWrtShell->GetView()); + SwModule::get()->ApplyUsrPref(aViewOption, &pWrtShell->GetView()); }); // Without the accompanying fix in place, this test would have failed, because KeepRatio was not // mapped to settings.xml diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index 8bad1e5c5f06..e2d4bea133e0 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -714,7 +714,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() sal_Int32 SAL_CALL SwAccessibleDocument::getBackground() { SolarMutexGuard aGuard; - return sal_Int32(SW_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor); + return sal_Int32(SwModule::get()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 57743ad19cdc..09ca10c3265d 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1837,7 +1837,7 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex, if ( pRedline ) { - const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig(); + const SwModuleOptions* pOpt = SwModule::get()->GetModuleConfig(); AuthorCharAttr aChangeAttr; if ( pOpt ) { diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 26ea024c511c..5512e4259651 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -271,7 +271,7 @@ SwCalc::SwCalc( SwDoc& rD ) for( n = 0; n < 4; ++n ) lcl_GetCalcExp(m_aVarTable, sNTypeTab[n + 7]).nValue.PutLong( rDocStat.*aDocStat2[ n ] ); - SvtUserOptions& rUserOptions = SW_MOD()->GetUserOptions(); + SvtUserOptions& rUserOptions = SwModule::get()->GetUserOptions(); lcl_GetCalcExp(m_aVarTable, sNTypeTab[11]).nValue.PutString( rUserOptions.GetFirstName() ); lcl_GetCalcExp(m_aVarTable, sNTypeTab[12]).nValue.PutString( rUserOptions.GetLastName() ); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index c823eccd94e6..da24bbaf4d5e 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -336,7 +336,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_TXTATR_METAFIELD, SwFormatMeta::CreatePoolDefault(RES_TXTATR_METAFIELD), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_AUTOFMT, new SwFormatAutoFormat, 0, SFX_ITEMINFOFLAG_NONE }, - // We cannot yet create the SwFormatINetFormat, that would crash since SW_MOD + // We cannot yet create the SwFormatINetFormat, that would crash since SwModule::get // is not initialized and the translated resource strings would not be available. // Luckily this mechanism allows to also flag this ItemInfo as 'incomplete' using // a nullptr as ItemPtr and implementing on-demand creation, see ::getItemInfo diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index b6f2ba079fbf..82e128f0fd95 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -3850,13 +3850,13 @@ bool DocumentRedlineManager::SetRedlineComment( const SwPaM& rPaM, const OUStrin // Create a new author if necessary std::size_t DocumentRedlineManager::GetRedlineAuthor() { - return SW_MOD()->GetRedlineAuthor(); + return SwModule::get()->GetRedlineAuthor(); } /// Insert new author into the Table for the Readers etc. std::size_t DocumentRedlineManager::InsertRedlineAuthor( const OUString& rNew ) { - return SW_MOD()->InsertRedlineAuthor(rNew); + return SwModule::get()->InsertRedlineAuthor(rNew); } void DocumentRedlineManager::UpdateRedlineAttr() diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 2d9e2c389724..2f9d4f840d90 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -670,7 +670,7 @@ sal_uInt16 sw::DocumentSettingManager::getLinkUpdateMode( /*[in]*/bool bGlobalSe { sal_uInt16 nRet = mnLinkUpdMode; if( bGlobalSettings && GLOBALSETTING == nRet ) - nRet = SW_MOD()->GetLinkUpdMode(); + nRet = SwModule::get()->GetLinkUpdMode(); return nRet; } @@ -683,7 +683,7 @@ SwFieldUpdateFlags sw::DocumentSettingManager::getFieldUpdateFlags( /*[in]*/bool { SwFieldUpdateFlags eRet = meFieldUpdMode; if( bGlobalSettings && AUTOUPD_GLOBALSETTING == eRet ) - eRet = SW_MOD()->GetFieldUpdateFlags(); + eRet = SwModule::get()->GetFieldUpdateFlags(); return eRet; } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 2c23d36d6c16..a7351ea9ef7a 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -2115,27 +2115,27 @@ bool SwDoc::ConvertFieldsToText(SwRootFrame const& rLayout) bool SwDoc::IsInsTableFormatNum() const { - return SW_MOD()->IsInsTableFormatNum(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE)); + return SwModule::get()->IsInsTableFormatNum(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE)); } bool SwDoc::IsInsTableChangeNumFormat() const { - return SW_MOD()->IsInsTableChangeNumFormat(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE)); + return SwModule::get()->IsInsTableChangeNumFormat(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE)); } bool SwDoc::IsInsTableAlignNum() const { - return SW_MOD()->IsInsTableAlignNum(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE)); + return SwModule::get()->IsInsTableAlignNum(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE)); } bool SwDoc::IsSplitVerticalByDefault() const { - return SW_MOD()->IsSplitVerticalByDefault(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE)); + return SwModule::get()->IsSplitVerticalByDefault(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE)); } void SwDoc::SetSplitVerticalByDefault(bool value) { - SW_MOD()->SetSplitVerticalByDefault(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE), value); + SwModule::get()->SetSplitVerticalByDefault(GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE), value); } /// Set up the InsertDB as Undo table diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 17999886deb1..50aea4a5a20e 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1837,7 +1837,8 @@ tools::Long SwDoc::CompareDoc( const SwDoc& rDoc ) tools::Long nRet = 0; // Get comparison options - CmpOptions.eCmpMode = SW_MOD()->GetCompareMode(); + SwModule* mod = SwModule::get(); + CmpOptions.eCmpMode = mod->GetCompareMode(); if( CmpOptions.eCmpMode == SwCompareMode::Auto ) { if( getRsidRoot() == rDoc.getRsidRoot() ) @@ -1855,8 +1856,8 @@ tools::Long SwDoc::CompareDoc( const SwDoc& rDoc ) } else { - CmpOptions.bUseRsid = getRsidRoot() == rDoc.getRsidRoot() && SW_MOD()->IsUseRsid(); - CmpOptions.nIgnoreLen = SW_MOD()->IsIgnorePieces() ? SW_MOD()->GetPieceLen() : 0; + CmpOptions.bUseRsid = getRsidRoot() == rDoc.getRsidRoot() && mod->IsUseRsid(); + CmpOptions.nIgnoreLen = mod->IsIgnorePieces() ? mod->GetPieceLen() : 0; } GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 085cdd9770f1..1e10a532c2a9 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -411,7 +411,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, /// Set the rsid of the next nLen symbols of rRg to the current session number void SwDoc::UpdateRsid( const SwPaM &rRg, const sal_Int32 nLen ) { - if (!SW_MOD()->GetModuleConfig()->IsStoreRsid()) + if (!SwModule::get()->GetModuleConfig()->IsStoreRsid()) return; SwTextNode *pTextNode = rRg.GetPoint()->GetNode().GetTextNode(); @@ -442,7 +442,7 @@ void SwDoc::UpdateRsid( const SwPaM &rRg, const sal_Int32 nLen ) bool SwDoc::UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal ) { - if (!SW_MOD()->GetModuleConfig()->IsStoreRsid()) + if (!SwModule::get()->GetModuleConfig()->IsStoreRsid()) return false; if (!pTextNode) diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 00c6d8080286..b6fbed83c51c 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -887,7 +887,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, if( pNew ) { // #i61007# order of captions - bool bOrderNumberingFirst = SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst(); + bool bOrderNumberingFirst = SwModule::get()->GetModuleConfig()->IsCaptionOrderNumberingFirst(); // Work up OUString OUString aText; if( bOrderNumberingFirst ) @@ -1180,7 +1180,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable if( pNew ) { //#i61007# order of captions - bool bOrderNumberingFirst = SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst(); + bool bOrderNumberingFirst = SwModule::get()->GetModuleConfig()->IsCaptionOrderNumberingFirst(); // prepare string OUString aText; diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 9ccc8348a561..988ec45884f0 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1359,7 +1359,7 @@ void SwRedlineData::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number(GetSeqNo()).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("author"), BAD_CAST(SW_MOD()->GetRedlineAuthor(GetAuthor()).toUtf8().getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("author"), BAD_CAST(SwModule::get()->GetRedlineAuthor(GetAuthor()).toUtf8().getStr())); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("date"), BAD_CAST(DateTimeToOString(GetTimeStamp()).getStr())); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("descr"), BAD_CAST(GetDescr().toUtf8().getStr())); @@ -1572,7 +1572,7 @@ void SwRangeRedline::Show(sal_uInt16 nLoop, size_t nMyPos, bool bForced) if (pSh) bIsShowChangesInMargin = pSh->GetViewOptions()->IsShowChangesInMargin(); else - bIsShowChangesInMargin = SW_MOD()->GetUsrPref(false)->IsShowChangesInMargin(); + bIsShowChangesInMargin = SwModule::get()->GetUsrPref(false)->IsShowChangesInMargin(); } if( 1 > nLoop && !bIsShowChangesInMargin ) @@ -2268,7 +2268,7 @@ std::size_t SwRangeRedline::GetAuthor( sal_uInt16 nPos ) const OUString const & SwRangeRedline::GetAuthorString( sal_uInt16 nPos ) const { - return SW_MOD()->GetRedlineAuthor(GetRedlineData(nPos).m_nAuthor); + return SwModule::get()->GetRedlineAuthor(GetRedlineData(nPos).m_nAuthor); } sal_uInt32 SwRangeRedline::GetMovedID(sal_uInt16 nPos) const diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index ec439961d788..948b955b196f 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -322,13 +322,14 @@ SwAuthorFieldType::SwAuthorFieldType() OUString SwAuthorFieldType::Expand(sal_uLong nFormat) { - SvtUserOptions& rOpt = SW_MOD()->GetUserOptions(); + SwModule* mod = SwModule::get(); + SvtUserOptions& rOpt = mod->GetUserOptions(); if((nFormat & 0xff) == AF_NAME) { // Prefer the view's redline author name. // (set in SwXTextDocument::initializeForTiledRendering) - std::size_t nAuthor = SW_MOD()->GetRedlineAuthor(); - OUString sAuthor = SW_MOD()->GetRedlineAuthor(nAuthor); + std::size_t nAuthor = mod->GetRedlineAuthor(); + OUString sAuthor = mod->GetRedlineAuthor(nAuthor); if (sAuthor.isEmpty()) return rOpt.GetFullName(); @@ -2074,7 +2075,7 @@ OUString SwExtUserFieldType::Expand(sal_uInt16 nSub ) } if( static_cast(USHRT_MAX) != nRet ) { - SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions(); + SvtUserOptions& rUserOpt = SwModule::get()->GetUserOptions(); return rUserOpt.GetToken( nRet ); } return OUString(); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 14cac86e962a..2ccb8b34116d 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3961,7 +3961,7 @@ bool IsExtraData( const SwDoc *pDoc ) const SwLineNumberInfo &rInf = pDoc->GetLineNumberInfo(); if (rInf.IsPaintLineNumbers() || rInf.IsCountInFlys() || - (static_cast(SW_MOD()->GetRedlineMarkPos()) != text::HoriOrientation::NONE && + (static_cast(SwModule::get()->GetRedlineMarkPos()) != text::HoriOrientation::NONE && !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty())) { return true; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 1120879e707a..8e2b97e7c045 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7655,7 +7655,7 @@ void SwPageFrame::RefreshExtraData( const SwRect &rRect ) const { const SwLineNumberInfo &rInfo = GetFormat()->GetDoc()->GetLineNumberInfo(); bool bLineInFly = (rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys()) - || static_cast(SW_MOD()->GetRedlineMarkPos()) != text::HoriOrientation::NONE; + || static_cast(SwModule::get()->GetRedlineMarkPos()) != text::HoriOrientation::NONE; SwRect aRect( rRect ); ::SwAlignRect( aRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() ); @@ -7682,7 +7682,7 @@ void SwLayoutFrame::RefreshExtraData( const SwRect &rRect ) const const SwLineNumberInfo &rInfo = GetFormat()->GetDoc()->GetLineNumberInfo(); bool bLineInBody = rInfo.IsPaintLineNumbers(), bLineInFly = bLineInBody && rInfo.IsCountInFlys(), - bRedLine = static_cast(SW_MOD()->GetRedlineMarkPos())!=text::HoriOrientation::NONE; + bRedLine = static_cast(SwModule::get()->GetRedlineMarkPos())!=text::HoriOrientation::NONE; const SwContentFrame *pCnt = ContainsContent(); while ( pCnt && IsAnLower( pCnt ) ) diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index b23741335cb0..ce6f31a4e88f 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -295,7 +295,7 @@ void SwExtraPainter::PaintRedline( SwTwips nY, tools::Long nMax ) } } const Color aOldCol( m_pSh->GetOut()->GetLineColor() ); - m_pSh->GetOut()->SetLineColor( SW_MOD()->GetRedlineMarkColor() ); + m_pSh->GetOut()->SetLineColor(SwModule::get()->GetRedlineMarkColor()); if ( m_pTextFrame->IsVertical() ) { @@ -320,7 +320,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const const SwFormatLineNumber &rLineNum = GetAttrSet()->GetLineNumber(); bool bLineNum = !IsInTab() && rLineInf.IsPaintLineNumbers() && ( !IsInFly() || rLineInf.IsCountInFlys() ) && rLineNum.IsCount(); - sal_Int16 eHor = static_cast(SW_MOD()->GetRedlineMarkPos()); + sal_Int16 eHor = static_cast(SwModule::get()->GetRedlineMarkPos()); if (eHor != text::HoriOrientation::NONE && (!IDocumentRedlineAccess::IsShowChanges(rIDRA.GetRedlineFlags()) || getRootFrame()->IsHideRedlines())) diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 1d7bbaf42e18..ec2d82be4356 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -313,7 +313,7 @@ void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextF m_pOpt = m_pVsh ? m_pVsh->GetViewOptions() : - SW_MOD()->GetViewOption(rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)); // Options from Module, due to StarONE + SwModule::get()->GetViewOption(rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)); // Options from Module, due to StarONE // bURLNotify is set if MakeGraphic prepares it // TODO: Unwind @@ -1637,7 +1637,7 @@ void SwTextFormatInfo::CtorInitTextFormatInfo( OutputDevice* pRenderContext, SwT m_nLineNetHeight = 0; SetLineStart(TextFrameIndex(0)); - SvtCTLOptions::TextNumerals const nTextNumerals(SW_MOD()->GetCTLTextNumerals()); + SvtCTLOptions::TextNumerals const nTextNumerals(SwModule::get()->GetCTLTextNumerals()); // cannot cache for NUMERALS_CONTEXT because we need to know the string // for the whole paragraph now if (nTextNumerals != SvtCTLOptions::NUMERALS_CONTEXT) diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 9b4175d9697e..9285bf457803 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -873,14 +873,14 @@ void SwRedlineItr::FillHints( std::size_t nAuthor, RedlineType eType ) switch ( eType ) { case RedlineType::Insert: - SW_MOD()->GetInsertAuthorAttr(nAuthor, *m_pSet); + SwModule::get()->GetInsertAuthorAttr(nAuthor, *m_pSet); break; case RedlineType::Delete: - SW_MOD()->GetDeletedAuthorAttr(nAuthor, *m_pSet); + SwModule::get()->GetDeletedAuthorAttr(nAuthor, *m_pSet); break; case RedlineType::Format: case RedlineType::FmtColl: - SW_MOD()->GetFormatAuthorAttr(nAuthor, *m_pSet); + SwModule::get()->GetFormatAuthorAttr(nAuthor, *m_pSet); break; default: break; diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 3020a2118722..a9406f55740c 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -485,9 +485,9 @@ static bool lcl_setRedlineAttr( SwTextFormatInfo &rInf, const SwTextNode& rTextN : pRedlineNum->GetAuthor(); if ( RedlineType::Delete == pRedlineNum->GetType() ) - SW_MOD()->GetDeletedAuthorAttr(aAuthor, aSet); + SwModule::get()->GetDeletedAuthorAttr(aAuthor, aSet); else - SW_MOD()->GetInsertAuthorAttr(aAuthor, aSet); + SwModule::get()->GetInsertAuthorAttr(aAuthor, aSet); if (const SvxColorItem* pItem = aSet.GetItemIfSet(RES_CHRATR_COLOR)) pNumFnt->SetColor(pItem->GetValue()); diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 787ea1390e78..0cf0f266511a 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -1015,9 +1015,9 @@ SwNumberPortion *SwTextFormatter::NewFootnoteNumPortion( SwTextFormatInfo const : pRedline->GetAuthor(); if ( RedlineType::Delete == pRedline->GetType() ) - SW_MOD()->GetDeletedAuthorAttr(aAuthor, aSet); + SwModule::get()->GetDeletedAuthorAttr(aAuthor, aSet); else - SW_MOD()->GetInsertAuthorAttr(aAuthor, aSet); + SwModule::get()->GetInsertAuthorAttr(aAuthor, aSet); if (const SvxColorItem* pItem = aSet.GetItemIfSet(RES_CHRATR_COLOR)) pNumFnt->SetColor(pItem->GetValue()); diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 864d3c99ecfb..905d65d0a8b8 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -1012,7 +1012,7 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf ) ChgFnt( rInf.GetShell(), rInf.GetOut() ); SwDigitModeModifier aDigitModeModifier(rInf.GetOut(), rInf.GetFont()->GetLanguage(), - SW_MOD()->GetCTLTextNumerals()); + SwModule::get()->GetCTLTextNumerals()); Size aTextSize; TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING) @@ -1142,7 +1142,7 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey ) ChgFnt( rInf.GetShell(), rInf.GetOut() ); SwDigitModeModifier aDigitModeModifier(rInf.GetOut(), rInf.GetFont()->GetLanguage(), - SW_MOD()->GetCTLTextNumerals()); + SwModule::get()->GetCTLTextNumerals()); const Point aOldPos(rInf.GetPos()); Point aPos( rInf.GetPos() ); @@ -1268,7 +1268,7 @@ void SwSubFont::DrawStretchText_( SwDrawTextInfo &rInf ) ChgFnt( rInf.GetShell(), rInf.GetOut() ); SwDigitModeModifier aDigitModeModifier(rInf.GetOut(), rInf.GetFont()->GetLanguage(), - SW_MOD()->GetCTLTextNumerals()); + SwModule::get()->GetCTLTextNumerals()); rInf.ApplyAutoColor(); @@ -1334,7 +1334,7 @@ TextFrameIndex SwSubFont::GetModelPositionForViewPoint_( SwDrawTextInfo& rInf ) ChgFnt( rInf.GetShell(), rInf.GetOut() ); SwDigitModeModifier aDigitModeModifier(rInf.GetOut(), rInf.GetFont()->GetLanguage(), - SW_MOD()->GetCTLTextNumerals()); + SwModule::get()->GetCTLTextNumerals()); TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING) ? TextFrameIndex(rInf.GetText().getLength()) diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index e3ae5955a6da..0b448c74ead5 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -228,7 +228,7 @@ lcl_MaskRedlinesAndHiddenText( const SwTextNode& rNode, OUStringBuffer& rText, nRedlinesMasked = lcl_MaskRedlines( rNode, rText, nStt, nEnd, cChar ); } - const bool bHideHidden = !SW_MOD()->GetViewOption(rDoc.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE))->IsShowHiddenChar(); + const bool bHideHidden = !SwModule::get()->GetViewOption(rDoc.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE))->IsShowHiddenChar(); // If called from word count, we want to mask the hidden ranges even // if they are visible: diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index b4a277ec5df4..88a4da9e3dd3 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -377,7 +377,8 @@ void SwHTMLWriter::SetupFilterFromPropertyValues( ErrCode SwHTMLWriter::WriteStream() { - if (!SW_MOD()) + SwModule* mod = SwModule::get(); + if (!mod) return ERRCODE_ABORT; // Intercept paste output if requested. char* pPasteEnv = getenv("SW_DEBUG_HTML_PASTE_TO"); @@ -439,7 +440,7 @@ ErrCode SwHTMLWriter::WriteStream() if( IsHTMLMode(HTMLMODE_SOME_STYLES | HTMLMODE_FULL_STYLES) ) m_nHTMLMode |= HTMLMODE_PRINT_EXT; - m_eCSS1Unit = SW_MOD()->GetMetric( m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) ); + m_eCSS1Unit = mod->GetMetric( m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) ); // Only for the MS-IE we favour the export of styles. m_bCfgPreferStyles = HTML_CFG_MSIE == m_nExportMode; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 8061bdcd9f49..84605d814f7d 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2214,7 +2214,7 @@ void DocxAttributeOutput::DoWriteMoveRangeTagStart(std::u16string_view bookmarkN SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && !SvtSecurityOptions::IsOptionSet( SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo); - const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( pRedlineData->GetAuthor() ) ); + const OUString& rAuthor(SwModule::get()->GetRedlineAuthor(pRedlineData->GetAuthor())); const DateTime& aDateTime = pRedlineData->GetTimeStamp(); bool bNoDate = bRemovePersonalInfo || ( aDateTime.GetYear() == 1970 && aDateTime.GetMonth() == 1 && aDateTime.GetDay() == 1 ); @@ -4106,7 +4106,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo); OString aId( OString::number( pRedlineData->GetSeqNo() ) ); - const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( pRedlineData->GetAuthor() ) ); + const OUString& rAuthor(SwModule::get()->GetRedlineAuthor(pRedlineData->GetAuthor())); const DateTime& aDateTime = pRedlineData->GetTimeStamp(); bool bNoDate = bRemovePersonalInfo || ( aDateTime.GetYear() == 1970 && aDateTime.GetMonth() == 1 && aDateTime.GetDay() == 1 ); @@ -4262,7 +4262,7 @@ void DocxAttributeOutput::StartRedline( const SwRedlineData * pRedlineData, bool SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && !SvtSecurityOptions::IsOptionSet( SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo); - const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( pRedlineData->GetAuthor() ) ); + const OUString& rAuthor(SwModule::get()->GetRedlineAuthor(pRedlineData->GetAuthor())); OString aAuthor( OUStringToOString( bRemovePersonalInfo ? "Author" + OUString::number( GetExport().GetInfoID(rAuthor) ) : rAuthor, RTL_TEXTENCODING_UTF8 ) ); diff --git a/sw/source/filter/ww8/docxtableexport.cxx b/sw/source/filter/ww8/docxtableexport.cxx index d8ee80836b0f..6a35e414a2d9 100644 --- a/sw/source/filter/ww8/docxtableexport.cxx +++ b/sw/source/filter/ww8/docxtableexport.cxx @@ -675,7 +675,7 @@ void DocxAttributeOutput::TableRowRedline( // use the same redline id in OOXML exported by MSO, but it seems, the recent solution // (different IDs for different ranges, also row changes) is also portable. OString aId(OString::number(m_nRedlineId++)); - const OUString& rAuthor(SW_MOD()->GetRedlineAuthor(aRedlineData.GetAuthor())); + const OUString& rAuthor(SwModule::get()->GetRedlineAuthor(aRedlineData.GetAuthor())); OString aAuthor(OUStringToOString( bRemovePersonalInfo ? "Author" + OUString::number(GetExport().GetInfoID(rAuthor)) : rAuthor, @@ -746,7 +746,7 @@ void DocxAttributeOutput::TableCellRedline( // use the same redline id in OOXML exported by MSO, but it seems, the recent solution // (different IDs for different ranges, also row changes) is also portable. OString aId(OString::number(m_nRedlineId++)); - const OUString& rAuthor(SW_MOD()->GetRedlineAuthor(aRedlineData.GetAuthor())); + const OUString& rAuthor(SwModule::get()->GetRedlineAuthor(aRedlineData.GetAuthor())); OString aAuthor(OUStringToOString( bRemovePersonalInfo ? "Author" + OUString::number(GetExport().GetInfoID(rAuthor)) : rAuthor, diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 7ddde4e78101..4f881ab90d84 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -637,7 +637,7 @@ void RtfAttributeOutput::Redline(const SwRedlineData* pRedline) m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVISED); m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVAUTH); m_aRun->append(static_cast( - m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())))); + m_rExport.GetRedline(SwModule::get()->GetRedlineAuthor(pRedline->GetAuthor())))); if (!bRemoveCommentAuthorDates) m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVDTTM); } @@ -646,7 +646,7 @@ void RtfAttributeOutput::Redline(const SwRedlineData* pRedline) m_aRun->append(OOO_STRING_SVTOOLS_RTF_DELETED); m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVAUTHDEL); m_aRun->append(static_cast( - m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())))); + m_rExport.GetRedline(SwModule::get()->GetRedlineAuthor(pRedline->GetAuthor())))); if (!bRemoveCommentAuthorDates) m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVDTTMDEL); } diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index b8c78f828375..bdbcdbe000df 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -270,7 +270,7 @@ void RtfExport::WriteRevTab() for (SwRangeRedline* pRedl : m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()) { - GetRedline(SW_MOD()->GetRedlineAuthor(pRedl->GetAuthor())); + GetRedline(SwModule::get()->GetRedlineAuthor(pRedl->GetAuthor())); } bool bRemoveChangesInfo diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 39f195bc3d6e..6b26ce5533db 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2222,7 +2222,7 @@ WW8_Annotation::WW8_Annotation(const SwRedlineData* pRedline) m_nRangeEnd(0), mpAuthorIDs(new SvtSecurityMapPersonalInfo) { - initPersonalInfo(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()), u""_ustr, + initPersonalInfo(SwModule::get()->GetRedlineAuthor(pRedline->GetAuthor()), u""_ustr, pRedline->GetTimeStamp()); } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index d436a61d00d7..41ec0aaf4e46 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1684,7 +1684,7 @@ sal_uInt16 WW8Export::AddRedlineAuthor( std::size_t nId ) bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo) && !SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo); - OUString sName(SW_MOD()->GetRedlineAuthor(nId)); + OUString sName(SwModule::get()->GetRedlineAuthor(nId)); return m_pRedlAuthors->AddName( bRemovePersonalInfo ? "Author" + OUString::number(mpAuthorIDs->GetInfoID(sName)) : sName); } diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index b0be42eab82f..6ccdf667ce20 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -191,7 +191,7 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) } sal_uInt16 const eUnit = SvXMLUnitConverter::GetMeasureUnit( - SW_MOD()->GetMetric(pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))); + SwModule::get()->GetMetric(pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))); if (GetMM100UnitConverter().GetXMLMeasureUnit() != eUnit ) { GetMM100UnitConverter().SetXMLMeasureUnit( eUnit ); diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index 1838ac554570..209a468103cb 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -71,7 +71,7 @@ SwCondCollPage::SwCondCollPage(weld::Container* pPage, weld::DialogController* p m_xStyleLB->connect_changed(LINK(this, SwCondCollPage, SelectTreeListBoxHdl)); m_xFilterLB->connect_changed(LINK(this, SwCondCollPage, SelectListBoxHdl)); - std::optional xFamilies(SW_MOD()->CreateStyleFamilies()); + std::optional xFamilies(SwModule::get()->CreateStyleFamilies()); size_t nCount = xFamilies->size(); for (size_t j = 0; j < nCount; ++j) { diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index f3419cb1e968..917f18f7d7d5 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -623,7 +623,7 @@ OUString SwLoadOptPage::GetAllStrings() bool SwLoadOptPage::FillItemSet( SfxItemSet* rSet ) { bool bRet = false; - SwModule* pMod = SW_MOD(); + SwModule* pMod = SwModule::get(); sal_Int32 nNewLinkMode = AUTOMATIC; if (m_xNeverRB->get_active()) @@ -730,7 +730,7 @@ bool SwLoadOptPage::FillItemSet( SfxItemSet* rSet ) void SwLoadOptPage::Reset( const SfxItemSet* rSet) { - const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref(false); + const SwMasterUsrPref* pUsrPref = SwModule::get()->GetUsrPref(false); const SwPtrItem* pShellItem = rSet->GetItemIfSet(FN_PARAM_WRTSHELL, false); if(pShellItem) @@ -1081,7 +1081,7 @@ OUString SwCaptionOptPage::GetAllStrings() bool SwCaptionOptPage::FillItemSet( SfxItemSet* ) { bool bRet = false; - SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); SaveEntry(m_xCheckLB->get_selected_index()); // apply current entry @@ -1177,7 +1177,7 @@ void SwCaptionOptPage::Reset( const SfxItemSet* rSet) SetOptions( nPos++, OLE_CAP, &rOleId ); } m_xLbCaptionOrder->set_active( - SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() ? 1 : 0); + SwModule::get()->GetModuleConfig()->IsCaptionOrderNumberingFirst() ? 1 : 0); m_xLbCaptionOrder->set_sensitive(!officecfg::Office::Writer::Insert::Caption::CaptionOrderNumberingFirst::isReadOnly()); m_xLbCaptionOrderImg->set_visible(officecfg::Office::Writer::Insert::Caption::CaptionOrderNumberingFirst::isReadOnly()); m_xCheckLB->select(0); @@ -1187,7 +1187,7 @@ void SwCaptionOptPage::Reset( const SfxItemSet* rSet) void SwCaptionOptPage::SetOptions(const sal_uLong nPos, const SwCapObjType eObjType, const SvGlobalName *pOleId) { - SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); const InsCaptionOpt* pOpt = pModOpt->GetCapOption(m_bHTMLMode, eObjType, pOleId); if (pOpt) diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index a591b9dbd5d9..3591ffb215ec 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -953,7 +953,7 @@ OUString SwStdFontTabPage::GetAllStrings() bool SwStdFontTabPage::FillItemSet( SfxItemSet* ) { - SW_MOD()->GetModuleConfig()->SetDefaultFontInCurrDocOnly(false); + SwModule::get()->GetModuleConfig()->SetDefaultFontInCurrDocOnly(false); const OUString sStandard = m_xStandardBox->get_active_text(); const OUString sTitle = m_xTitleBox->get_active_text(); @@ -1475,7 +1475,7 @@ OUString SwTableOptionsTabPage::GetAllStrings() bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* ) { bool bRet = false; - SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); if (m_xRowMoveMF->get_value_changed_from_saved()) pModOpt->SetTableHMove( o3tl::narrowing(m_xRowMoveMF->denormalize( m_xRowMoveMF->get_value(FieldUnit::TWIP)))); @@ -1566,7 +1566,7 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* rSet) m_bHTMLMode = 0 != (pItem->GetValue() & HTMLMODE_ON); } - const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + const SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); if ( rSet->GetItemState( SID_ATTR_METRIC ) >= SfxItemState::DEFAULT ) { const SfxUInt16Item& rItem = rSet->Get( SID_ATTR_METRIC ); @@ -2332,7 +2332,7 @@ OUString SwRedlineOptionsTabPage::GetAllStrings() bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) { CharAttr *pAttr; - SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pOpt = SwModule::get()->GetModuleConfig(); AuthorCharAttr aInsertedAttr; AuthorCharAttr aDeletedAttr; @@ -2408,7 +2408,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) void SwRedlineOptionsTabPage::Reset( const SfxItemSet* ) { - const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig(); + const SwModuleOptions* pOpt = SwModule::get()->GetModuleConfig(); const AuthorCharAttr &rInsertAttr = pOpt->GetInsertAuthorAttr(); const AuthorCharAttr &rDeletedAttr = pOpt->GetDeletedAuthorAttr(); @@ -2755,7 +2755,7 @@ OUString SwCompareOptionsTabPage::GetAllStrings() bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* ) { bool bRet = false; - SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pOpt = SwModule::get()->GetModuleConfig(); if( m_xAutoRB->get_state_changed_from_saved() || m_xWordRB->get_state_changed_from_saved() || @@ -2788,7 +2788,7 @@ bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* ) void SwCompareOptionsTabPage::Reset( const SfxItemSet* ) { - SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pOpt = SwModule::get()->GetModuleConfig(); SwCompareMode eCmpMode = pOpt->GetCompareMode(); if( eCmpMode == SwCompareMode::Auto ) diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 4a8dff5bee90..6ecdd3987211 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1003,7 +1003,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence& rSelection, break; } - const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + const SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); bool bHTML = 0 != (::GetHtmlMode( m_pView->GetDocShell() ) & HTMLMODE_ON); rSh.InsertTable( diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 4893d1df86db..ab4b32cb7f53 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -213,7 +213,7 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell, } } - m_pModOpt = SW_MOD()->GetModuleConfig(); + m_pModOpt = SwModule::get()->GetModuleConfig(); MailTextFormats nMailingMode(m_pModOpt->GetMailingFormats()); m_xFormatSwCB->set_active(bool(nMailingMode & MailTextFormats::OFFICE)); diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index 99af2899746b..1a4bfebaca4c 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -515,7 +515,7 @@ void SwFieldDBPage::ActivateMailMergeAddress() { m_xTypeLB->select_id(OUString::number(static_cast(SwFieldTypesEnum::Database))); TypeListBoxHdl(*m_xTypeLB); - const SwDBData& rData = SW_MOD()->GetDBConfig()->GetAddressSource(); + const SwDBData& rData = SwModule::get()->GetDBConfig()->GetAddressSource(); m_xDatabaseTLB->Select(rData.sDataSource, rData.sCommand, u""); } diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 40f9dd5e4100..292ac69838a2 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -95,7 +95,7 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, SwView &rV) , m_rView(rV) , m_pMgr(new SwFieldMgr(m_rView.GetWrtShellPtr())) , m_bCopyAttributes(false) - , m_bOrderNumberingFirst(SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst()) + , m_bOrderNumberingFirst(SwModule::get()->GetModuleConfig()->IsCaptionOrderNumberingFirst()) , m_xTextEdit(m_xBuilder->weld_entry(u"caption_edit"_ustr)) , m_xCategoryBox(m_xBuilder->weld_combo_box(u"category"_ustr)) , m_xFormatText(m_xBuilder->weld_label(u"numbering_label"_ustr)) @@ -315,7 +315,7 @@ IMPL_LINK_NOARG(SwCaptionDialog, OptionHdl, weld::Button&, void) if( m_bOrderNumberingFirst != pDlg->IsOrderNumberingFirst() ) { m_bOrderNumberingFirst = pDlg->IsOrderNumberingFirst(); - SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(m_bOrderNumberingFirst); + SwModule::get()->GetModuleConfig()->SetCaptionOrderNumberingFirst(m_bOrderNumberingFirst); ApplyCaptionOrder(); } DrawSample(); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index e2773bd6d363..d083d7a59e65 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -282,14 +282,14 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(weld::Widget* pParent, const SfxItemSet SetCurPageId(u"index"_ustr); m_xShowExampleCB->connect_toggled(LINK(this, SwMultiTOXTabDialog, ShowPreviewHdl)); - m_xShowExampleCB->set_active(SW_MOD()->GetModuleConfig()->IsShowIndexPreview()); + m_xShowExampleCB->set_active(SwModule::get()->GetModuleConfig()->IsShowIndexPreview()); ShowPreview(); } SwMultiTOXTabDialog::~SwMultiTOXTabDialog() { - SW_MOD()->GetModuleConfig()->SetShowIndexPreview(m_xShowExampleCB->get_active()); + SwModule::get()->GetModuleConfig()->SetShowIndexPreview(m_xShowExampleCB->get_active()); } void SwMultiTOXTabDialog::PageCreated(const OUString& rId, SfxTabPage &rPage) diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index f1dbbce9f112..90b1c08acc41 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -132,7 +132,7 @@ SwLineNumberingDlg::SwLineNumberingDlg(const SwView& rVw) if (nOffset == USHRT_MAX) nOffset = 0; - FieldUnit eFieldUnit = SW_MOD()->GetUsrPref(dynamic_cast< const SwWebDocShell*>( + FieldUnit eFieldUnit = SwModule::get()->GetUsrPref(dynamic_cast< const SwWebDocShell*>( rVw.GetDocShell()) != nullptr)->GetMetric(); ::SetFieldUnit(*m_xOffsetMF, eFieldUnit); m_xOffsetMF->set_value(m_xOffsetMF->normalize(nOffset), FieldUnit::TWIP); diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 92bfbbeaab88..c3a92f33131d 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -144,7 +144,7 @@ SwOutlineTabDialog::SwOutlineTabDialog(weld::Window* pParent, const SfxItemSet* SwWrtShell &rSh) : SfxTabDialogController(pParent, u"modules/swriter/ui/outlinenumbering.ui"_ustr, u"OutlineNumberingDialog"_ustr, pSwItemSet) , m_rWrtSh(rSh) - , m_pChapterNumRules(SW_MOD()->GetChapterNumRules()) + , m_pChapterNumRules(SwModule::get()->GetChapterNumRules()) , m_bModified(m_rWrtSh.IsModified()) , m_xMenuButton(m_xBuilder->weld_menu_button(u"format"_ustr)) { diff --git a/sw/source/ui/table/autoformatpreview.cxx b/sw/source/ui/table/autoformatpreview.cxx index 2f728d9bba7c..cb999155cc81 100644 --- a/sw/source/ui/table/autoformatpreview.cxx +++ b/sw/source/ui/table/autoformatpreview.cxx @@ -436,7 +436,8 @@ void AutoFormatPreview::Paint(vcl::RenderContext& rRenderContext, const tools::R { rRenderContext.Push(vcl::PushFlags::ALL); - const Color& rWinColor = SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor; + const Color& rWinColor + = SwModule::get()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor; rRenderContext.SetBackground(Wallpaper(rWinColor)); rRenderContext.Erase(); diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx index 11c935953ccf..67a6bd7bfbfc 100644 --- a/sw/source/ui/table/colwd.cxx +++ b/sw/source/ui/table/colwd.cxx @@ -44,7 +44,7 @@ SwTableWidthDlg::SwTableWidthDlg(weld::Window *pParent, SwWrtShell *pShell) bool bIsWeb = m_xFnc->GetShell() && (dynamic_cast< const SwWebDocShell* >( m_xFnc->GetShell()->GetView().GetDocShell()) != nullptr ); - FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( bIsWeb )->GetMetric(); + FieldUnit eFieldUnit = SwModule::get()->GetUsrPref(bIsWeb)->GetMetric(); ::SetFieldUnit(*m_xWidthMF, eFieldUnit); m_xColNF->set_max(m_xFnc->GetColCount() + 1); diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx index c6ff833166a3..32f2d9323acb 100644 --- a/sw/source/ui/table/convert.cxx +++ b/sw/source/ui/table/convert.cxx @@ -173,7 +173,7 @@ SwConvertTableDlg::SwConvertTableDlg(SwView& rView, bool bToTable) m_xOtherBtn->connect_toggled(aLk); m_xOtherEd->set_sensitive(m_xOtherBtn->get_active()); - const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + const SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); bool bHTMLMode = 0 != (::GetHtmlMode(rView.GetDocShell()) & HTMLMODE_ON); diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 2bdd6c7cac50..5a38be0efea9 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -96,7 +96,7 @@ SwInsTableDlg::SwInsTableDlg(SwView& rView) m_xInsertBtn->connect_clicked(LINK(this, SwInsTableDlg, OKHdl)); bool bHTMLMode = 0 != (::GetHtmlMode(rView.GetDocShell())&HTMLMODE_ON); - const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + const SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); SwInsertTableOptions aInsOpts = pModOpt->GetInsTableFlags(bHTMLMode); SwInsertTableFlags nInsTableFlags = aInsOpts.mnInsMode; diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx index 6b950bc6e136..89506d1304a2 100644 --- a/sw/source/ui/table/rowht.cxx +++ b/sw/source/ui/table/rowht.cxx @@ -47,7 +47,7 @@ SwTableHeightDlg::SwTableHeightDlg(weld::Window *pParent, SwWrtShell &rS) , m_xHeightEdit(m_xBuilder->weld_metric_spin_button(u"heightmf"_ustr, FieldUnit::CM)) , m_xAutoHeightCB(m_xBuilder->weld_check_button(u"fit"_ustr)) { - FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( dynamic_cast< const SwWebDocShell*>( + FieldUnit eFieldUnit = SwModule::get()->GetUsrPref( dynamic_cast< const SwWebDocShell*>( m_rSh.GetView().GetDocShell() ) != nullptr )->GetMetric(); ::SetFieldUnit(*m_xHeightEdit, eFieldUnit); diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index ac519b9d7afd..1d1c8ef03806 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -90,7 +90,7 @@ SwVbaApplication::AddSink( const uno::Reference< XSink >& xSink ) SwGlobals::ensure(); } // No harm in potentially calling this several times - SW_MOD()->RegisterAutomationApplicationEventsCaller( uno::Reference< XSinkCaller >(this) ); + SwModule::get()->RegisterAutomationApplicationEventsCaller(uno::Reference(this)); mvSinks.push_back(xSink); return mvSinks.size(); } diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 0e4545a83027..4bbd44ce78b1 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -215,9 +215,9 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) } SwWait aWait( *this, true ); + SwModule* mod = SwModule::get(); // Suppress SfxProgress, when we are Embedded - SW_MOD()->SetEmbeddedLoadSave( - SfxObjectCreateMode::EMBEDDED == GetCreateMode() ); + mod->SetEmbeddedLoadSave(SfxObjectCreateMode::EMBEDDED == GetCreateMode()); pRdr->GetDoc().getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, dynamic_cast< const SwWebDocShell *>( this ) != nullptr); @@ -243,7 +243,7 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) pRdr.reset(); - SW_MOD()->SetEmbeddedLoadSave( false ); + mod->SetEmbeddedLoadSave(false); SetError(nErr); bool bOk = !nErr.IsError(); @@ -280,6 +280,7 @@ bool SwDocShell::Save() ErrCode nVBWarning = ERRCODE_NONE; if( SfxObjectShell::Save() ) { + SwModule* mod = SwModule::get(); switch( GetCreateMode() ) { case SfxObjectCreateMode::INTERNAL: @@ -299,7 +300,7 @@ bool SwDocShell::Save() case SfxObjectCreateMode::EMBEDDED: // Suppress SfxProgress, if we are Embedded - SW_MOD()->SetEmbeddedLoadSave( true ); + mod->SetEmbeddedLoadSave(true); [[fallthrough]]; case SfxObjectCreateMode::STANDARD: @@ -334,7 +335,7 @@ bool SwDocShell::Save() } break; } - SW_MOD()->SetEmbeddedLoadSave( false ); + mod->SetEmbeddedLoadSave(false); } SetError(nErr ? nErr : nVBWarning); @@ -527,9 +528,9 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) Link aOldOLELnk( m_xDoc->GetOle2Link() ); m_xDoc->SetOle2Link( Link() ); + SwModule* mod = SwModule::get(); // Suppress SfxProgress when we are Embedded - SW_MOD()->SetEmbeddedLoadSave( - SfxObjectCreateMode::EMBEDDED == GetCreateMode() ); + mod->SetEmbeddedLoadSave(SfxObjectCreateMode::EMBEDDED == GetCreateMode()); WriterRef xWrt; ::GetXMLWriter(std::u16string_view(), rMedium.GetBaseURL(true), xWrt); @@ -554,7 +555,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) } m_xDoc->SetOle2Link( aOldOLELnk ); - SW_MOD()->SetEmbeddedLoadSave( false ); + mod->SetEmbeddedLoadSave(false); // Increase RSID m_xDoc->setRsid( m_xDoc->getRsid() ); @@ -752,9 +753,9 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) xWriter->SetAsciiOptions( aOpt ); } + SwModule* mod = SwModule::get(); // Suppress SfxProgress when we are Embedded - SW_MOD()->SetEmbeddedLoadSave( - SfxObjectCreateMode::EMBEDDED == GetCreateMode()); + mod->SetEmbeddedLoadSave(SfxObjectCreateMode::EMBEDDED == GetCreateMode()); // Span Context in order to suppress the Selection's View ErrCodeMsg nErrno; @@ -804,7 +805,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) } } - SW_MOD()->SetEmbeddedLoadSave( false ); + mod->SetEmbeddedLoadSave(false); SetError(nErrno ? nErrno : nVBWarning); if( !rMedium.IsStorage() ) rMedium.CloseOutStream(); @@ -879,7 +880,7 @@ void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup, pDev->SetBackground(); const bool bWeb = dynamic_cast< const SwWebDocShell *>( this ) != nullptr; SwPrintData aOpts; - SwViewShell::PrtOle2(m_xDoc.get(), SW_MOD()->GetUsrPref(bWeb), aOpts, *pDev, aRect, bOutputForScreen); + SwViewShell::PrtOle2(m_xDoc.get(), SwModule::get()->GetUsrPref(bWeb), aOpts, *pDev, aRect, bOutputForScreen); pDev->Pop(); if( pOrig ) @@ -1180,7 +1181,7 @@ void SwDocShell::SetView(SwView* pVw) // Set view-specific redline author. const OUString& rRedlineAuthor = m_pView->GetRedlineAuthor(); if (!rRedlineAuthor.isEmpty()) - SW_MOD()->SetRedlineAuthor(m_pView->GetRedlineAuthor()); + SwModule::get()->SetRedlineAuthor(m_pView->GetRedlineAuthor()); } else m_pWrtShell = nullptr; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index a252737fa8a4..733121e9dd0e 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -252,7 +252,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) case SfxEventHintId::OpenDoc: { uno::Sequence< css::uno::Any > aArgs; - SW_MOD()->CallAutomationApplicationEventSinks( u"DocumentChange"_ustr, aArgs ); + SwModule::get()->CallAutomationApplicationEventSinks(u"DocumentChange"_ustr, aArgs); break; } default: @@ -266,7 +266,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) uno::Any aDocument; aDocument <<= mxAutomationDocumentObject; uno::Sequence< uno::Any > aArgs{ aDocument }; - SW_MOD()->CallAutomationApplicationEventSinks( u"NewDocument"_ustr, aArgs ); + SwModule::get()->CallAutomationApplicationEventSinks( u"NewDocument"_ustr, aArgs ); } break; case SfxEventHintId::OpenDoc: @@ -274,7 +274,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) uno::Any aDocument; aDocument <<= mxAutomationDocumentObject; uno::Sequence< uno::Any > aArgs{ aDocument }; - SW_MOD()->CallAutomationApplicationEventSinks( u"DocumentOpen"_ustr, aArgs ); + SwModule::get()->CallAutomationApplicationEventSinks( u"DocumentOpen"_ustr, aArgs ); } break; default: @@ -365,7 +365,7 @@ bool SwDocShell::PrepareClose( bool bUI ) uno::Any(false) }; - SW_MOD()->CallAutomationApplicationEventSinks( u"DocumentBeforeClose"_ustr, aArgs ); + SwModule::get()->CallAutomationApplicationEventSinks(u"DocumentBeforeClose"_ustr, aArgs); // If the Cancel argument was set to True by an event handler, return false. bool bCancel(false); diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 8605ce7fba92..90d9629b1d2f 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -105,6 +105,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) if ( GetCreateMode() == SfxObjectCreateMode::EMBEDDED ) SwTransferable::InitOle( this ); + SwModule* mod = SwModule::get(); // set forbidden characters if necessary const bool bFuzzing = comphelper::IsFuzzing(); if (!bFuzzing) @@ -120,14 +121,14 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, !SvxAsianConfig::IsKerningWesternTextOnly()); m_xDoc->getIDocumentSettingAccess().setCharacterCompressionType(SvxAsianConfig::GetCharDistanceCompression()); - m_xDoc->getIDocumentDeviceAccess().setPrintData(*SW_MOD()->GetPrtOptions(bWeb)); + m_xDoc->getIDocumentDeviceAccess().setPrintData(*mod->GetPrtOptions(bWeb)); } SubInitNew(); // for all - SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig(); + SwStdFontConfig* pStdFont = mod->GetStdFontConfig(); SfxPrinter* pPrt = m_xDoc->getIDocumentDeviceAccess().getPrinter( false ); OUString sEntry; @@ -287,7 +288,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) // (old documents, where this property was not yet implemented, will get the // value 'false' in the SwDoc c-tor) m_xDoc->getIDocumentSettingAccess().set( DocumentSettingId::MATH_BASELINE_ALIGNMENT, - SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() ); + mod->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() ); m_xDoc->getIDocumentSettingAccess().set( DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND, true); } @@ -381,7 +382,7 @@ SwDocShell::~SwDocShell() void SwDocShell::Init_Impl() { - SetPool(&SW_MOD()->GetPool()); + SetPool(&SwModule::get()->GetPool()); SetBaseModel(new SwXTextDocument(this)); // we, as BroadCaster also become our own Listener // (for DocInfo/FileNames/...) @@ -497,6 +498,7 @@ bool SwDocShell::Load( SfxMedium& rMedium ) m_nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; } + SwModule* mod = SwModule::get(); SwWait aWait( *this, true ); ErrCodeMsg nErr = ERR_SWG_READ_ERROR; switch( GetCreateMode() ) @@ -519,7 +521,7 @@ bool SwDocShell::Load( SfxMedium& rMedium ) SwTransferable::InitOle( this ); } // suppress SfxProgress, when we are Embedded - SW_MOD()->SetEmbeddedLoadSave( true ); + mod->SetEmbeddedLoadSave( true ); [[fallthrough]]; case SfxObjectCreateMode::STANDARD: @@ -568,7 +570,7 @@ bool SwDocShell::Load( SfxMedium& rMedium ) } // suppress SfxProgress, when we are Embedded - SW_MOD()->SetEmbeddedLoadSave( false ); + mod->SetEmbeddedLoadSave( false ); } return bRet; @@ -669,7 +671,7 @@ void SwDocShell::SubInitNew() aDfltSet.Put( aHyp ); - sal_uInt16 nNewPos = o3tl::toTwips(SW_MOD()->GetUsrPref(false)->GetDefTabInMm100(), o3tl::Length::mm100); + sal_uInt16 nNewPos = o3tl::toTwips(SwModule::get()->GetUsrPref(false)->GetDefTabInMm100(), o3tl::Length::mm100); if( nNewPos ) aDfltSet.Put( SvxTabStopItem( 1, nNewPos, SvxTabAdjust::Default, RES_PARATR_TABSTOP ) ); @@ -681,7 +683,7 @@ void SwDocShell::SubInitNew() //default page mode for text grid if(!bWeb) { - bool bSquaredPageMode = SW_MOD()->GetUsrPref(false)->IsSquaredPageMode(); + bool bSquaredPageMode = SwModule::get()->GetUsrPref(false)->IsSquaredPageMode(); m_xDoc->SetDefaultPageMode( bSquaredPageMode ); // only set Widow/Orphan defaults on a new, non-web document - not an opened one diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 6bc5e0b56ae2..ecdb14726e37 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -695,7 +695,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) aUsrPref.SetKeepRatio(pBoolItem->GetValue()); if (pBoolItem->GetValue() != pVOpt->IsKeepRatio()) { - SW_MOD()->ApplyUsrPref(aUsrPref, &pWrtShell->GetView()); + SwModule::get()->ApplyUsrPref(aUsrPref, &pWrtShell->GetView()); } } } @@ -984,7 +984,7 @@ void SwDocShell::Edit( PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode)); FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode)); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast(eMetric))); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); if (!pDialogParent) { diff --git a/sw/source/uibase/app/mainwn.cxx b/sw/source/uibase/app/mainwn.cxx index 7c21797f8e3d..fce2d12970a1 100644 --- a/sw/source/uibase/app/mainwn.cxx +++ b/sw/source/uibase/app/mainwn.cxx @@ -52,7 +52,7 @@ static SwProgress *lcl_SwFindProgress( SwDocShell const *pDocShell ) void StartProgress( TranslateId pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell ) { - if( SW_MOD()->IsEmbeddedLoadSave() ) + if (SwModule::get()->IsEmbeddedLoadSave()) return; SwProgress *pProgress = nullptr; @@ -81,7 +81,7 @@ void StartProgress( TranslateId pMessResId, tools::Long nStartValue, tools::Long void SetProgressState( tools::Long nPosition, SwDocShell const *pDocShell ) { - if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() ) + if (pProgressContainer && !SwModule::get()->IsEmbeddedLoadSave()) { SwProgress *pProgress = lcl_SwFindProgress( pDocShell ); if ( pProgress ) @@ -91,7 +91,7 @@ void SetProgressState( tools::Long nPosition, SwDocShell const *pDocShell ) void EndProgress( SwDocShell const *pDocShell ) { - if( !pProgressContainer || SW_MOD()->IsEmbeddedLoadSave() ) + if (!pProgressContainer || SwModule::get()->IsEmbeddedLoadSave()) return; SwProgress *pProgress = nullptr; @@ -122,7 +122,7 @@ void EndProgress( SwDocShell const *pDocShell ) void RescheduleProgress( SwDocShell const *pDocShell ) { - if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() ) + if (pProgressContainer && !SwModule::get()->IsEmbeddedLoadSave()) { SwProgress *pProgress = lcl_SwFindProgress( pDocShell ); if ( pProgress ) diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx index 89f7b0b6cd71..a0d0d35773dd 100644 --- a/sw/source/uibase/app/swdll.cxx +++ b/sw/source/uibase/app/swdll.cxx @@ -156,7 +156,7 @@ SwDLL::~SwDLL() COVERITY_NOEXCEPT_FALSE } // Pool has to be deleted before statics are - SW_MOD()->RemoveAttrPool(); + SwModule::get()->RemoveAttrPool(); ::FinitUI(); m_pFilters.reset(); diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index be12a460ab6d..96bde7096a1b 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -432,15 +432,15 @@ static Color lcl_GetAuthorColor(std::size_t nPos) // same as SwPostItMgr::GetColorAnchor() switch (nPos % 9) { - case 0: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR1).nColor; - case 1: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR2).nColor; - case 2: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR3).nColor; - case 3: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR4).nColor; - case 4: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR5).nColor; - case 5: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR6).nColor; - case 6: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR7).nColor; - case 7: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR8).nColor; - case 8: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR9).nColor; + case 0: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR1).nColor; + case 1: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR2).nColor; + case 2: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR3).nColor; + case 3: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR4).nColor; + case 4: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR5).nColor; + case 5: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR6).nColor; + case 6: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR7).nColor; + case 7: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR8).nColor; + case 8: return SwModule::get()->GetColorConfig().GetColorValue(svtools::AUTHOR9).nColor; default: return COL_AUTO; // silence -Wreturn-type } } diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 737fe747a112..98d4364fcdd9 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -168,12 +168,12 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, OUString SwResId(TranslateId aId) { - return Translate::get(aId, SW_MOD()->GetResLocale()); + return Translate::get(aId, SwModule::get()->GetResLocale()); } OUString SwResId(TranslateNId aContextSingularPlural, int nCardinality) { - return Translate::nget(aContextSingularPlural, nCardinality, SW_MOD()->GetResLocale()); + return Translate::nget(aContextSingularPlural, nCardinality, SwModule::get()->GetResLocale()); } uno::Reference< scanner::XScannerManager2 > const & @@ -229,7 +229,7 @@ void SwDLL::RegisterFactories() void SwDLL::RegisterInterfaces() { - SwModule* pMod = SW_MOD(); + SwModule* pMod = SwModule::get(); SwModule::RegisterInterface( pMod ); SwDocShell::RegisterInterface( pMod ); SwWebDocShell::RegisterInterface( pMod ); @@ -266,7 +266,7 @@ void SwDLL::RegisterInterfaces() void SwDLL::RegisterControls() { - SwModule* pMod = SW_MOD(); + SwModule* pMod = SwModule::get(); SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod ); SvxTbxCtlDraw::RegisterControl(SID_TRACK_CHANGES_BAR, pMod ); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 79193c08eff5..757eba8c24c7 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1627,7 +1627,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, pViewFrame = SfxViewFrame::GetNext(*pViewFrame, pSourceDocSh); } - SW_MOD()->SetView(&pSourceShell->GetView()); + SwModule::get()->SetView(&pSourceShell->GetView()); if( xMailDispatcher.is() ) { @@ -2532,7 +2532,7 @@ SwDSParam* SwDBManager::FindDSConnection(const OUString& rDataSource, bool bCre const SwDBData& SwDBManager::GetAddressDBName() { - return SW_MOD()->GetDBConfig()->GetAddressSource(); + return SwModule::get()->GetDBConfig()->GetAddressSource(); } uno::Sequence SwDBManager::GetExistingDatabaseNames() diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 9e2bded63797..f6b1e9d9377a 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -300,8 +300,7 @@ SwTransferable::~SwTransferable() } m_aDocShellRef.Clear(); - SwModule* pMod = SW_MOD(); - if(pMod) + if (SwModule* pMod = SwModule::get()) { if ( pMod->m_pDragDrop == this ) pMod->m_pDragDrop = nullptr; @@ -321,7 +320,7 @@ static SwDoc& lcl_GetDoc(SwDocFac & rDocFac) void SwTransferable::ObjectReleased() { - SwModule *pMod = SW_MOD(); + SwModule* pMod = SwModule::get(); if (!pMod) return; if( this == pMod->m_pDragDrop ) @@ -333,8 +332,7 @@ void SwTransferable::ObjectReleased() void SwTransferable::AddSupportedFormats() { // only need if we are the current XSelection Object - SwModule *pMod = SW_MOD(); - if( this == pMod->m_pXSelection || comphelper::LibreOfficeKit::isActive()) + if (this == SwModule::get()->m_pXSelection || comphelper::LibreOfficeKit::isActive()) { SetDataForDragAndDrop( Point( 0,0) ); } @@ -1710,7 +1708,7 @@ bool SwTransferable::PasteData( const TransferableDataHelper& rData, { SwWait aWait( *rSh.GetView().GetDocShell(), false ); std::unique_ptr> pAction; - SwModule* pMod = SW_MOD(); + SwModule* pMod = SwModule::get(); bool bRet = false; bool bCallAutoCaption = false; @@ -3759,7 +3757,7 @@ void SwTransferable::StartDrag( vcl::Window* pWin, const Point& rPos ) if( m_pWrtShell->IsSelFrameMode() ) m_pWrtShell->ShowCursor(); - SW_MOD()->m_pDragDrop = this; + SwModule::get()->m_pDragDrop = this; SetDataForDragAndDrop( rPos ); @@ -4396,19 +4394,18 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, void SwTransferable::CreateSelection( SwWrtShell& rSh, const SwFrameShell * _pCreatorView ) { - SwModule *pMod = SW_MOD(); rtl::Reference pNew = new SwTransferable( rSh ); pNew->m_pCreatorView = _pCreatorView; - pMod->m_pXSelection = pNew.get(); + SwModule::get()->m_pXSelection = pNew.get(); pNew->CopyToPrimarySelection(); } void SwTransferable::ClearSelection( const SwWrtShell& rSh, const SwFrameShell * _pCreatorView) { - SwModule *pMod = SW_MOD(); + SwModule* pMod = SwModule::get(); if( pMod->m_pXSelection && ((!pMod->m_pXSelection->m_pWrtShell) || (pMod->m_pXSelection->m_pWrtShell == &rSh)) && (!_pCreatorView || (pMod->m_pXSelection->m_pCreatorView == _pCreatorView)) ) diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 4979045c48dd..03f3e5030ed6 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -383,7 +383,7 @@ void SwAnnotationWin::InitControls() } mpOutliner->SetControlWord(nCntrl); - std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor()); + std::size_t aIndex = SwModule::get()->InsertRedlineAuthor(GetAuthor()); SetColor( SwPostItMgr::GetColorDark(aIndex), SwPostItMgr::GetColorLight(aIndex), SwPostItMgr::GetColorAnchor(aIndex)); @@ -457,7 +457,7 @@ void SwAnnotationWin::CheckMetaText() void SwAnnotationWin::UpdateColors() { - std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor()); + std::size_t aIndex = SwModule::get()->InsertRedlineAuthor(GetAuthor()); SetColor( SwPostItMgr::GetColorDark(aIndex), SwPostItMgr::GetColorLight(aIndex), SwPostItMgr::GetColorAnchor(aIndex)); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 177d52c9777b..7ee85f5c7690 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -380,7 +380,7 @@ SwPostItMgr::SwPostItMgr(SwView* pView) mpView->GetWrtShell().MakeDrawView(); //make sure we get the colour yellow always, even if not the first one of comments or redlining - SW_MOD()->GetRedlineAuthor(); + SwModule::get()->GetRedlineAuthor(); // collect all PostIts and redline comments that exist after loading the document // don't check for existence for any of them, don't focus them diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx index 287d2969f632..72e50a65599e 100644 --- a/sw/source/uibase/docvw/edtdd.cxx +++ b/sw/source/uibase/docvw/edtdd.cxx @@ -249,9 +249,9 @@ sal_Int8 SwEditWin::ExecuteDrop( const ExecuteDropEvent& rEvt ) if( !SwTransferable::PasteData( aData, rSh, m_nDropAction, nActionFlags, m_nDropFormat, m_nDropDestination, false, rEvt.mbDefault, &aDocPt, nRet)) nRet = DND_ACTION_NONE; - else if ( SW_MOD()->m_pDragDrop ) + else if (SwModule* mod = SwModule::get(); mod->m_pDragDrop) //Don't clean up anymore at internal D&D! - SW_MOD()->m_pDragDrop->SetCleanUp( false ); + mod->m_pDragDrop->SetCleanUp(false); return nRet; } @@ -400,7 +400,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt ) const Point aDocPt( PixelToLogic( aPixPt ) ); //With the default action we still want to have a say. - SwModule *pMod = SW_MOD(); + SwModule* pMod = SwModule::get(); if( pMod->m_pDragDrop ) { bool bCleanup = false; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 7680cc4ebb0e..7d71f58bd363 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -1667,7 +1667,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) pACorr = pACfg->GetAutoCorrect(); } - SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); OUString sFormulaEntry; @@ -4334,7 +4334,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) if(aRelPos.X() >= 0) { FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( &GetView()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); const SfxPointItem aTmp1( SID_ATTR_POSITION, aRelPos ); rBnd.SetState( aTmp1 ); } diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index d8d7f7ec2057..11b3b3d4d9d1 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -533,7 +533,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) default: { - SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); if(!pModOpt->IsHideFieldTips()) { const SwField* pField = aContentAtPos.aFnd.pField; diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx index 423b6a53847e..4a60637c9624 100644 --- a/sw/source/uibase/docvw/edtwin3.cxx +++ b/sw/source/uibase/docvw/edtwin3.cxx @@ -106,7 +106,7 @@ bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt, TableChgMode GetTableChgDefaultMode() { - SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pOpt = SwModule::get()->GetModuleConfig(); return pOpt ? pOpt->GetTableMode() : TableChgMode::VarWidthChangeAbs; } diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx index fb8d20d0e525..ae59afcc1abc 100644 --- a/sw/source/uibase/docvw/romenu.cxx +++ b/sw/source/uibase/docvw/romenu.cxx @@ -100,7 +100,7 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV) , m_rView(rV) , m_xBrushItem(std::make_unique(RES_BACKGROUND)) { - m_bGrfToGalleryAsLnk = SW_MOD()->GetModuleConfig()->IsGrfToGalleryAsLnk(); + m_bGrfToGalleryAsLnk = SwModule::get()->GetModuleConfig()->IsGrfToGalleryAsLnk(); SwWrtShell &rSh = m_rView.GetWrtShell(); OUString sDescription; rSh.IsURLGrfAtPos( rDPos, &m_sURL, &m_sTargetFrameName, &sDescription ); @@ -303,9 +303,9 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId ) else if (nId == m_nReadonlyGraphicoff) nExecId = FN_VIEW_GRAPHIC; else if (nId == m_nReadonlyTogallerylink || nId == m_nReadonlyBackgroundTogallerylink) - SW_MOD()->GetModuleConfig()->SetGrfToGalleryAsLnk(true); + SwModule::get()->GetModuleConfig()->SetGrfToGalleryAsLnk(true); else if (nId == m_nReadonlyTogallerycopy || nId == m_nReadonlyBackgroundTogallerycopy) - SW_MOD()->GetModuleConfig()->SetGrfToGalleryAsLnk(false); + SwModule::get()->GetModuleConfig()->SetGrfToGalleryAsLnk(false); if( USHRT_MAX != nExecId ) rDis.GetBindings()->Execute( nExecId ); diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index 1fdc55838f29..8f6224682a61 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -700,7 +700,7 @@ void SwSrcEditWindow::ImpDoHighlight( std::u16string_view aSource, sal_uInt16 nL r.eType != svtools::HTMLKEYWORD && r.eType != svtools::HTMLUNKNOWN) r.eType = svtools::HTMLUNKNOWN; - Color aColor(SW_MOD()->GetColorConfig().GetColorValue(r.eType).nColor); + Color aColor(SwModule::get()->GetColorConfig().GetColorValue(r.eType).nColor); m_pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLineOff, r.nStart, r.nEnd+1 ); } } diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx index c78ed3ea7f73..d1ca1ab1ad23 100644 --- a/sw/source/uibase/envelp/envimg.cxx +++ b/sw/source/uibase/envelp/envimg.cxx @@ -44,7 +44,7 @@ SfxPoolItem* SwEnvItem::CreateDefault() { return new SwEnvItem; } OUString MakeSender() { - SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions(); + SvtUserOptions& rUserOpt = SwModule::get()->GetUserOptions(); const OUString sSenderToken(SwResId(STR_SENDER_TOKENS)); if (sSenderToken.isEmpty()) diff --git a/sw/source/uibase/envelp/labimg.cxx b/sw/source/uibase/envelp/labimg.cxx index f2aed778f921..4fb5829bea24 100644 --- a/sw/source/uibase/envelp/labimg.cxx +++ b/sw/source/uibase/envelp/labimg.cxx @@ -366,7 +366,7 @@ SwLabCfgItem::SwLabCfgItem(bool bLabel) : if(m_bIsLabel || !bNoConfigValues) return; - SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions(); + SvtUserOptions& rUserOpt = SwModule::get()->GetUserOptions(); m_aItem.m_aPrivFirstName = rUserOpt.GetFirstName(); m_aItem.m_aPrivName = rUserOpt.GetLastName(); m_aItem.m_aPrivShortCut = rUserOpt.GetID(); diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index 0c737246317c..e2a992e841c7 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -292,7 +292,7 @@ SwSpellPopup::SwSpellPopup( m_xPopupMenu->EnableItem(m_nCorrectMenuId, bEnable); - uno::Reference< linguistic2::XLanguageGuessing > xLG = SW_MOD()->GetLanguageGuesser(); + uno::Reference xLG = SwModule::get()->GetLanguageGuesser(); LanguageType nGuessLangWord = LANGUAGE_NONE; LanguageType nGuessLangPara = LANGUAGE_NONE; if (m_xSpellAlt.is() && xLG.is()) @@ -502,7 +502,7 @@ SwSpellPopup::SwSpellPopup( m_xPopupMenu->EnableItem(m_nCorrectMenuId, false); m_xPopupMenu->EnableItem(m_nCorrectDialogId, false); - uno::Reference< linguistic2::XLanguageGuessing > xLG = SW_MOD()->GetLanguageGuesser(); + uno::Reference xLG = SwModule::get()->GetLanguageGuesser(); LanguageType nGuessLangWord = LANGUAGE_NONE; LanguageType nGuessLangPara = LANGUAGE_NONE; if (xLG.is()) diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 2282174ae9aa..d1180be8271a 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -256,7 +256,7 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(std::shared_ptr xParent, we m_aSelectTimer.SetInvokeHandler(LINK(this, SwRedlineAcceptDlg, GotoHdl)); // we want to receive SfxHintId::SwRedlineContentAtPos - StartListening(*(SW_MOD()->GetView()->GetDocShell())); + StartListening(*(SwModule::get()->GetView()->GetDocShell())); } SwRedlineAcceptDlg::~SwRedlineAcceptDlg() @@ -561,7 +561,7 @@ void SwRedlineAcceptDlg::Activate() } // check comment - bool bIsShowChangesInMargin = SW_MOD()->GetUsrPref(false)->IsShowChangesInMargin(); + bool bIsShowChangesInMargin = SwModule::get()->GetUsrPref(false)->IsShowChangesInMargin(); for (SwRedlineTable::size_type i = 0; i < nCount; i++) { const SwRangeRedline& rRedln = pSh->GetRedline(i); @@ -919,7 +919,7 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli if (m_pTable->IsSorted()) rTreeView.make_unsorted(); - bool bIsShowChangesInMargin = SW_MOD()->GetUsrPref(false)->IsShowChangesInMargin(); + bool bIsShowChangesInMargin = SwModule::get()->GetUsrPref(false)->IsShowChangesInMargin(); // collect redlines of tracked table/row/column insertion/deletions under a single tree list // item to accept/reject the table change with a single click on Accept/Reject @@ -1653,7 +1653,7 @@ SwRedlineAcceptPanel::SwRedlineAcceptPanel(weld::Widget* pParent) mpImplDlg->Init(); // we want to receive SfxHintId::DocChanged - StartListening(*(SW_MOD()->GetView()->GetDocShell())); + StartListening(*(SwModule::get()->GetView()->GetDocShell())); } SwRedlineAcceptPanel::~SwRedlineAcceptPanel() diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 4d225dfc8aaa..8b30443a241c 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -497,7 +497,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) /* mod SwView* pView = &GetView(); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( pView) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric)); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric)); */ SfxItemSetFixed aDlgAttr(GetPool()); @@ -550,7 +550,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) /* mod todo ??? SwView* pView = &GetView(); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( pView) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric)); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric)); */ SfxItemSetFixed< EE_ITEMS_START, EE_ITEMS_END, diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index b7012e9274d7..739b12cb251b 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2413,7 +2413,7 @@ void SwBaseShell::ExecTextCtrl( SfxRequest& rReq ) if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM) nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang ); sal_uInt32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight(); - SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig(); + SwStdFontConfig* pStdFont = SwModule::get()->GetStdFontConfig(); SfxItemSetFixedGetModuleConfig(); + const SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); SwInsertTableOptions aInsTableOpts = pModOpt->GetInsTableFlags(bHTMLMode); rSh.StartUndo(SwUndoId::INSTABLE); @@ -3140,7 +3140,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) aInsTableOptsIn.mnInsMode = static_cast(pFlags->GetValue()); else { - const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + const SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); aInsTableOptsIn = pModOpt->GetInsTableFlags(bHTMLMode); } } diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index dd93cb847387..e66d3e98021f 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -290,7 +290,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) case SID_FONTWORK: { FieldUnit eMetric = ::GetDfltMetric( dynamic_cast( &rSh.GetView()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); SfxViewFrame& rVFrame = GetView().GetViewFrame(); if (pArgs) { diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 2c59cfe8ffa0..d0ee5e477bdb 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -217,7 +217,7 @@ void SwDrawBaseShell::Execute(SfxRequest& rReq) const WhichRangesContainer aRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); SfxItemSet aSet( *aNewAttr.GetPool(), aRange ); FieldUnit eMetric = ::GetDfltMetric( dynamic_cast(&GetView()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); aSet.Put( aNewAttr, false ); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 38d2a8521057..b3f152cf51a5 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -378,7 +378,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SwView& rView = GetView(); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast(&rView) != nullptr); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); SfxItemSetFixed aDlgAttr(GetPool()); // util::Language does not exists in the EditEngine! That is why not in set. @@ -454,7 +454,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) { SwView& rView = GetView(); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast(&rView) != nullptr); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); SfxItemSetFixed< EE_ITEMS_START, EE_ITEMS_END, SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_WIDOWS> aDlgAttr( GetPool() ); diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index 0b50fe3b94b0..21a11a9f53f0 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -175,7 +175,7 @@ void SwDrawTextShell::ExecFontWork(SfxRequest const & rReq) { SwWrtShell &rSh = GetShell(); FieldUnit eMetric = ::GetDfltMetric( dynamic_cast( &rSh.GetView()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast(eMetric))); SfxViewFrame& rVFrame = GetView().GetViewFrame(); if ( rReq.GetArgs() ) { diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index d1790ed10bdf..8f613c9a83f1 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -511,7 +511,8 @@ void SwFrameShell::Execute(SfxRequest &rReq) aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame().GetFrame())); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( &GetView()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) )); + SwModule* mod = SwModule::get(); + mod->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast(eMetric))); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); ScopedVclPtr pDlg(pFact->CreateFrameTabDialog( nSel & SelectionType::Graphic ? u"PictureDialog"_ustr : @@ -540,7 +541,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) { SwViewOption aUsrPref( *pVOpt ); aUsrPref.SetKeepRatio(pRatioItem->GetValue()); - SW_MOD()->ApplyUsrPref(aUsrPref, &GetView()); + mod->ApplyUsrPref(aUsrPref, &GetView()); } if (const SfxStringItem* pAltNameItem = pOutSet->GetItemIfSet(FN_SET_FRM_ALT_NAME)) { diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index d7d53292a80a..c508b0d4e86c 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -295,7 +295,8 @@ void SwGrfShell::Execute(SfxRequest &rReq) sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode)); FieldUnit eMetric = ::GetDfltMetric(0 != (nHtmlMode&HTMLMODE_ON)); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); + SwModule* mod = SwModule::get(); + mod->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast(eMetric))); const SwRect* pRect = &rSh.GetAnyCurRect(CurRectType::Page); SwFormatFrameSize aFrameSize( SwFrameSize::Variable, pRect->Width(), pRect->Height()); @@ -468,7 +469,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) } if( bApplyUsrPref ) - SW_MOD()->ApplyUsrPref(aUsrPref, &GetView()); + mod->ApplyUsrPref(aUsrPref, &GetView()); // and now set all the graphic attributes and other stuff if( const SvxBrushItem* pGraphicBrushItem = pSet->GetItemIfSet( diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 581e494cb3c7..577be8fe0369 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -278,7 +278,7 @@ void ItemSetToTableParam( const SfxItemSet& rSet, { SwViewOption aUsrPref( *rSh.GetViewOptions() ); aUsrPref.SetTableDest(static_cast(pDestItem->GetValue())); - SW_MOD()->ApplyUsrPref(aUsrPref, &rSh.GetView()); + SwModule::get()->ApplyUsrPref(aUsrPref, &rSh.GetView()); } bool bBorder = ( SfxItemState::SET == rSet.GetItemState( RES_BOX ) || SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) ); @@ -606,7 +606,7 @@ void SwTableShell::Execute(SfxRequest &rReq) SfxItemSet aCoreSet( GetPool(), aUITableAttrRange); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( &rSh.GetView()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); std::shared_ptr xTableRep(::lcl_TableParamToItemSet(aCoreSet, rSh)); aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); @@ -688,7 +688,7 @@ void SwTableShell::Execute(SfxRequest &rReq) if (SwView* pView = GetActiveView()) { FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( pView) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); SvNumberFormatter* pFormatter = rSh.GetNumberFormatter(); auto pCoreSet = std::make_shared>( GetPool() ); diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index dfd5591b6e46..d313c899f659 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -526,7 +526,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) auto xSet = CreateInsertFrameItemSet(aMgr); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( GetView().GetDocShell()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); VclPtr pDlg(pFact->CreateFrameTabDialog(u"FrameDialog"_ustr, GetView().GetViewFrame(), diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index c9b9ceb60e38..2b3614437a79 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -164,7 +164,7 @@ static void sw_CharDialog(SwWrtShell& rWrtSh, bool bUseDialog, bool bApplyToPara sal_uInt16 nSlot, const SfxItemSet* pArgs, SfxRequest* pReq) { FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( &rWrtSh.GetView()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); + SwModule::get()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast(eMetric))); auto pCoreSet = std::make_shared( &GetView()) != nullptr ); - SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); + SwModule* mod = SwModule::get(); + mod->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast(eMetric))); bool bApplyCharUnit = ::HasCharUnit( dynamic_cast( &GetView()) != nullptr ); - SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit)); + mod->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit)); SfxItemSetFixed< RES_PARATR_BEGIN, RES_FRMATR_END - 1, diff --git a/sw/source/uibase/sidebar/TableEditPanel.cxx b/sw/source/uibase/sidebar/TableEditPanel.cxx index a3c376835768..cee7dfeba5f7 100644 --- a/sw/source/uibase/sidebar/TableEditPanel.cxx +++ b/sw/source/uibase/sidebar/TableEditPanel.cxx @@ -188,7 +188,7 @@ void TableEditPanel::InitRowHeightToolitem() Link aLink = LINK(this, TableEditPanel, RowHeightMofiyHdl); m_aRowHeightEdit.connect_value_changed(aLink); - FieldUnit eFieldUnit = SW_MOD()->GetUsrPref(false)->GetMetric(); + FieldUnit eFieldUnit = SwModule::get()->GetUsrPref(false)->GetMetric(); m_aRowHeightEdit.SetFieldUnit(eFieldUnit); m_aRowHeightEdit.set_min(MINLAY, FieldUnit::TWIP); @@ -202,7 +202,7 @@ void TableEditPanel::InitColumnWidthToolitem() Link aLink = LINK(this, TableEditPanel, ColumnWidthMofiyHdl); m_aColumnWidthEdit.connect_value_changed(aLink); - FieldUnit eFieldUnit = SW_MOD()->GetUsrPref(false)->GetMetric(); + FieldUnit eFieldUnit = SwModule::get()->GetUsrPref(false)->GetMetric(); m_aColumnWidthEdit.SetFieldUnit(eFieldUnit); m_aColumnWidthEdit.set_min(MINLAY, FieldUnit::TWIP); @@ -229,7 +229,7 @@ void TableEditPanel::InitAlignmentControls() m_xAlignment->append(OUString::number(text::HoriOrientation::NONE), SwResId(STR_TABLE_PANEL_ALIGN_MANUAL)); - FieldUnit eFieldUnit = SW_MOD()->GetUsrPref(false)->GetMetric(); + FieldUnit eFieldUnit = SwModule::get()->GetUsrPref(false)->GetMetric(); m_aLeftSpacingEdit.SetFieldUnit(eFieldUnit); m_aRightSpacingEdit.SetFieldUnit(eFieldUnit); } diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 6fb310455a6f..aca313a9bc1b 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -178,7 +178,7 @@ SwPagePreviewWin::SwPagePreviewWin( vcl::Window *pParent, SwPagePreview& rPView GetOutDev()->SetLineColor( GetBackground().GetColor()); SetMapMode( MapMode(MapUnit::MapTwip) ); - const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(false); + const SwMasterUsrPref* pUsrPref = SwModule::get()->GetUsrPref(false); mnRow = pUsrPref->GetPagePrevRow(); // 1 row mnCol = pUsrPref->GetPagePrevCol(); // 1 column mnSttPage = USHRT_MAX; @@ -516,7 +516,7 @@ void SwPagePreviewWin::MouseButtonDown( const MouseEvent& rMEvt ) void SwPagePreviewWin::SetPagePreview( sal_Int16 nRow, sal_Int16 nCol ) { - SwMasterUsrPref *pOpt = const_cast(SW_MOD()->GetUsrPref(false)); + SwMasterUsrPref* pOpt = const_cast(SwModule::get()->GetUsrPref(false)); if (nRow != pOpt->GetPagePrevRow() || nCol != pOpt->GetPagePrevCol()) { @@ -1093,7 +1093,8 @@ void SwPagePreview::Init() // the handler, because the shell is unknown to the SFX management // within the CTOR phase. - const SwViewOption * pPrefs = SW_MOD()->GetUsrPref(false); + SwModule* mod = SwModule::get(); + const SwViewOption* pPrefs = mod->GetUsrPref(false); mbHScrollbarEnabled = pPrefs->IsViewHScrollBar(); mbVScrollbarEnabled = pPrefs->IsViewVScrollBar(); @@ -1135,7 +1136,7 @@ void SwPagePreview::Init() #endif // adjust view shell option to the same as for print - SwPrintData const aPrintOptions = *SW_MOD()->GetPrtOptions(false); + SwPrintData const aPrintOptions = *mod->GetPrtOptions(false); GetViewShell()->AdjustOptionsForPagePreview( aPrintOptions ); GetViewShell()->CalcLayout(); diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index ed0c3c68fcfc..01dc4f856c06 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -104,7 +104,7 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq ) case SID_TWAIN_SELECT: { bool bDone = false; - Reference< XScannerManager2 > xScanMgr = SW_MOD()->GetScannerManager(); + Reference xScanMgr = SwModule::get()->GetScannerManager(); if( xScanMgr.is() ) { @@ -152,7 +152,7 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq ) { bool bDone = false; - Reference< XScannerManager2 > xScanMgr = SW_MOD()->GetScannerManager(); + Reference xScanMgr = SwModule::get()->GetScannerManager(); if( xScanMgr.is() ) { SwScannerEventListener& rListener = GetScannerEventListener(); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 02722177646d..f2fef7d341e0 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -326,7 +326,7 @@ void SwView::SelectShell() { SfxDispatcher &rDispatcher = GetDispatcher(); - SwToolbarConfigItem *pBarCfg = SW_MOD()->GetToolbarConfig(); + SwToolbarConfigItem* pBarCfg = SwModule::get()->GetToolbarConfig(); if ( m_pShell ) { @@ -850,7 +850,7 @@ SwView::SwView(SfxViewFrame& _rFrame, SfxViewShell* pOldSh) rDocSh.UpdateFontList(); bool bWebDShell = dynamic_cast(&rDocSh) != nullptr; - const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(bWebDShell); + const SwMasterUsrPref* pUsrPref = SwModule::get()->GetUsrPref(bWebDShell); SwViewOption aUsrPref( *pUsrPref); //! get lingu options without loading lingu DLL @@ -1144,7 +1144,7 @@ SwViewGlueDocShell::SwViewGlueDocShell(SwView& rView, SwDocShell& rDocSh) { // Set DocShell rDocSh.SetView(&m_rView); - SW_MOD()->SetView(&m_rView); + SwModule::get()->SetView(&m_rView); } SwViewGlueDocShell::~SwViewGlueDocShell() @@ -1152,8 +1152,8 @@ SwViewGlueDocShell::~SwViewGlueDocShell() SwDocShell* pDocSh = m_rView.GetDocShell(); if (pDocSh && pDocSh->GetView() == &m_rView) pDocSh->SetView(nullptr); - if (SW_MOD()->GetView() == &m_rView) - SW_MOD()->SetView(nullptr); + if (SwModule* mod = SwModule::get(); mod->GetView() == &m_rView) + mod->SetView(nullptr); } SwView::~SwView() @@ -1289,7 +1289,7 @@ static bool lcl_IsOwnDocument( SwView& rView ) = xDPS->getDocumentProperties(); OUString Created = xDocProps->getAuthor(); OUString Changed = xDocProps->getModifiedBy(); - OUString FullName = SW_MOD()->GetUserOptions().GetFullName(); + OUString FullName = SwModule::get()->GetUserOptions().GetFullName(); return !FullName.isEmpty() && (Changed == FullName || (Changed.isEmpty() && Created == FullName)); } @@ -1573,7 +1573,7 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > // Got a custom value, then it makes sense to trigger notifications. SwViewOption aUsrPref(*pVOpt); aUsrPref.SetKeepRatio(bKeepRatio); - SW_MOD()->ApplyUsrPref(aUsrPref, this); + SwModule::get()->ApplyUsrPref(aUsrPref, this); } // Set ViewLayoutSettings @@ -1582,7 +1582,7 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > const bool bSetViewSettings = bGotZoomType && bGotZoomFactor && ( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom ) && - SW_MOD()->GetUsrPref(pVOpt->getBrowseMode())->IsDefaultZoom(); + SwModule::get()->GetUsrPref(pVOpt->getBrowseMode())->IsDefaultZoom(); // In case we have a 'fixed' view layout of 2 or more columns, // we have to apply the view options *before* starting the action. @@ -1852,8 +1852,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) void SwView::ScannerEventHdl() { - uno::Reference< XScannerManager2 > xScanMgr = SW_MOD()->GetScannerManager(); - if( xScanMgr.is() ) + if (uno::Reference xScanMgr = SwModule::get()->GetScannerManager()) { const ScannerContext aContext( xScanMgr->getAvailableScanners().getConstArray()[ 0 ] ); const ScanError eError = xScanMgr->getError( aContext ); @@ -2126,7 +2125,7 @@ namespace sw { void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb) { - o_rData = *SW_MOD()->GetPrtOptions(bWeb); + o_rData = *SwModule::get()->GetPrtOptions(bWeb); } } // namespace sw diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 0a0e21a28e68..3b640c179eae 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -707,7 +707,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) bool bWebView = dynamic_cast(this) != nullptr; SwWrtShell &rSh = GetWrtShell(); rSh.StartAction(); - SwModule* pModule = SW_MOD(); + SwModule* pModule = SwModule::get(); if( *rSh.GetViewOptions() != *pOpt ) { rSh.ApplyViewOptions( *pOpt ); diff --git a/sw/source/uibase/uiview/view1.cxx b/sw/source/uibase/uiview/view1.cxx index ca51ceba98c7..e18de9600d58 100644 --- a/sw/source/uibase/uiview/view1.cxx +++ b/sw/source/uibase/uiview/view1.cxx @@ -47,8 +47,7 @@ void SwView::Activate(bool bMDIActivate) SwDocShell* pDocSh = GetDocShell(); if(pDocSh) pDocSh->SetView(this); - SwModule* pSwMod = SW_MOD(); - pSwMod->SetView(this); + SwModule::get()->SetView(this); // Document size has changed. if(!bDocSzUpdated) diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index fa4d6b3d7eae..ff795be11827 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2952,7 +2952,7 @@ namespace return ( !aNames.hasElements() || ( ( 1 == aNames.getLength() ) - && aNames.getConstArray()[0] == SW_MOD()->GetDBConfig()->GetBibliographySource().sDataSource + && aNames.getConstArray()[0] == SwModule::get()->GetDBConfig()->GetBibliographySource().sDataSource ) ); } diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index 5eb3340627c6..49112bb77495 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -195,7 +195,7 @@ bool SwView::isQRCodeSelected() const void SwView::AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId) { - SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + SwModuleOptions* pModOpt = SwModule::get()->GetModuleConfig(); bool bWeb = dynamic_cast( this ) != nullptr; if (pModOpt->IsInsWithCaption(bWeb)) diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index f211396116d7..e62c4987ea79 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -95,7 +95,8 @@ void SwView::SetZoom_( const Size &rEditSize, SvxZoomType eZoomType, tools::Long nFac = nFactor; const bool bWeb = dynamic_cast< const SwWebView *>( this ) != nullptr; - SwMasterUsrPref *pUsrPref = const_cast(SW_MOD()->GetUsrPref(bWeb)); + SwModule* mod = SwModule::get(); + SwMasterUsrPref *pUsrPref = const_cast(mod->GetUsrPref(bWeb)); const SwPageDesc &rDesc = m_pWrtShell->GetPageDesc( m_pWrtShell->GetCurPageDesc() ); const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace(); @@ -167,7 +168,7 @@ void SwView::SetZoom_( const Size &rEditSize, SvxZoomType eZoomType, { pUsrPref->SetZoom(nZoomFac); pUsrPref->SetZoomType(eZoomType); - SW_MOD()->ApplyUsrPref(*pUsrPref, nullptr); + mod->ApplyUsrPref(*pUsrPref, nullptr); pUsrPref->SetModified(); } if ( pOpt->GetZoom() != nZoomFac ) @@ -227,7 +228,8 @@ void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly if ( !GetViewFrame().GetFrame().IsInPlace() && !bViewOnly ) { const bool bWeb = dynamic_cast< const SwWebView *>( this ) != nullptr; - SwMasterUsrPref *pUsrPref = const_cast(SW_MOD()->GetUsrPref(bWeb)); + SwModule* mod = SwModule::get(); + SwMasterUsrPref *pUsrPref = const_cast(mod->GetUsrPref(bWeb)); // Update MasterUsrPrefs and after that update the ViewOptions of the current View. if ( nColumns != pUsrPref->GetViewLayoutColumns() || @@ -235,7 +237,7 @@ void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly { pUsrPref->SetViewLayoutColumns(nColumns); pUsrPref->SetViewLayoutBookMode(bBookMode); - SW_MOD()->ApplyUsrPref(*pUsrPref, nullptr); + mod->ApplyUsrPref(*pUsrPref, nullptr); pUsrPref->SetModified(); } } diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index 1d19a897c034..aca4407a5264 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -79,7 +79,7 @@ SfxPrinter* SwView::GetPrinter( bool bCreate ) void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter const * pNew, bool bWeb ) { - SwPrintOptions* pOpt = SW_MOD()->GetPrtOptions(bWeb); + SwPrintOptions* pOpt = SwModule::get()->GetPrtOptions(bWeb); if( !pOpt) return; @@ -177,7 +177,7 @@ void SwView::ExecutePrint(SfxRequest& rReq) { case FN_FAX: { - SwPrintOptions* pPrintOptions = SW_MOD()->GetPrtOptions(bWeb); + SwPrintOptions* pPrintOptions = SwModule::get()->GetPrtOptions(bWeb); const OUString& sFaxName(pPrintOptions->GetFaxName()); if (!sFaxName.isEmpty()) { @@ -214,7 +214,7 @@ void SwView::ExecutePrint(SfxRequest& rReq) bool bFromMerge = pPrintFromMergeItem && pPrintFromMergeItem->GetValue(); bool bPrintSelection = false; if(!bSilent && !bFromMerge && - SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc()) + SwModule::get()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc()) { std::unique_ptr xBuilder(Application::CreateBuilder(GetEditWin().GetFrameWeld(), u"modules/swriter/ui/printmergedialog.ui"_ustr)); std::unique_ptr xBox(xBuilder->weld_message_dialog(u"PrintMergeDialog"_ustr)); diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index d1e3f102f967..866e1a9fa99a 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -301,7 +301,7 @@ void SwView::GetState(SfxItemSet &rSet) case SID_TWAIN_TRANSFER: #if defined(_WIN32) || defined UNX { - if(!SW_MOD()->GetScannerManager().is()) + if (!SwModule::get()->GetScannerManager().is()) rSet.DisableItem(nWhich); } #endif diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 713dea75838f..2d6c636f0bc9 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -270,7 +270,7 @@ void SwXPrintSettings::_preSetValues () switch (meType) { case SwXPrintSettingsType::Module: - mpPrtOpt = SW_MOD()->GetPrtOptions( false ); + mpPrtOpt = SwModule::get()->GetPrtOptions(false); break; case SwXPrintSettingsType::Document: { @@ -407,7 +407,7 @@ void SwXPrintSettings::_preGetValues() switch (meType) { case SwXPrintSettingsType::Module: - mpPrtOpt = SW_MOD()->GetPrtOptions( false ); + mpPrtOpt = SwModule::get()->GetPrtOptions(false); break; case SwXPrintSettingsType::Document: { @@ -543,7 +543,7 @@ void SwXViewSettings::_preSetValues () pVOpt = m_pView->GetWrtShell().GetViewOptions(); } else - pVOpt = SW_MOD()->GetViewOption(false); + pVOpt = SwModule::get()->GetViewOption(false); mpViewOption.reset( new SwViewOption (*pVOpt) ); mbApplyZoom = false; @@ -758,6 +758,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c void SwXViewSettings::_postSetValues() { + SwModule* mod = SwModule::get(); if( m_pView ) { if(mbApplyZoom ) @@ -772,12 +773,12 @@ void SwXViewSettings::_postSetValues() else { if(mbApplyHRulerMetric) - SW_MOD()->ApplyRulerMetric( m_eHRulerUnit, true, false ); + mod->ApplyRulerMetric(m_eHRulerUnit, true, false); if(mbApplyVRulerMetric) - SW_MOD()->ApplyRulerMetric( m_eVRulerUnit, false, false ); + mod->ApplyRulerMetric(m_eVRulerUnit, false, false); } - SW_MOD()->ApplyUsrPref( *mpViewOption, m_pView, m_pView ? SvViewOpt::DestViewOnly + mod->ApplyUsrPref( *mpViewOption, m_pView, m_pView ? SvViewOpt::DestViewOnly : SvViewOpt::DestText ); mpViewOption.reset(); @@ -792,7 +793,7 @@ void SwXViewSettings::_preGetValues () mpConstViewOption = m_pView->GetWrtShell().GetViewOptions(); } else - mpConstViewOption = SW_MOD()->GetViewOption(false); + mpConstViewOption = SwModule::get()->GetViewOption(false); } void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue ) @@ -909,7 +910,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u } else { - const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( false ); + const SwMasterUsrPref* pUsrPref = SwModule::get()->GetUsrPref(false); rValue <<= static_cast(pUsrPref->GetHScrollMetric()); } bBool = false; @@ -925,7 +926,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u } else { - const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( false ); + const SwMasterUsrPref* pUsrPref = SwModule::get()->GetUsrPref(false); rValue <<= static_cast(pUsrPref->GetVScrollMetric()); } bBool = false; diff --git a/sw/source/uibase/uno/unomodule.cxx b/sw/source/uibase/uno/unomodule.cxx index 714ae5d5ec1c..202e876f3b26 100644 --- a/sw/source/uibase/uno/unomodule.cxx +++ b/sw/source/uibase/uno/unomodule.cxx @@ -52,14 +52,15 @@ void SAL_CALL SwUnoModule::dispatchWithNotification( const util::URL& aURL, cons SolarMutexGuard aGuard; SwGlobals::ensure(); - const SfxSlot* pSlot = SW_MOD()->GetInterface()->GetSlot( aURL.Complete ); + SwModule* mod = SwModule::get(); + const SfxSlot* pSlot = mod->GetInterface()->GetSlot(aURL.Complete); sal_Int16 aState = frame::DispatchResultState::DONTKNOW; if ( !pSlot ) aState = frame::DispatchResultState::FAILURE; else { - SfxRequest aReq( pSlot, aArgs, SfxCallMode::SYNCHRON, SW_MOD()->GetPool() ); + SfxRequest aReq(pSlot, aArgs, SfxCallMode::SYNCHRON, mod->GetPool()); SfxAllItemSet aInternalSet( SfxGetpApp()->GetPool() ); css::uno::Reference xDesktop = css::frame::Desktop::create(::comphelper::getProcessComponentContext()); @@ -68,7 +69,7 @@ void SAL_CALL SwUnoModule::dispatchWithNotification( const util::URL& aURL, cons aInternalSet.Put(SfxUnoFrameItem(SID_FILLFRAME, xCurrentFrame)); aReq.SetInternalArgs_Impl(aInternalSet); - const SfxPoolItemHolder& rResult(SW_MOD()->ExecuteSlot(aReq)); + const SfxPoolItemHolder& rResult(mod->ExecuteSlot(aReq)); if (rResult) aState = frame::DispatchResultState::SUCCESS; else @@ -123,7 +124,7 @@ uno::Reference< frame::XDispatch > SAL_CALL SwUnoModule::queryDispatch( SolarMutexGuard aGuard; SwGlobals::ensure(); - const SfxSlot* pSlot = SW_MOD()->GetInterface()->GetSlot( aURL.Complete ); + const SfxSlot* pSlot = SwModule::get()->GetInterface()->GetSlot(aURL.Complete); if ( pSlot ) xReturn = this; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 2c5d72edaff2..148cb4de6189 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -1944,7 +1944,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& { OUString sDelim; aValue >>= sDelim; - SW_MOD()->GetModuleConfig()->SetWordDelimiter(sDelim); + SwModule::get()->GetModuleConfig()->SetWordDelimiter(sDelim); } break; case WID_DOC_CHANGES_RECORD: @@ -1991,7 +1991,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& } break; case WID_DOC_HIDE_TIPS : - SW_MOD()->GetModuleConfig()->SetHideFieldTips(*o3tl::doAccess(aValue)); + SwModule::get()->GetModuleConfig()->SetHideFieldTips(*o3tl::doAccess(aValue)); break; case WID_DOC_REDLINE_DISPLAY: { @@ -2167,9 +2167,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) } break; case WID_DOC_WORD_SEPARATOR : - { - aAny <<= SW_MOD()->GetDocStatWordDelim(); - } + aAny <<= SwModule::get()->GetDocStatWordDelim(); break; case WID_DOC_CHANGES_RECORD: case WID_DOC_CHANGES_SHOW: @@ -2194,7 +2192,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) aAny <<= GetDocOrThrow().GetTOIAutoMarkURL(); break; case WID_DOC_HIDE_TIPS : - aAny <<= SW_MOD()->GetModuleConfig()->IsHideFieldTips(); + aAny <<= SwModule::get()->GetModuleConfig()->IsHideFieldTips(); break; case WID_DOC_REDLINE_DISPLAY: { @@ -3450,7 +3448,7 @@ void SwXTextDocument::getTrackedChanges(tools::JsonWriter& rJson) void SwXTextDocument::getTrackedChangeAuthors(tools::JsonWriter& rJsonWriter) { - SW_MOD()->GetRedlineAuthorInfo(rJsonWriter); + SwModule::get()->GetRedlineAuthorInfo(rJsonWriter); } void SwXTextDocument::getRulerState(tools::JsonWriter& rJsonWriter) @@ -3777,7 +3775,7 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::SequenceGetRedlineAuthor(SW_MOD()->GetRedlineAuthor()); + OUString sOrigAuthor = SwModule::get()->GetRedlineAuthor(SwModule::get()->GetRedlineAuthor()); OUString sAuthor; for (const beans::PropertyValue& rValue : rArguments) diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 722e5bc2e93f..adddc658fba6 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -479,7 +479,7 @@ SwContentType::SwContentType(SwWrtShell* pShell, ContentTypeId nType, sal_uInt8 const int nShift = static_cast(m_nContentType); assert(nShift > -1); const sal_Int32 nMask = 1 << nShift; - const sal_Int32 nBlock = SW_MOD()->GetNavigationConfig()->GetSortAlphabeticallyBlock(); + const sal_Int32 nBlock = SwModule::get()->GetNavigationConfig()->GetSortAlphabeticallyBlock(); m_bAlphabeticSort = nBlock & nMask; FillMemberList(); @@ -1143,7 +1143,7 @@ SwContentTree::SwContentTree(std::unique_ptr xTreeView, SwNaviga , m_sInvisible(SwResId(STR_INVISIBLE)) , m_pHiddenShell(nullptr) , m_pActiveShell(nullptr) - , m_pConfig(SW_MOD()->GetNavigationConfig()) + , m_pConfig(SwModule::get()->GetNavigationConfig()) , m_nActiveBlock(0) , m_nHiddenBlock(0) , m_nEntryCount(0) diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index e8ab96545266..e0c77c357943 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -444,7 +444,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, , m_pContentWrtShell(nullptr) , m_pActContView(nullptr) , m_pCreateView(nullptr) - , m_pConfig(SW_MOD()->GetNavigationConfig()) + , m_pConfig(SwModule::get()->GetNavigationConfig()) , m_rBindings(*_pBindings) , m_bIsZoomedIn(false) , m_bGlobalMode(false) @@ -1282,7 +1282,7 @@ SwNavigatorWin::SwNavigatorWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, { _pBindings->Invalidate(SID_NAVIGATOR); - SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig(); + SwNavigationConfig* pNaviConfig = SwModule::get()->GetNavigationConfig(); SetMinOutputSizePixel(GetOptimalSize()); if (pNaviConfig->IsSmall()) diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 86c1c18264ef..ac13b482ea92 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -758,14 +758,14 @@ void SwToSfxPageDescAttr( SfxItemSet& rCoreSet ) FieldUnit GetDfltMetric(bool bWeb) { - return SW_MOD()->GetUsrPref(bWeb)->GetMetric(); + return SwModule::get()->GetUsrPref(bWeb)->GetMetric(); } // Determine metric void SetDfltMetric( FieldUnit eMetric, bool bWeb ) { - SW_MOD()->ApplyUserMetric(eMetric, bWeb); + SwModule::get()->ApplyUserMetric(eMetric, bWeb); } void InsertStringSorted(const OUString& rId, const OUString& rEntry, weld::ComboBox& rToFill, int nOffset) @@ -873,12 +873,12 @@ OUString GetAppLangDateTimeString( const DateTime& rDT ) bool HasCharUnit( bool bWeb) { - return SW_MOD()->GetUsrPref(bWeb)->IsApplyCharUnit(); + return SwModule::get()->GetUsrPref(bWeb)->IsApplyCharUnit(); } void SetApplyCharUnit(bool bApplyChar, bool bWeb) { - SW_MOD()->ApplyUserCharUnit(bApplyChar, bWeb); + SwModule::get()->ApplyUserCharUnit(bApplyChar, bWeb); } bool ExecuteMenuCommand(const css::uno::Reference& rMenu, const SfxViewFrame& rViewFrame, sal_uInt16 nId) diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 680f4f22c61e..7029b6f29e68 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -92,7 +92,7 @@ SwOneExampleFrame::SwOneExampleFrame(sal_uInt32 nFlags, const Link* pInitializedLink, const OUString* pURL) : m_aLoadedIdle("sw uibase SwOneExampleFrame Loaded") - , m_pModuleView(SW_MOD()->GetView()) + , m_pModuleView(SwModule::get()->GetView()) , m_nStyleFlags(nFlags) , m_bIsInitialized(false) { @@ -141,7 +141,7 @@ void SwOneExampleFrame::Paint(vcl::RenderContext& rRenderContext, const tools::R // invalidate on rRenderContext if it is a vcl::Window, which is the "classic" gen mode m_xVirDev->SetOutputSizePixel(aSize); - Color aBgColor = SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor; + Color aBgColor = SwModule::get()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor; m_xVirDev->DrawWallpaper(tools::Rectangle(Point(), aSize), aBgColor); if (m_xCursor) @@ -415,7 +415,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer, void ) } } - SW_MOD()->SetView(m_pModuleView); + SwModule::get()->SetView(m_pModuleView); Invalidate(); } diff --git a/sw/source/uibase/web/wview.cxx b/sw/source/uibase/web/wview.cxx index 766c1a5ccb00..2ed240b0252c 100644 --- a/sw/source/uibase/web/wview.cxx +++ b/sw/source/uibase/web/wview.cxx @@ -117,7 +117,7 @@ void SwWebView::SelectShell() else { SfxDispatcher &rDispatcher = *GetViewFrame().GetDispatcher(); - SwToolbarConfigItem *pBarCfg = SW_MOD()->GetWebToolbarConfig(); + SwToolbarConfigItem* pBarCfg = SwModule::get()->GetWebToolbarConfig(); if( GetCurShell() ) { diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index c9651cec90f3..040d3c81ebc7 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -455,7 +455,7 @@ void SwWrtShell::InsertObject( const svt::EmbeddedObjectRef& xRef, SvGlobalName // TODO/LATER: recording! Convert properties to items case SID_INSERT_FLOATINGFRAME: { - SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); + SfxSlotPool* pSlotPool = SwModule::get()->GetSlotPool(); const SfxSlot* pSlot = pSlotPool->GetSlot(nSlotId); OUString aCmd = pSlot->GetCommand(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); @@ -2260,8 +2260,9 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, const SfxRequest& rReq) sAuthor = pAuthorItem->GetValue(); else { - std::size_t nAuthor = SW_MOD()->GetRedlineAuthor(); - sAuthor = SW_MOD()->GetRedlineAuthor(nAuthor); + SwModule* mod = SwModule::get(); + std::size_t nAuthor = mod->GetRedlineAuthor(); + sAuthor = mod->GetRedlineAuthor(nAuthor); } const SvxPostItTextItem* pTextItem = rReq.GetArg(SID_ATTR_POSTIT_TEXT); From 7fce875718687e12df4d7a8b997ca7baea548b91 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 14 Nov 2024 19:28:09 +0500 Subject: [PATCH 179/373] Turn SD_MOD macro to a function Change-Id: I1303e9d48e92ac00eee12af9ed299cdaad2ce009 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177072 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sd/inc/sdmod.hxx | 4 ++-- sd/qa/unit/dialogs-test.cxx | 2 +- sd/source/core/drawdoc.cxx | 8 ++++---- sd/source/core/drawdoc3.cxx | 5 +++-- sd/source/core/sdpage.cxx | 2 +- sd/source/filter/eppt/pptx-epptooxml.cxx | 2 +- sd/source/ui/animations/CustomAnimationPane.cxx | 4 ++-- sd/source/ui/animations/SlideTransitionPane.cxx | 4 ++-- sd/source/ui/annotations/annotationmanager.cxx | 6 ++---- sd/source/ui/app/sdmod.cxx | 4 ++-- sd/source/ui/app/sdmod2.cxx | 5 +++-- sd/source/ui/app/sdpopup.cxx | 4 ++-- sd/source/ui/app/sdxfer.cxx | 4 ++-- sd/source/ui/dlg/dlgfield.cxx | 4 ++-- sd/source/ui/dlg/headerfooterdlg.cxx | 2 +- sd/source/ui/dlg/sdtreelb.cxx | 4 ++-- sd/source/ui/docshell/docshel3.cxx | 4 ++-- sd/source/ui/docshell/docshel4.cxx | 6 +++--- sd/source/ui/docshell/docshell.cxx | 2 +- sd/source/ui/func/fudraw.cxx | 6 +++--- sd/source/ui/func/fuexpand.cxx | 2 +- sd/source/ui/func/fuinsert.cxx | 2 +- sd/source/ui/func/fuinsfil.cxx | 4 ++-- sd/source/ui/func/fusel.cxx | 4 ++-- sd/source/ui/func/fusldlg.cxx | 2 +- sd/source/ui/func/fusumry.cxx | 2 +- sd/source/ui/func/futempl.cxx | 8 ++++---- sd/source/ui/sidebar/LayoutMenu.cxx | 2 +- sd/source/ui/slideshow/slideshow.cxx | 6 +++--- sd/source/ui/slideshow/slideshowimpl.cxx | 6 +++--- .../controller/SlideSorterController.cxx | 2 +- .../ui/slidesorter/controller/SlsClipboard.cxx | 14 +++++++------- .../controller/SlsDragAndDropContext.cxx | 2 +- .../controller/SlsSelectionFunction.cxx | 7 ++++--- .../ui/slidesorter/controller/SlsSlotManager.cxx | 4 ++-- sd/source/ui/table/tablefunction.cxx | 2 +- sd/source/ui/table/tableobjectbar.cxx | 2 +- sd/source/ui/unoidl/UnoDocumentSettings.cxx | 4 ++-- sd/source/ui/unoidl/unomodel.cxx | 2 +- sd/source/ui/unoidl/unomodule.cxx | 9 +++++---- sd/source/ui/unoidl/unoobj.cxx | 4 ++-- sd/source/ui/view/NotesPanelView.cxx | 2 +- sd/source/ui/view/NotesPanelViewShell.cxx | 2 +- sd/source/ui/view/Outliner.cxx | 6 +++--- sd/source/ui/view/ViewClipboard.cxx | 2 +- sd/source/ui/view/ViewShellBase.cxx | 4 ++-- sd/source/ui/view/drviews2.cxx | 4 ++-- sd/source/ui/view/drviews4.cxx | 2 +- sd/source/ui/view/drviews5.cxx | 2 +- sd/source/ui/view/drviews7.cxx | 2 +- sd/source/ui/view/drviewsa.cxx | 7 ++++--- sd/source/ui/view/drviewse.cxx | 2 +- sd/source/ui/view/drviewsf.cxx | 2 +- sd/source/ui/view/drviewsg.cxx | 2 +- sd/source/ui/view/drviewsk.cxx | 2 +- sd/source/ui/view/frmview.cxx | 2 +- sd/source/ui/view/outlview.cxx | 2 +- sd/source/ui/view/sdview.cxx | 2 +- sd/source/ui/view/sdview2.cxx | 15 ++++++++------- sd/source/ui/view/sdview3.cxx | 15 ++++++++------- sd/source/ui/view/viewshel.cxx | 2 +- 61 files changed, 128 insertions(+), 123 deletions(-) diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index b872ebf0913d..156a2ec09cec 100644 --- a/sd/inc/sdmod.hxx +++ b/sd/inc/sdmod.hxx @@ -127,6 +127,8 @@ public: svtools::ColorConfig& GetColorConfig(); + static auto get() { return static_cast(SfxApplication::GetModule(SfxToolsModule::Draw)); } + private: SdOptions* pImpressOptions; @@ -173,6 +175,4 @@ private: std::unique_ptr mpColorConfig; }; -#define SD_MOD() ( static_cast(SfxApplication::GetModule(SfxToolsModule::Draw)) ) - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx index bebbb2629341..0a00c80f88a7 100644 --- a/sd/qa/unit/dialogs-test.cxx +++ b/sd/qa/unit/dialogs-test.cxx @@ -409,7 +409,7 @@ VclPtr SdDialogsTest::createDialogByID(sal_uInt32 nID) aDlgSet.Put(SfxBoolItem(ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo)); aDlgSet.Put(SfxBoolItem(ATTR_PRESENT_INTERACTIVE, rPresentationSettings.mbInteractive)); - //SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + //SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); aDlgSet.Put(SfxInt32Item(ATTR_PRESENT_DISPLAY, 0 /*pOptions->GetDisplay()*/)); pRetval = getSdAbstractDialogFactory()->CreateSdStartPresentationDlg( Application::GetDefDialogParent(), diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 178b85265241..a07d24e4ffcb 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -159,7 +159,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) // Set measuring unit (of the application) and scale (of SdMod) sal_Int32 nX, nY; - SdOptions* pOptions = SD_MOD()->GetSdOptions(meDocType); + SdOptions* pOptions = SdModule::get()->GetSdOptions(meDocType); nX = officecfg::Office::Draw::Zoom::ScaleX::get(); nY = officecfg::Office::Draw::Zoom::ScaleY::get(); SvtSysLocale aSysLocale; @@ -935,7 +935,7 @@ SdOutliner* SdDrawDocument::GetOutliner(bool bCreateOutliner) mpOutliner.reset(new SdOutliner( this, OutlinerMode::TextObject )); if (mpDocSh) - mpOutliner->SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + mpOutliner->SetRefDevice(SdModule::get()->GetVirtualRefDevice()); mpOutliner->SetDefTab( m_nDefaultTabulator ); mpOutliner->SetStyleSheetPool(static_cast(GetStyleSheetPool())); @@ -959,7 +959,7 @@ SdOutliner* SdDrawDocument::GetInternalOutliner(bool bCreateOutliner) mpInternalOutliner->EnableUndo( false ); if (mpDocSh) - mpInternalOutliner->SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + mpInternalOutliner->SetRefDevice(SdModule::get()->GetVirtualRefDevice()); mpInternalOutliner->SetDefTab( m_nDefaultTabulator ); mpInternalOutliner->SetStyleSheetPool(static_cast(GetStyleSheetPool())); @@ -1097,7 +1097,7 @@ void SdDrawDocument::MasterPageListChanged() void SdDrawDocument::SetCalcFieldValueHdl(::Outliner* pOutliner) { - pOutliner->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); + pOutliner->SetCalcFieldValueHdl(LINK(SdModule::get(), SdModule, CalcFieldValueHdl)); } sal_uInt16 SdDrawDocument::GetAnnotationAuthorIndex( const OUString& rAuthor ) diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 82cc1611caff..5df9ea0d7dfd 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -444,12 +444,13 @@ bool SdDrawDocument::InsertBookmarkAsPage( if( bNoDialogs ) { + SdModule* mod = SdModule::get(); // If this is clipboard, then no need to scale objects: // this will make copied masters to differ from the originals, // and thus InsertBookmarkAsPage_FindDuplicateLayouts will // duplicate masters on insert to same document - m_bTransportContainer = (SD_MOD()->pTransferClip && - SD_MOD()->pTransferClip->GetWorkDocument() == this); + m_bTransportContainer = (mod->pTransferClip && + mod->pTransferClip->GetWorkDocument() == this); if (!m_bTransportContainer) { if (rBookmarkList.empty()) diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index ba3bbfb9d014..e611246eded6 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2365,7 +2365,7 @@ void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eO { SfxItemPool* pPool(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDrawOutliner().GetEmptyItemSet().GetPool()); pOutl = new ::Outliner( pPool, OutlinerMode::OutlineObject ); - pOutl->SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + pOutl->SetRefDevice(SdModule::get()->GetVirtualRefDevice()); pOutl->SetEditTextObjectPool(pPool); pOutl->SetStyleSheetPool(static_cast(getSdrModelFromSdrPage().GetStyleSheetPool())); pOutl->EnableUndo(false); diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index ab319d6ab498..01174b023902 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -1960,7 +1960,7 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderReferenceTextBody( aDateTimeText = SvxDateTimeField::GetFormatted( aDateTime, aDateTime, eDate, - eTime, *(SD_MOD()->GetNumberFormatter()), + eTime, *(SdModule::get()->GetNumberFormatter()), rLanguageTag.getLanguageType()); } diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 528e53e9d86d..77a2e4aa6a7d 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -743,7 +743,7 @@ void CustomAnimationPane::updateControls() mxPBMoveUp->set_sensitive(mxView.is() && bEnableUp); mxPBMoveDown->set_sensitive(mxView.is() && bEnableDown); - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); mxCBAutoPreview->set_active(pOptions->IsPreviewChangedEffects()); updateMotionPathTags(); @@ -2320,7 +2320,7 @@ void CustomAnimationPane::implControlHdl(const weld::Widget* pControl) onPreview( true ); else if (pControl == mxCBAutoPreview.get()) { - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); pOptions->SetPreviewChangedEffects(mxCBAutoPreview->get_active()); } } diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 69a22927cb49..1ab9ca44ab0c 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -634,7 +634,7 @@ void SlideTransitionPane::updateControls() else { mxRepeatAutoFrame->hide(); - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); mxCB_AUTO_PREVIEW->set_active( pOptions->IsPreviewTransitions() ); } @@ -1115,7 +1115,7 @@ IMPL_LINK_NOARG(SlideTransitionPane, LoopSoundBoxChecked, weld::Toggleable&, voi IMPL_LINK_NOARG(SlideTransitionPane, AutoPreviewClicked, weld::Toggleable&, void) { - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); pOptions->SetPreviewTransitions( mxCB_AUTO_PREVIEW->get_active() ); } diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index e2e5977a7e1e..d172d5acd0af 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -177,8 +177,7 @@ AnnotationManagerImpl::AnnotationManagerImpl( ViewShellBase& rViewShellBase ) , mbShowAnnotations( true ) , mnUpdateTagsEvent( nullptr ) { - SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()); - if( pOptions ) + if (SdOptions* pOptions = SdModule::get()->GetSdOptions(mpDoc->GetDocumentType())) mbShowAnnotations = pOptions->IsShowComments(); } @@ -289,8 +288,7 @@ void AnnotationManagerImpl::ShowAnnotations( bool bShow ) { mbShowAnnotations = bShow; - SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()); - if( pOptions ) + if (SdOptions* pOptions = SdModule::get()->GetSdOptions(mpDoc->GetDocumentType())) pOptions->SetShowComments( mbShowAnnotations ); UpdateTags(); diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index df2fd5c50eee..8b2ff650f6b3 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -86,12 +86,12 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 ) OUString SdResId(TranslateId aId) { - return Translate::get(aId, SD_MOD()->GetResLocale()); + return Translate::get(aId, SdModule::get()->GetResLocale()); } OUString SdResId(TranslateNId aContextSingularPlural, int nCardinality) { - return Translate::nget(aContextSingularPlural, nCardinality, SD_MOD()->GetResLocale()); + return Translate::nget(aContextSingularPlural, nCardinality, SdModule::get()->GetResLocale()); } // Dtor diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index a9cafe31a765..52b3f7780844 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -864,16 +864,17 @@ std::unique_ptr SdModule::CreateTabPage( sal_uInt16 nId, weld::Conta std::optional SdModule::CreateStyleFamilies() { SfxStyleFamilies aStyleFamilies; + std::locale resLocale = SdModule::get()->GetResLocale(); aStyleFamilies.emplace_back(SfxStyleFamily::Para, SdResId(STR_GRAPHICS_STYLE_FAMILY), BMP_STYLES_FAMILY_GRAPHICS, - RID_GRAPHICSTYLEFAMILY, SD_MOD()->GetResLocale()); + RID_GRAPHICSTYLEFAMILY, resLocale); aStyleFamilies.emplace_back(SfxStyleFamily::Pseudo, SdResId(STR_PRESENTATIONS_STYLE_FAMILY), BMP_STYLES_FAMILY_PRESENTATIONS, - RID_PRESENTATIONSTYLEFAMILY, SD_MOD()->GetResLocale()); + RID_PRESENTATIONSTYLEFAMILY, resLocale); return aStyleFamilies; } diff --git a/sd/source/ui/app/sdpopup.cxx b/sd/source/ui/app/sdpopup.cxx index 0e6f84347e7e..8c9607421be7 100644 --- a/sd/source/ui/app/sdpopup.cxx +++ b/sd/source/ui/app/sdpopup.cxx @@ -69,7 +69,7 @@ void SdFieldPopup::Fill( LanguageType eLanguage ) m_xPopup->append_radio(OUString::number(nID++), SdResId(STR_STANDARD_SMALL)); m_xPopup->append_radio(OUString::number(nID++), SdResId(STR_STANDARD_BIG)); - SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter(); + SvNumberFormatter* pNumberFormatter = SdModule::get()->GetNumberFormatter(); aDateField.SetFormat( SvxDateFormat::A ); // 13.02.96 m_xPopup->append_radio(OUString::number(nID++), aDateField.GetFormatted(*pNumberFormatter, eLanguage)); aDateField.SetFormat( SvxDateFormat::B ); // 13.02.1996 @@ -99,7 +99,7 @@ void SdFieldPopup::Fill( LanguageType eLanguage ) //SvxTimeFormat::System, // is not used m_xPopup->append_radio(OUString::number(nID++), SdResId(STR_STANDARD_NORMAL)); - SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter(); + SvNumberFormatter* pNumberFormatter = SdModule::get()->GetNumberFormatter(); aTimeField.SetFormat( SvxTimeFormat::HH24_MM ); // 13:49 m_xPopup->append_radio(OUString::number(nID++), aTimeField.GetFormatted(*pNumberFormatter, eLanguage)); aTimeField.SetFormat( SvxTimeFormat::HH24_MM_SS ); // 13:49:38 diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index a7cd70860ce1..17ed6280b13a 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -436,7 +436,7 @@ void SdTransferable::AddSupportedFormats() bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc ) { - if (SD_MOD()==nullptr) + if (SdModule::get() == nullptr) return false; SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor ); @@ -636,7 +636,7 @@ void SdTransferable::DragFinished( sal_Int8 nDropAction ) void SdTransferable::ObjectReleased() { - SdModule *pModule = SD_MOD(); + SdModule* pModule = SdModule::get(); if (!pModule) return; diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx index 881ab311b75d..61623d16c409 100644 --- a/sd/source/ui/dlg/dlgfield.cxx +++ b/sd/source/ui/dlg/dlgfield.cxx @@ -162,7 +162,7 @@ void SdModifyFieldDlg::FillFormatList() m_xLbFormat->append_text( SdResId( STR_STANDARD_SMALL ) ); m_xLbFormat->append_text( SdResId( STR_STANDARD_BIG ) ); - SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter(); + SvNumberFormatter* pNumberFormatter = SdModule::get()->GetNumberFormatter(); aDateField.SetFormat( SvxDateFormat::A ); // 13.02.96 m_xLbFormat->append_text( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); aDateField.SetFormat( SvxDateFormat::B ); // 13.02.1996 @@ -186,7 +186,7 @@ void SdModifyFieldDlg::FillFormatList() //SvxTimeFormat::System, // not used m_xLbFormat->append_text( SdResId( STR_STANDARD_NORMAL ) ); - SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter(); + SvNumberFormatter* pNumberFormatter = SdModule::get()->GetNumberFormatter(); aTimeField.SetFormat( SvxTimeFormat::HH24_MM ); // 13:49 m_xLbFormat->append_text( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); aTimeField.SetFormat( SvxTimeFormat::HH24_MM_SS ); // 13:49:38 diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index c2936d014faa..fe5c17045efe 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -431,7 +431,7 @@ void HeaderFooterTabPage::FillFormatList( sal_Int32 nSelectedPos ) OUString aStr( SvxDateTimeField::GetFormatted( aDateTime, aDateTime, nDateTimeFormats[nFormat].meDateFormat, nDateTimeFormats[nFormat].meTimeFormat, - *(SD_MOD()->GetNumberFormatter()), eLanguage ) ); + *(SdModule::get()->GetNumberFormatter()), eLanguage ) ); mxCBDateTimeFormat->append_text(aStr); if (nFormat == nSelectedPos) mxCBDateTimeFormat->set_active(nFormat); diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 8834c71e50bb..be28cc2fda73 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -465,7 +465,7 @@ bool SdPageObjsTLV::DoDrag() { AddShapeToTransferable(*m_xHelper, *pObject); m_xHelper->SetView(pView); - SD_MOD()->pTransferDrag = m_xHelper.get(); + SdModule::get()->pTransferDrag = m_xHelper.get(); } // Unnamed shapes have to be selected to be recognized by the @@ -479,7 +479,7 @@ bool SdPageObjsTLV::DoDrag() else { m_xHelper->SetView(pView); - SD_MOD()->pTransferDrag = m_xHelper.get(); + SdModule::get()->pTransferDrag = m_xHelper.get(); } return false; diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index 234c63578667..e4e3f9d4d171 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -144,7 +144,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) { const SvxSearchItem & rSearchItem = pReqArgs->Get(SID_SEARCH_ITEM); - SD_MOD()->SetSearchItem(std::unique_ptr(rSearchItem.Clone())); + SdModule::get()->SetSearchItem(std::unique_ptr(rSearchItem.Clone())); } rReq.Done(); @@ -220,7 +220,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) { const SvxSearchItem& rSearchItem = pReqArgs->Get(SID_SEARCH_ITEM); - SD_MOD()->SetSearchItem(std::unique_ptr(rSearchItem.Clone())); + SdModule::get()->SetSearchItem(std::unique_ptr(rSearchItem.Clone())); xFuSearch->SearchAndReplace(&rSearchItem); } } diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index c71706e3caab..dca885bcd2cd 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -105,7 +105,7 @@ SfxPrinter* DrawDocShell::GetPrinter(bool bCreate) SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT>>( GetPool() ); // set PrintOptionsSet - SdOptionsPrintItem aPrintItem( SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()) ); + SdOptionsPrintItem aPrintItem(SdModule::get()->GetSdOptions(mpDoc->GetDocumentType())); SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC ); SfxPrinterChangeFlags nFlags = (aPrintItem.GetOptionsPrint().IsWarningSize() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE) | @@ -168,7 +168,7 @@ void DrawDocShell::UpdateFontList() if ( mpDoc->GetPrinterIndependentLayout() == css::document::PrinterIndependentLayout::DISABLED ) pRefDevice = GetPrinter(true); else - pRefDevice = SD_MOD()->GetVirtualRefDevice(); + pRefDevice = SdModule::get()->GetVirtualRefDevice(); mpFontList.reset( new FontList(pRefDevice, nullptr) ); SvxFontListItem aFontListItem( mpFontList.get(), SID_ATTR_CHAR_FONTLIST ); PutItem( aFontListItem ); @@ -218,7 +218,7 @@ void DrawDocShell::UpdateRefDevice() break; case css::document::PrinterIndependentLayout::ENABLED: - pRefDevice = SD_MOD()->GetVirtualRefDevice(); + pRefDevice = SdModule::get()->GetVirtualRefDevice(); break; default: diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index cadc59826f47..834de4941159 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -223,7 +223,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet) case SID_SEARCH_ITEM: { - rSet.Put( *SD_MOD()->GetSearchItem() ); + rSet.Put(*SdModule::get()->GetSearchItem()); } break; diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx index 3e36d5d78f76..d40f325f2392 100644 --- a/sd/source/ui/func/fudraw.cxx +++ b/sd/source/ui/func/fudraw.cxx @@ -468,7 +468,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) if (mpView->IsDragObj()) { - if (SD_MOD()->GetWaterCan() && !mpView->PickHandle(aPnt)) + if (SdModule::get()->GetWaterCan() && !mpView->PickHandle(aPnt)) { // water can mode bDefPointer = false; @@ -479,7 +479,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) { SdrHdl* pHdl = mpView->PickHandle(aPnt); - if (SD_MOD()->GetWaterCan() && !pHdl) + if (SdModule::get()->GetWaterCan() && !pHdl) { // water can mode bDefPointer = false; @@ -656,7 +656,7 @@ void FuDraw::DoubleClick(const MouseEvent& rMEvt) SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); } else if ( ( DynCastSdrTextObj( pObj ) != nullptr || dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr ) && - !SD_MOD()->GetWaterCan() && + !SdModule::get()->GetWaterCan() && mpViewShell->GetFrameView()->IsDoubleClickTextEdit() && !mpDocSh->IsReadOnly()) { diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx index 17e0e0fed1ad..bd12519a66bb 100644 --- a/sd/source/ui/func/fuexpand.cxx +++ b/sd/source/ui/func/fuexpand.cxx @@ -92,7 +92,7 @@ void FuExpandPage::DoExecute( SfxRequest& ) aOutliner.EnableUndo(false); if (mpDocSh) - aOutliner.SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + aOutliner.SetRefDevice(SdModule::get()->GetVirtualRefDevice()); aOutliner.SetDefTab( mpDoc->GetDefaultTabulator() ); aOutliner.SetStyleSheetPool(static_cast(mpDoc->GetStyleSheetPool())); diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 693ae65f14c4..c2f9d7ea1022 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -492,7 +492,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr pDlg( - pFact->CreateInsertObjectDialog( mpViewShell->GetFrameWeld(), SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand(), + pFact->CreateInsertObjectDialog( mpViewShell->GetFrameWeld(), SdModule::get()->GetSlotPool()->GetSlot(nSlotId)->GetCommand(), xStorage, &aServerLst )); pDlg->Execute(); bCreateNew = pDlg->IsCreateNew(); diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 46253dad1467..639c9845ba14 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -425,7 +425,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) SdOutliner aOutliner( mpDoc, OutlinerMode::TextObject ); // set reference device - aOutliner.SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + aOutliner.SetRefDevice(SdModule::get()->GetVirtualRefDevice()); SdPage* pPage = static_cast(mpViewShell)->GetActualPage(); aLayoutName = pPage->GetLayoutName(); @@ -577,7 +577,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) aOutliner.SetStyleSheetPool(static_cast(mpDoc->GetStyleSheetPool())); // set reference device - aOutliner.SetRefDevice(SD_MOD()->GetVirtualRefDevice()); + aOutliner.SetRefDevice(SdModule::get()->GetVirtualRefDevice()); aOutliner.SetPaperSize(Size(0x7fffffff, 0x7fffffff)); SvStream* pStream = pMedium->GetInStream(); diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index efc1c6ea262d..bc2da0ced224 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -128,7 +128,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) { pHdl = nullptr; bool bReturn = FuDraw::MouseButtonDown(rMEvt); - bool bWaterCan = SD_MOD()->GetWaterCan(); + bool bWaterCan = SdModule::get()->GetWaterCan(); const bool bReadOnly = mpDocSh->IsReadOnly(); // When the right mouse button is pressed then only select objects // (and deselect others) as a preparation for showing the context @@ -801,7 +801,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) mpView->EndAction(); } - if( SD_MOD()->GetWaterCan() ) + if (SdModule::get()->GetWaterCan()) { if( rMEvt.IsRight() ) { diff --git a/sd/source/ui/func/fusldlg.cxx b/sd/source/ui/func/fusldlg.cxx index 3ce1814c92b2..95df1ad81c42 100644 --- a/sd/source/ui/func/fusldlg.cxx +++ b/sd/source/ui/func/fusldlg.cxx @@ -104,7 +104,7 @@ void FuSlideShowDlg::DoExecute( SfxRequest& ) aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) ); aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_INTERACTIVE, rPresentationSettings.mbInteractive ) ); - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) ); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); diff --git a/sd/source/ui/func/fusumry.cxx b/sd/source/ui/func/fusumry.cxx index 9b160099cba0..1c916e238842 100644 --- a/sd/source/ui/func/fusumry.cxx +++ b/sd/source/ui/func/fusumry.cxx @@ -164,7 +164,7 @@ void FuSummaryPage::DoExecute( SfxRequest& ) pOutl->EnableUndo(false); if (mpDocSh) - pOutl->SetRefDevice(SD_MOD()->GetVirtualRefDevice()); + pOutl->SetRefDevice(SdModule::get()->GetVirtualRefDevice()); pOutl->SetDefTab( mpDoc->GetDefaultTabulator() ); pOutl->SetStyleSheetPool(static_cast(mpDoc->GetStyleSheetPool())); diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx index d670c706f182..07580a6cef03 100644 --- a/sd/source/ui/func/futempl.cxx +++ b/sd/source/ui/func/futempl.cxx @@ -250,12 +250,12 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) case SID_STYLE_WATERCAN: { - if( !SD_MOD()->GetWaterCan() ) + if (SdModule* mod = SdModule::get(); !mod->GetWaterCan()) { if (pArgs && pArgs->GetItemState( nSId ) == SfxItemState::SET) { aStyleName = static_cast( pArgs->Get( nSId ) ).GetValue(); - SD_MOD()->SetWaterCan( true ); + mod->SetWaterCan(true); pStyleSheet = pSSPool->Find( aStyleName, nFamily); } // no presentation object templates, they are only allowed implicitly @@ -269,11 +269,11 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) } else - SD_MOD()->SetWaterCan( false ); + mod->SetWaterCan(false); } else { - SD_MOD()->SetWaterCan( false ); + mod->SetWaterCan(false); // we have to re-enable to tools-bar mpViewShell->Invalidate(); } diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 83e73e2ea4e8..4f0545fbf83e 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -558,7 +558,7 @@ void LayoutMenu::Clear() void LayoutMenu::ShowContextMenu(const Point* pPos) { - if (SD_MOD()->GetWaterCan()) + if (SdModule::get()->GetWaterCan()) return; // Determine the position where to show the menu. diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index 047fa95c27f9..49cb4f489bf5 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -519,7 +519,7 @@ void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const { bIllegalArgument = false; - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); pOptions->SetDisplay( nDisplay ); FullScreenWorkWindow *pWin = dynamic_cast(GetWorkWindow()); @@ -598,7 +598,7 @@ Any SAL_CALL SlideShow::getPropertyValue( const OUString& PropertyName ) return Any( rPresSettings.mbShowPauseLogo ); case ATTR_PRESENT_DISPLAY: { - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); return Any(pOptions->GetDisplay()); } @@ -1216,7 +1216,7 @@ sal_Int32 SlideShow::GetDisplay() { sal_Int32 nDisplay = 0; - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); if( pOptions ) nDisplay = pOptions->GetDisplay(); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 8562688be5a7..d8a8eccf5cdc 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -601,7 +601,7 @@ SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation, mbUsePen = maPresSettings.mbMouseAsPen; - SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); + SdOptions* pOptions = SdModule::get()->GetSdOptions(DocumentType::Impress); if( pOptions ) { mnUserPaintColor = pOptions->GetPresentationPenColor(); @@ -620,7 +620,7 @@ SlideshowImpl::~SlideshowImpl() if (nullptr != mpDoc) EndListening(*mpDoc); - SdModule *pModule = SD_MOD(); + SdModule* pModule = SdModule::get(); //rhbz#806663 SlideshowImpl can outlive SdModule SdOptions* pOptions = pModule ? pModule->GetSdOptions(DocumentType::Impress) : nullptr; @@ -1195,7 +1195,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx const * pPresSettings ) beans::PropertyState_DIRECT_VALUE ); const bool bZOrderEnabled( - SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsSlideshowRespectZOrder() ); + SdModule::get()->GetSdOptions( mpDoc->GetDocumentType() )->IsSlideshowRespectZOrder() ); aProperties.emplace_back( "DisableAnimationZOrder" , -1, Any( !bZOrderEnabled ), beans::PropertyState_DIRECT_VALUE ); diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index 43c8ec30ee3a..ad1d84bc1564 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -318,7 +318,7 @@ bool SlideSorterController::Command ( // indicator so that the user knows where a page insertion // would take place. mpInsertionIndicatorHandler->Start(false); - mpInsertionIndicatorHandler->UpdateIndicatorIcon(SD_MOD()->pTransferClip); + mpInsertionIndicatorHandler->UpdateIndicatorIcon(SdModule::get()->pTransferClip); mpInsertionIndicatorHandler->UpdatePosition( pWindow->PixelToLogic(rEvent.GetMousePosPixel()), InsertionIndicatorHandler::MoveMode); diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index 90fa0b7d7399..2c0b81bde2b2 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -227,7 +227,7 @@ void Clipboard::DoCopy () void Clipboard::DoPaste () { - SdTransferable* pClipTransferable = SD_MOD()->pTransferClip; + SdTransferable* pClipTransferable = SdModule::get()->pTransferClip; if (pClipTransferable==nullptr || !pClipTransferable->IsPageTransferable()) return; @@ -288,7 +288,7 @@ sal_Int32 Clipboard::GetInsertionPosition () sal_Int32 Clipboard::PasteTransferable (sal_Int32 nInsertPosition) { - SdTransferable* pClipTransferable = SD_MOD()->pTransferClip; + SdTransferable* pClipTransferable = SdModule::get()->pTransferClip; model::SlideSorterModel& rModel (mrSlideSorter.GetModel()); bool bMergeMasterPages = !pClipTransferable->HasSourceDoc (rModel.GetDocument()); sal_uInt16 nInsertIndex (rModel.GetCoreIndex(nInsertPosition)); @@ -432,9 +432,9 @@ void Clipboard::CreateSlideTransferable ( std::move(aRepresentatives)); if (bDrag) - SD_MOD()->pTransferDrag = pTransferable.get(); + SdModule::get()->pTransferDrag = pTransferable.get(); else - SD_MOD()->pTransferClip = pTransferable.get(); + SdModule::get()->pTransferClip = pTransferable.get(); pDocument->CreatingDataObj (pTransferable.get()); pTransferable->SetWorkDocument(pDocument->AllocSdDrawDocument()); @@ -631,7 +631,7 @@ sal_Int8 Clipboard::AcceptDrop ( // Use the copy action when the drop action is the default, i.e. not // explicitly set to move or link, and when the source and // target models are not the same. - SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + SdTransferable* pDragTransferable = SdModule::get()->pTransferDrag; if (pDragTransferable != nullptr && pDragTransferable->IsPageTransferable() && ((rEvent.maDragEvent.DropAction @@ -693,7 +693,7 @@ sal_Int8 Clipboard::ExecuteDrop ( case DT_PAGE: case DT_PAGE_FROM_NAVIGATOR: { - SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + SdTransferable* pDragTransferable = SdModule::get()->pTransferDrag; const Point aEventModelPosition ( pTargetWindow->PixelToLogic (rEvent.maPosPixel)); const sal_Int32 nXOffset (std::abs (pDragTransferable->GetStartPos().X() @@ -829,7 +829,7 @@ sal_uInt16 Clipboard::DetermineInsertPosition () Clipboard::DropType Clipboard::IsDropAccepted() const { - const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + const SdTransferable* pDragTransferable = SdModule::get()->pTransferDrag; if (pDragTransferable == nullptr) return DT_NONE; diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx index b635accc5535..248db2656a38 100644 --- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx +++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx @@ -44,7 +44,7 @@ DragAndDropContext::DragAndDropContext (SlideSorter& rSlideSorter) // For properly handling transferables created by the navigator we // need additional information. For this a user data object is // created that contains the necessary information. - SdTransferable* pTransferable = SD_MOD()->pTransferDrag; + SdTransferable* pTransferable = SdModule::get()->pTransferDrag; SdPageObjsTLV::SdPageObjsTransferable* pTreeListBoxTransferable = dynamic_cast(pTransferable); if (pTreeListBoxTransferable!=nullptr && !TransferableData::GetFromTransferable(pTransferable)) diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index af09253db8d1..902f02cd303f 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -941,7 +941,7 @@ void SelectionFunction::ModeHandler::StartDrag ( // modifier key can trigger a MouseMotion event in the originating // window (focus still in there). Together with the mouse button pressed // (drag-and-drop is active) this triggers the start of drag-and-drop.) - if (SD_MOD()->pTransferDrag != nullptr) + if (SdModule::get()->pTransferDrag != nullptr) return; mrSelectionFunction.SwitchToDragAndDropMode(rMousePosition); @@ -1389,14 +1389,15 @@ DragAndDropModeHandler::DragAndDropModeHandler ( vcl::Window* pWindow) : ModeHandler(rSlideSorter, rSelectionFunction, false) { - SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + SdModule* mod = SdModule::get(); + SdTransferable* pDragTransferable = mod->pTransferDrag; if (pDragTransferable==nullptr && mrSlideSorter.GetViewShell() != nullptr) { SlideSorterViewShell* pSlideSorterViewShell = dynamic_cast(mrSlideSorter.GetViewShell()); if (pSlideSorterViewShell != nullptr) pSlideSorterViewShell->StartDrag(rMousePosition, pWindow); - pDragTransferable = SD_MOD()->pTransferDrag; + pDragTransferable = mod->pTransferDrag; } mpDragAndDropContext.reset(new DragAndDropContext(mrSlideSorter)); diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 7eeb776af914..17482e36957f 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -366,7 +366,7 @@ void SlotManager::FuSupport (SfxRequest& rRequest) case SID_PASTE: { - SdTransferable* pTransferClip = SD_MOD()->pTransferClip; + SdTransferable* pTransferClip = SdModule::get()->pTransferClip; if( pTransferClip ) { SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell().get(); @@ -697,7 +697,7 @@ void SlotManager::GetMenuState (SfxItemSet& rSet) void SlotManager::GetClipboardState ( SfxItemSet& rSet) { - SdTransferable* pTransferClip = SD_MOD()->pTransferClip; + SdTransferable* pTransferClip = SdModule::get()->pTransferClip; if (rSet.GetItemState(SID_PASTE) == SfxItemState::DEFAULT || rSet.GetItemState(SID_PASTE_SPECIAL) == SfxItemState::DEFAULT) diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index 5670ffb1fd86..943744da15dc 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -254,7 +254,7 @@ void DrawViewShell::GetTableMenuState( SfxItemSet &rSet ) if( ( !aActiveLayer.isEmpty() && pPV && ( pPV->IsLayerLocked(aActiveLayer) || !pPV->IsLayerVisible(aActiveLayer) ) ) || - SD_MOD()->GetWaterCan() ) + SdModule::get()->GetWaterCan() ) { rSet.DisableItem( SID_INSERT_TABLE ); } diff --git a/sd/source/ui/table/tableobjectbar.cxx b/sd/source/ui/table/tableobjectbar.cxx index 2f60f0882376..9f460238b042 100644 --- a/sd/source/ui/table/tableobjectbar.cxx +++ b/sd/source/ui/table/tableobjectbar.cxx @@ -130,7 +130,7 @@ void TableObjectBar::Execute( SfxRequest& rReq ) vcl::Window* pWin = mpView->GetViewShell()->GetParentWindow(); VclPtr pDlg( pFact->CreateSvxInsRowColDlg(pWin ? pWin->GetFrameWeld() : nullptr, nSlotId == SID_TABLE_INSERT_COL_DLG, - SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) ); + SdModule::get()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) ); pDlg->StartExecuteAsync( [pDlg, xRequest=std::move(xRequest), nSlotId, xController, pBindings] (sal_Int32 nResult) mutable ->void { diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index cc610d2dd36c..41ff0b6c27db 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -430,7 +430,7 @@ DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries, } else { - aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) ); + aOptionsPrintItem.SetOptions(SdModule::get()->GetSdOptions(pDoc->GetDocumentType())); } SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint(); @@ -1104,7 +1104,7 @@ DocumentSettings::_getPropertyValues( } else { - aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) ); + aOptionsPrintItem.SetOptions(SdModule::get()->GetSdOptions(pDoc->GetDocumentType())); } SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint(); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 182988f1d62b..ecc9c0fb9645 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3975,7 +3975,7 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::SequenceGetSdOptions(mpDoc->GetDocumentType()); + SdOptions* pOptions = SdModule::get()->GetSdOptions(mpDoc->GetDocumentType()); pOptions->SetShowComments(comphelper::LibreOfficeKit::isTiledAnnotations()); pViewShell->SetRuler(false); diff --git a/sd/source/ui/unoidl/unomodule.cxx b/sd/source/ui/unoidl/unomodule.cxx index 571bca850472..743ccd62b097 100644 --- a/sd/source/ui/unoidl/unomodule.cxx +++ b/sd/source/ui/unoidl/unomodule.cxx @@ -40,15 +40,16 @@ void SAL_CALL SdUnoModule::dispatchWithNotification( const util::URL& aURL, cons SolarMutexGuard aGuard; SdDLL::Init(); - const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete ); + SdModule* mod = SdModule::get(); + const SfxSlot* pSlot = mod->GetInterface()->GetSlot( aURL.Complete ); sal_Int16 aState = frame::DispatchResultState::DONTKNOW; if ( !pSlot ) aState = frame::DispatchResultState::FAILURE; else { - SfxRequest aReq( pSlot, aArgs, SfxCallMode::SYNCHRON, SD_MOD()->GetPool() ); - const SfxPoolItemHolder aResult(SD_MOD()->ExecuteSlot(aReq)); + SfxRequest aReq( pSlot, aArgs, SfxCallMode::SYNCHRON, mod->GetPool() ); + const SfxPoolItemHolder aResult(mod->ExecuteSlot(aReq)); if (aResult) aState = frame::DispatchResultState::SUCCESS; else @@ -93,7 +94,7 @@ uno::Reference< frame::XDispatch > SAL_CALL SdUnoModule::queryDispatch( const ut { SolarMutexGuard aGuard; SdDLL::Init(); - const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete ); + const SfxSlot* pSlot = SdModule::get()->GetInterface()->GetSlot(aURL.Complete); uno::Reference< frame::XDispatch > xSlot; if ( pSlot ) diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 39e81fdc2c49..49633f61bc30 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -307,7 +307,7 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes() { SdrObjKind nObjId = mpShape->getShapeKind(); uno::Sequence< uno::Type > aTypes; - SdTypesCache& gImplTypesCache = SD_MOD()->gImplTypesCache; + SdTypesCache& gImplTypesCache = SdModule::get()->gImplTypesCache; SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) ); if( aIter == gImplTypesCache.end() ) { @@ -382,7 +382,7 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL SdXShape::getProper css::uno::Reference pInfo; SdExtPropertySetInfoCache& rCache = (mpModel && mpModel->IsImpressDocument()) ? - SD_MOD()->gImplImpressPropertySetInfoCache : SD_MOD()->gImplDrawPropertySetInfoCache; + SdModule::get()->gImplImpressPropertySetInfoCache : SdModule::get()->gImplDrawPropertySetInfoCache; SdExtPropertySetInfoCache::iterator aIter( rCache.find( nObjId ) ); if( aIter == rCache.end() ) diff --git a/sd/source/ui/view/NotesPanelView.cxx b/sd/source/ui/view/NotesPanelView.cxx index 037fb0809cf5..42562275b70f 100644 --- a/sd/source/ui/view/NotesPanelView.cxx +++ b/sd/source/ui/view/NotesPanelView.cxx @@ -41,7 +41,7 @@ NotesPanelView::NotesPanelView(DrawDocShell& rDocSh, vcl::Window* pWindow, aModifyIdle.SetPriority(TaskPriority::LOWEST); maOutliner.Init(OutlinerMode::OutlineView); - maOutliner.SetRefDevice(SD_MOD()->GetVirtualRefDevice()); + maOutliner.SetRefDevice(SdModule::get()->GetVirtualRefDevice()); maOutliner.SetPaperSize(mrNotesPanelViewShell.GetActiveWindow()->GetViewSize()); maOutlinerView.SetOutputArea( diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx b/sd/source/ui/view/NotesPanelViewShell.cxx index 5a5c9ec1407b..e2fadf2a2c5c 100644 --- a/sd/source/ui/view/NotesPanelViewShell.cxx +++ b/sd/source/ui/view/NotesPanelViewShell.cxx @@ -1362,7 +1362,7 @@ void NotesPanelViewShell::Execute(SfxRequest& rReq) { const SvxSearchItem& rSearchItem = pReqArgs->Get(SID_SEARCH_ITEM); - SD_MOD()->SetSearchItem( + SdModule::get()->SetSearchItem( std::unique_ptr(rSearchItem.Clone())); xFuSearch->SearchAndReplace(&rSearchItem); } diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 9ebadaca1026..d25744a4926e 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -185,7 +185,7 @@ SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode ) { SetStyleSheetPool(static_cast( mpDrawDocument->GetStyleSheetPool() )); SetEditTextObjectPool( &pDoc->GetItemPool() ); - SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); + SetCalcFieldValueHdl(LINK(SdModule::get(), SdModule, CalcFieldValueHdl)); SetForbiddenCharsTable( pDoc->GetForbiddenCharsTable() ); EEControlBits nCntrl = GetControlWord(); @@ -272,7 +272,7 @@ void SdOutliner::PrepareSpelling() sd::ViewShellBase* pBase = getViewShellBase(); if (pBase != nullptr) SetViewShell (pBase->GetMainViewShell()); - SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + SetRefDevice(SdModule::get()->GetVirtualRefDevice()); std::shared_ptr pViewShell (mpWeakViewShell.lock()); if (pViewShell) @@ -1970,7 +1970,7 @@ void SdOutliner::PrepareConversion() void SdOutliner::BeginConversion() { - SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + SetRefDevice(SdModule::get()->GetVirtualRefDevice()); sd::ViewShellBase* pBase = getViewShellBase(); if (pBase != nullptr) diff --git a/sd/source/ui/view/ViewClipboard.cxx b/sd/source/ui/view/ViewClipboard.cxx index c17bf7de1f01..89cf897eaae9 100644 --- a/sd/source/ui/view/ViewClipboard.cxx +++ b/sd/source/ui/view/ViewClipboard.cxx @@ -222,7 +222,7 @@ sal_uInt16 ViewClipboard::InsertSlides ( false, false, nInsertPosition, - (&rTransferable == SD_MOD()->pTransferDrag), + (&rTransferable == SdModule::get()->pTransferDrag), pDataDocSh, true, bMergeMasterPages, diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 15f1a51f1e8b..37d32df82f0f 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -368,7 +368,7 @@ void ViewShellBase::LateInit (const OUString& rsDefaultView) pFrameView->SetViewShellTypeOnLoad(pViewShell->GetShellType()); } // Show/Hide the TabBar - SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDocument()->GetDocumentType()); + SdOptions* pOptions = SdModule::get()->GetSdOptions(GetDocument()->GetDocumentType()); bool bIsTabBarVisible = pOptions->IsTabBarVisible(); mpImpl->SetUserWantsTabBar( bIsTabBarVisible ); } @@ -648,7 +648,7 @@ void ViewShellBase::Execute (SfxRequest& rRequest) case SID_TOGGLE_TABBAR_VISIBILITY: { - SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDocument()->GetDocumentType()); + SdOptions* pOptions = SdModule::get()->GetSdOptions(GetDocument()->GetDocumentType()); bool bIsTabBarVisible = pOptions->IsTabBarVisible(); pOptions->SetTabBarVisible( !bIsTabBarVisible ); mpImpl->SetUserWantsTabBar( !bIsTabBarVisible ); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 4faf8b632be7..d67963b2a823 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1914,7 +1914,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = GetActiveWindow(); ScopedVclPtr pDlg( pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, true, SdResId(STR_INSERTLAYER)) ); - pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() ); + pDlg->SetHelpId( SdModule::get()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() ); // test for already existing names bool bLoop = true; @@ -2067,7 +2067,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = GetActiveWindow(); ScopedVclPtr pDlg( pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, bDelete, SdResId(STR_MODIFYLAYER)) ); - pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() ); + pDlg->SetHelpId( SdModule::get()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() ); // test for already existing names bool bLoop = true; diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 3611af691081..6652f8d64e9c 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -558,7 +558,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) } } else if( rCEvt.GetCommand() == CommandEventId::ContextMenu && !bNativeShow && - pWin != nullptr && !mpDrawView->IsAction() && !SD_MOD()->GetWaterCan() ) + pWin != nullptr && !mpDrawView->IsAction() && !SdModule::get()->GetWaterCan() ) { OUString aPopupId; // Resource name for popup menu diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 3488bc9bc6ff..118c8971d917 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -136,7 +136,7 @@ void DrawViewShell::ReadFrameViewData(FrameView* pView) // this option has to be adjust at the model GetDoc()->SetPickThroughTransparentTextFrames( - SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough()); + SdModule::get()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough()); // initialization of the Character-(Screen-) attribute if (HasRuler() != pView->HasRuler()) diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 753c34b01e4e..8bb8748e2e36 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1064,7 +1064,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) if ( ( !aActiveLayer.isEmpty() && pPV && ( pPV->IsLayerLocked(aActiveLayer) || !pPV->IsLayerVisible(aActiveLayer) ) ) || - SD_MOD()->GetWaterCan() ) + SdModule::get()->GetWaterCan() ) { rSet.DisableItem( SID_PASTE ); rSet.DisableItem( SID_PASTE_SPECIAL ); diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 2779e27f7adc..78e86ff87e8a 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -132,8 +132,9 @@ DrawViewShell::DrawViewShell( ViewShellBase& rViewShellBase, vcl::Window* pParen doShow(); ConfigureAppBackgroundColor(); - SD_MOD()->GetColorConfig().AddListener(this); - maViewOptions.mnDocBackgroundColor = SD_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + SdModule* mod = SdModule::get(); + mod->GetColorConfig().AddListener(this); + maViewOptions.mnDocBackgroundColor = mod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; if (comphelper::LibreOfficeKit::isActive()) { @@ -162,7 +163,7 @@ void DrawViewShell::ImplDestroy() { destroyXSlideShowInstance(); - SD_MOD()->GetColorConfig().RemoveListener(this); + SdModule::get()->GetColorConfig().RemoveListener(this); mpSelectionChangeHandler->Disconnect(); diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index a096b31da543..b68d3e09cfdf 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -618,7 +618,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) return; // get SdOptions - SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); + SdOptions* pOptions = SdModule::get()->GetSdOptions(GetDoc()->GetDocumentType()); sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth()); sal_uInt32 nDefaultObjectSizeHeight(pOptions->GetDefaultObjectSizeHeight()); diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 037207137c75..0d9286ffcc62 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -545,7 +545,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) rSet.Put(SfxBoolItem(nWhich,false)); else { - SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan()); + SfxBoolItem aItem(nWhich, SdModule::get()->GetWaterCan()); aAllSet.Put( aItem ); } } diff --git a/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx index 1e156f3df0fa..c0e71e05ad7e 100644 --- a/sd/source/ui/view/drviewsg.cxx +++ b/sd/source/ui/view/drviewsg.cxx @@ -105,7 +105,7 @@ void DrawViewShell::ExecOptionsBar( SfxRequest& rReq ) bool bDefault = false; sal_uInt16 nSlot = rReq.GetSlot(); - SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); + SdOptions* pOptions = SdModule::get()->GetSdOptions(GetDoc()->GetDocumentType()); std::shared_ptr batch( comphelper::ConfigurationChanges::create()); diff --git a/sd/source/ui/view/drviewsk.cxx b/sd/source/ui/view/drviewsk.cxx index 1aaa2039ffd6..54cb0ac55aca 100644 --- a/sd/source/ui/view/drviewsk.cxx +++ b/sd/source/ui/view/drviewsk.cxx @@ -53,7 +53,7 @@ void DrawViewShell::ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, Co void DrawViewShell::ConfigureAppBackgroundColor( svtools::ColorConfig *pColorConfig ) { if (!pColorConfig) - pColorConfig = &SD_MOD()->GetColorConfig(); + pColorConfig = &SdModule::get()->GetColorConfig(); Color aFillColor( pColorConfig->GetColorValue( svtools::APPBACKGROUND ).nColor ); if (comphelper::LibreOfficeKit::isActive()) aFillColor = COL_TRANSPARENT; diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index 3fc4c4089085..54b84a5f550f 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -246,7 +246,7 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULL * bInitDesignMode = false; SetDesignMode( bInitDesignMode ); - Update( SD_MOD()->GetSdOptions(pDrawDoc->GetDocumentType()) ); + Update(SdModule::get()->GetSdOptions(pDrawDoc->GetDocumentType())); } } diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 0fa6402f1a04..15fad231a696 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -87,7 +87,7 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie // initialize Outliner: set Reference Device bInitOutliner = true; mrOutliner.Init( OutlinerMode::OutlineView ); - mrOutliner.SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + mrOutliner.SetRefDevice(SdModule::get()->GetVirtualRefDevice()); //viewsize without the width of the image and number in front mnPaperWidth = (mrOutlineViewShell.GetActiveWindow()->GetViewSize().Width() - 4000); mrOutliner.SetPaperSize(Size(mnPaperWidth, 400000000)); diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 189d3050bbf8..5a6be3034fb8 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -675,7 +675,7 @@ bool View::SdrBeginTextEdit( if( pOutl ) { pOutl->SetStyleSheetPool(static_cast( mrDoc.GetStyleSheetPool() )); - pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); + pOutl->SetCalcFieldValueHdl(LINK(SdModule::get(), SdModule, CalcFieldValueHdl)); EEControlBits nCntrl = pOutl->GetControlWord(); nCntrl |= EEControlBits::ALLOWBIGOBJS; nCntrl |= EEControlBits::MARKFIELDS; diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index b2f58cfcfffd..fd4abde21279 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -83,7 +83,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat // dynamically created object is destroyed automatically rtl::Reference pTransferable = new SdTransferable( &mrDoc, nullptr, false ); - SD_MOD()->pTransferClip = pTransferable.get(); + SdModule::get()->pTransferClip = pTransferable.get(); mrDoc.CreatingDataObj( pTransferable.get() ); pTransferable->SetWorkDocument( static_cast(CreateMarkedObjModel().release()) ); @@ -145,7 +145,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObje { rtl::Reference pTransferable = new SdTransferable( &mrDoc, pWorkView, false ); - SD_MOD()->pTransferDrag = pTransferable.get(); + SdModule::get()->pTransferDrag = pTransferable.get(); std::unique_ptr pObjDesc(new TransferableObjectDescriptor); OUString aDisplayName; @@ -196,7 +196,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateSelectionDat std::unique_ptr pObjDesc(new TransferableObjectDescriptor); const ::tools::Rectangle aMarkRect( GetAllMarkedRect() ); - SD_MOD()->pTransferSelection = pTransferable.get(); + SdModule::get()->pTransferSelection = pTransferable.get(); if( mpDocSh ) { @@ -232,10 +232,11 @@ void View::ClearSelectionClipboard() // true case return; if (!mpViewSh->GetActiveWindow()) return; - if (SD_MOD()->pTransferSelection && SD_MOD()->pTransferSelection->GetView() == this) + SdModule* mod = SdModule::get(); + if (mod->pTransferSelection && mod->pTransferSelection->GetView() == this) { TransferableHelper::ClearPrimarySelection(); - SD_MOD()->pTransferSelection = nullptr; + mod->pTransferSelection = nullptr; } } @@ -378,7 +379,7 @@ void View::DragFinished( sal_Int8 nDropAction ) BegUndo(aStr + " " + mpDragSrcMarkList->GetMarkDescription()); } - SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + SdTransferable* pDragTransferable = SdModule::get()->pTransferDrag; if( pDragTransferable ) pDragTransferable->SetView( nullptr ); @@ -473,7 +474,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge if( !bIsInsideOutlinerView ) { - SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + SdTransferable* pDragTransferable = SdModule::get()->pTransferDrag; if(pDragTransferable && (nDropAction & DND_ACTION_LINK)) { diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 4f7a52b0a9c3..c16f92b7349c 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -300,15 +300,16 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, // try to get own transfer data if( pImplementation ) { - if( SD_MOD()->pTransferClip == pImplementation ) - pOwnData = SD_MOD()->pTransferClip; - else if( SD_MOD()->pTransferDrag == pImplementation ) + SdModule* mod = SdModule::get(); + if (mod->pTransferClip == pImplementation) + pOwnData = mod->pTransferClip; + else if (mod->pTransferDrag == pImplementation) { - pOwnData = SD_MOD()->pTransferDrag; + pOwnData = mod->pTransferDrag; bSelfDND = true; } - else if( SD_MOD()->pTransferSelection == pImplementation ) - pOwnData = SD_MOD()->pTransferSelection; + else if (mod->pTransferSelection == pImplementation) + pOwnData = mod->pTransferSelection; } const bool bGroupUndoFromDragWithDrop = bSelfDND && mpDragSrcMarkList && IsUndoEnabled(); @@ -467,7 +468,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, // calculate real position of current // source objects, if necessary (#103207) - if( pOwnData == SD_MOD()->pTransferSelection ) + if (pOwnData == SdModule::get()->pTransferSelection) { ::tools::Rectangle aCurBoundRect; diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 261c6aaf7701..6c139827182e 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -383,7 +383,7 @@ void ViewShell::UIDeactivated( SfxInPlaceClient* ) void ViewShell::Deactivate(bool bIsMDIActivate) { // remove view from a still active drag'n'drop session - SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + SdTransferable* pDragTransferable = SdModule::get()->pTransferDrag; if (IsMainViewShell()) GetDocSh()->Disconnect(this); From f9cac88fc24539eb5f7fa501b2499ddf5a46d7f2 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 20 Nov 2024 21:32:16 +0500 Subject: [PATCH 180/373] Let ESelection use EPaM for simplification And drop EPosition, which duplicates EPaM, except for its default ctor (used in a single place). Change-Id: I48bb6dafcba84465d61579df0ec71b815945532a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177075 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- .../main/ChartController_TextEdit.cxx | 3 +- cui/inc/pch/precompiled_cui.hxx | 1 - cui/source/dialogs/SpellDialog.cxx | 22 +- .../source/ui/app/DocumentInfoPreview.cxx | 18 +- dbaccess/source/ui/control/sqledit.cxx | 14 +- editeng/qa/unit/ESelectionTest.cxx | 49 ++-- .../AccessibleEditableTextPara.cxx | 50 ++--- .../accessibility/AccessibleImageBullet.cxx | 2 +- .../AccessibleStaticTextBase.cxx | 52 ++--- editeng/source/editeng/editdbg.cxx | 2 +- editeng/source/editeng/editdoc.cxx | 6 +- editeng/source/editeng/editeng.cxx | 77 +++---- editeng/source/editeng/editobj.cxx | 4 +- editeng/source/editeng/editundo.cxx | 4 +- editeng/source/editeng/editview.cxx | 44 ++-- editeng/source/editeng/edtspell.cxx | 2 +- editeng/source/editeng/eertfpar.cxx | 4 +- editeng/source/editeng/impedit.cxx | 83 ++++--- editeng/source/editeng/impedit.hxx | 26 +-- editeng/source/editeng/impedit2.cxx | 49 ++-- editeng/source/editeng/impedit3.cxx | 10 +- editeng/source/editeng/impedit4.cxx | 4 +- editeng/source/editeng/impedit5.cxx | 3 +- editeng/source/editeng/textconv.cxx | 38 ++-- editeng/source/misc/urlfieldhelper.cxx | 7 +- editeng/source/outliner/outlin2.cxx | 6 +- editeng/source/outliner/outliner.cxx | 10 +- editeng/source/outliner/outlobj.cxx | 4 +- editeng/source/outliner/outlvw.cxx | 102 ++++----- editeng/source/outliner/overflowingtxt.cxx | 8 +- editeng/source/outliner/paralist.cxx | 8 +- editeng/source/uno/unoedhlp.cxx | 2 +- editeng/source/uno/unoedprx.cxx | 66 +++--- editeng/source/uno/unofored.cxx | 30 +-- editeng/source/uno/unoforou.cxx | 24 +- editeng/source/uno/unotext.cxx | 172 ++++++-------- editeng/source/uno/unotext2.cxx | 29 ++- editeng/source/xml/xmltxtimp.cxx | 18 +- filter/source/msfilter/msdffimp.cxx | 6 +- filter/source/msfilter/svdfppt.cxx | 23 +- forms/source/richtext/specialdispatchers.cxx | 7 +- include/editeng/EPaM.hxx | 20 +- include/editeng/EPosition.hxx | 49 ---- include/editeng/ESelection.hxx | 94 +++----- include/editeng/editdata.hxx | 19 +- include/editeng/editeng.hxx | 8 +- include/editeng/outliner.hxx | 8 +- sc/qa/extras/scpdfexport.cxx | 7 +- sc/qa/unit/subsequent_export_test.cxx | 21 +- sc/qa/unit/ucalc.cxx | 11 +- sc/source/core/data/stlpool.cxx | 10 +- sc/source/core/tool/editutil.cxx | 3 +- sc/source/filter/excel/xehelper.cxx | 16 +- sc/source/filter/excel/xicontent.cxx | 4 +- sc/source/filter/excel/xihelper.cxx | 30 ++- sc/source/filter/html/htmlpars.cxx | 63 +++--- sc/source/filter/oox/richstring.cxx | 11 +- sc/source/filter/orcus/interface.cxx | 5 +- sc/source/filter/rtf/eeimpars.cxx | 10 +- sc/source/filter/rtf/rtfparse.cxx | 20 +- sc/source/filter/xml/xmlcelli.cxx | 13 +- sc/source/filter/xml/xmlexprt.cxx | 2 +- sc/source/ui/app/inputhdl.cxx | 212 ++++++++---------- sc/source/ui/app/inputwin.cxx | 7 +- sc/source/ui/docshell/docsh4.cxx | 4 +- sc/source/ui/drawfunc/drtxtob.cxx | 14 +- sc/source/ui/drawfunc/futext.cxx | 3 +- sc/source/ui/formdlg/dwfunctr.cxx | 2 +- sc/source/ui/pagedlg/scuitphfedit.cxx | 52 ++--- sc/source/ui/unoobj/cellsuno.cxx | 9 +- sc/source/ui/unoobj/fielduno.cxx | 27 ++- sc/source/ui/unoobj/textuno.cxx | 27 +-- sc/source/ui/view/cellsh1.cxx | 4 +- sc/source/ui/view/editsh.cxx | 30 +-- sc/source/ui/view/gridwin.cxx | 6 +- sc/source/ui/view/tabvwshe.cxx | 4 +- sc/source/ui/view/viewfun4.cxx | 6 +- sd/qa/unit/TextFittingTest.cxx | 6 +- sd/qa/unit/tiledrendering/tiledrendering.cxx | 10 +- sd/qa/unit/uiimpress.cxx | 2 +- .../ui/annotations/annotationmanager.cxx | 6 +- sd/source/ui/annotations/annotationwindow.cxx | 5 +- sd/source/ui/dlg/headerfooterdlg.cxx | 2 +- sd/source/ui/docshell/docshel3.cxx | 4 +- sd/source/ui/func/fubullet.cxx | 6 +- sd/source/ui/func/fuinsfil.cxx | 3 +- sd/source/ui/func/fuparagr.cxx | 8 +- sd/source/ui/func/futext.cxx | 9 +- sd/source/ui/unoidl/unosrch.cxx | 20 +- sd/source/ui/view/NotesPanelViewShell.cxx | 20 +- sd/source/ui/view/Outliner.cxx | 18 +- sd/source/ui/view/drtxtob.cxx | 4 +- sd/source/ui/view/drtxtob1.cxx | 16 +- sd/source/ui/view/drviews2.cxx | 24 +- sd/source/ui/view/drviews4.cxx | 8 +- sd/source/ui/view/drviews7.cxx | 4 +- sd/source/ui/view/drviewse.cxx | 18 +- sd/source/ui/view/drviewsf.cxx | 2 +- sd/source/ui/view/outlnvs2.cxx | 16 +- sd/source/ui/view/outlnvsh.cxx | 5 +- sd/source/ui/view/sdview2.cxx | 3 +- starmath/inc/mathml/element.hxx | 4 +- starmath/inc/node.hxx | 4 +- starmath/qa/cppunit/test_starmath.cxx | 16 +- starmath/source/cursor.cxx | 2 +- starmath/source/edit.cxx | 64 +++--- starmath/source/node.cxx | 4 +- starmath/source/smediteng.cxx | 6 +- starmath/source/view.cxx | 12 +- .../accessibility/AccessibleTextHelper.cxx | 94 ++++---- svx/source/annotation/TextAPI.cxx | 2 +- svx/source/dialog/ClassificationEditView.cxx | 2 +- svx/source/dialog/weldeditview.cxx | 40 ++-- svx/source/sdr/properties/textproperties.cxx | 10 +- svx/source/svdraw/svdedxv.cxx | 21 +- svx/source/svdraw/svdview.cxx | 15 +- svx/source/svdraw/textchaincursor.cxx | 5 +- svx/source/svdraw/textchainflow.cxx | 4 +- svx/source/table/cell.cxx | 4 +- svx/source/table/tablecontroller.cxx | 2 +- svx/source/table/tablehtmlimporter.cxx | 8 +- svx/source/table/tablertfimporter.cxx | 8 +- .../core/doc/DocumentDrawModelManager.cxx | 4 +- sw/source/filter/ww8/ww8graf.cxx | 6 +- sw/source/ui/dbui/mmaddressblockpage.cxx | 78 +++---- .../dialog/SwSpellDialogChildWindow.cxx | 4 +- sw/source/uibase/docvw/AnnotationWin.cxx | 4 +- sw/source/uibase/docvw/AnnotationWin2.cxx | 3 +- sw/source/uibase/docvw/PostItMgr.cxx | 5 +- sw/source/uibase/docvw/edtwin.cxx | 5 +- sw/source/uibase/shells/annotsh.cxx | 5 +- sw/source/uibase/shells/drwtxtex.cxx | 7 +- sw/source/uibase/shells/drwtxtsh.cxx | 3 +- sw/source/uibase/shells/langhelper.cxx | 6 +- sw/source/uibase/uiview/viewdraw.cxx | 2 +- vcl/inc/pch/precompiled_vcl.hxx | 1 - 136 files changed, 1156 insertions(+), 1443 deletions(-) delete mode 100644 include/editeng/EPosition.hxx diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index bc8e65409130..bfbacd95a90c 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -271,8 +271,7 @@ void ChartController::executeDispatch_InsertSpecialCharacter() pOutlinerView->InsertText(aString, true); ESelection aSel = pOutlinerView->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); pOutlinerView->SetSelection(aSel); // show changes diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx index e007aea1cfa3..d968cc45fb23 100644 --- a/cui/inc/pch/precompiled_cui.hxx +++ b/cui/inc/pch/precompiled_cui.hxx @@ -298,7 +298,6 @@ #include #include #include -#include #include #include #include diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 279ed4c9f4c4..7ee6de654530 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1350,7 +1350,7 @@ bool SentenceEditWindow_Impl::KeyInput(const KeyEvent& rKeyEvt) std::vector aAttribList; m_xEditEngine->GetCharAttribs(0, aAttribList); - auto nCursor = aCurrentSelection.nStartPos; + auto nCursor = aCurrentSelection.start.nIndex; const EECharAttrib* pBackAttr = FindCharAttrib(nCursor, EE_CHAR_BKGCOLOR, aAttribList); const EECharAttrib* pErrorAttr = FindCharAttrib(nCursor, EE_CHAR_GRABBAG, aAttribList); const EECharAttrib* pBackAttrLeft = nullptr; @@ -1361,21 +1361,21 @@ bool SentenceEditWindow_Impl::KeyInput(const KeyEvent& rKeyEvt) if (bHasRange) { if (pBackAttr && - pBackAttr->nStart == aCurrentSelection.nStartPos && - pBackAttr->nEnd == aCurrentSelection.nEndPos) + pBackAttr->nStart == aCurrentSelection.start.nIndex && + pBackAttr->nEnd == aCurrentSelection.end.nIndex) { nSelectionType = FULL; } else if (pErrorAttr && - pErrorAttr->nStart <= aCurrentSelection.nStartPos && - pErrorAttr->nEnd >= aCurrentSelection.nEndPos) + pErrorAttr->nStart <= aCurrentSelection.start.nIndex && + pErrorAttr->nEnd >= aCurrentSelection.end.nIndex) { nSelectionType = INSIDE_YES; } else { nSelectionType = bHasField||bHasError ? BRACE : OUTSIDE_NO; - while (nCursor < aCurrentSelection.nEndPos) + while (nCursor < aCurrentSelection.end.nIndex) { ++nCursor; const EECharAttrib* pIntBackAttr = FindCharAttrib(nCursor, EE_CHAR_BKGCOLOR, aAttribList); @@ -1396,8 +1396,8 @@ bool SentenceEditWindow_Impl::KeyInput(const KeyEvent& rKeyEvt) const EECharAttrib* pCurAttr = pBackAttr ? pBackAttr : pErrorAttr; if (pCurAttr) { - nSelectionType = pCurAttr->nStart == aCurrentSelection.nStartPos ? - LEFT_NO : pCurAttr->nEnd == aCurrentSelection.nEndPos ? RIGHT_NO : INSIDE_NO; + nSelectionType = pCurAttr->nStart == aCurrentSelection.start.nIndex ? + LEFT_NO : pCurAttr->nEnd == aCurrentSelection.end.nIndex ? RIGHT_NO : INSIDE_NO; } else nSelectionType = OUTSIDE_NO; @@ -1747,7 +1747,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, const css void SentenceEditWindow_Impl::MoveErrorMarkTo(sal_Int32 nStart, sal_Int32 nEnd, bool bGrammarError) { - ESelection aAll(0, 0, 0, EE_TEXTPOS_ALL); + ESelection aAll(m_xEditEngine->NormalizeESelection(ESelection::All())); m_xEditEngine->RemoveAttribs(aAll, false, EE_CHAR_COLOR); m_xEditEngine->RemoveAttribs(aAll, false, EE_CHAR_WEIGHT); m_xEditEngine->RemoveAttribs(aAll, false, EE_CHAR_WEIGHT_CJK); @@ -1769,7 +1769,7 @@ void SentenceEditWindow_Impl::MoveErrorMarkTo(sal_Int32 nStart, sal_Int32 nEnd, // unless (tdf#133958) the selection already overlaps this range ESelection aCurrentSelection = m_xEditView->GetSelection(); aCurrentSelection.Adjust(); - bool bCurrentSelectionInRange = nStart <= aCurrentSelection.nEndPos && aCurrentSelection.nStartPos <= nEnd; + bool bCurrentSelectionInRange = nStart <= aCurrentSelection.end.nIndex && aCurrentSelection.start.nIndex <= nEnd; if (!bCurrentSelectionInRange) { m_xEditView->SetSelection(ESelection(0, nStart)); @@ -2160,7 +2160,7 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet) pWidget->set_sensitive(false); //remove error marks - ESelection aAll(0, 0, 0, EE_TEXTPOS_ALL); + ESelection aAll(m_xEditEngine->NormalizeESelection(ESelection::All())); m_xEditEngine->RemoveAttribs(aAll, false, EE_CHAR_COLOR); m_xEditEngine->RemoveAttribs(aAll, false, EE_CHAR_WEIGHT); m_xEditEngine->RemoveAttribs(aAll, false, EE_CHAR_WEIGHT_CJK); diff --git a/dbaccess/source/ui/app/DocumentInfoPreview.cxx b/dbaccess/source/ui/app/DocumentInfoPreview.cxx index f12de3fbe515..890e19eb2dc2 100644 --- a/dbaccess/source/ui/app/DocumentInfoPreview.cxx +++ b/dbaccess/source/ui/app/DocumentInfoPreview.cxx @@ -103,28 +103,18 @@ void ODocumentInfoPreview::fill( } } - m_xEditView->SetSelection(ESelection(0, 0, 0, 0)); -} - -namespace -{ - ESelection InsertAtEnd(const EditEngine& rEditEngine) - { - const sal_uInt32 nPara = rEditEngine.GetParagraphCount() -1; - sal_Int32 nLastLen = rEditEngine.GetText(nPara).getLength(); - return ESelection(nPara, nLastLen, nPara, nLastLen); - } + m_xEditView->SetSelection(ESelection(0, 0)); } void ODocumentInfoPreview::insertEntry( std::u16string_view title, OUString const & value) { if (m_xEditEngine->HasText()) { - m_xEditEngine->QuickInsertText(u"\n\n"_ustr, InsertAtEnd(*m_xEditEngine)); + m_xEditEngine->QuickInsertText(u"\n\n"_ustr, ESelection::AtEnd()); } OUString caption(OUString::Concat(title) + ":\n"); - m_xEditEngine->QuickInsertText(caption, InsertAtEnd(*m_xEditEngine)); + m_xEditEngine->QuickInsertText(caption, ESelection::AtEnd()); SfxItemSet aSet(m_xEditEngine->GetEmptyItemSet()); aSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT)); @@ -133,7 +123,7 @@ void ODocumentInfoPreview::insertEntry( int nCaptionPara = m_xEditEngine->GetParagraphCount() - 2; m_xEditEngine->QuickSetAttribs(aSet, ESelection(nCaptionPara, 0, nCaptionPara, caption.getLength() - 1)); - m_xEditEngine->QuickInsertText(value, InsertAtEnd(*m_xEditEngine)); + m_xEditEngine->QuickInsertText(value, ESelection::AtEnd()); } void ODocumentInfoPreview::insertNonempty(tools::Long id, OUString const & value) diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx index b616f1303ac8..70aa8b23aff2 100644 --- a/dbaccess/source/ui/control/sqledit.cxx +++ b/dbaccess/source/ui/control/sqledit.cxx @@ -203,7 +203,7 @@ void SQLEditView::UpdateData() { OUString aLine( rEditEngine.GetText( nLine ) ); - ESelection aAllLine(nLine, 0, nLine, EE_TEXTPOS_ALL); + ESelection aAllLine(nLine, 0, nLine, EE_TEXTPOS_MAX); rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_COLOR); rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_WEIGHT); rEditEngine.RemoveAttribs(aAllLine, false, EE_CHAR_WEIGHT_CJK); @@ -234,8 +234,8 @@ void SQLEditView::UpdateData() void SQLEditView::DoBracketHilight(sal_uInt16 nKey) { ESelection aCurrentPos = m_xEditView->GetSelection(); - sal_Int32 nStartPos = aCurrentPos.nStartPos; - const sal_uInt32 nStartPara = aCurrentPos.nStartPara; + sal_Int32 nStartPos = aCurrentPos.start.nIndex; + const sal_uInt32 nStartPara = aCurrentPos.start.nPara; sal_uInt16 nCount = 0; int nChar = -1; @@ -294,7 +294,7 @@ void SQLEditView::DoBracketHilight(sal_uInt16 nKey) aSet.Put(SvxWeightItem(WEIGHT_ULTRABOLD, EE_CHAR_WEIGHT_CTL)); m_xEditEngine->QuickSetAttribs(aSet, ESelection(nPara, i, nPara, i + 1)); - m_xEditEngine->QuickSetAttribs(aSet, ESelection(nStartPara, nStartPos, nStartPara, nStartPos)); + m_xEditEngine->QuickSetAttribs(aSet, ESelection(nStartPara, nStartPos)); return; } else @@ -415,11 +415,9 @@ bool SQLEditView::Command(const CommandEvent& rCEvt) pEditView->DeleteSelected(); else if (sCommand == "selectall") { - sal_Int32 nPar = m_xEditEngine->GetParagraphCount(); - if (nPar) + if (m_xEditEngine->GetParagraphCount()) { - sal_Int32 nLen = m_xEditEngine->GetTextLen(nPar - 1); - pEditView->SetSelection(ESelection(0, 0, nPar - 1, nLen)); + pEditView->SetSelection(ESelection::All()); } } else if (sCommand == "specialchar") diff --git a/editeng/qa/unit/ESelectionTest.cxx b/editeng/qa/unit/ESelectionTest.cxx index 27b9256b29d7..264a0aa2c7ac 100644 --- a/editeng/qa/unit/ESelectionTest.cxx +++ b/editeng/qa/unit/ESelectionTest.cxx @@ -20,42 +20,42 @@ CPPUNIT_TEST_FIXTURE(ESelectionTest, testConstruction) { { ESelection aNewSelection; - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aNewSelection.nStartPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aNewSelection.nStartPos); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aNewSelection.nEndPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aNewSelection.nEndPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aNewSelection.start.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aNewSelection.start.nIndex); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aNewSelection.end.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aNewSelection.end.nIndex); } { ESelection aNewSelection(1, 2, 3, 4); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.nStartPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.nStartPos); - CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aNewSelection.nEndPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aNewSelection.nEndPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.start.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.start.nIndex); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aNewSelection.end.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aNewSelection.end.nIndex); } { ESelection aNewSelection = { 1, 2, 3, 4 }; - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.nStartPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.nStartPos); - CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aNewSelection.nEndPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aNewSelection.nEndPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.start.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.start.nIndex); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aNewSelection.end.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aNewSelection.end.nIndex); } { ESelection aNewSelection{ 1, 2, 3, 4 }; - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.nStartPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.nStartPos); - CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aNewSelection.nEndPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aNewSelection.nEndPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.start.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.start.nIndex); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aNewSelection.end.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aNewSelection.end.nIndex); } { ESelection aNewSelection(1, 2); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.nStartPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.nStartPos); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.nEndPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.nEndPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.start.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.start.nIndex); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aNewSelection.end.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aNewSelection.end.nIndex); } } @@ -98,15 +98,6 @@ CPPUNIT_TEST_FIXTURE(ESelectionTest, testEquals) CPPUNIT_ASSERT_EQUAL(aSelection1, aSelection2); } -CPPUNIT_TEST_FIXTURE(ESelectionTest, testIsZero) -{ - ESelection aEmpty; - CPPUNIT_ASSERT_EQUAL(true, aEmpty.IsZero()); - - CPPUNIT_ASSERT_EQUAL(false, ESelection(1, 2, 1, 2).IsZero()); - CPPUNIT_ASSERT_EQUAL(true, ESelection(0, 0, 0, 0).IsZero()); -} - CPPUNIT_TEST_FIXTURE(ESelectionTest, testLess) { // Both equal diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 26bee59e731d..a5c4c3b3bdb3 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -374,35 +374,35 @@ namespace accessibility if( !GetEditViewForwarder().GetSelection( aSelection ) ) return false; - if( aSelection.nStartPara < aSelection.nEndPara ) + if( aSelection.start.nPara < aSelection.end.nPara ) { - if( aSelection.nStartPara > nPara || - aSelection.nEndPara < nPara ) + if( aSelection.start.nPara > nPara || + aSelection.end.nPara < nPara ) return false; - if( nPara == aSelection.nStartPara ) - nStartPos = aSelection.nStartPos; + if( nPara == aSelection.start.nPara ) + nStartPos = aSelection.start.nIndex; else nStartPos = 0; - if( nPara == aSelection.nEndPara ) - nEndPos = aSelection.nEndPos; + if( nPara == aSelection.end.nPara ) + nEndPos = aSelection.end.nIndex; else nEndPos = GetTextLen(); } else { - if( aSelection.nStartPara < nPara || - aSelection.nEndPara > nPara ) + if( aSelection.start.nPara < nPara || + aSelection.end.nPara > nPara ) return false; - if( nPara == aSelection.nStartPara ) - nStartPos = aSelection.nStartPos; + if( nPara == aSelection.start.nPara ) + nStartPos = aSelection.start.nIndex; else nStartPos = GetTextLen(); - if( nPara == aSelection.nEndPara ) - nEndPos = aSelection.nEndPos; + if( nPara == aSelection.end.nPara ) + nEndPos = aSelection.end.nIndex; else nEndPos = 0; } @@ -983,7 +983,7 @@ namespace accessibility EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(GetParagraphIndex()); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType == SVX_NUM_BITMAP ) { @@ -1119,19 +1119,19 @@ namespace accessibility ESelection aSelection; if( GetEditViewForwarder().GetSelection( aSelection ) && - GetParagraphIndex() == aSelection.nEndPara ) + GetParagraphIndex() == aSelection.end.nPara ) { // caret is always nEndPara,nEndPos EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex()); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType != SVX_NUM_BITMAP ) { sal_Int32 nBulletLen = aBulletInfo.aText.getLength(); - if( aSelection.nEndPos - nBulletLen >= 0 ) - return aSelection.nEndPos - nBulletLen; + if( aSelection.end.nIndex - nBulletLen >= 0 ) + return aSelection.end.nIndex - nBulletLen; } - return aSelection.nEndPos; + return aSelection.end.nIndex; } // not within this paragraph @@ -2048,7 +2048,7 @@ namespace accessibility //Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet sal_Int32 nBulletLen = 0; EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex()); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible ) nBulletLen = aBulletInfo.aText.getLength(); // save current selection ESelection aOldSelection; @@ -2091,7 +2091,7 @@ namespace accessibility // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet sal_Int32 nBulletLen = 0; EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex()); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible ) nBulletLen = aBulletInfo.aText.getLength(); ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) ) @@ -2128,7 +2128,7 @@ namespace accessibility // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet sal_Int32 nBulletLen = 0; EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex()); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible ) nBulletLen = aBulletInfo.aText.getLength(); if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) ) return false; // non-editable area selected @@ -2165,7 +2165,7 @@ namespace accessibility // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet sal_Int32 nBulletLen = 0; EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex()); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible ) nBulletLen = aBulletInfo.aText.getLength(); ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); @@ -2206,7 +2206,7 @@ namespace accessibility // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet sal_Int32 nBulletLen = 0; EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex()); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible ) nBulletLen = aBulletInfo.aText.getLength(); if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) ) @@ -2246,7 +2246,7 @@ namespace accessibility // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet sal_Int32 nBulletLen = 0; EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex()); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible ) nBulletLen = aBulletInfo.aText.getLength(); ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx index 5d07e71be0f9..5870e3300c95 100644 --- a/editeng/source/accessibility/AccessibleImageBullet.cxx +++ b/editeng/source/accessibility/AccessibleImageBullet.cxx @@ -231,7 +231,7 @@ namespace accessibility EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( GetParagraphIndex() ); tools::Rectangle aParentRect = rCacheTF.GetParaBounds( GetParagraphIndex() ); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType == SVX_NUM_BITMAP ) { diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx index 7d22150e1503..e318dc4eecba 100644 --- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx +++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx @@ -131,19 +131,19 @@ namespace accessibility AccessibleEditableTextPara& GetParagraph( sal_Int32 nPara ) const; sal_Int32 GetParagraphCount() const; - EPosition Index2Internal( sal_Int32 nFlatIndex ) const + EPaM Index2Internal( sal_Int32 nFlatIndex ) const { return ImpCalcInternal( nFlatIndex, false ); } - EPosition Range2Internal( sal_Int32 nFlatIndex ) const + EPaM Range2Internal( sal_Int32 nFlatIndex ) const { return ImpCalcInternal( nFlatIndex, true ); } - sal_Int32 Internal2Index( EPosition nEEIndex ) const; + sal_Int32 Internal2Index( EPaM nEEIndex ) const; void CorrectTextSegment( TextSegment& aTextSegment, int nPara ) const; @@ -158,7 +158,7 @@ namespace accessibility private: - EPosition ImpCalcInternal( sal_Int32 nFlatIndex, bool bExclusive ) const; + EPaM ImpCalcInternal( sal_Int32 nFlatIndex, bool bExclusive ) const; // our frontend class (the one implementing the actual // interface). That's not necessarily the one containing the impl @@ -233,7 +233,7 @@ namespace accessibility return mxTextParagraph->GetTextForwarder().GetParagraphCount(); } - sal_Int32 AccessibleStaticTextBase_Impl::Internal2Index( EPosition nEEIndex ) const + sal_Int32 AccessibleStaticTextBase_Impl::Internal2Index(EPaM nEEIndex) const { // XXX checks for overflow and returns maximum if so sal_Int32 aRes(0); @@ -268,7 +268,7 @@ namespace accessibility } } - EPosition AccessibleStaticTextBase_Impl::ImpCalcInternal( sal_Int32 nFlatIndex, bool bExclusive ) const + EPaM AccessibleStaticTextBase_Impl::ImpCalcInternal(sal_Int32 nFlatIndex, bool bExclusive) const { if( nFlatIndex < 0 ) @@ -288,7 +288,7 @@ namespace accessibility nFlatIndex - nCurrIndex + nCurrCount >= 0, "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow"); - return EPosition(nCurrPara, nFlatIndex - nCurrIndex + nCurrCount); + return EPaM(nCurrPara, nFlatIndex - nCurrIndex + nCurrCount); } } @@ -300,7 +300,7 @@ namespace accessibility nFlatIndex - nCurrIndex + nCurrCount >= 0, "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow"); - return EPosition(nCurrPara-1, nFlatIndex - nCurrIndex + nCurrCount); + return EPaM(nCurrPara - 1, nFlatIndex - nCurrIndex + nCurrCount); } // not found? Out of bounds @@ -507,7 +507,7 @@ namespace accessibility { SolarMutexGuard aGuard; - EPosition aPos( mpImpl->Index2Internal(nIndex) ); + EPaM aPos(mpImpl->Index2Internal(nIndex)); return mpImpl->GetParagraph( aPos.nPara ).getCharacter( aPos.nIndex ); } @@ -519,7 +519,7 @@ namespace accessibility //get the actual index without "\n" mpImpl->RemoveLineBreakCount( nIndex ); - EPosition aPos( mpImpl->Index2Internal(nIndex) ); + EPaM aPos(mpImpl->Index2Internal(nIndex)); return mpImpl->GetParagraph( aPos.nPara ).getCharacterAttributes( aPos.nIndex, aRequestedAttributes ); } @@ -530,7 +530,7 @@ namespace accessibility // #108900# Allow ranges for nIndex, as one-past-the-end // values are now legal, too. - EPosition aPos( mpImpl->Range2Internal(nIndex) ); + EPaM aPos(mpImpl->Range2Internal(nIndex)); // #i70916# Text in spread sheet cells return the wrong extents AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( aPos.nPara ); @@ -575,7 +575,7 @@ namespace accessibility // #112814# Use correct index offset if ( ( nIndex = rPara.getIndexAtPoint( aPoint ) ) != -1 ) - return mpImpl->Internal2Index(EPosition(i, nIndex)); + return mpImpl->Internal2Index(EPaM(i, nIndex)); } return -1; @@ -627,8 +627,8 @@ namespace accessibility { SolarMutexGuard aGuard; - EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) ); - EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) ); + EPaM aStartIndex(mpImpl->Range2Internal(nStartIndex)); + EPaM aEndIndex(mpImpl->Range2Internal(nEndIndex)); return mpImpl->SetSelection( aStartIndex.nPara, aStartIndex.nIndex, aEndIndex.nPara, aEndIndex.nIndex ); @@ -682,8 +682,8 @@ namespace accessibility nEndIndex++; } OUStringBuffer aRes; - EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) ); - EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) ); + EPaM aStartIndex(mpImpl->Range2Internal(nStartIndex)); + EPaM aEndIndex(mpImpl->Range2Internal(nEndIndex)); // #102170# Special case: start and end paragraph are identical if( aStartIndex.nPara == aEndIndex.nPara ) @@ -733,7 +733,7 @@ namespace accessibility SolarMutexGuard aGuard; bool bLineBreak = mpImpl->RemoveLineBreakCount( nIndex ); - EPosition aPos( mpImpl->Range2Internal(nIndex) ); + EPaM aPos(mpImpl->Range2Internal(nIndex)); css::accessibility::TextSegment aResult; @@ -749,7 +749,7 @@ namespace accessibility aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara ).getText(); // #112814# Adapt the start index with the paragraph offset - aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara, 0 ) ); + aResult.SegmentStart = mpImpl->Internal2Index(EPaM(aPos.nPara, 0)); aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength(); } else if ( AccessibleTextType::ATTRIBUTE_RUN == aTextType ) @@ -785,7 +785,7 @@ namespace accessibility sal_Int32 nOldIdx = nIndex; bool bLineBreak = mpImpl->RemoveLineBreakCount( nIndex ); - EPosition aPos( mpImpl->Range2Internal(nIndex) ); + EPaM aPos(mpImpl->Range2Internal(nIndex)); css::accessibility::TextSegment aResult; @@ -797,14 +797,14 @@ namespace accessibility aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara ).getText(); // #112814# Adapt the start index with the paragraph offset - aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara, 0 ) ); + aResult.SegmentStart = mpImpl->Internal2Index(EPaM(aPos.nPara, 0)); } else if( aPos.nPara > 0 ) { aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara - 1 ).getText(); // #112814# Adapt the start index with the paragraph offset - aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara - 1, 0 ) ); + aResult.SegmentStart = mpImpl->Internal2Index(EPaM(aPos.nPara - 1, 0)); } aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength(); @@ -832,7 +832,7 @@ namespace accessibility sal_Int32 nTemp = nIndex+1; bool bLineBreak = mpImpl->RemoveLineBreakCount( nTemp ); mpImpl->RemoveLineBreakCount( nIndex ); - EPosition aPos( mpImpl->Range2Internal(nIndex) ); + EPaM aPos(mpImpl->Range2Internal(nIndex)); css::accessibility::TextSegment aResult; @@ -846,7 +846,7 @@ namespace accessibility aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara + 1 ).getText(); // #112814# Adapt the start index with the paragraph offset - aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara + 1, 0 ) ); + aResult.SegmentStart = mpImpl->Internal2Index(EPaM(aPos.nPara + 1, 0)); aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength(); } } @@ -873,8 +873,8 @@ namespace accessibility if( nStartIndex > nEndIndex ) std::swap(nStartIndex, nEndIndex); - EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) ); - EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) ); + EPaM aStartIndex(mpImpl->Range2Internal(nStartIndex)); + EPaM aEndIndex(mpImpl->Range2Internal(nEndIndex)); return mpImpl->CopyText( aStartIndex.nPara, aStartIndex.nIndex, aEndIndex.nPara, aEndIndex.nIndex ); @@ -926,7 +926,7 @@ namespace accessibility SolarMutexGuard aGuard; - EPosition aPos( mpImpl->Index2Internal( nIndex ) ); + EPaM aPos(mpImpl->Index2Internal(nIndex)); AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( aPos.nPara ); uno::Sequence< beans::PropertyValue > aDefAttrSeq = rPara.getDefaultAttributes( RequestedAttributes ); uno::Sequence< beans::PropertyValue > aRunAttrSeq = rPara.getRunAttributes( aPos.nIndex, RequestedAttributes ); diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 0ff602376509..2b4d3956eefd 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -480,7 +480,7 @@ void ImpEditEngine::DumpData(bool bInfoBox) fprintf( fp, "\n VisArea: nX=%" SAL_PRIdINT64 ", nY=%" SAL_PRIdINT64 ", dX=%" SAL_PRIdINT64 ", dY=%" SAL_PRIdINT64, sal_Int64(aR.Left()), sal_Int64(aR.Top()), sal_Int64(aR.GetSize().Width()), sal_Int64(aR.GetSize().Height()) ); ESelection aSel = pV->GetSelection(); - fprintf( fp, "\n Selection: Start=%" SAL_PRIdINT32 ",%" SAL_PRIdINT32 ", End=%" SAL_PRIdINT32 ",%" SAL_PRIdINT32, aSel.nStartPara, aSel.nStartPos, aSel.nEndPara, aSel.nEndPos ); + fprintf( fp, "\n Selection: Start=%" SAL_PRIdINT32 ",%" SAL_PRIdINT32 ", End=%" SAL_PRIdINT32 ",%" SAL_PRIdINT32, aSel.start.nPara, aSel.start.nIndex, aSel.end.nPara, aSel.end.nIndex ); } if ( GetActiveView() ) { diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index fdc52e57a7fc..63961daefe27 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -451,7 +451,7 @@ sal_Int32 FastGetPos(const Array& rArray, const Val* p, sal_Int32& rLastPos) } // XXX "not found" condition for sal_Int32 indexes - return EE_PARA_NOT_FOUND; + return EE_PARA_MAX; } } @@ -537,7 +537,7 @@ sal_Int32 ParaPortionList::FindParagraph(tools::Long nYOffset) const if ( nY > nYOffset ) return i <= SAL_MAX_INT32 ? static_cast(i) : SAL_MAX_INT32; } - return EE_PARA_NOT_FOUND; + return EE_PARA_MAX; } #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG @@ -1043,7 +1043,7 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, bool bKeepEndingAttribs ) assert(aPaM.GetNode()); ContentNode* pCurNode = aPaM.GetNode(); sal_Int32 nPos = GetPos( pCurNode ); - assert(nPos != EE_PARA_NOT_FOUND); + assert(nPos != EE_PARA_MAX); OUString aStr = aPaM.GetNode()->Copy( aPaM.GetIndex() ); aPaM.GetNode()->Erase( aPaM.GetIndex() ); diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index b2f0b6c0b4f1..15dcc2d7dc5a 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -321,7 +321,7 @@ EEHorizontalTextDirection EditEngine::GetDefaultHorizontalTextDirection() const SvtScriptType EditEngine::GetScriptType( const ESelection& rSelection ) const { - return getImpl().GetScriptType( rSelection ); + return getImpl().GetItemScriptType(getImpl().CreateSel(rSelection)); } editeng::LanguageSpan EditEngine::GetLanguage(const EditPaM& rPaM) const @@ -336,7 +336,7 @@ editeng::LanguageSpan EditEngine::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) void EditEngine::TransliterateText( const ESelection& rSelection, TransliterationFlags nTransliterationMode ) { - getImpl().TransliterateText(getImpl().CreateSel( rSelection ), nTransliterationMode); + TransliterateText(CreateSelection(rSelection), nTransliterationMode); } EditSelection EditEngine::TransliterateText(const EditSelection& rSelection, TransliterationFlags nTransliterationMode) @@ -457,22 +457,19 @@ sal_uInt32 EditEngine::GetTextHeight( sal_Int32 nParagraph ) const return nHeight; } -OUString EditEngine::GetWord( sal_Int32 nPara, sal_Int32 nIndex ) +OUString EditEngine::GetWord(const EPaM& rPos) { - ESelection aESel( nPara, nIndex, nPara, nIndex ); - EditSelection aSel(getImpl().CreateSel(aESel)); - aSel = getImpl().SelectWord(aSel); - return getImpl().GetSelected(aSel); + EditSelection aSel(CreateSelection(ESelection(rPos))); + aSel = SelectWord(aSel); + return GetSelected(aSel); } ESelection EditEngine::GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const { // ImpEditEngine-Iteration-Methods should be const! - EditEngine* pNonConstEditEngine = const_cast(this); - - EditSelection aSel(pNonConstEditEngine->getImpl().CreateSel( rSelection ) ); - aSel = pNonConstEditEngine->getImpl().SelectWord( aSel, nWordType ); - return pNonConstEditEngine->getImpl().CreateESel( aSel ); + EditSelection aSel(getImpl().CreateSel(rSelection)); + aSel = getImpl().SelectWord(aSel, nWordType); + return CreateESelection(aSel); } void EditEngine::CheckIdleFormatter() @@ -737,6 +734,19 @@ EditSelection EditEngine::CreateSelection(const ESelection& rSel) return getImpl().CreateSel(rSel); } +ESelection EditEngine::NormalizeESelection(const ESelection& rSel) const +{ + return CreateESelection(getImpl().CreateNormalizedSel(rSel)); +} + +EPaM EditEngine::GetEnd() const +{ + auto para = GetEditDoc().Count(); + if (para) + --para; + return { para, GetTextLen(para) }; +} + const SfxItemSet& EditEngine::GetBaseParaAttribs(sal_Int32 nPara) const { return getImpl().GetParaAttribs(nPara); @@ -851,8 +861,7 @@ std::unique_ptr EditEngine::CreateTextObject() std::unique_ptr EditEngine::CreateTextObject( const ESelection& rESelection ) { - EditSelection aSel(getImpl().CreateSel(rESelection)); - return getImpl().CreateTextObject(aSel); + return getImpl().CreateTextObject(CreateSelection(rESelection)); } std::unique_ptr EditEngine::GetEmptyTextObject() @@ -1038,8 +1047,7 @@ void EditEngine::GetCharAttribs( sal_Int32 nPara, std::vector& rLi SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) { - EditSelection aSel(getImpl().ConvertSelection(rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos)); - return getImpl().GetAttribs(aSel, nOnlyHardAttrib); + return getImpl().GetAttribs(getImpl().CreateNormalizedSel(rSel), nOnlyHardAttrib); } SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags ) const @@ -1207,15 +1215,14 @@ SfxItemPool* EditEngine::GetEditTextObjectPool() const void EditEngine::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) { - EditSelection aSel(getImpl().ConvertSelection(rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos)); - getImpl().SetAttribs(aSel, rSet); + getImpl().SetAttribs(getImpl().CreateNormalizedSel(rSel), rSet); } void EditEngine::QuickMarkInvalid( const ESelection& rSel ) { - DBG_ASSERT(rSel.nStartPara < getImpl().GetEditDoc().Count(), "MarkInvalid: Start out of Range!"); - DBG_ASSERT(rSel.nEndPara < getImpl().GetEditDoc().Count(), "MarkInvalid: End out of Range!"); - for (sal_Int32 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++) + DBG_ASSERT(rSel.start.nPara < getImpl().GetEditDoc().Count(), "MarkInvalid: Start out of Range!"); + DBG_ASSERT(rSel.end.nPara < getImpl().GetEditDoc().Count(), "MarkInvalid: End out of Range!"); + for (sal_Int32 nPara = rSel.start.nPara; nPara <= rSel.end.nPara; nPara++) { ParaPortion* pPortion = getImpl().GetParaPortions().SafeGetObject(nPara); if ( pPortion ) @@ -1225,14 +1232,12 @@ void EditEngine::QuickMarkInvalid( const ESelection& rSel ) void EditEngine::QuickInsertText(const OUString& rText, const ESelection& rSel) { - EditSelection aSel(getImpl().ConvertSelection(rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos)); - getImpl().ImpInsertText(aSel, rText); + getImpl().ImpInsertText(getImpl().CreateNormalizedSel(rSel), rText); } void EditEngine::QuickDelete( const ESelection& rSel ) { - EditSelection aSel(getImpl().ConvertSelection(rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos)); - getImpl().ImpDeleteSelection( aSel ); + getImpl().ImpDeleteSelection(getImpl().CreateNormalizedSel(rSel)); } void EditEngine::QuickMarkToBeRepainted( sal_Int32 nPara ) @@ -1244,15 +1249,12 @@ void EditEngine::QuickMarkToBeRepainted( sal_Int32 nPara ) void EditEngine::QuickInsertLineBreak( const ESelection& rSel ) { - EditSelection aSel(getImpl().ConvertSelection(rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos)); - getImpl().InsertLineBreak( aSel ); + getImpl().InsertLineBreak(getImpl().CreateNormalizedSel(rSel)); } void EditEngine::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) { - - EditSelection aSel(getImpl().ConvertSelection(rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos)); - getImpl().ImpInsertFeature(aSel, rFld); + getImpl().ImpInsertFeature(getImpl().CreateNormalizedSel(rSel), rFld); } void EditEngine::QuickFormatDoc( bool bFull ) @@ -1519,20 +1521,16 @@ sal_Int32 EditEngine::FindParagraph( tools::Long nDocPosY ) return getImpl().GetParaPortions().FindParagraph(nDocPosY); } -EPosition EditEngine::FindDocPosition( const Point& rDocPos ) const +EPaM EditEngine::FindDocPosition(const Point& rDocPos) const { - EPosition aPos; // From the point of the API, this is const... EditPaM aPaM = getImpl().GetPaM(rDocPos, false); if ( aPaM.GetNode() ) - { - aPos.nPara = getImpl().maEditDoc.GetPos(aPaM.GetNode()); - aPos.nIndex = aPaM.GetIndex(); - } - return aPos; + return getImpl().CreateEPaM(aPaM); + return EPaM::NotFound(); } -tools::Rectangle EditEngine::GetCharacterBounds( const EPosition& rPos ) const +tools::Rectangle EditEngine::GetCharacterBounds(const EPaM& rPos) const { tools::Rectangle aBounds; ContentNode* pNode = getImpl().GetEditDoc().GetObject(rPos.nPara); @@ -1574,8 +1572,7 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_Int32 nPara ) uno::Reference EditEngine::CreateTransferable(const ESelection& rSelection) { - EditSelection aSel(getImpl().CreateSel(rSelection)); - return getImpl().CreateTransferable(aSel); + return getImpl().CreateTransferable(CreateSelection(rSelection)); } diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 9b17e434e53d..6f7182f383af 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -382,10 +382,10 @@ ContentInfo* EditTextObjectImpl::CreateAndInsertContent() sal_Int32 EditTextObjectImpl::GetParagraphCount() const { size_t nSize = maContents.size(); - if (nSize > EE_PARA_MAX_COUNT) + if (nSize > EE_PARA_MAX) { SAL_WARN( "editeng", "EditTextObjectImpl::GetParagraphCount - overflow " << nSize); - return EE_PARA_MAX_COUNT; + return EE_PARA_MAX; } return static_cast(nSize); } diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index f785c7057df0..47f5ac5b246f 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -524,9 +524,9 @@ void EditUndoSetAttribs::Undo() DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditEngine* pEE = GetEditEngine(); bool bFields = false; - for ( sal_Int32 nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ ) + for ( sal_Int32 nPara = aESel.start.nPara; nPara <= aESel.end.nPara; nPara++ ) { - const ContentAttribsInfo& rInf = *aPrevAttribs[nPara-aESel.nStartPara]; + const ContentAttribsInfo& rInf = *aPrevAttribs[nPara-aESel.start.nPara]; // first the paragraph attributes ... pEE->SetParaAttribsOnly(nPara, rInf.GetPrevParaAttribs()); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 7176e3961985..4791c5e7c0fb 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -274,7 +274,7 @@ void EditView::SetSelection( const ESelection& rESel ) if (nullptr != pNode) pNode->checkAndDeleteEmptyAttribs(); } - EditSelection aNewSelection(getImpEditEngine().ConvertSelection(rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos)); + EditSelection aNewSelection(getImpEditEngine().CreateNormalizedSel(rESel)); // If the selection is manipulated after a KeyInput: getEditEngine().CheckIdleFormatter(); @@ -309,15 +309,7 @@ void EditView::SetSelection( const ESelection& rESel ) ESelection EditView::GetSelection() const { - ESelection aSelection; - - aSelection.nStartPara = getEditEngine().GetEditDoc().GetPos( getImpl().GetEditSelection().Min().GetNode() ); - aSelection.nEndPara = getEditEngine().GetEditDoc().GetPos( getImpl().GetEditSelection().Max().GetNode() ); - - aSelection.nStartPos = getImpl().GetEditSelection().Min().GetIndex(); - aSelection.nEndPos = getImpl().GetEditSelection().Max().GetIndex(); - - return aSelection; + return getEditEngine().CreateESelection(getImpl().GetEditSelection()); } bool EditView::HasSelection() const @@ -734,7 +726,7 @@ void EditView::MoveParagraphs( Range aParagraphs, sal_Int32 nNewPos ) void EditView::MoveParagraphs( tools::Long nDiff ) { ESelection aSel = GetSelection(); - Range aRange( aSel.nStartPara, aSel.nEndPara ); + Range aRange( aSel.start.nPara, aSel.end.nPara ); aRange.Normalize(); tools::Long nDest = ( nDiff > 0 ? aRange.Max() : aRange.Min() ) + nDiff; if ( nDiff > 0 ) @@ -1226,8 +1218,8 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link aPortions; rEditEngine.GetPortions( nPara, aPortions ); @@ -1541,8 +1533,8 @@ void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList ) if( aPortions.empty() ) aPortions.push_back( rEditEngine.GetTextLen(nPara) ); - const sal_Int32 nBeginPos = (nPara == aSel.nStartPara) ? aSel.nStartPos : 0; - const sal_Int32 nEndPos = (nPara == aSel.nEndPara) ? aSel.nEndPos : EE_TEXTPOS_ALL; + const sal_Int32 nBeginPos = (nPara == aSel.start.nPara) ? aSel.start.nIndex : 0; + const sal_Int32 nEndPos = (nPara == aSel.end.nPara) ? aSel.end.nIndex : EE_TEXTPOS_MAX; for ( size_t nPos = 0; nPos < aPortions.size(); ++nPos ) { @@ -1689,22 +1681,22 @@ Selection EditView::GetSurroundingTextSelection() const // Stop reconversion if the selected text includes a line break. if ( aStr.indexOf( 0x0A ) == -1 ) - return Selection( 0, aSelection.nEndPos - aSelection.nStartPos ); + return Selection(0, aSelection.end.nIndex - aSelection.start.nIndex); else return Selection( 0, 0 ); } else { - return Selection( aSelection.nStartPos, aSelection.nEndPos ); + return Selection(aSelection.start.nIndex, aSelection.end.nIndex); } } bool EditView::DeleteSurroundingText(const Selection& rRange) { ESelection aSel(GetSelection()); - aSel.nEndPara = aSel.nStartPara; - aSel.nStartPos = rRange.Min(); - aSel.nEndPos = rRange.Max(); + aSel.end.nPara = aSel.start.nPara; + aSel.start.nIndex = rRange.Min(); + aSel.end.nIndex = rRange.Max(); SetSelection(aSel); DeleteSelected(); return true; diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 0dbcfedd55a0..8eef9af2bbe7 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -715,7 +715,7 @@ LanguageType EdtAutoCorrDoc::GetLanguage( sal_Int32 nPos ) const void EdtAutoCorrDoc::ImplStartUndoAction() { sal_Int32 nPara = mpEditEngine->GetEditDoc().GetPos( pCurNode ); - ESelection aSel( nPara, nCursor, nPara, nCursor ); + ESelection aSel(nPara, nCursor); mpEditEngine->UndoActionStart( EDITUNDO_INSERT, aSel ); bUndoAction = true; bAllowUndoAction = false; diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index deacdfa5905a..3170279eb7e9 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -367,8 +367,8 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) ContentNode* pEN = aEndPaM.GetNode(); sal_Int32 nStartNode = mpEditEngine->GetEditDoc().GetPos( pSN ); sal_Int32 nEndNode = mpEditEngine->GetEditDoc().GetPos( pEN ); - assert(nStartNode != EE_PARA_NOT_FOUND); - assert(nEndNode != EE_PARA_NOT_FOUND); + assert(nStartNode != EE_PARA_MAX); + assert(nEndNode != EE_PARA_MAX); sal_Int16 nOutlLevel = 0xff; if (rSet.StyleNo() && mpEditEngine->GetStyleSheetPool() && mpEditEngine->IsImportRTFStyleSheetsSet()) diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index a7497f629868..f67073380470 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -519,7 +519,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion, ContentNode* pEndNode = aTmpSel.Max().GetNode(); const sal_Int32 nStartPara = getEditEngine().GetEditDoc().GetPos(pStartNode); const sal_Int32 nEndPara = getEditEngine().GetEditDoc().GetPos(pEndNode); - if (nStartPara == EE_PARA_NOT_FOUND || nEndPara == EE_PARA_NOT_FOUND) + if (nStartPara == EE_PARA_MAX || nEndPara == EE_PARA_MAX) return; bool bStartHandleVisible = false; @@ -1146,7 +1146,7 @@ tools::Rectangle ImpEditView::GetEditCursor() const sal_Int32 nTextPortionStart = 0; sal_Int32 nPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() ); - if (nPara == EE_PARA_NOT_FOUND) // #i94322 + if (nPara == EE_PARA_MAX) // #i94322 return tools::Rectangle(); ParaPortion const& rParaPortion = getEditEngine().GetParaPortions().getRef(nPara); @@ -1192,7 +1192,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) sal_Int32 nTextPortionStart = 0; sal_Int32 nPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() ); - if (nPara == EE_PARA_NOT_FOUND) // #i94322 + if (nPara == EE_PARA_MAX) // #i94322 return; ParaPortion const& rParaPortion = getEditEngine().GetParaPortions().getRef(nPara); @@ -1876,7 +1876,7 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_Int32* pPara, bool ImpEditView::IsBulletArea( const Point& rPos, sal_Int32* pPara ) { if ( pPara ) - *pPara = EE_PARA_NOT_FOUND; + *pPara = EE_PARA_MAX; if( !GetOutputArea().Contains( rPos ) ) return false; @@ -2304,7 +2304,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur aSz = GetOutputDevice().PixelToLogic( aSz ); mpDragAndDropInfo->nSensibleRange = static_cast(aSz.Width()); mpDragAndDropInfo->nCursorWidth = static_cast(aSz.Width()) / 2; - mpDragAndDropInfo->aBeginDragSel = getImpEditEngine().CreateESel( aCopySel ); + mpDragAndDropInfo->aBeginDragSel = getEditEngine().CreateESelection( aCopySel ); uno::Reference xData = getEditEngine().CreateTransferable(aCopySel); @@ -2330,62 +2330,61 @@ void ImpEditView::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent if (mpDragAndDropInfo->bStarterOfDD && mpDragAndDropInfo->bDroppedInMe ) { // DropPos: Where was it dropped, irrespective of length. - ESelection aDropPos(mpDragAndDropInfo->aDropSel.nStartPara, mpDragAndDropInfo->aDropSel.nStartPos, mpDragAndDropInfo->aDropSel.nStartPara, mpDragAndDropInfo->aDropSel.nStartPos ); + ESelection aDropPos(mpDragAndDropInfo->aDropSel.start); ESelection aToBeDelSel = mpDragAndDropInfo->aBeginDragSel; - ESelection aNewSel( mpDragAndDropInfo->aDropSel.nEndPara, mpDragAndDropInfo->aDropSel.nEndPos, - mpDragAndDropInfo->aDropSel.nEndPara, mpDragAndDropInfo->aDropSel.nEndPos ); + ESelection aNewSel(mpDragAndDropInfo->aDropSel.end); bool bBeforeSelection = aDropPos < mpDragAndDropInfo->aBeginDragSel; - sal_Int32 nParaDiff = mpDragAndDropInfo->aBeginDragSel.nEndPara - mpDragAndDropInfo->aBeginDragSel.nStartPara; + sal_Int32 nParaDiff = mpDragAndDropInfo->aBeginDragSel.end.nPara - mpDragAndDropInfo->aBeginDragSel.start.nPara; if ( bBeforeSelection ) { // Adjust aToBeDelSel. - DBG_ASSERT(mpDragAndDropInfo->aBeginDragSel.nStartPara >= mpDragAndDropInfo->aDropSel.nStartPara, "But not before? "); - aToBeDelSel.nStartPara = aToBeDelSel.nStartPara + nParaDiff; - aToBeDelSel.nEndPara = aToBeDelSel.nEndPara + nParaDiff; + DBG_ASSERT(mpDragAndDropInfo->aBeginDragSel.start.nPara >= mpDragAndDropInfo->aDropSel.start.nPara, "But not before? "); + aToBeDelSel.start.nPara = aToBeDelSel.start.nPara + nParaDiff; + aToBeDelSel.end.nPara = aToBeDelSel.end.nPara + nParaDiff; // To correct the character? - if ( aToBeDelSel.nStartPara == mpDragAndDropInfo->aDropSel.nEndPara ) + if ( aToBeDelSel.start.nPara == mpDragAndDropInfo->aDropSel.end.nPara ) { sal_uInt16 nMoreChars; - if (mpDragAndDropInfo->aDropSel.nStartPara == mpDragAndDropInfo->aDropSel.nEndPara ) - nMoreChars = mpDragAndDropInfo->aDropSel.nEndPos - mpDragAndDropInfo->aDropSel.nStartPos; + if (mpDragAndDropInfo->aDropSel.start.nPara == mpDragAndDropInfo->aDropSel.end.nPara ) + nMoreChars = mpDragAndDropInfo->aDropSel.end.nIndex - mpDragAndDropInfo->aDropSel.start.nIndex; else - nMoreChars = mpDragAndDropInfo->aDropSel.nEndPos; - aToBeDelSel.nStartPos = - aToBeDelSel.nStartPos + nMoreChars; - if ( aToBeDelSel.nStartPara == aToBeDelSel.nEndPara ) - aToBeDelSel.nEndPos = - aToBeDelSel.nEndPos + nMoreChars; + nMoreChars = mpDragAndDropInfo->aDropSel.end.nIndex; + aToBeDelSel.start.nIndex = + aToBeDelSel.start.nIndex + nMoreChars; + if ( aToBeDelSel.start.nPara == aToBeDelSel.end.nPara ) + aToBeDelSel.end.nIndex = + aToBeDelSel.end.nIndex + nMoreChars; } } else { // aToBeDelSel is ok, but the selection of the View // has to be adapted, if it was deleted before! - DBG_ASSERT(mpDragAndDropInfo->aBeginDragSel.nStartPara <= mpDragAndDropInfo->aDropSel.nStartPara, "But not before? "); - aNewSel.nStartPara = aNewSel.nStartPara - nParaDiff; - aNewSel.nEndPara = aNewSel.nEndPara - nParaDiff; + DBG_ASSERT(mpDragAndDropInfo->aBeginDragSel.start.nPara <= mpDragAndDropInfo->aDropSel.start.nPara, "But not before? "); + aNewSel.start.nPara = aNewSel.start.nPara - nParaDiff; + aNewSel.end.nPara = aNewSel.end.nPara - nParaDiff; // To correct the character? - if (mpDragAndDropInfo->aBeginDragSel.nEndPara == mpDragAndDropInfo->aDropSel.nStartPara ) + if (mpDragAndDropInfo->aBeginDragSel.end.nPara == mpDragAndDropInfo->aDropSel.start.nPara ) { sal_uInt16 nLessChars; - if (mpDragAndDropInfo->aBeginDragSel.nStartPara == mpDragAndDropInfo->aBeginDragSel.nEndPara ) - nLessChars = mpDragAndDropInfo->aBeginDragSel.nEndPos - mpDragAndDropInfo->aBeginDragSel.nStartPos; + if (mpDragAndDropInfo->aBeginDragSel.start.nPara == mpDragAndDropInfo->aBeginDragSel.end.nPara ) + nLessChars = mpDragAndDropInfo->aBeginDragSel.end.nIndex - mpDragAndDropInfo->aBeginDragSel.start.nIndex; else - nLessChars = mpDragAndDropInfo->aBeginDragSel.nEndPos; - aNewSel.nStartPos = aNewSel.nStartPos - nLessChars; - if ( aNewSel.nStartPara == aNewSel.nEndPara ) - aNewSel.nEndPos = aNewSel.nEndPos - nLessChars; + nLessChars = mpDragAndDropInfo->aBeginDragSel.end.nIndex; + aNewSel.start.nIndex = aNewSel.start.nIndex - nLessChars; + if ( aNewSel.start.nPara == aNewSel.end.nPara ) + aNewSel.end.nIndex = aNewSel.end.nIndex - nLessChars; } } DrawSelectionXOR(); - EditSelection aDelSel(getImpEditEngine().CreateSel(aToBeDelSel)); + EditSelection aDelSel(getEditEngine().CreateSelection(aToBeDelSel)); DBG_ASSERT( !aDelSel.DbgIsBuggy(getEditEngine().GetEditDoc()), "ToBeDel is buggy!"); getEditEngine().DeleteSelection(aDelSel); if ( !bBeforeSelection ) { - DBG_ASSERT(!getImpEditEngine().CreateSel(aNewSel).DbgIsBuggy(getEditEngine().GetEditDoc()), "Bad"); - SetEditSelection(getImpEditEngine().CreateSel(aNewSel)); + DBG_ASSERT(!getEditEngine().CreateSelection(aNewSel).DbgIsBuggy(getEditEngine().GetEditDoc()), "Bad"); + SetEditSelection(getEditEngine().CreateSelection(aNewSel)); } getImpEditEngine().FormatAndLayout(getImpEditEngine().GetActiveView()); DrawSelectionXOR(); @@ -2430,7 +2429,7 @@ void ImpEditView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE if (mpDragAndDropInfo->bOutlinerMode) { bChanges = true; - GetEditViewPtr()->MoveParagraphs(Range(mpDragAndDropInfo->aBeginDragSel.nStartPara, mpDragAndDropInfo->aBeginDragSel.nEndPara ), mpDragAndDropInfo->nOutlinerDropDest); + GetEditViewPtr()->MoveParagraphs(Range(mpDragAndDropInfo->aBeginDragSel.start.nPara, mpDragAndDropInfo->aBeginDragSel.end.nPara ), mpDragAndDropInfo->nOutlinerDropDest); } else { @@ -2457,10 +2456,8 @@ void ImpEditView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE if (mpDragAndDropInfo->bStarterOfDD) { // Only set if the same engine! - mpDragAndDropInfo->aDropSel.nStartPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() ); - mpDragAndDropInfo->aDropSel.nStartPos = aPaM.GetIndex(); - mpDragAndDropInfo->aDropSel.nEndPara = getEditEngine().GetEditDoc().GetPos( aNewSel.Max().GetNode() ); - mpDragAndDropInfo->aDropSel.nEndPos = aNewSel.Max().GetIndex(); + mpDragAndDropInfo->aDropSel.start = getImpEditEngine().CreateEPaM(aPaM); + mpDragAndDropInfo->aDropSel.end = getImpEditEngine().CreateEPaM(aNewSel.Max()); mpDragAndDropInfo->bDroppedInMe = true; } } @@ -2578,8 +2575,8 @@ void ImpEditView::dragOver(const css::datatransfer::dnd::DropTargetDragEvent& rD mpDragAndDropInfo->nOutlinerDropDest = nPara+1; } - if ((mpDragAndDropInfo->nOutlinerDropDest >= mpDragAndDropInfo->aBeginDragSel.nStartPara) && - (mpDragAndDropInfo->nOutlinerDropDest <= (mpDragAndDropInfo->aBeginDragSel.nEndPara + 1))) + if ((mpDragAndDropInfo->nOutlinerDropDest >= mpDragAndDropInfo->aBeginDragSel.start.nPara) && + (mpDragAndDropInfo->nOutlinerDropDest <= (mpDragAndDropInfo->aBeginDragSel.end.nPara + 1))) { bAccept = false; } @@ -2589,8 +2586,8 @@ void ImpEditView::dragOver(const css::datatransfer::dnd::DropTargetDragEvent& rD { // it must not be dropped into a selection EPaM aP = getImpEditEngine().CreateEPaM( aPaM ); - ESelection aDestSel( aP.nPara, aP.nIndex, aP.nPara, aP.nIndex); - ESelection aCurSel = getImpEditEngine().CreateESel( GetEditSelection() ); + ESelection aDestSel(aP); + ESelection aCurSel = getEditEngine().CreateESelection(GetEditSelection()); aCurSel.Adjust(); if ( !(aDestSel < aCurSel) && !(aDestSel > aCurSel) ) { diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 8f722c660c6a..029ae6a9e223 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -748,7 +748,6 @@ private: void InitScriptTypes( sal_Int32 nPara ); sal_uInt16 GetI18NScriptType( const EditPaM& rPaM, sal_Int32* pEndPos = nullptr ) const; - SvtScriptType GetScriptType( const ESelection& rSel ); SvtScriptType GetItemScriptType( const EditSelection& rSel ) const; bool IsScriptChange( const EditPaM& rPaM ) const; bool HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) const; @@ -1117,8 +1116,7 @@ public: EPaM CreateEPaM( const EditPaM& rPaM ) const { - const ContentNode* pNode = rPaM.GetNode(); - return EPaM(maEditDoc.GetPos(pNode), rPaM.GetIndex()); + return EPaM(maEditDoc.GetPos(rPaM.GetNode()), rPaM.GetIndex()); } EditPaM CreateEditPaM( const EPaM& rEPaM ) @@ -1130,28 +1128,24 @@ public: ESelection CreateESel(const EditSelection& rSel) const { - const ContentNode* pStartNode = rSel.Min().GetNode(); - const ContentNode* pEndNode = rSel.Max().GetNode(); ESelection aESel; - aESel.nStartPara = maEditDoc.GetPos( pStartNode ); - aESel.nStartPos = rSel.Min().GetIndex(); - aESel.nEndPara = maEditDoc.GetPos( pEndNode ); - aESel.nEndPos = rSel.Max().GetIndex(); + aESel.start = CreateEPaM(rSel.Min()); + aESel.end = CreateEPaM(rSel.Max()); return aESel; } EditSelection CreateSel(const ESelection& rSel) { - DBG_ASSERT( rSel.nStartPara < maEditDoc.Count(), "CreateSel: invalid start paragraph" ); - DBG_ASSERT( rSel.nEndPara < maEditDoc.Count(), "CreateSel: invalid end paragraph" ); - EditSelection aSel; - aSel.Min().SetNode(maEditDoc.GetObject(rSel.nStartPara)); - aSel.Min().SetIndex( rSel.nStartPos ); - aSel.Max().SetNode(maEditDoc.GetObject(rSel.nEndPara)); - aSel.Max().SetIndex( rSel.nEndPos ); + DBG_ASSERT( rSel.start.nPara < maEditDoc.Count(), "CreateSel: invalid start paragraph" ); + DBG_ASSERT( rSel.end.nPara < maEditDoc.Count(), "CreateSel: invalid end paragraph" ); + EditSelection aSel(CreateEditPaM(rSel.start), CreateEditPaM(rSel.end)); DBG_ASSERT( !aSel.DbgIsBuggy( maEditDoc ), "CreateSel: incorrect selection!" ); return aSel; + } + EditSelection CreateNormalizedSel(const ESelection& rSel) + { + return ConvertSelection(rSel.start.nPara, rSel.start.nIndex, rSel.end.nPara, rSel.end.nIndex); } void SetStyleSheetPool( SfxStyleSheetPool* pSPool ); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 88b047f1e8e4..95ea82178989 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -248,7 +248,7 @@ void ImpEditEngine::InitDoc(bool bKeepParaAttribs) if ( IsCallParaInsertedOrDeleted() ) { - GetEditEnginePtr()->ParagraphDeleted( EE_PARA_ALL ); + GetEditEnginePtr()->ParagraphDeleted(EE_PARA_MAX); GetEditEnginePtr()->ParagraphInserted( 0 ); } @@ -264,8 +264,7 @@ EditPaM ImpEditEngine::DeleteSelected(const EditSelection& rSel) OUString ImpEditEngine::GetText( const ESelection& rESelection ) { - EditSelection aSel = CreateSel(rESelection); - return GetSelected(aSel); + return GetSelected(CreateSel(rESelection)); } OUString ImpEditEngine::GetSelected( const EditSelection& rSel ) const @@ -526,14 +525,14 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) if( pView->HasSelection() ) { - aSelection.nEndPos = aSelection.nStartPos; - aSelection.nStartPos += pData->GetStart(); - aSelection.nEndPos += pData->GetEnd(); + aSelection.end.nIndex = aSelection.start.nIndex; + aSelection.start.nIndex += pData->GetStart(); + aSelection.end.nIndex += pData->GetEnd(); } else { - aSelection.nStartPos = pData->GetStart(); - aSelection.nEndPos = pData->GetEnd(); + aSelection.start.nIndex = pData->GetStart(); + aSelection.end.nIndex = pData->GetEnd(); } pView->SetSelection( aSelection ); } @@ -544,11 +543,11 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) ESelection aSelection = pView->GetSelection(); aSelection.Adjust(); - if ( aSelection.nStartPara != aSelection.nEndPara ) + if ( aSelection.start.nPara != aSelection.end.nPara ) { - sal_Int32 aParaLen = mpEditEngine->GetTextLen( aSelection.nStartPara ); - aSelection.nEndPara = aSelection.nStartPara; - aSelection.nEndPos = aParaLen; + sal_Int32 aParaLen = mpEditEngine->GetTextLen( aSelection.start.nPara ); + aSelection.end.nPara = aSelection.start.nPara; + aSelection.end.nIndex = aParaLen; pView->SetSelection( aSelection ); } } @@ -790,7 +789,7 @@ void ImpEditEngine::ParaAttribsChanged( ContentNode const * pNode, bool bIgnoreU pPortion->MarkSelectionInvalid( 0 ); sal_Int32 nPara = maEditDoc.GetPos( pNode ); - assert( nPara != EE_PARA_NOT_FOUND ); + assert(nPara != EE_PARA_MAX); if (bIgnoreUndoCheck || mpEditEngine->IsInUndo()) mpEditEngine->ParaAttribsChanged( nPara ); @@ -1858,12 +1857,6 @@ sal_uInt16 ImpEditEngine::GetI18NScriptType( const EditPaM& rPaM, sal_Int32* pEn return nScriptType ? nScriptType : SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); } -SvtScriptType ImpEditEngine::GetScriptType( const ESelection& rSel ) -{ - EditSelection aSel(CreateSel(rSel)); - return GetItemScriptType( aSel ); -} - SvtScriptType ImpEditEngine::GetItemScriptType( const EditSelection& rSel ) const { EditSelection aSel( rSel ); @@ -2257,7 +2250,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_Int32 n // Determine the new location for paragraphs sal_Int32 nRealNewPos = pDestPortion ? GetParaPortions().GetPos( pDestPortion ) : GetParaPortions().Count(); - assert( nRealNewPos != EE_PARA_NOT_FOUND && "ImpMoveParagraphs: Invalid Position!" ); + assert(nRealNewPos != EE_PARA_MAX && "ImpMoveParagraphs: Invalid Position!"); // Add the paragraph portions and content nodes to a new position sal_Int32 i = 0; @@ -2307,8 +2300,8 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_Int32 n EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pRight, bool bBackward ) { OSL_ENSURE( pLeft != pRight, "Join together the same paragraph ?" ); - OSL_ENSURE( maEditDoc.GetPos( pLeft ) != EE_PARA_NOT_FOUND, "Inserted node not found (1)" ); - OSL_ENSURE( maEditDoc.GetPos( pRight ) != EE_PARA_NOT_FOUND, "Inserted node not found (2)" ); + OSL_ENSURE(maEditDoc.GetPos(pLeft) != EE_PARA_MAX, "Inserted node not found (1)"); + OSL_ENSURE(maEditDoc.GetPos(pRight) != EE_PARA_MAX, "Inserted node not found (2)"); // #i120020# it is possible that left and right are *not* in the desired order (left/right) // so correct it. This correction is needed, else an invalid SfxLinkUndoAction will be @@ -2506,7 +2499,7 @@ EditPaM ImpEditEngine::ImpDeleteSelection(const EditSelection& rCurSel) sal_Int32 nStartNode = maEditDoc.GetPos( aStartPaM.GetNode() ); sal_Int32 nEndNode = maEditDoc.GetPos( aEndPaM.GetNode() ); - assert( nEndNode != EE_PARA_NOT_FOUND && "Start > End ?!" ); + assert(nEndNode != EE_PARA_MAX && "Start > End ?!"); assert( nStartNode <= nEndNode && "Start > End ?!" ); // Remove all nodes in between... @@ -2630,7 +2623,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, sal_Unicode c, ESelection aESel( CreateESel(aSel) ); EditSelection aFirstWordSel; EditSelection aSecondWordSel; - if (aESel.nEndPara == 0) // is this the first para? + if (aESel.end.nPara == 0) // is this the first para? { // select first word... // start by checking if para starts with word. @@ -2650,7 +2643,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, sal_Unicode c, EditPaM aRight2Word( WordRight( aFirstWordSel.Max() ) ); aSecondWordSel = SelectWord( EditSelection( aRight2Word ) ); } - bool bIsFirstWordInFirstPara = aESel.nEndPara == 0 && + bool bIsFirstWordInFirstPara = aESel.end.nPara == 0 && aFirstWordSel.Max().GetIndex() <= aSel.Max().GetIndex() && aSel.Max().GetIndex() <= aSecondWordSel.Min().GetIndex(); @@ -2986,10 +2979,10 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel ) EditPaM ImpEditEngine::ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttribs ) { - if ( maEditDoc.Count() >= EE_PARA_MAX_COUNT ) + if (maEditDoc.Count() >= EE_PARA_MAX) { SAL_WARN( "editeng", "ImpEditEngine::ImpInsertParaBreak - can't process more than " - << EE_PARA_MAX_COUNT << " paragraphs!"); + << EE_PARA_MAX << " paragraphs!"); return rPaM; } @@ -3037,7 +3030,7 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttrib // Optimization: Do not place unnecessarily many getPos to Listen! // Here, as in undo, but also in all other methods. sal_Int32 nPos = GetParaPortions().GetPos( pPortion ); - assert(nPos != EE_PARA_NOT_FOUND); + assert(nPos != EE_PARA_MAX); ParaPortion* pNewPortion = new ParaPortion( aPaM.GetNode() ); GetParaPortions().Insert(nPos+1, std::unique_ptr(pNewPortion)); ParaAttribsChanged( pNewPortion->GetNode() ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 049cb1527008..b060d35fbc0a 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4385,7 +4385,7 @@ const ParaPortion* ImpEditEngine::GetPrevVisPortion( const ParaPortion* pCurPort const ParaPortion* ImpEditEngine::GetNextVisPortion( const ParaPortion* pCurPortion ) const { sal_Int32 nPara = GetParaPortions().GetPos( pCurPortion ); - if (nPara == EE_PARA_NOT_FOUND) + if (nPara == EE_PARA_MAX) { SAL_WARN("editeng", "Portion not found: GetPrevVisNode" ); return nullptr; @@ -4449,7 +4449,7 @@ void ImpEditEngine::InsertParagraph( sal_Int32 nPara, const EditTextObject& rTxt { if ( nPara > maEditDoc.Count() ) { - SAL_WARN_IF( nPara != EE_PARA_APPEND, "editeng", "Paragraph number too large, but not EE_PARA_APPEND!" ); + SAL_WARN_IF( nPara != EE_PARA_MAX, "editeng", "Paragraph number too large, but not EE_PARA_MAX!" ); nPara = maEditDoc.Count(); } @@ -4475,7 +4475,7 @@ void ImpEditEngine::InsertParagraph(sal_Int32 nPara, const OUString& rTxt) { if ( nPara > maEditDoc.Count() ) { - SAL_WARN_IF( nPara != EE_PARA_APPEND, "editeng", "Paragraph number too large, but not EE_PARA_APPEND!" ); + SAL_WARN_IF( nPara != EE_PARA_MAX, "editeng", "Paragraph number too large, but not EE_PARA_MAX!" ); nPara = maEditDoc.Count(); } @@ -4605,8 +4605,8 @@ const SvxNumberFormat* ImpEditEngine::GetNumberFormat( const ContentNode *pNode { // get index of paragraph sal_Int32 nPara = GetEditDoc().GetPos( pNode ); - DBG_ASSERT( nPara < EE_PARA_NOT_FOUND, "node not found in array" ); - if (nPara < EE_PARA_NOT_FOUND) + DBG_ASSERT( nPara < EE_PARA_MAX, "node not found in array" ); + if (nPara < EE_PARA_MAX) { // the called function may be overridden by an OutlinerEditEng // object to provide diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 6d444749092c..50d7f6fe9669 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1628,7 +1628,7 @@ void ImpEditEngine::CreateSpellInfo( bool bMultipleDocs ) // (spelling in only a selection or not starting with the top requires // further changes elsewhere to work properly) mpSpellInfo->aSpellStart = EPaM(); - mpSpellInfo->aSpellTo = EPaM( EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND ); + mpSpellInfo->aSpellTo = EPaM(EE_PARA_MAX, EE_TEXTPOS_MAX); } @@ -1852,7 +1852,7 @@ void ImpEditEngine::ImpConvert( OUString &rConvTxt, LanguageType &rConvTxtLang, mpEditEngine->GetText(mpConvInfo->aConvContinue.nPara).isEmpty()) { sal_Int32 nPara = mpConvInfo->aConvContinue.nPara; - ESelection aESel( nPara, 0, nPara, 0 ); + ESelection aESel(nPara, 0); // see comment for below same function call SetLanguageAndFont( aESel, nTargetLang, EE_CHAR_LANGUAGE_CJK, diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 6dd01d1d349e..9abcc1350c06 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -599,8 +599,7 @@ void ImpEditEngine::RemoveAttribs( const ESelection& rSelection, bool bRemovePar EERemoveParaAttribsMode::RemoveCharItems; UndoActionStart(EDITUNDO_RESETATTRIBS); - EditSelection aSel(ConvertSelection(rSelection.nStartPara, rSelection.nStartPos, rSelection.nEndPara, rSelection.nEndPos)); - RemoveCharAttribs(aSel, eMode, nWhich); + RemoveCharAttribs(CreateNormalizedSel(rSelection), eMode, nWhich); UndoActionEnd(); if (IsUpdateLayout()) FormatAndLayout(); diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index 3d4c03e1ddeb..9582c2b2e74b 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -121,8 +121,7 @@ bool TextConvWrapper::ConvMore_impl() bool bMore = false; EditEngine& rEditEngine = m_pEditView->getEditEngine(); - ImpEditEngine& rImpEditEngine = m_pEditView->getImpEditEngine(); - ConvInfo* pConvInfo = rImpEditEngine.GetConvInfo(); + ConvInfo* pConvInfo = rEditEngine.getImpl().GetConvInfo(); if ( pConvInfo->bMultipleDoc ) { bMore = rEditEngine.ConvertNextDocument(); @@ -169,8 +168,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) if (m_aConvSel.HasRange()) { // user selection: convert to end of selection - pConvInfo->aConvTo.nPara = m_aConvSel.nEndPara; - pConvInfo->aConvTo.nIndex = m_aConvSel.nEndPos; + pConvInfo->aConvTo = m_aConvSel.end; pConvInfo->bConvToEnd = false; } else @@ -248,10 +246,10 @@ void TextConvWrapper::SelectNewUnit_impl( return; ESelection aSelection = m_pEditView->GetSelection(); - DBG_ASSERT( aSelection.nStartPara == aSelection.nEndPara, + DBG_ASSERT( aSelection.start.nPara == aSelection.end.nPara, "paragraph mismatch in selection" ); - aSelection.nStartPos = (m_nLastPos + m_nUnitOffset + nUnitStart); - aSelection.nEndPos = (m_nLastPos + m_nUnitOffset + nUnitEnd); + aSelection.start.nIndex = (m_nLastPos + m_nUnitOffset + nUnitStart); + aSelection.end.nIndex = (m_nLastPos + m_nUnitOffset + nUnitEnd); m_pEditView->SetSelection( aSelection ); } @@ -269,11 +267,11 @@ void TextConvWrapper::GetNextPortion( m_nUnitOffset = 0; ESelection aSelection = m_pEditView->GetSelection(); - DBG_ASSERT( aSelection.nStartPara == aSelection.nEndPara, + DBG_ASSERT( aSelection.start.nPara == aSelection.end.nPara, "paragraph mismatch in selection" ); - DBG_ASSERT( aSelection.nStartPos <= aSelection.nEndPos, + DBG_ASSERT( aSelection.start.nIndex <= aSelection.end.nIndex, "start pos > end pos" ); - m_nLastPos = aSelection.nStartPos; + m_nLastPos = aSelection.start.nIndex; } @@ -336,15 +334,15 @@ void TextConvWrapper::ReplaceUnit( m_nUnitOffset = m_nUnitOffset + nUnitStart + aNewTxt.getLength(); // remember current original language for later use - ImpEditEngine& rImpEditEngine = m_pEditView->getImpEditEngine(); + EditEngine& rEditEngine = m_pEditView->getEditEngine(); ESelection aOldSel = m_pEditView->GetSelection(); //EditSelection aOldEditSel = pEditView->getImpl().GetEditSelection(); #ifdef DBG_UTIL - LanguageType nOldLang = rImpEditEngine.GetLanguage(rImpEditEngine.CreateSel( aOldSel ).Min() ).nLang; + LanguageType nOldLang = rEditEngine.GetLanguage(rEditEngine.CreateSelection( aOldSel ).Min() ).nLang; #endif - rImpEditEngine.UndoActionStart( EDITUNDO_INSERT ); + rEditEngine.UndoActionStart( EDITUNDO_INSERT ); // according to FT we should currently not bother about keeping // attributes in Hangul/Hanja conversion and leave that untouched. @@ -362,7 +360,7 @@ void TextConvWrapper::ReplaceUnit( "TextConvWrapper::ReplaceUnit : unexpected target language" ); ESelection aNewSel( aOldSel ); - aNewSel.nStartPos = aNewSel.nStartPos - aNewTxt.getLength(); + aNewSel.start.nIndex -= aNewTxt.getLength(); if (pNewUnitLanguage) { @@ -375,10 +373,10 @@ void TextConvWrapper::ReplaceUnit( } } - rImpEditEngine.UndoActionEnd(); + rEditEngine.UndoActionEnd(); // adjust ConvContinue / ConvTo if necessary - ConvInfo* pConvInfo = rImpEditEngine.GetConvInfo(); + ConvInfo* pConvInfo = rEditEngine.getImpl().GetConvInfo(); sal_Int32 nDelta = aNewTxt.getLength() - aOrigTxt.getLength(); if (nDelta != 0) { @@ -410,7 +408,7 @@ void TextConvWrapper::ChangeText( const OUString &rNewText, pESelection->Adjust(); // remember cursor start position for later setting of the cursor - const sal_Int32 nStartIndex = pESelection->nStartPos; + const sal_Int32 nStartIndex = pESelection->start.nIndex; const sal_Int32 nIndices = pOffsets->getLength(); const sal_Int32 *pIndices = pOffsets->getConstArray(); @@ -453,8 +451,8 @@ void TextConvWrapper::ChangeText( const OUString &rNewText, // set selection to sub string to be replaced in original text ESelection aSel( *pESelection ); sal_Int32 nChgInNodeStartIndex = nStartIndex + nCorrectionOffset + nChgPos; - aSel.nStartPos = nChgInNodeStartIndex; - aSel.nEndPos = nChgInNodeStartIndex + nChgLen; + aSel.start.nIndex = nChgInNodeStartIndex; + aSel.end.nIndex = nChgInNodeStartIndex + nChgLen; m_pEditView->SetSelection( aSel ); // replace selected sub string with the corresponding @@ -485,7 +483,7 @@ void TextConvWrapper::ChangeText( const OUString &rNewText, // set cursor to the end of the inserted text // (as it would happen after ChangeText_impl (Delete and Insert) // of the whole text in the 'else' branch below) - pESelection->nStartPos = pESelection->nEndPos = nStartIndex + nConvTextLen; + pESelection->start.nIndex = pESelection->end.nIndex = nStartIndex + nConvTextLen; } else { diff --git a/editeng/source/misc/urlfieldhelper.cxx b/editeng/source/misc/urlfieldhelper.cxx index 16303c064d50..7dafeb2c9628 100644 --- a/editeng/source/misc/urlfieldhelper.cxx +++ b/editeng/source/misc/urlfieldhelper.cxx @@ -30,12 +30,7 @@ bool URLFieldHelper::IsCursorAtURLField(const EditView& pEditView, bool bAlsoChe { // tdf#128666 Make sure only URL field (or nothing) is selected ESelection aSel = pEditView.GetSelection(); - auto nSelectedParas = aSel.nEndPara - aSel.nStartPara; - auto nSelectedChars = aSel.nEndPos - aSel.nStartPos; - bool bIsValidSelection - = nSelectedParas == 0 - && (nSelectedChars == 0 || nSelectedChars == 1 || nSelectedChars == -1); - if (!bIsValidSelection) + if (aSel.start.nPara != aSel.end.nPara || std::abs(aSel.end.nIndex - aSel.start.nIndex) > 1) return false; const SvxFieldData* pField diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index 6c9aeda64a4c..0e791eee9a36 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -158,9 +158,9 @@ OUString const & Outliner::GetWordDelimiters() const return pEditEngine->GetWordDelimiters(); } -OUString Outliner::GetWord( sal_Int32 nPara, sal_Int32 nIndex ) +OUString Outliner::GetWord(const EPaM& rPos) { - return pEditEngine->GetWord( nPara, nIndex ); + return pEditEngine->GetWord(rPos); } void Outliner::Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect ) @@ -423,7 +423,7 @@ bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, bool* pbBu { Point aDocPos = GetDocPos( rPaperPos ); sal_Int32 nPara = pEditEngine->FindParagraph( aDocPos.Y() ); - if ( ( nPara != EE_PARA_NOT_FOUND ) && ImplHasNumberFormat( nPara ) ) + if ((nPara != EE_PARA_MAX) && ImplHasNumberFormat(nPara)) { tools::Rectangle aBulArea = ImpCalcBulletArea( nPara, true, true ); if ( aBulArea.Contains( rPaperPos ) ) diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 171c296beaa1..e23ee74ff09f 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -150,7 +150,7 @@ void Outliner::ParagraphInserted( sal_Int32 nPara ) void Outliner::ParagraphDeleted( sal_Int32 nPara ) { - if ( nBlockInsCallback || ( nPara == EE_PARA_ALL ) ) + if (nBlockInsCallback || (nPara == EE_PARA_MAX)) return; Paragraph* pPara = pParaList->GetParagraph( nPara ); @@ -606,7 +606,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj, bool bAppend ) else { nPara = pParaList->GetParagraphCount(); - pEditEngine->InsertParagraph( EE_PARA_APPEND, rPObj.GetTextObject(), bAppend ); + pEditEngine->InsertParagraph(EE_PARA_MAX, rPObj.GetTextObject(), bAppend); } bFirstParaIsEmpty = false; @@ -816,7 +816,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const vcl::Font aStdFont; if ( !pEditEngine->IsFlatMode() ) { - ESelection aSel( nPara, 0, nPara, 0 ); + ESelection aSel(nPara, 0); aStdFont = EditEngine::CreateFontFromItemSet( pEditEngine->GetAttribs( aSel ), pEditEngine->GetScriptType( aSel ) ); } else @@ -1470,7 +1470,7 @@ void Outliner::StyleSheetChanged( SfxStyleSheet const * pStyle ) ImplCalcBulletText( nPara, false, false ); // EditEngine formats changed paragraphs before calling this method, // so they are not reformatted now and use wrong bullet indent - pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) ); + pEditEngine->QuickMarkInvalid(ESelection(nPara, 0)); } } } @@ -2029,7 +2029,7 @@ std::optional Outliner::GetNonOverflowingText() const bool bItAllOverflew = nCount == 0 && nOverflowLine == 0; if ( bItAllOverflew ) { - ESelection aEmptySel(0,0,0,0); + ESelection aEmptySel; //EditTextObject *pTObj = pEditEngine->CreateTextObject(aEmptySel); bool const bLastParaInterrupted = true; // Last Para was interrupted since everything overflew return NonOverflowingText(aEmptySel, bLastParaInterrupted); diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx index e6dc6e691c6c..91f89a8e3e8c 100644 --- a/editeng/source/outliner/outlobj.cxx +++ b/editeng/source/outliner/outlobj.cxx @@ -166,10 +166,10 @@ TextRotation OutlinerParaObject::GetRotation() const sal_Int32 OutlinerParaObject::Count() const { size_t nSize = mpImpl->maParagraphDataVector.size(); - if (nSize > EE_PARA_MAX_COUNT) + if (nSize > o3tl::make_unsigned(EE_PARA_MAX)) { SAL_WARN( "editeng", "OutlinerParaObject::Count - overflow " << nSize); - return EE_PARA_MAX_COUNT; + return EE_PARA_MAX; } return static_cast(nSize); } diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index e4f06d4548a0..62fa083b0321 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -123,12 +123,12 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra { if( !bReadOnly && !bSelection && ( pOwner->GetOutlinerMode() != OutlinerMode::TextObject ) ) { - if( aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) ) + if (aSel.end.nIndex == pOwner->pEditEngine->GetTextLen(aSel.end.nPara)) { - Paragraph* pNext = pOwner->pParaList->GetParagraph( aSel.nEndPara+1 ); + Paragraph* pNext = pOwner->pParaList->GetParagraph(aSel.end.nPara + 1); if( pNext && pNext->HasFlag(ParaFlag::ISPAGE) ) { - if( !pOwner->ImpCanDeleteSelectedPages( this, aSel.nEndPara, 1 ) ) + if (!pOwner->ImpCanDeleteSelectedPages(this, aSel.end.nPara, 1)) return false; } } @@ -149,13 +149,13 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra { if ( ( pOwner->GetOutlinerMode() != OutlinerMode::TextObject ) && ( pOwner->GetOutlinerMode() != OutlinerMode::TitleObject ) && - ( bSelection || !aSel.nStartPos ) ) + ( bSelection || !aSel.start.nIndex ) ) { Indent( aKeyCode.IsShift() ? -1 : +1 ); bKeyProcessed = true; } else if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) && - !bSelection && !aSel.nEndPos && pOwner->ImplHasNumberFormat( aSel.nEndPara ) ) + !bSelection && !aSel.end.nIndex && pOwner->ImplHasNumberFormat( aSel.end.nPara ) ) { Indent( aKeyCode.IsShift() ? -1 : +1 ); bKeyProcessed = true; @@ -165,15 +165,15 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra break; case KEY_BACKSPACE: { - if( !bReadOnly && !bSelection && aSel.nEndPara && !aSel.nEndPos ) + if (!bReadOnly && !bSelection && aSel.end.nPara && !aSel.end.nIndex) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara ); - Paragraph* pPrev = pOwner->pParaList->GetParagraph( aSel.nEndPara-1 ); + Paragraph* pPara = pOwner->pParaList->GetParagraph(aSel.end.nPara); + Paragraph* pPrev = pOwner->pParaList->GetParagraph(aSel.end.nPara - 1); if( !pPrev->IsVisible() ) return true; if( !pPara->GetDepth() ) { - if(!pOwner->ImpCanDeleteSelectedPages(this, aSel.nEndPara , 1 ) ) + if (!pOwner->ImpCanDeleteSelectedPages(this, aSel.end.nPara, 1)) return true; } } @@ -185,26 +185,26 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra { // Special treatment: hard return at the end of a paragraph, // which has collapsed subparagraphs. - Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara ); + Paragraph* pPara = pOwner->pParaList->GetParagraph(aSel.end.nPara); if( !aKeyCode.IsShift() ) { // Don't let insert empty paragraph with numbering. Instead end numbering. if (pPara->GetDepth() > -1 && - pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) == 0) + pOwner->pEditEngine->GetTextLen( aSel.end.nPara ) == 0) { ToggleBullets(); return true; } // ImpGetCursor again??? if( !bSelection && - aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) ) + aSel.end.nIndex == pOwner->pEditEngine->GetTextLen( aSel.end.nPara ) ) { sal_Int32 nChildren = pOwner->pParaList->GetChildCount(pPara); if( nChildren && !pOwner->pParaList->HasVisibleChildren(pPara)) { pOwner->UndoActionStart( OLUNDO_INSERT ); - sal_Int32 nTemp = aSel.nEndPara; + sal_Int32 nTemp = aSel.end.nPara; nTemp += nChildren; nTemp++; // insert above next Non-Child SAL_WARN_IF( nTemp < 0, "editeng", "OutlinerView::PostKeyEvent - overflow"); @@ -212,7 +212,7 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra { pOwner->Insert( OUString(),nTemp,pPara->GetDepth()); // Position the cursor - ESelection aTmpSel(nTemp,0,nTemp,0); + ESelection aTmpSel(nTemp, 0); pEditView->SetSelection( aTmpSel ); } pEditView->ShowCursor(); @@ -223,15 +223,15 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra } if( !bKeyProcessed && !bSelection && !aKeyCode.IsShift() && aKeyCode.IsMod1() && - ( aSel.nEndPos == pOwner->pEditEngine->GetTextLen(aSel.nEndPara) ) ) + ( aSel.end.nIndex == pOwner->pEditEngine->GetTextLen(aSel.end.nPara) ) ) { pOwner->UndoActionStart( OLUNDO_INSERT ); - sal_Int32 nTemp = aSel.nEndPara; + sal_Int32 nTemp = aSel.end.nPara; nTemp++; pOwner->Insert( OUString(), nTemp, pPara->GetDepth()+1 ); // Position the cursor - ESelection aTmpSel(nTemp,0,nTemp,0); + ESelection aTmpSel(nTemp, 0); pEditView->SetSelection( aTmpSel ); pEditView->ShowCursor(); pOwner->UndoActionEnd(); @@ -248,7 +248,7 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra sal_Int32 OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget) { - sal_Int32 nPara = EE_PARA_NOT_FOUND; + sal_Int32 nPara = EE_PARA_MAX; Point aMousePosWin = pEditView->GetOutputDevice().PixelToLogic( rPosPix ); if( !pEditView->GetOutputArea().Contains( aMousePosWin ) ) @@ -328,7 +328,7 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) if ( bHasChildren && pOwner->pParaList->HasVisibleChildren(pPara) ) nEndPara += pOwner->pParaList->GetChildCount( pPara ); // The selection is inverted, so that EditEngine does not scroll - ESelection aSel(nEndPara, EE_TEXTPOS_ALL, nPara, 0 ); + ESelection aSel(nEndPara, EE_TEXTPOS_MAX, nPara, 0); pEditView->SetSelection( aSel ); } else if( rMEvt.GetClicks() == 2 && bHasChildren ) @@ -338,10 +338,10 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) } // special case for outliner view in impress, check if double click hits the page icon for toggle - if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->GetOutlinerMode() == OutlinerMode::OutlineView) && (eTarget == MouseTarget::Text) && (rMEvt.GetClicks() == 2) ) + if( (nPara == EE_PARA_MAX) && (pOwner->GetOutlinerMode() == OutlinerMode::OutlineView) && (eTarget == MouseTarget::Text) && (rMEvt.GetClicks() == 2) ) { ESelection aSel( pEditView->GetSelection() ); - nPara = aSel.nStartPara; + nPara = aSel.start.nPara; Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); if( (pPara && pOwner->pParaList->HasChildren(pPara)) && pPara->HasFlag(ParaFlag::ISPAGE) ) { @@ -375,7 +375,7 @@ void OutlinerView::ReleaseMouse() void OutlinerView::ImpToggleExpand( Paragraph const * pPara ) { sal_Int32 nPara = pOwner->pParaList->GetAbsPos( pPara ); - pEditView->SetSelection( ESelection( nPara, 0, nPara, 0 ) ); + pEditView->SetSelection(ESelection(nPara, 0)); ImplExpandOrCollaps( nPara, nPara, !pOwner->pParaList->HasVisibleChildren( pPara ) ); pEditView->ShowCursor(); } @@ -401,8 +401,8 @@ sal_Int16 OutlinerView::GetDepth() const { ESelection aESelection = GetSelection(); aESelection.Adjust(); - sal_Int16 nDepth = pOwner->GetDepth(aESelection.nStartPara); - for (sal_Int32 nPara = aESelection.nStartPara + 1; nPara <= aESelection.nEndPara; ++nPara) + sal_Int16 nDepth = pOwner->GetDepth(aESelection.start.nPara); + for (sal_Int32 nPara = aESelection.start.nPara + 1; nPara <= aESelection.end.nPara; ++nPara) { if (nDepth != pOwner->GetDepth(nPara)) return -2; @@ -440,7 +440,7 @@ void OutlinerView::SetAttribs( const SfxItemSet& rAttrs ) ParaRange OutlinerView::ImpGetSelectedParagraphs( bool bIncludeHiddenChildren ) { ESelection aSel = pEditView->GetSelection(); - ParaRange aParas( aSel.nStartPara, aSel.nEndPara ); + ParaRange aParas(aSel.start.nPara, aSel.end.nPara); aParas.Adjust(); // Record the invisible Children of the last Parents in the selection @@ -497,7 +497,7 @@ void OutlinerView::Indent( short nDiff ) pPara->SetFlag( ParaFlag::ISPAGE ); pOwner->DepthChangedHdl(pPara, nPrevFlags); - pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) ); + pOwner->pEditEngine->QuickMarkInvalid(ESelection(nPara, 0)); if( bUndo ) pOwner->InsertUndo( std::make_unique( pOwner, nPara, nPrevFlags, pPara->nFlags ) ); @@ -566,7 +566,7 @@ void OutlinerView::Indent( short nDiff ) else { // Needs at least a repaint... - pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) ); + pOwner->pEditEngine->QuickMarkInvalid(ESelection(nPara, 0)); } } @@ -790,8 +790,8 @@ sal_Int32 OutlinerView::ImpInitPaste( sal_Int32& rStart ) pOwner->bPasting = true; ESelection aSelection( pEditView->GetSelection() ); aSelection.Adjust(); - rStart = aSelection.nStartPara; - sal_Int32 nSize = aSelection.nEndPara - aSelection.nStartPara + 1; + rStart = aSelection.start.nPara; + sal_Int32 nSize = aSelection.end.nPara - aSelection.start.nPara + 1; return nSize; } @@ -814,11 +814,7 @@ bool OutlinerView::Command(const CommandEvent& rCEvt) void OutlinerView::SelectRange( sal_Int32 nFirst, sal_Int32 nCount ) { - sal_Int32 nLast = nFirst+nCount; - nCount = pOwner->pParaList->GetParagraphCount(); - if( nLast <= nCount ) - nLast = nCount - 1; - ESelection aSel( nFirst, 0, nLast, EE_TEXTPOS_ALL ); + ESelection aSel(nFirst, 0, nFirst + nCount, EE_TEXTPOS_MAX); pEditView->SetSelection( aSel ); } @@ -829,18 +825,18 @@ sal_Int32 OutlinerView::ImpCalcSelectedPages( bool bIncludeFirstSelected ) aSel.Adjust(); sal_Int32 nPages = 0; - sal_Int32 nFirstPage = EE_PARA_MAX_COUNT; - sal_Int32 nStartPara = aSel.nStartPara; + sal_Int32 nFirstPage = EE_PARA_MAX; + sal_Int32 nStartPara = aSel.start.nPara; if ( !bIncludeFirstSelected ) nStartPara++; // All paragraphs after StartPara will be deleted - for ( sal_Int32 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ ) + for (sal_Int32 nPara = nStartPara; nPara <= aSel.end.nPara; nPara++) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); assert(pPara && "ImpCalcSelectedPages: invalid Selection?"); if( pPara->HasFlag(ParaFlag::ISPAGE) ) { nPages++; - if( nFirstPage == EE_PARA_MAX_COUNT ) + if (nFirstPage == EE_PARA_MAX) nFirstPage = nPara; } } @@ -867,7 +863,7 @@ void OutlinerView::ToggleBullets() sal_Int16 nNewDepth = -2; const SvxNumRule* pDefaultBulletNumRule = nullptr; - for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; nPara++) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); @@ -920,10 +916,10 @@ void OutlinerView::ToggleBullets() } const sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount(); - pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); + pOwner->ImplCheckParagraphs(aSel.start.nPara, nParaCount); sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount; - pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nEndPara, 0 ) ); + pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.start.nPara, 0, nEndPara, 0)); pOwner->pEditEngine->SetUpdateLayout( bUpdate ); @@ -943,7 +939,7 @@ void OutlinerView::ToggleBulletsNumbering( if ( bToggle ) { bToggleOn = false; - const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.nStartPara, aSel.nEndPara ) ); + const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.start.nPara, aSel.end.nPara ) ); if ( nBulletNumberingStatus != 0 && bHandleBullets ) { // not all paragraphs have bullets and method called to toggle bullets --> bullets on @@ -977,7 +973,7 @@ void OutlinerView::EnsureNumberingIsOn() const bool bUpdate = pOwner->pEditEngine->IsUpdateLayout(); pOwner->pEditEngine->SetUpdateLayout(false); - for (sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++) + for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; nPara++) { Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara); DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?"); @@ -987,10 +983,10 @@ void OutlinerView::EnsureNumberingIsOn() } sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount(); - pOwner->ImplCheckParagraphs(aSel.nStartPara, nParaCount); + pOwner->ImplCheckParagraphs(aSel.start.nPara, nParaCount); const sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount; - pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.nStartPara, 0, nEndPara, 0)); + pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.start.nPara, 0, nEndPara, 0)); pOwner->pEditEngine->SetUpdateLayout(bUpdate); @@ -1017,8 +1013,8 @@ void OutlinerView::ApplyBulletsNumbering( { ESelection aSel( pEditView->GetSelection() ); aSel.Adjust(); - nStartPara = aSel.nStartPara; - nEndPara = aSel.nEndPara; + nStartPara = aSel.start.nPara; + nEndPara = aSel.end.nPara; } else { @@ -1135,8 +1131,8 @@ void OutlinerView::SwitchOffBulletsNumbering( { ESelection aSel( pEditView->GetSelection() ); aSel.Adjust(); - nStartPara = aSel.nStartPara; - nEndPara = aSel.nEndPara; + nStartPara = aSel.start.nPara; + nEndPara = aSel.end.nPara; } else { @@ -1193,7 +1189,7 @@ void OutlinerView::RemoveAttribs( bool bRemoveParaAttribs, bool bKeepLanguages ) // Loop through all paragraphs and set indentation and level ESelection aSel = pEditView->GetSelection(); aSel.Adjust(); - for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; nPara++) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); pOwner->ImplInitDepth( nPara, pPara->GetDepth(), false ); @@ -1414,8 +1410,8 @@ void OutlinerView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueItera pEditView->Read( rInput, eFormat, pHTTPHeaderAttrs ); tools::Long nParaDiff = pEditView->getEditEngine().GetParagraphCount() - nOldParaCount; - sal_Int32 nChangesStart = aOldSel.nStartPara; - sal_Int32 nChangesEnd = nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara); + sal_Int32 nChangesStart = aOldSel.start.nPara; + sal_Int32 nChangesEnd = nChangesStart + nParaDiff + (aOldSel.end.nPara-aOldSel.start.nPara); for ( sal_Int32 n = nChangesStart; n <= nChangesEnd; n++ ) { @@ -1505,7 +1501,7 @@ bool GetStatusValueForThesaurusFromContext( if (!isSingleScriptType(rEditEngine.GetScriptType(aTextSel))) return false; - LanguageType nLang = rEditEngine.GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos ).nLang; + LanguageType nLang = rEditEngine.GetLanguage(aTextSel.start.nPara, aTextSel.start.nIndex).nLang; OUString aLangText( LanguageTag::convertToBcp47( nLang ) ); // set word and locale to look up as status value diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx index 0a17cd609100..b54706b9f059 100644 --- a/editeng/source/outliner/overflowingtxt.cxx +++ b/editeng/source/outliner/overflowingtxt.cxx @@ -126,9 +126,9 @@ bool NonOverflowingText::IsLastParaInterrupted() const std::optional NonOverflowingText::RemoveOverflowingText(Outliner *pOutliner) const { pOutliner->QuickDelete(maContentSel); - SAL_INFO("editeng.chaining", "Deleting selection from (Para: " << maContentSel.nStartPara - << ", Pos: " << maContentSel.nStartPos << ") to (Para: " << maContentSel.nEndPara - << ", Pos: " << maContentSel.nEndPos << ")"); + SAL_INFO("editeng.chaining", "Deleting selection from (Para: " << maContentSel.start.nPara + << ", Pos: " << maContentSel.start.nIndex << ") to (Para: " << maContentSel.end.nPara + << ", Pos: " << maContentSel.end.nIndex << ")"); return pOutliner->CreateParaObject(); } @@ -137,7 +137,7 @@ ESelection NonOverflowingText::GetOverflowPointSel() const //return getLastPositionSel(mpContentTextObj); // return the starting point of the selection we are removing - return ESelection(maContentSel.nStartPara, maContentSel.nStartPos); //XXX + return ESelection(maContentSel.start); //XXX } // The equivalent of ToParaObject for OverflowingText. Here we are prepending the overflowing text to the old dest box's text diff --git a/editeng/source/outliner/paralist.cxx b/editeng/source/outliner/paralist.cxx index 5b9f21449854..d25a00b18207 100644 --- a/editeng/source/outliner/paralist.cxx +++ b/editeng/source/outliner/paralist.cxx @@ -97,15 +97,15 @@ void ParagraphList::Clear() void ParagraphList::Append( std::unique_ptr pPara) { - SAL_WARN_IF( maEntries.size() >= EE_PARA_MAX_COUNT, "editeng", "ParagraphList::Append - overflow"); + SAL_WARN_IF( maEntries.size() >= EE_PARA_MAX, "editeng", "ParagraphList::Append - overflow"); maEntries.push_back(std::move(pPara)); } void ParagraphList::Insert( std::unique_ptr pPara, sal_Int32 nAbsPos) { - SAL_WARN_IF( nAbsPos < 0 || (maEntries.size() < o3tl::make_unsigned(nAbsPos) && nAbsPos != EE_PARA_APPEND), + SAL_WARN_IF( nAbsPos < 0 || (maEntries.size() < o3tl::make_unsigned(nAbsPos) && nAbsPos != EE_PARA_MAX), "editeng", "ParagraphList::Insert - bad insert position " << nAbsPos); - SAL_WARN_IF( maEntries.size() >= EE_PARA_MAX_COUNT, "editeng", "ParagraphList::Insert - overflow"); + SAL_WARN_IF( maEntries.size() >= EE_PARA_MAX, "editeng", "ParagraphList::Insert - overflow"); if (nAbsPos < 0 || maEntries.size() <= o3tl::make_unsigned(nAbsPos)) Append( std::move(pPara) ); @@ -242,7 +242,7 @@ sal_Int32 ParagraphList::GetAbsPos( Paragraph const * pParent ) const ++pos; } - return EE_PARA_NOT_FOUND; + return EE_PARA_MAX; } void ParagraphList::dumpAsXml(xmlTextWriterPtr pWriter) const diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx index 304acd50de13..12a67e1353fe 100644 --- a/editeng/source/uno/unoedhlp.cxx +++ b/editeng/source/uno/unoedhlp.cxx @@ -160,7 +160,7 @@ void SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE if ( !bInCell ) return; - EPosition aStartPos( nPara, nStartIndex ), aEndPos( nPara, nEndIndex ); + EPaM aStartPos(nPara, nStartIndex), aEndPos(nPara, nEndIndex); sal_Int32 nParaCount = rEE.GetParagraphCount(); sal_Int32 nCrrntParaLen = rEE.GetTextLen(nPara); //need to find closest index in front of nIndex in the previous paragraphs diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 8a0c6bd07445..a99039cbe780 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -186,7 +186,7 @@ void SvxAccessibleTextIndex::SetEEIndex( sal_Int32 nEEIndex, const SvxTextForwar EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() ); // any text bullets? - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType != SVX_NUM_BITMAP ) { @@ -232,7 +232,7 @@ void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() ); // any text bullets? - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType != SVX_NUM_BITMAP ) { @@ -431,12 +431,11 @@ OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); // normalize selection - if( rSel.nStartPara > rSel.nEndPara || - (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) ) + if (!rSel.IsAdjusted()) { std::swap( aStartIndex, aEndIndex ); } @@ -495,8 +494,8 @@ SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, EditEng SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); return mpTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex), nOnlyHardAttrib ); } @@ -547,8 +546,8 @@ SfxItemState SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); return mpTextForwarder->GetItemState( MakeEESelection(aStartIndex, aEndIndex), nWhich ); @@ -568,8 +567,8 @@ void SvxAccessibleTextAdapter::QuickInsertText( const OUString& rText, const ESe SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); mpTextForwarder->QuickInsertText( rText, MakeEESelection(aStartIndex, aEndIndex) ); @@ -582,8 +581,8 @@ void SvxAccessibleTextAdapter::QuickInsertField( const SvxFieldItem& rFld, const SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); mpTextForwarder->QuickInsertField( rFld, MakeEESelection(aStartIndex, aEndIndex) ); @@ -596,8 +595,8 @@ void SvxAccessibleTextAdapter::QuickSetAttribs( const SfxItemSet& rSet, const ES SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); mpTextForwarder->QuickSetAttribs( rSet, MakeEESelection(aStartIndex, aEndIndex) ); @@ -610,8 +609,8 @@ void SvxAccessibleTextAdapter::QuickInsertLineBreak( const ESelection& rSel ) SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); mpTextForwarder->QuickInsertLineBreak( MakeEESelection(aStartIndex, aEndIndex) ); } @@ -745,7 +744,7 @@ tools::Rectangle SvxAccessibleTextAdapter::GetParaBounds( sal_Int32 nPara ) cons EBulletInfo aBulletInfo = GetBulletInfo( nPara ); - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType != SVX_NUM_BITMAP ) { @@ -792,7 +791,7 @@ bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32& EBulletInfo aBulletInfo = GetBulletInfo( nPara ); // any text bullets? - if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + if( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType != SVX_NUM_BITMAP ) { @@ -993,8 +992,8 @@ bool SvxAccessibleTextAdapter::Delete( const ESelection& rSel ) SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); return mpTextForwarder->Delete( MakeEESelection(aStartIndex, aEndIndex ) ); } @@ -1006,8 +1005,8 @@ bool SvxAccessibleTextAdapter::InsertText( const OUString& rStr, const ESelectio SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); return mpTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) ); } @@ -1049,7 +1048,7 @@ bool SvxAccessibleTextAdapter::HaveImageBullet( sal_Int32 nPara ) const { EBulletInfo aBulletInfo = GetBulletInfo( nPara ); - return ( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + return ( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType == SVX_NUM_BITMAP ); } @@ -1058,7 +1057,7 @@ bool SvxAccessibleTextAdapter::HaveTextBullet( sal_Int32 nPara ) const { EBulletInfo aBulletInfo = GetBulletInfo( nPara ); - return ( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && + return ( aBulletInfo.nParagraph != EE_PARA_MAX && aBulletInfo.bVisible && aBulletInfo.nType != SVX_NUM_BITMAP ); } @@ -1068,12 +1067,11 @@ bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel ) const SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *this ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *this ); // normalize selection - if( rSel.nStartPara > rSel.nEndPara || - (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) ) + if (!rSel.IsAdjusted()) { std::swap( aStartIndex, aEndIndex ); } @@ -1148,8 +1146,8 @@ bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mpTextForwarder ); - aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mpTextForwarder ); + aStartIndex.SetEEIndex( aSelection.start.nPara, aSelection.start.nIndex, *mpTextForwarder ); + aEndIndex.SetEEIndex( aSelection.end.nPara, aSelection.end.nIndex, *mpTextForwarder ); DBG_ASSERT(aStartIndex.GetIndex() >= 0 && aEndIndex.GetIndex() >= 0, @@ -1168,8 +1166,8 @@ bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel ) SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *mpTextForwarder ); - aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *mpTextForwarder ); + aStartIndex.SetIndex( rSel.start.nPara, rSel.start.nIndex, *mpTextForwarder ); + aEndIndex.SetIndex( rSel.end.nPara, rSel.end.nIndex, *mpTextForwarder ); return mpViewForwarder->SetSelection( MakeEESelection(aStartIndex, aEndIndex) ); } diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index 0c4acc7c4541..c8728c6255a5 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -63,7 +63,7 @@ OUString SvxEditEngineForwarder::GetText( const ESelection& rSel ) const SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const { - if( rSel.nStartPara == rSel.nEndPara ) + if (rSel.start.nPara == rSel.end.nPara) { GetAttribsFlags nFlags = GetAttribsFlags::NONE; switch( nOnlyHardAttrib ) @@ -78,7 +78,7 @@ SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, EditEngin OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs"); } - return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags ); + return rEditEngine.GetAttribs( rSel.start.nPara, rSel.start.nIndex, rSel.end.nIndex, nFlags ); } else { @@ -184,17 +184,17 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES SfxItemState eState = SfxItemState::DEFAULT; // check all paragraphs inside the selection - for( sal_Int32 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ ) + for (sal_Int32 nPara = rSel.start.nPara; nPara <= rSel.end.nPara; nPara++) { SfxItemState eParaState = SfxItemState::DEFAULT; // calculate start and endpos for this paragraph sal_Int32 nPos = 0; - if( rSel.nStartPara == nPara ) - nPos = rSel.nStartPos; + if (rSel.start.nPara == nPara) + nPos = rSel.start.nIndex; - sal_Int32 nEndPos = rSel.nEndPos; - if( rSel.nEndPara != nPara ) + sal_Int32 nEndPos = rSel.end.nIndex; + if (rSel.end.nPara != nPara) nEndPos = rEditEngine.GetTextLen( nPara ); @@ -313,7 +313,7 @@ tools::Rectangle SvxEditEngineForwarder::GetCharBounds( sal_Int32 nPara, sal_Int if( nIndex ) { // use last character, if possible - aLast = rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex-1) ); + aLast = rEditEngine.GetCharacterBounds(EPaM(nPara, nIndex - 1)); // move at end of this last character, make one pixel wide aLast.Move( aLast.Right() - aLast.Left(), 0 ); @@ -339,7 +339,7 @@ tools::Rectangle SvxEditEngineForwarder::GetCharBounds( sal_Int32 nPara, sal_Int } else { - return SvxEditSourceHelper::EEToUserSpace( rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex) ), + return SvxEditSourceHelper::EEToUserSpace( rEditEngine.GetCharacterBounds( EPaM(nPara, nIndex) ), aSize, bIsVertical ); } } @@ -391,7 +391,7 @@ bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPar aSize, rEditEngine.IsEffectivelyVertical() )); - EPosition aDocPos = rEditEngine.FindDocPosition( aEEPos ); + EPaM aDocPos = rEditEngine.FindDocPosition(aEEPos); nPara = aDocPos.nPara; nIndex = aDocPos.nIndex; @@ -403,11 +403,11 @@ bool SvxEditEngineForwarder::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, { ESelection aRes = rEditEngine.GetWord( ESelection(nPara, nIndex, nPara, nIndex), css::i18n::WordType::DICTIONARY_WORD ); - if( aRes.nStartPara == nPara && - aRes.nStartPara == aRes.nEndPara ) + if( aRes.start.nPara == nPara && + aRes.start.nPara == aRes.end.nPara ) { - nStart = aRes.nStartPos; - nEnd = aRes.nEndPos; + nStart = aRes.start.nIndex; + nEnd = aRes.end.nIndex; return true; } @@ -502,7 +502,7 @@ sal_Int32 SvxEditEngineForwarder::AppendTextPortion( sal_Int32 nPara, const OUSt if (0 <= nPara && nPara < nParaCount) { nLen = rEditEngine.GetTextLen( nPara ); - rEditEngine.QuickInsertText( rText, ESelection( nPara, nLen, nPara, nLen ) ); + rEditEngine.QuickInsertText(rText, ESelection(nPara, nLen)); } return nLen; diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index 43aaabffc536..fe56a08e9086 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -69,7 +69,7 @@ OUString SvxOutlinerForwarder::GetText( const ESelection& rSel ) const static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib, EditEngine& rEditEngine ) { - if( rSel.nStartPara == rSel.nEndPara ) + if (rSel.start.nPara == rSel.end.nPara) { GetAttribsFlags nFlags = GetAttribsFlags::NONE; @@ -84,7 +84,7 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditE default: OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs"); } - return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags ); + return rEditEngine.GetAttribs( rSel.start.nPara, rSel.start.nIndex, rSel.end.nIndex, nFlags ); } else { @@ -121,7 +121,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA maAttribCacheSelection = rSel; } - SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( rSel.nStartPara ); + SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet(rSel.start.nPara); if( pStyle ) aSet.SetParent( &(pStyle->GetItemSet() ) ); @@ -299,7 +299,7 @@ tools::Rectangle SvxOutlinerForwarder::GetCharBounds( sal_Int32 nPara, sal_Int32 if( nIndex ) { // use last character, if possible - aLast = rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex-1) ); + aLast = rOutliner.GetEditEngine().GetCharacterBounds(EPaM(nPara, nIndex - 1)); // move at end of this last character, make one pixel wide aLast.Move( aLast.Right() - aLast.Left(), 0 ); @@ -325,7 +325,7 @@ tools::Rectangle SvxOutlinerForwarder::GetCharBounds( sal_Int32 nPara, sal_Int32 } else { - return SvxEditSourceHelper::EEToUserSpace( rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex) ), + return SvxEditSourceHelper::EEToUserSpace( rOutliner.GetEditEngine().GetCharacterBounds( EPaM(nPara, nIndex) ), aSize, bIsVertical ); } } @@ -356,7 +356,7 @@ bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPara, aSize, rOutliner.IsVertical() )); - EPosition aDocPos = rOutliner.GetEditEngine().FindDocPosition( aEEPos ); + EPaM aDocPos = rOutliner.GetEditEngine().FindDocPosition(aEEPos); nPara = aDocPos.nPara; nIndex = aDocPos.nIndex; @@ -366,13 +366,13 @@ bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPara, bool SvxOutlinerForwarder::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const { - ESelection aRes = rOutliner.GetEditEngine().GetWord( ESelection(nPara, nIndex, nPara, nIndex), css::i18n::WordType::DICTIONARY_WORD ); + ESelection aRes = rOutliner.GetEditEngine().GetWord( ESelection(nPara, nIndex), css::i18n::WordType::DICTIONARY_WORD ); - if( aRes.nStartPara == nPara && - aRes.nStartPara == aRes.nEndPara ) + if( aRes.start.nPara == nPara && + aRes.start.nPara == aRes.end.nPara ) { - nStart = aRes.nStartPos; - nEnd = aRes.nEndPos; + nStart = aRes.start.nIndex; + nEnd = aRes.end.nIndex; return true; } @@ -544,7 +544,7 @@ sal_Int32 SvxOutlinerForwarder::AppendTextPortion( sal_Int32 nPara, const OUStri if (0 <= nPara && nPara < nParaCount) { nLen = rEditEngine.GetTextLen( nPara ); - rEditEngine.QuickInsertText( rText, ESelection( nPara, nLen, nPara, nLen ) ); + rEditEngine.QuickInsertText(rText, ESelection(nPara, nLen)); } return nLen; diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 8bc101e5c2ed..6f149cdc67e1 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -60,10 +60,10 @@ namespace { ESelection toESelection(const text::TextRangeSelection& rSel) { ESelection aESel; - aESel.nStartPara = rSel.Start.Paragraph; - aESel.nStartPos = rSel.Start.PositionInParagraph; - aESel.nEndPara = rSel.End.Paragraph; - aESel.nEndPos = rSel.End.PositionInParagraph; + aESel.start.nPara = rSel.Start.Paragraph; + aESel.start.nIndex = rSel.Start.PositionInParagraph; + aESel.end.nPara = rSel.End.Paragraph; + aESel.end.nIndex = rSel.End.PositionInParagraph; return aESel; } @@ -151,7 +151,7 @@ void CheckSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarde if( !pForwarder ) return; - if( rSel.nStartPara == EE_PARA_MAX_COUNT ) + if (rSel.start.nPara == EE_PARA_MAX) { ::GetSelection( rSel, pForwarder ); } @@ -161,35 +161,31 @@ void CheckSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarde GetSelection( aMaxSelection, pForwarder ); // check start position - if( rSel.nStartPara < aMaxSelection.nStartPara ) + if (rSel.start.nPara < aMaxSelection.start.nPara) { - rSel.nStartPara = aMaxSelection.nStartPara; - rSel.nStartPos = aMaxSelection.nStartPos; + rSel.start = aMaxSelection.start; } - else if( rSel.nStartPara > aMaxSelection.nEndPara ) + else if (rSel.start.nPara > aMaxSelection.end.nPara) { - rSel.nStartPara = aMaxSelection.nEndPara; - rSel.nStartPos = aMaxSelection.nEndPos; + rSel.start = aMaxSelection.end; } - else if( rSel.nStartPos > pForwarder->GetTextLen( rSel.nStartPara ) ) + else if (rSel.start.nIndex > pForwarder->GetTextLen(rSel.start.nPara)) { - rSel.nStartPos = pForwarder->GetTextLen( rSel.nStartPara ); + rSel.start.nIndex = pForwarder->GetTextLen(rSel.start.nPara); } // check end position - if( rSel.nEndPara < aMaxSelection.nStartPara ) + if (rSel.end.nPara < aMaxSelection.start.nPara) { - rSel.nEndPara = aMaxSelection.nStartPara; - rSel.nEndPos = aMaxSelection.nStartPos; + rSel.end = aMaxSelection.start; } - else if( rSel.nEndPara > aMaxSelection.nEndPara ) + else if (rSel.end.nPara > aMaxSelection.end.nPara) { - rSel.nEndPara = aMaxSelection.nEndPara; - rSel.nEndPos = aMaxSelection.nEndPos; + rSel.end = aMaxSelection.end; } - else if( rSel.nEndPos > pForwarder->GetTextLen( rSel.nEndPara ) ) + else if (rSel.end.nIndex > pForwarder->GetTextLen(rSel.end.nPara)) { - rSel.nEndPos = pForwarder->GetTextLen( rSel.nEndPara ); + rSel.end.nIndex = pForwarder->GetTextLen(rSel.end.nPara); } } } @@ -270,7 +266,7 @@ void SvxUnoTextRangeBase::SetEditSource( SvxEditSource* pSource ) noexcept mpEditSource.reset( pSource ); - maSelection.nStartPara = EE_PARA_MAX_COUNT; + maSelection.start.nPara = EE_PARA_MAX; if( mpEditSource ) mpEditSource->addRange( this ); @@ -320,8 +316,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart() xRange = pRange; ESelection aNewSel = maSelection; - aNewSel.nEndPara = aNewSel.nStartPara; - aNewSel.nEndPos = aNewSel.nStartPos; + aNewSel.CollapseToStart(); pRange->SetSelection( aNewSel ); } @@ -348,8 +343,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd() xRet = pNew; ESelection aNewSel = maSelection; - aNewSel.nStartPara = aNewSel.nEndPara; - aNewSel.nStartPos = aNewSel.nEndPos; + aNewSel.CollapseToEnd(); pNew->SetSelection( aNewSel ); } return xRet; @@ -439,8 +433,8 @@ void SvxUnoTextRangeBase::_setPropertyValue( const OUString& PropertyName, const if( nPara == -1 ) { - nPara = aSel.nStartPara; - nEndPara = aSel.nEndPara; + nPara = aSel.start.nPara; + nEndPara = aSel.end.nPara; } else { @@ -471,8 +465,8 @@ void SvxUnoTextRangeBase::_setPropertyValue( const OUString& PropertyName, const if( nPara == -1 ) { - nPara = aSel.nStartPara; - nEndPara = aSel.nEndPara; + nPara = aSel.start.nPara; + nEndPara = aSel.end.nPara; } else { @@ -542,7 +536,7 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry* if( aValue >>= nLevel ) { // #101004# Call interface method instead of unsafe cast - if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) ) + if (!pForwarder->SetDepth(pSelection->start.nPara, nLevel)) throw lang::IllegalArgumentException(); // If valid, then not yet finished. Also needs to be added to paragraph props. @@ -559,7 +553,7 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry* sal_Int16 nStartValue = -1; if( aValue >>= nStartValue ) { - pForwarder->SetNumberingStartValue( pSelection->nStartPara, nStartValue ); + pForwarder->SetNumberingStartValue(pSelection->start.nPara, nStartValue); return true; } } @@ -573,7 +567,7 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry* bool bParaIsNumberingRestart = false; if( aValue >>= bParaIsNumberingRestart ) { - pForwarder->SetParaIsNumberingRestart( pSelection->nStartPara, bParaIsNumberingRestart ); + pForwarder->SetParaIsNumberingRestart( pSelection->start.nPara, bParaIsNumberingRestart ); return true; } } @@ -604,10 +598,10 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& Property { const ESelection& rSel = GetSelection(); text::TextRangeSelection aSel; - aSel.Start.Paragraph = rSel.nStartPara; - aSel.Start.PositionInParagraph = rSel.nStartPos; - aSel.End.Paragraph = rSel.nEndPara; - aSel.End.PositionInParagraph = rSel.nEndPos; + aSel.Start.Paragraph = rSel.start.nPara; + aSel.Start.PositionInParagraph = rSel.start.nIndex; + aSel.End.Paragraph = rSel.end.nPara; + aSel.End.PositionInParagraph = rSel.end.nIndex; return uno::Any(aSel); } @@ -662,7 +656,7 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertyMapEntry* pMap, std::optional pFldLineStyle; SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder(); - OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor, pFldLineStyle ) ); + OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.start.nPara, maSelection.start.nIndex, pTColor, pFColor, pFldLineStyle ) ); uno::Reference< text::XTextField > xField( new SvxUnoTextField( xAnchor, aPresentation, pData ) ); rAny <<= xField; @@ -682,7 +676,7 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertyMapEntry* pMap, case WID_PARASTYLENAME: { - rAny <<= GetEditSource()->GetTextForwarder()->GetStyleSheet(maSelection.nStartPara); + rAny <<= GetEditSource()->GetTextForwarder()->GetStyleSheet(maSelection.start.nPara); } break; @@ -727,7 +721,7 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons if (!pForwarder->SupportsOutlineDepth()) return false; - sal_Int16 nLevel = pForwarder->GetDepth( pSelection->nStartPara ); + sal_Int16 nLevel = pForwarder->GetDepth(pSelection->start.nPara); if( nLevel >= 0 ) aAny <<= nLevel; } @@ -737,14 +731,14 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons { SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr; if(pForwarder && pSelection) - aAny <<= pForwarder->GetNumberingStartValue( pSelection->nStartPara ); + aAny <<= pForwarder->GetNumberingStartValue(pSelection->start.nPara); } break; case WID_PARAISNUMBERINGRESTART: { SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr; if(pForwarder && pSelection) - aAny <<= pForwarder->IsParaIsNumberingRestart( pSelection->nStartPara ); + aAny <<= pForwarder->IsParaIsNumberingRestart(pSelection->start.nPara); } break; @@ -806,8 +800,8 @@ void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& a if( nTempPara == -1 ) { - nTempPara = aSel.nStartPara; - nEndPara = aSel.nEndPara; + nTempPara = aSel.start.nPara; + nEndPara = aSel.end.nPara; } std::optional pOldAttrSet; @@ -1293,11 +1287,11 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, co } else if( pMap->nWID == WID_NUMBERINGSTARTVALUE ) { - pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 ); + pForwarder->SetNumberingStartValue(maSelection.start.nPara, -1); } else if( pMap->nWID == WID_PARAISNUMBERINGRESTART ) { - pForwarder->SetParaIsNumberingRestart( maSelection.nStartPara, false ); + pForwarder->SetParaIsNumberingRestart(maSelection.start.nPara, false); } else { @@ -1403,24 +1397,21 @@ void SvxUnoTextRangeBase::CollapseToStart() noexcept { CheckSelection( maSelection, mpEditSource.get() ); - maSelection.nEndPara = maSelection.nStartPara; - maSelection.nEndPos = maSelection.nStartPos; + maSelection.CollapseToStart(); } void SvxUnoTextRangeBase::CollapseToEnd() noexcept { CheckSelection( maSelection, mpEditSource.get() ); - maSelection.nStartPara = maSelection.nEndPara; - maSelection.nStartPos = maSelection.nEndPos; + maSelection.CollapseToEnd(); } bool SvxUnoTextRangeBase::IsCollapsed() noexcept { CheckSelection( maSelection, mpEditSource.get() ); - return ( maSelection.nStartPara == maSelection.nEndPara && - maSelection.nStartPos == maSelection.nEndPos ); + return !maSelection.HasRange(); } bool SvxUnoTextRangeBase::GoLeft(sal_Int32 nCount, bool Expand) noexcept @@ -1428,8 +1419,8 @@ bool SvxUnoTextRangeBase::GoLeft(sal_Int32 nCount, bool Expand) noexcept CheckSelection( maSelection, mpEditSource.get() ); // #75098# use end position, as in Writer (start is anchor, end is cursor) - sal_Int32 nNewPos = maSelection.nEndPos; - sal_Int32 nNewPar = maSelection.nEndPara; + sal_Int32 nNewPos = maSelection.end.nIndex; + sal_Int32 nNewPar = maSelection.end.nPara; bool bOk = true; SvxTextForwarder* pForwarder = nullptr; @@ -1451,8 +1442,8 @@ bool SvxUnoTextRangeBase::GoLeft(sal_Int32 nCount, bool Expand) noexcept if ( bOk ) { nNewPos = nNewPos - nCount; - maSelection.nStartPara = nNewPar; - maSelection.nStartPos = nNewPos; + maSelection.start.nPara = nNewPar; + maSelection.start.nIndex = nNewPos; } if (!Expand) @@ -1471,8 +1462,8 @@ bool SvxUnoTextRangeBase::GoRight(sal_Int32 nCount, bool Expand) noexcept CheckSelection( maSelection, pForwarder ); - sal_Int32 nNewPos = maSelection.nEndPos + nCount; - sal_Int32 nNewPar = maSelection.nEndPara; + sal_Int32 nNewPos = maSelection.end.nIndex + nCount; + sal_Int32 nNewPar = maSelection.end.nPara; bool bOk = true; sal_Int32 nParCount = pForwarder->GetParagraphCount(); @@ -1491,8 +1482,8 @@ bool SvxUnoTextRangeBase::GoRight(sal_Int32 nCount, bool Expand) noexcept if (bOk) { - maSelection.nEndPara = nNewPar; - maSelection.nEndPos = nNewPos; + maSelection.end.nPara = nNewPar; + maSelection.end.nIndex = nNewPos; } if (!Expand) @@ -1503,8 +1494,8 @@ bool SvxUnoTextRangeBase::GoRight(sal_Int32 nCount, bool Expand) noexcept void SvxUnoTextRangeBase::GotoStart(bool Expand) noexcept { - maSelection.nStartPara = 0; - maSelection.nStartPos = 0; + maSelection.start.nPara = 0; + maSelection.start.nIndex = 0; if (!Expand) CollapseToStart(); @@ -1522,8 +1513,8 @@ void SvxUnoTextRangeBase::GotoEnd(bool Expand) noexcept if (nPar) --nPar; - maSelection.nEndPara = nPar; - maSelection.nEndPos = pForwarder->GetTextLen( nPar ); + maSelection.end.nPara = nPar; + maSelection.end.nIndex = pForwarder->GetTextLen(nPar); if (!Expand) CollapseToEnd(); @@ -1559,17 +1550,7 @@ sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionStarts( const uno::Referenc const ESelection& r1 = pR1->maSelection; const ESelection& r2 = pR2->maSelection; - if( r1.nStartPara == r2.nStartPara ) - { - if( r1.nStartPos == r2.nStartPos ) - return 0; - else - return r1.nStartPos < r2.nStartPos ? 1 : -1; - } - else - { - return r1.nStartPara < r2.nStartPara ? 1 : -1; - } + return r1.start == r2.start ? 0 : r1.start < r2.start ? 1 : -1; } sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) @@ -1583,17 +1564,7 @@ sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< const ESelection& r1 = pR1->maSelection; const ESelection& r2 = pR2->maSelection; - if( r1.nEndPara == r2.nEndPara ) - { - if( r1.nEndPos == r2.nEndPos ) - return 0; - else - return r1.nEndPos < r2.nEndPos ? 1 : -1; - } - else - { - return r1.nEndPara < r2.nEndPara ? 1 : -1; - } + return r1.end == r2.end ? 0 : r1.end < r2.end ? 1 : -1; } SvxUnoTextRange::SvxUnoTextRange(const SvxUnoTextBase& rParent, bool bPortion /* = false */) @@ -1856,21 +1827,19 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text { pForwarder->QuickInsertText( u""_ustr, aRange ); - aRange.nEndPos = aRange.nStartPos; - aRange.nEndPara = aRange.nStartPara; + aRange.CollapseToStart(); } else { - aRange.nStartPara = aRange.nEndPara; - aRange.nStartPos = aRange.nEndPos; + aRange.CollapseToEnd(); } pForwarder->QuickInsertLineBreak( aRange ); GetEditSource()->UpdateData(); - aRange.nEndPos += 1; + aRange.end.nIndex += 1; if( !bAbsorb ) - aRange.nStartPos += 1; + aRange.start.nIndex += 1; pRange->SetSelection( aRange ); } @@ -1884,19 +1853,18 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text ESelection aRange = pRange->GetSelection(); // ESelection aOldSelection = aRange; - aRange.nStartPos = pForwarder->GetTextLen( aRange.nStartPara ); + aRange.start.nIndex = pForwarder->GetTextLen( aRange.start.nPara ); - aRange.nEndPara = aRange.nStartPara; - aRange.nEndPos = aRange.nStartPos; + aRange.CollapseToStart(); pRange->SetSelection( aRange ); static constexpr OUStringLiteral CR = u"\x0D"; pRange->setString( CR ); - aRange.nStartPos = 0; - aRange.nStartPara += 1; - aRange.nEndPos = 0; - aRange.nEndPara += 1; + aRange.start.nIndex = 0; + aRange.start.nPara += 1; + aRange.end.nIndex = 0; + aRange.end.nPara += 1; pRange->SetSelection( aRange ); @@ -1995,7 +1963,7 @@ uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumera if (!GetEditSource()) return uno::Reference< container::XEnumeration >(); - if( maSelection == ESelection(0,0,0,0) || maSelection == ESelection(EE_PARA_MAX_COUNT,0,0,0) ) + if (maSelection == ESelection(0, 0, 0, 0) || maSelection == ESelection(EE_PARA_MAX, 0, 0, 0)) { ESelection aSelection; ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() ); @@ -2114,7 +2082,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph( // set properties for the previously last paragraph sal_Int32 nPara = nParaCount - 1; - ESelection aSel( nPara, 0, nPara, 0 ); + ESelection aSel(nPara, 0); SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() ); SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps, ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(), pTextForwarder, nPara ); @@ -2157,7 +2125,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion( SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() ); SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps, - ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, aSelection.nStartPara ); + ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, aSelection.start.nPara ); pTextForwarder->QuickSetAttribs( aItemSet, aSelection); rtl::Reference pNewRange = new SvxUnoTextRange( *this ); xRet = pNewRange; diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index d56981cc5ece..520aa65c74bf 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -51,18 +51,18 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase return; const SvxTextForwarder* pTextForwarder = rText.GetEditSource()->GetTextForwarder(); - const sal_Int32 maxParaIndex = std::min( rSel.nEndPara + 1, pTextForwarder->GetParagraphCount() ); + const sal_Int32 maxParaIndex = std::min( rSel.end.nPara + 1, pTextForwarder->GetParagraphCount() ); - for( sal_Int32 currentPara = rSel.nStartPara; currentPara < maxParaIndex; currentPara++ ) + for (sal_Int32 currentPara = rSel.start.nPara; currentPara < maxParaIndex; currentPara++) { const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() ); rtl::Reference pContent; sal_Int32 nStartPos = 0; sal_Int32 nEndPos = pTextForwarder->GetTextLen( currentPara ); - if( currentPara == rSel.nStartPara ) - nStartPos = std::max(nStartPos, rSel.nStartPos); - if( currentPara == rSel.nEndPara ) - nEndPos = std::min(nEndPos, rSel.nEndPos); + if (currentPara == rSel.start.nPara) + nStartPos = std::max(nStartPos, rSel.start.nIndex); + if (currentPara == rSel.end.nPara) + nEndPos = std::min(nEndPos, rSel.end.nIndex); ESelection aCurrentParaSel( currentPara, nStartPos, currentPara, nEndPos ); for (auto const& elemRange : rRanges) { @@ -374,24 +374,24 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rPa if (rParentText.GetEditSource()) mpEditSource = rParentText.GetEditSource()->Clone(); - if( !(mpEditSource && mpEditSource->GetTextForwarder() && (nParagraph == rSel.nStartPara && nParagraph == rSel.nEndPara)) ) + if( !(mpEditSource && mpEditSource->GetTextForwarder() && (nParagraph == rSel.start.nPara && nParagraph == rSel.end.nPara)) ) return; std::vector aPortions; mpEditSource->GetTextForwarder()->GetPortions( nParagraph, aPortions ); for( size_t aPortionIndex = 0; aPortionIndex < aPortions.size(); aPortionIndex++ ) { - sal_uInt16 nStartPos = 0; + sal_Int32 nStartPos = 0; if ( aPortionIndex > 0 ) nStartPos = aPortions.at( aPortionIndex - 1 ); - if( nStartPos > rSel.nEndPos ) + if (nStartPos > rSel.end.nIndex) continue; - sal_uInt16 nEndPos = aPortions.at( aPortionIndex ); - if( nEndPos < rSel.nStartPos ) + sal_Int32 nEndPos = aPortions.at(aPortionIndex); + if (nEndPos < rSel.start.nIndex) continue; - nStartPos = std::max(nStartPos, rSel.nStartPos); - nEndPos = std::min(nEndPos, rSel.nEndPos); + nStartPos = std::max(nStartPos, rSel.start.nIndex); + nEndPos = std::min(nEndPos, rSel.end.nIndex); ESelection aSel( nParagraph, nStartPos, nParagraph, nEndPos ); const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() ); @@ -572,8 +572,7 @@ void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRang if( bExpand ) { const ESelection& rOldSel = GetSelection(); - aNewSel.nStartPara = rOldSel.nStartPara; - aNewSel.nStartPos = rOldSel.nStartPos; + aNewSel.start = rOldSel.start; } SetSelection( aNewSel ); diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index ba2c8ba5002d..4be391ed72dc 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -153,7 +153,7 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection // Init return PaM. EditPaM aPaM( rEditEngine.CreateSelection( rSel ).Max()); - ESelection aSel(rSel.nStartPara+1, 0, rSel.nEndPara+1, 0); + ESelection aSel(rSel.start.nPara + 1, 0, rSel.end.nPara + 1, 0); uno::Reference xParent; rtl::Reference pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextImportComponentPropertySet, xParent ); pUnoText->SetSelection( aSel ); @@ -209,16 +209,16 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection //remove the extra para breaks EditDoc& pDoc = rEditEngine.GetEditDoc(); - rEditEngine.ParaAttribsToCharAttribs( pDoc.GetObject( rSel.nEndPara ) ); - rEditEngine.ConnectParagraphs( pDoc.GetObject( rSel.nEndPara ), - pDoc.GetObject( rSel.nEndPara + 1 ), true ); - rEditEngine.ParaAttribsToCharAttribs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara - 2 ) ); - rEditEngine.ConnectParagraphs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara - 2 ), - pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara -1 ), true ); + rEditEngine.ParaAttribsToCharAttribs(pDoc.GetObject(rSel.end.nPara)); + rEditEngine.ConnectParagraphs(pDoc.GetObject(rSel.end.nPara), + pDoc.GetObject(rSel.end.nPara + 1), true); + rEditEngine.ParaAttribsToCharAttribs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.end.nPara - 2 ) ); + rEditEngine.ConnectParagraphs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.end.nPara - 2 ), + pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.end.nPara -1 ), true ); // The final join is to be returned. - aPaM = rEditEngine.ConnectParagraphs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara - 2 ), - pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara -1 ), true ); + aPaM = rEditEngine.ConnectParagraphs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.end.nPara - 2 ), + pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.end.nPara -1 ), true ); } catch( const uno::Exception& ) { diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 60fa228f7f8c..b208cbcb015e 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -3744,7 +3744,7 @@ void SvxMSDffManager::ReadObjText( const OUString& rText, SdrObject* pObj ) else ++nParaSize; } - ESelection aSelection( nParaIndex, 0, nParaIndex, 0 ); + ESelection aSelection(nParaIndex, 0); OUString aParagraph( pCurrent, nParaSize ); if ( !nParaIndex && aParagraph.isEmpty() ) // SJ: we are crashing if the first paragraph is empty ? aParagraph += " "; // otherwise these two lines can be removed. @@ -3752,9 +3752,9 @@ void SvxMSDffManager::ReadObjText( const OUString& rText, SdrObject* pObj ) rOutliner.SetParaAttribs( nParaIndex, rOutliner.GetEmptyItemSet() ); SfxItemSet aParagraphAttribs( rOutliner.GetEmptyItemSet() ); - if ( !aSelection.nStartPos ) + if (!aSelection.start.nIndex) aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, false ) ); - aSelection.nStartPos = 0; + aSelection.start.nIndex = 0; rOutliner.QuickSetAttribs( aParagraphAttribs, aSelection ); nParaIndex++; } diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index c85d32b1ae64..d4bcc197d2e2 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -2290,7 +2290,7 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* sal_Int32 nParaIndex = pTextObj->GetCurrentIndex(); SfxStyleSheet* pS = ppStyleSheetAry ? ppStyleSheetAry[ pPara->mxParaSet->mnDepth ] : pSheet; - ESelection aSelection( nParaIndex, 0, nParaIndex, 0 ); + ESelection aSelection(nParaIndex, 0); rOutliner.Insert( OUString(), nParaIndex, pPara->mxParaSet->mnDepth ); rOutliner.QuickInsertText( OUString(pParaText.get(), nCurrentIndex), aSelection ); rOutliner.SetParaAttribs( nParaIndex, rOutliner.GetEmptyItemSet() ); @@ -2303,8 +2303,8 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* std::unique_ptr pFieldItem(pPortion->GetTextField()); if ( pFieldItem ) { - rOutliner.QuickInsertField( *pFieldItem, ESelection( nParaIndex, aSelection.nEndPos, nParaIndex, aSelection.nEndPos + 1 ) ); - aSelection.nEndPos++; + rOutliner.QuickInsertField( *pFieldItem, ESelection( nParaIndex, aSelection.end.nIndex, nParaIndex, aSelection.end.nIndex + 1 ) ); + aSelection.end.nIndex++; } else { @@ -2317,22 +2317,19 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* { nLen = pPtr - pF; if ( nLen ) - aSelection.nEndPos = - sal::static_int_cast< sal_uInt16 >( - aSelection.nEndPos + nLen ); + aSelection.end.nIndex += nLen; pF = pPtr + 1; - rOutliner.QuickInsertLineBreak( ESelection( nParaIndex, aSelection.nEndPos, nParaIndex, aSelection.nEndPos + 1 ) ); - aSelection.nEndPos++; + rOutliner.QuickInsertLineBreak( ESelection( nParaIndex, aSelection.end.nIndex, nParaIndex, aSelection.end.nIndex + 1 ) ); + aSelection.end.nIndex++; } } nLen = pPtr - pF; if ( nLen ) - aSelection.nEndPos = sal::static_int_cast< sal_uInt16 >( - aSelection.nEndPos + nLen ); + aSelection.end.nIndex += nLen; } pPortion->ApplyTo( aPortionAttribs, const_cast(*this), nDestinationInstance, pTextObj ); rOutliner.QuickSetAttribs( aPortionAttribs, aSelection ); - aSelection.nStartPos = aSelection.nEndPos; + aSelection.start.nIndex = aSelection.end.nIndex; } std::optional< sal_Int16 > oStartNumbering; SfxItemSet aParagraphAttribs( rOutliner.GetEmptyItemSet() ); @@ -2345,11 +2342,11 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* else aParagraphAttribs.Put( SfxInt16Item(EE_PARA_OUTLLEVEL, pPara->mxParaSet->mnDepth)); - if ( !aSelection.nStartPos ) // in PPT empty paragraphs never gets a bullet + if (!aSelection.start.nIndex) // in PPT empty paragraphs never gets a bullet { aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, false ) ); } - aSelection.nStartPos = 0; + aSelection.start.nIndex = 0; rOutliner.QuickSetAttribs( aParagraphAttribs, aSelection ); } } diff --git a/forms/source/richtext/specialdispatchers.cxx b/forms/source/richtext/specialdispatchers.cxx index b13d29aeeb98..d1f99d857259 100644 --- a/forms/source/richtext/specialdispatchers.cxx +++ b/forms/source/richtext/specialdispatchers.cxx @@ -63,12 +63,9 @@ namespace frm if ( !pEngine ) return; - sal_Int32 nParagraphs = pEngine->GetParagraphCount(); - if ( nParagraphs ) + if (pEngine->GetParagraphCount()) { - sal_Int32 nLastParaNumber = nParagraphs - 1; - sal_Int32 nParaLen = pEngine->GetTextLen( nLastParaNumber ); - getEditView()->SetSelection( ESelection( 0, 0, nLastParaNumber, nParaLen ) ); + getEditView()->SetSelection(ESelection::All()); } } diff --git a/include/editeng/EPaM.hxx b/include/editeng/EPaM.hxx index d474dfe18235..653adeafa6f9 100644 --- a/include/editeng/EPaM.hxx +++ b/include/editeng/EPaM.hxx @@ -19,25 +19,29 @@ #pragma once +#include + +#include + +inline constexpr sal_Int32 EE_PARA_MAX = SAL_MAX_INT32; +inline constexpr sal_Int32 EE_TEXTPOS_MAX = SAL_MAX_INT32; + struct EPaM { + static constexpr EPaM NotFound() { return { EE_PARA_MAX, EE_TEXTPOS_MAX }; } + sal_Int32 nPara = 0; sal_Int32 nIndex = 0; - EPaM() = default; + constexpr EPaM() = default; - EPaM(sal_Int32 _nParagraph, sal_Int32 _nIndex) + constexpr EPaM(sal_Int32 _nParagraph, sal_Int32 _nIndex) : nPara(_nParagraph) , nIndex(_nIndex) { } - bool operator==(const EPaM& rInstance) const - { - return nPara == rInstance.nPara && nIndex == rInstance.nIndex; - } - - bool operator!=(const EPaM& rSelection) const = default; + bool operator==(const EPaM&) const = default; bool operator<(const EPaM& rInstance) const { diff --git a/include/editeng/EPosition.hxx b/include/editeng/EPosition.hxx deleted file mode 100644 index ca6a3e13bee0..000000000000 --- a/include/editeng/EPosition.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- 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 - -#define EE_INDEX_NOT_FOUND SAL_MAX_INT32 -#define EE_PARA_NOT_FOUND SAL_MAX_INT32 - -struct EPosition -{ - sal_Int32 nPara; - sal_Int32 nIndex; - - EPosition() - : nPara(EE_PARA_NOT_FOUND) - , nIndex(EE_INDEX_NOT_FOUND) - { - } - - EPosition(sal_Int32 nPara_, sal_Int32 nPos_) - : nPara(nPara_) - , nIndex(nPos_) - { - } -}; - -template -inline std::basic_ostream& operator<<(std::basic_ostream& stream, - EPosition const& pos) -{ - return stream << "EPosition(" << pos.nPara << ',' << pos.nIndex << ")"; -} -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/ESelection.hxx b/include/editeng/ESelection.hxx index 1b6c98516435..c93b6df800e5 100644 --- a/include/editeng/ESelection.hxx +++ b/include/editeng/ESelection.hxx @@ -19,94 +19,74 @@ #pragma once +#include + +#include + +#include +#include + struct ESelection { - static constexpr sal_Int32 MAX_PARAGRAPH_POSITION = SAL_MAX_INT32; - static constexpr sal_Int32 MAX_TEXT_POSITION = SAL_MAX_INT32; - // Select all text - static ESelection All() { return ESelection(0, 0, MAX_PARAGRAPH_POSITION, MAX_TEXT_POSITION); } + static constexpr ESelection All() { return { 0, 0, EE_PARA_MAX, EE_TEXTPOS_MAX }; } - // Set to "not found" state - static ESelection NotFound() { return ESelection(MAX_PARAGRAPH_POSITION, MAX_TEXT_POSITION); } - // Set to no selection - static ESelection NoSelection() - { - return ESelection(MAX_PARAGRAPH_POSITION, MAX_TEXT_POSITION); - } + // Set to end without selection + static constexpr ESelection AtEnd() { return { EE_PARA_MAX, EE_TEXTPOS_MAX }; } - sal_Int32 nStartPara = 0; - sal_Int32 nStartPos = 0; - sal_Int32 nEndPara = 0; - sal_Int32 nEndPos = 0; + EPaM start; + EPaM end; - ESelection() = default; + constexpr ESelection() = default; - ESelection(sal_Int32 _nStartPara, sal_Int32 _nStartPos, sal_Int32 _nEndPara, sal_Int32 _nEndPos) - : nStartPara(_nStartPara) - , nStartPos(_nStartPos) - , nEndPara(_nEndPara) - , nEndPos(_nEndPos) + constexpr ESelection(sal_Int32 _nStartPara, sal_Int32 _nStartPos, sal_Int32 _nEndPara, + sal_Int32 _nEndPos) + : start(_nStartPara, _nStartPos) + , end(_nEndPara, _nEndPos) { } - ESelection(sal_Int32 nPara, sal_Int32 nPos) - : nStartPara(nPara) - , nStartPos(nPos) - , nEndPara(nPara) - , nEndPos(nPos) + constexpr ESelection(sal_Int32 nPara, sal_Int32 nPos) + : ESelection(nPara, nPos, nPara, nPos) { } + constexpr explicit ESelection(const EPaM& rPos) + : ESelection(rPos.nPara, rPos.nIndex) + { + } + + bool IsAdjusted() const { return !(end < start); } + void Adjust() { - if (nStartPara > nEndPara || (nStartPara == nEndPara && nStartPos > nEndPos)) - { - std::swap(nStartPara, nEndPara); - std::swap(nStartPos, nEndPos); - } + if (!IsAdjusted()) + std::swap(start, end); } - bool operator==(const ESelection& rSelection) const - { - return nStartPara == rSelection.nStartPara && nStartPos == rSelection.nStartPos - && nEndPara == rSelection.nEndPara && nEndPos == rSelection.nEndPos; - } + void CollapseToStart() { end = start; } + void CollapseToEnd() { start = end; } - bool operator!=(const ESelection& rSelection) const = default; + bool operator==(const ESelection&) const = default; bool operator<(const ESelection& rSelection) const { // The selection must be adjusted. + assert(IsAdjusted() && rSelection.IsAdjusted()); // => Only check if end of 'this' < Start of rS - return nEndPara < rSelection.nStartPara - || (nEndPara == rSelection.nStartPara && nEndPos < rSelection.nStartPos - && operator!=(rSelection)); + return end < rSelection.start; } + bool operator>(const ESelection& rSelection) const { return rSelection < *this; } - bool operator>(const ESelection& rSelection) const - { - // The selection must be adjusted. - // => Only check if end of 'this' < Start of rS - return nStartPara > rSelection.nEndPara - || (nStartPara == rSelection.nEndPara && nStartPos > rSelection.nEndPos - && operator!=(rSelection)); - } - - bool IsZero() const - { - return nStartPara == 0 && nStartPos == 0 && nEndPara == 0 && nEndPos == 0; - } - - bool HasRange() const { return nStartPara != nEndPara || nStartPos != nEndPos; } + bool HasRange() const { return start != end; } }; template inline std::basic_ostream& operator<<(std::basic_ostream& stream, ESelection const& rSelection) { - return stream << "ESelection(" << rSelection.nStartPara << ',' << rSelection.nStartPos << "," - << rSelection.nEndPara << "," << rSelection.nEndPos << ")"; + return stream << "ESelection(" << rSelection.start.nPara << ',' << rSelection.start.nIndex + << "," << rSelection.end.nPara << "," << rSelection.end.nIndex << ")"; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx index 25745f7f4cde..a9388e305556 100644 --- a/include/editeng/editdata.hxx +++ b/include/editeng/editdata.hxx @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -47,13 +46,6 @@ enum class EEAnchorMode { enum class EERemoveParaAttribsMode { RemoveAll, RemoveCharItems, RemoveNone }; -#define EE_PARA_APPEND ESelection::MAX_PARAGRAPH_POSITION -#define EE_PARA_ALL ESelection::MAX_PARAGRAPH_POSITION -#define EE_PARA_MAX_COUNT ESelection::MAX_PARAGRAPH_POSITION - -#define EE_TEXTPOS_ALL ESelection::MAX_TEXT_POSITION -#define EE_TEXTPOS_MAX_COUNT ESelection::MAX_TEXT_POSITION - EDITENG_DLLPUBLIC extern const size_t EE_APPEND; // Error messages for Read / Write Method @@ -89,7 +81,7 @@ struct EDITENG_DLLPUBLIC EFieldInfo { std::unique_ptr pFieldItem; OUString aCurrentText; - EPosition aPosition; + EPaM aPosition = EPaM::NotFound(); EFieldInfo(); EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_Int32 nPos ); @@ -235,13 +227,12 @@ struct EENotify { EENotifyType eNotificationType; - sal_Int32 nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED + sal_Int32 nParagraph = EE_PARA_MAX; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED - sal_Int32 nParam1; - sal_Int32 nParam2; + sal_Int32 nParam1 = 0; + sal_Int32 nParam2 = 0; - EENotify( EENotifyType eType ) - { eNotificationType = eType; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; } + EENotify(EENotifyType eType) { eNotificationType = eType; } }; namespace editeng diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index ef1ec563d3b5..9636a260ccac 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -298,10 +298,10 @@ public: SAL_DLLPRIVATE tools::Rectangle GetParaBounds( sal_Int32 nPara ); SAL_DLLPRIVATE ParagraphInfos GetParagraphInfos( sal_Int32 nPara ); SAL_DLLPRIVATE sal_Int32 FindParagraph( tools::Long nDocPosY ); - EPosition FindDocPosition( const Point& rDocPos ) const; - tools::Rectangle GetCharacterBounds( const EPosition& rPos ) const; + EPaM FindDocPosition( const Point& rDocPos ) const; + tools::Rectangle GetCharacterBounds( const EPaM& rPos ) const; - OUString GetWord(sal_Int32 nPara, sal_Int32 nIndex); + OUString GetWord(const EPaM& rPos); ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const; @@ -586,6 +586,8 @@ public: SAL_DLLPRIVATE ESelection CreateESelection(const EditSelection& rSel) const; SAL_DLLPRIVATE EditSelection CreateSelection(const ESelection& rSel); + ESelection NormalizeESelection(const ESelection& rSel) const; + EPaM GetEnd() const; SAL_DLLPRIVATE const SfxItemSet& GetBaseParaAttribs(sal_Int32 nPara) const; SAL_DLLPRIVATE void SetParaAttribsOnly(sal_Int32 nPara, const SfxItemSet& rSet); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 2e3670a74617..9a57b6c6aef1 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -553,7 +553,7 @@ public: sal_uInt16 nType; // see SvxNumberType bool bVisible; - EBulletInfo() : nParagraph( EE_PARA_NOT_FOUND ), nType( 0 ), bVisible( false ) {} + EBulletInfo() : nParagraph( EE_PARA_MAX ), nType( 0 ), bVisible( false ) {} }; enum class OutlinerMode { @@ -692,7 +692,7 @@ public: OutlinerView* GetView( size_t nIndex ) const; size_t GetViewCount() const; - Paragraph* Insert( const OUString& rText, sal_Int32 nAbsPos = EE_PARA_APPEND, sal_Int16 nDepth = 0 ); + Paragraph* Insert( const OUString& rText, sal_Int32 nAbsPos = EE_PARA_MAX, sal_Int16 nDepth = 0 ); void SetText( const OutlinerParaObject& ); void AddText( const OutlinerParaObject&, bool bAppend = false ); void SetText( const OUString& rText, Paragraph* pParagraph ); @@ -700,7 +700,7 @@ public: void SetToEmptyText(); - std::optional CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const; + std::optional CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_MAX ) const; const SfxItemSet& GetEmptyItemSet() const; @@ -818,7 +818,7 @@ public: void SetWordDelimiters( const OUString& rDelimiters ); OUString const & GetWordDelimiters() const; - OUString GetWord( sal_Int32 nPara, sal_Int32 nIndex ); + OUString GetWord( const EPaM& rPos ); void StripPortions(); diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx index a0037a36341e..bd0e8d21747b 100644 --- a/sc/qa/extras/scpdfexport.cxx +++ b/sc/qa/extras/scpdfexport.cxx @@ -201,16 +201,11 @@ void ScPDFExportTest::exportToPDFWithUnoCommands(const OUString& rRange) void ScPDFExportTest::setFont(ScFieldEditEngine& rEE, sal_Int32 nStart, sal_Int32 nEnd, const OUString& rFontName) { - ESelection aSel; - aSel.nStartPara = aSel.nEndPara = 0; - aSel.nStartPos = nStart; - aSel.nEndPos = nEnd; - SfxItemSet aItemSet = rEE.GetEmptyItemSet(); SvxFontItem aItem(FAMILY_MODERN, rFontName, u""_ustr, PITCH_VARIABLE, RTL_TEXTENCODING_UTF8, EE_CHAR_FONTINFO); aItemSet.Put(aItem); - rEE.QuickSetAttribs(aItemSet, aSel); + rEE.QuickSetAttribs(aItemSet, ESelection(0, nStart, 0, nEnd)); } void ScPDFExportTest::testMediaShapeScreen_Tdf159094() diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index ad8745ee1659..98151610a2c7 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -1139,10 +1139,7 @@ namespace void setAttribute(ScFieldEditEngine& rEE, sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt16 nType, Color nColor = COL_BLACK) { - ESelection aSel; - aSel.nStartPara = aSel.nEndPara = nPara; - aSel.nStartPos = nStart; - aSel.nEndPos = nEnd; + ESelection aSel(nPara, nStart, nPara, nEnd); SfxItemSet aItemSet = rEE.GetEmptyItemSet(); switch (nType) @@ -1196,30 +1193,20 @@ void setAttribute(ScFieldEditEngine& rEE, sal_Int32 nPara, sal_Int32 nStart, sal void setFont(ScFieldEditEngine& rEE, sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, const OUString& rFontName) { - ESelection aSel; - aSel.nStartPara = aSel.nEndPara = nPara; - aSel.nStartPos = nStart; - aSel.nEndPos = nEnd; - SfxItemSet aItemSet = rEE.GetEmptyItemSet(); SvxFontItem aItem(FAMILY_MODERN, rFontName, u""_ustr, PITCH_VARIABLE, RTL_TEXTENCODING_UTF8, EE_CHAR_FONTINFO); aItemSet.Put(aItem); - rEE.QuickSetAttribs(aItemSet, aSel); + rEE.QuickSetAttribs(aItemSet, ESelection(nPara, nStart, nPara, nEnd)); } void setEscapement(ScFieldEditEngine& rEE, sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, short nEsc, sal_uInt8 nRelSize) { - ESelection aSel; - aSel.nStartPara = aSel.nEndPara = nPara; - aSel.nStartPos = nStart; - aSel.nEndPos = nEnd; - SfxItemSet aItemSet = rEE.GetEmptyItemSet(); SvxEscapementItem aItem(nEsc, nRelSize, EE_CHAR_ESCAPEMENT); aItemSet.Put(aItem); - rEE.QuickSetAttribs(aItemSet, aSel); + rEE.QuickSetAttribs(aItemSet, ESelection(nPara, nStart, nPara, nEnd)); } } @@ -1646,8 +1633,6 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testRichTextExportODS) setAttribute(*pEE, 0, 0, 4, EE_CHAR_WEIGHT); // Set the 'Italic' part italic. setAttribute(*pEE, 0, 9, 15, EE_CHAR_ITALIC); - ESelection aSel; - aSel.nStartPara = aSel.nEndPara = 0; // Set this edit text to cell B2. pDoc->SetEditText(ScAddress(1, 1, 0), pEE->CreateTextObject()); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 3d0686c2cc77..7ef7eb9a3f08 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -278,17 +278,12 @@ CPPUNIT_TEST_FIXTURE(Test, testSharedStringPool) ScFieldEditEngine& rEE = m_pDoc->GetEditEngine(); rEE.SetTextCurrentDefaults(u"Andy and Bruce"_ustr); - ESelection aSel; - aSel.nStartPara = aSel.nEndPara = 0; - { // Set 'Andy' bold. SfxItemSet aItemSet = rEE.GetEmptyItemSet(); - aSel.nStartPos = 0; - aSel.nEndPos = 4; SvxWeightItem aWeight(WEIGHT_BOLD, EE_CHAR_WEIGHT); aItemSet.Put(aWeight); - rEE.QuickSetAttribs(aItemSet, aSel); + rEE.QuickSetAttribs(aItemSet, ESelection(0, 0, 0, 4)); } { @@ -296,9 +291,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSharedStringPool) SfxItemSet aItemSet = rEE.GetEmptyItemSet(); SvxPostureItem aItalic(ITALIC_NORMAL, EE_CHAR_ITALIC); aItemSet.Put(aItalic); - aSel.nStartPos = 9; - aSel.nEndPos = 14; - rEE.QuickSetAttribs(aItemSet, aSel); + rEE.QuickSetAttribs(aItemSet, ESelection(0, 9, 0, 14)); } m_pDoc->SetEditText(ScAddress(1,0,0), rEE.CreateTextObject()); // B1 diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 4516fe3638b4..aa4ae40dae1d 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -333,7 +333,7 @@ void ScStyleSheetPool::CreateStandardStyles() aStr = ScResId( STR_PAGE ) + " "; aEdEngine.SetTextCurrentDefaults( aStr ); nStrLen = aStr.getLength(); - aEdEngine.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen) ); pTxtObj = aEdEngine.CreateTextObject(); aFooterItem.SetLeftArea ( *pEmptyTxtObj ); aFooterItem.SetCenterArea( *pTxtObj ); @@ -378,14 +378,14 @@ void ScStyleSheetPool::CreateStandardStyles() aStr = " ()"; aEdEngine.SetTextCurrentDefaults( aStr ); - aEdEngine.QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2) ); aEdEngine.QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() ); pTxtObj = aEdEngine.CreateTextObject(); aHeaderItem.SetLeftArea( *pTxtObj ); aHeaderItem.SetCenterArea( *pEmptyTxtObj ); aStr = ", "; aEdEngine.SetTextCurrentDefaults( aStr ); - aEdEngine.QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2) ); aEdEngine.QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD), ESelection() ); pTxtObj = aEdEngine.CreateTextObject(); @@ -400,8 +400,8 @@ void ScStyleSheetPool::CreateStandardStyles() aStr += " / "; sal_Int32 nStrLen2 = aStr.getLength(); aEdEngine.SetTextCurrentDefaults( aStr ); - aEdEngine.QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2,0,nStrLen2) ); - aEdEngine.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2) ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen) ); pTxtObj = aEdEngine.CreateTextObject(); aFooterItem.SetLeftArea ( *pEmptyTxtObj ); aFooterItem.SetCenterArea( *pTxtObj ); diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index a52094cda538..d72235516d01 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -149,8 +149,7 @@ std::unique_ptr ScEditUtil::CreateURLObjectFromURL( ScDocument& SvxURLField aUrlField( rURL, rText, SvxURLFormat::AppDefault); EditEngine& rEE = rDoc.GetEditEngine(); rEE.SetText( OUString() ); - rEE.QuickInsertField( SvxFieldItem( aUrlField, EE_FEATURE_FIELD ), - ESelection( EE_PARA_MAX_COUNT, EE_TEXTPOS_MAX_COUNT ) ); + rEE.QuickInsertField(SvxFieldItem(aUrlField, EE_FEATURE_FIELD), ESelection::AtEnd()); return rEE.CreateTextObject(); } diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index ea93333b8a54..18ea2dc3484a 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -460,8 +460,8 @@ XclExpStringRef lclCreateFormattedString( // process all portions in the paragraph for( const auto& rPos : aPosList ) { - aSel.nEndPos = rPos; - OUString aXclPortionText = aParaText.copy( aSel.nStartPos, aSel.nEndPos - aSel.nStartPos ); + aSel.end.nIndex = rPos; + OUString aXclPortionText = aParaText.copy( aSel.start.nIndex, aSel.end.nIndex - aSel.start.nIndex ); aItemSet.ClearItem(); SfxItemSet aEditSet( rEE.GetAttribs( aSel ) ); @@ -472,7 +472,7 @@ XclExpStringRef lclCreateFormattedString( // process text fields bool bIsHyperlink = false; - if( aSel.nStartPos + 1 == aSel.nEndPos ) + if (aSel.start.nIndex + 1 == aSel.end.nIndex) { // test if the character is a text field if( const SvxFieldItem* pItem = aEditSet.GetItemIfSet( EE_FEATURE_FIELD, false ) ) @@ -523,7 +523,7 @@ XclExpStringRef lclCreateFormattedString( xString->AppendFormat( nXclPortionStart, nFontIdx ); } - aSel.nStartPos = aSel.nEndPos; + aSel.start.nIndex = aSel.end.nIndex; } // add trailing newline (important for correct character index calculation) @@ -734,8 +734,8 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico for( const auto& rPos : aPosList ) { - aSel.nEndPos = rPos; - if( aSel.nStartPos < aSel.nEndPos ) + aSel.end.nIndex = rPos; + if (aSel.start.nIndex < aSel.end.nIndex) { // --- font attributes --- @@ -832,7 +832,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico // --- text content or text fields --- const SvxFieldItem* pItem; - if( (aSel.nStartPos + 1 == aSel.nEndPos) && // fields are single characters + if( (aSel.start.nIndex + 1 == aSel.end.nIndex) && // fields are single characters (pItem = aEditSet.GetItemIfSet( EE_FEATURE_FIELD, false )) ) { if( const SvxFieldData* pFieldData = pItem->GetField() ) @@ -885,7 +885,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico } } - aSel.nStartPos = aSel.nEndPos; + aSel.start.nIndex = aSel.end.nIndex; } aText = ScGlobal::addToken( aText, aParaText, '\n' ); diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 7cf5ee60085a..cd284c32ee1a 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -180,7 +180,7 @@ void lclInsertUrl( XclImpRoot& rRoot, const OUString& rUrl, SCCOL nScCol, SCROW { const EditTextObject* pEditObj = aCell.getEditText(); rEE.SetTextCurrentDefaults( *pEditObj ); - rEE.QuickInsertField( SvxFieldItem( aUrlField, EE_FEATURE_FIELD ), ESelection( 0, 0, EE_PARA_ALL, 0 ) ); + rEE.QuickInsertField(SvxFieldItem(aUrlField, EE_FEATURE_FIELD), ESelection::All()); } else { @@ -190,7 +190,7 @@ void lclInsertUrl( XclImpRoot& rRoot, const OUString& rUrl, SCCOL nScCol, SCROW { SfxItemSet aItemSet( rEE.GetEmptyItemSet() ); pPattern->FillEditItemSet( &aItemSet ); - rEE.QuickSetAttribs( aItemSet, ESelection( 0, 0, EE_PARA_ALL, 0 ) ); + rEE.QuickSetAttribs(aItemSet, ESelection::All()); } } diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index 2f05d6722d7a..40dd4ba5901c 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -197,18 +197,17 @@ std::unique_ptr lclCreateTextObject( const XclImpRoot& rRoot, aNextRun.mnChar = 0xFFFF; // reset selection start to current position - aSelection.nStartPara = aSelection.nEndPara; - aSelection.nStartPos = aSelection.nEndPos; + aSelection.CollapseToEnd(); } // set end of selection to current position if( rString.GetText()[ nChar ] == '\n' ) { - ++aSelection.nEndPara; - aSelection.nEndPos = 0; + ++aSelection.end.nPara; + aSelection.end.nIndex = 0; } else - ++aSelection.nEndPos; + ++aSelection.end.nIndex; } // send items of last text portion to edit engine @@ -271,8 +270,6 @@ XclImpHFConverter::XclImpHFPortionInfo::XclImpHFPortionInfo() : mnHeight( 0 ), mnMaxLineHt( 0 ) { - maSel.nStartPara = maSel.nEndPara = 0; - maSel.nStartPos = maSel.nEndPos = 0; } XclImpHFConverter::XclImpHFConverter( const XclImpRoot& rRoot ) : @@ -524,14 +521,13 @@ void XclImpHFConverter::UpdateCurrMaxLineHeight() void XclImpHFConverter::SetAttribs() { ESelection& rSel = GetCurrSel(); - if( (rSel.nStartPara != rSel.nEndPara) || (rSel.nStartPos != rSel.nEndPos) ) + if (rSel.HasRange()) { SfxItemSet aItemSet( mrEE.GetEmptyItemSet() ); XclImpFont aFont( GetRoot(), *mxFontData ); aFont.FillToItemSet( aItemSet, XclFontItemType::HeaderFooter ); mrEE.QuickSetAttribs( aItemSet, rSel ); - rSel.nStartPara = rSel.nEndPara; - rSel.nStartPos = rSel.nEndPos; + rSel.CollapseToEnd(); } } @@ -552,8 +548,8 @@ void XclImpHFConverter::InsertText() { ESelection& rSel = GetCurrSel(); OUString sString(maCurrText.makeStringAndClear()); - mrEE.QuickInsertText( sString, ESelection( rSel.nEndPara, rSel.nEndPos, rSel.nEndPara, rSel.nEndPos ) ); - rSel.nEndPos = rSel.nEndPos + sString.getLength(); + mrEE.QuickInsertText(sString, ESelection(rSel.end)); + rSel.end.nIndex += sString.getLength(); UpdateCurrMaxLineHeight(); } } @@ -561,17 +557,17 @@ void XclImpHFConverter::InsertText() void XclImpHFConverter::InsertField( const SvxFieldItem& rFieldItem ) { ESelection& rSel = GetCurrSel(); - mrEE.QuickInsertField( rFieldItem, ESelection( rSel.nEndPara, rSel.nEndPos, rSel.nEndPara, rSel.nEndPos ) ); - ++rSel.nEndPos; + mrEE.QuickInsertField(rFieldItem, ESelection(rSel.end)); + ++rSel.end.nIndex; UpdateCurrMaxLineHeight(); } void XclImpHFConverter::InsertLineBreak() { ESelection& rSel = GetCurrSel(); - mrEE.QuickInsertText( OUString('\n'), ESelection( rSel.nEndPara, rSel.nEndPos, rSel.nEndPara, rSel.nEndPos ) ); - ++rSel.nEndPara; - rSel.nEndPos = 0; + mrEE.QuickInsertText(OUString('\n'), ESelection(rSel.end)); + ++rSel.end.nPara; + rSel.end.nIndex = 0; GetCurrInfo().mnHeight += GetMaxLineHeight( meCurrObj ); GetCurrInfo().mnMaxLineHt = 0; } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index dd2395074bd2..125d6e98ec80 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -404,22 +404,19 @@ void ScHTMLLayoutParser::NewActEntry( const ScEEParseEntry* pE ) { if ( !pE->aSel.HasRange() ) { // Completely empty, following text ends up in the same paragraph! - mxActEntry->aSel.nStartPara = pE->aSel.nEndPara; - mxActEntry->aSel.nStartPos = pE->aSel.nEndPos; + mxActEntry->aSel.start = pE->aSel.end; } } - mxActEntry->aSel.nEndPara = mxActEntry->aSel.nStartPara; - mxActEntry->aSel.nEndPos = mxActEntry->aSel.nStartPos; + mxActEntry->aSel.CollapseToStart(); } void ScHTMLLayoutParser::EntryEnd( ScEEParseEntry* pE, const ESelection& rSel ) { - if ( rSel.nEndPara >= pE->aSel.nStartPara ) + if (rSel.end.nPara >= pE->aSel.start.nPara) { - pE->aSel.nEndPara = rSel.nEndPara; - pE->aSel.nEndPos = rSel.nEndPos; + pE->aSel.end = rSel.end; } - else if ( rSel.nStartPara == pE->aSel.nStartPara - 1 && !pE->aSel.HasRange() ) + else if (rSel.start.nPara == pE->aSel.start.nPara - 1 && !pE->aSel.HasRange()) { // Did not attach a paragraph, but empty, do nothing } else @@ -961,20 +958,20 @@ void ScHTMLLayoutParser::CloseEntry( const HtmlImportInfo* pInfo ) nColMax = nColCnt; // Global MaxCol for ScEEParser GetDimensions! EntryEnd(mxActEntry.get(), pInfo->aSelection); ESelection& rSel = mxActEntry->aSel; - while ( rSel.nStartPara < rSel.nEndPara - && pEdit->GetTextLen( rSel.nStartPara ) == 0 ) + while ( rSel.start.nPara < rSel.end.nPara + && pEdit->GetTextLen( rSel.start.nPara ) == 0 ) { // Strip preceding empty paragraphs - rSel.nStartPara++; + rSel.start.nPara++; } - while ( rSel.nEndPos == 0 && rSel.nEndPara > rSel.nStartPara ) + while ( rSel.end.nIndex == 0 && rSel.end.nPara > rSel.start.nPara ) { // Strip successive empty paragraphs - rSel.nEndPara--; - rSel.nEndPos = pEdit->GetTextLen( rSel.nEndPara ); + rSel.end.nPara--; + rSel.end.nIndex = pEdit->GetTextLen( rSel.end.nPara ); } - if ( rSel.nStartPara > rSel.nEndPara ) + if ( rSel.start.nPara > rSel.end.nPara ) { // Gives GPF in CreateTextObject OSL_FAIL( "CloseEntry: EditEngine ESelection Start > End" ); - rSel.nEndPara = rSel.nStartPara; + rSel.end.nPara = rSel.start.nPara; } if ( rSel.HasRange() ) mxActEntry->aItemSet.Put( ScLineBreakCell(true) ); @@ -992,7 +989,7 @@ IMPL_LINK( ScHTMLLayoutParser, HTMLImportHdl, HtmlImportInfo&, rInfo, void ) case HtmlImportState::Start: break; case HtmlImportState::End: - if ( rInfo.aSelection.nEndPos ) + if (rInfo.aSelection.end.nIndex) { // If text remains: create paragraph, without calling CloseEntry(). if( bInCell ) // ...but only in opened table cells. @@ -1582,9 +1579,9 @@ void ScHTMLLayoutParser::AnchorOn( HtmlImportInfo* pInfo ) bool ScHTMLLayoutParser::IsAtBeginningOfText( const HtmlImportInfo* pInfo ) { ESelection& rSel = mxActEntry->aSel; - return rSel.nStartPara == rSel.nEndPara && - rSel.nStartPara <= pInfo->aSelection.nEndPara && - pEdit->GetTextLen( rSel.nStartPara ) == 0; + return rSel.start.nPara == rSel.end.nPara && + rSel.start.nPara <= pInfo->aSelection.end.nPara && + pEdit->GetTextLen( rSel.start.nPara ) == 0; } void ScHTMLLayoutParser::FontOn( HtmlImportInfo* pInfo ) @@ -1836,39 +1833,35 @@ bool ScHTMLEntry::HasContents() const void ScHTMLEntry::AdjustStart( const HtmlImportInfo& rInfo ) { // set start position - aSel.nStartPara = rInfo.aSelection.nStartPara; - aSel.nStartPos = rInfo.aSelection.nStartPos; + aSel.start = rInfo.aSelection.start; // adjust end position - if( (aSel.nEndPara < aSel.nStartPara) || ((aSel.nEndPara == aSel.nStartPara) && (aSel.nEndPos < aSel.nStartPos)) ) + if (!aSel.IsAdjusted()) { - aSel.nEndPara = aSel.nStartPara; - aSel.nEndPos = aSel.nStartPos; + aSel.CollapseToStart(); } } void ScHTMLEntry::AdjustEnd( const HtmlImportInfo& rInfo ) { - OSL_ENSURE( (aSel.nEndPara < rInfo.aSelection.nEndPara) || - ((aSel.nEndPara == rInfo.aSelection.nEndPara) && (aSel.nEndPos <= rInfo.aSelection.nEndPos)), + OSL_ENSURE( !(rInfo.aSelection.end < aSel.end), "ScHTMLQueryParser::AdjustEntryEnd - invalid end position" ); // set end position - aSel.nEndPara = rInfo.aSelection.nEndPara; - aSel.nEndPos = rInfo.aSelection.nEndPos; + aSel.end = rInfo.aSelection.end; } void ScHTMLEntry::Strip( const EditEngine& rEditEngine ) { // strip leading empty paragraphs - while( (aSel.nStartPara < aSel.nEndPara) && (rEditEngine.GetTextLen( aSel.nStartPara ) <= aSel.nStartPos) ) + while( (aSel.start.nPara < aSel.end.nPara) && (rEditEngine.GetTextLen( aSel.start.nPara ) <= aSel.start.nIndex) ) { - ++aSel.nStartPara; - aSel.nStartPos = 0; + ++aSel.start.nPara; + aSel.start.nIndex = 0; } // strip trailing empty paragraphs - while( (aSel.nStartPara < aSel.nEndPara) && (aSel.nEndPos == 0) ) + while( (aSel.start.nPara < aSel.end.nPara) && (aSel.end.nIndex == 0) ) { - --aSel.nEndPara; - aSel.nEndPos = rEditEngine.GetTextLen( aSel.nEndPara ); + --aSel.end.nPara; + aSel.end.nIndex = rEditEngine.GetTextLen( aSel.end.nPara ); } } diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx index 06db87e3c733..6f2a75b5f721 100644 --- a/sc/source/filter/oox/richstring.cxx +++ b/sc/source/filter/oox/richstring.cxx @@ -108,8 +108,7 @@ void RichStringPortion::convert( const Reference< XText >& rxText, bool bReplace void RichStringPortion::convert( ScEditEngineDefaulter& rEE, ESelection& rSelection, const oox::xls::Font* pFont ) { - rSelection.nStartPos = rSelection.nEndPos; - rSelection.nStartPara = rSelection.nEndPara; + rSelection.CollapseToEnd(); SfxItemSet aItemSet( rEE.GetEmptyItemSet() ); const Font* pFontToUse = mxFont ? mxFont.get() : lclNeedsRichTextFormat( pFont ) ? pFont : nullptr; @@ -125,18 +124,18 @@ void RichStringPortion::convert( ScEditEngineDefaulter& rEE, ESelection& rSelect { nLastParaLoc = nSearchIndex; ++nParaOccurrence; - rSelection.nEndPos = 0; + rSelection.end.nIndex = 0; nSearchIndex = maText.indexOf( '\n', nSearchIndex + 1); } - rSelection.nEndPara += nParaOccurrence; + rSelection.end.nPara += nParaOccurrence; if ( nLastParaLoc != -1 ) { - rSelection.nEndPos = maText.getLength() - 1 - nLastParaLoc; + rSelection.end.nIndex = maText.getLength() - 1 - nLastParaLoc; } else { - rSelection.nEndPos = rSelection.nStartPos + maText.getLength(); + rSelection.end.nIndex = rSelection.start.nIndex + maText.getLength(); } rEE.QuickSetAttribs( aItemSet, rSelection ); } diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 1f5ac13f358a..e4b5667643b5 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -1388,13 +1388,12 @@ void ScOrcusSharedStrings::set_segment_font_color( void ScOrcusSharedStrings::append_segment(std::string_view s) { - sal_Int32 nPos = mrEditEngine.GetText().getLength(); - ESelection aSel{0, nPos, 0, nPos}; // end of current text + ESelection aSel{ mrEditEngine.GetEnd() }; // end of current text OUString aStr = toOUString(s); mrEditEngine.QuickInsertText(aStr, aSel); - aSel.nEndPos += aStr.getLength(); // expand the selection over the current segment + aSel.end = mrEditEngine.GetEnd(); // expand the selection over the current segment maFormatSegments.emplace_back(aSel, maCurFormat); maCurFormat.ClearItem(); } diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 577f43efddca..5b6ad74377f9 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -109,7 +109,7 @@ namespace bool IsValidSel(const ScTabEditEngine& rEngine, const ESelection& rSel) { const auto nParaCount = rEngine.GetParagraphCount(); - return rSel.nStartPara < nParaCount && rSel.nEndPara < nParaCount; + return rSel.start.nPara < nParaCount && rSel.end.nPara < nParaCount; } } @@ -178,7 +178,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu aSet.ClearItem( EE_PARA_JUST ); // Test whether simple String without mixed attributes - bool bSimple = ( pE->aSel.nStartPara == pE->aSel.nEndPara ); + bool bSimple = (pE->aSel.start.nPara == pE->aSel.end.nPara); for (sal_uInt16 nId = EE_CHAR_START; nId <= EE_CHAR_END && bSimple; nId++) { const SfxPoolItem* pItem = nullptr; @@ -356,7 +356,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu OUString aStr; if( pE->bEntirePara ) { - aStr = mpEngine->GetText( pE->aSel.nStartPara ); + aStr = mpEngine->GetText(pE->aSel.start.nPara); } else { @@ -661,8 +661,8 @@ ScEEParser::~ScEEParser() void ScEEParser::NewActEntry( const ScEEParseEntry* pE ) { // New free-flying mxActEntry mxActEntry = std::make_shared(pPool.get()); - mxActEntry->aSel.nStartPara = (pE ? pE->aSel.nEndPara + 1 : 0); - mxActEntry->aSel.nStartPos = 0; + mxActEntry->aSel.start.nPara = (pE ? pE->aSel.end.nPara + 1 : 0); + mxActEntry->aSel.start.nIndex = 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx index c56b3f7d540e..3143ba36f52e 100644 --- a/sc/source/filter/rtf/rtfparse.cxx +++ b/sc/source/filter/rtf/rtfparse.cxx @@ -66,13 +66,11 @@ ErrCode ScRTFParser::Read( SvStream& rStream, const OUString& rBaseURL ) { auto& pE = maList.back(); if ( // Completely empty - ( pE->aSel.nStartPara == pE->aSel.nEndPara - && pE->aSel.nStartPos == pE->aSel.nEndPos - ) + ( !pE->aSel.HasRange() ) || // Empty paragraph - ( pE->aSel.nStartPara + 1 == pE->aSel.nEndPara - && pE->aSel.nStartPos == pEdit->GetTextLen( pE->aSel.nStartPara ) - && pE->aSel.nEndPos == 0 + ( pE->aSel.start.nPara + 1 == pE->aSel.end.nPara + && pE->aSel.start.nIndex == pEdit->GetTextLen( pE->aSel.start.nPara ) + && pE->aSel.end.nIndex == 0 ) ) { // Don't take over the last paragraph @@ -88,9 +86,9 @@ ErrCode ScRTFParser::Read( SvStream& rStream, const OUString& rBaseURL ) void ScRTFParser::EntryEnd( ScEEParseEntry* pE, const ESelection& aSel ) { // Paragraph -2 strips the attached empty paragraph - pE->aSel.nEndPara = aSel.nEndPara - 2; + pE->aSel.end.nPara = aSel.end.nPara - 2; // Although it's called nEndPos, the last one is position + 1 - pE->aSel.nEndPos = pEdit->GetTextLen( aSel.nEndPara - 1 ); + pE->aSel.end.nIndex = pEdit->GetTextLen(aSel.end.nPara - 1); } inline void ScRTFParser::NextRow() @@ -171,13 +169,13 @@ IMPL_LINK( ScRTFParser, RTFImportHdl, RtfImportInfo&, rInfo, void ) } break; case RtfImportState::End: - if ( rInfo.aSelection.nEndPos ) + if ( rInfo.aSelection.end.nIndex ) { // If still text: create last paragraph pActDefault = nullptr; rInfo.nToken = RTF_PAR; // EditEngine did not attach an empty paragraph anymore // which EntryEnd could strip - rInfo.aSelection.nEndPara++; + rInfo.aSelection.end.nPara++; ProcToken( &rInfo ); } break; @@ -352,7 +350,7 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo ) } // Adjust selection of free-flying mxActEntry // Paragraph -1 due to separated text in EditEngine during parsing - mxActEntry->aSel.nStartPara = pInfo->aSelection.nEndPara - 1; + mxActEntry->aSel.start.nPara = pInfo->aSelection.end.nPara - 1; } pActDefault = nullptr; diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 17b2a1a6b3c6..356be061ea2c 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -328,10 +328,9 @@ void ScXMLTableRowCellContext::PushParagraphField(std::unique_ptr sal_Int32 nPos = maParagraph.getLength(); maParagraph.append('\1'); // Placeholder text for inserted field item. - rField.maSelection.nStartPara = mnCurParagraph; - rField.maSelection.nEndPara = mnCurParagraph; - rField.maSelection.nStartPos = nPos; - rField.maSelection.nEndPos = nPos+1; + rField.maSelection.start.nPara = rField.maSelection.end.nPara = mnCurParagraph; + rField.maSelection.start.nIndex = nPos; + rField.maSelection.end.nIndex = nPos+1; PushFormat(nPos, nPos+1, rStyleName); } @@ -370,9 +369,9 @@ void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, cons mbHasFormatRuns = true; maFormats.push_back(std::make_unique(*mpEditEngine)); ParaFormat& rFmt = *maFormats.back(); - rFmt.maSelection.nStartPara = rFmt.maSelection.nEndPara = mnCurParagraph; - rFmt.maSelection.nStartPos = nBegin; - rFmt.maSelection.nEndPos = nEnd; + rFmt.maSelection.start.nPara = rFmt.maSelection.end.nPara = mnCurParagraph; + rFmt.maSelection.start.nIndex = nBegin; + rFmt.maSelection.end.nIndex = nEnd; // Store the used text styles for export. ScSheetSaveData* pSheetData = rXMLImport.GetScModel()->GetSheetSaveData(); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 0b7646bbc583..2657846388f6 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2417,7 +2417,7 @@ void ScXMLExport::collectAutoStyles() SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); uno::Reference xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); uno::Reference xParaProp( - lcl_GetEnumerated( xCellText, rNoteParaEntry.maSelection.nStartPara ), uno::UNO_QUERY ); + lcl_GetEnumerated( xCellText, rNoteParaEntry.maSelection.start.nPara ), uno::UNO_QUERY ); if ( xParaProp.is() ) { std::vector aPropStates(xParaPropMapper->Filter(*this, xParaProp)); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 2b1ab51fc6d4..b59ca0a4e2dc 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -347,12 +347,12 @@ static inline void incPos( const sal_Unicode c, sal_Int32& rPos, ESelection& rSe ++rPos; if (c == '\n') { - ++rSel.nEndPara; - rSel.nEndPos = 0; + ++rSel.end.nPara; + rSel.end.nIndex = 0; } else { - ++rSel.nEndPos; + ++rSel.end.nIndex; } } @@ -399,8 +399,7 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) } // Text between separators. We only consider within one line/paragraph. - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); nStart = nPos; handle_r1c1: { @@ -632,8 +631,7 @@ static void lcl_Replace( EditView* pView, const OUString& rNewStr, const ESelect ESelection aOldSel = pView->GetSelection(); if (aOldSel.HasRange()) - pView->SetSelection( ESelection( aOldSel.nEndPara, aOldSel.nEndPos, - aOldSel.nEndPara, aOldSel.nEndPos ) ); + pView->SetSelection(ESelection(aOldSel.end)); EditEngine& rEngine = pView->getEditEngine(); rEngine.QuickInsertText( rNewStr, rOldSel ); @@ -642,10 +640,7 @@ static void lcl_Replace( EditView* pView, const OUString& rNewStr, const ESelect // To do that we need to cancel the selection from above (before QuickInsertText) pView->InsertText( OUString() ); - const sal_Int32 nPara = rEngine.GetParagraphCount() - 1; - const sal_Int32 nLen = rEngine.GetTextLen(nPara); - ESelection aSel( nPara, nLen, nPara, nLen ); - pView->SetSelection( aSel ); // Set cursor to the end + pView->SetSelection(ESelection::AtEnd()); // Set cursor to the end } void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) @@ -669,8 +664,8 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) lcl_Replace( pTableView, aNewStr, rData.maSel ); // We are within one paragraph. - const sal_Int32 nDiff = aNewStr.getLength() - (rData.maSel.nEndPos - rData.maSel.nStartPos); - rData.maSel.nEndPos += nDiff; + const sal_Int32 nDiff = aNewStr.getLength() - (rData.maSel.end.nIndex - rData.maSel.start.nIndex); + rData.maSel.end.nIndex += nDiff; aSet.Put( SvxColorItem( nNewColor, EE_CHAR_COLOR ) ); mpEditEngine->QuickSetAttribs( aSet, rData.maSel ); @@ -688,11 +683,11 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) for (size_t i = nIndex + 1; i < nCount; ++i) { ScRangeFindData& rNext = pRangeFindList->GetObject( i ); - if (rNext.maSel.nStartPara != rData.maSel.nStartPara) + if (rNext.maSel.start.nPara != rData.maSel.start.nPara) break; - rNext.maSel.nStartPos += nDiff; - rNext.maSel.nEndPos += nDiff; + rNext.maSel.start.nIndex += nDiff; + rNext.maSel.end.nIndex += nDiff; } } @@ -1309,12 +1304,12 @@ void ScInputHandler::ShowTipCursor() ESelection aSel = pActiveView->GetSelection(); aSel.Adjust(); - if ( aParagraph.getLength() < aSel.nEndPos ) + if (aParagraph.getLength() < aSel.end.nIndex) return; - if ( aSel.nEndPos > 0 ) + if (aSel.end.nIndex > 0) { - OUString aSelText( aParagraph.copy( 0, aSel.nEndPos )); + OUString aSelText(aParagraph.copy(0, aSel.end.nIndex)); ShowArgumentsTip( aSelText ); } @@ -1578,21 +1573,21 @@ void ScInputHandler::UseFormulaData() // Due to differences between table and input cell (e.g clipboard with line breaks), // the selection may not be in line with the EditEngine anymore. // Just return without any indication as to why. - if ( aSel.nEndPos > aParagraph.getLength() ) + if (aSel.end.nIndex > aParagraph.getLength()) return; - if ( aParagraph.getLength() > aSel.nEndPos && - ( ScGlobal::getCharClass().isLetterNumeric( aParagraph, aSel.nEndPos ) || - aParagraph[ aSel.nEndPos ] == '_' || - aParagraph[ aSel.nEndPos ] == '.' || - aParagraph[ aSel.nEndPos ] == '$' ) ) + if ( aParagraph.getLength() > aSel.end.nIndex && + ( ScGlobal::getCharClass().isLetterNumeric( aParagraph, aSel.end.nIndex ) || + aParagraph[ aSel.end.nIndex ] == '_' || + aParagraph[ aSel.end.nIndex ] == '.' || + aParagraph[ aSel.end.nIndex ] == '$' ) ) return; // Is the cursor at the end of a word? - if ( aSel.nEndPos <= 0 ) + if (aSel.end.nIndex <= 0) return; - OUString aSelText( aParagraph.copy( 0, aSel.nEndPos )); + OUString aSelText(aParagraph.copy(0, aSel.end.nIndex)); OUString aText; if ( GetFuncName( aSelText, aText ) ) @@ -1666,38 +1661,38 @@ void completeFunction( EditView* pView, const OUString& rInsert, bool& rParInser if ( comphelper::LibreOfficeKit::isActive() ) { ESelection aSelRange = aSel; - --aSelRange.nStartPos; - --aSelRange.nEndPos; + --aSelRange.start.nIndex; + --aSelRange.end.nIndex; pView->SetSelection(aSelRange); pView->SelectCurrentWord(); if ( aOld == "=" ) { bNoInitialLetter = true; - aSelRange.nStartPos = 1; - aSelRange.nEndPos = 1; + aSelRange.start.nIndex = 1; + aSelRange.end.nIndex = 1; pView->SetSelection(aSelRange); } else if ( pView->GetSelected().startsWith("()") ) { bNoInitialLetter = true; - ++aSelRange.nStartPos; - ++aSelRange.nEndPos; + ++aSelRange.start.nIndex; + ++aSelRange.end.nIndex; pView->SetSelection(aSelRange); } } if(!bNoInitialLetter) { - const sal_Int32 nMinLen = std::max(aSel.nEndPos - aSel.nStartPos, sal_Int32(1)); + const sal_Int32 nMinLen = std::max(aSel.end.nIndex - aSel.start.nIndex, sal_Int32(1)); // Since transliteration service is used to test for match, the replaced string could be // longer than rInsert, so in order to find longest match before the cursor, test whole // string from start to current cursor position (don't limit to length of rInsert) // Disclaimer: I really don't know if a match longer than rInsert is actually possible, // so the above is based on assumptions how "transliteration" might possibly work. If - // it's in fact impossible, an optimization would be useful to limit aSel.nStartPos to - // std::max(sal_Int32(0), aSel.nEndPos - rInsert.getLength()). - aSel.nStartPos = 0; + // it's in fact impossible, an optimization would be useful to limit aSel.start.nPos to + // std::max(sal_Int32(0), aSel.end.nIndex - rInsert.getLength()). + aSel.start.nIndex = 0; pView->SetSelection(aSel); const OUString aAll = pView->GetSelected(); OUString aMatch; @@ -1708,7 +1703,7 @@ void completeFunction( EditView* pView, const OUString& rInsert, bool& rParInser aMatch = aTest; // Found => break the loop } - aSel.nStartPos = aSel.nEndPos - aMatch.getLength(); + aSel.start.nIndex = aSel.end.nIndex - aMatch.getLength(); pView->SetSelection(aSel); } @@ -1723,9 +1718,9 @@ void completeFunction( EditView* pView, const OUString& rInsert, bool& rParInser ESelection aWordSel = pView->GetSelection(); // aWordSel.EndPos points one behind string if word at end - if (aWordSel.nEndPos < aOld.getLength()) + if (aWordSel.end.nIndex < aOld.getLength()) { - sal_Unicode cNext = aOld[aWordSel.nEndPos]; + sal_Unicode cNext = aOld[aWordSel.end.nIndex]; if ( cNext == '(' ) { bDoParen = false; @@ -1739,8 +1734,8 @@ void completeFunction( EditView* pView, const OUString& rInsert, bool& rParInser if ( bDoParen ) // Put cursor between parentheses { aSel = pView->GetSelection(); - --aSel.nStartPos; - --aSel.nEndPos; + --aSel.start.nIndex; + --aSel.end.nIndex; pView->SetSelection(aSel); rParInserted = true; @@ -1834,14 +1829,14 @@ void ScTabViewShell::LOKSendFormulabarUpdate(EditView* pActiveView, OUString aSelection; if (pActiveView) { - aSelection = OUString::number(pActiveView->GetPosWithField(0, rSelection.nStartPos)) + ";" + - OUString::number(pActiveView->GetPosWithField(0, rSelection.nEndPos)) + ";" + - OUString::number(rSelection.nStartPara) + ";" + OUString::number(rSelection.nEndPara); + aSelection = OUString::number(pActiveView->GetPosWithField(0, rSelection.start.nIndex)) + ";" + + OUString::number(pActiveView->GetPosWithField(0, rSelection.end.nIndex)) + ";" + + OUString::number(rSelection.start.nPara) + ";" + OUString::number(rSelection.end.nPara); } else { - aSelection = OUString::number(rSelection.nStartPos) + ";" + OUString::number(rSelection.nEndPos) + ";" + - OUString::number(rSelection.nStartPara) + ";" + OUString::number(rSelection.nEndPara); + aSelection = OUString::number(rSelection.start.nIndex) + ";" + OUString::number(rSelection.end.nIndex) + ";" + + OUString::number(rSelection.start.nPara) + ";" + OUString::number(rSelection.end.nPara); } sal_uInt64 nCurrentShellId = reinterpret_cast(this); @@ -1988,10 +1983,10 @@ void ScInputHandler::PasteManualTip() ESelection aSel = pActiveView->GetSelection(); aSel.Adjust(); - OSL_ENSURE( !aSel.nStartPara && !aSel.nEndPara, "Too many paragraphs in Formula" ); - if ( !aSel.nStartPos ) // Selection from the start? + OSL_ENSURE( !aSel.start.nPara && !aSel.end.nPara, "Too many paragraphs in Formula" ); + if ( !aSel.start.nIndex ) // Selection from the start? { - if ( aSel.nEndPos == mpEditEngine->GetTextLen(0) ) + if ( aSel.end.nIndex == mpEditEngine->GetTextLen(0) ) { // Everything selected -> skip quotation marks if ( aInsert[0] == '"' ) @@ -2000,11 +1995,11 @@ void ScInputHandler::PasteManualTip() if ( aInsert.endsWith("\"") ) aInsert = aInsert.copy( 0, nInsLen-1 ); } - else if ( aSel.nEndPos ) + else if ( aSel.end.nIndex ) { // Not everything selected -> do not overwrite equality sign //FIXME: Even double equality signs?? - aSel.nStartPos = 1; + aSel.start.nIndex = 1; if ( pTopView ) pTopView->SetSelection( aSel ); if ( pTableView ) @@ -2040,7 +2035,7 @@ bool ScInputHandler::CursorAtClosingPar() if ( pActiveView && !pActiveView->HasSelection() && bFormulaMode ) { ESelection aSel = pActiveView->GetSelection(); - sal_Int32 nPos = aSel.nStartPos; + sal_Int32 nPos = aSel.start.nIndex; OUString aFormula = mpEditEngine->GetText(0); if ( nPos < aFormula.getLength() && aFormula[nPos] == ')' ) return true; @@ -2057,8 +2052,8 @@ void ScInputHandler::SkipClosingPar() if (pActiveView) { ESelection aSel = pActiveView->GetSelection(); - ++aSel.nStartPos; - ++aSel.nEndPos; + ++aSel.start.nIndex; + ++aSel.end.nIndex; // this is in a formula (only one paragraph), so the selection // can be used directly for the TopView @@ -2107,11 +2102,11 @@ void ScInputHandler::UseColData() // When typing aSel.Adjust(); sal_Int32 nParCnt = mpEditEngine->GetParagraphCount(); - if ( aSel.nEndPara+1 != nParCnt ) + if (aSel.end.nPara + 1 != nParCnt) return; - sal_Int32 nParLen = mpEditEngine->GetTextLen( aSel.nEndPara ); - if ( aSel.nEndPos != nParLen ) + sal_Int32 nParLen = mpEditEngine->GetTextLen(aSel.end.nPara); + if (aSel.end.nIndex != nParLen) return; OUString aText = GetEditText(mpEditEngine.get()); @@ -2155,8 +2150,8 @@ void ScInputHandler::UseColData() // When typing // Selection must be "backwards", so the cursor stays behind the last // typed character - ESelection aSelection( aSel.nEndPara, aSel.nEndPos + aIns.getLength(), - aSel.nEndPara, aSel.nEndPos ); + ESelection aSelection( aSel.end.nPara, aSel.end.nIndex + aIns.getLength(), + aSel.end.nPara, aSel.end.nIndex ); // When editing in input line, apply to both edit views if ( pTableView ) @@ -2184,12 +2179,12 @@ void ScInputHandler::NextAutoEntry( bool bBack ) ESelection aSel = pActiveView->GetSelection(); aSel.Adjust(); sal_Int32 nParCnt = mpEditEngine->GetParagraphCount(); - if ( aSel.nEndPara+1 == nParCnt && aSel.nStartPara == aSel.nEndPara ) + if ( aSel.end.nPara+1 == nParCnt && aSel.start.nPara == aSel.end.nPara ) { OUString aText = GetEditText(mpEditEngine.get()); - sal_Int32 nSelLen = aSel.nEndPos - aSel.nStartPos; - sal_Int32 nParLen = mpEditEngine->GetTextLen( aSel.nEndPara ); - if ( aSel.nEndPos == nParLen && aText.getLength() == aAutoSearch.getLength() + nSelLen ) + sal_Int32 nSelLen = aSel.end.nIndex - aSel.start.nIndex; + sal_Int32 nParLen = mpEditEngine->GetTextLen( aSel.end.nPara ); + if ( aSel.end.nIndex == nParLen && aText.getLength() == aAutoSearch.getLength() + nSelLen ) { OUString aNew; ScTypedCaseStrSet::const_iterator itNew = @@ -2211,16 +2206,16 @@ void ScInputHandler::NextAutoEntry( bool bBack ) pTableView->DeleteSelected(); pTableView->InsertText( aIns ); pTableView->SetSelection( ESelection( - aSel.nEndPara, aSel.nStartPos + aIns.getLength(), - aSel.nEndPara, aSel.nStartPos ) ); + aSel.end.nPara, aSel.start.nIndex + aIns.getLength(), + aSel.end.nPara, aSel.start.nIndex ) ); } if ( pTopView ) { pTopView->DeleteSelected(); pTopView->InsertText( aIns ); pTopView->SetSelection( ESelection( - aSel.nEndPara, aSel.nStartPos + aIns.getLength(), - aSel.nEndPara, aSel.nStartPos ) ); + aSel.end.nPara, aSel.start.nIndex + aIns.getLength(), + aSel.end.nPara, aSel.start.nIndex ) ); } bInOwnChange = false; @@ -2246,11 +2241,11 @@ void ScInputHandler::UpdateParenthesis() if ( pTableView && !pTableView->HasSelection() ) // Selection is always at the bottom { ESelection aSel = pTableView->GetSelection(); - if (aSel.nStartPos) + if (aSel.start.nIndex) { // Examine character left to the cursor - sal_Int32 nPos = aSel.nStartPos - 1; - OUString aFormula = mpEditEngine->GetText(aSel.nStartPara); + sal_Int32 nPos = aSel.start.nIndex - 1; + OUString aFormula = mpEditEngine->GetText(aSel.start.nPara); sal_Unicode c = aFormula[nPos]; if ( c == '(' || c == ')' ) { @@ -2270,9 +2265,9 @@ void ScInputHandler::UpdateParenthesis() mpEditEngine->RemoveCharAttribs( i, EE_CHAR_WEIGHT ); } - ESelection aSelThis( aSel.nStartPara, nPos, aSel.nStartPara, nPos+1); + ESelection aSelThis(aSel.start.nPara, nPos, aSel.start.nPara, nPos + 1); mpEditEngine->QuickSetAttribs( aSet, aSelThis ); - ESelection aSelOther( aSel.nStartPara, nOther, aSel.nStartPara, nOther+1); + ESelection aSelOther(aSel.start.nPara, nOther, aSel.start.nPara, nOther + 1); mpEditEngine->QuickSetAttribs( aSet, aSelOther ); // Dummy InsertText for Update and Paint (selection is empty) @@ -2680,31 +2675,30 @@ void ScInputHandler::MergeLanguageAttributes( ScEditEngineDefaulter& rDestEngine static void lcl_SetTopSelection( EditView* pEditView, ESelection& rSel ) { - OSL_ENSURE( rSel.nStartPara==0 && rSel.nEndPara==0, "SetTopSelection: Para != 0" ); + OSL_ENSURE( rSel.start.nPara==0 && rSel.end.nPara==0, "SetTopSelection: Para != 0" ); EditEngine& rEngine = pEditView->getEditEngine(); sal_Int32 nCount = rEngine.GetParagraphCount(); if (nCount > 1) { - sal_Int32 nParLen = rEngine.GetTextLen(rSel.nStartPara); - while (rSel.nStartPos > nParLen && rSel.nStartPara+1 < nCount) + sal_Int32 nParLen = rEngine.GetTextLen(rSel.start.nPara); + while (rSel.start.nIndex > nParLen && rSel.start.nPara + 1 < nCount) { - rSel.nStartPos -= nParLen + 1; // Including space from line break - nParLen = rEngine.GetTextLen(++rSel.nStartPara); + rSel.start.nIndex -= nParLen + 1; // Including space from line break + nParLen = rEngine.GetTextLen(++rSel.start.nPara); } - nParLen = rEngine.GetTextLen(rSel.nEndPara); - while (rSel.nEndPos > nParLen && rSel.nEndPara+1 < nCount) + nParLen = rEngine.GetTextLen(rSel.end.nPara); + while (rSel.end.nIndex > nParLen && rSel.end.nPara + 1 < nCount) { - rSel.nEndPos -= nParLen + 1; // Including space from line break - nParLen = rEngine.GetTextLen(++rSel.nEndPara); + rSel.end.nIndex -= nParLen + 1; // Including space from line break + nParLen = rEngine.GetTextLen(++rSel.end.nPara); } } ESelection aSel = pEditView->GetSelection(); - if ( rSel.nStartPara != aSel.nStartPara || rSel.nEndPara != aSel.nEndPara - || rSel.nStartPos != aSel.nStartPos || rSel.nEndPos != aSel.nEndPos ) + if (rSel != aSel) pEditView->SetSelection( rSel ); } @@ -2829,7 +2823,7 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified ) // Cursor before the end? aSel = pActiveView->GetSelection(); aSel.Adjust(); - bNeedGrow = ( aSel.nEndPos != mpEditEngine->GetTextLen(aSel.nEndPara) ); + bNeedGrow = (aSel.end.nIndex != mpEditEngine->GetTextLen(aSel.end.nPara)); } if (!bNeedGrow) { @@ -2958,8 +2952,7 @@ void ScInputHandler::RemoveSelection() return; ESelection aSel = pActiveView->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); if (pTableView) pTableView->SetSelection( aSel ); if (pTopView) @@ -3057,8 +3050,7 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText, S } else { - mpEditEngine->GetView(i)-> - SetSelection( ESelection( nPara, nLen, nPara, nLen ) ); + mpEditEngine->GetView(i)->SetSelection(ESelection(nPara, nLen)); } mpEditEngine->GetView(i)->ShowCursor(false); } @@ -3101,14 +3093,7 @@ static bool lcl_IsNumber(std::u16string_view aString) static void lcl_SelectionToEnd( EditView* pView ) { if ( pView ) - { - EditEngine& rEngine = pView->getEditEngine(); - sal_Int32 nParCnt = rEngine.GetParagraphCount(); - if ( nParCnt == 0 ) - nParCnt = 1; - ESelection aSel( nParCnt-1, rEngine.GetTextLen(nParCnt-1) ); // empty selection, cursor at the end - pView->SetSelection( aSel ); - } + pView->SetSelection(ESelection::AtEnd()); } void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInLOK ) @@ -3274,8 +3259,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL } } - ESelection aSel( 0, 0, nParCnt-1, mpEditEngine->GetTextLen(nParCnt-1) ); - SfxItemSet aOldAttribs = mpEditEngine->GetAttribs( aSel ); + SfxItemSet aOldAttribs = mpEditEngine->GetAttribs(ESelection::All()); const SfxPoolItem* pItem = nullptr; // Find common (cell) attributes before RemoveAdjust @@ -3626,7 +3610,7 @@ void ScInputHandler::SetReference( const ScRange& rRef, const ScDocument& rDoc ) EditView* pActiveView = pTopView ? pTopView : pTableView; ESelection aSel = pActiveView->GetSelection(); aSel.Adjust(); - if ( aSel.nStartPara == 0 && aSel.nStartPos == 0 ) + if (aSel.start.nPara == 0 && aSel.start.nIndex == 0) return; DataChanging(); // Cannot be new @@ -3635,7 +3619,7 @@ void ScInputHandler::SetReference( const ScRange& rRef, const ScDocument& rDoc ) if (pTableView) { ESelection aTabSel = pTableView->GetSelection(); - if (aTabSel.nStartPos > aTabSel.nEndPos && aTabSel.nStartPara == aTabSel.nEndPara) + if (aTabSel.start.nIndex > aTabSel.end.nIndex && aTabSel.start.nPara == aTabSel.end.nPara) { aTabSel.Adjust(); pTableView->SetSelection(aTabSel); @@ -3644,7 +3628,7 @@ void ScInputHandler::SetReference( const ScRange& rRef, const ScDocument& rDoc ) if (pTopView) { ESelection aTopSel = pTopView->GetSelection(); - if (aTopSel.nStartPos > aTopSel.nEndPos && aTopSel.nStartPara == aTopSel.nEndPara) + if (aTopSel.start.nIndex > aTopSel.end.nIndex && aTopSel.start.nPara == aTopSel.end.nPara) { aTopSel.Adjust(); pTopView->SetSelection(aTopSel); @@ -3730,8 +3714,8 @@ void ScInputHandler::InsertFunction( const OUString& rFuncName, bool bAddPar ) if (bAddPar) { ESelection aSel = pTableView->GetSelection(); - --aSel.nStartPos; - --aSel.nEndPos; + --aSel.start.nIndex; + --aSel.end.nIndex; pTableView->SetSelection(aSel); } } @@ -3741,8 +3725,8 @@ void ScInputHandler::InsertFunction( const OUString& rFuncName, bool bAddPar ) if (bAddPar) { ESelection aSel = pTopView->GetSelection(); - --aSel.nStartPos; - --aSel.nEndPos; + --aSel.start.nIndex; + --aSel.end.nIndex; pTopView->SetSelection(aSel); } } @@ -3770,12 +3754,12 @@ void ScInputHandler::ClearText() if (pTableView) { pTableView->getEditEngine().SetText( u""_ustr ); - pTableView->SetSelection( ESelection(0,0, 0,0) ); + pTableView->SetSelection(ESelection()); } if (pTopView) { pTopView->getEditEngine().SetText( u""_ustr ); - pTopView->SetSelection( ESelection(0,0, 0,0) ); + pTopView->SetSelection(ESelection()); } DataChanged(); @@ -4355,11 +4339,11 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, ESelection aSel = pActiveView ? pActiveView->GetSelection() : ESelection(); // if we switched content completely - don't send huge numbers - if (aSel.nStartPara == EE_PARA_NOT_FOUND) - aSel.nStartPara = 0; + if (aSel.start.nPara == EE_PARA_MAX) + aSel.start.nPara = 0; - if (aSel.nEndPara == EE_PARA_NOT_FOUND) - aSel.nEndPara = 0; + if (aSel.end.nPara == EE_PARA_MAX) + aSel.end.nPara = 0; pActiveViewSh->LOKSendFormulabarUpdate(pActiveView, aString, aSel); pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8()); @@ -4585,8 +4569,7 @@ bool ScInputHandler::GetTextAndFields( ScEditEngineDefaulter& rDestEngine ) if (mpEditEngine) { // Contains field? - sal_Int32 nParCnt = mpEditEngine->GetParagraphCount(); - SfxItemSet aSet = mpEditEngine->GetAttribs( ESelection(0,0,nParCnt,0) ); + SfxItemSet aSet = mpEditEngine->GetAttribs(ESelection::All()); SfxItemState eFieldState = aSet.GetItemState( EE_FEATURE_FIELD, false ); if ( eFieldState == SfxItemState::INVALID || eFieldState == SfxItemState::SET ) { @@ -4595,6 +4578,7 @@ bool ScInputHandler::GetTextAndFields( ScEditEngineDefaulter& rDestEngine ) rDestEngine.SetTextCurrentDefaults(*pObj); pObj.reset(); + sal_Int32 nParCnt = mpEditEngine->GetParagraphCount(); // Delete attributes for (sal_Int32 i=0; i 0 ) { nLen--; - pView->SetSelection( ESelection( 0, nLen, 0, nLen ) ); + pView->SetSelection(ESelection(0, nLen)); } pScMod->InputChanged(pView); @@ -675,10 +675,7 @@ void ScInputWindow::SwitchToTextWin() EditView* pView = mxTextWindow->GetEditView(); if (pView) { - sal_Int32 nPara = pView->getEditEngine().GetParagraphCount() ? ( pView->getEditEngine().GetParagraphCount() - 1 ) : 0; - sal_Int32 nLen = pView->getEditEngine().GetTextLen( nPara ); - ESelection aSel( nPara, nLen, nPara, nLen ); - pView->SetSelection( aSel ); // set cursor to end of text + pView->SetSelection(ESelection::AtEnd()); // set cursor to end of text } } } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 8253bec2869b..8020cb8c7471 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1283,8 +1283,8 @@ void ScDocShell::Execute( SfxRequest& rReq ) { ESelection aSel = pEditView->GetSelection(); aOldSel = aSel; - aSel.nStartPos = 0; - aSel.nEndPos = EE_TEXTPOS_ALL; + aSel.start.nIndex = 0; + aSel.end.nIndex = EE_TEXTPOS_MAX; pEditView->SetSelection( aSel ); } diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index cc2b3e561488..d5d00a2f04bd 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -593,7 +593,7 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) ESelection aOldSel = rOutView.GetSelection(); ESelection aSel = aOldSel; aSel.Adjust(); - sal_Int32 nNewEnd = aSel.nEndPos; + sal_Int32 nNewEnd = aSel.end.nIndex; bool bUpdate = pOutliner->IsUpdateLayout(); bool bChanged = false; @@ -603,7 +603,7 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) sal_Int32 nParCount = pOutliner->GetParagraphCount(); for (sal_Int32 nPar=0; nPar= aSel.nStartPara && nPar <= aSel.nEndPara ) + if (nPar >= aSel.start.nPara && nPar <= aSel.end.nPara) { std::vector aPortions; rEditEng.GetPortions( nPar, aPortions ); @@ -615,8 +615,8 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) sal_Int32 nStart = nPos ? aPortions[ nPos - 1 ] : 0; // fields are single characters if ( nEnd == nStart+1 && - ( nPar > aSel.nStartPara || nStart >= aSel.nStartPos ) && - ( nPar < aSel.nEndPara || nEnd <= aSel.nEndPos ) ) + ( nPar > aSel.start.nPara || nStart >= aSel.start.nIndex ) && + ( nPar < aSel.end.nPara || nEnd <= aSel.end.nIndex ) ) { ESelection aFieldSel( nPar, nStart, nPar, nEnd ); SfxItemSet aSet = rEditEng.GetAttribs( aFieldSel ); @@ -636,7 +636,7 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) OUString aFieldText = rEditEng.GetText( aFieldSel ); pOutliner->QuickInsertText( aFieldText, aFieldSel ); - if ( nPar == aSel.nEndPara ) + if (nPar == aSel.end.nPara) { nNewEnd = nNewEnd + aFieldText.getLength(); --nNewEnd; @@ -653,9 +653,9 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) } if ( aOldSel == aSel ) // aSel is adjusted - aOldSel.nEndPos = nNewEnd; + aOldSel.end.nIndex = nNewEnd; else - aOldSel.nStartPos = nNewEnd; // if aOldSel is backwards + aOldSel.start.nIndex = nNewEnd; // if aOldSel is backwards rOutView.SetSelection( aOldSel ); } diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 9125e5f60b4a..3826e04fe474 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -612,8 +612,7 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, } else if ( bCursorToEnd ) { - ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); - pOLV->SetSelection(aNewSelection); + pOLV->SetSelection(ESelection::AtEnd()); } if ( pInitialKey ) diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index fb7fa43ba54c..46baa84adf69 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -451,7 +451,7 @@ void ScFunctionWin::DoEnter(bool bDoubleOrEnter) pHdl->InsertFunction(aString); pEdView->InsertText(aArgStr.makeStringAndClear(),true); ESelection aESel=pEdView->GetSelection(); - aESel.nEndPos = aESel.nStartPos + aFirstArgStr.getLength(); + aESel.end.nIndex = aESel.start.nIndex + aFirstArgStr.getLength(); pEdView->SetSelection(aESel); pHdl->DataChanged(); } diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx index 97f179a4fa65..1178594b4092 100644 --- a/sc/source/ui/pagedlg/scuitphfedit.cxx +++ b/sc/source/ui/pagedlg/scuitphfedit.cxx @@ -445,11 +445,11 @@ bool ScHFEditPage::IsPageEntry(EditEngine*pEngine, const EditTextObject* pTextOb { OUString aPageEntry(m_xFtPage->get_label() + " "); ESelection aSel; - aSel.nEndPos = aPageEntry.getLength(); + aSel.end.nIndex = aPageEntry.getLength(); if(aPageEntry == pEngine->GetText(aSel)) { - aSel.nStartPos = aSel.nEndPos; - aSel.nEndPos++; + aSel.start.nIndex = aSel.end.nIndex; + aSel.end.nIndex++; std::unique_ptr< EditTextObject > pPageObj = pEngine->CreateTextObject(aSel); if(pPageObj && pPageObj->IsFieldObject() ) { @@ -534,14 +534,14 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) ESelection aSel; OUString aPageEntry( m_xFtPage->get_label() + " "); m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry); - aSel.nEndPos = aPageEntry.getLength(); - m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - ++aSel.nEndPos; + aSel.end.nIndex = aPageEntry.getLength(); + m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.end)); + ++aSel.end.nIndex; OUString aPageOfEntry(" " + m_xFtOf->get_label() + " "); - m_xWndCenter->GetEditEngine()->QuickInsertText(aPageOfEntry,ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - aSel.nEndPos = aSel.nEndPos + aPageOfEntry.getLength(); - m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + m_xWndCenter->GetEditEngine()->QuickInsertText(aPageOfEntry,ESelection(aSel.end)); + aSel.end.nIndex += aPageOfEntry.getLength(); + m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(aSel.end)); pTextObj = m_xWndCenter->GetEditEngine()->CreateTextObject(); m_xWndCenter->SetText(*pTextObj); if(!bTravelling) @@ -576,12 +576,12 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) ClearTextAreas(); ESelection aSel; m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD ), aSel ); - ++aSel.nEndPos; + ++aSel.end.nIndex; OUString aPageEntry(", " + m_xFtPage->get_label() + " "); - m_xWndCenter->GetEditEngine()->QuickInsertText(aPageEntry, ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - aSel.nStartPos = aSel.nEndPos; - aSel.nEndPos = aSel.nEndPos + aPageEntry.getLength(); - m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + m_xWndCenter->GetEditEngine()->QuickInsertText(aPageEntry, ESelection(aSel.end)); + aSel.start.nIndex = aSel.end.nIndex; + aSel.end.nIndex += aPageEntry.getLength(); + m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.end)); pTextObj = m_xWndCenter->GetEditEngine()->CreateTextObject(); m_xWndCenter->SetText(*pTextObj); if(!bTravelling) @@ -603,14 +603,14 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) ESelection aSel; OUString aPageEntry( m_xFtPage->get_label() + " " ); m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry); - aSel.nEndPos = aPageEntry.getLength(); - m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - ++aSel.nEndPos; + aSel.end.nIndex = aPageEntry.getLength(); + m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.end)); + ++aSel.end.nIndex; OUString aCommaSpace(u", "_ustr); - m_xWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - aSel.nEndPos = aSel.nEndPos + aCommaSpace.getLength(); - m_xWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + m_xWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.end)); + aSel.end.nIndex += aCommaSpace.getLength(); + m_xWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection(aSel.end)); pTextObj = m_xWndCenter->GetEditEngine()->CreateTextObject(); m_xWndCenter->SetText(*pTextObj); if(!bTravelling) @@ -624,13 +624,13 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) ESelection aSel; OUString aPageEntry( m_xFtPage->get_label() + " " ); m_xWndCenter->GetEditEngine()->SetTextCurrentDefaults(aPageEntry); - aSel.nEndPos = aPageEntry.getLength(); - m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - ++aSel.nEndPos; + aSel.end.nIndex = aPageEntry.getLength(); + m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.end)); + ++aSel.end.nIndex; OUString aCommaSpace(u", "_ustr); - m_xWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - aSel.nEndPos = aSel.nEndPos + aCommaSpace.getLength(); - m_xWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + m_xWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.end)); + aSel.end.nIndex += aCommaSpace.getLength(); + m_xWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(aSel.end)); pTextObj = m_xWndCenter->GetEditEngine()->CreateTextObject(); m_xWndCenter->SetText(*pTextObj); if(!bTravelling) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index f602b6ca0e3c..384671ea0d99 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6002,8 +6002,7 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference append aSelection.Adjust(); - aSelection.nStartPara = aSelection.nEndPara; - aSelection.nStartPos = aSelection.nEndPos; + aSelection.CollapseToEnd(); } if (pCellField->GetFieldType() == text::textfield::Type::TABLE) @@ -6016,8 +6015,8 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference xParent(this); pCellField->InitDoc( xParent, std::make_unique(pDocSh, aCellPos), aSelection); @@ -6025,7 +6024,7 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::ReferenceSetSelection( aSelection ); diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index db2a3538341b..110b9ddc2ddd 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -174,7 +174,7 @@ public: sal_uInt16 CountFields(); SvxFieldData* FindByIndex(sal_uInt16 nIndex); - SvxFieldData* FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType); + SvxFieldData* FindByPos(const EPaM& rPos, sal_Int32 nType); sal_Int32 GetFieldPar() const { return nFieldPar; } sal_Int32 GetFieldPos() const { return nFieldPos; } @@ -248,11 +248,11 @@ SvxFieldData* ScUnoEditEngine::FindByIndex(sal_uInt16 nIndex) return pFound.get(); } -SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType) +SvxFieldData* ScUnoEditEngine::FindByPos(const EPaM& rPos, sal_Int32 nType) { eMode = SC_UNO_COLLECT_FINDPOS; - nFieldPar = nPar; - nFieldPos = nPos; + nFieldPar = rPos.nPara; + nFieldPos = rPos.nIndex; mnFieldType = nType; nFieldCount = 0; UpdateFields(); @@ -618,7 +618,7 @@ void ScEditFieldObj::setPropertyValueURL(const OUString& rName, const css::uno:: // don't care about the type (only URLs can be found in the cells) SvxFieldData* pField = aTempEngine.FindByPos( - aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED); + aSelection.start, text::textfield::Type::UNSPECIFIED); OSL_ENSURE(pField,"setPropertyValue: Field not found"); if (!pField) return; @@ -687,7 +687,7 @@ uno::Any ScEditFieldObj::getPropertyValueURL(const OUString& rName) // don't care about the type (only URLs can be found in the cells) const SvxFieldData* pField = aTempEngine.FindByPos( - aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED); + aSelection.start, text::textfield::Type::UNSPECIFIED); OSL_ENSURE(pField,"getPropertyValue: Field not found"); if (!pField) throw uno::RuntimeException(); @@ -737,7 +737,7 @@ void ScEditFieldObj::setPropertyValueFile(const OUString& rName, const uno::Any& ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine(); ScUnoEditEngine aTempEngine(pEditEngine); SvxFieldData* pField = aTempEngine.FindByPos( - aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::EXTENDED_FILE); + aSelection.start, text::textfield::Type::EXTENDED_FILE); OSL_ENSURE(pField, "setPropertyValueFile: Field not found"); if (pField) { @@ -768,7 +768,7 @@ uno::Any ScEditFieldObj::getPropertyValueFile(const OUString& rName) ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine(); ScUnoEditEngine aTempEngine(pEditEngine); pField = aTempEngine.FindByPos( - aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::EXTENDED_FILE); + aSelection.start, text::textfield::Type::EXTENDED_FILE); } else pField = &getData(); @@ -792,7 +792,7 @@ void ScEditFieldObj::setPropertyValueDateTime(const OUString& rName, const uno:: // Field already inserted. ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine(); ScUnoEditEngine aTempEngine(pEditEngine); - SvxFieldData* pField = aTempEngine.FindByPos(aSelection.nStartPara, aSelection.nStartPos, meType); + SvxFieldData* pField = aTempEngine.FindByPos(aSelection.start, meType); if (!pField) return; @@ -886,7 +886,7 @@ uno::Any ScEditFieldObj::getPropertyValueDateTime(const OUString& rName) // Field already inserted. ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine(); ScUnoEditEngine aTempEngine(pEditEngine); - SvxFieldData* pField = aTempEngine.FindByPos(aSelection.nStartPara, aSelection.nStartPos, meType); + SvxFieldData* pField = aTempEngine.FindByPos(aSelection.start, meType); if (!pField) throw uno::RuntimeException(); @@ -994,7 +994,7 @@ void ScEditFieldObj::setPropertyValueSheet(const OUString& rName, const uno::Any // don't care about the type (only URLs can be found in the cells) SvxFieldData* pField = aTempEngine.FindByPos( - aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED); + aSelection.start, text::textfield::Type::UNSPECIFIED); OSL_ENSURE(pField,"setPropertyValue: Field not found"); if (!pField) return; @@ -1089,8 +1089,7 @@ void ScEditFieldObj::DeleteField() pForwarder->QuickInsertText( OUString(), aSelection ); mpEditSource->UpdateData(); - aSelection.nEndPara = aSelection.nStartPara; - aSelection.nEndPos = aSelection.nStartPos; + aSelection.CollapseToStart(); //! Broadcast in order to adjust selection in other objects //! (also for other actions) @@ -1117,7 +1116,7 @@ OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand ) // don't care about the type (only URLs can be found in the cells) const SvxFieldData* pField = aTempEngine.FindByPos( - aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED); + aSelection.start, text::textfield::Type::UNSPECIFIED); OSL_ENSURE(pField,"getPresentation: Field not found"); if (!pField) return OUString(); diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index a55cd8880c58..4e4070502dc2 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -385,8 +385,7 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent( { // don't replace -> append at end aSelection.Adjust(); - aSelection.nStartPara = aSelection.nEndPara; - aSelection.nStartPos = aSelection.nEndPos; + aSelection.CollapseToEnd(); } SvxFieldItem aItem(pHeaderField->CreateFieldItem()); @@ -397,8 +396,8 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent( // new selection: a digit aSelection.Adjust(); - aSelection.nEndPara = aSelection.nStartPara; - aSelection.nEndPos = aSelection.nStartPos + 1; + aSelection.end.nPara = aSelection.start.nPara; + aSelection.end.nIndex = aSelection.start.nIndex + 1; uno::Reference xTextRange; switch ( aTextData.GetPart() ) @@ -419,7 +418,7 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent( // for bAbsorb=FALSE, the new selection must be behind the inserted content // (the xml filter relies on this) if (!bAbsorb) - aSelection.nStartPos = aSelection.nEndPos; + aSelection.start.nIndex = aSelection.end.nIndex; pTextRange->SetSelection( aSelection ); @@ -556,8 +555,7 @@ uno::Reference SAL_CALL ScCellTextCursor::getStart() rtl::Reference pNew = new ScCellTextCursor( *this ); ESelection aNewSel(GetSelection()); - aNewSel.nEndPara = aNewSel.nStartPara; - aNewSel.nEndPos = aNewSel.nStartPos; + aNewSel.CollapseToStart(); pNew->SetSelection( aNewSel ); return static_cast(pNew.get()); @@ -572,8 +570,7 @@ uno::Reference SAL_CALL ScCellTextCursor::getEnd() rtl::Reference pNew = new ScCellTextCursor( *this ); ESelection aNewSel(GetSelection()); - aNewSel.nStartPara = aNewSel.nEndPara; - aNewSel.nStartPos = aNewSel.nEndPos; + aNewSel.CollapseToEnd(); pNew->SetSelection( aNewSel ); return static_cast(pNew.get()); @@ -607,8 +604,7 @@ uno::Reference SAL_CALL ScHeaderFooterTextCursor::getStart() rtl::Reference pNew = new ScHeaderFooterTextCursor( *this ); ESelection aNewSel(GetSelection()); - aNewSel.nEndPara = aNewSel.nStartPara; - aNewSel.nEndPos = aNewSel.nStartPos; + aNewSel.CollapseToStart(); pNew->SetSelection( aNewSel ); return static_cast(pNew.get()); @@ -623,8 +619,7 @@ uno::Reference SAL_CALL ScHeaderFooterTextCursor::getEnd() rtl::Reference pNew = new ScHeaderFooterTextCursor( *this ); ESelection aNewSel(GetSelection()); - aNewSel.nStartPara = aNewSel.nEndPara; - aNewSel.nStartPos = aNewSel.nEndPos; + aNewSel.CollapseToEnd(); pNew->SetSelection( aNewSel ); return static_cast(pNew.get()); @@ -663,8 +658,7 @@ uno::Reference SAL_CALL ScDrawTextCursor::getStart() rtl::Reference pNew = new ScDrawTextCursor( *this ); ESelection aNewSel(GetSelection()); - aNewSel.nEndPara = aNewSel.nStartPara; - aNewSel.nEndPos = aNewSel.nStartPos; + aNewSel.CollapseToStart(); pNew->SetSelection( aNewSel ); return static_cast(pNew.get()); @@ -679,8 +673,7 @@ uno::Reference SAL_CALL ScDrawTextCursor::getEnd() rtl::Reference pNew = new ScDrawTextCursor( *this ); ESelection aNewSel(GetSelection()); - aNewSel.nStartPara = aNewSel.nEndPara; - aNewSel.nStartPos = aNewSel.nEndPos; + aNewSel.CollapseToEnd(); pNew->SetSelection( aNewSel ); return static_cast(pNew.get()); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 328cee53267e..7593b037020c 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -3059,8 +3059,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( pEditView ) { ESelection aTextSel = pEditView->GetSelection(); - aTextSel.nStartPos = 0; - aTextSel.nEndPos = EE_TEXTPOS_ALL; + aTextSel.start.nIndex = 0; + aTextSel.end.nIndex = EE_TEXTPOS_MAX; pHdl->DataChanging(); pEditView->SetSelection(aTextSel); pEditView->InsertText(aFormula); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index f514a75e5402..3e8a5abe7b1d 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -351,16 +351,16 @@ void ScEditShell::Execute( SfxRequest& rReq ) OUString sInput(aSel.HasRange() ? pActiveView->GetSelected() : rEngine.GetText()); - if( aSel.nStartPos > aSel.nEndPos ) - aSel.nEndPos = aSel.nStartPos; + if (aSel.start.nIndex > aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex; //calculate a valid end-position by reading logical characters sal_Int32 nUtf16Pos=0; - while( (nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.nEndPos) ) + while ((nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.end.nIndex)) { sInput.iterateCodePoints(&nUtf16Pos); - if( nUtf16Pos > aSel.nEndPos ) - aSel.nEndPos = nUtf16Pos; + if (nUtf16Pos > aSel.end.nIndex) + aSel.end.nIndex = nUtf16Pos; } ToggleUnicodeCodepoint aToggle; @@ -369,7 +369,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) OUString sReplacement = aToggle.ReplacementString(); if( !sReplacement.isEmpty() ) { - aSel.nStartPos = aSel.nEndPos - aToggle.StringToReplace().getLength(); + aSel.start.nIndex = aSel.end.nIndex - aToggle.StringToReplace().getLength(); pTableView->SetSelection( aSel ); pTableView->InsertText(sReplacement, true); if( pTopView ) @@ -540,7 +540,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) ScDocument& rDoc = rViewData.GetDocument(); ScRefFinder aFinder(aText, rViewData.GetCurPos(), rDoc, rDoc.GetAddressConvention()); - aFinder.ToggleRel( aSel.nStartPos, aSel.nEndPos ); + aFinder.ToggleRel(aSel.start.nIndex, aSel.end.nIndex); if (aFinder.GetFound()) { const OUString& aNew = aFinder.GetText(); @@ -588,8 +588,8 @@ void ScEditShell::Execute( SfxRequest& rReq ) ESelection aSel = pTableView->GetSelection(); aSel.Adjust(); - aSel.nEndPara = aSel.nStartPara; - aSel.nEndPos = aSel.nStartPos + 1; + aSel.end.nPara = aSel.start.nPara; + aSel.end.nIndex = aSel.start.nIndex + 1; pTableView->SetSelection( aSel ); // insert new field @@ -605,8 +605,8 @@ void ScEditShell::Execute( SfxRequest& rReq ) if ( pTopView ) { aSel = pTopView->GetSelection(); - aSel.nEndPara = aSel.nStartPara; - aSel.nEndPos = aSel.nStartPos + 1; + aSel.end.nPara = aSel.start.nPara; + aSel.end.nIndex = aSel.start.nIndex + 1; pTopView->SetSelection( aSel ); pTopView->InsertField( aURLItem ); pTopView->SetSelection( aSel ); // select inserted field @@ -899,10 +899,10 @@ std::unique_ptr ScEditShell::GetFirstURLFieldFromCell() rEditEngine.GetPortions(nPara, aPosList); for (const auto& rPos : aPosList) { - aSel.nEndPos = rPos; + aSel.end.nIndex = rPos; SfxItemSet aEditSet(rEditEngine.GetAttribs(aSel)); - if (aSel.nStartPos + 1 == aSel.nEndPos) + if (aSel.start.nIndex + 1 == aSel.end.nIndex) { // test if the character is a text field if (const SvxFieldItem* pItem = aEditSet.GetItemIfSet(EE_FEATURE_FIELD, false)) @@ -914,7 +914,7 @@ std::unique_ptr ScEditShell::GetFirstURLFieldFromCell() } } } - aSel.nStartPos = aSel.nEndPos; + aSel.start.nIndex = aSel.end.nIndex; } } @@ -1312,7 +1312,7 @@ OUString ScEditShell::GetSelectionText( bool bWholeWord ) OUString aStrCurrentDelimiters = rEngine.GetWordDelimiters(); rEngine.SetWordDelimiters(u" .,;\"'"_ustr); - aStrSelection = rEngine.GetWord( aSel.nEndPara, aSel.nEndPos ); + aStrSelection = rEngine.GetWord(aSel.end); rEngine.SetWordDelimiters( aStrCurrentDelimiters ); } else diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 3a7447e170c0..42b906f66730 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3572,8 +3572,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S aTextPos -= aOutputArea.TopLeft(); aTextPos += aVisArea.TopLeft(); // position in the edit document - EPosition aDocPosition = rEditEngine.FindDocPosition(aTextPos); - ESelection aCompare(aDocPosition.nPara, aDocPosition.nIndex); + ESelection aCompare(rEditEngine.FindDocPosition(aTextPos)); ESelection aSelection = pEditView->GetSelection(); aSelection.Adjust(); // needed for IsLess/IsGreater if ( aCompare < aSelection || aCompare > aSelection ) @@ -3621,8 +3620,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S aTextPos -= aOutputArea.TopLeft(); aTextPos += aVisArea.TopLeft(); // position in the edit document - EPosition aDocPosition = rEditEngine.FindDocPosition(aTextPos); - ESelection aCompare(aDocPosition.nPara, aDocPosition.nIndex); + ESelection aCompare(rEditEngine.FindDocPosition(aTextPos)); ESelection aSelection = pOlView->GetSelection(); aSelection.Adjust(); // needed for IsLess/IsGreater if ( aCompare < aSelection || aCompare > aSelection ) diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index ee66fe18f8b4..c0e2372908be 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -151,11 +151,11 @@ void ScTabViewShell::InsertURL( const OUString& rName, const OUString& rURL, con static void lcl_SelectFieldAfterInsert( EditView& rView ) { ESelection aSel = rView.GetSelection(); - if ( aSel.nStartPos == aSel.nEndPos && aSel.nStartPos > 0 ) + if (aSel.start.nIndex == aSel.end.nIndex && aSel.start.nIndex > 0) { // Cursor is behind the inserted field -> extend selection to the left - --aSel.nStartPos; + --aSel.start.nIndex; rView.SetSelection( aSel ); } } diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 324b42d77c0b..d4b7ea83d9a8 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -728,11 +728,7 @@ void ScViewFunc::InsertBookmark( const OUString& rDescription, const OUString& r aEngine.SetText(aOld); } - sal_Int32 nPara = aEngine.GetParagraphCount(); - if (nPara) - --nPara; - sal_Int32 nTxtLen = aEngine.GetTextLen(nPara); - ESelection aInsSel( nPara, nTxtLen, nPara, nTxtLen ); + ESelection aInsSel(ESelection::AtEnd()); if ( bTryReplace && HasBookmarkAtCursor( nullptr ) ) { diff --git a/sd/qa/unit/TextFittingTest.cxx b/sd/qa/unit/TextFittingTest.cxx index 750614c937ff..f01108704ef1 100644 --- a/sd/qa/unit/TextFittingTest.cxx +++ b/sd/qa/unit/TextFittingTest.cxx @@ -90,17 +90,17 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest) CPPUNIT_ASSERT_EQUAL(sal_Int32(6), rEditEngine.GetParagraphCount()); // Delete paragraph 6 - rEditView.SetSelection(ESelection(4, EE_TEXTPOS_MAX_COUNT, 5, EE_TEXTPOS_MAX_COUNT)); + rEditView.SetSelection(ESelection(4, EE_TEXTPOS_MAX, 5, EE_TEXTPOS_MAX)); rEditView.DeleteSelected(); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), rEditEngine.GetParagraphCount()); // Delete paragraph 5 - rEditView.SetSelection(ESelection(3, EE_TEXTPOS_MAX_COUNT, 4, EE_TEXTPOS_MAX_COUNT)); + rEditView.SetSelection(ESelection(3, EE_TEXTPOS_MAX, 4, EE_TEXTPOS_MAX)); rEditView.DeleteSelected(); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), rEditEngine.GetParagraphCount()); // Delete paragraph 4 - rEditView.SetSelection(ESelection(2, EE_TEXTPOS_MAX_COUNT, 3, EE_TEXTPOS_MAX_COUNT)); + rEditView.SetSelection(ESelection(2, EE_TEXTPOS_MAX, 3, EE_TEXTPOS_MAX)); rEditView.DeleteSelected(); CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rEditEngine.GetParagraphCount()); diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index f08f2a919831..7e76d6738362 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -144,7 +144,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testPostKeyEvent) CPPUNIT_ASSERT(pView->GetTextEditObject()); EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); // Did we manage to enter a second character? - CPPUNIT_ASSERT_EQUAL(static_cast(2), rEditView.GetSelection().nStartPos); + CPPUNIT_ASSERT_EQUAL(static_cast(2), rEditView.GetSelection().start.nIndex); ESelection aWordSelection(0, 0, 0, 2); // start para, start char, end para, end char. rEditView.SetSelection(aWordSelection); // Did we enter the expected character? @@ -167,7 +167,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testPostMouseEvent) CPPUNIT_ASSERT(pView->GetTextEditObject()); EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); // Did we manage to go after the first character? - CPPUNIT_ASSERT_EQUAL(static_cast(1), rEditView.GetSelection().nStartPos); + CPPUNIT_ASSERT_EQUAL(static_cast(1), rEditView.GetSelection().start.nIndex); vcl::Cursor* pCursor = rEditView.GetCursor(); Point aPosition(pCursor->GetPos().getX(), pCursor->GetPos().getY() + pCursor->GetSize().Height() / 2); @@ -181,7 +181,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testPostMouseEvent) Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(pView->GetTextEditObject()); // The new cursor position must be before the first word. - CPPUNIT_ASSERT_EQUAL(static_cast(0), rEditView.GetSelection().nStartPos); + CPPUNIT_ASSERT_EQUAL(static_cast(0), rEditView.GetSelection().start.nIndex); } CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSetTextSelection) @@ -1860,7 +1860,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testIMESupport) // the cursor should be at position 3rd EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); - CPPUNIT_ASSERT_EQUAL(static_cast(3), rEditView.GetSelection().nStartPos); + CPPUNIT_ASSERT_EQUAL(static_cast(3), rEditView.GetSelection().start.nIndex); ESelection aWordSelection(0, 0, 0, 3); // start para, start char, end para, end char. rEditView.SetSelection(aWordSelection); @@ -2392,7 +2392,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testPasteUndo) // - Actual : 4 // i.e. the cursor position after undo was at the end of the line, not at the start, as // expected. - CPPUNIT_ASSERT_EQUAL(static_cast(0), aSelection.nStartPos); + CPPUNIT_ASSERT_EQUAL(static_cast(0), aSelection.start.nIndex); } CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testShapeEditInMultipleViews) diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 0f15578d1f36..d99098edd6fb 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -224,7 +224,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf111522) { &aInputString }); CPPUNIT_ASSERT(pView2->GetTextEditObject()); EditView& rEditView = pView2->GetTextEditOutlinerView()->GetEditView(); - CPPUNIT_ASSERT_EQUAL(static_cast(4), rEditView.GetSelection().nStartPos); + CPPUNIT_ASSERT_EQUAL(static_cast(4), rEditView.GetSelection().start.nIndex); pView2->SdrEndTextEdit(); // Without the accompanying fix in place, this test would have failed with an assertion failure // in SdrObjEditView::SdrEndTextEdit() as mpOldTextEditUndoManager was not nullptr. diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index d172d5acd0af..e3743c97ca42 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -610,7 +610,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq ) aStr += sQuote + "\"\n"; for( sal_Int32 nIdx = 0; nIdx >= 0; ) - aOutliner.Insert( aStr.getToken( 0, '\n', nIdx ), EE_PARA_APPEND, -1 ); + aOutliner.Insert(aStr.getToken(0, '\n', nIdx), EE_PARA_MAX, -1); if( aOutliner.GetParagraphCount() > 1 ) { @@ -618,8 +618,8 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq ) aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC)); ESelection aSel; - aSel.nEndPara = aOutliner.GetParagraphCount()-2; - aSel.nEndPos = aOutliner.GetText( aOutliner.GetParagraph( aSel.nEndPara ) ).getLength(); + aSel.end.nPara = aOutliner.GetParagraphCount() - 2; + aSel.end.nIndex = aOutliner.GetText( aOutliner.GetParagraph( aSel.end.nPara ) ).getLength(); aOutliner.QuickSetAttribs( aAnswerSet, aSel ); } diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index 1de79f30cb2c..01b9181f020c 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -354,7 +354,7 @@ void AnnotationWindow::FillMenuButton() void AnnotationWindow::StartEdit() { - GetOutlinerView()->SetSelection(ESelection::NoSelection()); + GetOutlinerView()->SetSelection(ESelection::AtEnd()); GetOutlinerView()->ShowCursor(); } @@ -455,8 +455,7 @@ void AnnotationWindow::SetLanguage(const SvxLanguageItem &aNewItem) mpOutliner->SetModifyHdl( Link() ); ESelection aOld = GetOutlinerView()->GetSelection(); - ESelection aNewSelection( 0, 0, mpOutliner->GetParagraphCount()-1, EE_TEXTPOS_ALL ); - GetOutlinerView()->SetSelection( aNewSelection ); + GetOutlinerView()->SetSelection(ESelection::All()); SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs()); aEditAttr.Put(aNewItem); GetOutlinerView()->SetAttribs( aEditAttr ); diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index fe5c17045efe..056c56b32e97 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -570,7 +570,7 @@ bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool if( pOPO ) pOutl->SetText( *pOPO ); - EPosition aDateFieldPosition; + EPaM aDateFieldPosition; bool bHasDateFieldItem = false; sal_Int32 nParaCount = pEdit->GetParagraphCount(); diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index e4e3f9d4d171..1ebde799f15a 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -341,8 +341,8 @@ void DrawDocShell::Execute( SfxRequest& rReq ) { ESelection aSel = rEditView.GetSelection(); aOldSel = aSel; - aSel.nStartPos = 0; - aSel.nEndPos = EE_TEXTPOS_ALL; + aSel.start.nIndex = 0; + aSel.end.nIndex = EE_TEXTPOS_MAX; rEditView.SetSelection( aSel ); } diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index a19e6ff51a3a..ba2e1d71cc50 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -138,8 +138,7 @@ void FuBullet::InsertFormattingMark( sal_Unicode cMark ) pOV->InsertText( aStr, true); ESelection aSel = pOV->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); pOV->SetSelection(aSel); rUndoMgr.LeaveListAction(); @@ -270,8 +269,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq ) pOV->SetAttribs(aSet); ESelection aSel = pOV->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); pOV->SetSelection(aSel); // do not go ahead with setting attributes of special characters diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 639c9845ba14..630ea14ae3aa 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -473,8 +473,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) { Paragraph* pPara = aOutliner.GetParagraph( 0 ); sal_uLong nLen = aOutliner.GetText( pPara ).getLength(); - aOutliner.QuickDelete( ESelection( 0, nLen, 1, 0 ) ); - aOutliner.QuickInsertLineBreak( ESelection( 0, nLen, 0, nLen ) ); + aOutliner.QuickInsertLineBreak(ESelection(0, nLen, 1, 0)); } } } diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx index ac5d87636098..2640b9251f19 100644 --- a/sd/source/ui/func/fuparagr.cxx +++ b/sd/source/ui/func/fuparagr.cxx @@ -82,8 +82,8 @@ void FuParagraph::DoExecute( SfxRequest& rReq ) if( pOutlView && pOutliner ) { ESelection eSelection = pOutlView->GetSelection(); - aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.nStartPara ) ) ); - aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.nStartPara ) ) ); + aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.start.nPara ) ) ); + aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.start.nPara ) ) ); } SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); @@ -114,13 +114,13 @@ void FuParagraph::DoExecute( SfxRequest& rReq ) if( const SfxBoolItem* pItem = pArgs->GetItemIfSet( ATTR_NUMBER_NEWSTART, false ) ) { const bool bNewStart = pItem->GetValue(); - pOutliner->SetParaIsNumberingRestart( eSelection.nStartPara, bNewStart ); + pOutliner->SetParaIsNumberingRestart( eSelection.start.nPara, bNewStart ); } if( const SfxInt16Item* pItem = pArgs->GetItemIfSet( ATTR_NUMBER_NEWSTART_AT, false ) ) { const sal_Int16 nStartAt = pItem->GetValue(); - pOutliner->SetNumberingStartValue( eSelection.nStartPara, nStartAt ); + pOutliner->SetNumberingStartValue( eSelection.start.nPara, nStartAt ); } } diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 24f8ad1e3046..799dc51c42aa 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -1098,9 +1098,8 @@ void FuText::SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag) else { // Move cursor to end of text - ESelection aNewSelection = ESelection::NotFound(); if (pOLV != nullptr) - pOLV->SetSelection(aNewSelection); + pOLV->SetSelection(ESelection::AtEnd()); } } else @@ -1376,11 +1375,7 @@ void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFo pOLV = pView->GetTextEditOutlinerView(); if( pOLV ) { - EditEngine& rEditEngine = pOLV->GetEditView().getEditEngine(); - ESelection aSel; - aSel.nEndPara = rEditEngine.GetParagraphCount() - 1; - aSel.nEndPos = rEditEngine.GetTextLen(aSel.nEndPara); - pOLV->SetSelection(aSel); + pOLV->SetSelection(ESelection::All()); ChangeFontSize( bGrow, pOLV, pFontList, pView ); } diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index 13e9643e95fb..8ed2ece29d7c 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -461,14 +461,14 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: ESelection aEndSel( GetSelection( xPortion->getEnd() ) ); // special case for empty portions with content or length one portions with content (fields) - if( (aStartSel.nStartPos == aEndSel.nStartPos) || ( (aStartSel.nStartPos == (aEndSel.nStartPos - 1)) && (nLen > 1) ) ) + if( (aStartSel.start.nIndex == aEndSel.start.nIndex) || ( (aStartSel.start.nIndex == (aEndSel.start.nIndex - 1)) && (nLen > 1) ) ) { for( sal_Int32 i = 0; i < nLen; i++ ) { if( ndbg < (nTextLen+2) ) { - *pPos++ = aStartSel.nStartPos; - *pPara++ = aStartSel.nStartPara; + *pPos++ = aStartSel.start.nIndex; + *pPara++ = aStartSel.start.nPara; ndbg += 1; } @@ -478,7 +478,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: } } - nLastPos = aStartSel.nStartPos; + nLastPos = aStartSel.start.nIndex; } // normal case else @@ -487,8 +487,8 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: { if( ndbg < (nTextLen+2) ) { - *pPos++ = aStartSel.nStartPos++; - *pPara++ = aStartSel.nStartPara; + *pPos++ = aStartSel.start.nIndex++; + *pPara++ = aStartSel.start.nPara; ndbg += 1; } @@ -498,10 +498,10 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: } } - nLastPos = aStartSel.nStartPos - 1; - DBG_ASSERT( aEndSel.nStartPos == aStartSel.nStartPos, "Search is not working" ); + nLastPos = aStartSel.start.nIndex - 1; + DBG_ASSERT( aEndSel.start.nIndex == aStartSel.start.nIndex, "Search is not working" ); } - nLastPara = aStartSel.nStartPara; + nLastPara = aStartSel.start.nPara; } } } @@ -529,7 +529,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: sal_Int32 nEndPos = 0; for( nStartPos = 0; nStartPos < nTextLen; nStartPos++ ) { - if( pConvertPara[nStartPos] == aSel.nStartPara && pConvertPos[nStartPos] == aSel.nStartPos ) + if( pConvertPara[nStartPos] == aSel.start.nPara && pConvertPos[nStartPos] == aSel.start.nIndex ) break; } diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx b/sd/source/ui/view/NotesPanelViewShell.cxx index e2fadf2a2c5c..2834a895b712 100644 --- a/sd/source/ui/view/NotesPanelViewShell.cxx +++ b/sd/source/ui/view/NotesPanelViewShell.cxx @@ -426,7 +426,7 @@ void NotesPanelViewShell::GetCtrlState(SfxItemSet& rSet) if (pFieldItem) { ESelection aSel = pOLV->GetSelection(); - if (abs(aSel.nEndPos - aSel.nStartPos) == 1) + if (abs(aSel.end.nIndex - aSel.start.nIndex) == 1) { const SvxFieldData* pField = pFieldItem->GetField(); if (auto pUrlField = dynamic_cast(pField)) @@ -531,7 +531,7 @@ void NotesPanelViewShell::GetAttrState(SfxItemSet& rSet) OutlinerView* pOV = mpNotesPanelView->GetOutlinerView(); ESelection aESel(pOV->GetSelection()); - if (aESel.nStartPara != aESel.nEndPara || aESel.nStartPos != aESel.nEndPos) + if (aESel.HasRange()) // spanned selection, i.e. StyleSheet and/or // attribution not necessarily unique rSet.DisableItem(nWhich); @@ -845,10 +845,10 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) EE_FEATURE_FIELD); ESelection aSel(pOutlinerView->GetSelection()); pOutlinerView->InsertField(aURLItem); - if (aSel.nStartPos <= aSel.nEndPos) - aSel.nEndPos = aSel.nStartPos + 1; + if (aSel.start.nIndex <= aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex + 1; else - aSel.nStartPos = aSel.nEndPos + 1; + aSel.start.nIndex = aSel.end.nIndex + 1; pOutlinerView->SetSelection(aSel); } @@ -1020,8 +1020,8 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) { // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); - if (aSel.nStartPos == aSel.nEndPos) - aSel.nEndPos++; + if (aSel.start.nIndex == aSel.end.nIndex) + aSel.end.nIndex++; pOutlinerView->SetSelection(aSel); } @@ -1061,10 +1061,10 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); bool bSel = true; - if (aSel.nStartPos == aSel.nEndPos) + if (aSel.start.nIndex == aSel.end.nIndex) { bSel = false; - aSel.nEndPos++; + aSel.end.nIndex++; } pOutlinerView->SetSelection(aSel); @@ -1072,7 +1072,7 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) // reset selection to original state if (!bSel) - aSel.nEndPos--; + aSel.end.nIndex--; pOutlinerView->SetSelection(aSel); pField.reset(); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index d25744a4926e..6f37edc79e70 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -560,13 +560,11 @@ void SdOutliner::Initialize (bool bDirectionIsForward) ESelection aSelection = getOutlinerView()->GetSelection (); if (mbDirectionIsForward) { - aSelection.nEndPara = aSelection.nStartPara; - aSelection.nEndPos = aSelection.nStartPos; + aSelection.CollapseToStart(); } else { - aSelection.nStartPara = aSelection.nEndPara; - aSelection.nStartPos = aSelection.nEndPos; + aSelection.CollapseToEnd(); } getOutlinerView()->SetSelection (aSelection); } @@ -1776,20 +1774,14 @@ void SdOutliner::EnterEditMode (bool bGrabFocus) ESelection SdOutliner::GetSearchStartPosition() const { + // The default constructor uses the beginning of the text as default. ESelection aPosition; - if (mbDirectionIsForward) - { - // The default constructor uses the beginning of the text as default. - aPosition = ESelection (); - } - else + if (!mbDirectionIsForward) { // Retrieve the position after the last character in the last // paragraph. sal_Int32 nParagraphCount = GetParagraphCount(); - if (nParagraphCount == 0) - aPosition = ESelection(); - else + if (nParagraphCount != 0) { sal_Int32 nLastParagraphLength = GetEditEngine().GetTextLen ( nParagraphCount-1); diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 4bdc074a0574..3e800881960b 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -482,8 +482,8 @@ void TextObjectBar::GetAttrStateImpl(ViewShell* mpViewShell, ::sd::View* mpView, { ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; - sal_Int32 nEndPara = aSel.nEndPara; + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; if( !aSel.HasRange() ) { nStartPara = 0; diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index b90bff224518..898f11687d8f 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -136,8 +136,8 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR { ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; - sal_Int32 nEndPara = aSel.nEndPara; + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; if( !aSel.HasRange() ) { nStartPara = 0; @@ -192,8 +192,8 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR { ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; - sal_Int32 nEndPara = aSel.nEndPara; + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; if( !aSel.HasRange() ) { nStartPara = 0; @@ -447,8 +447,8 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR SvxNumRule aNewRule(pItem->GetNumRule()); ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; - sal_Int32 nEndPara = aSel.nEndPara; + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara) { sal_uInt16 nLevel = pOL->GetDepth(nPara); @@ -614,7 +614,7 @@ SET_ADJUST: // set anchor ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; + sal_Int32 nStartPara = aSel.start.nPara; if (!aSel.HasRange()) nStartPara = 0; @@ -776,7 +776,7 @@ SET_ADJUST: // set anchor ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); - sal_Int32 nStartPara = aSel.nStartPara; + sal_Int32 nStartPara = aSel.start.nPara; if (!aSel.HasRange()) nStartPara = 0; diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index d67963b2a823..2803fb0721eb 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -411,7 +411,7 @@ private: for (svx::ClassificationResult const & rResult : rResults) { - ESelection aPosition(nParagraph, EE_TEXTPOS_MAX_COUNT); + ESelection aPosition(nParagraph, EE_TEXTPOS_MAX); switch (rResult.meType) { @@ -2330,13 +2330,13 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { //we are on the last paragraph aSel.Adjust(); - if (aSel.nEndPara == pOL->GetParagraphCount() - 1) + if (aSel.end.nPara == pOL->GetParagraphCount() - 1) { - sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara); + sal_uInt16 nDepth = pOL->GetDepth(aSel.end.nPara); //there exists a previous numbering level if (nDepth != sal_uInt16(-1) && nDepth > 0) { - Paragraph* pPara = pOL->GetParagraph(aSel.nEndPara); + Paragraph* pPara = pOL->GetParagraph(aSel.end.nPara); pOL->Remove(pPara, 1); } } @@ -2369,14 +2369,14 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { //we are on the last paragraph aSel.Adjust(); - if (aSel.nEndPara == pOL->GetParagraphCount() - 1) + if (aSel.end.nPara == pOL->GetParagraphCount() - 1) { - sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara); + sal_uInt16 nDepth = pOL->GetDepth(aSel.end.nPara); //there exists a previous numbering level if (nDepth < 8) { sal_uInt16 nNewDepth = nDepth+1; - pOL->Insert(SdResId(STR_PRESOBJ_MPOUTLINE_ARY[nNewDepth]), EE_PARA_APPEND, nNewDepth); + pOL->Insert(SdResId(STR_PRESOBJ_MPOUTLINE_ARY[nNewDepth]), EE_PARA_MAX, nNewDepth); } } } @@ -2474,8 +2474,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // select field, then it will be deleted when inserting ESelection aSel = pOLV->GetSelection(); - if( aSel.nStartPos == aSel.nEndPos ) - aSel.nEndPos++; + if (aSel.start.nIndex == aSel.end.nIndex) + aSel.end.nIndex++; pOLV->SetSelection( aSel ); } @@ -2552,10 +2552,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD ); - if( aSel.nStartPos == aSel.nEndPos ) + if (aSel.start.nIndex == aSel.end.nIndex) { bSelectionWasModified = true; - aSel.nEndPos++; + aSel.end.nIndex++; pOLV->SetSelection( aSel ); } @@ -2581,7 +2581,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) // restore selection to original if(bSelectionWasModified) { - aSel.nEndPos--; + aSel.end.nIndex--; pOLV->SetSelection( aSel ); } } diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 6652f8d64e9c..6db20f982c80 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -603,7 +603,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) if( pOLV->GetOutliner() ) { ESelection aSelection( pOLV->GetSelection() ); - eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos ); + eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.start.nPara, aSelection.start.nIndex ); } //fdo#44998 if the outliner has captured the mouse events release the lock @@ -627,10 +627,10 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) // select field, so that it will be deleted on insert ESelection aSel = pOLV->GetSelection(); bool bSel = true; - if( aSel.nStartPos == aSel.nEndPos ) + if (aSel.start.nIndex == aSel.end.nIndex) { bSel = false; - aSel.nEndPos++; + aSel.end.nIndex++; } pOLV->SetSelection( aSel ); @@ -638,7 +638,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) // reset selection back to original state if( !bSel ) - aSel.nEndPos--; + aSel.end.nIndex--; pOLV->SetSelection( aSel ); } } diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 8bb8748e2e36..b63253fa36e4 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1530,9 +1530,9 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { //and are on the last paragraph aSel.Adjust(); - if (aSel.nEndPara == pOL->GetParagraphCount() - 1) + if (aSel.end.nPara == pOL->GetParagraphCount() - 1) { - sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara); + sal_uInt16 nDepth = pOL->GetDepth(aSel.end.nPara); if (nDepth != sal_uInt16(-1)) { //there exists another numbering level that diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index b68d3e09cfdf..7cd214e19331 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -899,18 +899,18 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) { OUString sInput = pOLV->GetSurroundingText(); ESelection aSel( pOLV->GetSelection() ); - if( aSel.nStartPos > aSel.nEndPos ) - aSel.nEndPos = aSel.nStartPos; + if (aSel.start.nIndex > aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex; //calculate a valid end-position by reading logical characters sal_Int32 nUtf16Pos=0; - while( (nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.nEndPos) ) + while ((nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.end.nIndex)) { sInput.iterateCodePoints(&nUtf16Pos); //The mouse can set the cursor in the middle of a multi-unit character, // so reset to the proper end of the logical characters - if( nUtf16Pos > aSel.nEndPos ) - aSel.nEndPos = nUtf16Pos; + if (nUtf16Pos > aSel.end.nIndex) + aSel.end.nIndex = nUtf16Pos; } ToggleUnicodeCodepoint aToggle; @@ -921,7 +921,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) { OUString sStringToReplace = aToggle.StringToReplace(); mpDrawView->BegUndo(sStringToReplace +"->"+ sReplacement); - aSel.nStartPos = aSel.nEndPos - sStringToReplace.getLength(); + aSel.start.nIndex = aSel.end.nIndex - sStringToReplace.getLength(); pOLV->SetSelection( aSel ); pOLV->InsertText(sReplacement, true); mpDrawView->EndUndo(); @@ -1496,10 +1496,10 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText, ESelection aSel( pOLV->GetSelection() ); SvxFieldItem aURLItem( SvxURLField( rURL, rText, SvxURLFormat::Repr ), EE_FEATURE_FIELD ); pOLV->InsertField( aURLItem ); - if ( aSel.nStartPos <= aSel.nEndPos ) - aSel.nEndPos = aSel.nStartPos + 1; + if (aSel.start.nIndex <= aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex + 1; else - aSel.nStartPos = aSel.nEndPos + 1; + aSel.start.nIndex = aSel.end.nIndex + 1; pOLV->SetSelection( aSel ); } else diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 0d9286ffcc62..8444d9129b57 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -799,7 +799,7 @@ OUString DrawViewShell::GetSelectionText(bool bCompleteWords) OUString aStrCurrentDelimiters = pOl->GetWordDelimiters(); pOl->SetWordDelimiters(u" .,;\"'"_ustr); - aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos ); + aStrSelection = pOl->GetWord(aSel.end); pOl->SetWordDelimiters( aStrCurrentDelimiters ); } else diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 7cdbfa094f64..99935ec3ec57 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -359,10 +359,10 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) SvxURLFormat::Repr), EE_FEATURE_FIELD); ESelection aSel( pOutlinerView->GetSelection() ); pOutlinerView->InsertField(aURLItem); - if ( aSel.nStartPos <= aSel.nEndPos ) - aSel.nEndPos = aSel.nStartPos + 1; + if (aSel.start.nIndex <= aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex + 1; else - aSel.nStartPos = aSel.nEndPos + 1; + aSel.start.nIndex = aSel.end.nIndex + 1; pOutlinerView->SetSelection( aSel ); } @@ -534,8 +534,8 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); - if( aSel.nStartPos == aSel.nEndPos ) - aSel.nEndPos++; + if (aSel.start.nIndex == aSel.end.nIndex) + aSel.end.nIndex++; pOutlinerView->SetSelection( aSel ); } @@ -572,10 +572,10 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) // select field, so it gets deleted on Insert ESelection aSel = pOutlinerView->GetSelection(); bool bSel = true; - if( aSel.nStartPos == aSel.nEndPos ) + if (aSel.start.nIndex == aSel.end.nIndex) { bSel = false; - aSel.nEndPos++; + aSel.end.nIndex++; } pOutlinerView->SetSelection( aSel ); @@ -583,7 +583,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) // reset selection to original state if( !bSel ) - aSel.nEndPos--; + aSel.end.nIndex--; pOutlinerView->SetSelection( aSel ); pField.reset(); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 90fa7e8cafdb..f55ad226fa4e 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -355,7 +355,7 @@ void OutlineViewShell::GetCtrlState(SfxItemSet &rSet) if (pFieldItem) { ESelection aSel = pOLV->GetSelection(); - if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 ) + if (abs(aSel.end.nIndex - aSel.start.nIndex) == 1) { const SvxFieldData* pField = pFieldItem->GetField(); if ( auto pUrlField = dynamic_cast< const SvxURLField *>( pField ) ) @@ -1484,8 +1484,7 @@ void OutlineViewShell::GetAttrState( SfxItemSet& rSet ) OutlinerView* pOV = pOlView->GetViewByWindow(pActWin); ESelection aESel(pOV->GetSelection()); - if (aESel.nStartPara != aESel.nEndPara || - aESel.nStartPos != aESel.nEndPos) + if (aESel.HasRange()) // spanned selection, i.e. StyleSheet and/or // attribution not necessarily unique rSet.DisableItem(nWhich); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index fd4abde21279..8f5937172c0c 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -303,8 +303,7 @@ void View::DoPaste (::sd::Window* pWindow) for( sal_Int32 nPara = nParaCount - 2; nPara >= 0; nPara-- ) { const sal_Int32 nParaLen = rEdit.GetTextLen( nPara ); - pOutliner->QuickDelete( ESelection( nPara, nParaLen, nPara+1, 0 ) ); - pOutliner->QuickInsertLineBreak( ESelection( nPara, nParaLen, nPara, nParaLen ) ); + pOutliner->QuickInsertLineBreak(ESelection(nPara, nParaLen, nPara + 1, 0)); } DBG_ASSERT( rEdit.GetParagraphCount() <= 1, "Titleobject contains hard line breaks" ); diff --git a/starmath/inc/mathml/element.hxx b/starmath/inc/mathml/element.hxx index 030f93d422be..ddd826af3fa6 100644 --- a/starmath/inc/mathml/element.hxx +++ b/starmath/inc/mathml/element.hxx @@ -129,14 +129,14 @@ public: // location in the source * It is used to do the visual <-> text correspondence. * @return line */ - sal_Int32 GetSourceCodeRow() const { return m_aESelection.nStartPara; } + sal_Int32 GetSourceCodeRow() const { return m_aESelection.start.nPara; } /** * Gets the column of the line in the text where the node is located. * It is used to do the visual <-> text correspondence. * @return column */ - sal_Int32 GetSourceCodeColumn() const { return m_aESelection.nStartPos; } + sal_Int32 GetSourceCodeColumn() const { return m_aESelection.start.nIndex; } public: // attributes /** diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 778c11c2a968..50a85dc4f508 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -346,14 +346,14 @@ public: * It is used to do the visual <-> text correspondence. * @return line */ - sal_uInt16 GetRow() const { return sal::static_int_cast(m_aESelection.nStartPara); } + sal_Int32 GetRow() const { return m_aESelection.start.nPara; } /** * Gets the column of the line in the text where the node is located. * It is used to do the visual <-> text correspondence. * @return column */ - sal_uInt16 GetColumn() const { return sal::static_int_cast(m_aESelection.nStartPos); } + sal_Int32 GetColumn() const { return m_aESelection.start.nIndex; } /** * Gets the scale mode. diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index 8dd6bc0b22ba..e5d6f150ec28 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -200,10 +200,10 @@ void Test::editMarker() // should be safe i.e. do nothing rEditWindow.SelNextMark(); aSelection = rEditWindow.GetSelection(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nStartPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(19), aSelection.nStartPos); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nEndPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(19), aSelection.nEndPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.start.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(19), aSelection.start.nIndex); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.end.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(19), aSelection.end.nIndex); rEditWindow.SelPrevMark(); rEditWindow.Delete(); @@ -212,10 +212,10 @@ void Test::editMarker() // tdf#106116: should be safe i.e. do nothing rEditWindow.SelPrevMark(); aSelection = rEditWindow.GetSelection(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nStartPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aSelection.nStartPos); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nEndPara); - CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aSelection.nEndPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.start.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aSelection.start.nIndex); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.end.nPara); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aSelection.end.nIndex); rEditWindow.Flush(); OUString sFinalText = rEditWindow.GetText(); diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 7d7ec5a06ce7..7762fe9bd21f 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -1350,7 +1350,7 @@ void SmCursor::EndEdit(){ OUString formula; SmNodeToTextVisitor(mpTree, formula); mpDocShell->maText = formula; - mpDocShell->GetEditEngine().QuickInsertText( formula, ESelection( 0, 0, EE_PARA_ALL, EE_TEXTPOS_ALL ) ); + mpDocShell->GetEditEngine().QuickInsertText(formula, ESelection::All()); mpDocShell->GetEditEngine().QuickFormatDoc(); } diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 384f052ff000..3b18cf144625 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -50,14 +50,13 @@ void SmGetLeftSelectionPart(const ESelection &rSel, // returns paragraph number and position of the selections left part { // compare start and end of selection and use the one that comes first - if ( rSel.nStartPara < rSel.nEndPara - || (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos < rSel.nEndPos) ) - { nPara = rSel.nStartPara; - nPos = rSel.nStartPos; + if (rSel.start < rSel.end) + { nPara = rSel.start.nPara; + nPos = rSel.start.nIndex; } else - { nPara = rSel.nEndPara; - nPos = rSel.nEndPos; + { nPara = rSel.end.nPara; + nPos = rSel.end.nIndex; } } @@ -320,24 +319,24 @@ bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt) autoClose = true; else if (selected.isEmpty() && !aSelection.HasRange()) { - selected = pEditView->getEditEngine().GetText(aSelection.nEndPara); + selected = pEditView->getEditEngine().GetText(aSelection.end.nPara); if (!selected.isEmpty()) { - sal_Int32 index = selected.indexOf("\n", aSelection.nEndPos); + sal_Int32 index = selected.indexOf("\n", aSelection.end.nIndex); if (index != -1) { - selected = selected.copy(index, sal_Int32(aSelection.nEndPos-index)); + selected = selected.copy(index, sal_Int32(aSelection.end.nIndex-index)); if (o3tl::trim(selected).empty()) autoClose = true; } else { sal_Int32 length = selected.getLength(); - if (aSelection.nEndPos == length) + if (aSelection.end.nIndex == length) autoClose = true; else { - selected = selected.copy(aSelection.nEndPos); + selected = selected.copy(aSelection.end.nIndex); if (o3tl::trim(selected).empty()) autoClose = true; } @@ -392,8 +391,8 @@ bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt) { pEditView->InsertText(sClose); // position it at center of brackets - aSelection.nStartPos += 2; - aSelection.nEndPos = aSelection.nStartPos; + aSelection.start.nIndex += 2; + aSelection.end.nIndex = aSelection.start.nIndex; pEditView->SetSelection(aSelection); } @@ -577,11 +576,11 @@ bool SmEditWindow::IsAllSelected() const if (!(nParaCnt - 1)) { sal_Int32 nTextLen = pEditEngine->GetText().getLength(); - bRes = !eSelection.nStartPos && (eSelection.nEndPos == nTextLen - 1); + bRes = !eSelection.start.nIndex && (eSelection.end.nIndex == nTextLen - 1); } else { - bRes = !eSelection.nStartPara && (eSelection.nEndPara == nParaCnt - 1); + bRes = !eSelection.start.nPara && (eSelection.end.nPara == nParaCnt - 1); } return bRes; } @@ -590,8 +589,7 @@ void SmEditWindow::SelectAll() { if (EditView* pEditView = GetEditView()) { - // ALL as last two parameters refers to the end of the text - pEditView->SetSelection( ESelection( 0, 0, EE_PARA_ALL, EE_TEXTPOS_ALL ) ); + pEditView->SetSelection(ESelection::All()); } } @@ -599,8 +597,8 @@ void SmEditWindow::MarkError(const Point &rPos) { if (EditView* pEditView = GetEditView()) { - const sal_uInt16 nCol = sal::static_int_cast< sal_uInt16 >(rPos.X()); - const sal_uInt16 nRow = sal::static_int_cast< sal_uInt16 >(rPos.Y() - 1); + const sal_Int32 nCol = rPos.X(); + const sal_Int32 nRow = rPos.Y() - 1; pEditView->SetSelection(ESelection(nRow, nCol - 1, nRow, nCol)); GrabFocus(); @@ -625,22 +623,22 @@ void SmEditTextWindow::SelNextMark() return; ESelection eSelection = pEditView->GetSelection(); - sal_Int32 nPos = eSelection.nEndPos; + sal_Int32 nPos = eSelection.end.nIndex; sal_Int32 nCounts = pEditEngine->GetParagraphCount(); - while (eSelection.nEndPara < nCounts) + while (eSelection.end.nPara < nCounts) { - OUString aText = pEditEngine->GetText(eSelection.nEndPara); + OUString aText = pEditEngine->GetText(eSelection.end.nPara); nPos = aText.indexOf("", nPos); if (nPos != -1) { pEditView->SetSelection(ESelection( - eSelection.nEndPara, nPos, eSelection.nEndPara, nPos + 3)); + eSelection.end.nPara, nPos, eSelection.end.nPara, nPos + 3)); break; } nPos = 0; - eSelection.nEndPara++; + eSelection.end.nPara++; } } @@ -654,8 +652,8 @@ void SmEditWindow::SelPrevMark() return; ESelection eSelection = pEditView->GetSelection(); - sal_Int32 nPara = eSelection.nStartPara; - sal_Int32 nMax = eSelection.nStartPos; + sal_Int32 nPara = eSelection.start.nPara; + sal_Int32 nMax = eSelection.start.nIndex; OUString aText(pEditEngine->GetText(nPara)); static constexpr OUStringLiteral aMark(u""); sal_Int32 nPos; @@ -783,10 +781,10 @@ void SmEditTextWindow::InsertText(const OUString& rText) sal_Int32 nStartIndex = 0; // get the start position (when we get a multi line formula) - for (sal_Int32 nParaPos = 0; nParaPos < aSelection.nStartPara; nParaPos++) + for (sal_Int32 nParaPos = 0; nParaPos < aSelection.start.nPara; nParaPos++) nStartIndex = aCurrentFormula.indexOf("\n", nStartIndex) + 1; - nStartIndex += aSelection.nStartPos; + nStartIndex += aSelection.start.nIndex; // TODO: unify this function with the InsertCommand: The do the same thing for different // callers @@ -798,23 +796,23 @@ void SmEditTextWindow::InsertText(const OUString& rText) string = string.replaceFirst("", selected); // put a space before a new command if not in the beginning of a line - if (aSelection.nStartPos > 0 && aCurrentFormula[nStartIndex - 1] != ' ') + if (aSelection.start.nIndex > 0 && aCurrentFormula[nStartIndex - 1] != ' ') string = " " + string; pEditView->InsertText(string); // Remember start of the selection and move the cursor there afterwards. - aSelection.nEndPara = aSelection.nStartPara; + aSelection.end.nPara = aSelection.start.nPara; if (HasMark(string)) { - aSelection.nEndPos = aSelection.nStartPos; + aSelection.end.nIndex = aSelection.start.nIndex; pEditView->SetSelection(aSelection); SelNextMark(); } else { // set selection after inserted text - aSelection.nEndPos = aSelection.nStartPos + string.getLength(); - aSelection.nStartPos = aSelection.nEndPos; + aSelection.end.nIndex = aSelection.start.nIndex + string.getLength(); + aSelection.start.nIndex = aSelection.end.nIndex; pEditView->SetSelection(aSelection); } diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index f5457f5a819e..7f8c47d661c3 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -256,8 +256,8 @@ const SmNode * SmNode::FindTokenAt(sal_uInt16 nRow, sal_uInt16 nCol) const //! (there should be exactly one such node if any) { if ( IsVisible() - && nRow == GetSelection().nStartPara - && nCol >= GetSelection().nStartPos && nCol <= GetSelection().nEndPos ) + && nRow == GetSelection().start.nPara + && nCol >= GetSelection().start.nIndex && nCol <= GetSelection().end.nIndex ) return this; else { diff --git a/starmath/source/smediteng.cxx b/starmath/source/smediteng.cxx index 07946972b49e..51681f1423a3 100644 --- a/starmath/source/smediteng.cxx +++ b/starmath/source/smediteng.cxx @@ -101,9 +101,9 @@ void SmEditEngine::updateZoom() void SmEditEngine::updateAllESelection() { sal_Int32 paracount = GetParagraphCount(); - m_aAllSelection.nEndPara = paracount > 0 ? paracount - 1 : 0; - sal_Int32 textlength = GetTextLen(m_aAllSelection.nEndPara); - m_aAllSelection.nEndPos = textlength > 0 ? textlength : 0; + m_aAllSelection.end.nPara = paracount > 0 ? paracount - 1 : 0; + sal_Int32 textlength = GetTextLen(m_aAllSelection.end.nPara); + m_aAllSelection.end.nIndex = textlength > 0 ? textlength : 0; } void SmEditEngine::setSmItemPool(SfxItemPool* mpItemPool, const SvtLinguOptions& maLangOptions) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index b09b347a22c6..f1130e5701de 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1755,16 +1755,16 @@ void SmViewShell::Execute(SfxRequest& rReq) const OUString sInput = pEditView->GetSurroundingText(); ESelection aSel( pWin->GetSelection() ); - if ( aSel.nStartPos > aSel.nEndPos ) - aSel.nEndPos = aSel.nStartPos; + if (aSel.start.nIndex > aSel.end.nIndex) + aSel.end.nIndex = aSel.start.nIndex; //calculate a valid end-position by reading logical characters sal_Int32 nUtf16Pos=0; - while( (nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.nEndPos) ) + while ((nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.end.nIndex)) { sInput.iterateCodePoints(&nUtf16Pos); - if( nUtf16Pos > aSel.nEndPos ) - aSel.nEndPos = nUtf16Pos; + if (nUtf16Pos > aSel.end.nIndex) + aSel.end.nIndex = nUtf16Pos; } ToggleUnicodeCodepoint aToggle; @@ -1775,7 +1775,7 @@ void SmViewShell::Execute(SfxRequest& rReq) { pEditView->SetSelection( aSel ); pEditEngine->UndoActionStart(EDITUNDO_REPLACEALL); - aSel.nStartPos = aSel.nEndPos - aToggle.StringToReplace().getLength(); + aSel.start.nIndex = aSel.end.nIndex - aToggle.StringToReplace().getLength(); pWin->SetSelection( aSel ); pEditView->InsertText( sReplacement, true ); pEditEngine->UndoActionEnd(); diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index d83f3fcdefc5..2f3e0c26505e 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -224,7 +224,7 @@ namespace accessibility }; AccessibleTextHelper_Impl::AccessibleTextHelper_Impl() : - maLastSelection( EE_PARA_NOT_FOUND,EE_INDEX_NOT_FOUND,EE_PARA_NOT_FOUND,EE_INDEX_NOT_FOUND ), + maLastSelection( ESelection::AtEnd() ), mnFirstVisibleChild( -1 ), mnLastVisibleChild( -2 ), mnStartIndex( 0 ), @@ -447,7 +447,7 @@ namespace accessibility // find the one with the cursor and get/set focus accordingly ESelection aSelection; if( GetEditViewForwarder().GetSelection( aSelection ) ) - SetChildFocus( aSelection.nEndPara, bHaveFocus ); + SetChildFocus(aSelection.end.nPara, bHaveFocus); } catch( const uno::Exception& ) {} } @@ -495,7 +495,7 @@ namespace accessibility if( GetEditViewForwarder().GetSelection( aSelection ) ) { if( maLastSelection != aSelection && - aSelection.nEndPara < maParaManager.GetNum() ) + aSelection.end.nPara < maParaManager.GetNum() ) { // #103998# Not that important, changed from assertion to trace if( mbThisHasFocus ) @@ -507,30 +507,30 @@ namespace accessibility // notify all affected paragraphs (TODO: may be suboptimal, // since some paragraphs might stay selected) - if( maLastSelection.nStartPara != EE_PARA_NOT_FOUND ) + if (maLastSelection.start.nPara != EE_PARA_MAX) { // Did the caret move from one paragraph to another? // #100530# no caret events if not focused. if( mbGroupHasFocus && - maLastSelection.nEndPara != aSelection.nEndPara ) + maLastSelection.end.nPara != aSelection.end.nPara ) { - if( maLastSelection.nEndPara < maParaManager.GetNum() ) + if (maLastSelection.end.nPara < maParaManager.GetNum()) { - maParaManager.FireEvent( ::std::min( maLastSelection.nEndPara, nMaxValidParaIndex ), - ::std::min( maLastSelection.nEndPara, nMaxValidParaIndex )+1, + maParaManager.FireEvent( ::std::min( maLastSelection.end.nPara, nMaxValidParaIndex ), + ::std::min( maLastSelection.end.nPara, nMaxValidParaIndex )+1, AccessibleEventId::CARET_CHANGED, uno::Any(static_cast(-1)), - uno::Any(maLastSelection.nEndPos) ); + uno::Any(maLastSelection.end.nIndex) ); } - ChangeChildFocus( aSelection.nEndPara ); + ChangeChildFocus(aSelection.end.nPara); SAL_INFO( "svx", "focus changed, Object: " << this - << ", Paragraph: " << aSelection.nEndPara + << ", Paragraph: " << aSelection.end.nPara << ", Last paragraph: " - << maLastSelection.nEndPara); + << maLastSelection.end.nPara); } } @@ -541,46 +541,46 @@ namespace accessibility // #i13705# The old cursor can only contain valid // values if it's the same paragraph! - if( maLastSelection.nStartPara != EE_PARA_NOT_FOUND && - maLastSelection.nEndPara == aSelection.nEndPara ) + if( maLastSelection.start.nPara != EE_PARA_MAX && + maLastSelection.end.nPara == aSelection.end.nPara ) { - aOldCursor <<= maLastSelection.nEndPos; + aOldCursor <<= maLastSelection.end.nIndex; } else { aOldCursor <<= static_cast(-1); } - maParaManager.FireEvent( aSelection.nEndPara, - aSelection.nEndPara+1, + maParaManager.FireEvent( aSelection.end.nPara, + aSelection.end.nPara+1, AccessibleEventId::CARET_CHANGED, - uno::Any(aSelection.nEndPos), + uno::Any(aSelection.end.nIndex), aOldCursor ); } SAL_INFO( "svx", "caret changed, Object: " << this << ", New pos: " - << aSelection.nEndPos << ", Old pos: " - << maLastSelection.nEndPos << ", New para: " - << aSelection.nEndPara << ", Old para: " - << maLastSelection.nEndPara); + << aSelection.end.nIndex << ", Old pos: " + << maLastSelection.end.nIndex << ", New para: " + << aSelection.end.nPara << ", Old para: " + << maLastSelection.end.nPara); // #108947# Sort new range before calling FireEvent ::std::pair sortedSelection( - makeSortedPair(::std::min( aSelection.nStartPara, nMaxValidParaIndex ), - ::std::min( aSelection.nEndPara, nMaxValidParaIndex ) ) ); + makeSortedPair(::std::min( aSelection.start.nPara, nMaxValidParaIndex ), + ::std::min( aSelection.end.nPara, nMaxValidParaIndex ) ) ); // #108947# Sort last range before calling FireEvent ::std::pair sortedLastSelection( - makeSortedPair(::std::min( maLastSelection.nStartPara, nMaxValidParaIndex ), - ::std::min( maLastSelection.nEndPara, nMaxValidParaIndex ) ) ); + makeSortedPair(::std::min( maLastSelection.start.nPara, nMaxValidParaIndex ), + ::std::min( maLastSelection.end.nPara, nMaxValidParaIndex ) ) ); // event TEXT_SELECTION_CHANGED has to be submitted. (#i27299#) const sal_Int16 nTextSelChgEventId = AccessibleEventId::TEXT_SELECTION_CHANGED; // #107037# notify selection change - if( maLastSelection.nStartPara == EE_PARA_NOT_FOUND ) + if (maLastSelection.start.nPara == EE_PARA_MAX) { // last selection is undefined // use method (#i27299#) @@ -624,11 +624,11 @@ namespace accessibility ESelection aTmpSel( aSelection ); aTmpSel.Adjust(); // first submit event for new and changed selection - sal_Int32 nPara = aTmpSel.nStartPara; - for ( ; nPara <= aTmpSel.nEndPara; ++nPara ) + sal_Int32 nPara = aTmpSel.start.nPara; + for ( ; nPara <= aTmpSel.end.nPara; ++nPara ) { - if ( nPara < aTmpLastSel.nStartPara || - nPara > aTmpLastSel.nEndPara ) + if ( nPara < aTmpLastSel.start.nPara || + nPara > aTmpLastSel.end.nPara ) { // new selection on paragraph maParaManager.FireEvent( nPara, @@ -638,17 +638,17 @@ namespace accessibility { // check for changed selection on paragraph const sal_Int32 nParaStartPos = - nPara == aTmpSel.nStartPara - ? aTmpSel.nStartPos : 0; + nPara == aTmpSel.start.nPara + ? aTmpSel.start.nIndex : 0; const sal_Int32 nParaEndPos = - nPara == aTmpSel.nEndPara - ? aTmpSel.nEndPos : -1; + nPara == aTmpSel.end.nPara + ? aTmpSel.end.nIndex : -1; const sal_Int32 nLastParaStartPos = - nPara == aTmpLastSel.nStartPara - ? aTmpLastSel.nStartPos : 0; + nPara == aTmpLastSel.start.nPara + ? aTmpLastSel.start.nIndex : 0; const sal_Int32 nLastParaEndPos = - nPara == aTmpLastSel.nEndPara - ? aTmpLastSel.nEndPos : -1; + nPara == aTmpLastSel.end.nPara + ? aTmpLastSel.end.nIndex : -1; if ( nParaStartPos != nLastParaStartPos || nParaEndPos != nLastParaEndPos ) { @@ -658,11 +658,11 @@ namespace accessibility } } // second submit event for 'old' selections - nPara = aTmpLastSel.nStartPara; - for ( ; nPara <= aTmpLastSel.nEndPara; ++nPara ) + nPara = aTmpLastSel.start.nPara; + for ( ; nPara <= aTmpLastSel.end.nPara; ++nPara ) { - if ( nPara < aTmpSel.nStartPara || - nPara > aTmpSel.nEndPara ) + if ( nPara < aTmpSel.start.nPara || + nPara > aTmpSel.end.nPara ) { maParaManager.FireEvent( nPara, nTextSelChgEventId ); @@ -964,7 +964,7 @@ namespace accessibility pTextHint->GetId() == SfxHintId::TextParaRemoved )) ) return; - if( pTextHint->GetValue() == EE_PARA_ALL ) + if (pTextHint->GetValue() == EE_PARA_MAX) { mnParasChanged = -1; } @@ -1152,12 +1152,12 @@ namespace accessibility // focused child now loses focus ESelection aSelection; if( GetEditViewForwarder().GetSelection( aSelection ) ) - SetChildFocus( aSelection.nEndPara, false ); + SetChildFocus(aSelection.end.nPara, false); // change children state maParaManager.SetActive( false ); - maLastSelection = ESelection::NotFound(); + maLastSelection = ESelection::AtEnd(); break; } default: @@ -1212,7 +1212,7 @@ namespace accessibility // #108900# Delegate change event to children AccessibleTextHelper_ChildrenTextChanged aNotifyChildrenFunctor; - if( nPara == EE_PARA_ALL ) + if (nPara == EE_PARA_MAX) { // #108900# Call every child ::std::for_each( maParaManager.begin(), maParaManager.end(), diff --git a/svx/source/annotation/TextAPI.cxx b/svx/source/annotation/TextAPI.cxx index cd13acd76d3b..d3891f7f5958 100644 --- a/svx/source/annotation/TextAPI.cxx +++ b/svx/source/annotation/TextAPI.cxx @@ -167,7 +167,7 @@ void TextApiObject::SetText(OutlinerParaObject const& rText) pModel->AddUndo(std::make_unique(*pModel, this)); mpSource->SetText(rText); - maSelection.nStartPara = EE_PARA_MAX_COUNT; + maSelection.start.nPara = EE_PARA_MAX; } OUString TextApiObject::GetText() const { return mpSource->GetText(); } diff --git a/svx/source/dialog/ClassificationEditView.cxx b/svx/source/dialog/ClassificationEditView.cxx index fa4388017fcb..56ac009a30f8 100644 --- a/svx/source/dialog/ClassificationEditView.cxx +++ b/svx/source/dialog/ClassificationEditView.cxx @@ -58,7 +58,7 @@ void ClassificationEditView::InvertSelectionWeight() { ESelection aSelection = m_xEditView->GetSelection(); - for (sal_Int32 nParagraph = aSelection.nStartPara; nParagraph <= aSelection.nEndPara; ++nParagraph) + for (sal_Int32 nParagraph = aSelection.start.nPara; nParagraph <= aSelection.end.nPara; ++nParagraph) { FontWeight eFontWeight = WEIGHT_BOLD; diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx index 7728379e47d9..18539c449b5b 100644 --- a/svx/source/dialog/weldeditview.cxx +++ b/svx/source/dialog/weldeditview.cxx @@ -287,12 +287,9 @@ bool WeldEditView::KeyInput(const KeyEvent& rKEvt) { if (nKey == KEY_A) { - EditEngine* pEditEngine = GetEditEngine(); - sal_Int32 nPar = pEditEngine->GetParagraphCount(); - if (nPar) + if (GetEditEngine()->GetParagraphCount()) { - sal_Int32 nLen = pEditEngine->GetTextLen(nPar - 1); - pEditView->SetSelection(ESelection(0, 0, nPar - 1, nLen)); + pEditView->SetSelection(ESelection::All()); } return true; } @@ -965,7 +962,7 @@ SfxItemSet WeldTextForwarder::GetAttribs(const ESelection& rSel, { EditEngine* pEditEngine = m_rEditAcc.GetEditEngine(); assert(pEditEngine && "EditEngine missing"); - if (rSel.nStartPara == rSel.nEndPara) + if (rSel.start.nPara == rSel.end.nPara) { GetAttribsFlags nFlags = GetAttribsFlags::NONE; switch (nOnlyHardAttrib) @@ -980,7 +977,8 @@ SfxItemSet WeldTextForwarder::GetAttribs(const ESelection& rSel, SAL_WARN("svx", "unknown flags for WeldTextForwarder::GetAttribs"); } - return pEditEngine->GetAttribs(rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags); + return pEditEngine->GetAttribs(rSel.start.nPara, rSel.start.nIndex, rSel.end.nIndex, + nFlags); } else { @@ -1112,17 +1110,17 @@ static SfxItemState GetSvxEditEngineItemState(EditEngine const& rEditEngine, con SfxItemState eState = SfxItemState::DEFAULT; // check all paragraphs inside the selection - for (sal_Int32 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++) + for (sal_Int32 nPara = rSel.start.nPara; nPara <= rSel.end.nPara; nPara++) { SfxItemState eParaState = SfxItemState::DEFAULT; // calculate start and endpos for this paragraph sal_Int32 nPos = 0; - if (rSel.nStartPara == nPara) - nPos = rSel.nStartPos; + if (rSel.start.nPara == nPara) + nPos = rSel.start.nIndex; - sal_Int32 nEndPos = rSel.nEndPos; - if (rSel.nEndPara != nPara) + sal_Int32 nEndPos = rSel.end.nIndex; + if (rSel.end.nPara != nPara) nEndPos = rEditEngine.GetTextLen(nPara); // get list of char attribs @@ -1244,14 +1242,14 @@ tools::Rectangle WeldTextForwarder::GetCharBounds(sal_Int32 nPara, sal_Int32 nIn if (nIndex >= pEditEngine->GetTextLen(nPara)) { if (nIndex) - aRect = pEditEngine->GetCharacterBounds(EPosition(nPara, nIndex - 1)); + aRect = pEditEngine->GetCharacterBounds(EPaM(nPara, nIndex - 1)); aRect.Move(aRect.Right() - aRect.Left(), 0); aRect.SetSize(Size(1, pEditEngine->GetTextHeight())); } else { - aRect = pEditEngine->GetCharacterBounds(EPosition(nPara, nIndex)); + aRect = pEditEngine->GetCharacterBounds(EPaM(nPara, nIndex)); } } return aRect; @@ -1292,7 +1290,7 @@ bool WeldTextForwarder::GetIndexAtPoint(const Point& rPos, sal_Int32& nPara, EditEngine* pEditEngine = m_rEditAcc.GetEditEngine(); if (pEditEngine) { - EPosition aDocPos = pEditEngine->FindDocPosition(rPos); + EPaM aDocPos = pEditEngine->FindDocPosition(rPos); nPara = aDocPos.nPara; nIndex = aDocPos.nIndex; bRes = true; @@ -1307,13 +1305,13 @@ bool WeldTextForwarder::GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_In EditEngine* pEditEngine = m_rEditAcc.GetEditEngine(); if (pEditEngine) { - ESelection aRes = pEditEngine->GetWord(ESelection(nPara, nIndex, nPara, nIndex), - css::i18n::WordType::DICTIONARY_WORD); + ESelection aRes + = pEditEngine->GetWord(ESelection(nPara, nIndex), css::i18n::WordType::DICTIONARY_WORD); - if (aRes.nStartPara == nPara && aRes.nStartPara == aRes.nEndPara) + if (aRes.start.nPara == nPara && aRes.start.nPara == aRes.end.nPara) { - nStart = aRes.nStartPos; - nEnd = aRes.nEndPos; + nStart = aRes.start.nIndex; + nEnd = aRes.end.nIndex; bRes = true; } @@ -1445,7 +1443,7 @@ sal_Int32 WeldTextForwarder::AppendTextPortion(sal_Int32 nPara, const OUString& pEditEngine->QuickInsertText(rText, aSel); // set attributes for new appended text - nRes = aSel.nEndPos = pEditEngine->GetTextLen(nPara); + nRes = aSel.end.nIndex = pEditEngine->GetTextLen(nPara); pEditEngine->QuickSetAttribs(rSet, aSel); } return nRes; diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index bf19b885db5c..cabe52ab68b7 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -501,18 +501,18 @@ namespace sdr::properties { if(EE_FEATURE_FIELD == rAttrib.pAttr->Which()) { - aSel.nEndPos = rAttrib.nStart; + aSel.end.nIndex = rAttrib.nStart; - if(aSel.nStartPos != aSel.nEndPos) + if (aSel.start.nIndex != aSel.end.nIndex) pEditEngine->QuickSetAttribs(aColorSet, aSel); - aSel.nStartPos = rAttrib.nEnd; + aSel.start.nIndex = rAttrib.nEnd; } } - aSel.nEndPos = pEditEngine->GetTextLen(nPara); + aSel.end.nIndex = pEditEngine->GetTextLen(nPara); - if(aSel.nStartPos != aSel.nEndPos) + if (aSel.start.nIndex != aSel.end.nIndex) { pEditEngine->QuickSetAttribs( aColorSet, aSel ); } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index ef877e45cd70..3e2af6ba81b8 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2279,16 +2279,17 @@ bool SdrObjEditView::ImpIsTextEditAllSelected() const = mpTextEditOutliner->GetParagraph(nParaCnt > 1 ? nParaCnt - 1 : 0); ESelection aESel(mpTextEditOutlinerView->GetSelection()); - if (aESel.nStartPara == 0 && aESel.nStartPos == 0 && aESel.nEndPara == (nParaCnt - 1)) + if (aESel.start.nPara == 0 && aESel.start.nIndex == 0 + && aESel.end.nPara == (nParaCnt - 1)) { - if (mpTextEditOutliner->GetText(pLastPara).getLength() == aESel.nEndPos) + if (mpTextEditOutliner->GetText(pLastPara).getLength() == aESel.end.nIndex) bRet = true; } // in case the selection was done backwards - if (!bRet && aESel.nEndPara == 0 && aESel.nEndPos == 0 - && aESel.nStartPara == (nParaCnt - 1)) + if (!bRet && aESel.end.nPara == 0 && aESel.end.nIndex == 0 + && aESel.start.nPara == (nParaCnt - 1)) { - if (mpTextEditOutliner->GetText(pLastPara).getLength() == aESel.nStartPos) + if (mpTextEditOutliner->GetText(pLastPara).getLength() == aESel.start.nIndex) bRet = true; } } @@ -2822,11 +2823,11 @@ sal_uInt16 SdrObjEditView::GetSelectionLevel() const return 0xFFFF; //start and end position ESelection aSelect = mpTextEditOutlinerView->GetSelection(); - sal_uInt16 nStartPara = ::std::min(aSelect.nStartPara, aSelect.nEndPara); - sal_uInt16 nEndPara = ::std::max(aSelect.nStartPara, aSelect.nEndPara); + sal_Int32 nStartPara = ::std::min(aSelect.start.nPara, aSelect.end.nPara); + sal_Int32 nEndPara = ::std::max(aSelect.start.nPara, aSelect.end.nPara); //get level from each paragraph sal_uInt16 nLevel = 0; - for (sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++) + for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++) { sal_Int16 nDepth = mpTextEditOutliner->GetDepth(nPara); assert(nDepth >= 0 && nDepth <= 15); @@ -3095,7 +3096,7 @@ void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, sal_Int16 nDe ESelection aSel(pOLV->GetSelection()); bool fullParaSelection - = aSel.nEndPara != aSel.nStartPara || pOLV->GetEditView().IsSelectionFullPara(); + = aSel.end.nPara != aSel.start.nPara || pOLV->GetEditView().IsSelectionFullPara(); if (!aSel.HasRange()) pOLV->SetSelection(rEditEngine.GetWord(aSel, css::i18n::WordType::DICTIONARY_WORD)); const bool bRemoveParaAttribs = !bNoParagraphFormats && !fullParaSelection; @@ -3107,7 +3108,7 @@ void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, sal_Int16 nDe pOLV->SetAttribs(aPaintSet); if (!bNoParagraphFormats && nDepth > -2) { - for (sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; ++nPara) + for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; ++nPara) pOLV->SetDepth(nPara, nDepth); } } diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index 665e932a18c9..33f7fb5913d1 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -1236,9 +1236,9 @@ OUString SdrView::GetStatusText() else if (IsTextEdit() && mpTextEditOutlinerView != nullptr) { aStr=SvxResId(STR_ViewTextEdit); // "TextEdit - Row y, Column x"; ESelection aSel(mpTextEditOutlinerView->GetSelection()); - tools::Long nPar = aSel.nEndPara,nLin=0,nCol=aSel.nEndPos; - if (aSel.nEndPara>0) { - for (sal_Int32 nParaNum=0; nParaNum0) { + for (sal_Int32 nParaNum=0; nParaNumGetLineCount(nParaNum); } } @@ -1246,11 +1246,11 @@ OUString SdrView::GetStatusText() // At the end of a line of any multi-line paragraph, we display the // position of the next line of the same paragraph, if there is one. sal_uInt16 nParaLine = 0; - sal_uInt32 nParaLineCount = mpTextEditOutliner->GetLineCount(aSel.nEndPara); + sal_uInt32 nParaLineCount = mpTextEditOutliner->GetLineCount(aSel.end.nPara); bool bBrk = false; while (!bBrk) { - sal_uInt16 nLen = mpTextEditOutliner->GetLineLen(aSel.nEndPara, nParaLine); + sal_uInt16 nLen = mpTextEditOutliner->GetLineLen(aSel.end.nPara, nParaLine); bool bLastLine = (nParaLine == nParaLineCount - 1); if (nCol>nLen || (!bLastLine && nCol == nLen)) { @@ -1270,7 +1270,7 @@ OUString SdrView::GetStatusText() aStr = aStr.replaceFirst("%3", OUString::number(nCol + 1)); #ifdef DBG_UTIL - aStr += ", Level " + OUString::number(mpTextEditOutliner->GetDepth( aSel.nEndPara )); + aStr += ", Level " + OUString::number(mpTextEditOutliner->GetDepth( aSel.end.nPara )); #endif } @@ -1396,8 +1396,7 @@ void SdrView::UnmarkAll() { if (IsTextEdit()) { ESelection eSel=GetTextEditOutlinerView()->GetSelection(); - eSel.nStartPara=eSel.nEndPara; - eSel.nStartPos=eSel.nEndPos; + eSel.CollapseToEnd(); GetTextEditOutlinerView()->SetSelection(eSel); } else if (HasMarkedGluePoints()) UnmarkAllGluePoints(); else if (HasMarkedPoints()) UnmarkAllPoints(); // Marked, not Markable! diff --git a/svx/source/svdraw/textchaincursor.cxx b/svx/source/svdraw/textchaincursor.cxx index 51c4d1d8ef87..f9bb278f4272 100644 --- a/svx/source/svdraw/textchaincursor.cxx +++ b/svx/source/svdraw/textchaincursor.cxx @@ -78,7 +78,7 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt, sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); ESelection aCurSel = pOLV->GetSelection(); - ESelection aEndSelPrevBox(100000, 100000); + ESelection aEndSelPrevBox(ESelection::AtEnd()); sal_Int32 nLastPara = pOutl->GetParagraphCount()-1; OUString aLastParaText = pOutl->GetText(pOutl->GetParagraph(nLastPara)); @@ -144,8 +144,7 @@ void TextChainCursorManager::HandleCursorEventAfterChaining( // Move to end of prev box SdrTextObj *pPrevLink = mpTextObj->GetPrevLinkInChain(); - ESelection aEndSel(100000, 100000); - impChangeEditingTextObj(pPrevLink, aEndSel); + impChangeEditingTextObj(pPrevLink, ESelection::AtEnd()); return; } diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx index b7dc65cf7106..b41d208e221b 100644 --- a/svx/source/svdraw/textchainflow.cxx +++ b/svx/source/svdraw/textchainflow.cxx @@ -124,8 +124,8 @@ void TextChainFlow::impUpdateCursorInfo() ESelection aSelAtUFTime = GetTextChain()->GetPreChainingSel(GetLinkTarget()); // Might be an invalid selection if the cursor at UF time was before // the (possibly UF-induced) Overflowing point but we don't use it in that case - maPostChainingSel = ESelection(aSelAtUFTime.nStartPara-maOverflowPosSel.nStartPara, - aSelAtUFTime.nStartPos-maOverflowPosSel.nStartPos ); + maPostChainingSel = ESelection(aSelAtUFTime.start.nPara-maOverflowPosSel.start.nPara, + aSelAtUFTime.start.nIndex-maOverflowPosSel.start.nIndex ); } // XXX: It may not be necessary anymore to keep this method separated from EditingTextChainFlow::impBroadcastCursorInfo diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index fb99029d6e92..637305c9e6fc 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -760,7 +760,7 @@ void Cell::SetOutlinerParaObject( std::optional pTextObject { bool bNullTextObject = !pTextObject; SdrText::SetOutlinerParaObject( std::move(pTextObject) ); - maSelection.nStartPara = EE_PARA_MAX_COUNT; + maSelection.start.nPara = EE_PARA_MAX; if( bNullTextObject ) ForceOutlinerParaObject( OutlinerMode::TextObject ); @@ -1682,7 +1682,7 @@ void SAL_CALL Cell::insertControlCharacter( const Reference< XTextRange >& xRang OUString SAL_CALL Cell::getString( ) { - maSelection.nStartPara = EE_PARA_MAX_COUNT; + maSelection.start.nPara = EE_PARA_MAX; return SvxUnoTextBase::getString(); } diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 22b3ab5c406d..ee32304f2d93 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2094,7 +2094,7 @@ void SvxTableController::EditCell(const CellPos& rPos, vcl::Window* pWindow, Tbl ((nAction == TblAction::GotoRightCell) && (eMode == WritingMode_RL_TB)); if( bLast ) - aNewSelection = ESelection::NotFound(); + aNewSelection = ESelection::AtEnd(); } pOLV->SetSelection(aNewSelection); } diff --git a/svx/source/table/tablehtmlimporter.cxx b/svx/source/table/tablehtmlimporter.cxx index 7f7aace887cc..e9e35b93fb05 100644 --- a/svx/source/table/tablehtmlimporter.cxx +++ b/svx/source/table/tablehtmlimporter.cxx @@ -196,12 +196,12 @@ IMPL_LINK(SdrTableHTMLParser, HTMLImportHdl, HtmlImportInfo&, rInfo, void) ProcToken(&rInfo); break; case HtmlImportState::End: - if (rInfo.aSelection.nEndPos) + if (rInfo.aSelection.end.nIndex) { mpActDefault = nullptr; //TODO: ?? // rInfo.nToken = RTF_PAR; - rInfo.aSelection.nEndPara++; + rInfo.aSelection.end.nPara++; ProcToken(&rInfo); } break; @@ -442,7 +442,7 @@ void SdrTableHTMLParser::ProcToken(HtmlImportInfo* pInfo) RowColSpan aRowColSpan = lcl_GetRowColSpan(options); mpActDefault->mnColSpan = aRowColSpan.mnColSpan; mpActDefault->mnRowSpan = aRowColSpan.mnRowSpan; - mnCellStartPara = pInfo->aSelection.nStartPara; + mnCellStartPara = pInfo->aSelection.start.nPara; } break; case HtmlTokenId::TABLEDATA_OFF: @@ -456,7 +456,7 @@ void SdrTableHTMLParser::ProcToken(HtmlImportInfo* pInfo) if (mpActDefault->mnColSpan > 0) { mpActDefault->mnCellX = maColumnEdges[mnCellInRow + mpActDefault->mnColSpan - 1]; - InsertCell(mnCellStartPara, pInfo->aSelection.nEndPara); + InsertCell(mnCellStartPara, pInfo->aSelection.end.nPara); } NextColumn(); } diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx index c411636ebdd1..a2cc1de2ec5e 100644 --- a/svx/source/table/tablertfimporter.cxx +++ b/svx/source/table/tablertfimporter.cxx @@ -189,11 +189,11 @@ IMPL_LINK( SdrTableRTFParser, RTFImportHdl, RtfImportInfo&, rInfo, void ) } break; case RtfImportState::End: - if ( rInfo.aSelection.nEndPos ) + if ( rInfo.aSelection.end.nIndex ) { mpActDefault = nullptr; rInfo.nToken = RTF_PAR; - rInfo.aSelection.nEndPara++; + rInfo.aSelection.end.nPara++; ProcToken( &rInfo ); } break; @@ -219,7 +219,7 @@ void SdrTableRTFParser::InsertCell( RtfImportInfo const * pInfo ) RTFCellInfoPtr xCellInfo = std::make_shared(mrItemPool); xCellInfo->mnStartPara = mnStartPara; - xCellInfo->mnParaCount = pInfo->aSelection.nEndPara - 1 - mnStartPara; + xCellInfo->mnParaCount = pInfo->aSelection.end.nPara - 1 - mnStartPara; xCellInfo->mnCellX = mpActDefault->mnCellX; xCellInfo->mnRowSpan = mpActDefault->mnRowSpan; @@ -254,7 +254,7 @@ void SdrTableRTFParser::InsertCell( RtfImportInfo const * pInfo ) xColumn->push_back( xCellInfo ); } - mnStartPara = pInfo->aSelection.nEndPara - 1; + mnStartPara = pInfo->aSelection.end.nPara - 1; } void SdrTableRTFParser::InsertColumnEdge( sal_Int32 nEdge ) diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx index 516a89800b27..0c48cdc1db05 100644 --- a/sw/source/core/doc/DocumentDrawModelManager.cxx +++ b/sw/source/core/doc/DocumentDrawModelManager.cxx @@ -348,9 +348,9 @@ bool DocumentDrawModelManager::Search(const SwPaM& rPaM, const SvxSearchItem& rS return false; OutlinerView* pOutlinerView = pSdrView->GetTextEditOutlinerView(); if (!rSearchItem.GetBackward()) - pOutlinerView->SetSelection(ESelection(0, 0, 0, 0)); + pOutlinerView->SetSelection(ESelection(0, 0)); else - pOutlinerView->SetSelection(ESelection(EE_PARA_MAX_COUNT, EE_TEXTPOS_MAX_COUNT, EE_PARA_MAX_COUNT, EE_TEXTPOS_MAX_COUNT)); + pOutlinerView->SetSelection(ESelection::AtEnd()); pOutlinerView->StartSearchAndReplace(rSearchItem); return true; } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 466e5d66e365..fd25867d8c8c 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -602,8 +602,8 @@ public: bool IsValidSel(const EditEngine& rEngine, const ESelection& rSel) { const auto nParaCount = rEngine.GetParagraphCount(); - if (rSel.nStartPara < nParaCount && rSel.nEndPara < nParaCount) - return rSel.nStartPos >= 0 && rSel.nEndPos >= 0; + if (rSel.start.nPara < nParaCount && rSel.end.nPara < nParaCount) + return rSel.start.nIndex >= 0 && rSel.end.nIndex >= 0; return false; } } @@ -685,7 +685,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, nTextStart - nStartCp)); sal_Int32 nParaCount = m_pDrawEditEngine->GetParagraphCount(); - bool bBadSelection = aReplaceSel.nStartPara >= nParaCount || aReplaceSel.nEndPara >= nParaCount; + bool bBadSelection = aReplaceSel.start.nPara >= nParaCount || aReplaceSel.end.nPara >= nParaCount; SAL_WARN_IF(bBadSelection, "sw.ww8", "editengine has different amount of text than expected"); diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index c0fdbee88cd4..b674c4373f5e 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1137,7 +1137,7 @@ void AddressMultiLineEdit::SetText( const OUString& rStr ) const OUString sPara = m_xEditEngine->GetText( nPara ); if (!sPara.isEmpty() && !sPara.endsWith(" ")) { - ESelection aPaM(nPara, sPara.getLength(), nPara, sPara.getLength()); + ESelection aPaM(nPara, sPara.getLength()); m_xEditEngine->QuickInsertText(u" "_ustr, aPaM); } for(;;) @@ -1168,7 +1168,7 @@ void AddressMultiLineEdit::SetText( const OUString& rStr ) sal_Int32 nLastLen = m_xEditEngine->GetText(nParaCount - 1).getLength(); if (nLastLen) { - ESelection aPaM(nParaCount - 1, nLastLen, nParaCount - 1, nLastLen); + ESelection aPaM(nParaCount - 1, nLastLen); m_xEditEngine->QuickInsertText(u"\n \n "_ustr, aPaM); } } @@ -1182,13 +1182,13 @@ void AddressMultiLineEdit::InsertNewEntry( const OUString& rStr ) { // insert new entry after current selected one. ESelection aSelection = m_xEditView->GetSelection(); - const sal_uInt32 nPara = aSelection.nStartPara; + const sal_uInt32 nPara = aSelection.start.nPara; std::vector aAttribList; m_xEditEngine->GetCharAttribs(nPara, aAttribList); - sal_Int32 nIndex = aSelection.nEndPara; - const EECharAttrib* pAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); + sal_Int32 nIndex = aSelection.end.nPara; + const EECharAttrib* pAttrib = FindCharAttrib(aSelection.start.nIndex, aAttribList); if(nullptr != pAttrib) nIndex = pAttrib->nEnd; InsertNewEntryAtPosition( rStr, nPara, nIndex ); @@ -1205,7 +1205,7 @@ void AddressMultiLineEdit::InsertNewEntry( const OUString& rStr ) void AddressMultiLineEdit::InsertNewEntryAtPosition( const OUString& rStr, sal_uLong nPara, sal_uInt16 nIndex ) { - ESelection aInsertPos(nPara, nIndex, nPara, nIndex); + ESelection aInsertPos(nPara, nIndex); m_xEditEngine->QuickInsertText(rStr, aInsertPos); //restore the attributes @@ -1221,14 +1221,14 @@ void AddressMultiLineEdit::RemoveCurrentEntry() ESelection aSelection = m_xEditView->GetSelection(); std::vector aAttribList; - m_xEditEngine->GetCharAttribs(aSelection.nStartPara, aAttribList); + m_xEditEngine->GetCharAttribs(aSelection.start.nPara, aAttribList); - const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); + const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.start.nIndex, aAttribList); if(pBeginAttrib && - (pBeginAttrib->nStart <= aSelection.nStartPos - && pBeginAttrib->nEnd >= aSelection.nEndPos)) + (pBeginAttrib->nStart <= aSelection.start.nIndex + && pBeginAttrib->nEnd >= aSelection.end.nIndex)) { - const sal_uInt32 nPara = aSelection.nStartPara; + const sal_uInt32 nPara = aSelection.start.nPara; ESelection aEntrySel(nPara, pBeginAttrib->nStart, nPara, pBeginAttrib->nEnd); m_xEditEngine->QuickInsertText(OUString(), aEntrySel); //restore the attributes @@ -1242,16 +1242,16 @@ void AddressMultiLineEdit::MoveCurrentItem(MoveItemFlags nMove) ESelection aSelection = m_xEditView->GetSelection(); std::vector aAttribList; - m_xEditEngine->GetCharAttribs(aSelection.nStartPara, aAttribList); + m_xEditEngine->GetCharAttribs(aSelection.start.nPara, aAttribList); - const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); + const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.start.nIndex, aAttribList); if(!pBeginAttrib || - pBeginAttrib->nStart > aSelection.nStartPos || - pBeginAttrib->nEnd < aSelection.nEndPos) + pBeginAttrib->nStart > aSelection.start.nIndex || + pBeginAttrib->nEnd < aSelection.end.nIndex) return; //current item has been found - sal_Int32 nPara = aSelection.nStartPara; + sal_Int32 nPara = aSelection.start.nPara; sal_Int32 nIndex = pBeginAttrib->nStart; ESelection aEntrySel(nPara, pBeginAttrib->nStart, nPara, pBeginAttrib->nEnd); const OUString sCurrentItem = m_xEditEngine->GetText(aEntrySel); @@ -1279,7 +1279,7 @@ void AddressMultiLineEdit::MoveCurrentItem(MoveItemFlags nMove) { //go right to find a successor or simple text ++nIndex; - const EECharAttrib* pEndAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); + const EECharAttrib* pEndAttrib = FindCharAttrib(aSelection.start.nIndex, aAttribList); if(pEndAttrib && pEndAttrib->nEnd >= nIndex) { nIndex = pEndAttrib->nEnd; @@ -1301,7 +1301,7 @@ void AddressMultiLineEdit::MoveCurrentItem(MoveItemFlags nMove) { auto nInsPara = nPara - 1; auto nInsPos = m_xEditEngine->GetTextLen( nPara - 1 ); - ESelection aTemp(nInsPara, nInsPos, nInsPara, nInsPos); + ESelection aTemp(nInsPara, nInsPos); m_xEditEngine->QuickInsertText(u"\n"_ustr, aTemp); } InsertNewEntryAtPosition( sCurrentItem, nPara, nIndex ); @@ -1322,18 +1322,18 @@ MoveItemFlags AddressMultiLineEdit::IsCurrentItemMoveable() const ESelection aSelection = m_xEditView->GetSelection(); std::vector aAttribList; - m_xEditEngine->GetCharAttribs(aSelection.nStartPara, aAttribList); + m_xEditEngine->GetCharAttribs(aSelection.start.nPara, aAttribList); - const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); + const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.start.nIndex, aAttribList); if (pBeginAttrib && - (pBeginAttrib->nStart <= aSelection.nStartPos - && pBeginAttrib->nEnd >= aSelection.nEndPos)) + (pBeginAttrib->nStart <= aSelection.start.nIndex + && pBeginAttrib->nEnd >= aSelection.end.nIndex)) { if (pBeginAttrib->nStart) nRet |= MoveItemFlags::Left; //if there is an entry it can always be move to the right and down nRet |= MoveItemFlags::Right | MoveItemFlags::Down; - if (aSelection.nStartPara > 0) + if (aSelection.start.nPara > 0) nRet |= MoveItemFlags::Up; } return nRet; @@ -1344,12 +1344,12 @@ bool AddressMultiLineEdit::HasCurrentItem() const ESelection aSelection = m_xEditView->GetSelection(); std::vector aAttribList; - m_xEditEngine->GetCharAttribs(aSelection.nStartPara, aAttribList); + m_xEditEngine->GetCharAttribs(aSelection.start.nPara, aAttribList); - const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); + const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.start.nIndex, aAttribList); return (pBeginAttrib && - (pBeginAttrib->nStart <= aSelection.nStartPos - && pBeginAttrib->nEnd >= aSelection.nEndPos)); + (pBeginAttrib->nStart <= aSelection.start.nIndex + && pBeginAttrib->nEnd >= aSelection.end.nIndex)); } OUString AddressMultiLineEdit::GetCurrentItem() const @@ -1357,14 +1357,14 @@ OUString AddressMultiLineEdit::GetCurrentItem() const ESelection aSelection = m_xEditView->GetSelection(); std::vector aAttribList; - m_xEditEngine->GetCharAttribs(aSelection.nStartPara, aAttribList); + m_xEditEngine->GetCharAttribs(aSelection.start.nPara, aAttribList); - const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); + const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.start.nIndex, aAttribList); if (pBeginAttrib && - (pBeginAttrib->nStart <= aSelection.nStartPos - && pBeginAttrib->nEnd >= aSelection.nEndPos)) + (pBeginAttrib->nStart <= aSelection.start.nIndex + && pBeginAttrib->nEnd >= aSelection.end.nIndex)) { - const sal_uInt32 nPara = aSelection.nStartPara; + const sal_uInt32 nPara = aSelection.start.nPara; ESelection aEntrySel(nPara, pBeginAttrib->nStart, nPara, pBeginAttrib->nEnd); return m_xEditEngine->GetText( aEntrySel ); } @@ -1376,14 +1376,14 @@ void AddressMultiLineEdit::SelectCurrentItem() ESelection aSelection = m_xEditView->GetSelection(); std::vector aAttribList; - m_xEditEngine->GetCharAttribs(aSelection.nStartPara, aAttribList); + m_xEditEngine->GetCharAttribs(aSelection.start.nPara, aAttribList); - const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.nStartPos, aAttribList); + const EECharAttrib* pBeginAttrib = FindCharAttrib(aSelection.start.nIndex, aAttribList); if (pBeginAttrib && - (pBeginAttrib->nStart <= aSelection.nStartPos - && pBeginAttrib->nEnd >= aSelection.nEndPos)) + (pBeginAttrib->nStart <= aSelection.start.nIndex + && pBeginAttrib->nEnd >= aSelection.end.nIndex)) { - const sal_uInt32 nPara = aSelection.nStartPara; + const sal_uInt32 nPara = aSelection.start.nPara; ESelection aEntrySel(nPara, pBeginAttrib->nStart, nPara, pBeginAttrib->nEnd); m_xEditView->SetSelection(aEntrySel); Invalidate(); @@ -1577,8 +1577,8 @@ bool AddressMultiLineEdit::SetCursorLogicPosition(const Point& rPosition) ESelection aSelection = m_xEditView->GetSelection(); std::vector aAttribList; - m_xEditEngine->GetCharAttribs(aSelection.nStartPara, aAttribList); - return FindCharAttrib(aSelection.nStartPos, aAttribList) == nullptr; + m_xEditEngine->GetCharAttribs(aSelection.start.nPara, aAttribList); + return FindCharAttrib(aSelection.start.nIndex, aAttribList) == nullptr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index db9c5a84289f..69f5c3a18194 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -805,9 +805,7 @@ bool SwSpellDialogChildWindow::SpellDrawText_Impl(SwWrtShell& rSh, svx::SpellPor { OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); ESelection aCurrentSelection = pOLV->GetSelection(); - if(m_pSpellState->m_aStartDrawingSelection.nEndPara < aCurrentSelection.nEndPara || - (m_pSpellState->m_aStartDrawingSelection.nEndPara == aCurrentSelection.nEndPara && - m_pSpellState->m_aStartDrawingSelection.nEndPos < aCurrentSelection.nEndPos)) + if (m_pSpellState->m_aStartDrawingSelection.end < aCurrentSelection.end) { bRet = false; rPortions.clear(); diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index c69f7ff6826b..b8dc99c3b81a 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -461,12 +461,12 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject const & rText) GetOutlinerView()->InsertText(u"..."_ustr); GetOutlinerView()->InsertText(u"\"\n"_ustr); - GetOutlinerView()->SetSelection(ESelection(0,0,EE_PARA_ALL,EE_TEXTPOS_ALL)); + GetOutlinerView()->SetSelection(ESelection::All()); SfxItemSet aAnswerSet( mrView.GetDocShell()->GetPool() ); aAnswerSet.Put(SvxFontHeightItem(200,80,EE_CHAR_FONTHEIGHT)); aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC)); GetOutlinerView()->SetAttribs(aAnswerSet); - GetOutlinerView()->SetSelection(ESelection(EE_PARA_MAX_COUNT,EE_TEXTPOS_MAX_COUNT,EE_PARA_MAX_COUNT,EE_TEXTPOS_MAX_COUNT)); + GetOutlinerView()->SetSelection(ESelection::AtEnd()); //remove all attributes and reset our standard ones GetOutlinerView()->GetEditView().RemoveAttribsKeepLanguages(true); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 03f3e5030ed6..83344e82d2e2 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1006,8 +1006,7 @@ void SwAnnotationWin::DeactivatePostIt() if (GetOutlinerView()->GetEditView().HasSelection()) { ESelection aSelection = GetOutlinerView()->GetEditView().GetSelection(); - aSelection.nEndPara = aSelection.nStartPara; - aSelection.nEndPos = aSelection.nStartPos; + aSelection.CollapseToStart(); GetOutlinerView()->GetEditView().SetSelection(aSelection); } diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 7ee85f5c7690..5bcbdee0c061 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -2538,10 +2538,9 @@ sal_uInt16 SwPostItMgr::SearchReplace(const SwFormatField &pField, const i18nuti { ESelection aOldSelection = pWin->GetOutlinerView()->GetSelection(); if (bSrchForward) - pWin->GetOutlinerView()->SetSelection(ESelection(0,0,0,0)); + pWin->GetOutlinerView()->SetSelection(ESelection(0, 0)); else - pWin->GetOutlinerView()->SetSelection( - ESelection(EE_PARA_MAX_COUNT,EE_TEXTPOS_MAX_COUNT,EE_PARA_MAX_COUNT,EE_TEXTPOS_MAX_COUNT)); + pWin->GetOutlinerView()->SetSelection(ESelection::AtEnd()); SvxSearchItem aItem(SID_SEARCH_ITEM ); aItem.SetSearchOptions(rSearchOptions); aItem.SetBackward(!bSrchForward); diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 7d71f58bd363..0e24f7542f57 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6148,7 +6148,7 @@ void SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) { OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); ESelection aSelection = pOLV->GetSelection(); - if(!aSelection.IsZero()) + if(aSelection != ESelection()) { SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner(); bool bVertical = pOutliner->IsVertical(); @@ -6167,8 +6167,7 @@ void SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) else aEEPos -= rOutputArea.TopLeft(); - EPosition aDocPosition = rEditEng.FindDocPosition(aEEPos); - ESelection aCompare(aDocPosition.nPara, aDocPosition.nIndex); + ESelection aCompare(rEditEng.FindDocPosition(aEEPos)); // make it a forward selection - otherwise the IsLess/IsGreater do not work :-( aSelection.Adjust(); if(!(aCompare < aSelection) && !(aCompare > aSelection)) diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 8b30443a241c..0231546f1504 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -416,7 +416,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) { // Select the field so that it will be deleted during insert ESelection aSel = pOLV->GetSelection(); - aSel.nEndPos++; + aSel.end.nIndex++; pOLV->SetSelection(aSel); } if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) @@ -1899,8 +1899,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) // Erase selection ESelection aSel(pOLV->GetSelection()); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); pOLV->SetSelection(aSel); // Restore old font diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index b3f152cf51a5..52aff06cdcaa 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -518,7 +518,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) { // Select field so that it will be deleted during insert ESelection aSel = pOLV->GetSelection(); - aSel.nEndPos++; + aSel.end.nIndex++; pOLV->SetSelection(aSel); } pOLV->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD)); @@ -1113,7 +1113,7 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest const &rReq) OutlinerView* pOLV = m_pSdrView->GetTextEditOutlinerView(); ESelection aSel(pOLV->GetSelection()); - const bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos); + const bool bCopy = aSel.HasRange(); sal_uInt16 nId = rReq.GetSlot(); switch( nId ) { @@ -1193,8 +1193,7 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet) OutlinerView* pOLV = m_pSdrView->GetTextEditOutlinerView(); ESelection aSel(pOLV->GetSelection()); - const bool bCopy = (aSel.nStartPara != aSel.nEndPara) || - (aSel.nStartPos != aSel.nEndPos); + const bool bCopy = aSel.HasRange(); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &GetView().GetEditWin() ) ); const bool bPaste = aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index 21a11a9f53f0..3679fefda26f 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -780,8 +780,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) // Remove selection ESelection aSel(pOLV->GetSelection()); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; + aSel.CollapseToEnd(); pOLV->SetSelection(aSel); // Restore old font diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 3bcdd618d0e5..bb7d4d969668 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -512,11 +512,11 @@ namespace SwLangHelper // string for guessing language // get the full text of the paragraph that the end of selection is in - OUString aText = rEditEngine->GetText(rDocSelection.nEndPos); + OUString aText = rEditEngine->GetText(rDocSelection.end.nIndex); if (!aText.isEmpty()) { sal_Int32 nStt = 0; - sal_Int32 nEnd = rDocSelection.nEndPos; + sal_Int32 nEnd = rDocSelection.end.nIndex; // at most 100 chars to the left... nStt = nEnd > 100 ? nEnd - 100 : 0; // ... and 100 to the right of the cursor position @@ -529,7 +529,7 @@ namespace SwLangHelper void SelectPara( EditView &rEditView, const ESelection &rCurSel ) { - ESelection aParaSel( rCurSel.nStartPara, 0, rCurSel.nStartPara, EE_TEXTPOS_ALL ); + ESelection aParaSel(rCurSel.start.nPara, 0, rCurSel.start.nPara, EE_TEXTPOS_MAX); rEditView.SetSelection( aParaSel ); } diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 952f6f89244a..e02b0d284232 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -585,7 +585,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin, } // editing should start at the end of text, spell checking at the beginning ... - ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); + ESelection aNewSelection(ESelection::AtEnd()); if (bSetSelectionToStart) aNewSelection = ESelection(); if (pView) diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index 6adbba81df4d..a9bbe3c5e369 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -204,7 +204,6 @@ #include #include #include -#include #include #include #include From c069f50a9e05c796935a55e6b2db5f714cf9cff7 Mon Sep 17 00:00:00 2001 From: Mohamed Ali Date: Sat, 23 Nov 2024 17:51:27 +0200 Subject: [PATCH 181/373] tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro Change-Id: I958365b3db058ec809702a5ddde1d153467f21ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177158 Reviewed-by: Ilmari Lauhakangas Tested-by: Jenkins --- editeng/qa/unit/core-test.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index ac3c683c9204..029df4439dee 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -900,7 +900,7 @@ void Test::testHyperlinkSearch() { 21, 25, /* -> */ 21, 23 }, // the field is really just one char { 25, 27, /* -> */ 22, 23 }, { 50, 56, /* -> */ 40, 46 } }; - for (size_t n = 0; n < SAL_N_ELEMENTS(aTrickyOnes); n++) + for (size_t n = 0; n < std::size(aTrickyOnes); n++) { sal_Int32 nStart = aTrickyOnes[n].mnStart; sal_Int32 nEnd = aTrickyOnes[n].mnEnd; From d3d176cc657d5dcb5e0bc6d8912358a9b4435a93 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 23 Nov 2024 14:54:47 +0500 Subject: [PATCH 182/373] Simplify a bit Change-Id: I0b3e02669b326533f4579f57a41a16da53cf8ff4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177188 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- sc/source/ui/view/cellsh4.cxx | 50 +++++++++++++---------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx index 754c5077e93a..5f1336a28338 100644 --- a/sc/source/ui/view/cellsh4.cxx +++ b/sc/source/ui/view/cellsh4.cxx @@ -365,37 +365,31 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq ) break; case SID_SELECT_COL: + if (const SfxPoolItem *pColItem, *pModifierItem; + pReqArgs && pReqArgs->HasItem(FN_PARAM_1, &pColItem) + && pReqArgs->HasItem(FN_PARAM_2, &pModifierItem)) { - const SfxPoolItem* pColItem; - const SfxPoolItem* pModifierItem; - if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pColItem ) && - pReqArgs->HasItem( FN_PARAM_2, &pModifierItem ) ) - { - SCCOL nCol = static_cast(static_cast(pColItem)->GetValue()); - sal_Int16 nModifier = static_cast(pModifierItem)->GetValue(); + SCCOL nCol = static_cast(static_cast(pColItem)->GetValue()); + sal_Int16 nModifier = static_cast(pModifierItem)->GetValue(); - pTabViewShell->MarkColumns( nCol, nModifier ); - } - else - pTabViewShell->MarkColumns(); + pTabViewShell->MarkColumns( nCol, nModifier ); } + else + pTabViewShell->MarkColumns(); break; case SID_SELECT_ROW: + if (const SfxPoolItem *pRowItem, *pModifierItem; + pReqArgs && pReqArgs->HasItem(FN_PARAM_1, &pRowItem) + && pReqArgs->HasItem(FN_PARAM_2, &pModifierItem)) { - const SfxPoolItem* pRowItem; - const SfxPoolItem* pModifierItem; - if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pRowItem ) && - pReqArgs->HasItem( FN_PARAM_2, &pModifierItem ) ) - { - SCROW nRow = static_cast(static_cast(pRowItem)->GetValue()); - sal_Int16 nModifier = static_cast(pModifierItem)->GetValue(); + SCROW nRow = static_cast(static_cast(pRowItem)->GetValue()); + sal_Int16 nModifier = static_cast(pModifierItem)->GetValue(); - pTabViewShell->MarkRows( nRow, nModifier ); - } - else - pTabViewShell->MarkRows(); + pTabViewShell->MarkRows( nRow, nModifier ); } + else + pTabViewShell->MarkRows(); break; case SID_SELECT_NONE: @@ -419,15 +413,9 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq ) break; case SID_FOCUS_INPUTLINE: - { - ScInputHandler* pHdl = ScModule::get()->GetInputHdl(pTabViewShell); - if (pHdl) - { - ScInputWindow* pWin = pHdl->GetInputWindow(); - if (pWin) - pWin->SwitchToTextWin(); - } - } + if (ScInputHandler* pHdl = ScModule::get()->GetInputHdl(pTabViewShell)) + if (ScInputWindow* pWin = pHdl->GetInputWindow()) + pWin->SwitchToTextWin(); break; case SID_CURSORTOPOFSCREEN: From 3f0da431b3b826cd7e653dba5e77af8ec8e177f5 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 23 Nov 2024 17:27:57 +0100 Subject: [PATCH 183/373] Revert "tdf#152299 - Remove unused define(s) from C/C++ files" This reverts commit aee4e184119512dc407d8a3696653b57d3d9a54f. It seems to break stable API. Change-Id: I64b7b1b5a5f5d53649a6117de34790238313ed23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177170 Reviewed-by: Julien Nabet Tested-by: Jenkins --- include/sal/config.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/sal/config.h b/include/sal/config.h index 4bf1f6c00225..f666fed23897 100644 --- a/include/sal/config.h +++ b/include/sal/config.h @@ -29,6 +29,7 @@ #endif #ifdef _WIN32 +#define SAL_W32 #define SAL_DLLEXTENSION ".dll" #define SAL_EXEEXTENSION ".exe" #define SAL_PATHSEPARATOR ';' From b3dd1e92af805bd549bcf9d5ce0553831d2afc73 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 23 Nov 2024 17:26:12 +0100 Subject: [PATCH 184/373] Revert "tdf#152299 - Remove unused define(s) from C/C++ files" This reverts commit 16a5ae7c90a3349854fb3975b435c24f08c0a51c. It seems to break public API. Change-Id: I0ef2c6e975b4cf20b9894ddf33f36444e2230ca4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177168 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/rtl/textcvt.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/rtl/textcvt.h b/include/rtl/textcvt.h index 277c0f846435..14d374c16f6d 100644 --- a/include/rtl/textcvt.h +++ b/include/rtl/textcvt.h @@ -89,6 +89,7 @@ SAL_DLLPUBLIC void SAL_CALL rtl_resetTextToUnicodeContext( rtl_TextToUnicodeConv #define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL ((sal_uInt32)0x0002) #define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL ((sal_uInt32)0x0002) // Misspelled constant, kept for backwards compatibility: +#define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ((sal_uInt32)0x0004) #define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL ((sal_uInt32)0x0004) #define RTL_TEXTTOUNICODE_INFO_UNDEFINED ((sal_uInt32)0x0008) #define RTL_TEXTTOUNICODE_INFO_MBUNDEFINED ((sal_uInt32)0x0010) From 7eaf28b0a210a9ad7b22372a2a850a8c514d7593 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 23 Nov 2024 15:42:02 +0500 Subject: [PATCH 185/373] tdf#164005: also initialize locales in hyphenate() ... which is also used in queryAlternativeSpelling Change-Id: I7f0bbbc6e598d56156efe1446f422f9674ed6f25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177187 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 46071a987f5c..5ec43190a731 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -273,6 +273,7 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo Reference< XHyphenatedWord > xRes; + ensureLocales(); int k = -1; for (size_t j = 0; j < mvDicts.size(); ++j) { @@ -660,7 +661,6 @@ Reference < XHyphenatedWord > SAL_CALL Hyphenator::queryAlternativeSpelling( sal_Int16 nIndex, const css::uno::Sequence< css::beans::PropertyValue >& aProperties ) { - ensureLocales(); // Firstly we allow only one plus character before the hyphen to avoid to miss the right break point: for (int extrachar = 1; extrachar <= 2; extrachar++) { From 948e99fb30a98120e9c8281d5158faf9370e0a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 22 Nov 2024 17:21:58 +0000 Subject: [PATCH 186/373] cid#1555216 COPY_INSTEAD_OF_MOVE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and cid#1555525 COPY_INSTEAD_OF_MOVE cid#1555562 COPY_INSTEAD_OF_MOVE cid#1555676 COPY_INSTEAD_OF_MOVE cid#1556099 COPY_INSTEAD_OF_MOVE cid#1556527 COPY_INSTEAD_OF_MOVE cid#1556607 COPY_INSTEAD_OF_MOVE cid#1557084 COPY_INSTEAD_OF_MOVE cid#1557141 COPY_INSTEAD_OF_MOVE cid#1557937 COPY_INSTEAD_OF_MOVE cid#1556099 COPY_INSTEAD_OF_MOVE cid#1557774 COPY_INSTEAD_OF_MOVE Change-Id: Ifd716627d985dd43f4d1a9ce3df151e519fab03a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177163 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- sw/source/core/crsr/crstrvl.cxx | 2 +- sw/source/core/doc/docedt.cxx | 2 +- sw/source/core/edit/edlingu.cxx | 4 ++-- sw/source/core/edit/edsect.cxx | 2 +- sw/source/core/layout/trvlfrm.cxx | 10 +++++----- sw/source/core/unocore/unoobj.cxx | 8 ++++---- sw/source/uibase/uno/unotxvw.cxx | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index fc7aac7814d4..f2e4d72ac7cf 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -2015,7 +2015,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, { SwCallLink aLk( *this ); // watch Cursor-Moves SwCursorSaveState aSaveState( *m_pCurrentCursor ); - *m_pCurrentCursor->GetPoint() = aPos; + *m_pCurrentCursor->GetPoint() = std::move(aPos); if( m_pCurrentCursor->IsSelOvr( SwCursorSelOverFlags::CheckNodeSection | SwCursorSelOverFlags::Toggle) ) bRet = false; diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index c5dc09a64f3b..bf1d9d3679e6 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -428,7 +428,7 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev ) if( pOldTextNd == rPam.GetBound().GetContentNode() ) rPam.GetBound() = aAlphaPos; if( pOldTextNd == rPam.GetBound( false ).GetContentNode() ) - rPam.GetBound( false ) = aAlphaPos; + rPam.GetBound( false ) = std::move(aAlphaPos); } // delete the Node, at last! SwNode::Merge const eOldMergeFlag(pOldTextNd->GetRedlineMergeFlag()); diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index d2d3a3d4b842..e9900882a391 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -837,7 +837,7 @@ void SwEditShell::HandleCorrectionError(const OUString& aText, SwPosition aPos, aPos.SetContent( nBegin + nLeft ); SwPaM* pCursor = GetCursor(); - *pCursor->GetPoint() = aPos; + *pCursor->GetPoint() = std::move(aPos); pCursor->SetMark(); ExtendSelection( true, nLen - nLeft - nRight ); // don't determine the rectangle in the current line @@ -1667,7 +1667,7 @@ void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > const & xAl *pCursor->GetMark() = *pCursor->GetPoint(); } pCursor->SetMark(); - *pCursor->GetMark() = aStart; + *pCursor->GetMark() = std::move(aStart); CreatePortion(xAlt, pGrammarResult, false, false); } } diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index 77fd2e7b3dc9..8059a313f3ac 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -460,7 +460,7 @@ void SwEditShell::DoSpecialInsert() // insert a new text node, and set the cursor GetDoc()->getIDocumentContentOperations().AppendTextNode( aInsertPos ); - *pCursorPos = aInsertPos; + *pCursorPos = std::move(aInsertPos); // call AttrChangeNotify for the UI CallChgLnk(); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 38d0248e4e9e..65a6f7e8fdf7 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -293,11 +293,11 @@ bool SwPageFrame::GetModelPositionForViewPoint( SwPosition *pPos, Point &rPoint, if (bConsiderBackground && bTestBackground && bBackRet) { - (*pPos) = aBackPos; + (*pPos) = std::move(aBackPos); } else if (!bBackRet) { - (*pPos) = aTextPos; + (*pPos) = std::move(aTextPos); } else // bBackRet && !(bConsiderBackground && bTestBackground) { @@ -328,7 +328,7 @@ bool SwPageFrame::GetModelPositionForViewPoint( SwPosition *pPos, Point &rPoint, // previous character; to get a better measure from // lcl_getDistance, extend that to a rectangle over // the entire character. - SwPosition nextTextPos(prevTextPos); + SwPosition nextTextPos(std::move(prevTextPos)); nextTextPos.AdjustContent(+1); SwRect nextTextRect; pTextFrame->GetCharRect(nextTextRect, nextTextPos); @@ -375,11 +375,11 @@ bool SwPageFrame::GetModelPositionForViewPoint( SwPosition *pPos, Point &rPoint, if ( bValidTextDistance && bValidBackDistance && basegfx::fTools::more( nTextDistance, nBackDistance ) ) { - (*pPos) = aBackPos; + (*pPos) = std::move(aBackPos); } else { - (*pPos) = aTextPos; + (*pPos) = std::move(aTextPos); } } } diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index bee8090f4fe0..0d7b29bf9ccf 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -814,12 +814,12 @@ lcl_ForceIntoMeta(SwPaM & rCursor, case META_CHECK_BOTH: if (*rCursor.Start() < start) { - *rCursor.Start() = start; + *rCursor.Start() = std::move(start); bRet = false; } if (*rCursor.End() > end) { - *rCursor.End() = end; + *rCursor.End() = std::move(end); bRet = false; } break; @@ -866,13 +866,13 @@ bool lcl_ForceIntoContentControl(SwPaM& rCursor, const uno::Reference aEnd) { - *rCursor.End() = aEnd; + *rCursor.End() = std::move(aEnd); bRet = false; } break; diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index f48457b483ee..e7d4ca9f76cd 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1054,12 +1054,12 @@ void SwXTextViewCursor::gotoRange( auto [pParamLeft, pParamRight] = rDestPam.StartEnd(); // SwPosition* // Now four SwPositions are there, two of them are needed, but which? if(aOwnRight > *pParamRight) - *aOwnPaM.GetPoint() = aOwnRight; + *aOwnPaM.GetPoint() = std::move(aOwnRight); else *aOwnPaM.GetPoint() = *pParamRight; aOwnPaM.SetMark(); if(aOwnLeft < *pParamLeft) - *aOwnPaM.GetMark() = aOwnLeft; + *aOwnPaM.GetMark() = std::move(aOwnLeft); else *aOwnPaM.GetMark() = *pParamLeft; } From b4cb8dd96f7031fcfaff22f8728121cab37e68f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 22 Nov 2024 20:13:11 +0000 Subject: [PATCH 187/373] cid#1606622 silence Overflowed integer argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8a25e19d3de1515a03fe478fa28c1f5eec0963c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177165 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 7e8bb6a455eb..77c1c65a757c 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -433,6 +433,7 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const tools: auto aTextHeight = rRenderContext.GetTextHeight(); // Get max title width + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 auto nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET; nMaxTitleWidth -= (2 * SMALL_ICON_SIZE) + (4 * SPACE_BETWEEN); rRenderContext.SetFont(aStdFont); From ec775c8ada237b7a861074e51caf36a79d0e5fcc Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 24 Nov 2024 12:47:25 +0500 Subject: [PATCH 188/373] Deduplicate a bit Change-Id: I9a19dcc2fbf5297fe391fcd3644843eb51afdb9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177200 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- .../source/hyphenator/hyphen/hyphenimp.cxx | 109 +++++++----------- .../source/hyphenator/hyphen/hyphenimp.hxx | 1 + 2 files changed, 42 insertions(+), 68 deletions(-) diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 5ec43190a731..a9d6d779bacb 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -108,10 +108,9 @@ PropertyHelper_Hyphenation& Hyphenator::GetPropHelper_Impl() return *pPropHelper; } +// Requires GetLinguMutex locked void Hyphenator::ensureLocales() { - MutexGuard aGuard( GetLinguMutex() ); - // this routine should return the locales supported by the installed // dictionaries. if (mvDicts.empty()) @@ -256,6 +255,34 @@ bool LoadDictionary(HDInfo& rDict) } } +const HDInfo* Hyphenator::getMatchingDict(const css::lang::Locale& aLocale) +{ + MutexGuard aGuard(GetLinguMutex()); + ensureLocales(); + auto it = std::find_if(mvDicts.rbegin(), mvDicts.rend(), + [&aLocale](auto& el) { return el.aLoc == aLocale; }); + if (it == mvDicts.rend()) + return nullptr; + + // if this dictionary has not been loaded yet do that + if (!it->aPtr) + { + if (!LoadDictionary(*it)) + return nullptr; + } + + // we don't want to work with a default text encoding since following incorrect + // results may occur only for specific text and thus may be hard to notice. + // Thus better always make a clean exit here if the text encoding is in question. + // Hopefully something not working at all will raise proper attention quickly. ;-) + DBG_ASSERT(it->eEnc != RTL_TEXTENCODING_DONTKNOW, + "failed to get text encoding! (maybe incorrect encoding string in file)"); + if (it->eEnc == RTL_TEXTENCODING_DONTKNOW) + return nullptr; + + return &*it; +} + Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWord, const css::lang::Locale& aLocale, sal_Int16 nMaxLeading, @@ -269,36 +296,17 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo sal_Int16 minLen = rHelper.GetMinWordLength(); bool bNoHyphenateCaps = rHelper.IsNoHyphenateCaps(); - rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW; - - Reference< XHyphenatedWord > xRes; - - ensureLocales(); - int k = -1; - for (size_t j = 0; j < mvDicts.size(); ++j) - { - if (aLocale == mvDicts[j].aLoc) - k = j; - } - // if we have a hyphenation dictionary matching this locale - if (k != -1) + if (auto pHDInfo = getMatchingDict(aLocale)) { int nHyphenationPos = -1; int nHyphenationPosAlt = -1; int nHyphenationPosAltHyph = -1; - // if this dictionary has not been loaded yet do that - if (!mvDicts[k].aPtr) - { - if (!LoadDictionary(mvDicts[k])) - return nullptr; - } - - // otherwise hyphenate the word with that dictionary - HyphenDict *dict = mvDicts[k].aPtr; - eEnc = mvDicts[k].eEnc; - CharClass * pCC = mvDicts[k].apCC.get(); + // hyphenate the word with that dictionary + HyphenDict* dict = pHDInfo->aPtr; + rtl_TextEncoding eEnc = pHDInfo->eEnc; + CharClass* pCC = pHDInfo->apCC.get(); // Don't hyphenate uppercase words if requested if (bNoHyphenateCaps && aWord == makeUpperCase(aWord, pCC)) @@ -306,14 +314,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo return nullptr; } - // we don't want to work with a default text encoding since following incorrect - // results may occur only for specific text and thus may be hard to notice. - // Thus better always make a clean exit here if the text encoding is in question. - // Hopefully something not working at all will raise proper attention quickly. ;-) - DBG_ASSERT( eEnc != RTL_TEXTENCODING_DONTKNOW, "failed to get text encoding! (maybe incorrect encoding string in file)" ); - if (eEnc == RTL_TEXTENCODING_DONTKNOW) - return nullptr; - CapType ct = capitalType(aWord, pCC); // first convert any smart quotes or apostrophes to normal ones @@ -585,11 +585,8 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo } } - if (nHyphenationPos == -1) - { - xRes = nullptr; - } - else + Reference xRes; + if (nHyphenationPos != -1) { if (rep && rep[nHyphenationPos]) { @@ -689,37 +686,13 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const aWord, Sequence< sal_Int16 >() ); } - ensureLocales(); - int k = -1; - for (size_t j = 0; j < mvDicts.size(); ++j) - { - if (aLocale == mvDicts[j].aLoc) - k = j; - } - // if we have a hyphenation dictionary matching this locale - if (k != -1) + if (auto pHDInfo = getMatchingDict(aLocale)) { - HyphenDict *dict = nullptr; - // if this dictionary has not been loaded yet do that - if (!mvDicts[k].aPtr) - { - if (!LoadDictionary(mvDicts[k])) - return nullptr; - } - - // otherwise hyphenate the word with that dictionary - dict = mvDicts[k].aPtr; - rtl_TextEncoding eEnc = mvDicts[k].eEnc; - CharClass* pCC = mvDicts[k].apCC.get(); - - // we don't want to work with a default text encoding since following incorrect - // results may occur only for specific text and thus may be hard to notice. - // Thus better always make a clean exit here if the text encoding is in question. - // Hopefully something not working at all will raise proper attention quickly. ;-) - DBG_ASSERT( eEnc != RTL_TEXTENCODING_DONTKNOW, "failed to get text encoding! (maybe incorrect encoding string in file)" ); - if (eEnc == RTL_TEXTENCODING_DONTKNOW) - return nullptr; + // hyphenate the word with that dictionary + HyphenDict* dict = pHDInfo->aPtr; + rtl_TextEncoding eEnc = pHDInfo->eEnc; + CharClass* pCC = pHDInfo->apCC.get(); // first handle smart quotes both single and double OUStringBuffer rBuf(aWord); diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx index f60639ff2aa6..c66650891e6b 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx @@ -121,6 +121,7 @@ private: static OUString makeInitCap(const OUString&, CharClass const *); void ensureLocales(); + const HDInfo* getMatchingDict(const css::lang::Locale& aLocale); }; #endif From 16b629cf08f93e27e52816c761eeb3b5c128647b Mon Sep 17 00:00:00 2001 From: Patrick Luby Date: Sat, 23 Nov 2024 17:18:57 -0500 Subject: [PATCH 189/373] tdf#157312 and tdf#163945 Lower Skia flush timer priority on macOS On macOS, flushing with Skia/Metal is noticeably slower than with Skia/Raster. So lower the flush timer priority to TaskPriority::POST_PAINT so that the flush timer runs less frequently but each pass copies a more up-to-date offscreen surface. Unfortunately, lowering the priority causes tdf#163734 to reoccur. When a dockable window is dragged by its titlebar, a rectangle may be drawn in its parent window. However, the Skia flush timer doesn't run until after the mouse button has been released (probably due to lowering of the Skia flush timer's priority to fix tdf#163734). So run the parent frame's Skia flush timer immediately to display the rectangle. Change-Id: I289eab85a087cb76a751dc6b777342b8dee49e1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177190 Reviewed-by: Patrick Luby Tested-by: Jenkins --- vcl/osx/salframeview.mm | 19 +++++++++++++++++++ vcl/skia/gdiimpl.cxx | 22 ++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index b5a2d682e34c..ceab3c872fc4 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -440,6 +440,25 @@ static bool isMouseScrollWheelEvent( NSEvent *pEvent ) { mpFrame->UpdateFrameGeometry(); mpFrame->CallCallback( SalEvent::Move, nullptr ); + +#if HAVE_FEATURE_SKIA + // tdf#163734 Flush parent frame when Skia is enabled + // When a dockable window is dragged by its titlebar, a rectangle + // may be drawn in its parent window. However, the Skia flush + // timer doesn't run until after the mouse button has been + // released (probably due to lowering of the Skia flush timer's + // priority to fix tdf#163734). So run the parent frame's Skia + // flush timer immediately to display the rectangle. + if ( SkiaHelper::isVCLSkiaEnabled() && + mpFrame->mbShown && mpFrame->mpParent && + AquaSalFrame::isAlive( mpFrame->mpParent ) && + mpFrame->mpParent->mbShown ) + { + AquaSalGraphics* pGraphics = mpFrame->mpParent->mpGraphics; + if ( pGraphics ) + pGraphics->Flush(); + } +#endif } } diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 815c52b119f2..579a2d98d7fa 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -269,16 +269,18 @@ public: { mpGraphics->performFlush(); Stop(); - // tdf#163945 Lower priority of Skia flush timer - // Commit f4c2c7c79cfe4464ac596afda37b8904d06969db fixed tdf#157312 - // by lowering the timer priority to TaskPriority::POST_PAINT. But - // it caused tdf#163734 so it was reverted to TaskPriority::HIGHEST - // in commit 5a38e4f9798c5ff247aa57581adf2671485627fd. - // While reverting to TaskPriority::HIGHEST did not cause tdf#157312 - // to reoccur, it did cause tdf#163945 so set the timer priority to - // TaskPriority::HIGH_IDLE. This priority appears to be low enough to - // fix tdf#16394 without causing tdf#163734 to reoccur. - SetPriority(TaskPriority::HIGH_IDLE); +#ifdef MACOSX + // tdf#157312 and tdf#163945 Lower Skia flush timer priority on macOS + // On macOS, flushing with Skia/Metal is noticeably slower than + // with Skia/Raster. So lower the flush timer priority to + // TaskPriority::POST_PAINT so that the flush timer runs less + // frequently but each pass copies a more up-to-date offscreen + // surface. + // TODO: fix tdf#163734 on macOS + SetPriority(TaskPriority::POST_PAINT); +#else + SetPriority(TaskPriority::HIGHEST); +#endif } }; From 53d54929b518e48b307611bb0e2209629a17395f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 22 Nov 2024 20:00:28 +0000 Subject: [PATCH 190/373] cid#1606852 silence Overflowed constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I94d75d6c2b69937e5d0f29b498518999b1f49120 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177167 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- registry/source/reflwrit.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx index 854a4e0d865c..62245f6f38be 100644 --- a/registry/source/reflwrit.cxx +++ b/registry/source/reflwrit.cxx @@ -62,6 +62,8 @@ sal_uInt32 readString(const sal_uInt8* buffer, sal_Unicode* v, sal_uInt32 maxSiz len = maxSize / 2; } + assert(len > 0 && "maxSize has to be >= 2"); + for (i = 0; i < len; i++) { sal_uInt16 aChar; From aed4e00c4f5788253d68502f7d957dbb08f4555b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sat, 2 Nov 2024 20:37:02 +0000 Subject: [PATCH 191/373] UserInstallation may change in kit-mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So the setting fetched at ctor time for UserInstallation (and BRAND_BASE_DIR) may no longer be true, so expanding variables based on those earlier seen values results in unwanted paths. add XInitialization to SubstitutePathVariables (like done for PathSettings) to allow reiniting these explicitly once. Change-Id: Ia930ea71cb09adc91d6d47ee047c44b24222e8a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175961 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 410f6b50eb44276b1d2095c844244ef4d0ddefaa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177109 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- desktop/source/lib/init.cxx | 19 +++++++++++---- .../source/services/substitutepathvars.cxx | 23 ++++++++++++++++--- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f4e2c39f6d07..4842a9732cee 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -107,6 +107,7 @@ #include #include #include +#include #include #include #include @@ -8237,12 +8238,20 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char utl::Bootstrap::reloadData(); // Now that bootstrap User/Shared installation paths have been (re)set to the final - // location, reinitialize the PathSettings so $(userurl)/$(instdir) path variables - // will be expanded using these newly set paths and not the paths detected during - // preinit which used unorthodox throwaway temp locations + // location, reinitialize the PathSubstitution rules and PathSettings so that + // $(userurl)/$(instdir) path variables will be expanded using these newly set + // paths and not the paths detected during preinit which used unorthodox throwaway + // temp locations + + // First reinitialize the PathSubstitution rules + uno::Reference xPathSubst(util::PathSubstitution::create(xContext)); + uno::Reference xReInitSubstitution(xPathSubst, uno::UNO_QUERY_THROW); + xReInitSubstitution->initialize({}); + + // PathSettings depend on PathSubstitution rules uno::Reference xPathSettings = util::thePathSettings::get(xContext); - uno::Reference xReInit(xPathSettings, uno::UNO_QUERY_THROW); - xReInit->initialize({}); + uno::Reference xReInitSettings(xPathSettings, uno::UNO_QUERY_THROW); + xReInitSettings->initialize({}); } } diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx index 3d84cb619384..febece5e6040 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -35,6 +35,7 @@ #include +#include #include #include #include @@ -130,7 +131,8 @@ struct ReSubstFixedVarOrder typedef comphelper::WeakComponentImplHelper< css::util::XStringSubstitution, - css::lang::XServiceInfo > SubstitutePathVariables_BASE; + css::lang::XServiceInfo, + css::lang::XInitialization > SubstitutePathVariables_BASE; class SubstitutePathVariables : public SubstitutePathVariables_BASE { @@ -157,7 +159,12 @@ public: virtual OUString SAL_CALL reSubstituteVariables( const OUString& aText ) override; virtual OUString SAL_CALL getSubstituteVariableValue( const OUString& variable ) override; -protected: + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence& /*rArguments*/) override; + +private: + void impl_initialize(); + void SetPredefinedPathVariables(); // Special case (transient) values can change during runtime! @@ -188,6 +195,11 @@ private: }; SubstitutePathVariables::SubstitutePathVariables() +{ + impl_initialize(); +} + +void SubstitutePathVariables::impl_initialize() { SetPredefinedPathVariables(); @@ -219,6 +231,12 @@ SubstitutePathVariables::SubstitutePathVariables() sort(m_aReSubstFixedVarOrder.begin(),m_aReSubstFixedVarOrder.end()); } +void SAL_CALL SubstitutePathVariables::initialize(const css::uno::Sequence& /*rArguments*/) +{ + std::unique_lock g(m_aMutex); + impl_initialize(); +} + // XStringSubstitution OUString SAL_CALL SubstitutePathVariables::substituteVariables( const OUString& aText, sal_Bool bSubstRequired ) { @@ -598,7 +616,6 @@ OUString const & SubstitutePathVariables::impl_getSubstituteVariableValue( const void SubstitutePathVariables::SetPredefinedPathVariables() { - m_aPreDefVars.m_FixedVar[PREDEFVAR_BRANDBASEURL] = "$BRAND_BASE_DIR"; rtl::Bootstrap::expandMacros( m_aPreDefVars.m_FixedVar[PREDEFVAR_BRANDBASEURL]); From 12cad7e619913323eb748464ffe1a3bae2a9dd4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 22 Nov 2024 21:14:47 +0000 Subject: [PATCH 192/373] cid#1607163 silence Overflowed return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and cid#1608078 Overflowed return value cid#1608461 Overflowed return value Change-Id: Ic5fa20994c5be5d6c09a21c0bd1e3530ae9a6941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177164 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- scaddins/source/analysis/analysis.cxx | 3 ++- scaddins/source/analysis/analysishelper.hxx | 1 - sw/source/filter/ww8/writerwordglue.cxx | 1 + tools/source/datetime/tdate.cxx | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 81e12782a320..570d4e355261 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -407,7 +407,8 @@ sal_Int32 SAL_CALL AnalysisAddIn::getWeeknum( const uno::Reference< beans::XProp DaysToDate( nDate, nDay, nMonth, nYear ); sal_Int32 nFirstInYear = DateToDays( 1, 1, nYear ); - sal_Int16 nFirstDayInYear = GetDayOfWeek( nFirstInYear ); + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 + sal_uInt16 nFirstDayInYear = GetDayOfWeek( nFirstInYear ); return ( nDate - nFirstInYear + ( ( nMode == 1 )? ( nFirstDayInYear + 1 ) % 7 : nFirstDayInYear ) ) / 7 + 1; } diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx index fdb5d4a7994a..0fdae29ccd66 100644 --- a/scaddins/source/analysis/analysishelper.hxx +++ b/scaddins/source/analysis/analysishelper.hxx @@ -580,7 +580,6 @@ inline sal_Int32 GetDiffDate360( const css::uno::Reference< css::beans::XPropert inline sal_Int16 GetDayOfWeek( sal_Int32 n ) { // monday = 0, ..., sunday = 6 - assert(n >= 0); return static_cast< sal_Int16 >( ( n - 1 ) % 7 ); } diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index e2c76cfaf257..1f3fa03fd962 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -744,6 +744,7 @@ namespace sw if ( rDT.GetDate() == 0 ) return 0; + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 sal_uInt32 nDT = ( rDT.GetDayOfWeek() + 1 ) % 7; nDT <<= 9; nDT += ( rDT.GetYear() - 1900 ) & 0x1ff; diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 03ec18e6f394..3548f08f06f8 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -209,9 +209,8 @@ sal_uInt16 Date::GetDayOfYear() const sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, sal_Int16 nMinimumNumberOfDaysInWeek ) const { - short nWeek; + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 short n1WDay = static_cast(Date( 1, 1, GetYear() ).GetDayOfWeek()); - assert(n1WDay >= 0); short nDayOfYear = static_cast(GetDayOfYear()); // weekdays start at 0, thus decrement one @@ -225,6 +224,7 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, nMinimumNumberOfDaysInWeek = 4; } + short nWeek; if ( nMinimumNumberOfDaysInWeek == 1 ) { nWeek = ((n1WDay+nDayOfYear)/7) + 1; From b44339c2156dbef8a9adb4be88981631d0181c29 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 24 Nov 2024 15:08:46 +0500 Subject: [PATCH 193/373] Deduplicate calls to hnj_hyphen_hyphenate3 Change-Id: Iecd3cf707fd692a10382f3a6be02c2dd94f02111 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177201 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- .../source/hyphenator/hyphen/hyphenimp.cxx | 322 +++++++----------- .../source/hyphenator/hyphen/hyphenimp.hxx | 4 - 2 files changed, 121 insertions(+), 205 deletions(-) diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index a9d6d779bacb..66d22f0b61a9 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -253,6 +253,100 @@ bool LoadDictionary(HDInfo& rDict) rDict.eEnc = getTextEncodingFromCharset(dict->cset); return true; } + +OUString makeLowerCase(const OUString& aTerm, CharClass const* pCC) +{ + if (pCC) + return pCC->lowercase(aTerm); + return aTerm; +} + +OUString makeUpperCase(const OUString& aTerm, CharClass const* pCC) +{ + if (pCC) + return pCC->uppercase(aTerm); + return aTerm; +} + +OUString makeInitCap(const OUString& aTerm, CharClass const* pCC) +{ + sal_Int32 tlen = aTerm.getLength(); + if (pCC && tlen) + { + OUString bTemp = aTerm.copy(0, 1); + if (tlen > 1) + return (pCC->uppercase(bTemp, 0, 1) + pCC->lowercase(aTerm, 1, (tlen - 1))); + + return pCC->uppercase(bTemp, 0, 1); + } + return aTerm; +} + +struct hyphenation_result +{ + int n = 0; + bool failed = true; + char** rep = nullptr; // replacements of discretionary hyphenation + int* pos = nullptr; // array of [hyphenation point] minus [deletion position] + int* cut = nullptr; // length of deletions in original word + std::unique_ptr hyphens; + + ~hyphenation_result() + { + if (rep) + { + for (int i = 0; i < n; i++) + { + if (rep[i]) + free(rep[i]); + } + free(rep); + } + if (pos) + free(pos); + if (cut) + free(cut); + } +}; + +hyphenation_result getHyphens(std::u16string_view word, const HDInfo& hdInfo, sal_Int16 minLead, + sal_Int16 minTrail) +{ + // first convert any smart quotes or apostrophes to normal ones + OUStringBuffer aBuf(word); + for (sal_Int32 ix = 0; ix < aBuf.getLength(); ix++) + { + sal_Unicode ch = aBuf[ix]; + if ((ch == 0x201C) || (ch == 0x201D)) + aBuf[ix] = u'"'; + if ((ch == 0x2018) || (ch == 0x2019)) + aBuf[ix] = u'\''; + } + + // now convert word to all lowercase for pattern recognition + OUString nTerm(makeLowerCase(OUString::unacquired(aBuf), hdInfo.apCC.get())); + + // now convert word to needed encoding + OString encWord(OU2ENC(nTerm, hdInfo.eEnc)); + + // now strip off any ending periods + auto lastValidPos = std::string_view(encWord).find_last_not_of('.'); + if (lastValidPos == std::string_view::npos) + return {}; + + int n = lastValidPos + 1; + std::unique_ptr hyphens(new char[n + 5]); + char** rep = nullptr; // replacements of discretionary hyphenation + int* pos = nullptr; // array of [hyphenation point] minus [deletion position] + int* cut = nullptr; // length of deletions in original word + + HyphenDict* dict = hdInfo.aPtr; + const bool failed = 0 != hnj_hyphen_hyphenate3( dict, encWord.getStr(), n, hyphens.get(), nullptr, + &rep, &pos, &cut, minLead, minTrail, + std::max(dict->clhmin, 2) + std::max(0, minLead - std::max(dict->lhmin, 2)), + std::max(dict->crhmin, 2) + std::max(0, minTrail - std::max(dict->rhmin, 2)) ); + return { n, failed, rep, pos, cut, std::move(hyphens) }; // buffers will free in dtor +} } const HDInfo* Hyphenator::getMatchingDict(const css::lang::Locale& aLocale) @@ -304,7 +398,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo int nHyphenationPosAltHyph = -1; // hyphenate the word with that dictionary - HyphenDict* dict = pHDInfo->aPtr; rtl_TextEncoding eEnc = pHDInfo->eEnc; CharClass* pCC = pHDInfo->apCC.get(); @@ -316,68 +409,9 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo CapType ct = capitalType(aWord, pCC); - // first convert any smart quotes or apostrophes to normal ones - OUStringBuffer rBuf(aWord); - sal_Int32 nc = rBuf.getLength(); - sal_Unicode ch; - for (sal_Int32 ix=0; ix < nc; ix++) - { - ch = rBuf[ix]; - if ((ch == 0x201C) || (ch == 0x201D)) - rBuf[ix] = u'"'; - if ((ch == 0x2018) || (ch == 0x2019)) - rBuf[ix] = u'\''; - } - OUString nWord(rBuf.makeStringAndClear()); - - // now convert word to all lowercase for pattern recognition - OUString nTerm(makeLowerCase(nWord, pCC)); - - // now convert word to needed encoding - OString encWord(OU2ENC(nTerm,eEnc)); - - int wordlen = encWord.getLength(); - std::unique_ptr lcword(new char[wordlen + 1]); - std::unique_ptr hyphens(new char[wordlen + 5]); - - char ** rep = nullptr; // replacements of discretionary hyphenation - int * pos = nullptr; // array of [hyphenation point] minus [deletion position] - int * cut = nullptr; // length of deletions in original word - - // copy converted word into simple char buffer - strcpy(lcword.get(),encWord.getStr()); - - // now strip off any ending periods - int n = wordlen-1; - while((n >=0) && (lcword[n] == '.')) - n--; - n++; - if (n > 0) - { - const bool bFailed = 0 != hnj_hyphen_hyphenate3( dict, lcword.get(), n, hyphens.get(), nullptr, - &rep, &pos, &cut, minLead, minTrail, - std::max(dict->clhmin, std::max(dict->clhmin, 2) + std::max(0, minLead - std::max(dict->lhmin, 2))), - std::max(dict->crhmin, std::max(dict->crhmin, 2) + std::max(0, minTrail - std::max(dict->rhmin, 2))) ); - if (bFailed) - { - // whoops something did not work - if (rep) - { - for(int j = 0; j < n; j++) - { - if (rep[j]) free(rep[j]); - } - free(rep); - } - if (pos) free(pos); - if (cut) free(cut); - return nullptr; - } - } - - // now backfill hyphens[] for any removed trailing periods - for (int c = n; c < wordlen; c++) hyphens[c] = '0'; - hyphens[wordlen] = '\0'; + auto result = getHyphens(aWord, *pHDInfo, minLead, minTrail); + if (result.failed) + return nullptr; sal_Int32 Leading = GetPosInWordToCheck( aWord, nMaxLeading ); @@ -391,20 +425,20 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo OUString sStems; // processed result of the compound word analysis, e.g. com|pound|word sal_Int32 nSuffixLen = 0; // do not remove break points in suffixes - for (sal_Int32 i = 0; i < n; i++) + for (sal_Int32 i = 0; i < result.n; i++) { int leftrep = 0; - bool hit = (n >= minLen); - if (!rep || !rep[i]) + bool hit = (result.n >= minLen); + if (!result.rep || !result.rep[i]) { - hit = hit && (hyphens[i]&1) && (i < Leading); + hit = hit && (result.hyphens[i] & 1) && (i < Leading); hit = hit && (i >= (minLead-1) ); - hit = hit && ((n - i - 1) >= minTrail); + hit = hit && ((result.n - i - 1) >= minTrail); } else { // calculate change character length before hyphenation point signed with '=' - for (char * c = rep[i]; *c && (*c != '='); c++) + for (char * c = result.rep[i]; *c && (*c != '='); c++) { if (eEnc == RTL_TEXTENCODING_UTF8) { @@ -414,9 +448,9 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo else leftrep++; } - hit = hit && (hyphens[i]&1) && ((i + leftrep - pos[i]) < Leading); - hit = hit && ((i + leftrep - pos[i]) >= (minLead-1) ); - hit = hit && ((n - i - 1 + sal::static_int_cast< sal_sSize >(strlen(rep[i])) - leftrep - 1) >= minTrail); + hit = hit && (result.hyphens[i] & 1) && ((i + leftrep - result.pos[i]) < Leading); + hit = hit && ((i + leftrep - result.pos[i]) >= (minLead-1) ); + hit = hit && ((result.n - i - 1 + sal::static_int_cast< sal_sSize >(strlen(result.rep[i])) - leftrep - 1) >= minTrail); } if (hit) { @@ -577,10 +611,10 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo } nHyphenationPos = i; - if (rep && rep[i]) + if (result.rep && result.rep[i]) { - nHyphenationPosAlt = i - pos[i]; - nHyphenationPosAltHyph = i + leftrep - pos[i]; + nHyphenationPosAlt = i - result.pos[i]; + nHyphenationPosAltHyph = i + leftrep - result.pos[i]; } } } @@ -588,17 +622,17 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo Reference xRes; if (nHyphenationPos != -1) { - if (rep && rep[nHyphenationPos]) + if (result.rep && result.rep[nHyphenationPos]) { // remove equal sign - char * s = rep[nHyphenationPos]; + char * s = result.rep[nHyphenationPos]; int eq = 0; for (; *s; s++) { if (*s == '=') eq = 1; if (eq) *s = *(s + 1); } - OUString repHyphlow(rep[nHyphenationPos], strlen(rep[nHyphenationPos]), eEnc); + OUString repHyphlow(result.rep[nHyphenationPos], strlen(result.rep[nHyphenationPos]), eEnc); OUString repHyph; switch (ct) { @@ -627,7 +661,7 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo nHyphenationPosAltHyph : nHyphenationPos); // discretionary hyphenation xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LinguLocaleToLanguage( aLocale ), nPos, - aWord.replaceAt(nHyphenationPosAlt + 1, cut[nHyphenationPos], repHyph), + aWord.replaceAt(nHyphenationPosAlt + 1, result.cut[nHyphenationPos], repHyph), static_cast(nHyphenationPosAltHyph)); } else @@ -636,17 +670,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo static_cast(nHyphenationPos), aWord, static_cast(nHyphenationPos)); } } - - if (rep) - { - for(int j = 0; j < n; j++) - { - if (rep[j]) free(rep[j]); - } - free(rep); - } - if (pos) free(pos); - if (cut) free(cut); return xRes; } return nullptr; @@ -690,78 +713,16 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const if (auto pHDInfo = getMatchingDict(aLocale)) { // hyphenate the word with that dictionary - HyphenDict* dict = pHDInfo->aPtr; - rtl_TextEncoding eEnc = pHDInfo->eEnc; - CharClass* pCC = pHDInfo->apCC.get(); - - // first handle smart quotes both single and double - OUStringBuffer rBuf(aWord); - sal_Int32 nc = rBuf.getLength(); - sal_Unicode ch; - for (sal_Int32 ix=0; ix < nc; ix++) - { - ch = rBuf[ix]; - if ((ch == 0x201C) || (ch == 0x201D)) - rBuf[ix] = u'"'; - if ((ch == 0x2018) || (ch == 0x2019)) - rBuf[ix] = u'\''; - } - OUString nWord(rBuf.makeStringAndClear()); - - // now convert word to all lowercase for pattern recognition - OUString nTerm(makeLowerCase(nWord, pCC)); - - // now convert word to needed encoding - OString encWord(OU2ENC(nTerm,eEnc)); - - sal_Int32 wordlen = encWord.getLength(); - std::unique_ptr lcword(new char[wordlen+1]); - std::unique_ptr hyphens(new char[wordlen+5]); - char ** rep = nullptr; // replacements of discretionary hyphenation - int * pos = nullptr; // array of [hyphenation point] minus [deletion position] - int * cut = nullptr; // length of deletions in original word - - // copy converted word into simple char buffer - strcpy(lcword.get(),encWord.getStr()); - - // first remove any trailing periods - sal_Int32 n = wordlen-1; - while((n >=0) && (lcword[n] == '.')) - n--; - n++; - if (n > 0) - { - const bool bFailed = 0 != hnj_hyphen_hyphenate3(dict, lcword.get(), n, hyphens.get(), nullptr, - &rep, &pos, &cut, minLead, minTrail, - std::max(dict->clhmin, std::max(dict->clhmin, 2) + std::max(0, minLead - std::max(dict->lhmin, 2))), - std::max(dict->crhmin, std::max(dict->crhmin, 2) + std::max(0, minTrail - std::max(dict->rhmin, 2))) ); - if (bFailed) - { - if (rep) - { - for(int j = 0; j < n; j++) - { - if (rep[j]) free(rep[j]); - } - free(rep); - } - if (pos) free(pos); - if (cut) free(cut); - - return nullptr; - } - } - // now backfill hyphens[] for any removed periods - for (sal_Int32 c = n; c < wordlen; c++) - hyphens[c] = '0'; - hyphens[wordlen] = '\0'; + auto result = getHyphens(aWord, *pHDInfo, minLead, minTrail); + if (result.failed) + return nullptr; sal_Int32 nHyphCount = 0; // FIXME: shouldn't we iterate code points instead? - for (sal_Int32 i = 0; i < nWord.getLength(); i++) + for (sal_Int32 i = 0; i < aWord.getLength(); i++) { - if (hyphens[i]&1) + if (result.hyphens[i] & 1) nHyphCount++; } @@ -770,11 +731,11 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const OUStringBuffer hyphenatedWordBuffer; nHyphCount = 0; - for (sal_Int32 i = 0; i < nWord.getLength(); i++) + for (sal_Int32 i = 0; i < aWord.getLength(); i++) { hyphenatedWordBuffer.append(aWord[i]); // hyphenation position - if (hyphens[i]&1) + if (result.hyphens[i] & 1) { // linguistic::PossibleHyphens is stuck with // css::uno::Sequence because of @@ -797,54 +758,13 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const OUString hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear(); - Reference< XPossibleHyphens > xRes = PossibleHyphens::CreatePossibleHyphens( + return PossibleHyphens::CreatePossibleHyphens( aWord, LinguLocaleToLanguage( aLocale ), hyphenatedWord, aHyphPos); - - if (rep) - { - for(int j = 0; j < n; j++) - { - if (rep[j]) free(rep[j]); - } - free(rep); - } - if (pos) free(pos); - if (cut) free(cut); - - return xRes; } return nullptr; } -OUString Hyphenator::makeLowerCase(const OUString& aTerm, CharClass const * pCC) -{ - if (pCC) - return pCC->lowercase(aTerm); - return aTerm; -} - -OUString Hyphenator::makeUpperCase(const OUString& aTerm, CharClass const * pCC) -{ - if (pCC) - return pCC->uppercase(aTerm); - return aTerm; -} - -OUString Hyphenator::makeInitCap(const OUString& aTerm, CharClass const * pCC) -{ - sal_Int32 tlen = aTerm.getLength(); - if (pCC && tlen) - { - OUString bTemp = aTerm.copy(0,1); - if (tlen > 1) - return ( pCC->uppercase(bTemp, 0, 1) + pCC->lowercase(aTerm,1,(tlen-1)) ); - - return pCC->uppercase(bTemp, 0, 1); - } - return aTerm; -} - sal_Bool SAL_CALL Hyphenator::addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) { diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx index c66650891e6b..f36c24afd2be 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx @@ -116,10 +116,6 @@ public: virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override; private: - static OUString makeLowerCase(const OUString&, CharClass const *); - static OUString makeUpperCase(const OUString&, CharClass const *); - static OUString makeInitCap(const OUString&, CharClass const *); - void ensureLocales(); const HDInfo* getMatchingDict(const css::lang::Locale& aLocale); }; From 190ccb653955fa1d23e7c0d3bf5e47769a73ba30 Mon Sep 17 00:00:00 2001 From: Laurent Balland Date: Fri, 1 Nov 2024 18:27:51 +0100 Subject: [PATCH 194/373] tdf#161930 Copy only once mimetype mimetype must not be zipped, just stored. mimetype was correctly stored with the first zip command, but mimetype was also present in the files list on the second zip command. This patch remove mimetype from the files list of the second zip command. Change-Id: Ie66f06103bbad2700eee4986df878b9ebd4c0a09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175930 Tested-by: Jenkins Reviewed-by: Laurent Balland --- extras/CustomTarget_templates.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/CustomTarget_templates.mk b/extras/CustomTarget_templates.mk index 9754985f1a59..a0661e96b356 100644 --- a/extras/CustomTarget_templates.mk +++ b/extras/CustomTarget_templates.mk @@ -17,7 +17,7 @@ $(call gb_Trace_StartRange,$(subst $(gb_CustomTarget_workdir)/extras/source/,,$@ cd $(dir $<) && \ $(call gb_Helper_wsl_path,\ $(WSL) zip -q0X --filesync --must-match $@ mimetype && \ -$(WSL) zip -qrX --must-match $@ $(subst $(dir $<),,$^)) +$(WSL) zip -qrX --must-match $@ $(subst $(dir $<),,$^)) -x mimetype $(call gb_Trace_EndRange,$(subst $(gb_CustomTarget_workdir)/extras/source/,,$@),ZIP) endef From 6272747e0668e98c818c1830ae6d25186e6e649d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 12 Nov 2024 12:34:38 +0000 Subject: [PATCH 195/373] cid#1607832 Overflowed constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie0d14ef985bebf4acdb08c460675ebba75f88a8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177166 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- oox/source/vml/vmlformatting.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 3eefc8abd090..fa8dd5dc47f7 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -957,7 +957,7 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper& ? nOffsetY < 0 ? table::ShadowLocation_TOP_LEFT : table::ShadowLocation_BOTTOM_LEFT : nOffsetY < 0 ? table::ShadowLocation_TOP_RIGHT : table::ShadowLocation_BOTTOM_RIGHT; // The width of the shadow is the average of the x and y values, see SwWW8ImplReader::MatchSdrItemsIntoFlySet(). - aFormat.ShadowWidth = ((std::abs(nOffsetX) + std::abs(nOffsetY)) / 2); + aFormat.ShadowWidth = std::min(o3tl::saturating_add(std::abs(nOffsetX), std::abs(nOffsetY)) / 2, SHRT_MAX); rPropMap.setProperty(PROP_ShadowFormat, aFormat); } From a18672dd3ef382436b0aa2449bded50c18e35705 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 23 Nov 2024 20:54:47 +0100 Subject: [PATCH 196/373] tdf#130857 Pass child type to WidgetBuilder::insertObject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In WidgetBuilder::handleChild, pass the child type not only to WidgetBuilder::tweakInsertedChild, but also to WidgetBuilder::handleObject (add a new param for that) and from there down into the virtual WidgetBuilder::insertObject, so it can be evaluated by subclasses when creating new widgets. While it is not used yet, an upcoming commit will make use of it in QtBuilder, in order to distinguish between the two "GtkExpander" children: the label and the actual content child. As described in the "GtkExpander as GtkBuildable" doc [1]: > The GtkExpander implementation of the GtkBuildable interface supports > placing a child in the label position by specifying “label” as the > “type” attribute of a element. A normal content child can be > specified without specifying a type attribute. [1] https://docs.gtk.org/gtk3/class.Expander.html Change-Id: I3e308a6642d72b55d0ccc597dac716b236c22d61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177191 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/builder.hxx | 2 +- include/vcl/widgetbuilder.hxx | 19 ++++++++++--------- vcl/inc/qt5/QtBuilder.hxx | 6 +++--- vcl/qt5/QtBuilder.cxx | 4 ++-- vcl/source/window/builder.cxx | 5 +++-- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 9f062448d97f..254b4e52d328 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -242,7 +242,7 @@ private: std::string_view sType, std::string_view sInternalChild) override; VclPtr insertObject(vcl::Window* pParent, const OUString& rClass, - const OUString& rID, stringmap& rProps, + std::string_view sType, const OUString& rID, stringmap& rProps, stringmap& rPangoAttributes, stringmap& rAtkProps) override; VclPtr makeObject(vcl::Window *pParent, diff --git a/include/vcl/widgetbuilder.hxx b/include/vcl/widgetbuilder.hxx index 8e8a729fb57a..22641cb5d552 100644 --- a/include/vcl/widgetbuilder.hxx +++ b/include/vcl/widgetbuilder.hxx @@ -124,8 +124,8 @@ protected: { if (name == "object" || name == "placeholder") { - pCurrentChild - = handleObject(pParent, pAtkProps, reader, sInternalChild, bToolbarItem); + pCurrentChild = handleObject(pParent, pAtkProps, reader, sType, sInternalChild, + bToolbarItem); bool bObjectInserted = pCurrentChild && pParent != pCurrentChild; if (bObjectInserted) @@ -161,7 +161,8 @@ protected: } WidgetPtr handleObject(Widget* pParent, stringmap* pAtkProps, xmlreader::XmlReader& reader, - std::string_view sInternalChild, bool bToolbarItem) + std::string_view sType, std::string_view sInternalChild, + bool bToolbarItem) { OUString sClass; OUString sID; @@ -226,7 +227,7 @@ protected: { if (!pCurrentChild) { - pCurrentChild = insertObject(pParent, sClass, sID, aProperties, + pCurrentChild = insertObject(pParent, sClass, sType, sID, aProperties, aPangoAttributes, aAtkAttributes); } handleChild(pCurrentChild, nullptr, reader, isToolbarItemClass(sClass)); @@ -281,8 +282,8 @@ protected: if (!pCurrentChild) { - pCurrentChild - = insertObject(pParent, sClass, sID, aProperties, aPangoAttributes, aAtkAttributes); + pCurrentChild = insertObject(pParent, sClass, sType, sID, aProperties, aPangoAttributes, + aAtkAttributes); } if (!aItems.empty()) @@ -535,9 +536,9 @@ protected: const std::vector& rItems) = 0; - virtual WidgetPtr insertObject(Widget* pParent, const OUString& rClass, const OUString& rID, - stringmap& rProps, stringmap& rPangoAttributes, - stringmap& rAtkProps) + virtual WidgetPtr insertObject(Widget* pParent, const OUString& rClass, std::string_view sType, + const OUString& rID, stringmap& rProps, + stringmap& rPangoAttributes, stringmap& rAtkProps) = 0; virtual void tweakInsertedChild(Widget* pParent, Widget* pCurrentChild, std::string_view sType, diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx index dd31c9999c42..7415b399eb57 100644 --- a/vcl/inc/qt5/QtBuilder.hxx +++ b/vcl/inc/qt5/QtBuilder.hxx @@ -61,9 +61,9 @@ public: virtual void insertComboBoxOrListBoxItems(QObject* pObject, stringmap& rMap, const std::vector& rItems) override; - virtual QObject* insertObject(QObject* pParent, const OUString& rClass, const OUString& rID, - stringmap& rProps, stringmap& rPangoAttributes, - stringmap& rAtkProps) override; + virtual QObject* insertObject(QObject* pParent, const OUString& rClass, std::string_view sType, + const OUString& rID, stringmap& rProps, + stringmap& rPangoAttributes, stringmap& rAtkProps) override; void tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std::string_view sType, std::string_view sInternalChild) override; diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index d73800d02d0d..36efe978551f 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -83,8 +83,8 @@ void QtBuilder::insertComboBoxOrListBoxItems(QObject* pObject, stringmap& rMap, assert(false && "list boxes are not supported yet"); } -QObject* QtBuilder::insertObject(QObject* pParent, const OUString& rClass, const OUString& rID, - stringmap& rProps, stringmap&, stringmap&) +QObject* QtBuilder::insertObject(QObject* pParent, const OUString& rClass, std::string_view, + const OUString& rID, stringmap& rProps, stringmap&, stringmap&) { QObject* pCurrentChild = nullptr; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 0a06c388fb67..e22ebf320e15 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2411,8 +2411,9 @@ namespace BuilderUtils } } -VclPtr VclBuilder::insertObject(vcl::Window *pParent, const OUString &rClass, - const OUString &rID, stringmap &rProps, stringmap &rPango, stringmap &rAtk) +VclPtr VclBuilder::insertObject(vcl::Window* pParent, const OUString& rClass, + std::string_view, const OUString& rID, + stringmap& rProps, stringmap& rPango, stringmap& rAtk) { VclPtr pCurrentChild; From 7738a109699044ab4c370e4794234402b27b7677 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 23 Nov 2024 23:46:36 +0100 Subject: [PATCH 197/373] tdf#130857 weld: Move Window::set_centered_on_parent to Dialog weld::Window::set_centered_on_parent only ever gets called for weld::Dialog instances, so move it to the weld::Dialog subclass. For the Qt implementation, no longer trigger an assert because of the method being unimplemented (doing nothing), as QDialog opens centered on its parent toplevel by default. Quoting from the QDialog doc [1]: > Note that QDialog (and any other widget that has type Qt::Dialog) uses > the parent widget slightly differently from other classes in Qt. A > dialog is always a top-level widget, but if it has a parent, its default > location is centered on top of the parent's top-level widget (if it is > not top-level itself). (API for moving a QWidget to a different position like QWidget::move [2] exists, but would only work on X11/XWayland, not Wayland.) [1] https://doc.qt.io/qt-6/qdialog.html#details [2] https://doc.qt.io/qt-6/qwidget.html#pos-prop Change-Id: I14d41f91e5297c6e58cb4edb2ee98f19814d45cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177192 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/weld.hxx | 25 ++++++++++++++----------- vcl/inc/qt5/QtInstanceDialog.hxx | 2 ++ vcl/inc/qt5/QtInstanceWindow.hxx | 1 - vcl/inc/salvtables.hxx | 4 ++-- vcl/qt5/QtInstanceDialog.cxx | 5 +++++ vcl/qt5/QtInstanceWindow.cxx | 2 -- vcl/source/app/salvtables.cxx | 24 ++++++++++++------------ vcl/unx/gtk3/gtkinst.cxx | 24 ++++++++++++------------ 8 files changed, 47 insertions(+), 40 deletions(-) diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index effe46665612..98495b7496ec 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -543,17 +543,7 @@ public: virtual Size get_size() const = 0; virtual Point get_position() const = 0; virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const = 0; - // center window on is parent - // - // bTrackGeometryRequests set to true tries to ensure the window will end - // up still centered on its parent windows final size, taking into account - // that there may currently be pending geometry requests for the parent not - // yet processed by the underlying toolkit - // - // for e.g gtk this will means the window is always centered even when - // resized, calling set_centered_on_parent with false will turn this - // off again. - virtual void set_centered_on_parent(bool bTrackGeometryRequests) = 0; + // returns whether the widget that has focus is within this Window // (its very possible to move this to weld::Container if that becomes // desirable) @@ -617,6 +607,19 @@ private: public: virtual void set_modal(bool bModal) = 0; virtual bool get_modal() const = 0; + + // center dialog on its parent + // + // bTrackGeometryRequests set to true tries to ensure the dialog will end + // up still centered on its parent windows final size, taking into account + // that there may currently be pending geometry requests for the parent not + // yet processed by the underlying toolkit + // + // for e.g gtk this will means the dialog is always centered even when + // resized, calling set_centered_on_parent with false will turn this + // off again. + virtual void set_centered_on_parent(bool bTrackGeometryRequests) = 0; + virtual int run() = 0; // Run async without a controller // @param self - must point to this, to enforce that the dialog was created/held by a shared_ptr diff --git a/vcl/inc/qt5/QtInstanceDialog.hxx b/vcl/inc/qt5/QtInstanceDialog.hxx index 5c8a6d0981ab..9395a9a1fe48 100644 --- a/vcl/inc/qt5/QtInstanceDialog.hxx +++ b/vcl/inc/qt5/QtInstanceDialog.hxx @@ -52,6 +52,8 @@ public: virtual bool get_modal() const override; + virtual void set_centered_on_parent(bool bTrackGeometryRequests) override; + virtual weld::Button* weld_widget_for_response(int) override; virtual void set_default_response(int) override; diff --git a/vcl/inc/qt5/QtInstanceWindow.hxx b/vcl/inc/qt5/QtInstanceWindow.hxx index 9b73b39694d7..b92b830c7b9b 100644 --- a/vcl/inc/qt5/QtInstanceWindow.hxx +++ b/vcl/inc/qt5/QtInstanceWindow.hxx @@ -25,7 +25,6 @@ public: virtual Size get_size() const override; virtual Point get_position() const override; virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const override; - virtual void set_centered_on_parent(bool) override; virtual bool has_toplevel_focus() const override; virtual void present() override; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 196be2c4193a..3af166383832 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -483,8 +483,6 @@ public: virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const override; - virtual void set_centered_on_parent(bool /*bTrackGeometryRequests*/) override; - virtual bool get_resizable() const override; virtual bool has_toplevel_focus() const override; @@ -551,6 +549,8 @@ public: virtual bool get_modal() const override; + virtual void set_centered_on_parent(bool /*bTrackGeometryRequests*/) override; + virtual weld::Button* weld_widget_for_response(int nResponse) override; virtual void set_default_response(int nResponse) override; diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx index c1be1db313c0..61de5aa8b153 100644 --- a/vcl/qt5/QtInstanceDialog.cxx +++ b/vcl/qt5/QtInstanceDialog.cxx @@ -139,6 +139,11 @@ bool QtInstanceDialog::get_modal() const return m_pDialog->isModal(); } +void QtInstanceDialog::set_centered_on_parent(bool) +{ + // QDialog is centered on parent toplevel by default +} + weld::Button* QtInstanceDialog::weld_widget_for_response(int) { assert(false && "Not implemented yet"); diff --git a/vcl/qt5/QtInstanceWindow.cxx b/vcl/qt5/QtInstanceWindow.cxx index 8cc9573a6be5..262fe299a0c9 100644 --- a/vcl/qt5/QtInstanceWindow.cxx +++ b/vcl/qt5/QtInstanceWindow.cxx @@ -80,8 +80,6 @@ AbsoluteScreenPixelRectangle QtInstanceWindow::get_monitor_workarea() const return AbsoluteScreenPixelRectangle(); } -void QtInstanceWindow::set_centered_on_parent(bool) { assert(false && "Not implemented yet"); } - bool QtInstanceWindow::has_toplevel_focus() const { SolarMutexGuard g; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 77d856b60a66..bf562ce7c687 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1627,18 +1627,6 @@ AbsoluteScreenPixelRectangle SalInstanceWindow::get_monitor_workarea() const return m_xWindow->GetDesktopRectPixel(); } -void SalInstanceWindow::set_centered_on_parent(bool /*bTrackGeometryRequests*/) -{ - if (vcl::Window* pParent = m_xWidget->GetParent()) - { - Size aParentGeometry(pParent->GetSizePixel()); - Size aGeometry(m_xWidget->get_preferred_size()); - auto nX = (aParentGeometry.Width() - aGeometry.Width()) / 2; - auto nY = (aParentGeometry.Height() - aGeometry.Height()) / 2; - m_xWidget->SetPosPixel(Point(nX, nY)); - } -} - bool SalInstanceWindow::get_resizable() const { return m_xWindow->GetStyle() & WB_SIZEABLE; } bool SalInstanceWindow::has_toplevel_focus() const { return m_xWindow->HasChildPathFocus(); } @@ -1936,6 +1924,18 @@ void SalInstanceDialog::set_modal(bool bModal) bool SalInstanceDialog::get_modal() const { return m_xDialog->IsModalInputMode(); } +void SalInstanceDialog::set_centered_on_parent(bool /*bTrackGeometryRequests*/) +{ + if (vcl::Window* pParent = m_xWidget->GetParent()) + { + Size aParentGeometry(pParent->GetSizePixel()); + Size aGeometry(m_xWidget->get_preferred_size()); + auto nX = (aParentGeometry.Width() - aGeometry.Width()) / 2; + auto nY = (aParentGeometry.Height() - aGeometry.Height()) / 2; + m_xWidget->SetPosPixel(Point(nX, nY)); + } +} + void SalInstanceDialog::set_default_response(int nResponse) { m_xDialog->set_default_response(nResponse); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index f7c220273417..91a12bc3b9bf 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -6421,18 +6421,6 @@ public: return ::get_monitor_workarea(GTK_WIDGET(m_pWindow)); } - virtual void set_centered_on_parent(bool bTrackGeometryRequests) override - { -#if !GTK_CHECK_VERSION(4, 0, 0) - if (bTrackGeometryRequests) - gtk_window_set_position(m_pWindow, GTK_WIN_POS_CENTER_ALWAYS); - else - gtk_window_set_position(m_pWindow, GTK_WIN_POS_CENTER_ON_PARENT); -#else - (void)bTrackGeometryRequests; -#endif - } - virtual bool get_resizable() const override { return gtk_window_get_resizable(m_pWindow); @@ -7163,6 +7151,18 @@ public: return gtk_window_get_modal(m_pDialog); } + virtual void set_centered_on_parent(bool bTrackGeometryRequests) override + { +#if !GTK_CHECK_VERSION(4, 0, 0) + if (bTrackGeometryRequests) + gtk_window_set_position(m_pDialog, GTK_WIN_POS_CENTER_ALWAYS); + else + gtk_window_set_position(m_pDialog, GTK_WIN_POS_CENTER_ON_PARENT); +#else + (void)bTrackGeometryRequests; +#endif + } + virtual void response(int nResponse) override; virtual void add_button(const OUString& rText, int nResponse, const OUString& rHelpId) override From 9ca43e71e294f778db1cd4febcfc232f2935a0b4 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 24 Nov 2024 00:07:44 +0100 Subject: [PATCH 198/373] tdf#130857 qt weld: Implement "GtkExpander" equivalent Implement support for "GtkExpander" objects in .ui files. As Qt doesn't seem to have any equivalent, add a new QtExpander class that subclasses QWidget and has a button that can be used to toggle visibility of the widget that is the GtkExpander's [1] content child. For a visual appearance similar to GtkExpander, set an icon for the button ("go-down" and "go-next" from the icon theme, which are arrows like the ones shown on a GtkExpander, at least with the Breeze icon theme). In QtBuilder, implement handling for "GtkExpander" objects: * Create an instance of the new QtExpander class. * Identify the content child, which can be distinguished from the label child by the fact that the latter has a "label" child type set, see also previous commit Change-Id: I3e308a6642d72b55d0ccc597dac716b236c22d61 Author: Michael Weghorn Date: Sat Nov 23 20:54:47 2024 +0100 tdf#130857 Pass child type to WidgetBuilder::insertObject * Erase the "visible" property for the content child, as otherwise the content widget would be initially visible even if the expander is set to not be expanded. (QtExpander takes care of this, so ignore the property set in the .ui file.) * For the label child in GtkExpander, simply take over its text to QtExpander's button, then mark the label for deletion, as it's not needed otherwise. Support for the "Document in Use" dialog that has a GtkExpander and thuse makes use of this will be declared in a separate commit. [1] https://docs.gtk.org/gtk3/class.Expander.html Change-Id: Id2366834cb542eba613ea087e70f3a812d20fa89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177193 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/CustomTarget_qt5_moc.mk | 1 + vcl/CustomTarget_qt6_moc.mk | 1 + vcl/Library_vclplug_qt5.mk | 1 + vcl/Library_vclplug_qt6.mk | 1 + vcl/inc/qt5/QtBuilder.hxx | 4 +-- vcl/inc/qt5/QtExpander.hxx | 37 +++++++++++++++++++++++ vcl/inc/qt6/QtExpander.hxx | 12 ++++++++ vcl/qt5/QtBuilder.cxx | 32 +++++++++++++++++--- vcl/qt5/QtExpander.cxx | 60 +++++++++++++++++++++++++++++++++++++ vcl/qt6/QtExpander.cxx | 12 ++++++++ 10 files changed, 155 insertions(+), 6 deletions(-) create mode 100644 vcl/inc/qt5/QtExpander.hxx create mode 100644 vcl/inc/qt6/QtExpander.hxx create mode 100644 vcl/qt5/QtExpander.cxx create mode 100644 vcl/qt6/QtExpander.cxx diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk index a819d4008307..184787590282 100644 --- a/vcl/CustomTarget_qt5_moc.mk +++ b/vcl/CustomTarget_qt5_moc.mk @@ -11,6 +11,7 @@ $(eval $(call gb_CustomTarget_CustomTarget,vcl/qt5)) $(call gb_CustomTarget_get_target,vcl/qt5) : \ $(gb_CustomTarget_workdir)/vcl/qt5/QtClipboard.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtExpander.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtFilePicker.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtFrame.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstance.moc \ diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk index cb53e819835e..1ca3042eddc5 100644 --- a/vcl/CustomTarget_qt6_moc.mk +++ b/vcl/CustomTarget_qt6_moc.mk @@ -11,6 +11,7 @@ $(eval $(call gb_CustomTarget_CustomTarget,vcl/qt6)) $(call gb_CustomTarget_get_target,vcl/qt6) : \ $(gb_CustomTarget_workdir)/vcl/qt6/QtClipboard.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtExpander.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtFilePicker.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtFrame.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstance.moc \ diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk index 29dd1de6fba9..46d5eba4266a 100644 --- a/vcl/Library_vclplug_qt5.mk +++ b/vcl/Library_vclplug_qt5.mk @@ -85,6 +85,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ vcl/qt5/QtCustomStyle \ vcl/qt5/QtData \ vcl/qt5/QtDragAndDrop \ + vcl/qt5/QtExpander \ vcl/qt5/QtFilePicker \ vcl/qt5/QtFont \ vcl/qt5/QtFontFace \ diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk index a1c28756220b..9a01ca63f7f6 100644 --- a/vcl/Library_vclplug_qt6.mk +++ b/vcl/Library_vclplug_qt6.mk @@ -84,6 +84,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\ vcl/qt6/QtCustomStyle \ vcl/qt6/QtData \ vcl/qt6/QtDragAndDrop \ + vcl/qt6/QtExpander \ vcl/qt6/QtFilePicker \ vcl/qt6/QtFont \ vcl/qt6/QtFontFace \ diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx index 7415b399eb57..a69158e10a8f 100644 --- a/vcl/inc/qt5/QtBuilder.hxx +++ b/vcl/inc/qt5/QtBuilder.hxx @@ -47,8 +47,8 @@ public: template T* get(std::u16string_view sID); - QObject* makeObject(QObject* pParent, std::u16string_view sName, const OUString& sID, - stringmap& rMap); + QObject* makeObject(QObject* pParent, std::u16string_view sName, std::string_view sType, + const OUString& sID, stringmap& rMap); virtual void applyAtkProperties(QObject* pObject, const stringmap& rProperties, bool bToolbarItem) override; diff --git a/vcl/inc/qt5/QtExpander.hxx b/vcl/inc/qt5/QtExpander.hxx new file mode 100644 index 000000000000..135841c039f7 --- /dev/null +++ b/vcl/inc/qt5/QtExpander.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include +#include + +class QtExpander : public QWidget +{ + Q_OBJECT + + QPushButton* m_pButton; + QGridLayout* m_pLayout; + QWidget* m_pContentWidget; + bool m_bExpanded; + +public: + QtExpander(QWidget* pParent); + void setContentWidget(QWidget* pWidget); + void setText(const QString& rText); + +private: + void update(); + +private Q_SLOTS: + void handleButtonClick(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/qt6/QtExpander.hxx b/vcl/inc/qt6/QtExpander.hxx new file mode 100644 index 000000000000..25c0ac365af9 --- /dev/null +++ b/vcl/inc/qt6/QtExpander.hxx @@ -0,0 +1,12 @@ +/* -*- 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/. + */ + +#include "../qt5/QtExpander.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 36efe978551f..2c2d954b30c7 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -9,6 +9,7 @@ #include +#include #include #include #include @@ -83,12 +84,12 @@ void QtBuilder::insertComboBoxOrListBoxItems(QObject* pObject, stringmap& rMap, assert(false && "list boxes are not supported yet"); } -QObject* QtBuilder::insertObject(QObject* pParent, const OUString& rClass, std::string_view, +QObject* QtBuilder::insertObject(QObject* pParent, const OUString& rClass, std::string_view sType, const OUString& rID, stringmap& rProps, stringmap&, stringmap&) { QObject* pCurrentChild = nullptr; - pCurrentChild = makeObject(pParent, rClass, rID, rProps); + pCurrentChild = makeObject(pParent, rClass, sType, rID, rProps); setProperties(pCurrentChild, rProps); @@ -97,8 +98,8 @@ QObject* QtBuilder::insertObject(QObject* pParent, const OUString& rClass, std:: return pCurrentChild; } -QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, const OUString& sID, - stringmap& rMap) +QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, std::string_view sType, + const OUString& sID, stringmap& rMap) { // ignore placeholders if (sName.empty()) @@ -202,6 +203,10 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons pObject = pLineEdit; } + else if (sName == u"GtkExpander") + { + pObject = new QtExpander(pParentWidget); + } else if (sName == u"GtkFrame") { pObject = new QGroupBox(pParentWidget); @@ -301,6 +306,16 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons // unset pParentWidget to not create a layout below pParentWidget = nullptr; } + else if (QtExpander* pExpander = qobject_cast(pParentWidget)) + { + // set the content (not the label) child as the expander's widget + if (sType != "label") + { + pExpander->setContentWidget(pWidget); + // erase "visible" property, QtExpander shows/hides the widget as needed + rMap.erase("visible"); + } + } if (pWidget) { @@ -364,6 +379,15 @@ void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std pGroupBox->setTitle(pLabel->text()); deleteObject(pLabel); } + else if (QtExpander* pExpander = qobject_cast(pParent)) + { + // GtkExpander has a `child-type="label"` child for the expander label + // in the GtkBuilder .ui file, s. https://docs.gtk.org/gtk3/class.Expander.html + // For QtExpander, the (button) text can be set directly. Therefore, take over + // text from the label and delete the separate label widget again + pExpander->setText(pLabel->text()); + deleteObject(pLabel); + } } } diff --git a/vcl/qt5/QtExpander.cxx b/vcl/qt5/QtExpander.cxx new file mode 100644 index 000000000000..b7e9b499f285 --- /dev/null +++ b/vcl/qt5/QtExpander.cxx @@ -0,0 +1,60 @@ +/* -*- 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/. + */ + +#include +#include + +QtExpander::QtExpander(QWidget* pParent) + : QWidget(pParent) + , m_pContentWidget(nullptr) + , m_bExpanded(false) +{ + m_pLayout = new QGridLayout; + setLayout(m_pLayout); + + m_pButton = new QPushButton; + m_pButton->setFlat(true); + m_pButton->setSizePolicy(QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Maximum); + m_pLayout->addWidget(m_pButton, 0, 0); + m_pLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Policy::MinimumExpanding, + QSizePolicy::Policy::MinimumExpanding), + 0, 1); + + update(); + + connect(m_pButton, &QAbstractButton::clicked, this, &QtExpander::handleButtonClick); +} + +void QtExpander::setContentWidget(QWidget* pWidget) +{ + assert(pWidget); + m_pContentWidget = pWidget; + m_pLayout->addWidget(m_pContentWidget, 1, 0, 1, 2); + update(); +} + +void QtExpander::setText(const QString& rText) { m_pButton->setText(rText); } + +void QtExpander::update() +{ + const QString sIcon = m_bExpanded ? "go-down" : "go-next"; + m_pButton->setIcon(QIcon::fromTheme(sIcon)); + + if (m_pContentWidget) + m_pContentWidget->setVisible(m_bExpanded); +} + +void QtExpander::handleButtonClick() +{ + // toggle + m_bExpanded = !m_bExpanded; + update(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt6/QtExpander.cxx b/vcl/qt6/QtExpander.cxx new file mode 100644 index 000000000000..9978011ff290 --- /dev/null +++ b/vcl/qt6/QtExpander.cxx @@ -0,0 +1,12 @@ +/* -*- 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/. + */ + +#include "../qt5/QtExpander.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ From a0ca2e68177322539f554cd18eea5b7ca36ae155 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 24 Nov 2024 00:22:26 +0100 Subject: [PATCH 199/373] tdf#130857 qt weld: Support "Document in Use" dialog Declare support for the dialog shown when trying to open a file that's already opened by another user (or more exactly, for which a lock file suggesting that it's opened by another user or LO instance exists). This means that native Qt widgets are used for that dialog now when using the qt5 or qt6 VCL plugin and starting LO with environment variable SAL_VCL_QT_USE_WELDED_WIDGETS=1 set. This is the first supported dialog making use of "GtkNotebook"/ QtInstanceNotebook, i.e. of what was implemented in previous commit Sample steps to see that dialog: * start Writer, save document as /tmp/test.odt * kill LibreOffice * open the lock file ( /tmp/.~lock.test.odt# ) in a text editor and change the user name to a dummy one, save. * start LO with qt6 VCL plugin and try to open the document Change-Id: If30736e70172c6b25feee0072c952274754aa81e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177194 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/qt5/QtInstanceBuilder.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 33838a2151f6..1cfb2349f431 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -71,6 +71,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile) u"sfx/ui/safemodequerydialog.ui"_ustr, u"svt/ui/printersetupdialog.ui"_ustr, u"svt/ui/restartdialog.ui"_ustr, + u"vcl/ui/openlockedquerybox.ui"_ustr, u"vcl/ui/printprogressdialog.ui"_ustr, u"writerperfect/ui/exportepub.ui"_ustr, }; From 62595170ec26af556cd5d2ab3501d9e12ff28d49 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 24 Nov 2024 00:35:30 +0100 Subject: [PATCH 200/373] tdf#130857 openlockedquerybox.ui: Define grid children in order Switch the order in which the children of the grid in the .ui file are defined so that the order matches the visual appearance, which makes sure that tab focus order with the Qt-based VCL plugins is correct as well in that dialog when using native Qt widgets after support for that dialog was added in Change-Id: If30736e70172c6b25feee0072c952274754aa81e Author: Michael Weghorn Date: Sun Nov 24 00:22:26 2024 +0100 tdf#130857 qt weld: Support "Document in Use" dialog See commit 02692566ad9fc7c3484f8581ffa0004cd4e43987 Author: Michael Weghorn Date: Thu Oct 24 17:43:35 2024 +0200 tdf#130857 optnewdictionarydialog.ui: Define focusable widgets in order for more background. Change-Id: Ie18c7b91911fea612167510e9bb098d63e1e9227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177195 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/uiconfig/ui/openlockedquerybox.ui | 134 +++++++++++++------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/vcl/uiconfig/ui/openlockedquerybox.ui b/vcl/uiconfig/ui/openlockedquerybox.ui index 680698d2ecef..0b3942112b6d 100644 --- a/vcl/uiconfig/ui/openlockedquerybox.ui +++ b/vcl/uiconfig/ui/openlockedquerybox.ui @@ -133,73 +133,6 @@ receive a notification if ready. 1 - - - True - False - You can open a copy on your -local system. - 0 - - - static - - - - - 0 - 2 - - - - - True - True - True - - - True - False - 10 - 0 - - - static - - - - - - - True - False - _More Details - True - - - - - - - - 0 - 3 - 2 - - - - - Open Co_py - True - True - True - True - - - 1 - 2 - - True @@ -241,6 +174,73 @@ local system. 1 + + + True + False + You can open a copy on your +local system. + 0 + + + static + + + + + 0 + 2 + + + + + Open Co_py + True + True + True + True + + + 1 + 2 + + + + + True + True + True + + + True + False + 10 + 0 + + + static + + + + + + + True + False + _More Details + True + + + + + + + + 0 + 3 + 2 + + True From a60ccb091ed26e5287d29ea1df885bf144c74b3f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 24 Nov 2024 00:50:39 +0100 Subject: [PATCH 201/373] tdf#130857 qt weld: Support "Safe Mode" dialog Now that "GtkExpander" support has been implemented, declare support for the "Safe Mode" dialog that can be triggered via "Help" -> "Restart in Safe Mode" and confirming with "Restart". This means that native Qt widgets are used for that dialog now when using the qt5 or qt6 VCL plugin and starting LO with environment variable SAL_VCL_QT_USE_WELDED_WIDGETS=1 set. Change-Id: I67ef04356a5147c24442cd3ec84e4bbc644b3a71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177196 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/qt5/QtInstanceBuilder.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 1cfb2349f431..8971fbcda96e 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -71,6 +71,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile) u"sfx/ui/safemodequerydialog.ui"_ustr, u"svt/ui/printersetupdialog.ui"_ustr, u"svt/ui/restartdialog.ui"_ustr, + u"svx/ui/safemodedialog.ui"_ustr, u"vcl/ui/openlockedquerybox.ui"_ustr, u"vcl/ui/printprogressdialog.ui"_ustr, u"writerperfect/ui/exportepub.ui"_ustr, From ec760b211087b90f9cddec96d1e097bf68ad3e1f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 24 Nov 2024 01:20:31 +0100 Subject: [PATCH 202/373] tdf#130857 qt weld: Add QtInstanceExpander Add a new QtInstanceExpander class that is the weld::Expander implementation using a native Qt widget. It uses the custom QtExpander widget added in Change-Id: Id2366834cb542eba613ea087e70f3a812d20fa89 Author: Michael Weghorn Date: Sun Nov 24 00:07:44 2024 +0100 tdf#130857 qt weld: Implement "GtkExpander" equivalent Extend QtExpander to provide what's needed to implement the QtInstanceExpander methods. Let QtInstanceBuilder::weld_expander return an instance of the new class. Signal handling still needs to be implemented (calling `weld::Expander::signal_expanded` when the expanded state is toggled). QtInstanceExpander is e.g. needed by the "Set Password" dialog. ("File" -> "Save As", check "Save with password" checkbox and press "Save" to trigger the dialog.) Change-Id: I7e3a332c0417b1897ae57d7d4c29609245fb5e19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177197 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/CustomTarget_qt5_moc.mk | 1 + vcl/CustomTarget_qt6_moc.mk | 1 + vcl/Library_vclplug_qt5.mk | 1 + vcl/Library_vclplug_qt6.mk | 1 + vcl/inc/qt5/QtExpander.hxx | 5 +++ vcl/inc/qt5/QtInstanceBuilder.hxx | 2 +- vcl/inc/qt5/QtInstanceExpander.hxx | 30 ++++++++++++++++++ vcl/inc/qt6/QtInstanceExpander.hxx | 12 +++++++ vcl/qt5/QtExpander.cxx | 13 ++++++-- vcl/qt5/QtInstanceBuilder.cxx | 9 ++++-- vcl/qt5/QtInstanceExpander.cxx | 50 ++++++++++++++++++++++++++++++ vcl/qt6/QtInstanceExpander.cxx | 12 +++++++ 12 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 vcl/inc/qt5/QtInstanceExpander.hxx create mode 100644 vcl/inc/qt6/QtInstanceExpander.hxx create mode 100644 vcl/qt5/QtInstanceExpander.cxx create mode 100644 vcl/qt6/QtInstanceExpander.cxx diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk index 184787590282..48dea66e2136 100644 --- a/vcl/CustomTarget_qt5_moc.mk +++ b/vcl/CustomTarget_qt5_moc.mk @@ -21,6 +21,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDialog.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDrawingArea.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceEntry.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceExpander.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLevelBar.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLinkButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceMessageDialog.moc \ diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk index 1ca3042eddc5..8c72cb8b70fe 100644 --- a/vcl/CustomTarget_qt6_moc.mk +++ b/vcl/CustomTarget_qt6_moc.mk @@ -21,6 +21,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDialog.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDrawingArea.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceEntry.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceExpander.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLevelBar.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLinkButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceMessageDialog.moc \ diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk index 46d5eba4266a..664f4153ebc1 100644 --- a/vcl/Library_vclplug_qt5.mk +++ b/vcl/Library_vclplug_qt5.mk @@ -106,6 +106,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ vcl/qt5/QtInstanceDialog \ vcl/qt5/QtInstanceDrawingArea \ vcl/qt5/QtInstanceEntry \ + vcl/qt5/QtInstanceExpander \ vcl/qt5/QtInstanceFrame \ vcl/qt5/QtInstanceImage \ vcl/qt5/QtInstanceLabel \ diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk index 9a01ca63f7f6..da06490af0e9 100644 --- a/vcl/Library_vclplug_qt6.mk +++ b/vcl/Library_vclplug_qt6.mk @@ -105,6 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\ vcl/qt6/QtInstanceDialog \ vcl/qt6/QtInstanceDrawingArea \ vcl/qt6/QtInstanceEntry \ + vcl/qt6/QtInstanceExpander \ vcl/qt6/QtInstanceFrame \ vcl/qt6/QtInstanceImage \ vcl/qt6/QtInstanceLabel \ diff --git a/vcl/inc/qt5/QtExpander.hxx b/vcl/inc/qt5/QtExpander.hxx index 135841c039f7..394712a55a77 100644 --- a/vcl/inc/qt5/QtExpander.hxx +++ b/vcl/inc/qt5/QtExpander.hxx @@ -25,7 +25,12 @@ class QtExpander : public QWidget public: QtExpander(QWidget* pParent); void setContentWidget(QWidget* pWidget); + void setText(const QString& rText); + QString text() const; + + void setExpanded(bool bExpand); + bool isExpanded() const; private: void update(); diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx b/vcl/inc/qt5/QtInstanceBuilder.hxx index caf264735275..547d7aec1b8e 100644 --- a/vcl/inc/qt5/QtInstanceBuilder.hxx +++ b/vcl/inc/qt5/QtInstanceBuilder.hxx @@ -68,7 +68,7 @@ public: virtual std::unique_ptr weld_icon_view(const OUString&) override; virtual std::unique_ptr weld_label(const OUString&) override; virtual std::unique_ptr weld_text_view(const OUString& rId) override; - virtual std::unique_ptr weld_expander(const OUString&) override; + virtual std::unique_ptr weld_expander(const OUString& rId) override; virtual std::unique_ptr weld_drawing_area(const OUString&, const a11yref& rA11yImpl = nullptr, FactoryFunction pUITestFactoryFunction = nullptr, diff --git a/vcl/inc/qt5/QtInstanceExpander.hxx b/vcl/inc/qt5/QtInstanceExpander.hxx new file mode 100644 index 000000000000..d596acb9ba94 --- /dev/null +++ b/vcl/inc/qt5/QtInstanceExpander.hxx @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "QtInstanceWidget.hxx" +#include "QtExpander.hxx" + +class QtInstanceExpander : public QObject, public QtInstanceWidget, public virtual weld::Expander +{ + Q_OBJECT + + QtExpander* m_pExpander; + +public: + QtInstanceExpander(QtExpander* pExpander); + + virtual void set_label(const OUString& rText); + virtual OUString get_label() const; + virtual bool get_expanded() const; + virtual void set_expanded(bool bExpand); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/qt6/QtInstanceExpander.hxx b/vcl/inc/qt6/QtInstanceExpander.hxx new file mode 100644 index 000000000000..1dd97000e6bd --- /dev/null +++ b/vcl/inc/qt6/QtInstanceExpander.hxx @@ -0,0 +1,12 @@ +/* -*- 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/. + */ + +#include "../qt5/QtInstanceExpander.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtExpander.cxx b/vcl/qt5/QtExpander.cxx index b7e9b499f285..433244999905 100644 --- a/vcl/qt5/QtExpander.cxx +++ b/vcl/qt5/QtExpander.cxx @@ -41,6 +41,16 @@ void QtExpander::setContentWidget(QWidget* pWidget) void QtExpander::setText(const QString& rText) { m_pButton->setText(rText); } +QString QtExpander::text() const { return m_pButton->text(); } + +void QtExpander::setExpanded(bool bExpand) +{ + m_bExpanded = bExpand; + update(); +} + +bool QtExpander::isExpanded() const { return m_bExpanded; } + void QtExpander::update() { const QString sIcon = m_bExpanded ? "go-down" : "go-next"; @@ -53,8 +63,7 @@ void QtExpander::update() void QtExpander::handleButtonClick() { // toggle - m_bExpanded = !m_bExpanded; - update(); + setExpanded(!isExpanded()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 8971fbcda96e..c0512b5929aa 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -329,10 +330,12 @@ std::unique_ptr QtInstanceBuilder::weld_text_view(const OUString return xRet; } -std::unique_ptr QtInstanceBuilder::weld_expander(const OUString&) +std::unique_ptr QtInstanceBuilder::weld_expander(const OUString& rId) { - assert(false && "Not implemented yet"); - return nullptr; + QtExpander* pExpander = m_xBuilder->get(rId); + std::unique_ptr xRet(pExpander ? std::make_unique(pExpander) + : nullptr); + return xRet; } std::unique_ptr diff --git a/vcl/qt5/QtInstanceExpander.cxx b/vcl/qt5/QtInstanceExpander.cxx new file mode 100644 index 000000000000..7594af8f0a26 --- /dev/null +++ b/vcl/qt5/QtInstanceExpander.cxx @@ -0,0 +1,50 @@ +/* -*- 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/. + */ + +#include +#include + +#include + +QtInstanceExpander::QtInstanceExpander(QtExpander* pExpander) + : QtInstanceWidget(pExpander) + , m_pExpander(pExpander) +{ + assert(m_pExpander); +} + +void QtInstanceExpander::set_label(const OUString& rText) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pExpander->setText(toQString(rText)); }); +} + +OUString QtInstanceExpander::get_label() const +{ + SolarMutexGuard g; + OUString sLabel; + GetQtInstance().RunInMainThread([&] { sLabel = toOUString(m_pExpander->text()); }); + return sLabel; +} + +bool QtInstanceExpander::get_expanded() const +{ + SolarMutexGuard g; + bool bExpanded = false; + GetQtInstance().RunInMainThread([&] { bExpanded = m_pExpander->isExpanded(); }); + return bExpanded; +} + +void QtInstanceExpander::set_expanded(bool bExpand) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pExpander->setExpanded(bExpand); }); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt6/QtInstanceExpander.cxx b/vcl/qt6/QtInstanceExpander.cxx new file mode 100644 index 000000000000..584bb0bc3fab --- /dev/null +++ b/vcl/qt6/QtInstanceExpander.cxx @@ -0,0 +1,12 @@ +/* -*- 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/. + */ + +#include "../qt5/QtInstanceExpander.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ From 5e4aa646356e1d59976e0f1adcfeb9353c65eda0 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 24 Nov 2024 01:36:29 +0100 Subject: [PATCH 203/373] tdf#130857 qt weld: Support "Save with password" dialog Declare support for the "Set Password" dialog that can be triggered in Writer using "File" -> "Save As", check "Save with password" checkbox and press "Save" to trigger the dialog. This means that native Qt widgets are used for that dialog now when using the qt5 or qt6 VCL plugin and starting LO with environment variable SAL_VCL_QT_USE_WELDED_WIDGETS=1 set. This makes use of QtInstanceExpander added in Change-Id: I7e3a332c0417b1897ae57d7d4c29609245fb5e19 Author: Michael Weghorn Date: Sun Nov 24 01:20:31 2024 +0100 tdf#130857 qt weld: Add QtInstanceExpander Currently, I see a small rendering issue when opening that dialog and expanding the expander: The "Enter password to allow editing" and "Confirm password" label text is a bit cropped. It's shown fine when manually enlarging the dialog a bit, however. Change-Id: I37775fa3a39d621696d2a6aaa49bd11d6cfb9350 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177198 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/qt5/QtInstanceBuilder.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index c0512b5929aa..d232e10b4893 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -51,6 +51,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile) u"cui/ui/aboutdialog.ui"_ustr, u"cui/ui/insertrowcolumn.ui"_ustr, u"cui/ui/optnewdictionarydialog.ui"_ustr, + u"cui/ui/password.ui"_ustr, u"cui/ui/querysetinsmodedialog.ui"_ustr, u"cui/ui/securityoptionsdialog.ui"_ustr, u"cui/ui/tipofthedaydialog.ui"_ustr, From 2f5acb35458d360c7db6b0f072204baf021ea84b Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 24 Nov 2024 02:13:32 +0100 Subject: [PATCH 204/373] tdf#130857 qt weld: Notify about Expander state change Call weld::Expander::signal_expanded when the QtExpander expanded state changes, e.g. when its button gets clicked. In order to do that, introduce a signal in QtExpander and connect to that in QtInstanceExpander. With this in place, a breakpoint in weld::Expander::signal_expanded now gets hit as expected when (un)expanding the expander in the "Set Password" dialog triggered in Writer using "File" -> "Save As", check "Save with password" checkbox and press "Save" when using the qt6 VCL plugin with SAL_VCL_QT_USE_WELDED_WIDGETS=1 set. This implements what was mentioned as still missing in earlier commit Change-Id: I7e3a332c0417b1897ae57d7d4c29609245fb5e19 Author: Michael Weghorn Date: Sun Nov 24 01:20:31 2024 +0100 tdf#130857 qt weld: Add QtInstanceExpander as > Signal handling still needs to be implemented > (calling `weld::Expander::signal_expanded` when > the expanded state is toggled). Change-Id: I9cd1b2cc99018f84ba930d55399953266119bed0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177199 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/inc/qt5/QtExpander.hxx | 3 +++ vcl/qt5/QtExpander.cxx | 5 +++++ vcl/qt5/QtInstanceExpander.cxx | 2 ++ 3 files changed, 10 insertions(+) diff --git a/vcl/inc/qt5/QtExpander.hxx b/vcl/inc/qt5/QtExpander.hxx index 394712a55a77..d9952c9f914d 100644 --- a/vcl/inc/qt5/QtExpander.hxx +++ b/vcl/inc/qt5/QtExpander.hxx @@ -32,6 +32,9 @@ public: void setExpanded(bool bExpand); bool isExpanded() const; +Q_SIGNALS: + void expandedChanged(bool bExpanded); + private: void update(); diff --git a/vcl/qt5/QtExpander.cxx b/vcl/qt5/QtExpander.cxx index 433244999905..1b690ecdc888 100644 --- a/vcl/qt5/QtExpander.cxx +++ b/vcl/qt5/QtExpander.cxx @@ -45,8 +45,13 @@ QString QtExpander::text() const { return m_pButton->text(); } void QtExpander::setExpanded(bool bExpand) { + if (m_bExpanded == bExpand) + return; + m_bExpanded = bExpand; update(); + + emit expandedChanged(isExpanded()); } bool QtExpander::isExpanded() const { return m_bExpanded; } diff --git a/vcl/qt5/QtInstanceExpander.cxx b/vcl/qt5/QtInstanceExpander.cxx index 7594af8f0a26..1c120105e690 100644 --- a/vcl/qt5/QtInstanceExpander.cxx +++ b/vcl/qt5/QtInstanceExpander.cxx @@ -17,6 +17,8 @@ QtInstanceExpander::QtInstanceExpander(QtExpander* pExpander) , m_pExpander(pExpander) { assert(m_pExpander); + + connect(m_pExpander, &QtExpander::expandedChanged, this, [&] { signal_expanded(); }); } void QtInstanceExpander::set_label(const OUString& rText) From c568149596fe58adcba00641368f5da7c64b3590 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 24 Nov 2024 20:13:02 +0500 Subject: [PATCH 205/373] No need to create PossibleHyphens for no-hyphenation case Change-Id: Idd509e40f96373fc29d0f313bcb5c14ee8490f17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177212 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 66d22f0b61a9..74761d739c54 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -704,10 +704,7 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const // Resolves: fdo#41083 honour MinWordLength in "createPossibleHyphens" as // well as "hyphenate" if (aWord.getLength() < minLen) - { - return PossibleHyphens::CreatePossibleHyphens( aWord, LinguLocaleToLanguage( aLocale ), - aWord, Sequence< sal_Int16 >() ); - } + return nullptr; // if we have a hyphenation dictionary matching this locale if (auto pHDInfo = getMatchingDict(aLocale)) From d3c2fcc3f33f09d655904abdfbad62c1db005288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sun, 24 Nov 2024 14:16:46 +0000 Subject: [PATCH 206/373] Resolves: tdf#163772 move margin into ValueSet itself MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instead of using margin property in .ui where size_request doesn't take such margins into account, while pref_size does. Change-Id: I7c557fd63c438515814ad32b9627895c27c13b81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177213 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- cui/source/customize/cfg.cxx | 1 + cui/uiconfig/ui/iconselectordialog.ui | 4 ---- include/svtools/valueset.hxx | 2 ++ svtools/source/control/valueset.cxx | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 9b79a931163f..3aaa07d6bb15 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2739,6 +2739,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow, m_xTbSymbol->SetItemWidth(m_nExpectedSize); m_xTbSymbol->SetItemHeight(m_nExpectedSize); m_xTbSymbol->SetExtraSpacing(6); + m_xTbSymbol->SetMargin(4); Size aSize(m_xTbSymbol->CalcWindowSizePixel(Size(m_nExpectedSize, m_nExpectedSize), 11, 5)); m_xTbSymbol->set_size_request(aSize.Width(), aSize.Height()); diff --git a/cui/uiconfig/ui/iconselectordialog.ui b/cui/uiconfig/ui/iconselectordialog.ui index 9ee6ee8847cb..1d07337f1cbb 100644 --- a/cui/uiconfig/ui/iconselectordialog.ui +++ b/cui/uiconfig/ui/iconselectordialog.ui @@ -119,10 +119,6 @@ True True GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - 3 - 3 - 3 - 3 True True
    diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 03dea4c03749..2244dfc805af 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -209,6 +209,7 @@ private: sal_uInt16 mnUserVisLines; sal_uInt16 mnFirstLine; sal_uInt16 mnSpacing; + sal_uInt16 mnMargin; DrawFrameStyle mnFrameStyle; Color maColor; OUString maText; @@ -369,6 +370,7 @@ public: } void SetExtraSpacing( sal_uInt16 nNewSpacing ); + void SetMargin( sal_uInt16 nNewMargin ); void Format(vcl::RenderContext const & rRenderContext); void SetFormat(); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 03666c97688b..5a056751b105 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -96,6 +96,7 @@ ValueSet::ValueSet(std::unique_ptr pScrolledWindow) mnUserCols = 0; mnUserVisLines = 0; mnSpacing = 0; + mnMargin = 0; mnFrameStyle = DrawFrameStyle::NONE; mbNoSelection = true; mbDoubleSel = false; @@ -861,6 +862,12 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) else nOff = 0; + if ( mnMargin ) + { + aWinSize.AdjustWidth(-mnMargin * 2); + aWinSize.AdjustHeight(-mnMargin * 2); + } + // consider size, if NameField does exist if (nStyle & WB_NAMEFIELD) { @@ -876,6 +883,8 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) else mnTextOffset = 0; + mnTextOffset += mnMargin; + // consider offset and size, if NoneField does exist if (nStyle & WB_NONEFIELD) { @@ -1038,6 +1047,9 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) nStartY = 0; } + nStartX += mnMargin; + nStartY += mnMargin; + // calculate and draw items maVirDev->SetLineColor(); tools::Long x = nStartX; @@ -1648,6 +1660,12 @@ Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCol aSize.AdjustHeight(nTxtHeight + n + mnSpacing ); } + if ( mnMargin ) + { + aSize.AdjustWidth(mnMargin * 2); + aSize.AdjustHeight(mnMargin * 2); + } + return aSize; } @@ -1820,6 +1838,12 @@ void ValueSet::SetExtraSpacing( sal_uInt16 nNewSpacing ) } } +void ValueSet::SetMargin( sal_uInt16 nNewMargin ) +{ + mnMargin = nNewMargin; + QueueReformat(); +} + void ValueSet::SetFormat() { mbFormat = true; From 737c4e624f660970eb66dd9a80de3e0306647937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sun, 24 Nov 2024 15:43:56 +0000 Subject: [PATCH 207/373] Resolves: tdf#164026 explicitly make these insensitive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifa399d9bb42bad8e5209f5937052fa9b616f8914 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177215 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- cui/source/tabpages/transfrm.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index 4ccf16dfd822..9cfeff9b1ff8 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -392,6 +392,7 @@ SvxSlantTabPage::SvxSlantTabPage(weld::Container* pPage, weld::DialogController* m_aControlX[i] = m_xBuilder->weld_metric_spin_button("controlx" + OUString::number(i+1), FieldUnit::CM); m_aControlGroupY[i] = m_xBuilder->weld_widget("controlgroupy" + OUString::number(i+1)); m_aControlY[i] = m_xBuilder->weld_metric_spin_button("controly" + OUString::number(i+1), FieldUnit::CM); + m_aControlGroups[i]->set_sensitive(false); } // this page needs ExchangeSupport From f4253af367e95a59c5f68140c7b1ec0a45aa22e5 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 24 Nov 2024 21:19:46 +0500 Subject: [PATCH 208/373] Avoid assigning unused value Change-Id: Ic6c59500805a8710150f083ff089b2e1c4c36530 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177217 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 74761d739c54..1e527c8e8ada 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -241,8 +241,8 @@ bool LoadDictionary(HDInfo& rDict) #else OString sTmp(OU2ENC(dictpath, osl_getThreadTextEncoding())); #endif - HyphenDict *dict = nullptr; - if ((dict = hnj_hyphen_load(sTmp.getStr())) == nullptr) + HyphenDict* dict = hnj_hyphen_load(sTmp.getStr()); + if (!dict) { SAL_WARN( "lingucomponent", From fbfa2769f261cba11a5ea7f3be648fa67c3816ca Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Mon, 25 Nov 2024 00:06:29 +1030 Subject: [PATCH 209/373] tdf#163486 PVS V1037 Two or more case-branches perform the same actions second identical branch was added in d519cbe89268ff24e2b8b05ba5124dca98f22b79 and V530 The return value of function 'GetTitle' is required... to be utilized the unnecessary GetTitle() call that was duplicated in d519cbe89268ff24e2b8b05ba5124dca98f22b79 was there since 9ae5a91f7955e44d3b24a3f7741f9bca02ac7f24 (initial import) Change-Id: Ied25faf177184cc1b1ca4a512285232bf966c1e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177209 Reviewed-by: Mike Kaganski Tested-by: Jenkins Reviewed-by: Aron Budea --- sc/source/ui/view/tabvwshf.cxx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 8c0d4049ffc4..70b9e424c32f 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -227,8 +227,6 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) if( pScSh ) { - pScSh->GetTitle(); - if (aDocName == pScSh->GetTitle(SFX_TITLE_FULLNAME)) { nDoc = i; @@ -540,12 +538,6 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet ) break; case FID_TAB_MOVE: - if ( !rDoc.IsDocEditable() - || rDoc.GetChangeTrack() != nullptr - || nTabCount > MAXTAB) - rSet.DisableItem( nWhich ); - break; - case FID_TAB_DUPLICATE: if ( !rDoc.IsDocEditable() || rDoc.GetChangeTrack() != nullptr @@ -763,8 +755,6 @@ void ScTabViewShell::ExecuteMoveTable( SfxRequest& rReq ) if( pScSh ) { - pScSh->GetTitle(); - if (aDocName == pScSh->GetTitle()) { nDoc = i; From 9646eddfa09c0048b2ca0371b9d540076025b0ca Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Mon, 25 Nov 2024 12:25:12 +1030 Subject: [PATCH 210/373] tdf#163486 PVS V1023 A pointer without owner is added to the container ...by the 'emplace_back' method. Change-Id: I76a0a655d5fc5b123cd1018cb010ff9c9625c1d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177226 Reviewed-by: Mike Kaganski Tested-by: Jenkins Reviewed-by: Aron Budea --- scaddins/source/analysis/analysishelper.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index 64277a2053c9..1ba1b303c2e6 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -2223,10 +2223,10 @@ double ConvertDataLinear::ConvertFromBase( double f, sal_Int16 n ) const ConvertDataList::ConvertDataList() { -#define NEWD(str,unit,cl) maVector.emplace_back(new ConvertData(str,unit,cl)) -#define NEWDP(str,unit,cl) maVector.emplace_back(new ConvertData(str,unit,cl,true)) -#define NEWL(str,unit,offs,cl) maVector.emplace_back(new ConvertDataLinear(str,unit,offs,cl)) -#define NEWLP(str,unit,offs,cl) maVector.emplace_back(new ConvertDataLinear(str,unit,offs,cl,true)) +#define NEWD(str,unit,cl) maVector.push_back(std::make_unique(str,unit,cl)) +#define NEWDP(str,unit,cl) maVector.push_back(std::make_unique(str,unit,cl,true)) +#define NEWL(str,unit,offs,cl) maVector.push_back(std::make_unique(str,unit,offs,cl)) +#define NEWLP(str,unit,offs,cl) maVector.push_back(std::make_unique(str,unit,offs,cl,true)) // *** are extra and not standard Excel Analysis Addin! From 8bbc65fa69b2c414370bfc3035368ac0437dae03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Wed, 4 Sep 2024 21:38:29 +0200 Subject: [PATCH 211/373] Identify layers so can be recognized as animation target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it has to match convertTarget result from unomodel.cxx which is used on export of animations Change-Id: I61df0b82681628722516c17c110acd90ce25b881 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172875 Reviewed-by: Marco Cecchetti Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177223 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- sd/qa/unit/tiledrendering/tiledrendering.cxx | 32 +++++++++-- sd/source/ui/inc/SlideshowLayerRenderer.hxx | 17 +++--- sd/source/ui/tools/SlideshowLayerRenderer.cxx | 54 +++++++++++++++++-- 3 files changed, 89 insertions(+), 14 deletions(-) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 7e76d6738362..3b73312982fb 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2956,7 +2956,13 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati OUString rJsonMsg; CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); - // TODO - check JSON content + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\"")); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); + debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); } @@ -2966,7 +2972,13 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati OUString rJsonMsg; CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); - // TODO - check JSON content + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); + debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); } @@ -2976,7 +2988,13 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati OUString rJsonMsg; CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); - // TODO - check JSON content + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); + debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); } @@ -2986,7 +3004,13 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati OUString rJsonMsg; CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); CPPUNIT_ASSERT(bIsBitmapLayer); - // TODO - check JSON content + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); + debugWriteImageToFile(4, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); } diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx b/sd/source/ui/inc/SlideshowLayerRenderer.hxx index 805541e3e857..ea15f7be555a 100644 --- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx +++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx @@ -42,6 +42,7 @@ struct RenderState std::unordered_set maObjectsDone; std::unordered_set maInAnimation; sal_Int32 mnIndex = 0; + SdrObject* mpCurrentTarget = nullptr; bool mbFirstObjectInPass = true; bool mbPassHasOutput = false; @@ -59,7 +60,7 @@ struct RenderState } /// returns the current stage as string - OString stageString() + OString stageString() const { if (meStage == RenderStage::Master) return "MasterPage"_ostr; @@ -67,41 +68,45 @@ struct RenderState } /// returns the current index depending on the current render stage - sal_Int32 currentIndex() + sal_Int32 currentIndex() const { if (meStage == RenderStage::Master) return mnMasterIndex; return mnIndex; } + /// returns the current target element for which layer is created if any + SdrObject* currentTarget() const { return mpCurrentTarget; } + /// resets properties that are valid for one pass void resetPass() { mbFirstObjectInPass = true; mbPassHasOutput = false; mbSkipAllInThisPass = false; + mpCurrentTarget = nullptr; } /// return if there was no rendering output in the pass - bool noMoreOutput() + bool noMoreOutput() const { // no output and we don't skip anything return !mbPassHasOutput && !mbSkipAllInThisPass; } /// should include background in rendering - bool includeBackground() + bool includeBackground() const { // include background only if we are rendering the first pass return mnCurrentPass == 0; } - bool isObjectAlreadyRendered(SdrObject* pObject) + bool isObjectAlreadyRendered(SdrObject* pObject) const { return maObjectsDone.find(pObject) != maObjectsDone.end(); } - bool isObjectInAnimation(SdrObject* pObject) + bool isObjectInAnimation(SdrObject* pObject) const { return maInAnimation.find(pObject) != maInAnimation.end(); } diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index dc219fe4d20a..1d9d8b7cd4b9 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -25,6 +26,7 @@ #include #include #include +#include #include #include @@ -126,6 +128,8 @@ public: if (pPage == nullptr) return; + mrRenderState.mpCurrentTarget = pObject; + // is the object visible and not hidden by any option const bool bVisible = pObject->getSdrPageFromSdrObject()->checkVisibility(rOriginal, rDisplayInfo, true); @@ -296,6 +300,13 @@ void SlideshowLayerRenderer::createViewAndDraw(RenderContext& rRenderContext) aView.CompleteRedraw(rRenderContext.maVirtualDevice, aRegion, &aRedirector); } +static void writeContentNode(::tools::JsonWriter& aJsonWriter) +{ + auto aContentNode = aJsonWriter.startNode("content"); + aJsonWriter.put("type", "%IMAGETYPE%"); + aJsonWriter.put("checksum", "%IMAGECHECKSUM%"); +} + void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg) { ::tools::JsonWriter aJsonWriter; @@ -303,12 +314,47 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg) aJsonWriter.put("index", maRenderState.currentIndex()); aJsonWriter.put("slideHash", GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage))); - aJsonWriter.put("type", "bitmap"); + bool bIsAnimation = false; + SdrObject* pObject = maRenderState.currentTarget(); + com::sun::star::uno::Reference xShape; + if (pObject) { - auto aContentNode = aJsonWriter.startNode("content"); - aJsonWriter.put("type", "%IMAGETYPE%"); - aJsonWriter.put("checksum", "%IMAGECHECKSUM%"); + xShape = GetXShapeForSdrObject(pObject); + + auto* pSdPage = dynamic_cast(&mrPage); + if (pSdPage) + { + std::shared_ptr pMainSequence(pSdPage->getMainSequence()); + if (pMainSequence && pMainSequence->hasEffect(xShape)) + bIsAnimation = true; + } } + + if (bIsAnimation) + { + aJsonWriter.put("type", "animated"); + { + auto aContentNode = aJsonWriter.startNode("content"); + + if (xShape.is()) + { + com::sun::star::uno::Reference xRef; + com::sun::star::uno::Any(xShape) >>= xRef; + if (xRef.is()) + aJsonWriter.put("hash", GetInterfaceHash(xRef)); + } + + aJsonWriter.put("initVisible", true); // TODO + aJsonWriter.put("type", "bitmap"); + writeContentNode(aJsonWriter); + } + } + else + { + aJsonWriter.put("type", "bitmap"); + writeContentNode(aJsonWriter); + } + rJsonMsg = aJsonWriter.finishAndGetAsOString(); maRenderState.incrementIndex(); From c913af24825baa8c95c91c3706d140a0b45e3341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Sun, 8 Sep 2024 20:56:06 +0200 Subject: [PATCH 212/373] slideshow: extract initial visibility of the animation target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Szymon Kłos Change-Id: I35ea503d254f36c8ab7307b157c87d5c2e0a8e1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173050 Tested-by: Jenkins CollaboraOffice Reviewed-by: Marco Cecchetti Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177224 Tested-by: Jenkins --- include/animations/animationnodehelper.hxx | 37 +++++++++++++++++++ sd/qa/unit/tiledrendering/tiledrendering.cxx | 3 ++ sd/source/ui/inc/SlideshowLayerRenderer.hxx | 2 + sd/source/ui/tools/SlideshowLayerRenderer.cxx | 33 ++++++++++++++--- .../engine/slide/targetpropertiescreator.cxx | 30 +-------------- 5 files changed, 72 insertions(+), 33 deletions(-) diff --git a/include/animations/animationnodehelper.hxx b/include/animations/animationnodehelper.hxx index cb6b6b74f67f..820d79749b5d 100644 --- a/include/animations/animationnodehelper.hxx +++ b/include/animations/animationnodehelper.hxx @@ -19,7 +19,9 @@ #pragma once +#include #include +#include #include #include #include @@ -70,6 +72,41 @@ namespace anim { } } + + inline bool getVisibilityProperty( + const css::uno::Reference< css::animations::XAnimate >& xAnimateNode) + { + bool bVisible( false ); + if( xAnimateNode->getAttributeName().equalsIgnoreAsciiCase("visibility") ) + { + + css::uno::Any aAny( xAnimateNode->getTo() ); + + // try to extract bool value + if( !(aAny >>= bVisible) ) + { + // try to extract string + OUString aString; + if( aAny >>= aString ) + { + // we also take the strings "true" and "false", + // as well as "on" and "off" here + if( aString.equalsIgnoreAsciiCase("true") || + aString.equalsIgnoreAsciiCase("on") ) + { + bVisible = true; + } + if( aString.equalsIgnoreAsciiCase("false") || + aString.equalsIgnoreAsciiCase("off") ) + { + bVisible = false; + } + } + } + } + + return bVisible; + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 3b73312982fb..f3a21c08eb06 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2960,6 +2960,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\"")); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); @@ -2976,6 +2977,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); @@ -3008,6 +3010,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx b/sd/source/ui/inc/SlideshowLayerRenderer.hxx index ea15f7be555a..760d771470ba 100644 --- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx +++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx @@ -13,6 +13,7 @@ #include #include #include +#include #include class SdrPage; @@ -41,6 +42,7 @@ struct RenderState std::unordered_set maObjectsDone; std::unordered_set maInAnimation; + std::map maInitiallyVisible; sal_Int32 mnIndex = 0; SdrObject* mpCurrentTarget = nullptr; diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index 1d9d8b7cd4b9..1b09c8cccd24 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -240,12 +240,16 @@ void SlideshowLayerRenderer::setupAnimations() uno::Any aAny = xAnimate->getTarget(); uno::Reference xShape; + SvxShape* pShape = nullptr; + SdrObject* pObject = nullptr; + if ((aAny >>= xShape) && xShape.is()) { - SvxShape* pShape = comphelper::getFromUnoTunnel(xShape); + pShape = comphelper::getFromUnoTunnel(xShape); if (pShape) { - maRenderState.maInAnimation.insert(pShape->GetSdrObject()); + pObject = pShape->GetSdrObject(); + maRenderState.maInAnimation.insert(pObject); } } else // if target is not a shape @@ -257,13 +261,26 @@ void SlideshowLayerRenderer::setupAnimations() xShape = aParagraphTarget.Shape; - SvxShape* pShape = comphelper::getFromUnoTunnel(xShape); + pShape = comphelper::getFromUnoTunnel(xShape); if (pShape) { - maRenderState.maInAnimation.insert(pShape->GetSdrObject()); + pObject = pShape->GetSdrObject(); + maRenderState.maInAnimation.insert(pObject); } } } + + if (pObject) + { + bool bVisible = anim::getVisibilityProperty(xAnimate); + + // if initial anim sets shape visible, set it + // to invisible. If we're asked for the final + // state, don't do anything obviously + bVisible = !bVisible; + + maRenderState.maInitiallyVisible[pObject] = bVisible; + } } } } @@ -341,10 +358,16 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg) com::sun::star::uno::Reference xRef; com::sun::star::uno::Any(xShape) >>= xRef; if (xRef.is()) + { aJsonWriter.put("hash", GetInterfaceHash(xRef)); + + bool bInitiallyVisible = true; + if (maRenderState.maInitiallyVisible.contains(pObject)) + bInitiallyVisible = maRenderState.maInitiallyVisible[pObject]; + aJsonWriter.put("initVisible", bInitiallyVisible); + } } - aJsonWriter.put("initVisible", true); // TODO aJsonWriter.put("type", "bitmap"); writeContentNode(aJsonWriter); } diff --git a/slideshow/source/engine/slide/targetpropertiescreator.cxx b/slideshow/source/engine/slide/targetpropertiescreator.cxx index 2752d543e55c..6ccf2374515a 100644 --- a/slideshow/source/engine/slide/targetpropertiescreator.cxx +++ b/slideshow/source/engine/slide/targetpropertiescreator.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include @@ -257,34 +258,7 @@ namespace slideshow::internal // initially. This is currently the only place // where a shape effect influences shape // attributes outside it's effective duration. - bool bVisible( false ); - if( xAnimateNode->getAttributeName().equalsIgnoreAsciiCase("visibility") ) - { - - uno::Any aAny( xAnimateNode->getTo() ); - - // try to extract bool value - if( !(aAny >>= bVisible) ) - { - // try to extract string - OUString aString; - if( aAny >>= aString ) - { - // we also take the strings "true" and "false", - // as well as "on" and "off" here - if( aString.equalsIgnoreAsciiCase("true") || - aString.equalsIgnoreAsciiCase("on") ) - { - bVisible = true; - } - if( aString.equalsIgnoreAsciiCase("false") || - aString.equalsIgnoreAsciiCase("off") ) - { - bVisible = false; - } - } - } - } + bool bVisible = anim::getVisibilityProperty(xAnimateNode); // if initial anim sets shape visible, set it // to invisible. If we're asked for the final From a7041bb3099dcd40ec67d598dc0fa3eecf2e63d3 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Sat, 23 Nov 2024 15:28:13 +0100 Subject: [PATCH 213/373] tdf#152299 - Remove unused define(s) from C/C++ files Change-Id: Id7b5e1675963fd4b65974f4da39dbdccd45af549 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177143 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sal/rtl/alloc_impl.hxx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sal/rtl/alloc_impl.hxx b/sal/rtl/alloc_impl.hxx index 398597c483d7..eefee462f1b5 100644 --- a/sal/rtl/alloc_impl.hxx +++ b/sal/rtl/alloc_impl.hxx @@ -36,11 +36,6 @@ #define RTL_MEMORY_ALIGNMENT_8 sizeof(void*) #endif /* SAL_TYPES_ALIGNMENT8 */ -#if 0 /* @@@ */ -#define RTL_MEMORY_ALIGNMENT_1 8 -#define RTL_MEMORY_ALIGNMENT_2 (sizeof(void*) * 2) -#endif /* @@@ */ - #define RTL_MEMORY_ALIGN(value, align) (((value) + ((align) - 1)) & ~((align) - 1)) #define RTL_MEMORY_ISP2(value) (((value) & ((value) - 1)) == 0) @@ -208,11 +203,6 @@ typedef CRITICAL_SECTION rtl_memory_lock_type; #error Unknown platform #endif /* SAL_UNX | _WIN32 */ -/** Cache creation flags. - @internal -*/ -#define RTL_CACHE_FLAG_NOMAGAZINE (1 << 13) /* w/o magazine layer */ - #endif // INCLUDED_SAL_RTL_ALLOC_IMPL_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From c969795babd116635f87184facdc37f4f952d838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Fri, 8 Nov 2024 11:50:14 +0100 Subject: [PATCH 214/373] pdf: Introduce a IPDFEncryptor and use it in PDFWriterImpl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea of IPDFEncryptor is to be the interface to encrypt the stream/string in the same way, irregardless which PDF encryption version/revision we are using. Change-Id: Ie7835384f1be5a44c53985b01c8187323400aa0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176890 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/inc/pdf/PDFEncryptor.hxx | 42 +++++++++++++++++++++++------- vcl/inc/pdf/pdfwriter_impl.hxx | 2 +- vcl/source/gdi/pdfwriter_impl.cxx | 30 ++++++++++++--------- vcl/source/gdi/pdfwriter_impl2.cxx | 14 +++++----- 4 files changed, 57 insertions(+), 31 deletions(-) diff --git a/vcl/inc/pdf/PDFEncryptor.hxx b/vcl/inc/pdf/PDFEncryptor.hxx index a5fc3a17c054..3547252ceb5e 100644 --- a/vcl/inc/pdf/PDFEncryptor.hxx +++ b/vcl/inc/pdf/PDFEncryptor.hxx @@ -33,7 +33,29 @@ namespace vcl::pdf { class EncryptionHashTransporter; -class PDFEncryptor +class IPDFEncryptor +{ +public: + virtual ~IPDFEncryptor() {} + virtual sal_Int32 getAccessPermissions() = 0; + virtual sal_Int32 getKeyLength() = 0; + virtual bool prepareEncryption( + const css::uno::Reference& xEncryptionMaterialHolder, + PDFEncryptionProperties& rProperties) + = 0; + virtual void setupKeysAndCheck(PDFEncryptionProperties& rProperties) = 0; + + virtual void setupEncryption(std::vector const& rEncryptionKey, sal_Int32 nObject) + = 0; + virtual void enableStreamEncryption() = 0; + virtual void disableStreamEncryption() = 0; + virtual bool isStreamEncryptionEnabled() = 0; + virtual void encrypt(const void* pInput, sal_uInt64 nInputSize, sal_uInt8* pOutput, + sal_uInt64 nOutputsSize) + = 0; +}; + +class PDFEncryptor : public IPDFEncryptor { private: /* the numerical value of the access permissions, according to PDF spec, must be signed */ @@ -55,8 +77,8 @@ public: /* used to cipher the stream data and for password management */ rtlCipher m_aCipher = nullptr; - sal_Int32 getAccessPermissions() { return m_nAccessPermissions; } - sal_Int32 getKeyLength() { return m_nKeyLength; } + sal_Int32 getAccessPermissions() override { return m_nAccessPermissions; } + sal_Int32 getKeyLength() override { return m_nKeyLength; } sal_Int32 getRC4KeyLength() { return m_nRC4KeyLength; } static css::uno::Reference @@ -64,18 +86,18 @@ public: virtual bool prepareEncryption( const css::uno::Reference& xEncryptionMaterialHolder, - PDFEncryptionProperties& rProperties); + PDFEncryptionProperties& rProperties) override; - void setupKeysAndCheck(PDFEncryptionProperties& rProperties); + void setupKeysAndCheck(PDFEncryptionProperties& rProperties) override; - void setupEncryption(std::vector const& rEncryptionKey, sal_Int32 nObject); - void enableStreamEncryption(); - void disableStreamEncryption(); + void setupEncryption(std::vector const& rEncryptionKey, sal_Int32 nObject) override; + void enableStreamEncryption() override; + void disableStreamEncryption() override; - bool isStreamEncryptionEnabled() { return m_bEncryptThisStream; } + bool isStreamEncryptionEnabled() override { return m_bEncryptThisStream; } void encrypt(const void* pInput, sal_uInt64 nInputSize, sal_uInt8* pOutput, - sal_uInt64 nOutputsSize); + sal_uInt64 nOutputsSize) override; }; } diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index 88267ed4b9f4..e7644d7c4884 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -811,7 +811,7 @@ private: ExternalPDFStreams m_aExternalPDFStreams; - PDFEncryptor m_aPDFEncryptor; + std::unique_ptr m_pPDFEncryptor; /* output redirection; e.g. to accumulate content streams for XObjects diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 2641256b30c4..b282827ee4c3 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1453,11 +1453,14 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, setupDocInfo(); if (xEncryptionMaterialHolder.is()) - m_aPDFEncryptor.prepareEncryption(xEncryptionMaterialHolder, m_aContext.Encryption); + { + m_pPDFEncryptor.reset(new PDFEncryptor); + m_pPDFEncryptor->prepareEncryption(xEncryptionMaterialHolder, m_aContext.Encryption); + } if (m_aContext.Encryption.Encrypt()) { - m_aPDFEncryptor.setupKeysAndCheck(m_aContext.Encryption); + m_pPDFEncryptor->setupKeysAndCheck(m_aContext.Encryption); } // write header @@ -1591,7 +1594,7 @@ append the string as unicode hex, encrypted if needed inline void PDFWriterImpl::appendUnicodeTextStringEncrypt( const OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer ) { rOutBuffer.append( "<" ); - if( m_aContext.Encryption.Encrypt() ) + if (m_aContext.Encryption.Encrypt()) { const sal_Unicode* pStr = rInString.getStr(); sal_Int32 nLen = rInString.getLength(); @@ -1610,7 +1613,7 @@ inline void PDFWriterImpl::appendUnicodeTextStringEncrypt( const OUString& rInSt *pCopy++ = static_cast( aUnChar & 255 ); } //encrypt in place - rtl_cipher_encodeARCFOUR( m_aPDFEncryptor.m_aCipher, m_vEncryptionBuffer.data(), nChars, m_vEncryptionBuffer.data(), nChars); + m_pPDFEncryptor->encrypt(m_vEncryptionBuffer.data(), nChars, m_vEncryptionBuffer.data(), nChars); //now append, hexadecimal (appendHex), the encrypted result for(int i = 0; i < nChars; i++) appendHex( m_vEncryptionBuffer[i], rOutBuffer ); @@ -1625,12 +1628,12 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( std::string_view rInStrin rOutBuffer.append( "(" ); sal_Int32 nChars = rInString.size(); //check for encryption, if ok, encrypt the string, then convert with appndLiteralString - if( m_aContext.Encryption.Encrypt() ) + if (m_aContext.Encryption.Encrypt()) { m_vEncryptionBuffer.resize(nChars); //encrypt the string in a buffer, then append it - enableStringEncryption( nInObjectNumber ); - rtl_cipher_encodeARCFOUR(m_aPDFEncryptor.m_aCipher, rInString.data(), nChars, m_vEncryptionBuffer.data(), nChars); + enableStringEncryption(nInObjectNumber); + m_pPDFEncryptor->encrypt(rInString.data(), nChars, m_vEncryptionBuffer.data(), nChars); appendLiteralString( reinterpret_cast(m_vEncryptionBuffer.data()), nChars, rOutBuffer ); } else @@ -1737,13 +1740,14 @@ bool PDFWriterImpl::writeBufferBytes( const void* pBuffer, sal_uInt64 nBytes ) } else { - if (m_aPDFEncryptor.isStreamEncryptionEnabled()) + bool bStreamEncryption = m_pPDFEncryptor && m_pPDFEncryptor->isStreamEncryptionEnabled(); + if (bStreamEncryption) { m_vEncryptionBuffer.resize(nBytes); - m_aPDFEncryptor.encrypt(pBuffer, nBytes, m_vEncryptionBuffer.data(), nBytes); + m_pPDFEncryptor->encrypt(pBuffer, nBytes, m_vEncryptionBuffer.data(), nBytes); } - const void* pWriteBuffer = m_aPDFEncryptor.isStreamEncryptionEnabled() ? m_vEncryptionBuffer.data() : pBuffer; + const void* pWriteBuffer = bStreamEncryption ? m_vEncryptionBuffer.data() : pBuffer; m_DocDigest.update(static_cast(pWriteBuffer), static_cast(nBytes)); if (m_aFile.write(pWriteBuffer, nBytes, nWritten) != osl::File::E_None) @@ -6149,7 +6153,7 @@ sal_Int32 PDFWriterImpl::emitEncrypt() // emit the owner password, must not be encrypted aWriter.writeString("/O", reinterpret_cast(m_aContext.Encryption.OValue.data()), sal_Int32(m_aContext.Encryption.OValue.size())); aWriter.writeString("/U", reinterpret_cast(m_aContext.Encryption.UValue.data()), sal_Int32(m_aContext.Encryption.UValue.size())); - aWriter.write("/P", m_aPDFEncryptor.getAccessPermissions()); + aWriter.write("/P", m_pPDFEncryptor->getAccessPermissions()); aWriter.endDict(); aWriter.endObject(); @@ -9768,7 +9772,7 @@ bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& rObject, bool bMask ) aLine.append( "\n<" ); if( m_aContext.Encryption.Encrypt() ) { - enableStringEncryption( rObject.m_nObject ); + enableStringEncryption(rObject.m_nObject); //check encryption buffer size m_vEncryptionBuffer.resize(pAccess->GetPaletteEntryCount()*3); int nChar = 0; @@ -9781,7 +9785,7 @@ bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& rObject, bool bMask ) m_vEncryptionBuffer[nChar++] = rColor.GetBlue(); } //encrypt the colorspace lookup table - rtl_cipher_encodeARCFOUR(m_aPDFEncryptor.m_aCipher, m_vEncryptionBuffer.data(), nChar, m_vEncryptionBuffer.data(), nChar); + m_pPDFEncryptor->encrypt(m_vEncryptionBuffer.data(), nChar, m_vEncryptionBuffer.data(), nChar); //now queue the data for output nChar = 0; for( sal_uInt16 i = 0; i < pAccess->GetPaletteEntryCount(); i++ ) diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 354397af60df..3efc67a32b61 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1079,25 +1079,25 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa void PDFWriterImpl::checkAndEnableStreamEncryption(sal_Int32 nObject) { - if (!m_aContext.Encryption.Encrypt()) + if (!m_aContext.Encryption.Encrypt() || !m_pPDFEncryptor) return; - m_aPDFEncryptor.enableStreamEncryption(); - m_aPDFEncryptor.setupEncryption(m_aContext.Encryption.EncryptionKey, nObject); + m_pPDFEncryptor->enableStreamEncryption(); + m_pPDFEncryptor->setupEncryption(m_aContext.Encryption.EncryptionKey, nObject); } void PDFWriterImpl::disableStreamEncryption() { - m_aPDFEncryptor.disableStreamEncryption(); - + if (m_pPDFEncryptor) + m_pPDFEncryptor->disableStreamEncryption(); } void PDFWriterImpl::enableStringEncryption(sal_Int32 nObject) { - if (!m_aContext.Encryption.Encrypt()) + if (!m_aContext.Encryption.Encrypt() || !m_pPDFEncryptor) return; - m_aPDFEncryptor.setupEncryption(m_aContext.Encryption.EncryptionKey, nObject); + m_pPDFEncryptor->setupEncryption(m_aContext.Encryption.EncryptionKey, nObject); } const tools::Long unsetRun[256] = From 69e881925f8fb876f334541abe0c17fbaf3f8f1f Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Mon, 25 Nov 2024 03:20:02 +1030 Subject: [PATCH 215/373] tdf#163486 PVS V581 The conditional expressions of the 'if' statements situated ...alongside each other are identical. Started when a call inbetween was removed in e50f6c023926269f76cd73e085b7a246cd0f88fa. and V1053 Calling the 'EnableRTL' virtual function in the constructor ...may lead to unexpected result at runtime. and V1051 Consider checking for misprints. It's possible that the ...'nTopPos' should be checked here. V1028 Possible overflow. Consider casting operands of the... 'nStartCol + 1' operator to the 'sal_Int64' type, not the result. Change-Id: Ided25ab6dc9e9d4a1c72a1b809de586c7b890ce0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177218 Tested-by: Jenkins Reviewed-by: Aron Budea Reviewed-by: Mike Kaganski --- sc/source/ui/view/tabview.cxx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index abc5528ff926..0761018fd089 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -79,7 +79,7 @@ ScCornerButton::ScCornerButton( vcl::Window* pParent, ScViewData* pData ) : Window( pParent, WinBits( 0 ) ), pViewData( pData ) { - EnableRTL( false ); + ScCornerButton::EnableRTL( false ); } ScCornerButton::~ScCornerButton() @@ -393,10 +393,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) nBarY += nScrollBarSize; nSizeY -= nBarY; - } - if (bHScroll) // Scrollbars horizontal - { tools::Long nSizeLt = 0; // left scroll bar tools::Long nSizeRt = 0; // right scroll bar tools::Long nSizeSp = 0; // splitter @@ -2213,8 +2210,7 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLRO if (eOldV != SC_SPLIT_NONE) { nTopPos = aViewData.GetPosY(SC_SPLIT_TOP); - if (aViewData.GetPosY(SC_SPLIT_BOTTOM) > nBottomPos) - nBottomPos = aViewData.GetPosY(SC_SPLIT_BOTTOM); + nBottomPos = std::max(aViewData.GetPosY(SC_SPLIT_BOTTOM), nBottomPos); } aSplit = aViewData.GetScrPos(nPosX, nPosY, ePos, true); if (aSplit.Y() > 0) @@ -3062,7 +3058,7 @@ void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::J if (nStartCol != nEndCol) { auto node = rJsonWriter.startStruct(); - rJsonWriter.put("text", static_cast(nStartCol + 1)); + rJsonWriter.put("text", static_cast(nStartCol) + 1); rJsonWriter.put("size", nTotalPixels); rJsonWriter.put("groupLevels", static_cast(nColGroupDepth)); } From 58e255c8e29e5287d9c9fea2a698045138a354ca Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Fri, 22 Nov 2024 16:40:22 +0100 Subject: [PATCH 216/373] Related: tdf#157233 - A11y: fix wrong Issue ID in options_list DocumentStyleLanguage used the wrong AccessibilityIssueID. Change-Id: I7bbb9737abc9b36972376e86996e65443014b178 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177040 Tested-by: Jenkins Reviewed-by: Balazs Varga --- cui/source/options/optaccessibility.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx index 0e0e4bfb8b84..41cb13f358ac 100644 --- a/cui/source/options/optaccessibility.cxx +++ b/cui/source/options/optaccessibility.cxx @@ -31,8 +31,8 @@ namespace constexpr std::pair> options_list[] { { u"DocumentTitle"_ustr, { sfx::AccessibilityIssueID::DOCUMENT_TITLE, STR_DOCUMENT_TITLE } }, { u"DocumentLanguage"_ustr, { sfx::AccessibilityIssueID::DOCUMENT_LANGUAGE, STR_DOCUMENT_DEFAULT_LANGUAGE } }, - { u"DocumentBackground"_ustr, { sfx::AccessibilityIssueID::DOCUMENT_LANGUAGE, STR_AVOID_BACKGROUND_IMAGES } }, - { u"DocumentStyleLanguage"_ustr, { sfx::AccessibilityIssueID::DOCUMENT_BACKGROUND, STR_STYLE_NO_LANGUAGE } }, + { u"DocumentBackground"_ustr, { sfx::AccessibilityIssueID::DOCUMENT_BACKGROUND, STR_AVOID_BACKGROUND_IMAGES } }, + { u"DocumentStyleLanguage"_ustr, { sfx::AccessibilityIssueID::STYLE_LANGUAGE, STR_STYLE_NO_LANGUAGE } }, { u"LinkedGraphic"_ustr, { sfx::AccessibilityIssueID::LINKED_GRAPHIC, STR_LINKED_GRAPHIC } }, { u"NoAltOleObj"_ustr, { sfx::AccessibilityIssueID::NO_ALT_OLE, STR_NO_ALT_OLE } }, { u"NoAltGraphicObj"_ustr, { sfx::AccessibilityIssueID::NO_ALT_GRAPHIC, STR_NO_ALT_GRAPHIC } }, From ff68535068169d86cf95907c5e6a3a0aee94cb49 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 25 Nov 2024 08:17:13 +0100 Subject: [PATCH 217/373] svx: prefix members of SdrDragMove See tdf#94879 for motivation. Change-Id: I4945cec5ee88700360c5a8ff706105dbc7f95f6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177229 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- include/svx/svddrgmt.hxx | 8 +++---- svx/source/svdraw/svddrgmt.cxx | 38 +++++++++++++++++----------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/svx/svddrgmt.hxx b/include/svx/svddrgmt.hxx index 58639bc85df5..3352f09196b3 100644 --- a/include/svx/svddrgmt.hxx +++ b/include/svx/svddrgmt.hxx @@ -228,10 +228,10 @@ inline const tools::Rectangle& SdrDragMethod::GetMarkedRect() const class SVXCORE_DLLPUBLIC SdrDragMove : public SdrDragMethod { private: - tools::Long nBestXSnap; - tools::Long nBestYSnap; - bool bXSnapped; - bool bYSnapped; + tools::Long m_nBestXSnap; + tools::Long m_nBestYSnap; + bool m_bXSnapped; + bool m_bYSnapped; void ImpCheckSnap(const Point& rPt); diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 885dd8fcc277..7e2a812e430e 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -1470,10 +1470,10 @@ void SdrDragMove::applyCurrentTransformationToSdrObject(SdrObject& rTarget) SdrDragMove::SdrDragMove(SdrDragView& rNewView) : SdrDragMethod(rNewView) - , nBestXSnap(0) - , nBestYSnap(0) - , bXSnapped(false) - , bYSnapped(false) + , m_nBestXSnap(0) + , m_nBestYSnap(0) + , m_bXSnapped(false) + , m_bYSnapped(false) { setMoveOnly(true); } @@ -1518,43 +1518,43 @@ void SdrDragMove::ImpCheckSnap(const Point& rPt) if (nRet & SdrSnap::XSNAPPED) { - if (bXSnapped) + if (m_bXSnapped) { - if (std::abs(aPt.X()) Date: Mon, 9 Sep 2024 17:34:03 +0200 Subject: [PATCH 218/373] lok: slideshow: render background as separate layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit we still take color from the JSON Change-Id: I6b83cc8aaaa3e9127d85ec06589bac7ed4472f71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173083 Reviewed-by: Marco Cecchetti Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177227 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- sd/qa/unit/tiledrendering/data/anim.odp | Bin 0 -> 14485 bytes sd/qa/unit/tiledrendering/tiledrendering.cxx | 35 ++++++++++++++++++ sd/source/ui/inc/SlideshowLayerRenderer.hxx | 35 +++++++----------- sd/source/ui/tools/SlideshowLayerRenderer.cxx | 18 ++++++--- 4 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 sd/qa/unit/tiledrendering/data/anim.odp diff --git a/sd/qa/unit/tiledrendering/data/anim.odp b/sd/qa/unit/tiledrendering/data/anim.odp new file mode 100644 index 0000000000000000000000000000000000000000..b508d48f8a43f5ca0b7641f5dac14656fe780304 GIT binary patch literal 14485 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 literal 0 HcmV?d00001 diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index f3a21c08eb06..8289d539c639 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2793,6 +2793,15 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering) CPPUNIT_ASSERT_EQUAL(1125, nViewHeight); const Color aTransparentColor(ColorAlpha, 0x00000000); + + // Background Layer - TODO + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + } + { std::vector pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; @@ -2863,6 +2872,15 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie CPPUNIT_ASSERT_EQUAL(1125, nViewHeight); const Color aTransparentColor(ColorAlpha, 0x00000000); + + // Background Layer - TODO + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + } + { std::vector pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; @@ -2950,6 +2968,23 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT_EQUAL(2000, nViewWidth); CPPUNIT_ASSERT_EQUAL(1125, nViewHeight); + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"Background\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\"")); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); + + debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + { std::vector pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx b/sd/source/ui/inc/SlideshowLayerRenderer.hxx index 760d771470ba..5555ea8300e4 100644 --- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx +++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx @@ -28,22 +28,24 @@ struct RenderContext; enum class RenderStage { + Background, Master, - Slide + Slide, + TextFields, + Count }; /** Holds rendering state, properties and switches through all rendering passes */ struct RenderState { - RenderStage meStage = RenderStage::Master; + RenderStage meStage = RenderStage::Background; - sal_Int32 mnMasterIndex = 0; bool mbStopRenderingWhenField = true; std::unordered_set maObjectsDone; std::unordered_set maInAnimation; std::map maInitiallyVisible; - sal_Int32 mnIndex = 0; + sal_Int32 mnIndex[static_cast(RenderStage::Count)] = { 0, 0, 0, 0 }; SdrObject* mpCurrentTarget = nullptr; bool mbFirstObjectInPass = true; @@ -53,29 +55,22 @@ struct RenderState sal_Int32 mnCurrentPass = 0; /// increments index depending on the current render stage - void incrementIndex() - { - if (meStage == RenderStage::Master) - mnMasterIndex++; - else - mnIndex++; - } + void incrementIndex() { mnIndex[static_cast(meStage)]++; } /// returns the current stage as string OString stageString() const { if (meStage == RenderStage::Master) return "MasterPage"_ostr; + else if (meStage == RenderStage::Background) + return "Background"_ostr; + else if (meStage == RenderStage::TextFields) + return "TextFields"_ostr; return "DrawPage"_ostr; } /// returns the current index depending on the current render stage - sal_Int32 currentIndex() const - { - if (meStage == RenderStage::Master) - return mnMasterIndex; - return mnIndex; - } + sal_Int32 currentIndex() const { return mnIndex[static_cast(meStage)]; } /// returns the current target element for which layer is created if any SdrObject* currentTarget() const { return mpCurrentTarget; } @@ -97,11 +92,7 @@ struct RenderState } /// should include background in rendering - bool includeBackground() const - { - // include background only if we are rendering the first pass - return mnCurrentPass == 0; - } + bool includeBackground() const { return meStage == RenderStage::Background; } bool isObjectAlreadyRendered(SdrObject* pObject) const { diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index 1b09c8cccd24..d9bb1ce41045 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -115,6 +115,12 @@ public: const sdr::contact::DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override { + if (mrRenderState.meStage == RenderStage::Background) + { + mrRenderState.mbSkipAllInThisPass = true; + return; + } + if (mrRenderState.mbSkipAllInThisPass) return; @@ -202,11 +208,7 @@ SlideshowLayerRenderer::SlideshowLayerRenderer(SdrPage& rPage) : mrPage(rPage) , mrModel(rPage.getSdrModelFromSdrPage()) { - if (!hasEmptyMaster(rPage)) - maRenderState.meStage = RenderStage::Master; - else - maRenderState.meStage = RenderStage::Slide; - + maRenderState.meStage = RenderStage::Background; setupAnimations(); } @@ -399,6 +401,12 @@ bool SlideshowLayerRenderer::render(unsigned char* pBuffer, OString& rJsonMsg) maRenderState.mnCurrentPass++; + if (maRenderState.meStage == RenderStage::Background) + maRenderState.meStage = RenderStage::Master; + + if (hasEmptyMaster(mrPage)) + maRenderState.meStage = RenderStage::Slide; + return true; } From dfb779ff7689fc31b7e6bd27ea87a2074c2bdfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Mon, 9 Sep 2024 18:14:16 +0200 Subject: [PATCH 219/373] lok: slideshow: render animated objects as separate layers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit don't merge animated and non-animated objects on single layer Signed-off-by: Szymon Kłos Change-Id: I259507e08c95c3662e60f7691646395d1a840465 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173084 Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177228 Tested-by: Jenkins --- sd/qa/unit/tiledrendering/tiledrendering.cxx | 139 +++++++++++++++++- sd/source/ui/tools/SlideshowLayerRenderer.cxx | 8 +- 2 files changed, 142 insertions(+), 5 deletions(-) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 8289d539c639..72fc3894dd2d 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -3011,9 +3011,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); - CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0); - CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); - CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\"")); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); @@ -3030,6 +3030,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); @@ -3062,6 +3063,138 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati pXImpressDocument->postSlideshowCleanup(); } +CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animations2) +{ + SdXImpressDocument* pXImpressDocument = createDoc("anim.odp"); + pXImpressDocument->initializeForTiledRendering(uno::Sequence()); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + CPPUNIT_ASSERT(pViewShell); + SdPage* pPage = pViewShell->GetActualPage(); + CPPUNIT_ASSERT(pPage); + sal_Int32 nViewWidth = 2000; + sal_Int32 nViewHeight = 2000; + CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(0, nViewWidth, nViewHeight, true, true)); + CPPUNIT_ASSERT_EQUAL(2000, nViewWidth); + CPPUNIT_ASSERT_EQUAL(1125, nViewHeight); + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"Background\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\"")); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); + + debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + + debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + + debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + + debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + + debugWriteImageToFile(4, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 2") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + + debugWriteImageToFile(5, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + + debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + } + + pXImpressDocument->postSlideshowCleanup(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index d9bb1ce41045..54ad8d0a98e6 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -117,6 +117,7 @@ public: { if (mrRenderState.meStage == RenderStage::Background) { + mrRenderState.mbPassHasOutput = true; mrRenderState.mbSkipAllInThisPass = true; return; } @@ -134,8 +135,6 @@ public: if (pPage == nullptr) return; - mrRenderState.mpCurrentTarget = pObject; - // is the object visible and not hidden by any option const bool bVisible = pObject->getSdrPageFromSdrObject()->checkVisibility(rOriginal, rDisplayInfo, true); @@ -166,6 +165,9 @@ public: if (mrRenderState.isObjectInAnimation(pObject)) { + if (!mrRenderState.mbFirstObjectInPass) + return; + mrRenderState.mbSkipAllInThisPass = true; } @@ -177,6 +179,8 @@ public: return; } + mrRenderState.mpCurrentTarget = pObject; + // render the object sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence( rOriginal, rDisplayInfo, rVisitor); From 4ffd7c145626563ef36f81a256b5b2cddc72fc8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Mon, 9 Sep 2024 23:40:05 +0200 Subject: [PATCH 220/373] slideshow: fix initVisible value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit be sure we don't overwrite the real "visibility" value when other property is read Signed-off-by: Szymon Kłos Change-Id: Ied2285e8183665b5b48d10d74e1cc052cf8edcbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173110 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177235 --- include/animations/animationnodehelper.hxx | 9 +-- sd/qa/unit/tiledrendering/tiledrendering.cxx | 4 +- sd/source/ui/inc/SlideshowLayerRenderer.hxx | 31 +++++++++- sd/source/ui/tools/SlideshowLayerRenderer.cxx | 56 ++++++------------- .../engine/slide/targetpropertiescreator.cxx | 3 +- 5 files changed, 55 insertions(+), 48 deletions(-) diff --git a/include/animations/animationnodehelper.hxx b/include/animations/animationnodehelper.hxx index 820d79749b5d..c23ab25c140f 100644 --- a/include/animations/animationnodehelper.hxx +++ b/include/animations/animationnodehelper.hxx @@ -74,12 +74,11 @@ namespace anim } inline bool getVisibilityProperty( - const css::uno::Reference< css::animations::XAnimate >& xAnimateNode) + const css::uno::Reference< css::animations::XAnimate >& xAnimateNode, bool& bReturn) { - bool bVisible( false ); if( xAnimateNode->getAttributeName().equalsIgnoreAsciiCase("visibility") ) { - + bool bVisible( false ); css::uno::Any aAny( xAnimateNode->getTo() ); // try to extract bool value @@ -103,9 +102,11 @@ namespace anim } } } + bReturn = bVisible; + return true; } - return bVisible; + return false; } } diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 72fc3894dd2d..13b94ddfa435 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -3146,7 +3146,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); - CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); @@ -3178,7 +3178,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0); - CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx b/sd/source/ui/inc/SlideshowLayerRenderer.hxx index 5555ea8300e4..b6397ddc9fb8 100644 --- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx +++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx @@ -9,9 +9,13 @@ #pragma once -#include -#include #include +#include +#include +#include +#include +#include + #include #include #include @@ -103,6 +107,29 @@ struct RenderState { return maInAnimation.find(pObject) != maInAnimation.end(); } + + bool isObjectInitiallyVisible(SdrObject* pObject) const + { + bool bInitiallyVisible = true; + if (maInitiallyVisible.contains(pObject)) + bInitiallyVisible = maInitiallyVisible.at(pObject); + return bInitiallyVisible; + } + + static std::string getObjectHash(SdrObject* pObject) + { + css::uno::Reference xShape = GetXShapeForSdrObject(pObject); + if (xShape.is()) + { + css::uno::Reference xRef; + css::uno::Any(xShape) >>= xRef; + if (xRef.is()) + return GetInterfaceHash(xRef); + } + + SAL_WARN("sd", "RenderState::getObjectHash: failed"); + return std::string(); + } }; /** Renders a slide */ diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index 54ad8d0a98e6..c244142f9d35 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -12,14 +12,12 @@ #include #include #include -#include #include #include #include #include #include #include -#include #include #include @@ -115,6 +113,7 @@ public: const sdr::contact::DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override { + // Generate single pass for background layer if (mrRenderState.meStage == RenderStage::Background) { mrRenderState.mbPassHasOutput = true; @@ -165,9 +164,11 @@ public: if (mrRenderState.isObjectInAnimation(pObject)) { + // Animated object cannot be attached to the previous object if (!mrRenderState.mbFirstObjectInPass) return; + // Animated object has to be only one in the render mrRenderState.mbSkipAllInThisPass = true; } @@ -278,14 +279,17 @@ void SlideshowLayerRenderer::setupAnimations() if (pObject) { - bool bVisible = anim::getVisibilityProperty(xAnimate); + bool bVisible; - // if initial anim sets shape visible, set it - // to invisible. If we're asked for the final - // state, don't do anything obviously - bVisible = !bVisible; + if (anim::getVisibilityProperty(xAnimate, bVisible)) + { + // if initial anim sets shape visible, set it + // to invisible. If we're asked for the final + // state, don't do anything obviously + bVisible = !bVisible; - maRenderState.maInitiallyVisible[pObject] = bVisible; + maRenderState.maInitiallyVisible[pObject] = bVisible; + } } } } @@ -337,43 +341,17 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg) aJsonWriter.put("index", maRenderState.currentIndex()); aJsonWriter.put("slideHash", GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage))); - bool bIsAnimation = false; SdrObject* pObject = maRenderState.currentTarget(); - com::sun::star::uno::Reference xShape; - if (pObject) - { - xShape = GetXShapeForSdrObject(pObject); - auto* pSdPage = dynamic_cast(&mrPage); - if (pSdPage) - { - std::shared_ptr pMainSequence(pSdPage->getMainSequence()); - if (pMainSequence && pMainSequence->hasEffect(xShape)) - bIsAnimation = true; - } - } - - if (bIsAnimation) + bool bIsAnimated = maRenderState.isObjectInAnimation(pObject); + if (bIsAnimated) { + assert(pObject); aJsonWriter.put("type", "animated"); { auto aContentNode = aJsonWriter.startNode("content"); - - if (xShape.is()) - { - com::sun::star::uno::Reference xRef; - com::sun::star::uno::Any(xShape) >>= xRef; - if (xRef.is()) - { - aJsonWriter.put("hash", GetInterfaceHash(xRef)); - - bool bInitiallyVisible = true; - if (maRenderState.maInitiallyVisible.contains(pObject)) - bInitiallyVisible = maRenderState.maInitiallyVisible[pObject]; - aJsonWriter.put("initVisible", bInitiallyVisible); - } - } - + aJsonWriter.put("hash", RenderState::getObjectHash(pObject)); + aJsonWriter.put("initVisible", maRenderState.isObjectInitiallyVisible(pObject)); aJsonWriter.put("type", "bitmap"); writeContentNode(aJsonWriter); } diff --git a/slideshow/source/engine/slide/targetpropertiescreator.cxx b/slideshow/source/engine/slide/targetpropertiescreator.cxx index 6ccf2374515a..ed3376cf97c8 100644 --- a/slideshow/source/engine/slide/targetpropertiescreator.cxx +++ b/slideshow/source/engine/slide/targetpropertiescreator.cxx @@ -258,7 +258,8 @@ namespace slideshow::internal // initially. This is currently the only place // where a shape effect influences shape // attributes outside it's effective duration. - bool bVisible = anim::getVisibilityProperty(xAnimateNode); + bool bVisible = false; + anim::getVisibilityProperty(xAnimateNode, bVisible); // if initial anim sets shape visible, set it // to invisible. If we're asked for the final From 51b2f0a1c787b77df843f37fa641f28e5d2ddc66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Tue, 10 Sep 2024 06:29:39 +0200 Subject: [PATCH 221/373] slideshow: lok: correct z-order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit we need to keep the order correct, especially when we have stacked shapes which are animated and some are non-animated. in case: non-anim anim non-anim anim don't allow to join non-animated layers into one Signed-off-by: Szymon Kłos Change-Id: Ic5d94478b691a80fd62853946ebedec075963f44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173116 Reviewed-by: Tomaž Vajngerl Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177236 Tested-by: Jenkins --- sd/qa/unit/tiledrendering/tiledrendering.cxx | 17 ++++++++++++++++- sd/source/ui/tools/SlideshowLayerRenderer.cxx | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 13b94ddfa435..885582758b39 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -3178,11 +3178,26 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); + + debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + } + + { + std::vector pBuffer(nViewWidth * nViewHeight * 4); + bool bIsBitmapLayer = false; + OUString rJsonMsg; + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg)); + CPPUNIT_ASSERT(bIsBitmapLayer); + + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 4") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); - debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); + debugWriteImageToFile(7, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); } { diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index c244142f9d35..3516e901d020 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -164,12 +164,12 @@ public: if (mrRenderState.isObjectInAnimation(pObject)) { + // Animated object has to be only one in the render + mrRenderState.mbSkipAllInThisPass = true; + // Animated object cannot be attached to the previous object if (!mrRenderState.mbFirstObjectInPass) return; - - // Animated object has to be only one in the render - mrRenderState.mbSkipAllInThisPass = true; } if (mrRenderState.meStage == RenderStage::Master && hasFields(pObject) From 7e1ecd89fb3e389bb3d5f331ed178cb76d8d5cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 25 Nov 2024 08:47:31 +0000 Subject: [PATCH 222/373] Labels can just use mnemonic-widget to indicate what they label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the more complex label-for/labelled-by only need to get used when when using something non-standard as a "label" Change-Id: Ibbe13b868622646e20357703e31cfc26e31fac7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177238 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- cui/uiconfig/ui/possizetabpage.ui | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cui/uiconfig/ui/possizetabpage.ui b/cui/uiconfig/ui/possizetabpage.ui index f0f785a97a3c..e57862902047 100644 --- a/cui/uiconfig/ui/possizetabpage.ui +++ b/cui/uiconfig/ui/possizetabpage.ui @@ -234,10 +234,8 @@ False Wi_dth: True + MTR_FLD_WIDTH 0 - - -
    0 @@ -329,9 +327,6 @@ True adjustmentSIZE 2 - - - Enter a width for the selected object. @@ -352,9 +347,6 @@ True adjustmentSIZE1 2 - - - Enter a height for the selected object. @@ -372,10 +364,8 @@ False H_eight: True + MTR_FLD_HEIGHT 0 - - - 0 From 1c49a6d5aab168ca02fdda6d2c27d4ca1fa152f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sat, 23 Nov 2024 19:37:27 +0000 Subject: [PATCH 223/373] cid#1607224 Overflowed return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I297159aec76a497c5082c70adc0c2e45878322a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177240 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- oox/source/vml/vmldrawing.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx index c44b9e426119..69b0557c173b 100644 --- a/oox/source/vml/vmldrawing.cxx +++ b/oox/source/vml/vmldrawing.cxx @@ -235,7 +235,6 @@ sal_Int32 Drawing::getLocalShapeIndex( std::u16string_view rShapeId ) const sal_Int32 nBlockId = (nShapeId - 1) / 1024; BlockIdVector::iterator aIt = ::std::lower_bound( maBlockIds.begin(), maBlockIds.end(), nBlockId ); sal_Int32 nIndex = static_cast< sal_Int32 >( aIt - maBlockIds.begin() ); - assert(nIndex < std::numeric_limits::max() / 1024 -1 && "possible overflow"); // block id not found in set -> register it now (value of nIndex remains valid) if( (aIt == maBlockIds.end()) || (*aIt != nBlockId) ) @@ -245,7 +244,13 @@ sal_Int32 Drawing::getLocalShapeIndex( std::u16string_view rShapeId ) const sal_Int32 nBlockOffset = (nShapeId - 1) % 1024 + 1; // calculate the local shape index - return 1024 * nIndex + nBlockOffset; + sal_Int32 nRet; + if (o3tl::checked_add(1024 * nIndex, nBlockOffset, nRet)) + { + SAL_WARN("oox", "getLocalShapeIndex: overflow on " << 1024 * nIndex << " + " << nBlockOffset); + nRet = -1; + } + return nRet; } const OleObjectInfo* Drawing::getOleObjectInfo( const OUString& rShapeId ) const From 95efd80fcae322a14c5051e8a4455b571db926c5 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 22 Nov 2024 14:10:26 +0100 Subject: [PATCH 224/373] cool#10582 sd lok: insert curve shapes directly Dispatching .uno:Line in LOK mode inserts a line shape with defaults at the center of the current slide, but dispatching .uno:Bezier_Unfilled starts an interactive mode where the preview is not exposed in LOK, so looks weird. .uno:Line works because DrawViewShell::FuPermanent() actives the "create directly" flag for SID_DRAW_LINE. Fix the problem by doing the same for SID_DRAW_BEZIER_NOFILL in the next block: we get a curve shape with reasonable defaults with this. If an interactive curve drawing mode is wanted for LOK in the future, then that would be handled outside LOK anyway, with taking the already drawn curve's properties at UNO command dispatch time. Change-Id: I03feded76578575ecfbd4a0d79c7ca1a31e37093 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177250 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sd/source/ui/view/drviewse.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 7cd214e19331..2b354a104556 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -468,6 +468,10 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) case SID_DRAW_BEZIER_FILL: // BASIC case SID_DRAW_BEZIER_NOFILL: // BASIC { + // Direct mode means no interactive drawing, just insert the shape with reasonable + // defaults -- to be consistent with the line insert case above. + bCreateDirectly = comphelper::LibreOfficeKit::isActive(); + SetCurrentFunction( FuConstructBezierPolygon::Create(this, GetActiveWindow(), mpDrawView.get(), GetDoc(), rReq, bPermanent) ); rReq.Done(); } From 81a6c8704f19a08acb6c56cc39d5f117ee38df75 Mon Sep 17 00:00:00 2001 From: Sahil Gautam Date: Mon, 25 Nov 2024 11:37:31 +0530 Subject: [PATCH 225/373] tdf#85976 Use correct labels in 'Handle Duplicate Records' dialog + 'Records:' to 'Compare by:' + if row is selected in 'Compare:', 'Header:' checkbox should be labeled as 'Data contains column headers' and vice versa for column Change-Id: Ic9dfbab9a5636312c40b6945af3abdcd9b190310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177230 Tested-by: Jenkins Reviewed-by: Sahil Gautam --- sc/inc/strings.hrc | 2 -- sc/source/ui/inc/duplicaterecordsdlg.hxx | 1 - sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx | 11 ++--------- sc/uiconfig/scalc/ui/duplicaterecordsdlg.ui | 7 ++++--- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 7ae3d47b5f43..faaa5e64998b 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -443,8 +443,6 @@ #define STR_DUPLICATERECORDSDLG_NODATAFOUND NC_("STR_DUPLICATERECORDS_NODATAFOUND", "No data found to operate on.") #define STR_DUPLICATERECORDS_DATACONATINSROWHEADERS NC_("STR_DUPLICATERECORDS_DATACONATINSROWHEADERS", "Data contains row headers") #define STR_DUPLICATERECORDS_DATACONATINSCOLUMNHEADERS NC_("STR_DUPLICATERECORDS_DATACONATINSCOLUMNHEADERS", "Data contains column headers") -#define STR_DUPLICATERECORDS_RECORDSROWS NC_("STR_DUPLICATERECORDS_RECORDSROWS", "Rows:") -#define STR_DUPLICATERECORDS_RECORDSCOLUMNS NC_("STR_DUPLICATERECORDS_RECORDSCOLUMNS", "Columns:") #define STR_CONTENT_WITH_UNKNOWN_ENCRYPTION NC_("STR_CONTENT_WITH_UNKNOWN_ENCRYPTION", "Document contains DRM content that is encrypted with an unknown encryption method. Only the un-encrypted content will be shown.") diff --git a/sc/source/ui/inc/duplicaterecordsdlg.hxx b/sc/source/ui/inc/duplicaterecordsdlg.hxx index cee462cebdbb..5977bad41191 100644 --- a/sc/source/ui/inc/duplicaterecordsdlg.hxx +++ b/sc/source/ui/inc/duplicaterecordsdlg.hxx @@ -60,7 +60,6 @@ private: std::unique_ptr m_xRadioRemove; std::unique_ptr m_xCheckList; std::unique_ptr m_xAllChkBtn; - std::unique_ptr m_xRecordsLabel; std::unique_ptr m_xOkBtn; diff --git a/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx b/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx index b626236e0823..f3fe991b92a7 100644 --- a/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx +++ b/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx @@ -40,7 +40,6 @@ ScDuplicateRecordsDlg::ScDuplicateRecordsDlg(weld::Window* pParent, , m_xRadioRemove(m_xBuilder->weld_radio_button("remove")) , m_xCheckList(m_xBuilder->weld_tree_view("checklist")) , m_xAllChkBtn(m_xBuilder->weld_check_button("allcheckbtn")) - , m_xRecordsLabel(m_xBuilder->weld_label("records")) , m_xOkBtn(m_xBuilder->weld_button("okbtn")) , mrCellData(rData) , mrRange(rRange) @@ -123,15 +122,9 @@ void ScDuplicateRecordsDlg::SetDialogData(bool bToggle) void ScDuplicateRecordsDlg::SetDialogLabels() { if (m_xRadioRow->get_active()) - { - m_xIncludesHeaders->set_label(ScResId(STR_DUPLICATERECORDS_DATACONATINSROWHEADERS)); - m_xRecordsLabel->set_label(ScResId(STR_DUPLICATERECORDS_RECORDSCOLUMNS)); - } - else - { m_xIncludesHeaders->set_label(ScResId(STR_DUPLICATERECORDS_DATACONATINSCOLUMNHEADERS)); - m_xRecordsLabel->set_label(ScResId(STR_DUPLICATERECORDS_RECORDSROWS)); - } + else + m_xIncludesHeaders->set_label(ScResId(STR_DUPLICATERECORDS_DATACONATINSROWHEADERS)); } void ScDuplicateRecordsDlg::InsertEntry(const OUString& rTxt, bool bToggle) diff --git a/sc/uiconfig/scalc/ui/duplicaterecordsdlg.ui b/sc/uiconfig/scalc/ui/duplicaterecordsdlg.ui index 3e8f0c88865e..0822c3c3d03f 100644 --- a/sc/uiconfig/scalc/ui/duplicaterecordsdlg.ui +++ b/sc/uiconfig/scalc/ui/duplicaterecordsdlg.ui @@ -93,8 +93,9 @@ True False + start start - Compare by: + Compare: row @@ -296,12 +297,12 @@ - + True False start start - Records: + Compare by: allcheckbtn From c20db9a219699f689d0096fb11fe72d10034c6f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 8 Nov 2024 17:49:52 +0000 Subject: [PATCH 226/373] cid#1607047 Overflowed integer argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I60c991ba32c85ed872c6086104774259d1ac3b24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177239 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sc/source/core/data/column3.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index f540f8fe77be..825d0bb58d02 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -580,10 +580,11 @@ void ScColumn::AttachFormulaCells( sc::StartListeningContext& rCxt, SCROW nRow1, { nRow1 = std::min( nRow1, rCell.GetSharedTopRow()); SCROW nCellLen = rCell.GetSharedLength(); - assert(nCellLen > 0); - if (nRow2 < rCell.GetSharedTopRow() + nCellLen) + // coverity[ tainted_data_return : FALSE ] version 2023.12.2 + const auto nEndRow = rCell.GetSharedTopRow() + nCellLen; + if (nRow2 < nEndRow) { - nRow2 = rCell.GetSharedTopRow() + nCellLen - 1; + nRow2 = nEndRow - 1; bEnlargedDown = true; // Same end row is also enlarged, i.e. doesn't need to be // checked for another group. From 3a00e589cec3d760efa677edfe11c81841d986ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Tue, 10 Sep 2024 09:56:54 +0200 Subject: [PATCH 227/373] slideshow: lok: export bounds for animated layers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Szymon Kłos Change-Id: Iccc0993fd9736842fc3e9783306d21aabc813e5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173121 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177249 Tested-by: Jenkins --- sd/qa/unit/tiledrendering/tiledrendering.cxx | 7 +++++++ sd/source/ui/tools/SlideshowLayerRenderer.cxx | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 885582758b39..4a17fc480ca7 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -3088,6 +3088,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\"")); CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\"")); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0); @@ -3103,6 +3104,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\"")); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); @@ -3117,6 +3119,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\"")); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); @@ -3132,6 +3135,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0); CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\"")); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); @@ -3163,6 +3167,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 2") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"bounds\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); @@ -3179,6 +3184,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0); CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\"")); + CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\"")); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr()); @@ -3194,6 +3200,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 4") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0); + CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"bounds\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0); CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0); diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index 3516e901d020..ffa36854c55f 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -334,6 +334,16 @@ static void writeContentNode(::tools::JsonWriter& aJsonWriter) aJsonWriter.put("checksum", "%IMAGECHECKSUM%"); } +static void writeBoundingBox(::tools::JsonWriter& aJsonWriter, SdrObject* pObject) +{ + auto aContentNode = aJsonWriter.startNode("bounds"); + ::tools::Rectangle aRect = pObject->GetCurrentBoundRect(); + aJsonWriter.put("x", aRect.getX()); + aJsonWriter.put("y", aRect.getY()); + aJsonWriter.put("width", aRect.GetWidth()); + aJsonWriter.put("height", aRect.GetHeight()); +} + void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg) { ::tools::JsonWriter aJsonWriter; @@ -354,6 +364,7 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg) aJsonWriter.put("initVisible", maRenderState.isObjectInitiallyVisible(pObject)); aJsonWriter.put("type", "bitmap"); writeContentNode(aJsonWriter); + writeBoundingBox(aJsonWriter, pObject); } } else From 9f35c2b6cdc50de017aae3585fd9e55b0796d4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 20 Nov 2024 09:49:55 +0000 Subject: [PATCH 228/373] move SdViewOptions options down to ViewShellBase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ViewShellBase is the SfxViewShell and is the analogue of the equivalent writer/calc SfxViewShell's, while a DrawViewShell is one of multiple sd::ViewShells that can exist inside that SfxViewShell Issue: * When creating new shell instances, background color is fetched from application configuration. * When multiple users are active on an Impress document, if one switches to notes view, a new shell is created. * Background color for the new shell is fetched from app colors. * If another user has switched to dark mode, the user which just switched to notes view, will see dark mode for their background. Moving the SdViewOptions options down the ViewShellBase means that multiple sd::ViewShells hosted within that ViewShellBase share the same view settings. Change-Id: Id875260dda89311ab8029ead08b47f80fd14604f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177253 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sd/inc/viewopt.hxx | 4 +- sd/source/ui/inc/DrawViewShell.hxx | 4 +- sd/source/ui/inc/ViewShellBase.hxx | 4 ++ sd/source/ui/view/ViewShellBase.cxx | 66 ++++++++++++++--------------- sd/source/ui/view/drviewsa.cxx | 1 - sd/source/ui/view/drviewsj.cxx | 11 +++++ sd/source/ui/view/drviewsk.cxx | 19 ++++++--- 7 files changed, 63 insertions(+), 46 deletions(-) diff --git a/sd/inc/viewopt.hxx b/sd/inc/viewopt.hxx index eb9f16513624..cf75d6f06156 100644 --- a/sd/inc/viewopt.hxx +++ b/sd/inc/viewopt.hxx @@ -23,12 +23,14 @@ /// View options for the current view struct SdViewOptions { + SdViewOptions(); + // The color of the area behind the slide (used to be called "Wiese") Color mnAppBackgroundColor; // The color of the document background Color mnDocBackgroundColor; // The name of the color scheme - OUString msColorSchemeName = u"Default"_ustr; + OUString msColorSchemeName; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 989582749c0a..f382eff431d3 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -383,7 +383,8 @@ public: bool IsInSwitchPage() const { return mbIsInSwitchPage; } - const SdViewOptions& GetViewOptions() const { return maViewOptions; } + const SdViewOptions& GetViewOptions() const; + void SetViewOptions(const SdViewOptions& rOptions); //move this method to ViewShell. //void NotifyAccUpdate(); @@ -508,7 +509,6 @@ private: std::unique_ptr mpAnnotationManager; std::unique_ptr mpViewOverlayManager; std::vector> m_ExternalEdits; - SdViewOptions maViewOptions; css::uno::Reference mxSlideShow; }; diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx index 1e1517eb6550..921865624ff7 100644 --- a/sd/source/ui/inc/ViewShellBase.hxx +++ b/sd/source/ui/inc/ViewShellBase.hxx @@ -24,6 +24,7 @@ #include class SdDrawDocument; +struct SdViewOptions; class SfxRequest; namespace sd::tools { @@ -227,6 +228,9 @@ public: void setLOKVisibleArea(const ::tools::Rectangle& rArea) { maLOKVisibleArea = rArea; } virtual ::tools::Rectangle getLOKVisibleArea() const override { return maLOKVisibleArea; } + const SdViewOptions& GetViewOptions() const; + void SetViewOptions(const SdViewOptions& rOptions) const; + protected: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 37d32df82f0f..bfbff51d1389 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -115,6 +115,8 @@ namespace sd { class ViewShellBase::Implementation { public: + SdViewOptions maViewOptions; + /** Main controller of the view shell. During the switching from one stacked shell to another this pointer may be NULL. */ @@ -922,6 +924,16 @@ OUString ViewShellBase::GetInitialViewShellType() const return sRequestedView; } +const SdViewOptions& ViewShellBase::GetViewOptions() const +{ + return mpImpl->maViewOptions; +} + +void ViewShellBase::SetViewOptions(const SdViewOptions& rOptions) const +{ + mpImpl->maViewOptions = rOptions; +} + std::shared_ptr const & ViewShellBase::GetEventMultiplexer() const { OSL_ASSERT(mpImpl != nullptr); @@ -1138,48 +1150,24 @@ void ViewShellBase::NotifyCursor(SfxViewShell* pOtherShell) const ::Color ViewShellBase::GetColorConfigColor(svtools::ColorConfigEntry nColorType) const { - auto pViewShell = GetMainViewShell().get(); - if (DrawViewShell* pCurrentDrawShell = dynamic_cast(pViewShell)) + Color aColor; + + const SdViewOptions& rViewOptions = GetViewOptions(); + switch (nColorType) { - const SdViewOptions& rViewOptions = pCurrentDrawShell->GetViewOptions(); - switch (nColorType) + case svtools::ColorConfigEntry::DOCCOLOR: { - case svtools::ColorConfigEntry::DOCCOLOR: - { - return rViewOptions.mnDocBackgroundColor; - } - // Should never be called for an unimplemented color type - default: - { - O3TL_UNREACHABLE; - } + aColor = rViewOptions.mnDocBackgroundColor; + break; } - } - // IASS: also need to handle OutlineViewShell - else if (nullptr != dynamic_cast(pViewShell)) - { - switch (nColorType) + // Should never be called for an unimplemented color type + default: { - case svtools::ColorConfigEntry::DOCCOLOR: - { - // IASS: OutlineViewShell does not have any SdViewOptions and no access - // to the (currently not shown) DrawViewShell. If that should be - // needed it may be added. For now, assume that DOCCOLOR is COL_WHITE - return COL_WHITE; - } - // Should never be called for an unimplemented color type - default: - { - O3TL_UNREACHABLE; - } + O3TL_UNREACHABLE; } } - SAL_WARN("sd", "Unknown ViewShell used: Consider adding a case for this to get correct colors, COL_WHITE is used as fallback."); - // NOTE: This returned COL_BLACK. For unknown ViewShells I would assume that - // returning COL_WHITE would be safer - a better default for an office - // application dealing with Paper as target - return COL_WHITE; + return aColor; } //===== ViewShellBase::Implementation ========================================= @@ -1566,6 +1554,14 @@ void CurrentPageSetter::operator() (bool) } // end of anonymous namespace +SdViewOptions::SdViewOptions() + : msColorSchemeName(u"Default"_ustr) +{ + const svtools::ColorConfig& rColorConfig = SdModule::get()->GetColorConfig(); + mnAppBackgroundColor = rColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor; + mnDocBackgroundColor = rColorConfig.GetColorValue(svtools::DOCCOLOR).nColor; +} + //===== FocusForwardingWindow ================================================= namespace sd { diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 78e86ff87e8a..a62467902968 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -134,7 +134,6 @@ DrawViewShell::DrawViewShell( ViewShellBase& rViewShellBase, vcl::Window* pParen ConfigureAppBackgroundColor(); SdModule* mod = SdModule::get(); mod->GetColorConfig().AddListener(this); - maViewOptions.mnDocBackgroundColor = mod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; if (comphelper::LibreOfficeKit::isActive()) { diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx index 6422747d03e8..934a4e475d21 100644 --- a/sd/source/ui/view/drviewsj.cxx +++ b/sd/source/ui/view/drviewsj.cxx @@ -38,6 +38,7 @@ #include #include #include +#include using namespace com::sun::star; @@ -563,6 +564,16 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) } } +const SdViewOptions& DrawViewShell::GetViewOptions() const +{ + return GetViewShellBase().GetViewOptions(); +} + +void DrawViewShell::SetViewOptions(const SdViewOptions& rOptions) +{ + GetViewShellBase().SetViewOptions(rOptions); +} + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drviewsk.cxx b/sd/source/ui/view/drviewsk.cxx index 54cb0ac55aca..3cab2bb1cea0 100644 --- a/sd/source/ui/view/drviewsk.cxx +++ b/sd/source/ui/view/drviewsk.cxx @@ -30,18 +30,21 @@ void DrawViewShell::ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, Co svtools::ColorConfig *pColorConfig = dynamic_cast(pCb); ConfigureAppBackgroundColor(pColorConfig); if (!comphelper::LibreOfficeKit::isActive()) - maViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; + { + SdViewOptions aViewOptions = GetViewOptions(); + aViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; + SetViewOptions(aViewOptions); + } else { SfxViewShell* pCurrentShell = SfxViewShell::Current(); ViewShellBase* pShellBase = dynamic_cast(pCurrentShell); if (!pShellBase) return; - if (DrawViewShell* pCurrentDrawShell = dynamic_cast(pShellBase->GetMainViewShell().get())) - { - pCurrentDrawShell->maViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; - pCurrentDrawShell->maViewOptions.msColorSchemeName = svtools::ColorConfig::GetCurrentSchemeName(); - } + SdViewOptions aViewOptions = pShellBase->GetViewOptions(); + aViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; + aViewOptions.msColorSchemeName = svtools::ColorConfig::GetCurrentSchemeName(); + pShellBase->SetViewOptions(aViewOptions); SdXImpressDocument* pDoc = comphelper::getFromUnoTunnel(pCurrentShell->GetCurrentDocument()); SfxLokHelper::notifyViewRenderState(pCurrentShell, pDoc); Color aFillColor(pColorConfig->GetColorValue(svtools::APPBACKGROUND).nColor); @@ -60,7 +63,9 @@ void DrawViewShell::ConfigureAppBackgroundColor( svtools::ColorConfig *pColorCon // tdf#87905 Use darker background color for master view if (meEditMode == EditMode::MasterPage) aFillColor.DecreaseLuminance( 64 ); - maViewOptions.mnAppBackgroundColor = aFillColor; + SdViewOptions aViewOptions = GetViewOptions(); + aViewOptions.mnAppBackgroundColor = aFillColor; + SetViewOptions(aViewOptions); } void DrawViewShell::destroyXSlideShowInstance() From ae55831f16584aa2a727aa684df57f590bdab0e9 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 25 Nov 2024 10:25:19 +0100 Subject: [PATCH 229/373] a11y: Make param const to avoid const_cast in caller Make the `pWindow` param for `ImplFindDlgCtrlWindow` a const pointer, which removes the need to `const_cast` when calling the function in Window::getLegacyNonLayoutAccessibleRelationMemberOf. Change-Id: I2225f5c4be33060c1e3fddd5e83760e68856585d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177245 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/source/window/dlgctrl.cxx | 4 ++-- vcl/source/window/dlgctrl.hxx | 5 +++-- vcl/source/window/legacyaccessibility.cxx | 7 ++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index ac75333d9011..c5575ef6e5fc 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -324,8 +324,8 @@ vcl::Window* Window::ImplGetDlgWindow( sal_uInt16 nIndex, GetDlgWindowType nType } /* namespace vcl */ -vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pParent, vcl::Window* pWindow, sal_uInt16& rIndex, - sal_uInt16& rFormStart, sal_uInt16& rFormEnd ) +vcl::Window* ImplFindDlgCtrlWindow(vcl::Window* pParent, const vcl::Window* pWindow, + sal_uInt16& rIndex, sal_uInt16& rFormStart, sal_uInt16& rFormEnd) { vcl::Window* pSWindow; vcl::Window* pSecondWindow = nullptr; diff --git a/vcl/source/window/dlgctrl.hxx b/vcl/source/window/dlgctrl.hxx index 94af911c7818..50d7ee1f2bab 100644 --- a/vcl/source/window/dlgctrl.hxx +++ b/vcl/source/window/dlgctrl.hxx @@ -23,8 +23,9 @@ vcl::Window* ImplGetChildWindow( vcl::Window* pParent, sal_uInt16 n, sal_uInt16& nIndex, bool bTestEnable ); -vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pParent, vcl::Window* pWindow, sal_uInt16& rIndex, - sal_uInt16& rFormStart, sal_uInt16& rFormEnd ); +vcl::Window* ImplFindDlgCtrlWindow(vcl::Window* pParent, const vcl::Window* pWindow, + sal_uInt16& rIndex, sal_uInt16& rFormStart, + sal_uInt16& rFormEnd); vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_Unicode cCharCode, sal_uInt16 nFormStart, sal_uInt16 nFormEnd, bool bCheckEnable = true ); diff --git a/vcl/source/window/legacyaccessibility.cxx b/vcl/source/window/legacyaccessibility.cxx index a0f4aff33919..58410ed66d29 100644 --- a/vcl/source/window/legacyaccessibility.cxx +++ b/vcl/source/window/legacyaccessibility.cxx @@ -200,11 +200,8 @@ Window* Window::getLegacyNonLayoutAccessibleRelationMemberOf() const // is directly before the control // get form start and form end and index of this control sal_uInt16 nIndex, nFormStart, nFormEnd; - Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, - const_cast(this), - nIndex, - nFormStart, - nFormEnd ); + Window* pSWindow + = ::ImplFindDlgCtrlWindow(pFrameWindow, this, nIndex, nFormStart, nFormEnd); if( pSWindow && nIndex != nFormStart ) { if( GetType() == WindowType::PUSHBUTTON || From d2587b5646833b49c9cfc12ea7eaa013a1fcf7f1 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 25 Nov 2024 09:34:46 +0100 Subject: [PATCH 230/373] gtk3: Drop gtk+-unix-print-3.0 from configure.ac Unused since commit ed07ec7606cb24cccaf6b7b81b2bd308debaa2e6 Date: Sun Dec 20 16:49:12 2020 +0000 drop never completed GtkSalPrinter Change-Id: Iacbf84449175863e5a6ad09f6946b3bd3b503a9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177237 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ebfff94178b5..c02897469211 100644 --- a/configure.ac +++ b/configure.ac @@ -12248,7 +12248,7 @@ if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = add_warning 'Non-system cairo combined with gtk3 is known to cause trouble (eg. broken image in the splashscreen). Use --with-system-cairo unless you know what you are doing.' fi : ${with_system_cairo:=yes} - PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.20 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 atk >= 2.28.1 cairo) + PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.20 gmodule-no-export-2.0 glib-2.0 >= 2.38 atk >= 2.28.1 cairo) GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" FilterLibs "${GTK3_LIBS}" From 579d0a72a3df1e292d1d1a049247500d003ff4e3 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 25 Nov 2024 11:40:34 +0100 Subject: [PATCH 231/373] a11y: Move identical implementations to base class Instead of having a purely virtual VCLXAccessibleBox::IsValid that all subclasses implement the same way, deduplicate this by moving the implementation to the VCLXAccessibleBox base class. Change-Id: I354bf3d0be6751a165b373c06b951c6f0b63480b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177252 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- accessibility/inc/standard/vclxaccessiblebox.hxx | 2 +- accessibility/inc/standard/vclxaccessiblecombobox.hxx | 2 -- .../inc/standard/vclxaccessibledropdowncombobox.hxx | 1 - .../inc/standard/vclxaccessibledropdownlistbox.hxx | 2 -- accessibility/inc/standard/vclxaccessiblelistbox.hxx | 2 -- accessibility/source/standard/vclxaccessiblebox.cxx | 5 +++++ accessibility/source/standard/vclxaccessiblecombobox.cxx | 6 ------ .../source/standard/vclxaccessibledropdowncombobox.cxx | 6 ------ .../source/standard/vclxaccessibledropdownlistbox.cxx | 5 ----- accessibility/source/standard/vclxaccessiblelistbox.cxx | 6 ------ 10 files changed, 6 insertions(+), 31 deletions(-) diff --git a/accessibility/inc/standard/vclxaccessiblebox.hxx b/accessibility/inc/standard/vclxaccessiblebox.hxx index 3825be0d4f22..2d0f0b46e8f7 100644 --- a/accessibility/inc/standard/vclxaccessiblebox.hxx +++ b/accessibility/inc/standard/vclxaccessiblebox.hxx @@ -107,7 +107,7 @@ protected: /** Returns true when the object is valid. */ - virtual bool IsValid() const = 0; + bool IsValid() const; virtual void ProcessWindowChildEvent (const VclWindowEvent& rVclWindowEvent) override; virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) override; diff --git a/accessibility/inc/standard/vclxaccessiblecombobox.hxx b/accessibility/inc/standard/vclxaccessiblecombobox.hxx index 67c2ef93b139..6294e7df91d1 100644 --- a/accessibility/inc/standard/vclxaccessiblecombobox.hxx +++ b/accessibility/inc/standard/vclxaccessiblecombobox.hxx @@ -39,8 +39,6 @@ public: private: virtual ~VCLXAccessibleComboBox() override = default; - - virtual bool IsValid() const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibledropdowncombobox.hxx b/accessibility/inc/standard/vclxaccessibledropdowncombobox.hxx index 76c1c14594e9..2527b2fbc2c8 100644 --- a/accessibility/inc/standard/vclxaccessibledropdowncombobox.hxx +++ b/accessibility/inc/standard/vclxaccessibledropdowncombobox.hxx @@ -41,7 +41,6 @@ public: private: virtual ~VCLXAccessibleDropDownComboBox() override = default; - virtual bool IsValid() const override; virtual void ProcessWindowEvent(const VclWindowEvent& rVclWindowEvent) override; }; diff --git a/accessibility/inc/standard/vclxaccessibledropdownlistbox.hxx b/accessibility/inc/standard/vclxaccessibledropdownlistbox.hxx index d971e80ccaa9..3a314ad09434 100644 --- a/accessibility/inc/standard/vclxaccessibledropdownlistbox.hxx +++ b/accessibility/inc/standard/vclxaccessibledropdownlistbox.hxx @@ -40,8 +40,6 @@ public: private: virtual ~VCLXAccessibleDropDownListBox() override = default; - - virtual bool IsValid() const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblelistbox.hxx b/accessibility/inc/standard/vclxaccessiblelistbox.hxx index 9405947b2b5b..ed2cd05efc56 100644 --- a/accessibility/inc/standard/vclxaccessiblelistbox.hxx +++ b/accessibility/inc/standard/vclxaccessiblelistbox.hxx @@ -38,8 +38,6 @@ public: private: virtual ~VCLXAccessibleListBox() override = default; - - virtual bool IsValid() const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx index 43b9967ed51a..cee19613a396 100644 --- a/accessibility/source/standard/vclxaccessiblebox.cxx +++ b/accessibility/source/standard/vclxaccessiblebox.cxx @@ -54,6 +54,11 @@ VCLXAccessibleBox::VCLXAccessibleBox (VCLXWindow* pVCLWindow, BoxType aType, boo VCLXAccessibleBox::~VCLXAccessibleBox() {} +bool VCLXAccessibleBox::IsValid() const +{ + return GetWindow(); +} + void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) { uno::Any aOldValue, aNewValue; diff --git a/accessibility/source/standard/vclxaccessiblecombobox.cxx b/accessibility/source/standard/vclxaccessiblecombobox.cxx index 8b239996599d..5e0c77304ad8 100644 --- a/accessibility/source/standard/vclxaccessiblecombobox.cxx +++ b/accessibility/source/standard/vclxaccessiblecombobox.cxx @@ -30,12 +30,6 @@ VCLXAccessibleComboBox::VCLXAccessibleComboBox (VCLXWindow* pVCLWindow) { } - -bool VCLXAccessibleComboBox::IsValid() const -{ - return GetWindow(); -} - // XServiceInfo OUString VCLXAccessibleComboBox::getImplementationName() diff --git a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx index 903e704b92bf..5dc7073e7f0b 100644 --- a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx +++ b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx @@ -33,12 +33,6 @@ VCLXAccessibleDropDownComboBox::VCLXAccessibleDropDownComboBox (VCLXWindow* pVCL { } - -bool VCLXAccessibleDropDownComboBox::IsValid() const -{ - return GetWindow(); -} - void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) { switch ( rVclWindowEvent.GetId() ) diff --git a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx index 5d1c206f1737..360eab0dc26c 100644 --- a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx +++ b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx @@ -30,11 +30,6 @@ VCLXAccessibleDropDownListBox::VCLXAccessibleDropDownListBox (VCLXWindow* pVCLWi { } -bool VCLXAccessibleDropDownListBox::IsValid() const -{ - return GetWindow(); -} - // XServiceInfo OUString VCLXAccessibleDropDownListBox::getImplementationName() { diff --git a/accessibility/source/standard/vclxaccessiblelistbox.cxx b/accessibility/source/standard/vclxaccessiblelistbox.cxx index 1b4d444e6ca9..2f9392ab0341 100644 --- a/accessibility/source/standard/vclxaccessiblelistbox.cxx +++ b/accessibility/source/standard/vclxaccessiblelistbox.cxx @@ -29,12 +29,6 @@ VCLXAccessibleListBox::VCLXAccessibleListBox (VCLXWindow* pVCLWindow) { } - -bool VCLXAccessibleListBox::IsValid() const -{ - return GetWindow(); -} - // XServiceInfo OUString VCLXAccessibleListBox::getImplementationName() From 32d81ed85c581134dbbfe04707863a59f0101a1a Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 25 Nov 2024 12:03:33 +0100 Subject: [PATCH 232/373] PVS: V560 A part of conditional expression is always true Change-Id: I1c84f84f5d656e2a11f5b3a594f7f19641ff51ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177255 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sfx2/source/control/dispatch.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index e704d324a355..29fa907ae32e 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1114,7 +1114,7 @@ void SfxDispatcher::Update_Impl( bool bForce ) bool bIsActive = false; SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl(); - if ( !bIsActive && this == pActDispat ) + if ( this == pActDispat ) bIsActive = true; Update_Impl_( bUIActive, !bIsIPActive, bIsIPActive, pWorkWin ); @@ -1140,7 +1140,7 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne SfxWorkWindow *pWorkWin = xImp->pFrame->GetFrame().GetWorkWindow_Impl(); bool bIsActive = false; SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl(); - if ( pActDispat && !bIsActive ) + if ( pActDispat ) { if ( this == pActDispat ) bIsActive = true; @@ -1276,7 +1276,7 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne bool bIsTaskActive = false; SfxDispatcher *pActDispatcher = pTaskWin->GetBindings().GetDispatcher_Impl(); - if ( pActDispatcher && !bIsTaskActive ) + if ( pActDispatcher ) { if ( this == pActDispatcher ) bIsTaskActive = true; From 93362fec3e5cb3a8e009d518bd1325fb750b3c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 25 Nov 2024 11:16:43 +0000 Subject: [PATCH 233/373] fix: Gtk-CRITICAL gtk_label_set_label: assertion 'GTK_IS_LABEL (label)' failed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I45cbfbef038653e1e99e9b2f8907a1739d6c2214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177257 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- cui/uiconfig/ui/colorconfigwin.ui | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/cui/uiconfig/ui/colorconfigwin.ui b/cui/uiconfig/ui/colorconfigwin.ui index 5baa136e7757..8196a72668e2 100644 --- a/cui/uiconfig/ui/colorconfigwin.ui +++ b/cui/uiconfig/ui/colorconfigwin.ui @@ -50,6 +50,7 @@ True 0 True + @@ -83,6 +84,7 @@ end 0 True + @@ -123,6 +125,7 @@ end 0 True + @@ -156,6 +159,7 @@ end 0 True + @@ -196,6 +200,7 @@ end 0 True + @@ -231,6 +236,7 @@ end 0 True + @@ -274,6 +280,7 @@ end 0 True + @@ -314,6 +321,7 @@ end 0 True + @@ -346,6 +354,7 @@ end 0 True + @@ -381,6 +390,7 @@ end 0 True + @@ -456,6 +466,7 @@ True 0 True + @@ -491,6 +502,7 @@ end 0 True + @@ -534,6 +546,7 @@ end 0 True + @@ -574,6 +587,7 @@ end 0 True + @@ -607,6 +621,7 @@ end 0 True + @@ -647,6 +662,7 @@ end 0 True + @@ -679,6 +695,7 @@ end 0 True + @@ -711,6 +728,7 @@ end 0 True + @@ -743,6 +761,7 @@ end 0 True + @@ -775,6 +794,7 @@ end 0 True + @@ -842,6 +862,7 @@ True 0 True + @@ -874,6 +895,7 @@ end 0 True + @@ -906,6 +928,7 @@ end 0 True + @@ -938,6 +961,7 @@ end 0 True + @@ -970,6 +994,7 @@ end 0 True + @@ -987,6 +1012,7 @@ end 0 True + @@ -1019,6 +1045,7 @@ end 0 True + @@ -1051,6 +1078,7 @@ end 0 True + @@ -1083,6 +1111,7 @@ end 0 True + @@ -1115,6 +1144,7 @@ end 0 True + @@ -1147,6 +1177,7 @@ end 0 True + @@ -1179,6 +1210,7 @@ end 0 True + @@ -1229,6 +1261,7 @@ end 0 True + @@ -1272,6 +1305,7 @@ end 0 True + @@ -1297,6 +1331,7 @@ end 0 True + @@ -1350,6 +1385,7 @@ True 0 True + @@ -1407,6 +1443,7 @@ True 0 True + @@ -1489,6 +1526,7 @@ True 0 True + @@ -1522,6 +1560,7 @@ True 0 True + @@ -1555,6 +1594,7 @@ True 0 True + @@ -1588,6 +1628,7 @@ True 0 True + @@ -1621,6 +1662,7 @@ True 0 True + @@ -1654,6 +1696,7 @@ True 0 True + @@ -1687,6 +1730,7 @@ True 0 True + @@ -1720,6 +1764,7 @@ True 0 True + @@ -1753,6 +1798,7 @@ True 0 True + @@ -1805,6 +1851,7 @@ True 0 True + @@ -1837,6 +1884,7 @@ end 0 True + @@ -1869,6 +1917,7 @@ end 0 True + @@ -1901,6 +1950,7 @@ end 0 True + @@ -1933,6 +1983,7 @@ end 0 True + @@ -1965,6 +2016,7 @@ end 0 True + @@ -1997,6 +2049,7 @@ end 0 True + @@ -2029,6 +2082,7 @@ end 0 True + @@ -2096,6 +2150,7 @@ True 0 True + @@ -2128,6 +2183,7 @@ end 0 True + @@ -2160,6 +2216,7 @@ end 0 True + @@ -2192,6 +2249,7 @@ end 0 True + @@ -2224,6 +2282,7 @@ end 0 True + @@ -2256,6 +2315,7 @@ end 0 True + @@ -2288,6 +2348,7 @@ end 0 True + @@ -2355,6 +2416,7 @@ True 0 True + @@ -2402,6 +2464,7 @@ end 0 True + @@ -2434,6 +2497,7 @@ end 0 True + @@ -2466,6 +2530,7 @@ end 0 True + From afa42fcd26d9d8677b246fcc4485a11c50d5d67d Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 25 Nov 2024 11:52:57 +0100 Subject: [PATCH 234/373] PVS: V547 Expression 'pOldSelFly' is always true. Since commit 142dc93d9ad793e036baa5573aea31cb6f416f57 Author: Michael Stahl Date: Mon Oct 26 16:41:29 2020 +0100 (related: tdf#131679) sw: only unmark if this SwFlyFrame is marked Change-Id: Ia916161d336dad3d06e9df0c5747fda78dbd404c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177254 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- sw/source/core/layout/fly.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index ae7fdfae4326..98e10b4d1c83 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -506,13 +506,10 @@ void SwFlyFrame::FinitDrawObj() if (SwFEShell *const pFEShell = dynamic_cast(&rCurrentShell)) { // tdf#131679 move any cursor out of fly rCurrentShell.Imp()->GetDrawView()->UnmarkAll(); - if (pOldSelFly) - { - SwPaM const temp(ResolveFlyAnchor(*pOldSelFly->GetFormat())); - pFEShell->SetSelection(temp); - // could also call SetCursor() like SwFEShell::SelectObj() - // does, but that would access layout a bit much... - } + SwPaM const temp(ResolveFlyAnchor(*pOldSelFly->GetFormat())); + pFEShell->SetSelection(temp); + // could also call SetCursor() like SwFEShell::SelectObj() + // does, but that would access layout a bit much... } else { From a3152312aca05b4ac0afd9f1640ba04c8ddbafce Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 25 Nov 2024 10:30:09 +0100 Subject: [PATCH 235/373] a11y: Make ImplGetLabeledBy param const and drop const_cast Change-Id: I7b9d61a5a6752985d17633f2a1aff80d86a7011a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177246 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/source/window/legacyaccessibility.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vcl/source/window/legacyaccessibility.cxx b/vcl/source/window/legacyaccessibility.cxx index 58410ed66d29..73195b286654 100644 --- a/vcl/source/window/legacyaccessibility.cxx +++ b/vcl/source/window/legacyaccessibility.cxx @@ -106,7 +106,7 @@ Window* Window::getLegacyNonLayoutAccessibleRelationLabelFor() const return pWindow; } -static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Window* pLabeled ) +static Window* ImplGetLabeledBy(Window* pFrameWindow, WindowType nMyType, const Window* pLabeled) { Window* pWindow = nullptr; if (pFrameWindow && nMyType != WindowType::GROUPBOX && nMyType != WindowType::FIXEDLINE) @@ -175,9 +175,9 @@ Window* Window::getLegacyNonLayoutAccessibleRelationLabeledBy() const // #i100833# MT 2010/02: Group box and fixed lines can also label a fixed text. // See tools/options/print for example. - Window* pWindow = ImplGetLabeledBy( pFrameWindow, GetType(), const_cast(this) ); + Window* pWindow = ImplGetLabeledBy(pFrameWindow, GetType(), this); if( ! pWindow && mpWindowImpl->mpRealParent ) - pWindow = ImplGetLabeledBy( mpWindowImpl->mpRealParent, GetType(), const_cast(this) ); + pWindow = ImplGetLabeledBy(mpWindowImpl->mpRealParent, GetType(), this); return pWindow; } From 4401a0ee3efcf3a13d4ae83291f186aaf4c994e5 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 25 Nov 2024 10:32:24 +0100 Subject: [PATCH 236/373] vcl: Use non-const local var instead of const_casting later Change-Id: I34ddf601a4f48aa894e32ae0842fd30f4cfe823b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177247 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/source/window/dlgctrl.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index c5575ef6e5fc..338b676257f6 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -76,7 +76,7 @@ static vcl::Window* ImplGetCurTabWindow(const vcl::Window* pWindow) // Check if the TabPage is a Child of the TabControl and still exists (by // walking all child windows); because it could be that the TabPage has been // destroyed already by a Dialog-Dtor, event that the TabControl still exists. - const TabPage* pTempTabPage = pTabControl->GetTabPage(pTabControl->GetCurPageId()); + TabPage* pTempTabPage = pTabControl->GetTabPage(pTabControl->GetCurPageId()); if (pTempTabPage) { vcl::Window* pTempWindow = pTabControl->GetWindow(GetWindowType::FirstChild); @@ -84,7 +84,7 @@ static vcl::Window* ImplGetCurTabWindow(const vcl::Window* pWindow) { if (pTempWindow->ImplGetWindow() == pTempTabPage) { - return const_cast(pTempTabPage); + return pTempTabPage; } pTempWindow = nextLogicalChildOfParent(pTabControl, pTempWindow); } From ba3ac4735deeda1332f9c716a6f1b5f6cd4c9c4a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 25 Nov 2024 10:35:13 +0100 Subject: [PATCH 237/373] a11y: Avoid const_cast in Window::getLegacyNonLayoutAccessibleRelationLabelFor Make the ImplGetLabelFor param const, so the const `this` can just be passed to it as is. Change-Id: Ie6f0c5100cc67050012d9165b436cbd76550d8d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177248 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/source/window/legacyaccessibility.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vcl/source/window/legacyaccessibility.cxx b/vcl/source/window/legacyaccessibility.cxx index 73195b286654..dc3275ff84ff 100644 --- a/vcl/source/window/legacyaccessibility.cxx +++ b/vcl/source/window/legacyaccessibility.cxx @@ -25,7 +25,7 @@ using namespace ::com::sun::star; -static vcl::Window* ImplGetLabelFor( vcl::Window* pFrameWindow, WindowType nMyType, vcl::Window* pLabel, sal_Unicode nAccel ) +static vcl::Window* ImplGetLabelFor(vcl::Window* pFrameWindow, WindowType nMyType, const vcl::Window* pLabel, sal_Unicode nAccel) { vcl::Window* pWindow = nullptr; @@ -100,9 +100,9 @@ Window* Window::getLegacyNonLayoutAccessibleRelationLabelFor() const sal_Unicode nAccel = getAccel( GetText() ); - Window* pWindow = ImplGetLabelFor( pFrameWindow, GetType(), const_cast(this), nAccel ); + Window* pWindow = ImplGetLabelFor(pFrameWindow, GetType(), this, nAccel); if( ! pWindow && mpWindowImpl->mpRealParent ) - pWindow = ImplGetLabelFor( mpWindowImpl->mpRealParent, GetType(), const_cast(this), nAccel ); + pWindow = ImplGetLabelFor(mpWindowImpl->mpRealParent, GetType(), this, nAccel); return pWindow; } From 4fef75d4c8798dd5ebff1c6bd66993665602507d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 25 Nov 2024 13:45:39 +0100 Subject: [PATCH 238/373] sw: fix property set implementation of SwXTextRange RANGE_IS_SECTION Use cursor that includes section nodes, the core implementation should not need start/end to be a text node. Fix one case in SwDoc::ResetAttrs() where a text node is expected. (regression from commit 7ab349296dac79dad3fec09f60348efcbb9ea17e) Change-Id: I56960b5d233ced02703a7c522ebe6afa3347cd25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177259 Tested-by: Jenkins Reviewed-by: Michael Stahl --- .../extras/unowriter/data/section-table.fodt | 162 ++++++++++++++++++ sw/qa/extras/unowriter/unowriter.cxx | 31 ++++ sw/source/core/doc/docfmt.cxx | 3 +- sw/source/core/unocore/unoobj2.cxx | 24 +-- 4 files changed, 207 insertions(+), 13 deletions(-) create mode 100644 sw/qa/extras/unowriter/data/section-table.fodt diff --git a/sw/qa/extras/unowriter/data/section-table.fodt b/sw/qa/extras/unowriter/data/section-table.fodt new file mode 100644 index 000000000000..4f46ac086c91 --- /dev/null +++ b/sw/qa/extras/unowriter/data/section-table.fodt @@ -0,0 +1,162 @@ + + + GCC2024-11-25T12:23:18.3609789502024-11-25T12:24:38.999591414GCCPT1M22S1LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/10f916791e49306b51a6a299739b130fc2129de1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Table in section + + + + + + + + + + + + + + + + Outside section + + + \ No newline at end of file diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 75f034a73773..51bd211a0a87 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -562,6 +562,37 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorCopyTable) xCursor->getString()); } +CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorProperties) +{ + createSwDoc("section-table.fodt"); + + uno::Reference const xTextSectionsSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference const xSections( + xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount()); + + uno::Reference const xSection(xSections->getByIndex(0), uno::UNO_QUERY); + uno::Reference const xAnchor(xSection->getAnchor()); + uno::Reference const xAnchorProp(xAnchor, uno::UNO_QUERY); + + // the problem was that the property set didn't work + auto xSecFromProp = getProperty>(xAnchorProp, "TextSection"); + CPPUNIT_ASSERT_EQUAL(xSection, xSecFromProp); + + xAnchorProp->setPropertyValue("CharHeight", uno::Any(float(64))); + CPPUNIT_ASSERT_EQUAL(float(64), getProperty(xAnchorProp, "CharHeight")); + uno::Reference const xAnchorState(xAnchor, uno::UNO_QUERY); + // TODO: why does this return DEFAULT_VALUE instead of DIRECT_VALUE? + CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, + xAnchorState->getPropertyState("CharHeight")); + CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, + xAnchorState->getPropertyStates({ "CharHeight" })[0]); + CPPUNIT_ASSERT_EQUAL(float(12), xAnchorState->getPropertyDefault("CharHeight").get()); + xAnchorState->setPropertyToDefault("CharHeight"); + CPPUNIT_ASSERT_EQUAL(float(12), getProperty(xAnchorProp, "CharHeight")); +} + CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTextRangeInTable) { createSwDoc("bookmarkintable.fodt"); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 1e10a532c2a9..6b755eafc1af 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -364,7 +364,8 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, ++aTmpStt; } - if( pEnd->GetContentIndex() == pEnd->GetNode().GetContentNode()->Len() ) + if (!pEnd->GetNode().IsContentNode() + || pEnd->GetContentIndex() == pEnd->GetNode().GetContentNode()->Len()) { // set up a later, and all CharFormatAttr -> TextFormatAttr ++aTmpEnd; diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 4a3cd81c3c7f..d2910db91710 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1470,12 +1470,12 @@ SwXTextRange::setPropertyValue( { SolarMutexGuard aGuard; - if (!m_pMark) + if (!m_pMark && (m_eRangePosition != RANGE_IS_SECTION || !m_pTableOrSectionFormat)) { throw uno::RuntimeException(u"range has no mark (table?)"_ustr); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); SwUnoCursorHelper::SetPropertyValue(aPaM, m_rPropSet, rPropertyName, rValue); } @@ -1485,12 +1485,12 @@ SwXTextRange::getPropertyValue(const OUString& rPropertyName) { SolarMutexGuard aGuard; - if (!m_pMark) + if (!m_pMark && (m_eRangePosition != RANGE_IS_SECTION || !m_pTableOrSectionFormat)) { throw uno::RuntimeException(u"range has no mark (table?)"_ustr); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); return SwUnoCursorHelper::GetPropertyValue(aPaM, m_rPropSet, rPropertyName); } @@ -1532,12 +1532,12 @@ SwXTextRange::getPropertyState(const OUString& rPropertyName) { SolarMutexGuard aGuard; - if (!m_pMark) + if (!m_pMark && (m_eRangePosition != RANGE_IS_SECTION || !m_pTableOrSectionFormat)) { throw uno::RuntimeException(u"range has no mark (table?)"_ustr); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); return SwUnoCursorHelper::GetPropertyState(aPaM, m_rPropSet, rPropertyName); } @@ -1547,12 +1547,12 @@ SwXTextRange::getPropertyStates(const uno::Sequence< OUString >& rPropertyName) { SolarMutexGuard g; - if (!m_pMark) + if (!m_pMark && (m_eRangePosition != RANGE_IS_SECTION || !m_pTableOrSectionFormat)) { throw uno::RuntimeException(u"range has no mark (table?)"_ustr); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); return SwUnoCursorHelper::GetPropertyStates(aPaM, m_rPropSet, rPropertyName); } @@ -1561,12 +1561,12 @@ void SAL_CALL SwXTextRange::setPropertyToDefault(const OUString& rPropertyName) { SolarMutexGuard aGuard; - if (!m_pMark) + if (!m_pMark && (m_eRangePosition != RANGE_IS_SECTION || !m_pTableOrSectionFormat)) { throw uno::RuntimeException(u"range has no mark (table?)"_ustr); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); SwUnoCursorHelper::SetPropertyToDefault(aPaM, m_rPropSet, rPropertyName); } @@ -1576,12 +1576,12 @@ SwXTextRange::getPropertyDefault(const OUString& rPropertyName) { SolarMutexGuard aGuard; - if (!m_pMark) + if (!m_pMark && (m_eRangePosition != RANGE_IS_SECTION || !m_pTableOrSectionFormat)) { throw uno::RuntimeException(u"range has no mark (table?)"_ustr); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); return SwUnoCursorHelper::GetPropertyDefault(aPaM, m_rPropSet, rPropertyName); } From e2378e0074c35fa5b7980f8202ca137c518e399b Mon Sep 17 00:00:00 2001 From: Sahil Gautam Date: Mon, 25 Nov 2024 13:10:30 +0530 Subject: [PATCH 239/373] tdf#85976 consider 'contains column labels' property for database range A database range is an element in file format. It has the attribute 'table:contains-header' with values 'true' (default) and 'false', and the attribute 'table:orientation' with values 'row' (default) and 'column'. The attributes are only written to file, if the value is not default. If the selected range has a database range element then use its contains-header property rather than what was last selected. Change-Id: I120daa2756c50b6c51fab4f6a0549a0b874abaee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177231 Reviewed-by: Sahil Gautam Tested-by: Jenkins --- sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx b/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx index f3fe991b92a7..0817d3a75914 100644 --- a/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx +++ b/sc/source/ui/miscdlgs/duplicaterecordsdlg.cxx @@ -144,13 +144,27 @@ void ScDuplicateRecordsDlg::Init() m_xOkBtn->connect_clicked(LINK(this, ScDuplicateRecordsDlg, OkHdl)); m_xAllChkBtn->connect_toggled(LINK(this, ScDuplicateRecordsDlg, AllCheckBtnHdl)); + const ScDocument& rDoc = mrViewData.GetDocument(); + bool bIncludeHeaders + = officecfg::Office::Calc::Misc::HandleDuplicateRecords::DataIncludesHeaders::get(); + + ScDBCollection* pDBColl = rDoc.GetDBCollection(); + const SCTAB nCurTab = mrViewData.GetTabNo(); + if (pDBColl) + { + ScDBData* pDBData + = pDBColl->GetDBAtArea(nCurTab, mrRange.aStart.Col(), mrRange.aStart.Row(), + mrRange.aEnd.Col(), mrRange.aEnd.Row()); + if (pDBData) + bIncludeHeaders = pDBData->HasHeader(); + } + // defaults (find duplicate rows | data doesn't include headers) + m_xIncludesHeaders->set_active(bIncludeHeaders); m_xRadioRow->set_active( officecfg::Office::Calc::Misc::HandleDuplicateRecords::RemoveDuplicateRows::get()); m_xRadioColumn->set_active( !officecfg::Office::Calc::Misc::HandleDuplicateRecords::RemoveDuplicateRows::get()); - m_xIncludesHeaders->set_active( - officecfg::Office::Calc::Misc::HandleDuplicateRecords::DataIncludesHeaders::get()); m_xRadioRemove->set_active( officecfg::Office::Calc::Misc::HandleDuplicateRecords::RemoveRecords::get()); m_xRadioSelect->set_active( From ac2b3c339ee47497365066754e9937aba2cca700 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 25 Nov 2024 14:04:12 +0100 Subject: [PATCH 240/373] GCC 15 trunk now defaults to C23, where bool is a keyword ...so the existing C code started to fail with > In file included from workdir/UnpackedTarball/mariadb-connector-c/libmariadb/ma_alloc.c:20: > workdir/UnpackedTarball/mariadb-connector-c/include/ma_global.h:687:25: error: two or more data types in declaration specifiers > 687 | typedef char bool; /* Ordinary boolean values 0 1 */ > | ^~~~ (And the !defined(HAVE_BOOL) there, always being true, apparently started to get in the way now and thus needed to be removed, whatever its original purpose.) Change-Id: I781458d643e01a7199e19a178da3a32520d16b34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177260 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- .../UnpackedTarball_mariadb-connector-c.mk | 1 + external/mariadb-connector-c/c23.patch.0 | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 external/mariadb-connector-c/c23.patch.0 diff --git a/external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk b/external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk index dbce7aec4bdd..3ba6bfef583f 100644 --- a/external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk +++ b/external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk @@ -27,6 +27,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,mariadb-connector-c,1)) $(eval $(call gb_UnpackedTarball_add_patches,mariadb-connector-c,\ external/mariadb-connector-c/clang-cl.patch.0 \ + external/mariadb-connector-c/c23.patch.0 \ )) # TODO are any "plugins" needed? diff --git a/external/mariadb-connector-c/c23.patch.0 b/external/mariadb-connector-c/c23.patch.0 new file mode 100644 index 000000000000..d19d6be4cdae --- /dev/null +++ b/external/mariadb-connector-c/c23.patch.0 @@ -0,0 +1,11 @@ +--- include/ma_global.h ++++ include/ma_global.h +@@ -683,7 +683,7 @@ + typedef int myf; /* Type of MyFlags in my_funcs */ + typedef char my_bool; /* Small bool */ + typedef unsigned long long my_ulonglong; +-#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus)) ++#if !defined(bool) && !defined(bool_defined) && !(defined(__cplusplus) || __STDC_VERSION__ >= 202311L) + typedef char bool; /* Ordinary boolean values 0 1 */ + #endif + /* Macros for converting *constants* to the right type */ From 8431865e6b4d006f9df34663c4d81e76cccbda44 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 22 Nov 2024 19:33:52 -0500 Subject: [PATCH 241/373] tdf#108820 tdf#158713 sw layout: no footnote in repeated table rows This fixes my LO 7.1 regression from bug 108820. The problem was that footnotes-placed-in-table-headline were being visually removed if a split-table was ever joined during editing, etc. (i.e. one less page needed). Avoid the join() cleanup code being triggered on GetFollow frames because those were wrongly being informed that there was a footnote, despite being deliberately disallowed in IsFootnoteAllowed, so it really must not HasFootnote()! make CppunitTest_sw_core_layout \ CPPUNIT_TEST_NAME=testTdf158713_footnoteInHeadline Change-Id: I8f395217ba66a258738fc3f32846b952c69d367b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177059 Reviewed-by: Justin Luth Tested-by: Jenkins --- .../data/tdf158713_footnoteInHeadline.odt | Bin 0 -> 18639 bytes sw/qa/core/layout/ftnfrm.cxx | 14 ++++++++++++++ sw/source/core/text/txtftn.cxx | 8 ++++---- 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odt diff --git a/sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odt b/sw/qa/core/layout/data/tdf158713_footnoteInHeadline.odt new file mode 100644 index 0000000000000000000000000000000000000000..d1c470c23cdac956e81ad5de24f189fbc0f664f6 GIT binary patch literal 18639 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

    i9r}F;&$WKVv?-omiPJLKTSL$w zz#Ue=m>{_@Ux=z?rED7yoom5(k+}7N(>C6?VW9!K$BZ;bSFVbW%T7nd$MDEV3XdDD zHUH6qMMY=*i00)p=FONM>Z^B3FrO08L7;YBB#fX$N!Gps;9YH%j2+$ zI^Ep2>eALRU}>$@TMr&2*HO=5LPxtRce@!_xGRsOxLrPe$V{|rPbAG-t`sgh{g^IV z`(RYmW?Qc{spa4~cXxFQ4hpoXNbZgYfyQzcMWCbRBv&$JXQHFDn028&G<}@^Akn8W z&M#5uVYXs=pKfn^MlE&Zjh8v`xx;!FM#-^HV~uO(o`0;bI(HKPG~ME*rOQKfiW^wh zHCoT4GHW-_kI_1Npl_ zc^}^cwCJw);pB~u-Okq zd3iB}Zz!xY?leX0S|!!amVL$_!^bjSr$a(9Ifm3YN}0Q7n%^dyiKg~u;J(`mcroe? zD1O>O_bjQ7^Ta$;#TTq%Ix#~cWJ8Qla#~C!O+w4vv_kK&P*wB*^i#YSdt8)P)(Y;9 zmp4W*PaXB76*lrJlRC_}YYKH!XEPcy9Fu;!V%G|PTplkDCtLi1;uazP{r>j(q8 z^zC*~JYAp>9jRj!uUSn^G}P!@mU-;}jgZDCIl8=%xeqV;a_eNA4QAYR9;AnX;y9$; z$FQ{N_?0{NHXuhfkbsSo?aH#OAK@~E%jHSoO4$r*Kz zeU=<}zr=(^2g!aTG?iSS9XQ(@eP#=BG_(Qqo2tyf@N`rJ#ydx6)+1J$aJzLz#1n78 zlIlV~ZBa^FH??yYeZ(Ekx2sBI+QR9RsHmBa#^d88dvNCe(=BjX1?lsV?CdLTPQT<}^bGCii`1&j*^hCu4FW5El*v%j4?81`XlrziGO-<3 zZ&(8)wPWm&LgVG&m?! zpI^Ra75gpq&w4XNm)8j=;2L>Ou^;?^<+!e^BcL}C6JaJhu4#~VIH6v4+& zCV3IdDbRh1Ym=HxwL3z{jbK+N9iU>OmIlcx}OVv{X+B*LZ;H!(QVV0wEv;9h&Fy?`q)lJXYO zQwtZ+FY;dGCxe*JXs&n9F3BBJXV;lB!`t`ct64;E%)S-z;#9Jl`#6I?rqW8+9nG{U z4YMXsT)FORGLf6{JQ{VQd_)%;9FF)o+fIvRpk7kP`@b5SuB6ry1Z>P25r1=$M2TFgz4{2Fn%Yf#CzIA1w|Q~Wb`(- zji{?0x%uh2oxIFs&}xi8V``e4NilUXVyBO%w&qh~zX+lNX=JP)DHC*EGifA7n5!k5 zq>RT!f4Yk0F7#5MSV#ijxNQ#-gn6qcxQRTzFB-~+>z>sZ`OQ9kTZzbb)>1pho)JK2>{Y+PM3Uc+0WFaj6L=@4cCErw6 zS>V$oQJ$gYOj%TqfI8wTvL^XqO>=Q+A47sCQ+!88AG)R4#b3@9M#MIWZS4mA$cpb5 zxeVR4xhs{sZ~f{b74bODl5zVMc_y!ki-vZ$^Qpd z+fPIgm-S@j9-sHKIeYlP*^MD zn}lGuDc~yp-N`v8ZeA+bsZL4bvX?s|Sz8ssw1()sB`3!k> zS_JHSTKD1=yASub(@?Yw!cFJxm?bXcV`VtQeX|kS=cmIby+6)4*uO)oXy2`2WZ-|C zaX>)PfWOZw@@H)Rf`8^1`JYsO-SNMic>enR9^dv~l8O9#+ka63z@Hoze?ibY`ae^W z{CjedzvuKP;m2Rl`Hub{oc<-*$lvq%~2*0EMph AGynhq literal 0 HcmV?d00001 diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx index 215d766682dd..0bd0b2c5d077 100644 --- a/sw/qa/core/layout/ftnfrm.cxx +++ b/sw/qa/core/layout/ftnfrm.cxx @@ -65,6 +65,20 @@ CPPUNIT_TEST_FIXTURE(Test, testFlySplitFootnoteLayout) CPPUNIT_ASSERT(pPage->FindFootnoteCont()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf158713_footnoteInHeadline) +{ + // Given a file with table-with-headline split across multiple pages, + // and a footnote in the table's repeated heading row: + createSwDoc("tdf158713_footnoteInHeadline.odt"); + + // delete first paragraph, so table now fits all on the first page - no more "follow table"... + dispatchCommand(mxComponent, u".uno:Delete"_ustr, {}); + + // ensure the footnote text has not been removed from the layout + xmlDocUniquePtr pLayout = parseLayoutDump(); + assertXPath(pLayout, "/root/page/ftncont/ftn", 1); +} + CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnote) { // Given a DOC file with an endnote and then a footnote: diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 0cf0f266511a..84f961781232 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -797,10 +797,10 @@ SwFootnotePortion *SwTextFormatter::NewFootnotePortion( SwTextFormatInfo &rInf, OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(), "NewFootnotePortion with unswapped frame" ); - SwTextFootnote *pFootnote = static_cast(pHint); + if (!m_pFrame->IsFootnoteAllowed()) + return new SwFootnotePortion(u""_ustr, nullptr); - if( !m_pFrame->IsFootnoteAllowed() ) - return new SwFootnotePortion(u""_ustr, pFootnote); + SwTextFootnote *pFootnote = static_cast(pHint); const SwFormatFootnote& rFootnote = pFootnote->GetFootnote(); SwDoc *const pDoc = &m_pFrame->GetDoc(); @@ -1408,7 +1408,7 @@ bool SwFootnotePortion::Format( SwTextFormatInfo &rInf ) SetAscent( rInf.GetAscent() ); Height( rInf.GetTextHeight() ); rInf.SetFootnoteDone( !bFull ); - if( !bFull ) + if (!bFull && m_pFootnote) rInf.SetParaFootnote(); return bFull; } From fc1e12bb2dbe74793adc8e66d0d1eaa0ab701efb Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 25 Nov 2024 17:16:34 +0100 Subject: [PATCH 242/373] distro-configs/LibreOfficeFlatpak.conf lacks --without-system-java-websocket ...after 3de3f660af5afad6f4a78cc021ed20dada936bbd "add a --with-system-java-websocket" Change-Id: If96dafacbc33746934a2d388b11436c797290559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177275 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- distro-configs/LibreOfficeFlatpak.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/distro-configs/LibreOfficeFlatpak.conf b/distro-configs/LibreOfficeFlatpak.conf index 6a296fd696e4..bb4ff2369c41 100644 --- a/distro-configs/LibreOfficeFlatpak.conf +++ b/distro-configs/LibreOfficeFlatpak.conf @@ -25,6 +25,7 @@ --without-system-frozen --without-system-glm --without-system-gpgmepp +--without-system-java-websocket --without-system-jfreereport --without-system-libabw --without-system-libatomic_ops From 0807fe362819629259a9a80a48d2826e588d909c Mon Sep 17 00:00:00 2001 From: Patrick Luby Date: Sun, 24 Nov 2024 20:25:59 -0500 Subject: [PATCH 243/373] Improve rendering speed for native controls when using Skia/Metal While debugging tdf#163945, Xcode's Instruments application uncovered the following performance bottlenecks when using Skia/Metal: 1. Very slow rendering an NSBox: Many system colors have the NSColorTypeCatalog color type. For some unkown reason, setting the NSBox's fill color to a color set to NSColorTypeCatalog causes drawing to take at least twice as long as when the fill color is set to NSColorTypeComponentBased. So, only draw with a fill color set to NSColorTypeComponentBased. 2. Excessively large offscreen buffers when drawing native controls: The temporary bitmap was set to the control region expanded by 50 * mScaling (e.g. both width and height were increased by 200 pixels when running on a Retina display). This caused temporary bitmaps to be up to several times larger than needed. Also, drawing NSBox objects to a CGBitmapContext is noticeably slow so filling all that unneeded temporary bitmap area can slow down performance when a large number of NSBox objects like the status bar are redrawn in quick succession. Using getNativeControlRegion() isn't perfect, but it does try to account for the focus ring as well as the minimum width and/or height of the native control so union the two regions set by getNativeControlRegion() and add double the focus ring width on each side just to be safe. In most cases, this should ensure that the temporary bitmap is large enough to draw the entire native control and a focus ring. 3. Unncessary copying of bitmap buffer when drawing native controls: Let Skia own the CGBitmapContext's buffer so that an SkImage can be created without Skia making a copy of the buffer. Change-Id: Ibd3abb4b9d7045c47268319772fe97a5c4dba3c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177225 Tested-by: Jenkins Reviewed-by: Patrick Luby --- vcl/inc/quartz/salgdi.h | 1 + vcl/osx/salnativewidgets.cxx | 27 ++++++++++--- vcl/skia/osx/gdiimpl.cxx | 74 +++++++++++++++++++++--------------- 3 files changed, 66 insertions(+), 36 deletions(-) diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 40209e97b3ba..0b8e01b569ba 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -440,6 +440,7 @@ protected: virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const Color& rBackgroundColor ) override; +public: virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override; diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 7ff36f0cf690..7dd94ac4b87e 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -380,6 +380,8 @@ bool AquaGraphicsBackend::drawNativeControl(ControlType nType, static void drawBox(CGContextRef context, const NSRect& rc, NSColor* pColor) { + assert(pColor); + CGContextSaveGState(context); CGContextTranslateCTM(context, rc.origin.x, rc.origin.y + rc.size.height); CGContextScaleCTM(context, 1, -1); @@ -388,12 +390,27 @@ static void drawBox(CGContextRef context, const NSRect& rc, NSColor* pColor) NSRect rect = { NSZeroPoint, NSMakeSize(rc.size.width, rc.size.height) }; NSBox* pBox = [[NSBox alloc] initWithFrame: rect]; - [pBox setBoxType: NSBoxCustom]; - [pBox setFillColor: pColor]; - SAL_WNODEPRECATED_DECLARATIONS_PUSH // setBorderType first deprecated in macOS 10.15 - [pBox setBorderType: NSNoBorder]; - SAL_WNODEPRECATED_DECLARATIONS_POP + + // Related tdf#163945: Set fill color to NSColorTypeComponentBased color type + // Many system colors have the NSColorTypeCatalog color type. For + // some unkown reason, setting the NSBox's fill color to a color set + // to NSColorTypeCatalog causes drawing to take at least twice as long + // as when the fill color is set to NSColorTypeComponentBased. So, + // only draw with a fill color set to NSColorTypeComponentBased. + NSColor* pRGBColor = pColor; + if ([pColor type] != NSColorTypeComponentBased) + { + pRGBColor = [pColor colorUsingType: NSColorTypeComponentBased]; + if (!pRGBColor) + pRGBColor = pColor; + } + [pBox setFillColor: pRGBColor]; + + // -[NSBox setBorderType: NSNoBorder] is deprecated so hide the border + // by setting the border color to transparent + [pBox setBorderColor: [NSColor clearColor]]; + [pBox setTitlePosition: NSNoTitle]; [pBox displayRectIgnoringOpacity: rect inContext: graphicsContext]; diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index 45216340492c..7fa95e8d9fab 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -249,28 +250,51 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n return false; // rControlRegion is not the whole area that the control should be painted to (e.g. highlight - // around focused lineedit is outside of it). Since we draw to a temporary bitmap, we need tofind out - // the real size. Using getNativeControlRegion() might seem like the function to call, but we need - // the other direction - what is called rControlRegion here is rNativeContentRegion in that function - // what's called rControlRegion there is what we need here. Moreover getNativeControlRegion() - // in some cases returns a fixed size that does not depend on its input, so we have no way to - // actually find out what the original size was (or maybe the function is kind of broken, I don't know). - // So, add a generous margin and hope it's enough. + // around focused lineedit is outside of it). Since we draw to a temporary bitmap, we need to find out + // the real size. + // Related tdf#163945 Reduce the size of the temporary bitmap + // Previously, the temporary bitmap was set to the control region + // expanded by 50 * mScaling (e.g. both width and height were + // increased by 200 pixels when running on a Retina display). This + // caused temporary bitmaps to be up to several times larger than + // needed. Also, drawing NSBox objects to a CGBitmapContext is + // noticeably slow so filling all that unneeded temporary bitmap + // area can slow down performance when a large number of NSBox + // objects like the status bar are redrawn in quick succession. + // Using getNativeControlRegion() isn't perfect, but it does try to + // account for the focus ring as well as the minimum width and/or + // height of the native control so union the two regions set by + // getNativeControlRegion() and add double the focus ring width on + // each side just to be safe. In most cases, this should ensure + // that the temporary bitmap is large enough to draw the entire + // native control and a focus ring. tools::Rectangle boundingRegion(rControlRegion); - boundingRegion.expand(50 * mScaling); + tools::Rectangle rNativeBoundingRegion; + tools::Rectangle rNativeContentRegion; + AquaSalGraphics* pGraphics = mrShared.mpFrame->mpGraphics; + if (pGraphics + && pGraphics->getNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, + OUString(), rNativeBoundingRegion, + rNativeContentRegion)) + { + boundingRegion.Union(rNativeBoundingRegion); + boundingRegion.Union(rNativeContentRegion); + } + boundingRegion.expand(2 * FOCUS_RING_WIDTH * mScaling); + // Do a scaled bitmap in HiDPI in order not to lose precision. const tools::Long width = boundingRegion.GetWidth() * mScaling; const tools::Long height = boundingRegion.GetHeight() * mScaling; const size_t bytes = width * height * 4; - sal_uInt8* data = new sal_uInt8[bytes]; - memset(data, 0, bytes); + // Let Skia own the CGBitmapContext's buffer so that an SkImage + // can be created without Skia making a copy of the buffer + sk_sp data = SkData::MakeZeroInitialized(bytes); CGContextRef context = CGBitmapContextCreate( - data, width, height, 8, width * 4, GetSalData()->mxRGBSpace, + data->writable_data(), width, height, 8, width * 4, GetSalData()->mxRGBSpace, SkiaToCGBitmapType(mSurface->imageInfo().colorType(), kPremul_SkAlphaType)); if (!context) { SAL_WARN("vcl.skia", "drawNativeControl(): Failed to allocate bitmap context"); - delete[] data; return false; } // Setup context state for drawing (performDrawNativeControl() e.g. fills background in some cases). @@ -302,14 +326,6 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n CGContextRelease(context); if (bOK) { - // Let SkBitmap determine when it is safe to delete the pixel buffer - SkBitmap bitmap; - if (!bitmap.installPixels(SkImageInfo::Make(width, height, - mSurface->imageInfo().colorType(), - kPremul_SkAlphaType), - data, width * 4, nullptr, nullptr)) - abort(); - preDraw(); SAL_INFO("vcl.skia.trace", "drawnativecontrol(" << this << "): " << rControlRegion << ":" << int(nType) << "/" << int(nPart)); @@ -322,23 +338,19 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n updateRect.GetWidth(), updateRect.GetHeight())); SkRect drawRect = SkRect::MakeXYWH(boundingRegion.getX(), boundingRegion.getY(), boundingRegion.GetWidth(), boundingRegion.GetHeight()); - assert(drawRect.width() * mScaling == bitmap.width()); // no scaling should be needed - getDrawCanvas()->drawImageRect(bitmap.asImage(), drawRect, SkSamplingOptions()); + sk_sp image = SkImages::RasterFromData( + SkImageInfo::Make(width, height, mSurface->imageInfo().colorType(), + kPremul_SkAlphaType), + data, width * 4); + assert(image + && drawRect.width() * mScaling == image->width()); // no scaling should be needed + getDrawCanvas()->drawImageRect(image, drawRect, SkSamplingOptions()); // Related: tdf#156881 flush the canvas after drawing the pixel buffer if (auto dContext = GrAsDirectContext(getDrawCanvas()->recordingContext())) dContext->flushAndSubmit(); ++pendingOperationsToFlush; // tdf#136369 postDraw(); } - // Related: tdf#159529 eliminate possible memory leak - // Despite confirming that the release function passed to - // SkBitmap.bitmap.installPixels() does get called for every - // data array that has been allocated, Apple's Instruments - // indicates that the data is leaking. While it is likely a - // false positive, it makes leak analysis difficult so leave - // the bitmap mutable. That causes SkBitmap.asImage() to make - // a copy of the data and the data can be safely deleted here. - delete[] data; return bOK; } From 4178b34521227e726bd1f393d384c17c63909c3d Mon Sep 17 00:00:00 2001 From: prrvchr Date: Mon, 25 Nov 2024 11:52:29 +0100 Subject: [PATCH 244/373] tdf#164040 Expose XGridDataListener type in SortableGridDataModel It had been introduced in commit de9dba9275aff2863978f7f665685d54ef82b0ad (gridsort: introduce XSortableGridDataModel::removeColumnSort, 2011-01-18), but in getTypes, an explicit exclusion for it had been made. Change-Id: I4915949b26ef15905ec810aa54e69d0e62100b90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177256 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- .../controls/grid/sortablegriddatamodel.cxx | 48 +------------------ 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx index d74a496ad1ec..1c614b324c93 100644 --- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx +++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx @@ -53,13 +53,11 @@ namespace { class SortableGridDataModel; typedef ::comphelper::WeakComponentImplHelper < css::awt::grid::XSortableMutableGridDataModel + , css::awt::grid::XGridDataListener , css::lang::XServiceInfo , css::lang::XInitialization > SortableGridDataModel_Base; -typedef ::cppu::ImplHelper1 < css::awt::grid::XGridDataListener - > SortableGridDataModel_PrivateBase; class SortableGridDataModel :public SortableGridDataModel_Base - ,public SortableGridDataModel_PrivateBase { public: explicit SortableGridDataModel( const css::uno::Reference< css::uno::XComponentContext > & rxContext ); @@ -122,15 +120,6 @@ public: // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& i_event ) override; - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; - virtual void SAL_CALL acquire( ) noexcept final override; - virtual void SAL_CALL release( ) noexcept override; - - // XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) override; - private: /** translates the given public index into one to be passed to our delegator @throws css::lang::IndexOutOfBoundsException @@ -221,7 +210,6 @@ void lcl_clear( STLCONTAINER& i_container ) { } - SortableGridDataModel::SortableGridDataModel( SortableGridDataModel const & i_copySource ) :m_xContext( i_copySource.m_xContext ) ,m_isInitialized( true ) @@ -244,40 +232,6 @@ void lcl_clear( STLCONTAINER& i_container ) dispose(); } - - Any SAL_CALL SortableGridDataModel::queryInterface( const Type& aType ) - { - Any aReturn( SortableGridDataModel_Base::queryInterface( aType ) ); - if ( !aReturn.hasValue() ) - aReturn = SortableGridDataModel_PrivateBase::queryInterface( aType ); - return aReturn; - } - - - void SAL_CALL SortableGridDataModel::acquire( ) noexcept - { - SortableGridDataModel_Base::acquire(); - } - - - void SAL_CALL SortableGridDataModel::release( ) noexcept - { - SortableGridDataModel_Base::release(); - } - - - Sequence< Type > SAL_CALL SortableGridDataModel::getTypes( ) - { - return SortableGridDataModel_Base::getTypes(); - // don't expose the types got via SortableGridDataModel_PrivateBase - they're private, after all - } - - - Sequence< ::sal_Int8 > SAL_CALL SortableGridDataModel::getImplementationId( ) - { - return css::uno::Sequence(); - } - Reference< XCollator > lcl_loadDefaultCollator_throw( const Reference & rxContext ) { Reference< XCollator > const xCollator = Collator::create( rxContext ); From 8f0a2c52f60f2d11bf4a1f8df246f651ce01360e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 25 Nov 2024 16:49:52 +0000 Subject: [PATCH 245/373] Resolves: tdf#163777 Ignore pageup and down when modifier held... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in a SalInstanceEntryTreeView, otherwise the ctrl+pageup/down gets processed twice by the toplevel notebook due to the forwarding used here. Change-Id: Ic5003064ddba44f940fb4c4a727d8081c3644361 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177277 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- vcl/source/app/salvtables.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index bf562ce7c687..32a613a32dd0 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -6961,9 +6961,12 @@ IMPL_LINK(SalInstanceEntryTreeView, KeyPressListener, VclWindowEvent&, rEvent, v if (rEvent.GetId() != VclEventId::WindowKeyInput) return; const KeyEvent& rKeyEvent = *static_cast(rEvent.GetData()); + if (rKeyEvent.GetKeyCode().GetModifier()) // tdf#163777 ignore when modifier held + return; sal_uInt16 nKeyCode = rKeyEvent.GetKeyCode().GetCode(); - if (!(nKeyCode == KEY_UP || nKeyCode == KEY_DOWN || nKeyCode == KEY_PAGEUP - || nKeyCode == KEY_PAGEDOWN)) + const bool bNavigation = nKeyCode == KEY_UP || nKeyCode == KEY_DOWN || nKeyCode == KEY_PAGEUP + || nKeyCode == KEY_PAGEDOWN; + if (!bNavigation) return; m_pTreeView->disable_notify_events(); From 507c6fc66cda7c1022008b3d1d4c087540cb2d18 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Mon, 25 Nov 2024 09:58:45 -0500 Subject: [PATCH 246/373] tdf#124741 export xlsx: no defaultRowHeight without customHeight Apparently, the value of defaultRowHeight is just some nice kind of suggestion to Excel, since optimalRowHeight rows can be less than what is specified in defaultRowHeight. Since Calc always treats defaultRowHeight as authoritative, on export it needs to always export it that way. Apparently there are some TWIPS calculations going on because while Calc defaults to exporting a defaultRowHeight of 12.80, Excel is still round-tripping it as 12.75. make CppunitTest_sc_subsequent_export_test2 \ CPPUNIT_TEST_NAME=testTdf120168 (In this unit test, it originates as customHeight=1, but Calc was round-tripping it without that. Although the round-trip looked identical in Calc, in Excel the empty rows were now much shorter, being height-formatted according to the default font size.) Change-Id: I7ed6b612de0fa508a89dc4cf357b873de230962c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177276 Tested-by: Jenkins Reviewed-by: Justin Luth --- sc/qa/unit/subsequent_export_test2.cxx | 4 ++++ sc/source/filter/excel/xetable.cxx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index decbf2ad00b2..ca0effbea1e1 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -243,6 +243,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf120168) // - Actual : general assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "horizontal", u"left"); assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "horizontal", u"right"); + + // tdf#124741: without round-tripping customHeight, Excel wasn't applying defaultRowHeight + xmlDocUniquePtr pSheet = parseExport(u"xl/worksheets/sheet1.xml"_ustr); + assertXPath(pSheet, "//x:sheetFormatPr", "customHeight", u"true"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf117266) diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index a466bfa7ca81..0b287c404871 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2828,10 +2828,10 @@ void XclExpCellTable::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement( XML_sheetFormatPr, // OOXTODO: XML_baseColWidth XML_defaultColWidth, OString::number(maColInfoBfr.GetDefColWidth()), - // OOXTODO: XML_customHeight // OOXTODO: XML_thickTop // OOXTODO: XML_thickBottom XML_defaultRowHeight, OString::number(static_cast (rDefData.mnHeight) / 20.0), + XML_customHeight, ToPsz(true), XML_zeroHeight, ToPsz( rDefData.IsHidden() ), XML_outlineLevelRow, OString::number(maRowBfr.GetHighestOutlineLevel()), XML_outlineLevelCol, OString::number(maColInfoBfr.GetHighestOutlineLevel()) ); From dc0307fd4092383a8740225307001894cdc81519 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 25 Nov 2024 15:54:10 +0100 Subject: [PATCH 247/373] ScCondFormatList: pDoc is never nullptr Change-Id: I764cd7eed4fe91bac7ad83dbbc48b2a2c4509c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177273 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/source/ui/condformat/colorformat.cxx | 30 ++-- sc/source/ui/condformat/condformatdlg.cxx | 54 +++---- .../ui/condformat/condformatdlgentry.cxx | 146 +++++++++--------- sc/source/ui/condformat/condformateasydlg.cxx | 30 ++-- sc/source/ui/condformat/condformathelper.cxx | 18 +-- sc/source/ui/inc/colorformat.hxx | 4 +- sc/source/ui/inc/condformatdlg.hxx | 5 +- sc/source/ui/inc/condformatdlgentry.hxx | 18 +-- sc/source/ui/inc/condformateasydlg.hxx | 2 +- sc/source/ui/inc/condformathelper.hxx | 8 +- 10 files changed, 158 insertions(+), 157 deletions(-) diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index ff8afff2d48f..4dd4f92599f3 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -25,7 +25,7 @@ void SetType(const ScColorScaleEntry* pEntry, weld::ComboBox& rLstBox) } void GetType(const weld::ComboBox& rLstBox, const weld::Entry& rEd, ScColorScaleEntry* pEntry, SvNumberFormatter* pNumberFormatter, - ScDocument* pDoc, const ScAddress& rPos ) + ScDocument& rDoc, const ScAddress& rPos ) { double nVal = 0; sal_uInt32 nIndex = 0; @@ -43,33 +43,33 @@ void GetType(const weld::ComboBox& rLstBox, const weld::Entry& rEd, ScColorScale pEntry->SetValue(nVal); break; case COLORSCALE_FORMULA: - pEntry->SetFormula(rEd.get_text(), *pDoc, rPos); + pEntry->SetFormula(rEd.get_text(), rDoc, rPos); break; } } -OUString convertNumberToString(double nVal, const ScDocument* pDoc) +OUString convertNumberToString(double nVal, const ScDocument& rDoc) { - SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pNumberFormatter = rDoc.GetFormatTable(); return pNumberFormatter->GetInputLineString(nVal, 0); } -void SetValue( const ScDocument* pDoc, const ScColorScaleEntry* pEntry, weld::Entry& rEdit) +void SetValue( const ScDocument& rDoc, const ScColorScaleEntry* pEntry, weld::Entry& rEdit) { if(pEntry->GetType() == COLORSCALE_FORMULA) rEdit.set_text(pEntry->GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); else if(pEntry->GetType() != COLORSCALE_MIN && pEntry->GetType() != COLORSCALE_MAX) - rEdit.set_text(convertNumberToString(pEntry->GetValue(), pDoc)); + rEdit.set_text(convertNumberToString(pEntry->GetValue(), rDoc)); else rEdit.set_sensitive(false); } } -ScDataBarSettingsDlg::ScDataBarSettingsDlg(weld::Window* pParent, const ScDataBarFormatData& rData, ScDocument* pDoc, const ScAddress& rPos) +ScDataBarSettingsDlg::ScDataBarSettingsDlg(weld::Window* pParent, const ScDataBarFormatData& rData, ScDocument& rDoc, const ScAddress& rPos) : GenericDialogController(pParent, u"modules/scalc/ui/databaroptions.ui"_ustr, u"DataBarOptions"_ustr) - , mpNumberFormatter(pDoc->GetFormatTable()) - , mpDoc(pDoc) + , mpNumberFormatter(rDoc.GetFormatTable()) + , mrDoc(rDoc) , maPos(rPos) , mxBtnOk(m_xBuilder->weld_button(u"ok"_ustr)) , mxLbPos(new ColorListBox(m_xBuilder->weld_menu_button(u"positive_colour"_ustr), [this]{ return m_xDialog.get(); })) @@ -109,10 +109,10 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(weld::Window* pParent, const ScDataBa } ::SetType(rData.mpLowerLimit.get(), *mxLbTypeMin); ::SetType(rData.mpUpperLimit.get(), *mxLbTypeMax); - SetValue(mpDoc, rData.mpLowerLimit.get(), *mxEdMin); - SetValue(mpDoc, rData.mpUpperLimit.get(), *mxEdMax); - mxLenMin->set_text(convertNumberToString(rData.mnMinLength, mpDoc)); - mxLenMax->set_text(convertNumberToString(rData.mnMaxLength, mpDoc)); + SetValue(mrDoc, rData.mpLowerLimit.get(), *mxEdMin); + SetValue(mrDoc, rData.mpUpperLimit.get(), *mxEdMax); + mxLenMin->set_text(convertNumberToString(rData.mnMinLength, mrDoc)); + mxLenMax->set_text(convertNumberToString(rData.mnMaxLength, mrDoc)); mxLbAxisCol->SelectEntry(rData.maAxisColor); mxCbOnlyBar->set_active(rData.mbOnlyBar); @@ -180,8 +180,8 @@ ScDataBarFormatData* ScDataBarSettingsDlg::GetData() pData->maAxisColor = mxLbAxisCol->GetSelectEntryColor(); pData->mbOnlyBar = mxCbOnlyBar->get_active(); - ::GetType(*mxLbTypeMin, *mxEdMin, pData->mpLowerLimit.get(), mpNumberFormatter, mpDoc, maPos); - ::GetType(*mxLbTypeMax, *mxEdMax, pData->mpUpperLimit.get(), mpNumberFormatter, mpDoc, maPos); + ::GetType(*mxLbTypeMin, *mxEdMin, pData->mpLowerLimit.get(), mpNumberFormatter, mrDoc, maPos); + ::GetType(*mxLbTypeMax, *mxEdMax, pData->mpUpperLimit.get(), mpNumberFormatter, mrDoc, maPos); GetAxesPosition(pData, *mxLbAxisPos); SetBarLength(pData, mxLenMin->get_text(), mxLenMax->get_text(), mpNumberFormatter); diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 8c608597cab0..dc65664f4498 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -24,13 +24,14 @@ #include ScCondFormatList::ScCondFormatList(ScCondFormatDlg* pDialogParent, + ScDocument& rDoc, std::unique_ptr xWindow, std::unique_ptr xGrid) : mxScrollWindow(std::move(xWindow)) , mxGrid(std::move(xGrid)) , mbFrozen(false) , mbNewEntry(false) - , mpDoc(nullptr) + , mrDoc(rDoc) , mpDialogParent(pDialogParent) { mxScrollWindow->set_size_request(mxScrollWindow->get_approximate_digit_width() * 85, @@ -48,11 +49,10 @@ ScCondFormatList::~ScCondFormatList() Freeze(); } -void ScCondFormatList::init(ScDocument& rDoc, +void ScCondFormatList::init( const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType) { - mpDoc = &rDoc; maPos = rPos; maRanges = rRanges; @@ -71,9 +71,9 @@ void ScCondFormatList::init(ScDocument& rDoc, { const ScCondFormatEntry* pConditionEntry = static_cast( pEntry ); if(pConditionEntry->GetOperation() != ScConditionMode::Direct) - maEntries.emplace_back(new ScConditionFrmtEntry( this, mpDoc, mpDialogParent, maPos, pConditionEntry ) ); + maEntries.emplace_back(new ScConditionFrmtEntry( this, mrDoc, mpDialogParent, maPos, pConditionEntry ) ); else - maEntries.emplace_back(new ScFormulaFrmtEntry( this, mpDoc, mpDialogParent, maPos, pConditionEntry ) ); + maEntries.emplace_back(new ScFormulaFrmtEntry( this, mrDoc, mpDialogParent, maPos, pConditionEntry ) ); } break; @@ -81,19 +81,19 @@ void ScCondFormatList::init(ScDocument& rDoc, { const ScColorScaleFormat* pColorScale = static_cast( pEntry ); if( pColorScale->size() == 2 ) - maEntries.emplace_back(new ScColorScale2FrmtEntry( this, mpDoc, maPos, pColorScale ) ); + maEntries.emplace_back(new ScColorScale2FrmtEntry( this, mrDoc, maPos, pColorScale ) ); else - maEntries.emplace_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos, pColorScale ) ); + maEntries.emplace_back(new ScColorScale3FrmtEntry( this, mrDoc, maPos, pColorScale ) ); } break; case ScFormatEntry::Type::Databar: - maEntries.emplace_back(new ScDataBarFrmtEntry( this, mpDoc, maPos, static_cast( pEntry ) ) ); + maEntries.emplace_back(new ScDataBarFrmtEntry( this, mrDoc, maPos, static_cast( pEntry ) ) ); break; case ScFormatEntry::Type::Iconset: - maEntries.emplace_back(new ScIconSetFrmtEntry( this, mpDoc, maPos, static_cast( pEntry ) ) ); + maEntries.emplace_back(new ScIconSetFrmtEntry( this, mrDoc, maPos, static_cast( pEntry ) ) ); break; case ScFormatEntry::Type::Date: - maEntries.emplace_back(new ScDateFrmtEntry( this, mpDoc, static_cast( pEntry ) ) ); + maEntries.emplace_back(new ScDateFrmtEntry( this, mrDoc, static_cast( pEntry ) ) ); break; } } @@ -105,19 +105,19 @@ void ScCondFormatList::init(ScDocument& rDoc, switch(eType) { case condformat::dialog::CONDITION: - maEntries.emplace_back(new ScConditionFrmtEntry( this, mpDoc, mpDialogParent, maPos )); + maEntries.emplace_back(new ScConditionFrmtEntry( this, mrDoc, mpDialogParent, maPos )); break; case condformat::dialog::COLORSCALE: - maEntries.emplace_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos )); + maEntries.emplace_back(new ScColorScale3FrmtEntry( this, mrDoc, maPos )); break; case condformat::dialog::DATABAR: - maEntries.emplace_back(new ScDataBarFrmtEntry( this, mpDoc, maPos )); + maEntries.emplace_back(new ScDataBarFrmtEntry( this, mrDoc, maPos )); break; case condformat::dialog::ICONSET: - maEntries.emplace_back(new ScIconSetFrmtEntry( this, mpDoc, maPos )); + maEntries.emplace_back(new ScIconSetFrmtEntry( this, mrDoc, maPos )); break; case condformat::dialog::DATE: - maEntries.emplace_back(new ScDateFrmtEntry( this, mpDoc )); + maEntries.emplace_back(new ScDateFrmtEntry( this, mrDoc )); break; case condformat::dialog::NONE: break; @@ -145,7 +145,7 @@ std::unique_ptr ScCondFormatList::GetConditionalFormat() co if(maEntries.empty()) return nullptr; - std::unique_ptr pFormat(new ScConditionalFormat(0, mpDoc)); + std::unique_ptr pFormat(new ScConditionalFormat(0, &mrDoc)); pFormat->SetRange(maRanges); for(auto & rEntry: maEntries) @@ -215,28 +215,28 @@ IMPL_LINK(ScCondFormatList, AfterColFormatTypeHdl, void*, p, void) return; Freeze(); - itr->reset(new ScColorScale2FrmtEntry(this, mpDoc, maPos)); + itr->reset(new ScColorScale2FrmtEntry(this, mrDoc, maPos)); break; case 1: if((*itr)->GetType() == condformat::entry::COLORSCALE3) return; Freeze(); - itr->reset(new ScColorScale3FrmtEntry(this, mpDoc, maPos)); + itr->reset(new ScColorScale3FrmtEntry(this, mrDoc, maPos)); break; case 2: if((*itr)->GetType() == condformat::entry::DATABAR) return; Freeze(); - itr->reset(new ScDataBarFrmtEntry(this, mpDoc, maPos)); + itr->reset(new ScDataBarFrmtEntry(this, mrDoc, maPos)); break; case 3: if((*itr)->GetType() == condformat::entry::ICONSET) return; Freeze(); - itr->reset(new ScIconSetFrmtEntry(this, mpDoc, maPos)); + itr->reset(new ScIconSetFrmtEntry(this, mrDoc, maPos)); break; default: break; @@ -281,7 +281,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, void*, p, void) return; } Freeze(); - itr->reset(new ScColorScale3FrmtEntry(this, mpDoc, maPos)); + itr->reset(new ScColorScale3FrmtEntry(this, mrDoc, maPos)); mpDialogParent->InvalidateRefData(); (*itr)->SetActive(); break; @@ -290,7 +290,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, void*, p, void) return; Freeze(); - itr->reset(new ScConditionFrmtEntry(this, mpDoc, mpDialogParent, maPos)); + itr->reset(new ScConditionFrmtEntry(this, mrDoc, mpDialogParent, maPos)); mpDialogParent->InvalidateRefData(); (*itr)->SetActive(); break; @@ -299,7 +299,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, void*, p, void) return; Freeze(); - itr->reset(new ScFormulaFrmtEntry(this, mpDoc, mpDialogParent, maPos)); + itr->reset(new ScFormulaFrmtEntry(this, mrDoc, mpDialogParent, maPos)); mpDialogParent->InvalidateRefData(); (*itr)->SetActive(); break; @@ -308,7 +308,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, void*, p, void) return; Freeze(); - itr->reset(new ScDateFrmtEntry( this, mpDoc )); + itr->reset(new ScDateFrmtEntry( this, mrDoc )); mpDialogParent->InvalidateRefData(); (*itr)->SetActive(); break; @@ -321,7 +321,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, void*, p, void) IMPL_LINK_NOARG( ScCondFormatList, AddBtnHdl, weld::Button&, void ) { Freeze(); - maEntries.emplace_back(new ScConditionFrmtEntry(this, mpDoc, mpDialogParent, maPos)); + maEntries.emplace_back(new ScConditionFrmtEntry(this, mrDoc, mpDialogParent, maPos)); for(auto& rxEntry : maEntries) { rxEntry->SetInactive(); @@ -440,7 +440,7 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, , mxFtRange(m_xBuilder->weld_label(u"ftassign"_ustr)) , mxEdRange(new formula::RefEdit(m_xBuilder->weld_entry(u"edassign"_ustr))) , mxRbRange(new formula::RefButton(m_xBuilder->weld_button(u"rbassign"_ustr))) - , mxCondFormList(new ScCondFormatList(this, m_xBuilder->weld_scrolled_window(u"listwindow"_ustr), + , mxCondFormList(new ScCondFormatList(this, mpViewData->GetDocument(), m_xBuilder->weld_scrolled_window(u"listwindow"_ustr), m_xBuilder->weld_container(u"list"_ustr))) { mxEdRange->SetReferences(this, mxFtRange.get()); @@ -476,7 +476,7 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, } maPos = aRange.GetTopLeftCorner(); - mxCondFormList->init(mpViewData->GetDocument(), pFormat, aRange, maPos, mpDlgItem->GetDialogType()); + mxCondFormList->init(pFormat, aRange, maPos, mpDlgItem->GetDialogType()); mxBtnOk->connect_clicked(LINK(this, ScCondFormatDlg, BtnPressedHdl ) ); mxBtnAdd->connect_clicked( LINK( mxCondFormList.get(), ScCondFormatList, AddBtnHdl ) ); diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index c9b5e208ffa5..6906d4fb5316 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -50,7 +50,7 @@ static bool isLOKMobilePhone() return pCurrent && pCurrent->isLOKMobilePhone(); } -ScCondFrmtEntry::ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos) +ScCondFrmtEntry::ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos) : mpParent(pParent) , mxBuilder(Application::CreateBuilder(pParent->GetContainer(), isLOKMobilePhone()?u"modules/scalc/ui/conditionalentrymobile.ui"_ustr:u"modules/scalc/ui/conditionalentry.ui"_ustr)) , mxBorder(mxBuilder->weld_widget(u"border"_ustr)) @@ -60,7 +60,7 @@ ScCondFrmtEntry::ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, co , mbActive(false) , maStrCondition(ScResId(SCSTR_CONDITION)) , mxLbType(mxBuilder->weld_combo_box(u"type"_ustr)) - , mpDoc(pDoc) + , mrDoc(rDoc) , maPos(rPos) { mxLbType->set_size_request(CommonWidgetWidth, -1); @@ -148,9 +148,9 @@ const ScConditionMode ScConditionFrmtEntry::mpEntryToCond[ScConditionFrmtEntry:: ScConditionMode::LastYear, ScConditionMode::NextYear }; -ScConditionFrmtEntry::ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, +ScConditionFrmtEntry::ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry) - : ScCondFrmtEntry(pParent, pDoc, rPos) + : ScCondFrmtEntry(pParent, rDoc, rPos) , mxLbCondType(mxBuilder->weld_combo_box(u"typeis"_ustr)) , mxEdVal1(new formula::RefEdit(mxBuilder->weld_entry(u"val1"_ustr))) , mxEdVal2(new formula::RefEdit(mxBuilder->weld_entry(u"val2"_ustr))) @@ -169,7 +169,7 @@ ScConditionFrmtEntry::ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument Init(pDialogParent); - StartListening(*pDoc->GetStyleSheetPool(), DuplicateHandling::Prevent); + StartListening(*rDoc.GetStyleSheetPool(), DuplicateHandling::Prevent); if(pFormatEntry) { @@ -221,7 +221,7 @@ void ScConditionFrmtEntry::Init(ScCondFormatDlg* pDialogParent) mxEdVal1->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); mxEdVal2->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); - ScCondFormatHelper::FillStyleListBox(mpDoc, *mxLbStyle); + ScCondFormatHelper::FillStyleListBox(mrDoc, *mxLbStyle); mxLbStyle->connect_changed( LINK( this, ScConditionFrmtEntry, StyleSelectHdl ) ); mxLbCondType->connect_changed( LINK( this, ScConditionFrmtEntry, ConditionTypeSelectHdl ) ); @@ -241,14 +241,14 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const } } - ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aExpr1, aExpr2, *mpDoc, maPos, mxLbStyle->get_active_text()); + ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aExpr1, aExpr2, mrDoc, maPos, mxLbStyle->get_active_text()); return pEntry; } IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, formula::RefEdit&, rRefEdit, void) { weld::Entry& rEdit = *rRefEdit.GetWidget(); - ScCondFormatHelper::ValidateInputField(rEdit, *mxFtVal, mpDoc, maPos); + ScCondFormatHelper::ValidateInputField(rEdit, *mxFtVal, mrDoc, maPos); } void ScConditionFrmtEntry::Select() @@ -381,21 +381,21 @@ void ScConditionFrmtEntry::Notify(SfxBroadcaster&, const SfxHint& rHint) if(rHint.GetId() == SfxHintId::StyleSheetModified || rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) { if(!mbIsInStyleCreate) - ScCondFormatHelper::UpdateStyleList(*mxLbStyle, mpDoc); + ScCondFormatHelper::UpdateStyleList(*mxLbStyle, mrDoc); } } IMPL_LINK_NOARG(ScConditionFrmtEntry, StyleSelectHdl, weld::ComboBox&, void) { mbIsInStyleCreate = true; - ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview); + ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mrDoc, maWdPreview); mbIsInStyleCreate = false; } // formula -ScFormulaFrmtEntry::ScFormulaFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormat) - : ScCondFrmtEntry(pParent, pDoc, rPos) +ScFormulaFrmtEntry::ScFormulaFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormat) + : ScCondFrmtEntry(pParent, rDoc, rPos) , mxFtStyle(mxBuilder->weld_label(u"styleft"_ustr)) , mxLbStyle(mxBuilder->weld_combo_box(u"style"_ustr)) , mxWdPreviewWin(mxBuilder->weld_widget(u"previewwin"_ustr)) @@ -411,7 +411,7 @@ ScFormulaFrmtEntry::ScFormulaFrmtEntry(ScCondFormatList* pParent, ScDocument* pD if(pFormat) { - mxEdFormula->SetText(pFormat->GetExpression(rPos, 0, 0, pDoc->GetGrammar())); + mxEdFormula->SetText(pFormat->GetExpression(rPos, 0, 0, rDoc.GetGrammar())); mxLbStyle->set_active_text(pFormat->GetStyle()); } else @@ -430,13 +430,13 @@ void ScFormulaFrmtEntry::Init(ScCondFormatDlg* pDialogParent) { mxEdFormula->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); - ScCondFormatHelper::FillStyleListBox(mpDoc, *mxLbStyle); + ScCondFormatHelper::FillStyleListBox(mrDoc, *mxLbStyle); mxLbStyle->connect_changed( LINK( this, ScFormulaFrmtEntry, StyleSelectHdl ) ); } IMPL_LINK_NOARG(ScFormulaFrmtEntry, StyleSelectHdl, weld::ComboBox&, void) { - ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview); + ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mrDoc, maWdPreview); } ScFormatEntry* ScFormulaFrmtEntry::createFormulaEntry() const @@ -445,7 +445,7 @@ ScFormatEntry* ScFormulaFrmtEntry::createFormulaEntry() const if(aFormula.isEmpty()) return nullptr; - ScFormatEntry* pEntry = new ScCondFormatEntry(ScConditionMode::Direct, aFormula, OUString(), *mpDoc, maPos, mxLbStyle->get_active_text()); + ScFormatEntry* pEntry = new ScCondFormatEntry(ScConditionMode::Direct, aFormula, OUString(), mrDoc, maPos, mxLbStyle->get_active_text()); return pEntry; } @@ -483,9 +483,9 @@ void ScFormulaFrmtEntry::SetInactive() namespace { -OUString convertNumberToString(double nVal, const ScDocument* pDoc) +OUString convertNumberToString(double nVal, const ScDocument& rDoc) { - SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pNumberFormatter = rDoc.GetFormatTable(); return pNumberFormatter->GetInputLineString(nVal, 0); } @@ -547,7 +547,7 @@ void removeType(weld::ComboBox& rListBox, ScColorScaleEntryType eType) rListBox.remove(nPos); } -void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& rLbType, weld::Entry& rEdit, ColorListBox& rLbCol, const ScDocument* pDoc ) +void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& rLbType, weld::Entry& rEdit, ColorListBox& rLbCol, const ScDocument& rDoc ) { // entry Automatic is not available for color scales assert(rEntry.GetType() > COLORSCALE_AUTO); @@ -562,7 +562,7 @@ void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& r case COLORSCALE_PERCENT: { double nVal = rEntry.GetValue(); - rEdit.set_text(convertNumberToString(nVal, pDoc)); + rEdit.set_text(convertNumberToString(nVal, rDoc)); } break; case COLORSCALE_FORMULA: @@ -576,7 +576,7 @@ void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& r } void SetColorScaleEntry(ScColorScaleEntry* pEntry, const weld::ComboBox& rType, const weld::Entry& rValue, - ScDocument* pDoc, const ScAddress& rPos) + ScDocument& rDoc, const ScAddress& rPos) { ScColorScaleEntryType eType = getSelectedType(rType); @@ -593,24 +593,24 @@ void SetColorScaleEntry(ScColorScaleEntry* pEntry, const weld::ComboBox& rType, { sal_uInt32 nIndex = 0; double nVal = 0; - SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pNumberFormatter = rDoc.GetFormatTable(); (void)pNumberFormatter->IsNumberFormat(rValue.get_text(), nIndex, nVal); pEntry->SetValue(nVal); } break; case COLORSCALE_FORMULA: - pEntry->SetFormula(rValue.get_text(), *pDoc, rPos); + pEntry->SetFormula(rValue.get_text(), rDoc, rPos); break; default: break; } } -ScColorScaleEntry* createColorScaleEntry( const weld::ComboBox& rType, const ColorListBox& rColor, const weld::Entry& rValue, ScDocument* pDoc, const ScAddress& rPos ) +ScColorScaleEntry* createColorScaleEntry( const weld::ComboBox& rType, const ColorListBox& rColor, const weld::Entry& rValue, ScDocument& rDoc, const ScAddress& rPos ) { ScColorScaleEntry* pEntry = new ScColorScaleEntry(); - SetColorScaleEntry(pEntry, rType, rValue, pDoc, rPos); + SetColorScaleEntry(pEntry, rType, rValue, rDoc, rPos); Color aColor = rColor.GetSelectEntryColor(); pEntry->SetColor(aColor); return pEntry; @@ -618,8 +618,8 @@ ScColorScaleEntry* createColorScaleEntry( const weld::ComboBox& rType, const Col } -ScColorScale2FrmtEntry::ScColorScale2FrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat) - : ScCondFrmtEntry(pParent, pDoc, rPos) +ScColorScale2FrmtEntry::ScColorScale2FrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat) + : ScCondFrmtEntry(pParent, rDoc, rPos) , mxLbColorFormat(mxBuilder->weld_combo_box(u"colorformat"_ustr)) , mxLbEntryTypeMin(mxBuilder->weld_combo_box(u"colscalemin"_ustr)) , mxLbEntryTypeMax(mxBuilder->weld_combo_box(u"colscalemax"_ustr)) @@ -652,9 +652,9 @@ ScColorScale2FrmtEntry::ScColorScale2FrmtEntry(ScCondFormatList* pParent, ScDocu if(pFormat) { ScColorScaleEntries::const_iterator itr = pFormat->begin(); - SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMin, *mxEdMin, *mxLbColMin, pDoc); + SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMin, *mxEdMin, *mxLbColMin, rDoc); ++itr; - SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMax, *mxEdMax, *mxLbColMax, pDoc); + SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMax, *mxEdMax, *mxLbColMax, rDoc); } else { @@ -682,9 +682,9 @@ void ScColorScale2FrmtEntry::Init() ScFormatEntry* ScColorScale2FrmtEntry::createColorscaleEntry() const { - ScColorScaleFormat* pColorScale = new ScColorScaleFormat(mpDoc); - pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMin, *mxLbColMin, *mxEdMin, mpDoc, maPos)); - pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMax, *mxLbColMax, *mxEdMax, mpDoc, maPos)); + ScColorScaleFormat* pColorScale = new ScColorScaleFormat(&mrDoc); + pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMin, *mxLbColMin, *mxEdMin, mrDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMax, *mxLbColMax, *mxEdMax, mrDoc, maPos)); return pColorScale; } @@ -753,8 +753,8 @@ IMPL_LINK( ScColorScale2FrmtEntry, EntryTypeHdl, weld::ComboBox&, rBox, void ) pEd->set_sensitive(false); } -ScColorScale3FrmtEntry::ScColorScale3FrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat) - : ScCondFrmtEntry(pParent, pDoc, rPos) +ScColorScale3FrmtEntry::ScColorScale3FrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat) + : ScCondFrmtEntry(pParent, rDoc, rPos) , mxLbColorFormat(mxBuilder->weld_combo_box(u"colorformat"_ustr)) , mxLbEntryTypeMin(mxBuilder->weld_combo_box(u"colscalemin"_ustr)) , mxLbEntryTypeMiddle(mxBuilder->weld_combo_box(u"colscalemiddle"_ustr)) @@ -792,12 +792,12 @@ ScColorScale3FrmtEntry::ScColorScale3FrmtEntry(ScCondFormatList* pParent, ScDocu if(pFormat) { ScColorScaleEntries::const_iterator itr = pFormat->begin(); - SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMin, *mxEdMin, *mxLbColMin, pDoc); + SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMin, *mxEdMin, *mxLbColMin, rDoc); assert(pFormat->size() == 3); ++itr; - SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMiddle, *mxEdMiddle, *mxLbColMiddle, pDoc); + SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMiddle, *mxEdMiddle, *mxLbColMiddle, rDoc); ++itr; - SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMax, *mxEdMax, *mxLbColMax, pDoc); + SetColorScaleEntryTypes(*itr[0], *mxLbEntryTypeMax, *mxEdMax, *mxLbColMax, rDoc); } else { @@ -830,11 +830,11 @@ void ScColorScale3FrmtEntry::Init() ScFormatEntry* ScColorScale3FrmtEntry::createColorscaleEntry() const { - ScColorScaleFormat* pColorScale = new ScColorScaleFormat(mpDoc); - pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMin, *mxLbColMin, *mxEdMin, mpDoc, maPos)); + ScColorScaleFormat* pColorScale = new ScColorScaleFormat(&mrDoc); + pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMin, *mxLbColMin, *mxEdMin, mrDoc, maPos)); if (mxLbColorFormat->get_active() == 1) - pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMiddle, *mxLbColMiddle, *mxEdMiddle, mpDoc, maPos)); - pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMax, *mxLbColMax, *mxEdMax, mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMiddle, *mxLbColMiddle, *mxEdMiddle, mrDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*mxLbEntryTypeMax, *mxLbColMax, *mxEdMax, mrDoc, maPos)); return pColorScale; } @@ -938,7 +938,7 @@ IMPL_LINK_NOARG(ScConditionFrmtEntry, ConditionTypeSelectHdl, weld::ComboBox&, v namespace { -void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& rLbType, weld::Entry& rEdit, const ScDocument* pDoc ) +void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& rLbType, weld::Entry& rEdit, const ScDocument& rDoc ) { selectType(rLbType, rEntry.GetType()); switch(rEntry.GetType()) @@ -952,7 +952,7 @@ void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& rLbT case COLORSCALE_PERCENTILE: { double nVal = rEntry.GetValue(); - SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pNumberFormatter = rDoc.GetFormatTable(); OUString aText = pNumberFormatter->GetInputLineString(nVal, 0); rEdit.set_text(aText); } @@ -965,8 +965,8 @@ void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& rLbT } -ScDataBarFrmtEntry::ScDataBarFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat) - : ScCondFrmtEntry(pParent, pDoc, rPos) +ScDataBarFrmtEntry::ScDataBarFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat) + : ScCondFrmtEntry(pParent, rDoc, rPos) , mxLbColorFormat(mxBuilder->weld_combo_box(u"colorformat"_ustr)) , mxLbDataBarMinType(mxBuilder->weld_combo_box(u"colscalemin"_ustr)) , mxLbDataBarMaxType(mxBuilder->weld_combo_box(u"colscalemax"_ustr)) @@ -992,8 +992,8 @@ ScDataBarFrmtEntry::ScDataBarFrmtEntry(ScCondFormatList* pParent, ScDocument* pD if(pFormat) { mpDataBarData.reset(new ScDataBarFormatData(*pFormat->GetDataBarData())); - SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *mxLbDataBarMinType, *mxEdDataBarMin, pDoc); - SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *mxLbDataBarMaxType, *mxEdDataBarMax, pDoc); + SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *mxLbDataBarMinType, *mxEdDataBarMin, rDoc); + SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *mxLbDataBarMaxType, *mxEdDataBarMax, rDoc); DataBarTypeSelectHdl(*mxLbDataBarMinType); } else @@ -1037,10 +1037,10 @@ void ScDataBarFrmtEntry::Init() ScFormatEntry* ScDataBarFrmtEntry::createDatabarEntry() const { SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), *mxLbDataBarMinType, - *mxEdDataBarMin, mpDoc, maPos); + *mxEdDataBarMin, mrDoc, maPos); SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), *mxLbDataBarMaxType, - *mxEdDataBarMax, mpDoc, maPos); - ScDataBarFormat* pDataBar = new ScDataBarFormat(mpDoc); + *mxEdDataBarMax, mrDoc, maPos); + ScDataBarFormat* pDataBar = new ScDataBarFormat(&mrDoc); pDataBar->SetDataBarData(new ScDataBarFormatData(*mpDataBarData)); return pDataBar; } @@ -1092,21 +1092,21 @@ IMPL_LINK_NOARG( ScDataBarFrmtEntry, DataBarTypeSelectHdl, weld::ComboBox&, void IMPL_LINK_NOARG( ScDataBarFrmtEntry, OptionBtnHdl, weld::Button&, void ) { SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), *mxLbDataBarMinType, - *mxEdDataBarMin, mpDoc, maPos); + *mxEdDataBarMin, mrDoc, maPos); SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), *mxLbDataBarMaxType, - *mxEdDataBarMax, mpDoc, maPos); - ScDataBarSettingsDlg aDlg(mpParent->GetFrameWeld(), *mpDataBarData, mpDoc, maPos); + *mxEdDataBarMax, mrDoc, maPos); + ScDataBarSettingsDlg aDlg(mpParent->GetFrameWeld(), *mpDataBarData, mrDoc, maPos); if (aDlg.run() == RET_OK) { mpDataBarData.reset(aDlg.GetData()); - SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *mxLbDataBarMinType, *mxEdDataBarMin, mpDoc); - SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *mxLbDataBarMaxType, *mxEdDataBarMax, mpDoc); + SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *mxLbDataBarMinType, *mxEdDataBarMin, mrDoc); + SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *mxLbDataBarMaxType, *mxEdDataBarMax, mrDoc); DataBarTypeSelectHdl(*mxLbDataBarMinType); } } -ScDateFrmtEntry::ScDateFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat) - : ScCondFrmtEntry(pParent, pDoc, ScAddress()) +ScDateFrmtEntry::ScDateFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScCondDateFormatEntry* pFormat) + : ScCondFrmtEntry(pParent, rDoc, ScAddress()) , mxLbDateEntry(mxBuilder->weld_combo_box(u"datetype"_ustr)) , mxFtStyle(mxBuilder->weld_label(u"styleft"_ustr)) , mxLbStyle(mxBuilder->weld_combo_box(u"style"_ustr)) @@ -1121,7 +1121,7 @@ ScDateFrmtEntry::ScDateFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, co Init(); - StartListening(*pDoc->GetStyleSheetPool(), DuplicateHandling::Prevent); + StartListening(*rDoc.GetStyleSheetPool(), DuplicateHandling::Prevent); if(pFormat) { @@ -1143,7 +1143,7 @@ void ScDateFrmtEntry::Init() mxLbDateEntry->set_active(0); mxLbType->set_active(3); - ScCondFormatHelper::FillStyleListBox(mpDoc, *mxLbStyle); + ScCondFormatHelper::FillStyleListBox(mrDoc, *mxLbStyle); mxLbStyle->connect_changed( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) ); mxLbStyle->set_active(1); } @@ -1173,13 +1173,13 @@ void ScDateFrmtEntry::Notify( SfxBroadcaster&, const SfxHint& rHint ) if(rHint.GetId() == SfxHintId::StyleSheetModified || rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) { if(!mbIsInStyleCreate) - ScCondFormatHelper::UpdateStyleList(*mxLbStyle, mpDoc); + ScCondFormatHelper::UpdateStyleList(*mxLbStyle, mrDoc); } } ScFormatEntry* ScDateFrmtEntry::GetEntry() const { - ScCondDateFormatEntry* pNewEntry = new ScCondDateFormatEntry(mpDoc); + ScCondDateFormatEntry* pNewEntry = new ScCondDateFormatEntry(&mrDoc); condformat::ScCondFormatDateType eType = static_cast(mxLbDateEntry->get_active()); pNewEntry->SetDateType(eType); pNewEntry->SetStyleName(mxLbStyle->get_active_text()); @@ -1195,7 +1195,7 @@ OUString ScDateFrmtEntry::GetExpressionString() IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl, weld::ComboBox&, void ) { mbIsInStyleCreate = true; - ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview); + ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mrDoc, maWdPreview); mbIsInStyleCreate = false; } @@ -1212,7 +1212,7 @@ private: weld::Container* mpContainer; public: - ScIconSetFrmtDataEntry(weld::Container* pParent, ScIconSetType eType, const ScDocument* pDoc, + ScIconSetFrmtDataEntry(weld::Container* pParent, ScIconSetType eType, const ScDocument& rDoc, sal_Int32 i, const ScColorScaleEntry* pEntry = nullptr); ~ScIconSetFrmtDataEntry(); void Show() { mxGrid->show(); } @@ -1228,7 +1228,7 @@ public: void SetFirstEntry(); }; -ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry(weld::Container* pParent, ScIconSetType eType, const ScDocument* pDoc, sal_Int32 i, const ScColorScaleEntry* pEntry) +ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry(weld::Container* pParent, ScIconSetType eType, const ScDocument& rDoc, sal_Int32 i, const ScColorScaleEntry* pEntry) : mxBuilder(Application::CreateBuilder(pParent, u"modules/scalc/ui/conditionaliconset.ui"_ustr)) , mxGrid(mxBuilder->weld_container(u"ConditionalIconSet"_ustr)) , mxImgIcon(mxBuilder->weld_image(u"icon"_ustr)) @@ -1247,15 +1247,15 @@ ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry(weld::Container* pParent, ScIconS { case COLORSCALE_VALUE: mxLbEntryType->set_active(0); - mxEdEntry->set_text(convertNumberToString(pEntry->GetValue(), pDoc)); + mxEdEntry->set_text(convertNumberToString(pEntry->GetValue(), rDoc)); break; case COLORSCALE_PERCENTILE: mxLbEntryType->set_active(2); - mxEdEntry->set_text(convertNumberToString(pEntry->GetValue(), pDoc)); + mxEdEntry->set_text(convertNumberToString(pEntry->GetValue(), rDoc)); break; case COLORSCALE_PERCENT: mxLbEntryType->set_active(1); - mxEdEntry->set_text(convertNumberToString(pEntry->GetValue(), pDoc)); + mxEdEntry->set_text(convertNumberToString(pEntry->GetValue(), rDoc)); break; case COLORSCALE_FORMULA: mxLbEntryType->set_active(3); @@ -1319,8 +1319,8 @@ void ScIconSetFrmtDataEntry::SetFirstEntry() mxLbEntryType->set_active(1); } -ScIconSetFrmtEntry::ScIconSetFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat) - : ScCondFrmtEntry(pParent, pDoc, rPos) +ScIconSetFrmtEntry::ScIconSetFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat) + : ScCondFrmtEntry(pParent, rDoc, rPos) , mxLbColorFormat(mxBuilder->weld_combo_box(u"colorformat"_ustr)) , mxLbIconSetType(mxBuilder->weld_combo_box(u"iconsettype"_ustr)) , mxIconParent(mxBuilder->weld_container(u"iconparent"_ustr)) @@ -1342,7 +1342,7 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry(ScCondFormatList* pParent, ScDocument* pD i < n; ++i) { maEntries.emplace_back(new ScIconSetFrmtDataEntry( - mxIconParent.get(), eType, pDoc, i, pIconSetFormatData->m_Entries[i].get())); + mxIconParent.get(), eType, rDoc, i, pIconSetFormatData->m_Entries[i].get())); maEntries[i]->set_grid_top_attach(i); } maEntries[0]->SetFirstEntry(); @@ -1375,7 +1375,7 @@ IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl, weld::ComboBox&, void ) for(size_t i = 0; i < nElements; ++i) { - maEntries.emplace_back(new ScIconSetFrmtDataEntry(mxIconParent.get(), static_cast(nPos), mpDoc, i)); + maEntries.emplace_back(new ScIconSetFrmtDataEntry(mxIconParent.get(), static_cast(nPos), mrDoc, i)); maEntries[i]->set_grid_top_attach(i); maEntries[i]->Show(); } @@ -1413,13 +1413,13 @@ void ScIconSetFrmtEntry::SetInactive() ScFormatEntry* ScIconSetFrmtEntry::GetEntry() const { - ScIconSetFormat* pFormat = new ScIconSetFormat(mpDoc); + ScIconSetFormat* pFormat = new ScIconSetFormat(&mrDoc); ScIconSetFormatData* pData = new ScIconSetFormatData; pData->eIconSetType = static_cast(mxLbIconSetType->get_active()); for(const auto& rxEntry : maEntries) { - pData->m_Entries.emplace_back(rxEntry->CreateEntry(*mpDoc, maPos)); + pData->m_Entries.emplace_back(rxEntry->CreateEntry(mrDoc, maPos)); } pFormat->SetIconSetData(pData); diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index fe473ce80b96..677d10c3b9d5 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -71,7 +71,7 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, u"CondFormatEasyDlg"_ustr) , mpParent(pParent) , mpViewData(pViewData) - , mpDocument(&mpViewData->GetDocument()) + , mrDocument(mpViewData->GetDocument()) , mbIsManaged(false) , mnFormatKey(0) , mnEntryIndex(0) @@ -264,7 +264,7 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, ScRangeList aRange; mpViewData->GetMarkData().FillRangeListWithMarks(&aRange, false); ScConditionalFormat* format - = mpDocument->GetCondFormList(mpViewData->GetTabNo())->GetFormat(mnFormatKey); + = mrDocument.GetCondFormList(mpViewData->GetTabNo())->GetFormat(mnFormatKey); if (aRange.empty() && mnFormatKey != -1 && mnEntryIndex != -1) { aRange = format->GetRangeList(); @@ -280,7 +280,7 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, maPosition.SetTab(mpViewData->GetTabNo()); OUString sRangeString; - aRange.Format(sRangeString, ScRefFlags::VALID, *mpDocument, mpDocument->GetAddressConvention()); + aRange.Format(sRangeString, ScRefFlags::VALID, mrDocument, mrDocument.GetAddressConvention()); mxRangeEntry->SetText(sRangeString); OUString sStyleName; @@ -307,8 +307,8 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, } } - StartListening(*mpDocument->GetStyleSheetPool(), DuplicateHandling::Prevent); - ScCondFormatHelper::FillStyleListBox(mpDocument, *mxStyles); + StartListening(*mrDocument.GetStyleSheetPool(), DuplicateHandling::Prevent); + ScCondFormatHelper::FillStyleListBox(mrDocument, *mxStyles); mxStyles->set_active_text(sStyleName); StyleSelectHdl(*mxStyles); @@ -328,7 +328,7 @@ void ConditionalFormatEasyDialog::Notify(SfxBroadcaster&, const SfxHint& rHint) { if (rHint.GetId() == SfxHintId::StyleSheetModified || rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) - ScCondFormatHelper::UpdateStyleList(*mxStyles, mpDocument); + ScCondFormatHelper::UpdateStyleList(*mxStyles, mrDocument); } void ConditionalFormatEasyDialog::SetReference(const ScRange& rRange, ScDocument&) @@ -340,7 +340,7 @@ void ConditionalFormatEasyDialog::SetReference(const ScRange& rRange, ScDocument ScRefFlags nFlags = ScRefFlags::RANGE_ABS; const ScDocument& rDoc = mpViewData->GetDocument(); OUString sRange( - rRange.Format(rDoc, nFlags, ScAddress::Details(mpDocument->GetAddressConvention(), 0, 0))); + rRange.Format(rDoc, nFlags, ScAddress::Details(mrDocument.GetAddressConvention(), 0, 0))); pEdit->SetRefString(sRange); maPosition = rRange.aStart; } @@ -361,11 +361,11 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo if (&rButton == mxButtonOk.get()) { if (mnEntryIndex != -1 && mnFormatKey != -1) // isEdit - mpDocument->GetCondFormList(maPosition.Tab()) + mrDocument.GetCondFormList(maPosition.Tab()) ->GetFormat(mnFormatKey) ->RemoveEntry(mnEntryIndex); - std::unique_ptr pFormat(new ScConditionalFormat(0, mpDocument)); + std::unique_ptr pFormat(new ScConditionalFormat(0, &mrDocument)); OUString sExpression1 = (mxNumberEntry->get_visible() && mxAllInputs->get_visible() ? mxNumberEntry->get_text() @@ -390,20 +390,20 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo std::unique_ptr xEntry; if (meMode < ScConditionMode::Formula) { - xEntry.reset(new ScCondFormatEntry(meMode, sExpression1, sExpression2, *mpDocument, + xEntry.reset(new ScCondFormatEntry(meMode, sExpression1, sExpression2, mrDocument, maPosition, mxStyles->get_active_text())); } else if (meMode >= ScConditionMode::Today && meMode < ScConditionMode::NONE) { - ScCondDateFormatEntry entry(mpDocument); + ScCondDateFormatEntry entry(&mrDocument); entry.SetDateType(GetScCondFormatDateType(meMode)); entry.SetStyleName(mxStyles->get_active_text()); - xEntry.reset(new ScCondDateFormatEntry(mpDocument, entry)); + xEntry.reset(new ScCondDateFormatEntry(&mrDocument, entry)); } else if (meMode == ScConditionMode::Formula) { xEntry.reset(new ScCondFormatEntry(ScConditionMode::Direct, msFormula, OUString(), - *mpDocument, maPosition, + mrDocument, maPosition, mxStyles->get_active_text())); } else @@ -432,12 +432,12 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo IMPL_LINK_NOARG(ConditionalFormatEasyDialog, StyleSelectHdl, weld::ComboBox&, void) { - ScCondFormatHelper::StyleSelect(mpParent, *mxStyles, &(mpViewData->GetDocument()), maWdPreview); + ScCondFormatHelper::StyleSelect(mpParent, *mxStyles, mpViewData->GetDocument(), maWdPreview); } IMPL_LINK(ConditionalFormatEasyDialog, OnEdChanged, weld::Entry&, rEntry, void) { - ScCondFormatHelper::ValidateInputField(rEntry, *mxWarningLabel, mpDocument, maPosition); + ScCondFormatHelper::ValidateInputField(rEntry, *mxWarningLabel, mrDocument, maPosition); if (!mxWarningLabel->get_label().isEmpty()) mxWarningLabel->show(); diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx index 876facef4dc8..39e183278666 100644 --- a/sc/source/ui/condformat/condformathelper.cxx +++ b/sc/source/ui/condformat/condformathelper.cxx @@ -231,7 +231,7 @@ OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int } void ScCondFormatHelper::StyleSelect(weld::Window* pDialogParent, weld::ComboBox& rLbStyle, - const ScDocument* pDoc, SvxFontPrevWindow& rWdPreview) + const ScDocument& rDoc, SvxFontPrevWindow& rWdPreview) { if (rLbStyle.get_active() == 0) { @@ -260,7 +260,7 @@ void ScCondFormatHelper::StyleSelect(weld::Window* pDialogParent, weld::ComboBox pDisp->Lock(true); // Find the new style and add it into the style list boxes - SfxStyleSheetIterator aStyleIter(pDoc->GetStyleSheetPool(), SfxStyleFamily::Para); + SfxStyleSheetIterator aStyleIter(rDoc.GetStyleSheetPool(), SfxStyleFamily::Para); bool bFound = false; for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle && !bFound; pStyle = aStyleIter.Next()) @@ -293,7 +293,7 @@ void ScCondFormatHelper::StyleSelect(weld::Window* pDialogParent, weld::ComboBox OUString aStyleName = rLbStyle.get_active_text(); SfxStyleSheetBase* pStyleSheet - = pDoc->GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para); + = rDoc.GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para); if (pStyleSheet) { const SfxItemSet& rSet = pStyleSheet->GetItemSet(); @@ -301,10 +301,10 @@ void ScCondFormatHelper::StyleSelect(weld::Window* pDialogParent, weld::ComboBox } } -void ScCondFormatHelper::FillStyleListBox(const ScDocument* pDocument, weld::ComboBox& rCombo) +void ScCondFormatHelper::FillStyleListBox(const ScDocument& rDocument, weld::ComboBox& rCombo) { std::set aStyleNames; - SfxStyleSheetIterator aStyleIter(pDocument->GetStyleSheetPool(), SfxStyleFamily::Para); + SfxStyleSheetIterator aStyleIter(rDocument.GetStyleSheetPool(), SfxStyleFamily::Para); for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next()) { aStyleNames.insert(pStyle->GetName()); @@ -315,16 +315,16 @@ void ScCondFormatHelper::FillStyleListBox(const ScDocument* pDocument, weld::Com } } -void ScCondFormatHelper::UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument* pDoc) +void ScCondFormatHelper::UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument& rDoc) { OUString aSelectedStyle = rLbStyle.get_active_text(); for (sal_Int32 i = rLbStyle.get_count(); i > 1; --i) rLbStyle.remove(i - 1); - ScCondFormatHelper::FillStyleListBox(pDoc, rLbStyle); + ScCondFormatHelper::FillStyleListBox(rDoc, rLbStyle); rLbStyle.set_active_text(aSelectedStyle); } -void ScCondFormatHelper::ValidateInputField(weld::Entry& rEntry, weld::Label& rLabel, ScDocument* pDoc, ScAddress& rPos) +void ScCondFormatHelper::ValidateInputField(weld::Entry& rEntry, weld::Label& rLabel, ScDocument& rDoc, ScAddress& rPos) { OUString aFormula = rEntry.get_text(); @@ -334,7 +334,7 @@ void ScCondFormatHelper::ValidateInputField(weld::Entry& rEntry, weld::Label& rL return; } - ScCompiler aComp( *pDoc, rPos, pDoc->GetGrammar() ); + ScCompiler aComp( rDoc, rPos, rDoc.GetGrammar() ); aComp.SetExtendedErrorDetection( ScCompiler::ExtendedErrorDetection::EXTENDED_ERROR_DETECTION_NAME_BREAK); std::unique_ptr ta(aComp.CompileString(aFormula)); diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx index c30e4c80fa75..5865527e3dc2 100644 --- a/sc/source/ui/inc/colorformat.hxx +++ b/sc/source/ui/inc/colorformat.hxx @@ -23,7 +23,7 @@ private: OUString maStrWarnSameValue; SvNumberFormatter* mpNumberFormatter; - ScDocument* mpDoc; + ScDocument& mrDoc; ScAddress maPos; std::unique_ptr mxBtnOk; @@ -53,7 +53,7 @@ private: void Init(); public: - ScDataBarSettingsDlg(weld::Window* pParent, const ScDataBarFormatData& rData, ScDocument* pDoc, + ScDataBarSettingsDlg(weld::Window* pParent, const ScDataBarFormatData& rData, ScDocument& rDoc, const ScAddress& rPos); virtual ~ScDataBarSettingsDlg() override; diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index 4b2b4cfb4c11..1946196b5028 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -38,19 +38,20 @@ private: bool mbFrozen; bool mbNewEntry; - ScDocument* mpDoc; + ScDocument& mrDoc; ScAddress maPos; ScRangeList maRanges; ScCondFormatDlg* mpDialogParent; public: ScCondFormatList(ScCondFormatDlg* pParent, + ScDocument& rDoc, std::unique_ptr xWindow, std::unique_ptr xGrid); weld::Container* GetContainer() { return mxGrid.get(); } ~ScCondFormatList(); - void init(ScDocument& rDoc, const ScConditionalFormat* pFormat, + void init(const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType); diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index 6f024643d4b3..05cb252e9b68 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -61,7 +61,7 @@ private: protected: std::unique_ptr mxLbType; - ScDocument* mpDoc; + ScDocument& mrDoc; ScAddress maPos; virtual void Select(); @@ -70,7 +70,7 @@ protected: virtual OUString GetExpressionString() = 0; public: - ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos); + ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos); virtual ~ScCondFrmtEntry(); void Show() { mxGrid->show(); } @@ -127,7 +127,7 @@ protected: virtual void Deselect() override; public: - ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, + ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = nullptr); virtual ~ScConditionFrmtEntry() override; @@ -156,7 +156,7 @@ class ScFormulaFrmtEntry : public ScCondFrmtEntry DECL_LINK(StyleSelectHdl, weld::ComboBox&, void); public: - ScFormulaFrmtEntry(ScCondFormatList* pParent, ScDocument* PDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = nullptr); + ScFormulaFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = nullptr); virtual ~ScFormulaFrmtEntry() override; virtual ScFormatEntry* GetEntry() const override; @@ -191,7 +191,7 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry DECL_LINK( EntryTypeHdl, weld::ComboBox&, void ); public: - ScColorScale2FrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = nullptr); + ScColorScale2FrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = nullptr); virtual ~ScColorScale2FrmtEntry() override; virtual ScFormatEntry* GetEntry() const override; virtual void SetActive() override; @@ -228,7 +228,7 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry DECL_LINK( EntryTypeHdl, weld::ComboBox&, void ); public: - ScColorScale3FrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = nullptr); + ScColorScale3FrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = nullptr); virtual ~ScColorScale3FrmtEntry() override; virtual ScFormatEntry* GetEntry() const override; virtual void SetActive() override; @@ -261,7 +261,7 @@ class ScDataBarFrmtEntry : public ScCondFrmtEntry DECL_LINK( OptionBtnHdl, weld::Button&, void ); DECL_LINK( DataBarTypeSelectHdl, weld::ComboBox&, void ); public: - ScDataBarFrmtEntry(ScCondFormatList* pParemt, ScDocument* pDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat = nullptr); + ScDataBarFrmtEntry(ScCondFormatList* pParemt, ScDocument& rDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat = nullptr); virtual ~ScDataBarFrmtEntry() override; virtual ScFormatEntry* GetEntry() const override; virtual void SetActive() override; @@ -273,7 +273,7 @@ public: class ScDateFrmtEntry : public ScCondFrmtEntry, public SfxListener { public: - ScDateFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat = nullptr); + ScDateFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScCondDateFormatEntry* pFormat = nullptr); virtual ~ScDateFrmtEntry() override; virtual ScFormatEntry* GetEntry() const override; virtual void SetActive() override; @@ -320,7 +320,7 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry DECL_LINK(IconSetTypeHdl, weld::ComboBox&, void); public: - ScIconSetFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat = nullptr); + ScIconSetFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat = nullptr); virtual ~ScIconSetFrmtEntry() override; virtual ScFormatEntry* GetEntry() const override; virtual void SetActive() override; diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index 8bc21215b178..6dfa19c37752 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -41,7 +41,7 @@ private: weld::Window* mpParent; ScViewData* mpViewData; - ScDocument* mpDocument; + ScDocument& mrDocument; ScConditionMode meMode; bool mbIsManaged; OUString msFormula; diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx index f3bd7b2a2013..1098b56e4663 100644 --- a/sc/source/ui/inc/condformathelper.hxx +++ b/sc/source/ui/inc/condformathelper.hxx @@ -35,10 +35,10 @@ public: static SC_DLLPUBLIC OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex, std::u16string_view aStr1 = std::u16string_view(), std::u16string_view aStr2 = std::u16string_view() ); static SC_DLLPUBLIC void StyleSelect(weld::Window* pDialogParent, weld::ComboBox& rLbStyle, - const ScDocument* pDoc, SvxFontPrevWindow& rWdPreview); - static SC_DLLPUBLIC void FillStyleListBox(const ScDocument* pDocument, weld::ComboBox& rCombo); - static SC_DLLPUBLIC void UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument* pDoc); - static SC_DLLPUBLIC void ValidateInputField(weld::Entry& rEntry, weld::Label& label, ScDocument* pDoc, ScAddress& rPos); + const ScDocument& rDoc, SvxFontPrevWindow& rWdPreview); + static SC_DLLPUBLIC void FillStyleListBox(const ScDocument& rDocument, weld::ComboBox& rCombo); + static SC_DLLPUBLIC void UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument& rDoc); + static SC_DLLPUBLIC void ValidateInputField(weld::Entry& rEntry, weld::Label& label, ScDocument& rDoc, ScAddress& rPos); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 29a95e4b9051ee35b063b88ac4d80d81f78eca85 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Mon, 25 Nov 2024 14:59:59 +0100 Subject: [PATCH 248/373] tdf#163870 remove list attribute on style apply Follow-up to 075560420a7aa238182e2d80dfe1c5fbaad3edbd Removes hard list attribute also if the applied paragraph style is applied again. Change-Id: Ic08241b5e244690825dfe79c419298c5d5f7c17e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177270 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Tested-by: Gabor Kelemen --- sw/qa/extras/uiwriter/data/tdf162326_list.odt | Bin 0 -> 10423 bytes sw/qa/extras/uiwriter/uiwriter9.cxx | 28 +++++++++++++++++- sw/source/core/doc/docfmt.cxx | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100755 sw/qa/extras/uiwriter/data/tdf162326_list.odt diff --git a/sw/qa/extras/uiwriter/data/tdf162326_list.odt b/sw/qa/extras/uiwriter/data/tdf162326_list.odt new file mode 100755 index 0000000000000000000000000000000000000000..324ac884337c9cee9ab20a6c533c4f8ca01da18b GIT binary patch literal 10423 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 } -CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Pargraph) +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Paragraph) { createSwDoc("tdf162326.odt"); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); @@ -800,6 +800,32 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Character) CPPUNIT_ASSERT_EQUAL(short(1), getProperty(getRun(getParagraph(3), 2), u"CharUnderline"_ustr)); } + +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_List) +{ + createSwDoc("tdf162326_list.odt"); + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParaCursor(xTextDocument->getText()->createTextCursor(), + uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL(u"A)"_ustr, getProperty(xParaCursor, u"ListLabelString"_ustr)); + + dispatchCommand(mxComponent, u".uno:StyleApply"_ustr, + { comphelper::makePropertyValue(u"FamilyName"_ustr, u"ParagraphStyles"_ustr), + comphelper::makePropertyValue(u"Style"_ustr, u"Footnote"_ustr) }); + + //hard list attribute unchanged + CPPUNIT_ASSERT_EQUAL(u"A)"_ustr, getProperty(xParaCursor, u"ListLabelString"_ustr)); + + dispatchCommand(mxComponent, u".uno:StyleApply"_ustr, + { comphelper::makePropertyValue(u"FamilyName"_ustr, u"ParagraphStyles"_ustr), + comphelper::makePropertyValue(u"Style"_ustr, u"Footnote"_ustr), + comphelper::makePropertyValue(u"KeyModifier"_ustr, uno::Any(KEY_MOD1)) }); + + //list replaced by para style list setting + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, getProperty(xParaCursor, u"ListLabelString"_ustr)); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf163340) { createSwDoc("tdf163340.odt"); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 6b755eafc1af..fe20483d963e 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1018,7 +1018,7 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs ) // #i62675# check, if paragraph style has changed if ( pPara->bResetListAttrs && - pFormat != pCNd->GetFormatColl() + (pPara->bResetAllCharAttrs || pFormat != pCNd->GetFormatColl()) && pCNd->GetTextNode()->IsInList() ) { // Check, if the list style of the paragraph will change. From 7c7e7da1538c1ed0c65821e18233ec9dcdc6cd2b Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Thu, 7 Nov 2024 15:34:58 +0100 Subject: [PATCH 249/373] tdf#152839 remove paragraph spacing attributes in fill cells Invisible cells in Word are added to Writer tables to get regular tables. Borders of such cells are allready switched off. Now also paragraph spacing is removed to not determine the row height. Change-Id: I27d3d033de54f051527cf29e2655e7a564d1a5ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176219 Reviewed-by: Thorsten Behrens Tested-by: Jenkins --- .../layout/data/tdf152839_firstrows.rtf | 253 ++++++++++++++++++ sw/qa/extras/layout/layout4.cxx | 11 + sw/qa/uibase/uiview/uiview.cxx | 4 - .../writerfilter/rtftok/rtfdispatchsymbol.cxx | 39 +++ 4 files changed, 303 insertions(+), 4 deletions(-) create mode 100644 sw/qa/extras/layout/data/tdf152839_firstrows.rtf diff --git a/sw/qa/extras/layout/data/tdf152839_firstrows.rtf b/sw/qa/extras/layout/data/tdf152839_firstrows.rtf new file mode 100644 index 000000000000..477b8166602b --- /dev/null +++ b/sw/qa/extras/layout/data/tdf152839_firstrows.rtf @@ -0,0 +1,253 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1031\deflangfe1041\themelang3079\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};} +{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f48\fbidi \fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Segoe UI;} +{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};} +{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};} +{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};} +{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};} +{\f1354\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}{\f1355\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};} +{\f1357\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}{\f1358\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};} +{\f1359\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}{\f1360\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};} +{\f1361\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}{\f1362\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}{\f1694\fbidi \froman\fcharset238\fprq2 Cambria Math CE;} +{\f1695\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f1697\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f1698\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f1701\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;} +{\f1702\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f1834\fbidi \fswiss\fcharset238\fprq2 Segoe UI CE;}{\f1835\fbidi \fswiss\fcharset204\fprq2 Segoe UI Cyr;}{\f1837\fbidi \fswiss\fcharset161\fprq2 Segoe UI Greek;} +{\f1838\fbidi \fswiss\fcharset162\fprq2 Segoe UI Tur;}{\f1839\fbidi \fswiss\fcharset177\fprq2 Segoe UI (Hebrew);}{\f1840\fbidi \fswiss\fcharset178\fprq2 Segoe UI (Arabic);}{\f1841\fbidi \fswiss\fcharset186\fprq2 Segoe UI Baltic;} +{\f1842\fbidi \fswiss\fcharset163\fprq2 Segoe UI (Vietnamese);}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};} +{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};} +{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};} +{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};} +{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};} +{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};} +{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};} +{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};} +{\fhimajor\f31528\fbidi \fswiss\fcharset238\fprq2 Calibri Light CE;}{\fhimajor\f31529\fbidi \fswiss\fcharset204\fprq2 Calibri Light Cyr;}{\fhimajor\f31531\fbidi \fswiss\fcharset161\fprq2 Calibri Light Greek;} +{\fhimajor\f31532\fbidi \fswiss\fcharset162\fprq2 Calibri Light Tur;}{\fhimajor\f31533\fbidi \fswiss\fcharset177\fprq2 Calibri Light (Hebrew);}{\fhimajor\f31534\fbidi \fswiss\fcharset178\fprq2 Calibri Light (Arabic);} +{\fhimajor\f31535\fbidi \fswiss\fcharset186\fprq2 Calibri Light Baltic;}{\fhimajor\f31536\fbidi \fswiss\fcharset163\fprq2 Calibri Light (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};} +{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};} +{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};} +{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};} +{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};} +{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};} +{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};} +{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};} +{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};} +{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};} +{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};} +{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};} +{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;} +{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31573\fbidi \fswiss\fcharset177\fprq2 Calibri (Hebrew);} +{\fhiminor\f31574\fbidi \fswiss\fcharset178\fprq2 Calibri (Arabic);}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);} +{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};} +{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};} +{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};} +{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}}{\colortbl;\red0\green0\blue0; +\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128; +\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red0\green0\blue0;\red0\green0\blue0;}{\*\defchp \fs22 }{\*\defpap \ql \li0\ri0\sa160\sl259\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 +\fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\sb120\sa120\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs32\alang1025 +\ltrch\fcs0 \fs32\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 \sbasedon0 \snext0 \slink15 \sqformat \styrsid12458106 heading 1;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa160\sl259\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1031\langfe1041\cgrid\langnp1031\langfenp1041 \snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive \rtlch\fcs1 +\ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 \'dcberschrift 1 Zchn;}{\s16\ql \li0\ri0\widctlpar\brdrt\brdrs\brdrw10\brsp20 \brdrl\brdrs\brdrw10\brsp80 \brdrb +\brdrs\brdrw10\brsp20 \brdrr\brdrs\brdrw10\brsp80 \wrapdefault\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\cf6\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 \sbasedon0 \snext0 +BausteinName;}{\s17\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ai\af0\afs20\alang1025 \ltrch\fcs0 \i\fs20\cf10\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 \sbasedon0 \snext0 Kommentar;}{ +\s18\ql \li0\ri0\widctlpar\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 \sbasedon0 \snext18 \slink19 header;}{\* +\cs19 \additive \rtlch\fcs1 \af0\afs26 \ltrch\fcs0 \fs26 \sbasedon10 \slink18 \slocked \ssemihidden Kopfzeile Zchn;}{\s20\ql \li0\ri0\widctlpar\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 +\af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 \sbasedon0 \snext20 \slink21 footer;}{\*\cs21 \additive \rtlch\fcs1 \af0\afs26 \ltrch\fcs0 \fs26 \sbasedon10 \slink20 \slocked \ssemihidden Fu\'dfzeile Zchn;}{ +\s22\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af48\afs18\alang1025 \ltrch\fcs0 \f48\fs18\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 +\sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid477296 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af48\afs18 \ltrch\fcs0 \f48\fs18 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid477296 Sprechblasentext Zchn;}}{\*\rsidtbl \rsid25915 +\rsid141657\rsid162930\rsid337940\rsid468624\rsid477296\rsid538180\rsid734395\rsid882106\rsid1008931\rsid1116736\rsid1131385\rsid1186002\rsid1378358\rsid1457463\rsid1458675\rsid1463711\rsid1576598\rsid1643320\rsid1733725\rsid2233523\rsid2237796 +\rsid2239019\rsid2294971\rsid2363667\rsid2580829\rsid3020432\rsid3151009\rsid3230690\rsid3676125\rsid4327642\rsid4655589\rsid4939037\rsid5118193\rsid5398017\rsid5587896\rsid5841343\rsid5984835\rsid6555207\rsid6701627\rsid6712741\rsid6831792\rsid7089764 +\rsid7152567\rsid7290328\rsid7496291\rsid7549106\rsid7606353\rsid7810231\rsid7872350\rsid8015286\rsid8078336\rsid8148054\rsid8479968\rsid8534386\rsid8608751\rsid8983466\rsid9060380\rsid9242023\rsid9322053\rsid9402351\rsid9595908\rsid10161122\rsid10238746 +\rsid10242283\rsid10557518\rsid10896052\rsid10964931\rsid11037801\rsid11081007\rsid11094885\rsid11283431\rsid11344075\rsid11424229\rsid11499115\rsid11690788\rsid11871934\rsid11893049\rsid11947419\rsid12262926\rsid12458106\rsid12652382\rsid12928601 +\rsid12986890\rsid12999067\rsid13055997\rsid13110340\rsid13254002\rsid13255087\rsid13305316\rsid13334452\rsid13516935\rsid14315527\rsid14378587\rsid14563127\rsid14580302\rsid14632582\rsid14708412\rsid14823218\rsid14964844\rsid15622987\rsid15626663 +\rsid15745522\rsid16274659\rsid16606131}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\subject asdf}{\author Oliver Specht}{\operator Oliver Specht} +{\creatim\yr2024\mo11\dy20\hr8\min57}{\revtim\yr2024\mo11\dy20\hr8\min57}{\printim\yr2022\mo10\dy11\hr12\min16}{\version2}{\edmins0}{\nofpages1}{\nofwords4}{\nofchars27}{\*\company BMLV}{\nofcharsws30}{\vern107}}{\*\userprops {\propname KPH_Enabled} +\proptype30{\staticval 0}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw16840\paperh11907\margl1134\margr1418\margt567\margb567\gutter0\ltrsect +\deftab709\widowctrl\ftnbj\aenddoc\hyphhotz425\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0 +\showxmlerrors0\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dgmargin\dghspace130\dgvspace180\dghorigin1134\dgvorigin567\dghshow0\dgvshow0 +\jexpand\viewkind1\viewscale180\pgbrdrhead\pgbrdrfoot\nolnhtadjtbl\nojkernpunct\rsidroot4655589 \fet0{\*\wgrffmtfilter 013f}\ilfomacatclnup0{\*\template C:\\Users\\x2mf\\AppData\\Roaming\\Microsoft\\Templates\\kis.3.0.dot} +{\*\docvar {DKE_SBGeschlecht}{[SBGeschlecht]}}{\*\docvar {KPH_Genehmiger}{[Genehmiger]}}{\*\docvar {KPH_Gesch\'e4ftszahl}{[Gesch\'e4ftszahl]}}{\*\docvar {KPH_Sachbearbeiter}{[Sachbearbeiter]}}{\*\docvar {KPH_SBeMail}{[SB_eMail]}} +{\*\docvar {KPH_SBFax}{[SB_Fax]}}{\*\docvar {KPH_SBIFMIN}{SBIFMIN}}{\*\docvar {KPH_SBTelefon}{[SB_Telefon]}}{\*\ftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 +\af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid162930 \chftnsep +\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 {\rtlch\fcs1 \af0 +\ltrch\fcs0 \insrsid162930 \chftnsepc +\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 {\rtlch\fcs1 \af0 +\ltrch\fcs0 \insrsid162930 \chftnsep +\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 {\rtlch\fcs1 \af0 +\ltrch\fcs0 \insrsid162930 \chftnsepc +\par }}\ltrpar \sectd \ltrsect\lndscpsxn\binfsxn4\binsxn4\psz9\linex0\headery567\footery567\endnhere\sectlinegrid354\sectdefaultcl\sectrsid8078336\sftnbj {\headerl \ltrpar \pard\plain \ltrpar\s18\ql \li0\ri0\widctlpar +\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6701627 +\par }}{\headerr \ltrpar \pard\plain \ltrpar\s18\ql \li0\ri0\widctlpar\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6701627 +\par }}{\footerl \ltrpar \pard\plain \ltrpar\s20\ql \li0\ri0\widctlpar\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6701627 +\par }}{\footerr \ltrpar \pard\plain \ltrpar\s20\ql \li0\ri0\widctlpar\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid6701627 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 +\fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid12458106\charrsid6701627 +\par }}{\headerf \ltrpar \pard\plain \ltrpar\s18\ql \li0\ri0\widctlpar\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6701627 +\par }}{\footerf \ltrpar \pard\plain \ltrpar\s20\ql \li0\ri0\widctlpar\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6701627 +\par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}} +{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8 +\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li0\ri-1\widctlpar +\tqr\tx14317\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin-1\lin0\itap0\pararsid12458106 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 \fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 +\v\fs18\insrsid11037801\charrsid5118193 \line }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \v\fs18\insrsid11283431\charrsid5118193 \line \line \line }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \v\fs18\cf1\insrsid5118193\charrsid5118193 \line }{\rtlch\fcs1 \ab\af0\afs2 +\ltrch\fcs0 \b\fs2\insrsid12458106\charrsid3020432 +\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts11\trgaph70\trleft-70\trkeep\trftsWidth3\trwWidth14240\trftsWidthB3\trftsWidthA3\trwWidthA11405\trpaddl70\trpaddr70\trpaddfl3\trpaddfr3\tblrsid1131385\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl +\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth2835\clshdrawnil \cellx2765\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid1458675 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 +\fs18\insrsid2237796 \cell }\pard \ltrpar\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18\insrsid2237796 \trowd \irow0\irowband0\ltrrow +\ts11\trgaph70\trleft-70\trkeep\trftsWidth3\trwWidth14240\trftsWidthB3\trftsWidthA3\trwWidthA11405\trpaddl70\trpaddr70\trpaddfl3\trpaddfr3\tblrsid1131385\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl +\cltxlrtb\clftsWidth3\clwWidth2835\clshdrawnil \cellx2765\row \ltrrow}\trowd \irow1\irowband1\lastrow \ltrrow +\ts11\trgaph70\trleft-70\trkeep\trftsWidth3\trwWidth14240\trftsWidthB3\trftsWidthA3\trpaddl70\trpaddr70\trpaddfl3\trpaddfr3\tblrsid13110340\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw45 \clbrdrl\brdrs\brdrw45 \clbrdrb\brdrs\brdrw45 \clbrdrr +\brdrs\brdrw45 \cltxlrtb\clftsWidth3\clwWidth14240\clshdrawnil \cellx14170\pard \ltrpar\ql \li0\ri0\sb120\sa120\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid1458675 {\rtlch\fcs1 \af0\afs72 \ltrch\fcs0 +\fs72\lang1024\langfe1024\noproof\langnp1040\insrsid5587896 MUSTERMANN Max}{\rtlch\fcs1 \af0\afs72 \ltrch\fcs0 \fs72\lang1040\langfe3079\langnp1040\insrsid2237796\charrsid14823218 \cell }\pard \ltrpar\ql \li0\ri0\sa160\sl259\slmult1 +\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af0\afs72 \ltrch\fcs0 \fs72\lang1040\langfe3079\langnp1040\insrsid2237796\charrsid14823218 \trowd \irow1\irowband1\lastrow \ltrrow +\ts11\trgaph70\trleft-70\trkeep\trftsWidth3\trwWidth14240\trftsWidthB3\trftsWidthA3\trpaddl70\trpaddr70\trpaddfl3\trpaddfr3\tblrsid13110340\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw45 \clbrdrl\brdrs\brdrw45 \clbrdrb\brdrs\brdrw45 \clbrdrr +\brdrs\brdrw45 \cltxlrtb\clftsWidth3\clwWidth14240\clshdrawnil \cellx14170\row }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid1131385 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 +\v\fs18\insrsid13255087\charrsid13255087 \line \line \line \line \line }{\rtlch\fcs1 \af0 \ltrch\fcs0 \v\lang1024\langfe1024\noproof\insrsid2237796\charrsid13255087 +\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a +9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad +5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6 +b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0 +0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6 +a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f +c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512 +0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462 +a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865 +6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b +4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b +4757e8d3f729e245eb2b260a0238fd010000ffff0300504b030414000600080000002100937e00e7ca060000891a0000160000007468656d652f7468656d652f +7468656d65312e786d6cec595b8bdb46147e2ff43f08bd3bbe49be2cf1065bb69336bb49889d943cceda636bb2238dd18c776342a0244f7d2914d2d28706fad6 +87521a68a0a12ffd310b1bdaf447f4cc489667ec71f6420aa1640d8b34face996fce39face48ba7aed51449d239c70c2e2965bbe52721d1c8fd898c4d3967b6f +d82f345c870b148f1165316eb90bccdd6bbb9f7e7215ed881047d801fb98efa0961b0a31db2916f9088611bfc26638866b13964448c069322d8e13740c7e235a +ac944ab5628448ec3a318ac0ededc9848cb0bbbb74dba3e03b165c0e8c6832904ef126767c589608bee0014d9c23445b2ecc3066c743fc48b80e455cc085965b +527f6e71f76a11ed6446546cb1d5ecfaea2fb3cb0cc687153567323dc827f53cdfabb573ff0a40c526ae57efd57ab5dc9f02a0d108569a72d17dfa9d66a7eb67 +580d941e5a7c77ebdd6ad9c06bfeab1b9cdbbefc1978054afd7b1bf87e3f80281a78054af1fe06def3ea95c033f00a94e26b1bf87aa9ddf5ea065e81424ae2c3 +0d74c9af5583e56a73c884d11b5678d3f7faf54ae67c85826ac8ab4b4e3161b1d8566b117ac8923e002490224162472c6678824650bf01a2e42021ce1e998650 +783314330ec3a54aa95faac27ff9f3d4918a08dac148b396bc8009df18927c1c3e4ac84cb4dccfc1abab414e5fbf3e79faeae4e9ef27cf9e9d3cfd359b5bb932 +ec6ea078aadbbdfde99b7f5e7ce9fcfddb8f6f9f7f9b4ebd8ee73afecd2f5fbdf9e3cf77b98715af4271faddcb37af5e9e7efff55f3f3fb7786f27e840870f49 +84b9730b1f3b7759040bb4f0c707c9c52c862122ba453b9e721423398bc57f4f8406fad6025164c175b019c7fb09488d0d787dfed0203c0893b920168f37c3c8 +00ee33463b2cb146e1a69c4b0bf3701e4fed9327731d7717a123dbdc018a8d2cf7e633d05862731984d8a07987a258a0298eb170e4357688b165750f0831e2ba +4f4609e36c229c07c4e920620dc9901c18d5b432ba4122c8cbc24610f26dc466ffbed361d4b6ea2e3e3291706f206a213fc4d408e375341728b2b91ca288ea01 +df4322b4911c2c92918eeb7101999e62ca9cde18736eb3b99dc07ab5a4df0499b1a77d9f2e221399087268f3b98718d3915d761884289ad9b00312873af6337e +08258a9c3b4cd8e0fbccbc43e439e401c55bd37d9f6023dd67abc13d50589dd2aa40e4957962c9e575cc8cfa1d2ce804612535d0000c5d8f487ca6c8afc9bbff +dfc93b88e8e90f2f2c2b7a3f926e776ce4e38262de4e88f56ebab126e1db70ebc21db0644c3e7cddeea2797c07c3adb2d9bc3ecaf647d976fff7b2bded7e7eff +62bdd267906eb96d4db7eb6af31e6dddbb4f08a503b1a0788fabed3b87ae34eec3a0b4534fac387f969b857028ef6498c0c04d13a46c9c84892f880807219ac1 +1ebfec4a27539eb99e7267c6386cfdd5b0d5b7c4d379b4cfc6e9236bb92c1f4f53f1e048acc64b7e3e0e8f1b2245d7eaabc7b0dcbd623b558fcb4b02d2f62224 +b4c94c12550b89fa725006493d9c43d02c24d4cade0b8ba6854543ba5fa66a830550cbb302db2607365b2dd7f7c0048ce0a90a513c96794a53bdccae4ae6fbcc +f4b6601a15007b886505ac32dd945cb72e4fae2e2db57364da20a1959b49424546f5301ea231ceaa538e9e87c64573dd5ca5d4a02743a1e683d25ad1a837dec5 +e2b2b906bb756da0b1ae1434768e5b6eadea43c98cd0ace54ee0d11f0ea319d40e97db5d44a7f0e66c2492f486bf8cb2cc122eba888769c095e8a46a10118113 +8792a8e5cae5e769a0b1d210c5ad5c0141f860c93541563e3472907433c97832c123a1a75d1b91914e4f41e153adb05e55e697074b4b3687740fc2f1b17340e7 +c95d0425e6d7cb328063c2e10d50398de698c02bcd5cc856f5b7d69832d9d5df29aa1a4ac7119d8528eb28ba98a77025e5391d7596c7403bcbd60c01d5429235 +c283a96cb07a508d6e9a778d94c3d6ae7bb6918c9c269aab9e69a88aec9a7615336658b681b5585eaec96bac9621064dd33b7c2addeb92db5c6addda3e21ef12 +10f03c7e96ae7b8e86a0515b4d6650938c3765586a76366af68ee502cfa0769e26a1a97e6de9762d6e798fb04e078397eafc60b75eb5303459ee2b55a4d5570f +fdf3043b7808e2d18517c1732ab84a257c7c48106c88066a4f92ca06dc228f44766bc091334f48cb7d5cf2db5e50f18342a9e1f70a5ed52b151a7ebb5a68fb7e +b5dcf3cba56ea7f2041a8b08a3b29f7e71e9c36b28bac8bebba8f18d6f2fd1f24ddb95118b8a4c7d5b292ae2eadb4bb962f9f6e20ce52716d721203a8f6b957e +b3daecd40acd6abb5ff0ba9d46a119d43a856e2da877fbddc06f34fb4f5ce74881bd7635f06abd46a1560e8282572b49fa8d66a1ee552a6dafde6ef4bcf6936c +1b032b4fe5238b058457f1dafd170000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f7468656d652f5f72 +656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c08 +2e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd0 +8a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa +4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c0200001300000000000000000000000000000000005b436f +6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000000000000000300100005f72 +656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000190200007468656d652f746865 +6d652f7468656d654d616e616765722e786d6c504b01022d0014000600080000002100937e00e7ca060000891a00001600000000000000000000000000d60200 +007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027000000000000000000000000 +00d40900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000cf0a00000000} +{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d +617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 +6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 +656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} +{\*\latentstyles\lsdstimax376\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1; +\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; +\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7; +\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 1; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 5; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 9; +\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3; +\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6; +\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Indent; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 header;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footer; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index heading;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of figures; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope return;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation reference; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 line number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 page number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote text; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of authorities;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 macro;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 toa heading;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 3; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 3; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 3; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Closing; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Signature;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 4; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Message Header;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Note Heading; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 3; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Block Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Hyperlink;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 FollowedHyperlink;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong; +\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Document Map;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Plain Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 E-mail Signature; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Top of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Bottom of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal (Web);\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Acronym; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Cite;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Code;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Definition; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Keyboard;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Preformatted;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Sample;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Typewriter; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Variable;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation subject;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 No List;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 1; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Balloon Text;\lsdpriority39 \lsdlocked0 Table Grid; +\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid; +\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2; +\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1; +\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1; +\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; +\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2; +\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdpriority62 \lsdlocked0 Light Grid Accent 3; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3; +\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; +\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5; +\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6; +\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6; +\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6; +\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; +\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography; +\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4; +\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4; +\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1; +\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1; +\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2; +\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2; +\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3; +\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4; +\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4; +\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5; +\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5; +\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6; +\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6; +\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark; +\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1; +\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1; +\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2; +\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3; +\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3; +\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4; +\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4; +\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5; +\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5; +\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6; +\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Mention; +\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Smart Hyperlink;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Hashtag;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Unresolved Mention;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Smart Link;}}{\*\datastore 01050000 +02000000180000004d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000 +d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000f058 +85d4213bdb01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx index e2bdf093cf17..d1527e503961 100644 --- a/sw/qa/extras/layout/layout4.cxx +++ b/sw/qa/extras/layout/layout4.cxx @@ -1875,6 +1875,17 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf163285) CPPUNIT_ASSERT(topText3.startsWith("pg_3")); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf152839_firstRows) +{ + createSwDoc("tdf152839_firstrows.rtf"); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + sal_Int32 nHeight + = getXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[2]/txt/infos/bounds", "height") + .toInt32(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(223), nHeight); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx index 531d4d351432..486219215581 100644 --- a/sw/qa/uibase/uiview/uiview.cxx +++ b/sw/qa/uibase/uiview/uiview.cxx @@ -314,13 +314,9 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, TestTdf152839_Formtext) createSwDoc("tdf152839_formtext.rtf"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nBottom - = getXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[2]/cell[1]/infos/bounds", "bottom") - .toInt32(); sal_Int32 nHeight = getXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[2]/cell[1]/txt/infos/bounds", "height") .toInt32(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2308), nBottom); CPPUNIT_ASSERT_EQUAL(sal_Int32(723), nHeight); } diff --git a/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx b/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx index 35a561fbbd13..f1f53d626c91 100644 --- a/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx +++ b/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx @@ -295,6 +295,45 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) } } } + //Overwrite font size attribute on fill cells + RTFValue::Pointer_t pFontSize; + RTFValue::Pointer_t pFontSizeCs; + int nCell = 1; + for (Buf_t& rTableBufferElement : m_aTableBufferStack.back()) + { + if (BUFFER_CELLEND == std::get<0>(rTableBufferElement)) + ++nCell; + else if (nCell == nCellCount - 1) + { + if (BUFFER_PROPS_CHAR == std::get<0>(rTableBufferElement)) + { + tools::SvRef xPropValue + = std::get<1>(rTableBufferElement); + RTFSprms& rElementSprms = xPropValue->getSprms(); + pFontSize = rElementSprms.find(NS_ooxml::LN_EG_RPrBase_sz); + pFontSizeCs = rElementSprms.find(NS_ooxml::LN_EG_RPrBase_szCs); + } + } + } + + nCell = 1; + for (Buf_t& rTableBufferElement : m_aTableBufferStack.back()) + { + if (BUFFER_CELLEND == std::get<0>(rTableBufferElement)) + ++nCell; + //Remove paragraph spacing on fill cells + if (nCell == nCellCount && BUFFER_PROPS == std::get<0>(rTableBufferElement)) + { + tools::SvRef xPropValue + = std::get<1>(rTableBufferElement); + RTFSprms& rElementSprms = xPropValue->getSprms(); + rElementSprms.erase(NS_ooxml::LN_CT_PPrBase_spacing); + if (pFontSize) + rElementSprms.set(NS_ooxml::LN_EG_RPrBase_sz, pFontSize); + if (pFontSizeCs) + rElementSprms.set(NS_ooxml::LN_EG_RPrBase_szCs, pFontSizeCs); + } + } m_aStates.top().setTableRowWidthAfter(0); } From b10d331c1c9801adbf6d014d9348bb0a4dad3d2c Mon Sep 17 00:00:00 2001 From: Kurt Nordback Date: Wed, 17 Jul 2024 17:07:05 -0600 Subject: [PATCH 250/373] tdf#161800 - I/O of '# of values in second plot' parameter not supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for input and output of 'split position' parameter (number of entries in second plot) for of-pie charts. In OOXML this uses the supported split-pos tag. For ODF I added an extension in loext namespace for this parameter. This commit also includes simple tests for the I/O functionality in OOXML and ODF. Change-Id: I00ff59db721867fa836eb99b6677350040d005dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170666 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- chart2/qa/extras/chart2export.cxx | 65 ++++++++++++++++++ .../data/ods/tdf161800_barOfPie_split_pos.ods | Bin 0 -> 15011 bytes .../data/ods/tdf161800_pieOfPie_split_pos.ods | Bin 0 -> 15964 bytes .../qa/extras/data/xlsx/barOfPieChart2.xlsx | Bin 0 -> 8130 bytes .../qa/extras/data/xlsx/pieOfPieChart2.xlsx | Bin 0 -> 8036 bytes .../chartapiwrapper/DiagramWrapper.cxx | 6 +- .../dialogs/ChartTypeDialogController.cxx | 21 +++++- .../controller/dialogs/tp_ChartType.cxx | 3 +- .../controller/sidebar/ChartTypePanel.cxx | 4 +- chart2/source/inc/ChartType.hxx | 2 +- .../source/inc/ChartTypeDialogController.hxx | 6 +- chart2/source/model/main/Diagram.cxx | 6 ++ .../model/template/ChartTypeManager.cxx | 20 +++--- chart2/source/model/template/PieChartType.cxx | 6 +- .../model/template/PieChartTypeTemplate.cxx | 15 ++-- .../model/template/PieChartTypeTemplate.hxx | 1 + chart2/source/view/charttypes/PieChart.cxx | 21 +++--- chart2/source/view/charttypes/PieChart.hxx | 8 +-- .../view/main/SeriesPlotterContainer.cxx | 6 ++ include/oox/export/chartexport.hxx | 2 +- .../drawingml/chart/typegroupcontext.cxx | 2 +- .../drawingml/chart/typegroupconverter.cxx | 4 ++ oox/source/drawingml/chart/typegroupmodel.cxx | 2 +- oox/source/export/chartexport.cxx | 13 +++- oox/source/token/properties.txt | 1 + .../OpenDocument-v1.4+libreoffice-schema.rng | 9 +++ xmloff/inc/xmlprop.hxx | 1 + xmloff/source/chart/SchXMLChartContext.cxx | 9 ++- xmloff/source/chart/SchXMLChartContext.hxx | 1 + xmloff/source/chart/SchXMLExport.cxx | 37 +++++++++- 30 files changed, 218 insertions(+), 53 deletions(-) create mode 100644 chart2/qa/extras/data/ods/tdf161800_barOfPie_split_pos.ods create mode 100644 chart2/qa/extras/data/ods/tdf161800_pieOfPie_split_pos.ods create mode 100644 chart2/qa/extras/data/xlsx/barOfPieChart2.xlsx create mode 100644 chart2/qa/extras/data/xlsx/pieOfPieChart2.xlsx diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index c57c238ef3b0..3f37794e1d10 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -546,6 +546,28 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest, testBarOfPieChart) assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:ofPieChart/c:ofPieType[1]", "val", u"bar"); } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest, testPieOfPieSplitPos) +{ + loadFromFile(u"xlsx/pieOfPieChart2.xlsx"); + save(u"Calc Office Open XML"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr); + CPPUNIT_ASSERT(pXmlDoc); + + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:ofPieChart"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:ofPieChart/c:splitPos[1]", "val", u"4"); +} + +CPPUNIT_TEST_FIXTURE(Chart2ExportTest, testBarOfPieSplitPos) +{ + loadFromFile(u"xlsx/barOfPieChart2.xlsx"); + save(u"Calc Office Open XML"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr); + CPPUNIT_ASSERT(pXmlDoc); + + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:ofPieChart"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:ofPieChart/c:splitPos[1]", "val", u"5"); +} + CPPUNIT_TEST_FIXTURE(Chart2ExportTest, testDisplayUnits) { loadFromFile(u"docx/DisplayUnits.docx"); @@ -1133,6 +1155,49 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest, tdf50934_pieOfPie) CPPUNIT_ASSERT_EQUAL(chart2::PieChartSubType_PIE, subPieType); } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest, tdf161800_barOfPie_split_pos) +{ + loadFromFile(u"ods/tdf161800_barOfPie_split_pos.ods"); + saveAndReload(u"calc8"_ustr); + + uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0 ); + CPPUNIT_ASSERT(xChartDoc.is()); + + Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, 0 ); + CPPUNIT_ASSERT(xChartType.is()); + + // Verify that it saves and loads with the correct split position + Reference< beans::XPropertySet > xPropSet( xChartType, uno::UNO_QUERY_THROW ); + uno::Any aAny = xPropSet->getPropertyValue(u"SplitPos"_ustr); + CPPUNIT_ASSERT(aAny.hasValue()); + double nSplitPos; + aAny >>= nSplitPos; + CPPUNIT_ASSERT_EQUAL(4.0, nSplitPos); +} + +CPPUNIT_TEST_FIXTURE(Chart2ExportTest, tdf161800_pieOfPie_split_pos) +{ + loadFromFile(u"ods/tdf161800_pieOfPie_split_pos.ods"); + saveAndReload(u"calc8"_ustr); + + uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0 ); + CPPUNIT_ASSERT(xChartDoc.is()); + + Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, 0 ); + CPPUNIT_ASSERT(xChartType.is()); + + CPPUNIT_ASSERT_EQUAL(u"com.sun.star.chart2.PieChartType"_ustr, + xChartType->getChartType()); + + // Verify that it saves and loads with the correct split position + Reference< beans::XPropertySet > xPropSet( xChartType, uno::UNO_QUERY_THROW ); + uno::Any aAny = xPropSet->getPropertyValue(u"SplitPos"_ustr); + CPPUNIT_ASSERT(aAny.hasValue()); + double nSplitPos; + aAny >>= nSplitPos; + CPPUNIT_ASSERT_EQUAL(3.0, nSplitPos); +} + CPPUNIT_TEST_FIXTURE(Chart2ExportTest, testChartCrash) { loadFromFile(u"docx/FDO75975.docx"); diff --git a/chart2/qa/extras/data/ods/tdf161800_barOfPie_split_pos.ods b/chart2/qa/extras/data/ods/tdf161800_barOfPie_split_pos.ods new file mode 100644 index 0000000000000000000000000000000000000000..a87941bfa22d073600d8676a71330661124ddef9 GIT binary patch literal 15011 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 literal 0 HcmV?d00001 diff --git a/chart2/qa/extras/data/xlsx/barOfPieChart2.xlsx b/chart2/qa/extras/data/xlsx/barOfPieChart2.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..be24cd293915a8f77ad31c0db7df5f1c6b0ebeab GIT binary patch literal 8130 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 literal 0 HcmV?d00001 diff --git a/chart2/qa/extras/data/xlsx/pieOfPieChart2.xlsx b/chart2/qa/extras/data/xlsx/pieOfPieChart2.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c80f0169cc89baab5387aebfeaf9cae6f9fc0b4c GIT binary patch literal 8036 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::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( "CompositeSize", - PROP_DIAGRAM_COMPOSITE_SIZE, + rOutProperties.emplace_back( "SplitPos", + PROP_DIAGRAM_SPLIT_POS, cppu::UnoType::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT ); diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index 308ff1930457..365df1c328f9 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -305,7 +305,8 @@ rtl::Reference< ChartTypeTemplate > ChartTypeDialogController::getCurrentTemplat } void ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParameter - , const rtl::Reference<::chart::ChartModel>& xChartModel ) + , const rtl::Reference<::chart::ChartModel>& xChartModel + , const uno::Reference& xTemplateProps) { rtl::Reference< ::chart::ChartTypeManager > xTemplateManager = xChartModel->getTypeManager(); rtl::Reference< ::chart::ChartTypeTemplate > xTemplate( getCurrentTemplate( rParameter, xTemplateManager ) ); @@ -329,6 +330,20 @@ void ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParame if (xDiagram.is()) { xDiagram->setPropertyValue(CHART_UNONAME_SORT_BY_XVALUES, uno::Any(rParameter.bSortByXValues)); + + sal_Int32 nSplitPos; + try { + if (xTemplateProps.is()) { + xTemplateProps->getPropertyValue(u"SplitPos"_ustr) >>= nSplitPos; + xDiagram->setPropertyValue(u"SplitPos"_ustr, uno::Any(nSplitPos)); + } + } + catch( uno::Exception & ex ) + { + //not all templates need to support SplitPos + ex.Context.is();//to have debug information without compilation warnings + } + } } void ChartTypeDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ ) @@ -763,7 +778,7 @@ void OfPieChartDialogController::fillExtraControls( { try { - xTemplateProps->getPropertyValue( u"CompositeSize"_ustr ) >>= nCompositeSize; + xTemplateProps->getPropertyValue( u"SplitPos"_ustr ) >>= nCompositeSize; } catch( const uno::Exception & ) { @@ -801,7 +816,7 @@ void OfPieChartDialogController::setTemplateProperties( const uno::Reference< be if( xTemplateProps.is()) { sal_Int32 nCompositeSize = m_xMF_CompositeSize->get_value(); - xTemplateProps->setPropertyValue( u"CompositeSize"_ustr , uno::Any(nCompositeSize) ); + xTemplateProps->setPropertyValue( u"SplitPos"_ustr , uno::Any(nCompositeSize) ); } } diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index 811c4df19017..12fa0325cef4 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -166,7 +166,8 @@ void ChartTypeTabPage::commitToModel( const ChartTypeParameter& rParameter ) return; m_aTimerTriggeredControllerLock.startTimer(); - m_pCurrentMainType->commitToModel( rParameter, m_xChartModel ); + uno::Reference< beans::XPropertySet > xTemplateProps( static_cast(getCurrentTemplate().get()), uno::UNO_QUERY ); + m_pCurrentMainType->commitToModel( rParameter, m_xChartModel, xTemplateProps ); } void ChartTypeTabPage::stateChanged() diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx index 38ea92912a19..fa85ded6d4a6 100644 --- a/chart2/source/controller/sidebar/ChartTypePanel.cxx +++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx @@ -391,7 +391,9 @@ void ChartTypePanel::commitToModel(const ChartTypeParameter& rParameter) return; m_aTimerTriggeredControllerLock.startTimer(); - m_pCurrentMainType->commitToModel(rParameter, m_xChartModel); + uno::Reference xTemplateProps( + static_cast(getCurrentTemplate().get()), uno::UNO_QUERY); + m_pCurrentMainType->commitToModel(rParameter, m_xChartModel, xTemplateProps); } void ChartTypePanel::selectMainType() diff --git a/chart2/source/inc/ChartType.hxx b/chart2/source/inc/ChartType.hxx index 7b1fccfb159e..697b0d7ffc91 100644 --- a/chart2/source/inc/ChartType.hxx +++ b/chart2/source/inc/ChartType.hxx @@ -43,7 +43,7 @@ enum PROP_PIECHARTTYPE_USE_RINGS, PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, PROP_PIECHARTTYPE_SUBTYPE, // none, of-bar, of-pie - PROP_PIECHARTTYPE_COMPOSITESIZE + PROP_PIECHARTTYPE_SPLIT_POS }; diff --git a/chart2/source/inc/ChartTypeDialogController.hxx b/chart2/source/inc/ChartTypeDialogController.hxx index cbeeb8b59406..1d36a433d96a 100644 --- a/chart2/source/inc/ChartTypeDialogController.hxx +++ b/chart2/source/inc/ChartTypeDialogController.hxx @@ -130,8 +130,10 @@ public: virtual void adjustParameterToSubType(ChartTypeParameter& rParameter); virtual void adjustParameterToMainType(ChartTypeParameter& rParameter); OUString getServiceNameForParameter(const ChartTypeParameter& rParameter) const; - void commitToModel(const ChartTypeParameter& rParameter, - const rtl::Reference<::chart::ChartModel>& xChartModel); + void + commitToModel(const ChartTypeParameter& rParameter, + const rtl::Reference<::chart::ChartModel>& xChartModel, + const css::uno::Reference& xTemplateProps); rtl::Reference<::chart::ChartTypeTemplate> getCurrentTemplate(const ChartTypeParameter& rParameter, const rtl::Reference<::chart::ChartTypeManager>& xTemplateManager) const; diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index bbd5dd61fab2..c3c4e0be9cc6 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -98,6 +98,7 @@ enum PROP_DIAGRAM_3DRELATIVEHEIGHT, PROP_DIAGRAM_DATATABLEHBORDER, PROP_DIAGRAM_OF_PIE_TYPE, + PROP_DIAGRAM_SPLIT_POS, PROP_DIAGRAM_DATATABLEVBORDER, PROP_DIAGRAM_DATATABLEOUTLINE, PROP_DIAGRAM_EXTERNALDATA @@ -188,6 +189,10 @@ void lcl_AddPropertiesToVector( PROP_DIAGRAM_OF_PIE_TYPE, cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID ); + rOutProperties.emplace_back( "SplitPos", + PROP_DIAGRAM_SPLIT_POS, + cppu::UnoType::get(), + beans::PropertyAttribute::MAYBEVOID ); rOutProperties.emplace_back( "ExternalData", PROP_DIAGRAM_EXTERNALDATA, cppu::UnoType::get(), @@ -209,6 +214,7 @@ const ::chart::tPropertyValueMap& StaticDiagramDefaults() ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 ); ::chart::PropertyHelper::setPropertyValueDefault< chart2::PieChartSubType >( aMap, PROP_DIAGRAM_OF_PIE_TYPE, chart2::PieChartSubType_NONE); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, PROP_DIAGRAM_SPLIT_POS, 2 ); ::chart::SceneProperties::AddDefaultsToMap( aMap ); return aMap; }(); diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx index b81e47ee3884..deb70d9aa03c 100644 --- a/chart2/source/model/template/ChartTypeManager.cxx +++ b/chart2/source/model/template/ChartTypeManager.cxx @@ -396,52 +396,52 @@ rtl::Reference< ::chart::ChartTypeTemplate > ChartTypeManager::createTemplate( case TEMPLATE_PIE: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_NONE, false, - chart2::PieChartSubType_NONE, 2 )); + chart2::PieChartSubType_NONE, 3, 2)); break; case TEMPLATE_PIEALLEXPLODED: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_ALL_EXPLODED, false, - chart2::PieChartSubType_NONE, 2 )); + chart2::PieChartSubType_NONE, 3, 2 )); break; case TEMPLATE_DONUT: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_NONE, true, - chart2::PieChartSubType_NONE, 2 )); + chart2::PieChartSubType_NONE, 3, 2 )); break; case TEMPLATE_DONUTALLEXPLODED: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_ALL_EXPLODED, true, - chart2::PieChartSubType_NONE, 2 )); + chart2::PieChartSubType_NONE, 3, 2 )); break; case TEMPLATE_BAROFPIE: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_NONE, false, - chart2::PieChartSubType_BAR, 2 )); + chart2::PieChartSubType_BAR, 3, 2 )); break; case TEMPLATE_PIEOFPIE: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_NONE, false, - chart2::PieChartSubType_PIE, 2 )); + chart2::PieChartSubType_PIE, 3, 2 )); break; case TEMPLATE_THREEDPIE: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_NONE, false, - chart2::PieChartSubType_NONE, 3 )); + chart2::PieChartSubType_NONE, 3, 3 )); break; case TEMPLATE_THREEDPIEALLEXPLODED: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_ALL_EXPLODED, false, - chart2::PieChartSubType_NONE, 3 )); + chart2::PieChartSubType_NONE, 3, 3 )); break; case TEMPLATE_THREEDDONUT: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_NONE, true, - chart2::PieChartSubType_NONE, 3 )); + chart2::PieChartSubType_NONE, 3, 3 )); break; case TEMPLATE_THREEDDONUTALLEXPLODED: xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, chart2::PieChartOffsetMode_ALL_EXPLODED, true, - chart2::PieChartSubType_NONE, 3 )); + chart2::PieChartSubType_NONE, 3, 3 )); break; case TEMPLATE_SCATTERLINESYMBOL: diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx index 224b37a88865..36f9a59d0862 100644 --- a/chart2/source/model/template/PieChartType.cxx +++ b/chart2/source/model/template/PieChartType.cxx @@ -47,7 +47,7 @@ namespace ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, ::chart::PROP_PIECHARTTYPE_USE_RINGS, false ); ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 ); ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, ::chart::PROP_PIECHARTTYPE_SUBTYPE, chart2::PieChartSubType_NONE ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, ::chart::PROP_PIECHARTTYPE_COMPOSITESIZE, 2 ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, ::chart::PROP_PIECHARTTYPE_SPLIT_POS, 2 ); return aOutMap; }(); return aStaticDefaults; @@ -72,8 +72,8 @@ namespace ::chart::PROP_PIECHARTTYPE_SUBTYPE, cppu::UnoType::get(), beans::PropertyAttribute::MAYBEDEFAULT }, - { u"CompositeSize"_ustr, - ::chart::PROP_PIECHARTTYPE_COMPOSITESIZE, + { u"SplitPos"_ustr, + ::chart::PROP_PIECHARTTYPE_SPLIT_POS, cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID } }; diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index cc5c0c0ed09f..0cdeb48ecfce 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -56,7 +56,7 @@ enum PROP_PIE_TEMPLATE_DIMENSION, PROP_PIE_TEMPLATE_USE_RINGS, PROP_PIE_TEMPLATE_SUB_PIE_TYPE, - PROP_PIE_TEMPLATE_COMPOSITE_SIZE + PROP_PIE_TEMPLATE_SPLIT_POS }; ::chart::tPropertyValueMap& StaticPieChartTypeTemplateDefaults() @@ -69,7 +69,8 @@ enum ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_PIE_TEMPLATE_DIMENSION, 2 ); ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIE_TEMPLATE_USE_RINGS, false ); ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIE_TEMPLATE_SUB_PIE_TYPE, chart2::PieChartSubType_NONE ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_PIE_TEMPLATE_COMPOSITE_SIZE, 2 ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( + aOutMap, PROP_PIE_TEMPLATE_SPLIT_POS, 2 ); return aOutMap; }(); return aStaticDefaults; @@ -106,8 +107,8 @@ enum cppu::UnoType::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT }, - { u"CompositeSize"_ustr, - PROP_PIE_TEMPLATE_COMPOSITE_SIZE, + { u"SplitPos"_ustr, + PROP_PIE_TEMPLATE_SPLIT_POS, cppu::UnoType::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT } @@ -140,6 +141,7 @@ PieChartTypeTemplate::PieChartTypeTemplate( chart2::PieChartOffsetMode eMode, bool bRings, chart2::PieChartSubType eSubType, + sal_Int32 nCompositeSize, sal_Int32 nDim /* = 2 */ ) : ChartTypeTemplate( xContext, rServiceName ) { @@ -147,7 +149,7 @@ PieChartTypeTemplate::PieChartTypeTemplate( setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_DIMENSION, uno::Any( nDim )); setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_USE_RINGS, uno::Any( bRings )); setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_SUB_PIE_TYPE, uno::Any( eSubType )); - setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_COMPOSITE_SIZE, uno::Any( sal_Int32(2) )); + setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_SPLIT_POS, uno::Any( nCompositeSize )); } PieChartTypeTemplate::~PieChartTypeTemplate() @@ -274,7 +276,8 @@ void PieChartTypeTemplate::createChartTypes( xCT->setFastPropertyValue( PROP_PIECHARTTYPE_SUBTYPE, getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE )); // "SubType" xCT->setFastPropertyValue( - PROP_PIECHARTTYPE_COMPOSITESIZE, getFastPropertyValue( PROP_PIE_TEMPLATE_COMPOSITE_SIZE )); // "CompositeSize" + PROP_PIECHARTTYPE_SPLIT_POS, getFastPropertyValue( + PROP_PIE_TEMPLATE_SPLIT_POS )); // "CompositeSize" rCoordSys[0]->setChartTypes( std::vector{xCT} ); if( !aSeriesSeq.empty() ) diff --git a/chart2/source/model/template/PieChartTypeTemplate.hxx b/chart2/source/model/template/PieChartTypeTemplate.hxx index c7b3b9b6951c..d95b8c49d900 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.hxx +++ b/chart2/source/model/template/PieChartTypeTemplate.hxx @@ -39,6 +39,7 @@ public: css::chart2::PieChartOffsetMode eMode, bool bRings, css::chart2::PieChartSubType eSubType, + sal_Int32 nCompositeSize, sal_Int32 nDim ); virtual ~PieChartTypeTemplate() override; diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 4bda2129817d..82ed7f32f6d4 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -195,7 +195,7 @@ PieChart::PieChart( const rtl::Reference& xChartTypeModel , m_bUseRings(false) , m_bSizeExcludesLabelsAndExplodedSegments(bExcludingPositioning) , m_eSubType(PieChartSubType_NONE) - , m_nCompositeSize(2) + , m_nSplitPos(2) , m_fMaxOffset(std::numeric_limits::quiet_NaN()) { PlotterBase::m_pPosHelper = &m_aPosHelper; @@ -230,7 +230,7 @@ PieChart::PieChart( const rtl::Reference& xChartTypeModel } try { - xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_COMPOSITESIZE) >>= m_nCompositeSize; // "CompositeSize" + xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_SPLIT_POS) >>= m_nSplitPos; // "CompositeSize" } catch( const uno::Exception& ) { @@ -1050,7 +1050,7 @@ void PieChart::createShapes() PieDataSrcBase *pDataSrc = nullptr; PieDataSrc normalPieSrc; - OfPieDataSrc ofPieSrc(m_nCompositeSize); + OfPieDataSrc ofPieSrc(m_nSplitPos); // Default to regular pie if too few points for of-pie ::css::chart2::PieChartSubType eSubType = @@ -2303,26 +2303,25 @@ uno::Reference< beans::XPropertySet > PieDataSrc::getProps( // class OfPieDataSrc //======================= -// For now, just implement the default Excel behavior, which is that the -// right pie consists of the last three entries in the series. Other -// behaviors should be supported later. +// Support data splits only of the type "last n entries go in right subchart", +// for now. // TODO sal_Int32 OfPieDataSrc::getNPoints(const VDataSeries* pSeries, enum SubPieType eType) const { if (eType == SubPieType::LEFT) { - return pSeries->getTotalPointCount() - m_nCompositeSize + 1; + return pSeries->getTotalPointCount() - m_nSplitPos + 1; } else { assert(eType == SubPieType::RIGHT); - return m_nCompositeSize; + return m_nSplitPos; } } double OfPieDataSrc::getData(const VDataSeries* pSeries, sal_Int32 nPtIdx, enum SubPieType eType) const { - const sal_Int32 n = pSeries->getTotalPointCount() - m_nCompositeSize; + const sal_Int32 n = pSeries->getTotalPointCount() - m_nSplitPos; if (eType == SubPieType::LEFT) { // nPtIdx should be in [0, n] if (nPtIdx < n) { @@ -2331,7 +2330,7 @@ double OfPieDataSrc::getData(const VDataSeries* pSeries, sal_Int32 nPtIdx, // composite wedge assert(nPtIdx == n); double total = 0; - for (sal_Int32 i = n; i < n + m_nCompositeSize; ++i) { + for (sal_Int32 i = n; i < n + m_nSplitPos; ++i) { total += pSeries->getYValue(i); } return total; @@ -2347,7 +2346,7 @@ uno::Reference< beans::XPropertySet > OfPieDataSrc::getProps( enum SubPieType eType) const { const sal_Int32 nPts = pSeries->getTotalPointCount(); - const sal_Int32 n = nPts - m_nCompositeSize; + const sal_Int32 n = nPts - m_nSplitPos; if (eType == SubPieType::LEFT) { // nPtIdx should be in [0, n] if (nPtIdx < n) { diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx index c5cb1e535cc8..b2fa3b8982ec 100644 --- a/chart2/source/view/charttypes/PieChart.hxx +++ b/chart2/source/view/charttypes/PieChart.hxx @@ -101,8 +101,8 @@ public: class OfPieDataSrc : public PieDataSrcBase { public: - OfPieDataSrc(sal_Int32 nCompositeSize): - m_nCompositeSize(nCompositeSize) + OfPieDataSrc(sal_Int32 nSplitPos): + m_nSplitPos(nSplitPos) {} // Minimum sensible number of data points @@ -118,7 +118,7 @@ public: const VDataSeries* pSeries, sal_Int32 nPtIdx, enum SubPieType eType) const; private: - sal_Int32 m_nCompositeSize; + double m_nSplitPos; }; //======================= @@ -276,7 +276,7 @@ private: //member bool m_bSizeExcludesLabelsAndExplodedSegments; ::css::chart2::PieChartSubType m_eSubType; // Number of entries in an of-pie composite wedge - sal_Int32 m_nCompositeSize; + double m_nSplitPos; struct PieLabelInfo { diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index 43b62ae747ad..8ad97c3d1717 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -154,6 +154,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart sal_Int32 nStartingAngle = 90; sal_Int32 n3DRelativeHeight = 100; PieChartSubType ePieChartSubType = PieChartSubType_NONE; + double nSplitPos = 2; try { xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= bSortByXValues; @@ -167,6 +168,8 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart xDiagram->getPropertyValue(u"3DRelativeHeight"_ustr) >>= n3DRelativeHeight; } xDiagram->getPropertyValue(u"SubPieType"_ustr) >>= ePieChartSubType; + + xDiagram->getPropertyValue(u"SplitPos"_ustr) >>= nSplitPos; } catch (const uno::Exception&) { @@ -234,6 +237,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart uno::Any(ePieChartSubType)); // Reset the diagram-level property so it's not persistent. xDiagram->setPropertyValue(u"SubPieType"_ustr, uno::Any(PieChartSubType_NONE)); + + xChartType->setFastPropertyValue(PROP_PIECHARTTYPE_SPLIT_POS, uno::Any(nSplitPos)); + //xDiagram->setPropertyValue(u"SplitPos"_ustr, uno::Any(nSplitPos)); } if (nT == 0) diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx index 1b708b83d479..e88bb05dc5d0 100644 --- a/include/oox/export/chartexport.hxx +++ b/include/oox/export/chartexport.hxx @@ -195,7 +195,7 @@ private: void exportDoughnutChart( const css::uno::Reference< css::chart2::XChartType >& xChartType ); void exportLineChart( const css::uno::Reference< css::chart2::XChartType >& xChartType ); void exportOfPieChart( const css::uno::Reference< css::chart2::XChartType >& - xChartType, const char* s_subtype ); + xChartType, const char* s_subtype, double nSplitPos ); void exportPieChart( const css::uno::Reference< css::chart2::XChartType >& xChartType ); void exportRadarChart( const css::uno::Reference< css::chart2::XChartType >& xChartType ); void exportScatterChart( const css::uno::Reference< css::chart2::XChartType >& xChartType ); diff --git a/oox/source/drawingml/chart/typegroupcontext.cxx b/oox/source/drawingml/chart/typegroupcontext.cxx index 9604e58a2507..393073261533 100644 --- a/oox/source/drawingml/chart/typegroupcontext.cxx +++ b/oox/source/drawingml/chart/typegroupcontext.cxx @@ -296,7 +296,7 @@ ContextHandlerRef OfPieTypeGroupContext::onCreateContext( sal_Int32 nElement, co case C_TOKEN( serLines ): return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() ); case C_TOKEN( splitPos ): - mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 ); + mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 2.0 ); return nullptr; case C_TOKEN( splitType ): mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto ); diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx index 9127e7d47006..71be134a9f03 100644 --- a/oox/source/drawingml/chart/typegroupconverter.cxx +++ b/oox/source/drawingml/chart/typegroupconverter.cxx @@ -358,6 +358,10 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra if (maTypeInfo.meTypeId == TYPEID_OFPIE) { aDiaProp.setProperty(PROP_SubPieType, convertOfPieType(mrModel.mnOfPieType)); + if (mrModel.mnSplitType == XML_auto || + mrModel.mnSplitType == XML_pos) { + aDiaProp.setProperty(PROP_SplitPos, mrModel.mfSplitPos); + } } else { aDiaProp.setProperty(PROP_SubPieType, PieChartSubType_NONE); } diff --git a/oox/source/drawingml/chart/typegroupmodel.cxx b/oox/source/drawingml/chart/typegroupmodel.cxx index 9479f93c4939..257237a8a57c 100644 --- a/oox/source/drawingml/chart/typegroupmodel.cxx +++ b/oox/source/drawingml/chart/typegroupmodel.cxx @@ -32,7 +32,7 @@ UpDownBarsModel::~UpDownBarsModel() } TypeGroupModel::TypeGroupModel( sal_Int32 nTypeId, bool bMSO2007Doc ) : - mfSplitPos( 0.0 ), + mfSplitPos( 2.0 ), mnBarDir( XML_col ), mnBubbleScale( 100 ), mnFirstAngle( 0 ), diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 78d3d4cbcebf..261b6c2a96e1 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1764,8 +1764,13 @@ void ChartExport::exportPlotArea(const Reference< css::chart::XChartDocument >& default: assert(false); } + double fSplitPos; + if (!xChartTypeProp.getProperty(fSplitPos, + PROP_SplitPos)) { + fSplitPos = 2; + } - exportOfPieChart(xChartType, sSubType); + exportOfPieChart(xChartType, sSubType, fSplitPos); } else { exportPieChart( xChartType ); } @@ -2323,7 +2328,8 @@ void ChartExport::exportDoughnutChart( const Reference< chart2::XChartType >& xC void ChartExport::exportOfPieChart( const Reference< chart2::XChartType >& xChartType, - const char* sSubType ) + const char* sSubType, + double fSplitPos) { FSHelperPtr pFS = GetFS(); pFS->startElement(FSNS(XML_c, XML_ofPieChart)); @@ -2335,6 +2341,9 @@ void ChartExport::exportOfPieChart( bool bPrimaryAxes = true; exportAllSeries(xChartType, bPrimaryAxes); + pFS->singleElement(FSNS(XML_c, XML_splitType), XML_val, "pos"); + pFS->singleElement(FSNS(XML_c, XML_splitPos), XML_val, OString::number(fSplitPos)); + pFS->endElement( FSNS( XML_c, XML_ofPieChart ) ); } diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 0cb978129ccc..d73008a80539 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -555,6 +555,7 @@ SpinIncrement SpinValue SpinValueMax SpinValueMin +SplitPos StackCharacters StackingDirection StartPosition diff --git a/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng index 7ae65dc531ee..e874f15852fc 100644 --- a/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng +++ b/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng @@ -2762,6 +2762,15 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. + + + + + + + + + diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx index 8f47e328ff44..dd48cb11ff63 100644 --- a/xmloff/inc/xmlprop.hxx +++ b/xmloff/inc/xmlprop.hxx @@ -595,6 +595,7 @@ inline constexpr OUString PROP_Speed = u"Speed"_ustr; inline constexpr OUString PROP_SplineOrder = u"SplineOrder"_ustr; inline constexpr OUString PROP_SplineResolution = u"SplineResolution"_ustr; inline constexpr OUString PROP_SplineType = u"SplineType"_ustr; +inline constexpr OUString PROP_SplitPos = u"SplitPos"_ustr; inline constexpr OUString PROP_Stacked = u"Stacked"_ustr; inline constexpr OUString PROP_StackedBarsConnected = u"StackedBarsConnected"_ustr; inline constexpr OUString PROP_StackedText = u"StackedText"_ustr; diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index c79071dac166..a6cd20a3d54f 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -232,7 +232,8 @@ SchXMLChartContext::SchXMLChartContext( SchXMLImportHelper& rImpHelper, mbRowHasLabels( false ), meDataRowSource( chart::ChartDataRowSource_COLUMNS ), mbIsStockChart( false ), - mPieSubType(css::chart2::PieChartSubType_NONE) + mPieSubType(css::chart2::PieChartSubType_NONE), + mfPieSplitPos(2.0) { } @@ -400,6 +401,9 @@ void SchXMLChartContext::startFastElement( sal_Int32 /*nElement*/, mPieSubType = css::chart2::PieChartSubType_PIE; } break; + case XML_ELEMENT(LO_EXT, XML_SPLIT_POSITION): + mfPieSplitPos = aIter.toDouble(); + break; default: XMLOFF_WARN_UNKNOWN("xmloff", aIter); } @@ -748,12 +752,13 @@ void SchXMLChartContext::endFastElement(sal_Int32 ) // cleanup: remove empty chart type groups lcl_removeEmptyChartTypeGroups( xNewDoc ); - // Handle sub-pie type. Is this the right place to do this? + // Handle of-pie paramters. Is this the right place to do this? if (maChartTypeServiceName == "com.sun.star.chart2.PieChartType") { Reference< chart2::XDiagram> xDia(xNewDoc->getFirstDiagram()); uno::Reference< beans::XPropertySet > xDiaProp( xDia, uno::UNO_QUERY ); if( xDiaProp.is()) { xDiaProp->setPropertyValue(u"SubPieType"_ustr, uno::Any(mPieSubType)); + xDiaProp->setPropertyValue(u"SplitPos"_ustr, uno::Any(mfPieSplitPos)); } } diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx index b7f94fa6c986..563ae2ebe8e1 100644 --- a/xmloff/source/chart/SchXMLChartContext.hxx +++ b/xmloff/source/chart/SchXMLChartContext.hxx @@ -101,6 +101,7 @@ private: css::chart::ChartDataRowSource meDataRowSource; bool mbIsStockChart; css::chart2::PieChartSubType mPieSubType; + double mfPieSplitPos; OUString msCategoriesAddress; OUString msChartAddress; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 4e3fa02b7651..f58904997ce6 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -114,7 +114,6 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::std::vector; - namespace { /** @@ -1287,11 +1286,47 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > XML_NAMESPACE_CHART, GetXMLToken(eXMLChartType )) ); } + bool bIsOfPie = false; // Handle subtype for of-pie charts if (sChartType == u"com.sun.star.chart.BarOfPieDiagram") { mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_SUB_BAR, OUString::boolean(true)); + bIsOfPie = true; } else if (sChartType == u"com.sun.star.chart.PieOfPieDiagram") { mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_SUB_PIE, OUString::boolean(true)); + bIsOfPie = true; + } + + if (bIsOfPie) { + + // Find the split position. We have to dig deep into the + // structure tree to get it, which is awkward. Part of the + // problem is that the split position is sort of a series-level + // parameter, but is generally handled at the chart level since + // of-pie charts have only a single series. + double fSplitPos = 2.0; + + Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( xNewDiagram, uno::UNO_QUERY ); + if (xBCooSysCnt.is()) { + const Sequence< Reference< chart2::XCoordinateSystem > > + aCooSysSeq( xBCooSysCnt->getCoordinateSystems()); + for (const auto& rCooSys : aCooSysSeq ) { + Reference< chart2::XChartTypeContainer > xCTCnt( rCooSys, uno::UNO_QUERY ); + if( ! xCTCnt.is()) + continue; + const Sequence< Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes()); + for (const auto& rChartType : aCTSeq ) { + Reference< beans::XPropertySet > xCTProp( rChartType, uno::UNO_QUERY ); + + if (xCTProp.is()) { + xCTProp->getPropertyValue(u"SplitPos"_ustr) >>= fSplitPos; + } + } + } + } + + // Insert split position for of-pie chart + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_SPLIT_POSITION, + OUString::number(fSplitPos)); } //column-mapping or row-mapping From a0ff88da40c2fdc20a069e686230506e41b2ebc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Fri, 8 Nov 2024 11:56:25 +0100 Subject: [PATCH 251/373] pdf: write encrption O and U values as hex string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is easier to evaluate when opening the file in text editor than binary. It is also more common in other PDF writers to use it as hex string. There is no problem with viewers. Change-Id: Ie453556d22695017916c7953f91c499e3d990b0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176891 Reviewed-by: Tomaž Vajngerl Tested-by: Jenkins --- vcl/source/gdi/pdfwriter_impl.cxx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b282827ee4c3..71c097d6b36e 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -353,14 +353,6 @@ public: maLine.append(value); } - void writeString(std::string_view key, char* pString, sal_Int32 nSize) - { - maLine.append(key); - maLine.append(" ("); - appendLiteralString(pString, nSize, maLine); - maLine.append(")"); - } - void writeUnicodeEncrypt(std::string_view key, OUString const& rString, sal_Int32 nObject) { maLine.append(key); @@ -372,6 +364,17 @@ public: maLine.append(key); mrWriterImpl.appendLiteralStringEncrypt(value, nObject, maLine); } + + void writeHexArray(std::string_view key, sal_uInt8* pData, size_t nSize) + { + maLine.append(key); + maLine.append(" <"); + for (size_t i = 0; i < nSize; i++) + { + appendHex(sal_Int8(pData[i]), maLine); + } + maLine.append(">"); + } }; } // end anonymous namespace @@ -6143,6 +6146,7 @@ sal_Int32 PDFWriterImpl::emitEncrypt() if (updateObject(nObject)) { + PDFEncryptionProperties& rProperties = m_aContext.Encryption; PDFStructureWriter aWriter(*this); aWriter.startObject(nObject); aWriter.startDict(); @@ -6151,8 +6155,8 @@ sal_Int32 PDFWriterImpl::emitEncrypt() aWriter.write("/Length", 128); aWriter.write("/R", 3); // emit the owner password, must not be encrypted - aWriter.writeString("/O", reinterpret_cast(m_aContext.Encryption.OValue.data()), sal_Int32(m_aContext.Encryption.OValue.size())); - aWriter.writeString("/U", reinterpret_cast(m_aContext.Encryption.UValue.data()), sal_Int32(m_aContext.Encryption.UValue.size())); + aWriter.writeHexArray("/O", rProperties.OValue.data(), rProperties.OValue.size()); + aWriter.writeHexArray("/U", rProperties.UValue.data(), rProperties.UValue.size()); aWriter.write("/P", m_pPDFEncryptor->getAccessPermissions()); aWriter.endDict(); aWriter.endObject(); From 5e0c670e6534fee529ea46d520c6b442bea93aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Mon, 11 Nov 2024 13:23:03 +0100 Subject: [PATCH 252/373] comphelper: add support for AES256_ECB encryption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5e8ab2a2be6ea9cd5d1ed93b70780f1f6153f3fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176892 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- comphelper/qa/unit/CryptoTest.cxx | 58 +++++++++++++++++++++------- comphelper/source/crypto/Crypto.cxx | 3 ++ include/comphelper/crypto/Crypto.hxx | 1 + 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/comphelper/qa/unit/CryptoTest.cxx b/comphelper/qa/unit/CryptoTest.cxx index b13887040667..8bdda3b384b1 100644 --- a/comphelper/qa/unit/CryptoTest.cxx +++ b/comphelper/qa/unit/CryptoTest.cxx @@ -30,19 +30,9 @@ public: NSS_Shutdown(); #endif } - - void testCryptoHash(); - void testRoundUp(); - void testEncrypt_AES256(); - - CPPUNIT_TEST_SUITE(CryptoTest); - CPPUNIT_TEST(testCryptoHash); - CPPUNIT_TEST(testRoundUp); - CPPUNIT_TEST(testEncrypt_AES256); - CPPUNIT_TEST_SUITE_END(); }; -void CryptoTest::testCryptoHash() +CPPUNIT_TEST_FIXTURE(CryptoTest, testCryptoHash) { // Check examples from Wikipedia (https://en.wikipedia.org/wiki/HMAC) OString aContentString("The quick brown fox jumps over the lazy dog"_ostr); @@ -86,7 +76,7 @@ void CryptoTest::testCryptoHash() } } -void CryptoTest::testRoundUp() +CPPUNIT_TEST_FIXTURE(CryptoTest, testRoundUp) { CPPUNIT_ASSERT_EQUAL(16, comphelper::roundUp(16, 16)); CPPUNIT_ASSERT_EQUAL(32, comphelper::roundUp(32, 16)); @@ -97,7 +87,7 @@ void CryptoTest::testRoundUp() CPPUNIT_ASSERT_EQUAL(32, comphelper::roundUp(31, 16)); } -void CryptoTest::testEncrypt_AES256() +CPPUNIT_TEST_FIXTURE(CryptoTest, testEncrypt_AES256_CBC) { std::vector key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; @@ -139,6 +129,46 @@ void CryptoTest::testEncrypt_AES256() comphelper::hashToString(decrypted)); } -CPPUNIT_TEST_SUITE_REGISTRATION(CryptoTest); +CPPUNIT_TEST_FIXTURE(CryptoTest, testEncrypt_AES256_ECB) +{ + std::vector key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + + std::vector iv = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + + std::vector original = { 's', 'e', 'c', 'r', 'e', 't', '\0' }; + + std::vector encrypted(original.size()); + + sal_uInt32 nWrittenSize = 0; + + comphelper::Encrypt aEncryptor(key, iv, comphelper::CryptoType::AES_256_ECB); + nWrittenSize = aEncryptor.update(encrypted, original); + + // nothing should be written as the size of the input is not a multiple of block size + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), nWrittenSize); + + original.resize(16, 0); // apply padding to make it multiple of block size + encrypted.resize(16, 0); + + CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), + comphelper::hashToString(original)); + + nWrittenSize = aEncryptor.update(encrypted, original); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); + + CPPUNIT_ASSERT_EQUAL(std::string("11c380204c0bae9f18a795177e28d842"), + comphelper::hashToString(encrypted)); + + std::vector decrypted(encrypted.size()); + + comphelper::Decrypt aDecryptor(key, iv, comphelper::CryptoType::AES_256_ECB); + nWrittenSize = aDecryptor.update(decrypted, encrypted); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); + + CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), + comphelper::hashToString(decrypted)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/crypto/Crypto.cxx b/comphelper/source/crypto/Crypto.cxx index 9a90f0aa0553..d93a44dd8150 100644 --- a/comphelper/source/crypto/Crypto.cxx +++ b/comphelper/source/crypto/Crypto.cxx @@ -154,6 +154,8 @@ struct CryptoImpl { case CryptoType::AES_128_ECB: return EVP_aes_128_ecb(); + case CryptoType::AES_256_ECB: + return EVP_aes_256_ecb(); case CryptoType::AES_128_CBC: return EVP_aes_128_cbc(); case CryptoType::AES_256_CBC: @@ -315,6 +317,7 @@ struct CryptoImpl switch (type) { case CryptoType::AES_128_ECB: + case CryptoType::AES_256_ECB: mechanism = CKM_AES_ECB; break; case CryptoType::AES_128_CBC: diff --git a/include/comphelper/crypto/Crypto.hxx b/include/comphelper/crypto/Crypto.hxx index b2530f02b558..151ee9d04565 100644 --- a/include/comphelper/crypto/Crypto.hxx +++ b/include/comphelper/crypto/Crypto.hxx @@ -46,6 +46,7 @@ enum class CryptoType UNKNOWN, AES_128_ECB, AES_128_CBC, + AES_256_ECB, AES_256_CBC, }; From 8f2bf78a55624da22d18a844dc3f05fd61c4f62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Tue, 26 Nov 2024 10:14:17 +0900 Subject: [PATCH 253/373] comphelper: fix test - key should be 32 bytes, not 16 bytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue spotted when trying encryption and decryption with OpenSSL, which doesn't handle the shorter keys correctly. Also can't use the same instance of Encrypt after an attempt that failed (0 bytes written) as the blocks are inter-dependent and it looks like OpenSSL already changes the state. Change-Id: I061764e6727c7fbe600e11c5a5a6b8889d15c4e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177305 Reviewed-by: Tomaž Vajngerl Tested-by: Jenkins --- comphelper/qa/unit/CryptoTest.cxx | 98 ++++++++++++++++++------------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/comphelper/qa/unit/CryptoTest.cxx b/comphelper/qa/unit/CryptoTest.cxx index 8bdda3b384b1..4c7603d88eb6 100644 --- a/comphelper/qa/unit/CryptoTest.cxx +++ b/comphelper/qa/unit/CryptoTest.cxx @@ -89,8 +89,9 @@ CPPUNIT_TEST_FIXTURE(CryptoTest, testRoundUp) CPPUNIT_TEST_FIXTURE(CryptoTest, testEncrypt_AES256_CBC) { - std::vector key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + std::vector key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, + 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, + 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32 }; std::vector iv = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; @@ -99,40 +100,47 @@ CPPUNIT_TEST_FIXTURE(CryptoTest, testEncrypt_AES256_CBC) std::vector encrypted(original.size()); - sal_uInt32 nWrittenSize = 0; + { + sal_uInt32 nWrittenSize = 0; + comphelper::Encrypt aEncryptor(key, iv, comphelper::CryptoType::AES_256_CBC); + nWrittenSize = aEncryptor.update(encrypted, original); - comphelper::Encrypt aEncryptor(key, iv, comphelper::CryptoType::AES_256_CBC); - nWrittenSize = aEncryptor.update(encrypted, original); + // nothing should be written as the size of the input is not a multiple of block size + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), nWrittenSize); + } - // nothing should be written as the size of the input is not a multiple of block size - CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), nWrittenSize); + { + sal_uInt32 nWrittenSize = 0; + comphelper::Encrypt aEncryptor(key, iv, comphelper::CryptoType::AES_256_CBC); - original.resize(16, 0); // apply padding to make it multiple of block size - encrypted.resize(16, 0); + original.resize(16, 0); // apply padding to make it multiple of block size + encrypted.resize(16, 0); - CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), - comphelper::hashToString(original)); + CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), + comphelper::hashToString(original)); - nWrittenSize = aEncryptor.update(encrypted, original); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); + nWrittenSize = aEncryptor.update(encrypted, original); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); - CPPUNIT_ASSERT_EQUAL(std::string("181fd8e8e33d2e0b06abc41c2b90f6e5"), - comphelper::hashToString(encrypted)); + CPPUNIT_ASSERT_EQUAL(std::string("e75cb91a34377c09c354c24fcef345a6"), + comphelper::hashToString(encrypted)); - std::vector decrypted(encrypted.size()); + std::vector decrypted(encrypted.size(), 0); - comphelper::Decrypt aDecryptor(key, iv, comphelper::CryptoType::AES_256_CBC); - nWrittenSize = aDecryptor.update(decrypted, encrypted); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); + comphelper::Decrypt aDecryptor(key, iv, comphelper::CryptoType::AES_256_CBC); + nWrittenSize = aDecryptor.update(decrypted, encrypted); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); - CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), - comphelper::hashToString(decrypted)); + CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), + comphelper::hashToString(decrypted)); + } } CPPUNIT_TEST_FIXTURE(CryptoTest, testEncrypt_AES256_ECB) { - std::vector key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + std::vector key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, + 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, + 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32 }; std::vector iv = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; @@ -141,34 +149,40 @@ CPPUNIT_TEST_FIXTURE(CryptoTest, testEncrypt_AES256_ECB) std::vector encrypted(original.size()); - sal_uInt32 nWrittenSize = 0; + { + sal_uInt32 nWrittenSize = 0; + comphelper::Encrypt aEncryptor(key, iv, comphelper::CryptoType::AES_256_ECB); + nWrittenSize = aEncryptor.update(encrypted, original); - comphelper::Encrypt aEncryptor(key, iv, comphelper::CryptoType::AES_256_ECB); - nWrittenSize = aEncryptor.update(encrypted, original); + // nothing should be written as the size of the input is not a multiple of block size + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), nWrittenSize); + } - // nothing should be written as the size of the input is not a multiple of block size - CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), nWrittenSize); + { + sal_uInt32 nWrittenSize = 0; + comphelper::Encrypt aEncryptor(key, iv, comphelper::CryptoType::AES_256_ECB); - original.resize(16, 0); // apply padding to make it multiple of block size - encrypted.resize(16, 0); + original.resize(16, 0); // apply padding to make it multiple of block size + encrypted.resize(16, 0); - CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), - comphelper::hashToString(original)); + CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), + comphelper::hashToString(original)); - nWrittenSize = aEncryptor.update(encrypted, original); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); + nWrittenSize = aEncryptor.update(encrypted, original); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); - CPPUNIT_ASSERT_EQUAL(std::string("11c380204c0bae9f18a795177e28d842"), - comphelper::hashToString(encrypted)); + CPPUNIT_ASSERT_EQUAL(std::string("abf7abec9a6b58c089e902397c47ac49"), + comphelper::hashToString(encrypted)); - std::vector decrypted(encrypted.size()); + std::vector decrypted(encrypted.size(), 0); - comphelper::Decrypt aDecryptor(key, iv, comphelper::CryptoType::AES_256_ECB); - nWrittenSize = aDecryptor.update(decrypted, encrypted); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); + comphelper::Decrypt aDecryptor(key, iv, comphelper::CryptoType::AES_256_ECB); + nWrittenSize = aDecryptor.update(decrypted, encrypted); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(16), nWrittenSize); - CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), - comphelper::hashToString(decrypted)); + CPPUNIT_ASSERT_EQUAL(std::string("73656372657400000000000000000000"), + comphelper::hashToString(decrypted)); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From d88683e4675f836c26c8fb10cda7a7d71026bcb7 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 25 Nov 2024 20:18:38 +0500 Subject: [PATCH 254/373] Some simplification Change-Id: I8dc994421ef036f609e270c4891ac4494276ba23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177299 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- scaddins/source/analysis/analysishelper.cxx | 196 ++++++++------------ scaddins/source/analysis/analysishelper.hxx | 23 +-- 2 files changed, 89 insertions(+), 130 deletions(-) diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index 1ba1b303c2e6..40d5f86b6542 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -44,6 +44,8 @@ using namespace sca::analysis; #define STDPAR false // all parameters are described #define INTPAR true // first parameter is internal +#define INV_MATCHLEV 1764 // guess, what this is... :-) - I doubt this kind of comment looks fun :-( + #define FUNCDATA( FUNCNAME, DBL, OPT, NUMOFPAR, CAT ) \ { "get" #FUNCNAME, ANALYSIS_FUNCNAME_##FUNCNAME, ANALYSIS_##FUNCNAME, DBL, OPT, ANALYSIS_DEFFUNCNAME_##FUNCNAME, NUMOFPAR, CAT, nullptr } @@ -2032,39 +2034,30 @@ void ComplexList::Append( const uno::Sequence< uno::Any >& aMultPars ) } } -ConvertData::ConvertData(const char p[], double fC, ConvertDataClass e, bool bPrefSupport) +ConvertData::ConvertData(std::u16string_view sUnitName, double fC, ConvertDataClass e, bool bPrefSupport) : fConst(fC) - , aName(p, strlen(p), RTL_TEXTENCODING_MS_1252) + , aName(sUnitName) , eClass(e) , bPrefixSupport(bPrefSupport) { + assert(!aName.empty()); } -ConvertData::~ConvertData() -{ -} +ConvertData::~ConvertData() = default; sal_Int16 ConvertData::GetMatchingLevel( const OUString& rRef ) const { OUString aStr = rRef; - sal_Int32 nLen = rRef.getLength(); - sal_Int32 nIndex = rRef.lastIndexOf( '^' ); - if( nIndex > 0 && nIndex == ( nLen - 2 ) ) - aStr = aStr.subView( 0, nLen - 2 ) + OUStringChar( aStr[ nLen - 1 ] ); + if (sal_Int32 nIndex = rRef.lastIndexOf('^'); nIndex > 0 && nIndex == (rRef.getLength() - 2)) + aStr = aStr.replaceAt(nIndex, 1, ""); if( aName == aStr ) return 0; - else + if (std::u16string_view prefix; bPrefixSupport && aStr.endsWith(aName, &prefix)) { - const sal_Unicode* p = aStr.getStr(); - - nLen = aStr.getLength(); - bool bPref = bPrefixSupport; - bool bOneChar = (bPref && nLen > 1 && (aName == p + 1)); - if (bOneChar || (bPref && nLen > 2 && (aName == p + 2) && - *p == 'd' && *(p+1) == 'a')) + if (prefix.size() == 1 || prefix == u"da") { sal_Int16 n; - switch( *p ) + switch (prefix[0]) { case 'y': n = -24; break; // yocto case 'z': n = -21; break; // zepto @@ -2076,12 +2069,10 @@ sal_Int16 ConvertData::GetMatchingLevel( const OUString& rRef ) const case 'm': n = -3; break; case 'c': n = -2; break; case 'd': - { - if ( bOneChar ) - n = -1; // deci - else - n = 1; // deca - } + if (prefix.size() == 1) + n = -1; // deci + else + n = 1; // deca break; case 'e': n = 1; break; case 'h': n = 2; break; @@ -2093,85 +2084,72 @@ sal_Int16 ConvertData::GetMatchingLevel( const OUString& rRef ) const case 'E': n = 18; break; case 'Z': n = 21; break; // zetta case 'Y': n = 24; break; // yotta - default: - n = INV_MATCHLEV; + default: return INV_MATCHLEV; } // We could weed some nonsense out, ODFF doesn't say so though. #if 0 if (n < 0 && Class() == CDC_Information) - n = INV_MATCHLEV; // milli-bits doesn't make sense + return INV_MATCHLEV; // milli-bits doesn't make sense #endif //! "cm3" is not 10^-2 m^3 but 10^-6 m^3 !!! ------------------ - if( n != INV_MATCHLEV ) - { - sal_Unicode cLast = p[ aStr.getLength() - 1 ]; - if( cLast == '2' ) - n *= 2; - else if( cLast == '3' ) - n *= 3; - } + if (aStr.endsWith("2")) + n *= 2; + else if (aStr.endsWith("3")) + n *= 3; //! ------------------------------------------------------------------- return n; } - else if ( nLen > 2 && ( aName == p + 2 ) && ( Class() == CDC_Information ) ) + else if (prefix.size() == 2 && prefix[1] == 'i' && Class() == CDC_Information) { - const sal_Unicode* pStr = aStr.getStr(); - if ( *(pStr + 1) != 'i') - return INV_MATCHLEV; - sal_Int16 n; - switch( *pStr ) + switch (prefix[0]) { - case 'k': n = 10; break; - case 'M': n = 20; break; - case 'G': n = 30; break; - case 'T': n = 40; break; - case 'P': n = 50; break; - case 'E': n = 60; break; - case 'Z': n = 70; break; - case 'Y': n = 80; break; - default: - n = INV_MATCHLEV; + case 'k': return 10; + case 'M': return 20; + case 'G': return 30; + case 'T': return 40; + case 'P': return 50; + case 'E': return 60; + case 'Z': return 70; + case 'Y': return 80; + default: return INV_MATCHLEV; } - return n; } - else - return INV_MATCHLEV; } + return INV_MATCHLEV; } double ConvertData::Convert( double f, const ConvertData& r, sal_Int16 nLevFrom, sal_Int16 nLevTo ) const { - if( Class() != r.Class() ) - throw lang::IllegalArgumentException(); - - bool bBinFromLev = ( nLevFrom > 0 && ( nLevFrom % 10 ) == 0 ); - bool bBinToLev = ( nLevTo > 0 && ( nLevTo % 10 ) == 0 ); - - if ( Class() == CDC_Information && ( bBinFromLev || bBinToLev ) ) - { - if ( bBinFromLev && bBinToLev ) - { - nLevFrom = sal::static_int_cast( nLevFrom - nLevTo ); - f *= r.fConst / fConst; - if( nLevFrom ) - f *= pow( 2.0, nLevFrom ); - } - else if ( bBinFromLev ) - f *= ( r.fConst / fConst ) * ( pow( 2.0, nLevFrom ) / pow( 10.0, nLevTo ) ); - else - f *= ( r.fConst / fConst ) * ( pow( 10.0, nLevFrom ) / pow( 2.0, nLevTo ) ); - return f; - } - - nLevFrom = sal::static_int_cast( nLevFrom - nLevTo ); // effective level + assert(Class() == r.Class()); f *= r.fConst / fConst; + if (Class() == CDC_Information) + { + bool bBinFromLev = (nLevFrom > 0 && (nLevFrom % 10) == 0); + bool bBinToLev = (nLevTo > 0 && (nLevTo % 10) == 0); + if (bBinFromLev || bBinToLev) + { + if (bBinFromLev && bBinToLev) + { + nLevFrom -= nLevTo; + if (nLevFrom) + f *= pow(2.0, nLevFrom); + } + else if (bBinFromLev) + f *= pow(2.0, nLevFrom) / pow(10.0, nLevTo); + else + f *= pow(10.0, nLevFrom) / pow(2.0, nLevTo); + return f; + } + } + + nLevFrom -= nLevTo; // effective level if( nLevFrom ) f = ::rtl::math::pow10Exp( f, nLevFrom ); @@ -2179,21 +2157,14 @@ double ConvertData::Convert( } -double ConvertData::ConvertFromBase( double f, sal_Int16 n ) const -{ - return ::rtl::math::pow10Exp( f * fConst, -n ); -} - -ConvertDataLinear::~ConvertDataLinear() -{ -} +ConvertDataLinear::~ConvertDataLinear() = default; double ConvertDataLinear::Convert( double f, const ConvertData& r, sal_Int16 nLevFrom, sal_Int16 nLevTo ) const { - if( Class() != r.Class() ) - throw lang::IllegalArgumentException(); - return r.ConvertFromBase( ConvertToBase( f, nLevFrom ), nLevTo ); + assert(Class() == r.Class()); + assert(dynamic_cast(&r)); + return static_cast(r).ConvertFromBase( ConvertToBase( f, nLevFrom ), nLevTo ); } @@ -2223,10 +2194,13 @@ double ConvertDataLinear::ConvertFromBase( double f, sal_Int16 n ) const ConvertDataList::ConvertDataList() { -#define NEWD(str,unit,cl) maVector.push_back(std::make_unique(str,unit,cl)) -#define NEWDP(str,unit,cl) maVector.push_back(std::make_unique(str,unit,cl,true)) -#define NEWL(str,unit,offs,cl) maVector.push_back(std::make_unique(str,unit,offs,cl)) -#define NEWLP(str,unit,offs,cl) maVector.push_back(std::make_unique(str,unit,offs,cl,true)) +#define NEWD(str,unit,cl) maVector.push_back(std::make_unique(u"" str,unit,cl)) +#define NEWDP(str,unit,cl) maVector.push_back(std::make_unique(u"" str,unit,cl,true)) +#define NEWL(str,unit,offs,cl) maVector.push_back(std::make_unique(u"" str,unit,offs,cl)) +#define NEWLP(str,unit,offs,cl) maVector.push_back(std::make_unique(u"" str,unit,offs,cl,true)) + + const size_t expected_size = 146; + maVector.reserve(expected_size); // *** are extra and not standard Excel Analysis Addin! @@ -2401,12 +2375,12 @@ ConvertDataList::ConvertDataList() // INFORMATION: 1 Bit is... NEWDP( "bit", 1.00E00, CDC_Information); // *** Bit NEWDP( "byte", 1.25E-01, CDC_Information); // *** Byte + + assert(maVector.size() == expected_size); } -ConvertDataList::~ConvertDataList() -{ -} +ConvertDataList::~ConvertDataList() = default; double ConvertDataList::Convert( double fVal, const OUString& rFrom, const OUString& rTo ) @@ -2420,41 +2394,32 @@ double ConvertDataList::Convert( double fVal, const OUString& rFrom, const OUStr for( const auto& rItem : maVector ) { - ConvertData* p = rItem.get(); if( bSearchFrom ) { - sal_Int16 n = p->GetMatchingLevel( rFrom ); + sal_Int16 n = rItem->GetMatchingLevel(rFrom); if( n != INV_MATCHLEV ) { - if( n ) + pFrom = rItem.get(); + nLevelFrom = n; + if (!n) { // only first match for partial equality rulz a little bit more - pFrom = p; - nLevelFrom = n; - } - else - { // ... but exact match rulz most - pFrom = p; + // ... but exact match rulz most bSearchFrom = false; - nLevelFrom = n; } } } if( bSearchTo ) { - sal_Int16 n = p->GetMatchingLevel( rTo ); + sal_Int16 n = rItem->GetMatchingLevel(rTo); if( n != INV_MATCHLEV ) { - if( n ) + pTo = rItem.get(); + nLevelTo = n; + if (!n) { // only first match for partial equality rulz a little bit more - pTo = p; - nLevelTo = n; - } - else - { // ... but exact match rulz most - pTo = p; + // ... but exact match rulz most bSearchTo = false; - nLevelTo = n; } } } @@ -2466,6 +2431,9 @@ double ConvertDataList::Convert( double fVal, const OUString& rFrom, const OUStr if( !pFrom || !pTo ) throw lang::IllegalArgumentException(); + if (pFrom->Class() != pTo->Class()) + throw lang::IllegalArgumentException(); + return pFrom->Convert( fVal, *pTo, nLevelFrom, nLevelTo ); } diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx index 0fdae29ccd66..e1920046923c 100644 --- a/scaddins/source/analysis/analysishelper.hxx +++ b/scaddins/source/analysis/analysishelper.hxx @@ -492,20 +492,17 @@ enum ConvertDataClass }; -#define INV_MATCHLEV 1764 // guess, what this is... :-) - - class ConvertData { protected: friend class ConvertDataList; double fConst; - OUString aName; + std::u16string_view aName; ConvertDataClass eClass; bool bPrefixSupport; public: ConvertData( - const char pUnitName[], + std::u16string_view sUnitName, double fConvertConstant, ConvertDataClass eClass, bool bPrefSupport = false ); @@ -522,9 +519,8 @@ public: /// @throws css::lang::IllegalArgumentException virtual double Convert( double fVal, const ConvertData& rTo, sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo ) const; - virtual double ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const; - inline ConvertDataClass Class() const; + ConvertDataClass Class() const { return eClass; } }; class ConvertDataLinear final : public ConvertData @@ -532,7 +528,7 @@ class ConvertDataLinear final : public ConvertData double fOffs; public: inline ConvertDataLinear( - const char pUnitName[], + std::u16string_view sUnitName, double fConvertConstant, double fConvertOffset, ConvertDataClass eClass, @@ -548,7 +544,7 @@ public: // throws exception if not from same class // this implementation is for proportional cases only double ConvertToBase( double fVal, sal_Int16 nMatchLevel ) const; - virtual double ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const override; + double ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const; }; @@ -709,14 +705,9 @@ inline void ComplexList::Append( Complex&& p ) } -inline ConvertDataClass ConvertData::Class() const -{ - return eClass; -} - -inline ConvertDataLinear::ConvertDataLinear( const char p[], double fC, double fO, ConvertDataClass e, +inline ConvertDataLinear::ConvertDataLinear( std::u16string_view sUnitName, double fC, double fO, ConvertDataClass e, bool bPrefSupport ) : - ConvertData( p, fC, e, bPrefSupport ), + ConvertData( sUnitName, fC, e, bPrefSupport ), fOffs( fO ) { } From 1e54b2037a4d58dacc821bd8833e924f6691a7fd Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 26 Nov 2024 00:37:53 +0500 Subject: [PATCH 255/373] tdf#146269: don't set modified when connecting frame, model and controller Change-Id: I487a989a97389af11c98e10ac001c860d7855aec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177300 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- include/unotools/fcm.hxx | 11 +++++++++++ .../ooxmlexport/data/deleted_pageref.docx | Bin 0 -> 8545 bytes sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/deleted_pageref.docx diff --git a/include/unotools/fcm.hxx b/include/unotools/fcm.hxx index 30df362884ba..6fd6b8283777 100644 --- a/include/unotools/fcm.hxx +++ b/include/unotools/fcm.hxx @@ -23,6 +23,7 @@ #include #include #include +#include namespace utl { @@ -40,12 +41,22 @@ ConnectFrameControllerModel(const css::uno::Reference& xFram const css::uno::Reference& xController, const css::uno::Reference& xModel) { + auto xModifiable = xModel.query(); + bool bOldModifiable = false; + if (xModifiable) + { + bOldModifiable = xModifiable->isSetModifiedEnabled(); + if (bOldModifiable) + xModifiable->disableSetModified(); + } ConnectModelController(xModel, xController); if (xFrame) xFrame->setComponent(xController->getComponentWindow(), xController); // creates the view and menu // for correct menu creation the initialized component must be already set into the frame xController->attachFrame(xFrame); + if (xModifiable && bOldModifiable) + xModifiable->enableSetModified(); } } diff --git a/sw/qa/extras/ooxmlexport/data/deleted_pageref.docx b/sw/qa/extras/ooxmlexport/data/deleted_pageref.docx new file mode 100644 index 0000000000000000000000000000000000000000..3b34327eaa4040b68f00420a725a534d210ddf4a GIT binary patch literal 8545 zcmaiZ1z1&Ew>Di$BOsm9-7T=`?k?GMcS$M@A|SQtPU(_v5Tp^W>qhvaoCz z2+Ka1uTp$G>NNnsn%1zfRB7LU_g@YWQst!!be9&DQJR!BJ4raMHa98r7KrZJybC`N zBf^(91x5s!>~>`>yIt0{geo*x8d+B415UPHl@BToph(942uL25HrxbJ20Kr>oahd+ zq2kwhO~S4;Ssk$6?FHCR=-7P>s;y%va?gytpNY-@=rIwX(&+Z7*T?e?=Ia**0s_rW z_4}?q6v=Tcn~hx`k{$S1Y{d?Ds=b$E=0|~-bI-^#O~YQ$R|BHy%s!j|3cnC-Ux4zg zR_9MUKj#R=jDjR0<1@j&(8_X%NbAlQfGx=I$6%nKl>biyVM5*jI+!XuJ2<+qm^wI{ zF?-tCMyn1fcC%u%oIZ;^43Edb0Laio@4(ZOTf(oJr`cJ9coX+I&kmi^`o{X9KZh=) zAMd?u-9BqBZ()+|CCJF8MT$jCM*rFXr;9dxFML>7e^fJfm&K^2k8ThGTe& znETXEcBmv67#Nh5pFW%FsOwU}STQO`&?&9KV>}7f;b_HnOym!GclR-w(%k^h6!?d53F!50zxQut$p}zJk*LI*F}+g1i7=Ye#&rLfh@lW^(*-ohSStRA zUCq5|UB=*HÉ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 b<^K^ol;z+dW`%-!0{QEJd?}G6k9YqAZZ-S* literal 0 HcmV?d00001 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 2f874f79ecc6..5a5c103786f4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -1165,6 +1165,24 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentWithChildrenTdf163092) CPPUNIT_ASSERT_EQUAL(parents[sComment3Id], sComment2Id); } +CPPUNIT_TEST_FIXTURE(Test, testTdf146269) +{ + // Given a focument with a field in a redline: + createSwDoc("deleted_pageref.docx"); + // It must open unmodified: + { + auto xModifiable = mxComponent.queryThrow(); + CPPUNIT_ASSERT(!xModifiable->isModified()); + } + + // Test also after save-and-reload: + saveAndReload(u"Office Open XML Text"_ustr); + { + auto xModifiable = mxComponent.queryThrow(); + CPPUNIT_ASSERT(!xModifiable->isModified()); + } +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); From 4049405dcde61fa66852dae72d811562c69b3920 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 25 Nov 2024 22:46:22 +0100 Subject: [PATCH 256/373] Let a test use a copy of a SRCDIR test doc Whatever the reason, but running the test against a read-only SRCDIR caused CppunitTest_sfx2_view CPPUNIT_TEST_NAME=testLokHelperCommandValuesSignature::TestBody to fail with > sfx2/qa/cppunit/view.cxx:138:testLokHelperCommandValuesSignature::TestBody > assertion failed > - Expression: nSignatureTime != 0 Change-Id: I35d7df0de1b63937920687444ea0698fc0856446 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177302 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- sfx2/qa/cppunit/view.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sfx2/qa/cppunit/view.cxx b/sfx2/qa/cppunit/view.cxx index 220a913b2ca6..d2c81d6e9a6e 100644 --- a/sfx2/qa/cppunit/view.cxx +++ b/sfx2/qa/cppunit/view.cxx @@ -119,7 +119,8 @@ CPPUNIT_TEST_FIXTURE(Sfx2ViewTest, testLokHelperAddCertifices) CPPUNIT_TEST_FIXTURE(Sfx2ViewTest, testLokHelperCommandValuesSignature) { // Given an unsigned PDF file: - loadFromFile(u"unsigned.pdf"); + createTempCopy(u"unsigned.pdf"); + loadFromURL(maTempFile.GetURL()); // When extracting hashes: tools::JsonWriter aWriter; From d902401452d85db0c320401335b5170dfa5f6c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCl=C5=9Fah=20K=C3=B6se?= Date: Fri, 22 Nov 2024 14:38:40 +0300 Subject: [PATCH 257/373] tdf#163842 Fix autofilter ascending sort condition reference import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if (rSorConditionLoaded.mbDescending) condition ignores the ascending sort. So when we import a document that uses ascending sort then export it, we don't know which column is sorted. With the following patch we fix this case. Signed-off-by: Gülşah Köse Change-Id: I561146517959a87eb0fb6cec419d68299bcb7eee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177016 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177222 Tested-by: Jenkins --- sc/qa/unit/data/xlsx/sortconditionref.xlsx | Bin 0 -> 8993 bytes sc/qa/unit/subsequent_export_test2.cxx | 15 +++++++++++++++ sc/source/filter/oox/autofilterbuffer.cxx | 10 ++++------ 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 sc/qa/unit/data/xlsx/sortconditionref.xlsx diff --git a/sc/qa/unit/data/xlsx/sortconditionref.xlsx b/sc/qa/unit/data/xlsx/sortconditionref.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..7aaebcc20471e5a6abd5249079b4fb2313224283 GIT binary patch literal 8993 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 literal 0 HcmV?d00001 diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index ca0effbea1e1..43226bb14e9f 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -401,6 +401,21 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf95640_xlsx_to_xlsx) u"Low,Medium,High"); } +CPPUNIT_TEST_FIXTURE(ScExportTest2, testSortConditionRef) +{ + // Ascending sortCondition reference detected wrong without fix. + // - Expected: B3:B2 + // - Actual : A3:A2 + // - In <>, attribute 'ref' of '//x:worksheet/x:autoFilter/x:sortState/x:sortCondition' incorrect value. + createScDoc("xlsx/sortconditionref.xlsx"); + + save(u"Calc Office Open XML"_ustr); + xmlDocUniquePtr pDoc = parseExport(u"xl/worksheets/sheet1.xml"_ustr); + + assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", u"B2"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", u"B3:B2"); +} + CPPUNIT_TEST_FIXTURE(ScExportTest2, testDateAutofilterXLSX) { // XLSX Roundtripping autofilter with date list diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index 2aaeae049be1..1d7b7ffb0d70 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -847,15 +847,13 @@ void AutoFilter::finalizeImport( const Reference< XDatabaseRange >& rxDatabaseRa return; SCCOLROW nStartPos = aParam.bByRow ? maRange.aStart.Col() : maRange.aStart.Row(); + // descending sort - need to enable 1st SortParam slot if (rSorConditionLoaded.mbDescending) - { - // descending sort - need to enable 1st SortParam slot assert(aParam.GetSortKeyCount() == DEFSORT); - aParam.maKeyState[0].bDoSort = true; - aParam.maKeyState[0].bAscending = false; - aParam.maKeyState[0].nField += nStartPos; - } + aParam.maKeyState[0].bDoSort = true; + aParam.maKeyState[0].bAscending = !rSorConditionLoaded.mbDescending; + aParam.maKeyState[0].nField += nStartPos; ScDBData* pDBData = rDoc.GetDBAtArea( nSheet, From 16bce5bb1cb4e446f45633b128f6ab02a48b6840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Mon, 25 Nov 2024 15:15:36 +0100 Subject: [PATCH 258/373] tdf#86731 bNoDictionaryAvailable should trigger meesagebox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reverts "PVS: V547 Expression 'bNoDictionaryAvailable' is always false" This reverts commit 816b51c7a9cdd72eaa01f3c074ba5a8446917d19. It removed the message completely from the code while, we should fix it rather by using correct condition. It was somehow too aggresively limited in commit f200dd5cb84681558700c49de0969907f78f8db1 tdf#86731 Don't show 'start from beginning' when dictionary is missing Change-Id: I5f4b859047216399a09c7aefb8a47244c4833df5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177271 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- sw/inc/strings.hrc | 1 + sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 44b011cba6b7..a6ce4cad0a5a 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -945,6 +945,7 @@ #define STR_QUERY_SPELL_CONTINUE NC_("STR_QUERY_SPELL_CONTINUE", "Continue checking at beginning of document?") #define STR_SPELLING_COMPLETED NC_("STR_SPELLING_COMPLETED", "The spellcheck is complete.") +#define STR_DICTIONARY_UNAVAILABLE NC_("STR_DICTIONARY_UNAVAILABLE", "No dictionary available") /*-------------------------------------------------------------------- Description: strings for the types diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 69f5c3a18194..65c96385f0e6 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -398,10 +398,10 @@ The code below would only be part of the solution. bCloseMessage = false; // no closing message if a wrap around has been denied } } - if( aRet.empty() && bCloseMessage && !bNoDictionaryAvailable ) + if( aRet.empty() && bCloseMessage ) { LockFocusNotification( true ); - OUString sInfo( SwResId( STR_SPELLING_COMPLETED ) ); + OUString sInfo( SwResId( bNoDictionaryAvailable ? STR_DICTIONARY_UNAVAILABLE : STR_SPELLING_COMPLETED ) ); auto xSpellController = GetController(); // #i84610# std::unique_ptr xBox( From 608deaf49c585e8b34e9d53e4e3f175fbfdf3201 Mon Sep 17 00:00:00 2001 From: Sahil Gautam Date: Sun, 24 Nov 2024 01:45:01 +0530 Subject: [PATCH 259/373] Libreoffice Theme Part 4: Windows Color Customization I couldn't find any way of putting the colors from the theme back into the system using the win32 api. Taking inspiration from Caolan's dark mode patch (commit: a3f400886768bf95fbd8e6b236e11d7aac393b96, related: tdf#118320 enable some windows dark theme support, 2022-03-17), I was able to make it work. I am working on vcl welding for windows, for which I am learning win32. In the coming weeks/months the themeing approach for windows is expected evolve because of that. There are some "rough edges" still... something to be addressed later in different tickets. Change-Id: I4b4cb3804b9b7a9d15e75a1b2511cdedda2b5b12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170840 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Sahil Gautam --- vcl/win/gdi/salnativewidgets-luna.cxx | 291 ++++++++++++++++++++++++-- vcl/win/window/salframe.cxx | 86 +++++++- 2 files changed, 359 insertions(+), 18 deletions(-) diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx index 53f835fbdd8a..02248127ed09 100644 --- a/vcl/win/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/gdi/salnativewidgets-luna.cxx @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -434,6 +435,211 @@ bool UseDarkMode() return bRet; } +static bool drawThemedControl(HDC hDC, ControlType nType, int iPart, int iState, RECT rc) +{ + if (nType == ControlType::Scrollbar) + { + if (iPart == SBP_ARROWBTN) + { + const Color& rBackColor = ThemeColors::GetThemeColors().GetWindowColor(); + const Color& rArrowFillColor = ThemeColors::GetThemeColors().GetBaseColor(); + + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(rBackColor.GetRed(), + rBackColor.GetGreen(), + rBackColor.GetBlue()))); + FillRect(hDC, &rc, hbrush.get()); + + bool bDrawArrow = false; + POINT aArrowPoints[3]; + + if (iState == ABS_UPHOT || iState == ABS_UPPRESSED) + { + aArrowPoints[0] = { rc.left + (rc.right - rc.left) / 4, rc.bottom - (rc.bottom - rc.top) / 4 }; + aArrowPoints[1] = { rc.right - (rc.right - rc.left) / 4, rc.bottom - (rc.bottom - rc.top) / 4 }; + aArrowPoints[2] = { rc.left + (rc.right - rc.left) / 2, rc.top + (rc.bottom - rc.top) / 4 }; + bDrawArrow = true; + } + else if (iState == ABS_DOWNHOT || iState == ABS_DOWNPRESSED) + { + aArrowPoints[0] = { rc.left + (rc.right - rc.left) / 4, rc.top + (rc.bottom - rc.top) / 4 }; + aArrowPoints[1] = { rc.right - (rc.right - rc.left) / 4, rc.top + (rc.bottom - rc.top) / 4 }; + aArrowPoints[2] = { rc.left + (rc.right - rc.left) / 2, rc.bottom - (rc.bottom - rc.top) / 4 }; + bDrawArrow = true; + } + else if (iState == ABS_RIGHTHOT || iState == ABS_RIGHTPRESSED) + { + aArrowPoints[0] = { rc.left + (rc.right - rc.left) / 4, rc.top + (rc.bottom - rc.top) / 4 }; + aArrowPoints[1] = { rc.right - (rc.right - rc.left) / 4, rc.top + (rc.bottom - rc.top) / 2 }; + aArrowPoints[2] = { rc.left + (rc.right - rc.left) / 4, rc.bottom - (rc.bottom - rc.top) / 4 }; + bDrawArrow = true; + } + else if (iState == ABS_LEFTHOT || iState == ABS_LEFTPRESSED) + { + aArrowPoints[0] = { rc.right - (rc.right - rc.left) / 4, rc.top + (rc.bottom - rc.top) / 4 }; + aArrowPoints[1] = { rc.right - (rc.right - rc.left) / 4, rc.bottom - (rc.bottom - rc.top) / 4 }; + aArrowPoints[2] = { rc.left + (rc.right - rc.left) / 4, rc.top + (rc.bottom - rc.top) / 2 }; + bDrawArrow = true; + } + + if (bDrawArrow) + { + ScopedHPEN hpen(CreatePen(PS_SOLID, 1, RGB(0, 0, 0))); + ScopedHBRUSH hbrushArrow(CreateSolidBrush(RGB(rArrowFillColor.GetRed(), + rArrowFillColor.GetGreen(), + rArrowFillColor.GetBlue()))); + SelectObject(hDC, hpen.get()); + SelectObject(hDC, hbrushArrow.get()); + Polygon(hDC, aArrowPoints, ARRAYSIZE(aArrowPoints)); + } + return true; + } + else if (iPart == SBP_THUMBBTNHORZ || iPart == SBP_THUMBBTNVERT) + { + Color aScrollBarThumbColor = ThemeColors::GetThemeColors().GetBaseColor(); + const Color& rBackgroundColor = ThemeColors::GetThemeColors().GetWindowColor(); + + if (iState == SCRBS_PRESSED) + aScrollBarThumbColor.IncreaseLuminance(60); + else if (iState = SCRBS_HOT) + aScrollBarThumbColor.IncreaseLuminance(30); + + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(rBackgroundColor.GetRed(), + rBackgroundColor.GetGreen(), + rBackgroundColor.GetBlue()))); + FillRect(hDC, &rc, hbrush.get()); + + RECT thumb = rc; + if (iPart == SBP_THUMBBTNHORZ) + { + thumb.top += 3; + thumb.bottom -= 3; + } + else + { + thumb.left += 3; + thumb.right -= 3; + } + + hbrush = ScopedHBRUSH(CreateSolidBrush(RGB(aScrollBarThumbColor.GetRed(), + aScrollBarThumbColor.GetGreen(), + aScrollBarThumbColor.GetBlue()))); + FillRect(hDC, &thumb, hbrush.get()); + return true; + } + else if (iPart == SBP_UPPERTRACKHORZ || iPart == SBP_LOWERTRACKHORZ + || iPart == SBP_UPPERTRACKVERT || iPart == SBP_LOWERTRACKVERT) + { + const Color& rWindowColor = ThemeColors::GetThemeColors().GetWindowColor(); + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(rWindowColor.GetRed(), + rWindowColor.GetGreen(), + rWindowColor.GetBlue()))); + FillRect(hDC, &rc, hbrush.get()); + FrameRect(hDC, &rc, hbrush.get()); + return true; + } + } + else if (nType == ControlType::Pushbutton) + { + if (iPart == BP_PUSHBUTTON) + { + Color aButtonColor = ThemeColors::GetThemeColors().GetButtonColor(); + const Color& rButtonRectColor = ThemeColors::GetThemeColors().GetDisabledColor(); + + if (iState == PBS_PRESSED) + aButtonColor.Merge(rButtonRectColor, 230); + else if (iState == PBS_DISABLED) + aButtonColor = ThemeColors::GetThemeColors().GetDisabledColor(); + else if (iState == PBS_HOT) + aButtonColor.Merge(rButtonRectColor, 170); + else if (iState == PBS_DEFAULTED) + aButtonColor.Merge(rButtonRectColor, 150); + + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aButtonColor.GetRed(), + aButtonColor.GetGreen(), + aButtonColor.GetBlue()))); + FillRect(hDC, &rc, hbrush.get()); + + hbrush = ScopedHBRUSH(CreateSolidBrush(RGB(rButtonRectColor.GetRed(), + rButtonRectColor.GetGreen(), + rButtonRectColor.GetBlue()))); + FrameRect(hDC, &rc, hbrush.get()); + return true; + } + } + else if (nType == ControlType::Editbox) + { + if (iPart == EP_EDITBORDER_NOSCROLL) + { + const Color& rColor = ThemeColors::GetThemeColors().GetSeparatorColor(); + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(rColor.GetRed(), + rColor.GetGreen(), + rColor.GetBlue()))); + FrameRect(hDC, &rc, hbrush.get()); + return true; + } + } + else if (nType == ControlType::Toolbar) + { + if (iPart == TP_BUTTON) + { + Color aButtonColor = ThemeColors::GetThemeColors().GetAccentColor(); + const Color& rWindowColor = ThemeColors::GetThemeColors().GetWindowColor(); + Color aFrameOutline = aButtonColor; + + if (iState == TS_PRESSED) + aButtonColor.Merge(rWindowColor, 100); + else if (iState == TS_HOTCHECKED || iState == TS_HOT) + aButtonColor.Merge(rWindowColor, 60); + else if (iState == TS_CHECKED || iState == TS_NORMAL) + aButtonColor.Merge(rWindowColor, 100); + + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aButtonColor.GetRed(), + aButtonColor.GetGreen(), + aButtonColor.GetBlue()))); + FillRect(hDC, &rc, hbrush.get()); + + hbrush = ScopedHBRUSH(CreateSolidBrush(RGB(aFrameOutline.GetRed(), + aFrameOutline.GetGreen(), + aFrameOutline.GetBlue()))); + FrameRect(hDC, &rc, hbrush.get()); + return true; + } + } + else if (nType == ControlType::MenuPopup) + { + if (iPart == MENU_POPUPBACKGROUND) + { + Color aColor(ThemeColors::GetThemeColors().GetMenuColor()); + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(), + aColor.GetGreen(), + aColor.GetBlue()))); + FillRect(hDC, &rc, hbrush.get()); + + aColor = ThemeColors::GetThemeColors().GetMenuBorderColor(); + hbrush = ScopedHBRUSH(CreateSolidBrush( RGB(aColor.GetRed(), + aColor.GetGreen(), + aColor.GetBlue()))); + FrameRect(hDC, &rc, hbrush.get()); + return true; + } + else if (iPart == MENU_POPUPITEM) + { + Color aBackgroundColor; + if (iState == MPI_HOT || iState == MPI_NORMAL) + aBackgroundColor = ThemeColors::GetThemeColors().GetMenuHighlightColor(); + else if (iState == MPI_DISABLEDHOT || MPI_DISABLED) + aBackgroundColor = ThemeColors::GetThemeColors().GetDisabledColor(); + + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aBackgroundColor.GetRed(), + aBackgroundColor.GetGreen(), + aBackgroundColor.GetBlue()))); + FillRect(hDC, &rc, hbrush.get()); + return true; + } + } + return false; +} + static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, ControlType nType, ControlPart nPart, @@ -457,6 +663,7 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nPart == ControlPart::Entire ) nType = ControlType::Editbox; + bool bThemeLoaded = ThemeColors::IsThemeLoaded(); int iPart(0), iState(0); if( nType == ControlType::Scrollbar ) { @@ -472,6 +679,10 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iState = ABS_UPHOT; else iState = ABS_UPNORMAL; + + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + hr = DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr); return (hr == S_OK); } @@ -486,6 +697,10 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iState = ABS_DOWNHOT; else iState = ABS_DOWNNORMAL; + + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + hr = DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr); return (hr == S_OK); } @@ -500,6 +715,10 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iState = ABS_LEFTHOT; else iState = ABS_LEFTNORMAL; + + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + hr = DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr); return (hr == S_OK); } @@ -514,6 +733,10 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iState = ABS_RIGHTHOT; else iState = ABS_RIGHTNORMAL; + + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + hr = DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr); return (hr == S_OK); } @@ -534,6 +757,9 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, GetThemePartSize(hTheme, hDC, iPart, iState, nullptr, TS_TRUE, &sz); GetThemePartSize(hTheme, hDC, iPart, iState, nullptr, TS_DRAW, &sz); + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + hr = DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr); // paint gripper on thumb if enough space if( ( (nPart == ControlPart::ThumbVert) && (rc.bottom-rc.top > 12) ) || @@ -564,6 +790,10 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iState = SCRBS_HOT; else iState = SCRBS_NORMAL; + + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + hr = DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr); return (hr == S_OK); } @@ -692,6 +922,9 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, else iState = PBS_NORMAL; + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } @@ -755,6 +988,9 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, else iState = EPSN_NORMAL; + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } @@ -786,7 +1022,7 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, { // tabpane in tabcontrols gets drawn in "darkmode" as if it was a // a "light" theme, so bodge this by drawing a frame directly - if (bUseDarkMode) + if (bThemeLoaded || bUseDarkMode) { Color aColor(Application::GetSettings().GetStyleSettings().GetDisableColor()); ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(), @@ -802,7 +1038,7 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nType == ControlType::TabBody ) { // tabbody in main window gets drawn in white in "darkmode", so bodge this here - if (bUseDarkMode) + if (bThemeLoaded || bUseDarkMode) { Color aColor(Application::GetSettings().GetStyleSettings().GetWindowColor()); ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(), @@ -862,7 +1098,7 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, // tabitem in tabcontrols gets drawn in "darkmode" as if it was a // a "light" theme, so bodge this by drawing with a button instead - if (bUseDarkMode) + if (bThemeLoaded || bUseDarkMode) { Color aColor; if (iState == TILES_SELECTED) @@ -912,6 +1148,9 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, else iState = bChecked ? TS_CHECKED : TS_NORMAL; + if (bThemeLoaded) + return drawThemedControl(hDC, nType, iPart, iState, rc); + if (bUseDarkMode && (bChecked || (nState & (ControlState::PRESSED) || (nState & ControlState::ROLLOVER)))) { const WinOSVersionInfo aVersion = WinSalInstance::getWinOSVersionInfo(); @@ -954,7 +1193,7 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, } // toolbar in main window gets drawn in white in "darkmode", so bodge this here - if (bUseDarkMode) + if (bThemeLoaded || bUseDarkMode) { Color aColor(Application::GetSettings().GetStyleSettings().GetWindowColor()); ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(), @@ -986,9 +1225,12 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, rc.bottom += pValue->maTopDockingAreaHeight; // extend potential gradient to cover docking area as well // menubar in main window gets drawn in white in "darkmode", so bodge this here - if (bUseDarkMode) + if (bThemeLoaded || bUseDarkMode) { - Color aColor(Application::GetSettings().GetStyleSettings().GetWindowColor()); + Color aColor + = bThemeLoaded + ? ThemeColors::GetThemeColors().GetMenuBarColor() + : Application::GetSettings().GetStyleSettings().GetWindowColor(); ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue()))); @@ -1017,13 +1259,18 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, else iState = MBI_NORMAL; - if(GetSalData()->mbThemeMenuSupport && Application::GetSettings().GetStyleSettings().GetHighContrastMode() - && ( nState & (ControlState::SELECTED | nState & ControlState::ROLLOVER ))) + if (bThemeLoaded + || (GetSalData()->mbThemeMenuSupport + && Application::GetSettings().GetStyleSettings().GetHighContrastMode() + && (nState & (ControlState::SELECTED | nState & ControlState::ROLLOVER)))) { - Color aColor(Application::GetSettings().GetStyleSettings().GetHighlightColor()); + Color aColor = bThemeLoaded + ? ThemeColors::GetThemeColors().GetMenuBarHighlightColor() + : Application::GetSettings().GetStyleSettings().GetHighlightColor(); + ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aColor.GetRed(), - aColor.GetGreen(), - aColor.GetBlue()))); + aColor.GetGreen(), + aColor.GetBlue()))); FillRect(hDC, &rc, hbrush.get()); return true; } @@ -1161,6 +1408,10 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, aGutterRC.left += aValue.getNumericVal(); aGutterRC.right = aGutterRC.left+3; } + + if (bThemeLoaded) + return drawThemedControl(hDC, nType, MENU_POPUPBACKGROUND, iState, rc); + return ImplDrawTheme( hTheme, hDC, MENU_POPUPBACKGROUND, 0, rc, aCaption ) && ImplDrawTheme( hTheme, hDC, MENU_POPUPGUTTER, 0, aGutterRC, aCaption ) @@ -1172,6 +1423,10 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iState = (nState & ControlState::SELECTED) ? MPI_HOT : MPI_NORMAL; else iState = (nState & ControlState::SELECTED) ? MPI_DISABLEDHOT : MPI_DISABLED; + + if (bThemeLoaded) + return drawThemedControl(hDC, nType, MENU_POPUPITEM, iState, rc); + return ImplDrawTheme( hTheme, hDC, MENU_POPUPITEM, iState, rc, aCaption ); } else if( nPart == ControlPart::MenuItemCheckMark || nPart == ControlPart::MenuItemRadioMark ) @@ -1642,11 +1897,17 @@ void WinSalGraphics::updateSettingsNative( AllSettings& rSettings ) Color aMenuBarTextColor = aStyleSettings.GetPersonaMenuBarTextColor().value_or( aStyleSettings.GetMenuTextColor() ); // in aero menuitem highlight text is drawn in the same color as normal // high contrast highlight color is not related to persona and not apply blur or transparency - if( !aStyleSettings.GetHighContrastMode() ) + bool bThemeLoaded = ThemeColors::IsThemeLoaded(); + if( bThemeLoaded || !aStyleSettings.GetHighContrastMode() ) { - aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() ); - aStyleSettings.SetMenuBarRolloverTextColor( aMenuBarTextColor ); - aStyleSettings.SetMenuBarHighlightTextColor( aMenuBarTextColor ); + const ThemeColors& rThemeColors = ThemeColors::GetThemeColors(); + aStyleSettings.SetMenuHighlightTextColor(bThemeLoaded + ? rThemeColors.GetMenuHighlightTextColor() + : aStyleSettings.GetMenuTextColor()); + aStyleSettings.SetMenuBarRolloverTextColor( + bThemeLoaded ? rThemeColors.GetMenuBarHighlightTextColor() : aMenuBarTextColor); + aStyleSettings.SetMenuBarHighlightTextColor( + bThemeLoaded ? rThemeColors.GetMenuBarHighlightTextColor() : aMenuBarTextColor); } pSVData->maNWFData.mnMenuFormatBorderX = 2; diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 09018fdf8c6b..dbbffe73b27b 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -51,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -2610,6 +2612,72 @@ static tools::Long ImplW2I( const wchar_t* pStr ) return n; } +static void lcl_LoadColorsFromTheme(StyleSettings& rStyleSet) +{ + const ThemeColors& rThemeColors = ThemeColors::GetThemeColors(); + + rStyleSet.SetWindowColor(rThemeColors.GetWindowColor()); + rStyleSet.BatchSetBackgrounds(rThemeColors.GetWindowColor()); + + rStyleSet.SetActiveTabColor(rThemeColors.GetWindowColor()); + rStyleSet.SetInactiveTabColor(rThemeColors.GetBaseColor()); + rStyleSet.SetDisableColor(rThemeColors.GetDisabledColor()); // tab outline + + // Highlight related colors + rStyleSet.SetAccentColor(rThemeColors.GetAccentColor()); + rStyleSet.SetHighlightColor(rThemeColors.GetAccentColor()); + + rStyleSet.SetListBoxWindowHighlightColor(rThemeColors.GetAccentColor()); + rStyleSet.SetListBoxWindowTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetListBoxWindowBackgroundColor(rThemeColors.GetBaseColor()); + rStyleSet.SetListBoxWindowHighlightTextColor(rThemeColors.GetMenuHighlightTextColor()); + rStyleSet.SetWindowTextColor(rThemeColors.GetWindowTextColor()); // Treeview Lists + + rStyleSet.SetRadioCheckTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetLabelTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetFieldTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetTabTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetFieldColor(rThemeColors.GetBaseColor()); + rStyleSet.SetMenuBarTextColor(rThemeColors.GetMenuBarTextColor()); + rStyleSet.SetMenuTextColor(rThemeColors.GetMenuTextColor()); + + rStyleSet.SetDefaultActionButtonTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetActionButtonTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetShadowColor(rThemeColors.GetShadeColor()); + + rStyleSet.SetDefaultButtonTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetDefaultButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetDefaultButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + + rStyleSet.SetFlatButtonTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetFlatButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetFlatButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + + rStyleSet.SetButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetDefaultActionButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetDefaultActionButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetActionButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetActionButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetFieldRolloverTextColor(rThemeColors.GetButtonTextColor()); + + rStyleSet.SetButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetHelpColor(rThemeColors.GetWindowColor()); + rStyleSet.SetHelpTextColor(rThemeColors.GetWindowTextColor()); + + // rStyleSet.SetHighlightTextColor(aThemeColors.GetActiveTextColor()); + // rStyleSet.SetActiveColor(aThemeColors.GetActiveColor()); + rStyleSet.SetActiveTextColor(rThemeColors.GetWindowTextColor()); + + // rStyleSet.SetLinkColor(aThemeColors.GetAccentColor()); + // Color aVisitedLinkColor = aThemeColors.GetActiveColor(); + // aVisitedLinkColor.Merge(aThemeColors.GetWindowColor(), 100); + // rStyleSet.SetVisitedLinkColor(aVisitedLinkColor); + // rStyleSet.SetToolTextColor(Color(255, 0, 0)); + + rStyleSet.SetTabRolloverTextColor(rThemeColors.GetMenuBarHighlightTextColor()); +} + void WinSalFrame::UpdateSettings( AllSettings& rSettings ) { MouseSettings aMouseSettings = rSettings.GetMouseSettings(); @@ -2690,9 +2758,16 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) } const bool bUseDarkMode(UseDarkMode()); - - OUString sThemeName(!bUseDarkMode ? u"colibre" : u"colibre_dark"); - aStyleSettings.SetPreferredIconTheme(sThemeName, bUseDarkMode); + if (!ThemeColors::IsThemeLoaded()) + { + OUString sThemeName(!bUseDarkMode ? u"colibre" : u"colibre_dark"); + aStyleSettings.SetPreferredIconTheme(sThemeName, bUseDarkMode); + } + else + { + aStyleSettings.SetPreferredIconTheme(vcl::IconThemeSelector::GetIconThemeForDesktopEnvironment( + Application::GetDesktopEnvironment(), ThemeColors::GetThemeColors().GetWindowColor().IsDark())); + } if (bUseDarkMode) { @@ -2930,6 +3005,11 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) } } + // otherwise, menu shows up as white in dark mode + aStyleSettings.SetMenuColor(aStyleSettings.GetWindowColor()); + if (ThemeColors::IsThemeLoaded()) + lcl_LoadColorsFromTheme(aStyleSettings); + rSettings.SetMouseSettings( aMouseSettings ); rSettings.SetStyleSettings( aStyleSettings ); From 2baa317ae365003b75537bbdc4d7b57bfa20e0b3 Mon Sep 17 00:00:00 2001 From: Sahil Gautam Date: Wed, 20 Nov 2024 18:06:21 +0530 Subject: [PATCH 260/373] Libreoffice Theme Part 5: OSX Color Customization We don't draw popup menus and menubar rather use the native ones. I don't know any Objective-C which made it really difficult for me to parse the widget toolkit code. I can learn it if required, but it would be better if some macos developer takes this patch further; Themeing related objects like colors, persona settings (TODO) will be available via the ThemeColors class. Change-Id: Idd89328ca82fbfa58b1e686b5b105469bea4b4a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171239 Tested-by: Jenkins Reviewed-by: Sahil Gautam Reviewed-by: Patrick Luby --- vcl/osx/salframe.cxx | 71 +++++++++++++++++++++++++++++++++++- vcl/osx/salnativewidgets.cxx | 35 +++++++++++++++--- 2 files changed, 99 insertions(+), 7 deletions(-) diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 81aae45457a7..109ccfd16ba8 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include @@ -34,6 +35,7 @@ #include #include #include +#include #include #include @@ -1345,6 +1347,58 @@ bool AquaSalFrame::GetUseReducedAnimation() const return [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldReduceMotion]; } +static void lcl_LoadColorsFromTheme(StyleSettings& rStyleSet) +{ + const ThemeColors& rThemeColors = ThemeColors::GetThemeColors(); + rStyleSet.SetWindowColor(rThemeColors.GetWindowColor()); + rStyleSet.BatchSetBackgrounds(rThemeColors.GetWindowColor()); + rStyleSet.SetActiveTabColor(rThemeColors.GetWindowColor()); + rStyleSet.SetInactiveTabColor(rThemeColors.GetBaseColor()); + rStyleSet.SetDisableColor(rThemeColors.GetDisabledColor()); // tab outline + // Highlight related colors + rStyleSet.SetAccentColor(rThemeColors.GetAccentColor()); + rStyleSet.SetHighlightColor(rThemeColors.GetAccentColor()); + rStyleSet.SetListBoxWindowHighlightColor(rThemeColors.GetAccentColor()); + rStyleSet.SetListBoxWindowTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetListBoxWindowBackgroundColor(rThemeColors.GetBaseColor()); + rStyleSet.SetListBoxWindowHighlightTextColor(rThemeColors.GetMenuHighlightTextColor()); + rStyleSet.SetWindowTextColor(rThemeColors.GetWindowTextColor()); // Treeview Lists + rStyleSet.SetRadioCheckTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetLabelTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetFieldTextColor(rThemeColors.GetWindowTextColor()); + rStyleSet.SetFieldColor(rThemeColors.GetBaseColor()); + rStyleSet.SetMenuBarTextColor(rThemeColors.GetMenuBarTextColor()); + rStyleSet.SetMenuTextColor(rThemeColors.GetMenuTextColor()); + rStyleSet.SetDefaultActionButtonTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetActionButtonTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetShadowColor(rThemeColors.GetShadeColor()); + rStyleSet.SetDefaultButtonTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetDefaultButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetDefaultButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetFlatButtonTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetFlatButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetFlatButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetDefaultActionButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetDefaultActionButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetActionButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetActionButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetFieldRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetButtonRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetButtonPressedRolloverTextColor(rThemeColors.GetButtonTextColor()); + rStyleSet.SetHelpColor(rThemeColors.GetWindowColor()); + rStyleSet.SetHelpTextColor(rThemeColors.GetWindowTextColor()); + // rStyleSet.SetHighlightTextColor(rThemeColors.GetActiveTextColor()); + // rStyleSet.SetActiveColor(rThemeColors.GetActiveColor()); + // rStyleSet.SetActiveTextColor(rThemeColors.GetActiveTextColor()); + // rStyleSet.SetLinkColor(rThemeColors.GetAccentColor()); + // Color aVisitedLinkColor = rThemeColors.GetActiveColor(); + // aVisitedLinkColor.Merge(rThemeColors.GetWindowColor(), 100); + // rStyleSet.SetVisitedLinkColor(aVisitedLinkColor); + // rStyleSet.SetToolTextColor(Color(255, 0, 0)); + rStyleSet.SetTabRolloverTextColor(rThemeColors.GetMenuBarHighlightTextColor()); +} + // on OSX-Aqua the style settings are independent of the frame, so it does // not really belong here. Since the connection to the Appearance_Manager // is currently done in salnativewidgets.cxx this would be a good place. @@ -1376,8 +1430,18 @@ SAL_WNODEPRECATED_DECLARATIONS_POP StyleSettings aStyleSettings = rSettings.GetStyleSettings(); bool bUseDarkMode(GetUseDarkMode()); - OUString sThemeName(!bUseDarkMode ? u"sukapura_svg" : u"sukapura_dark_svg"); - aStyleSettings.SetPreferredIconTheme(sThemeName, bUseDarkMode); + if (!ThemeColors::IsThemeLoaded()) + { + OUString sThemeName(!bUseDarkMode ? u"sukapura_svg" : u"sukapura_dark_svg"); + aStyleSettings.SetPreferredIconTheme(sThemeName, bUseDarkMode); + } + else + { + aStyleSettings.SetPreferredIconTheme( + vcl::IconThemeSelector::GetIconThemeForDesktopEnvironment( + Application::GetDesktopEnvironment(), + ThemeColors::GetThemeColors().GetWindowColor().IsDark())); + } Color aControlBackgroundColor(getNSBoxBackgroundColor([NSColor controlBackgroundColor])); Color aWindowBackgroundColor(getNSBoxBackgroundColor([NSColor windowBackgroundColor])); @@ -1540,6 +1604,9 @@ SAL_WNODEPRECATED_DECLARATIONS_POP aStyleSettings.SetHideDisabledMenuItems( true ); aStyleSettings.SetPreferredContextMenuShortcuts( false ); + if (ThemeColors::IsThemeLoaded()) + lcl_LoadColorsFromTheme(aStyleSettings); + rSettings.SetStyleSettings( aStyleSettings ); // don't draw frame around each and every toolbar diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 7dd94ac4b87e..88bccb7a6985 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -254,6 +255,14 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType, return mpBackend->drawNativeControl(nType, nPart, rControlRegion, nState, aValue); } +static NSColor* colorFromRGB(const Color& rColor) +{ + return [NSColor colorWithSRGBRed:(rColor.GetRed() / 255.0f) + green:(rColor.GetGreen() / 255.0f) + blue:(rColor.GetBlue() / 255.0f) + alpha:(rColor.GetAlpha() / 255.0f)]; +} + static void paintCell(NSCell* pBtn, const NSRect& bounds, bool bShowsFirstResponder, CGContextRef context, NSView* pView) { //translate and scale because up side down otherwise @@ -424,7 +433,10 @@ static void drawBox(CGContextRef context, const NSRect& rc, NSColor* pColor) static void drawEditableBackground(CGContextRef context, const NSRect& rc) { CGContextSaveGState(context); - CGContextSetFillColorWithColor(context, [NSColor controlBackgroundColor].CGColor); + if (ThemeColors::IsThemeLoaded()) + CGContextSetFillColorWithColor(context, colorFromRGB(ThemeColors::GetThemeColors().GetBaseColor()).CGColor); + else + CGContextSetFillColorWithColor(context, [NSColor controlBackgroundColor].CGColor); CGContextFillRect(context, rc); CGContextRestoreGState(context); } @@ -441,19 +453,26 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, AquaSalFrame* mpFrame) { bool bOK = false; + bool bThemeLoaded(ThemeColors::IsThemeLoaded()); AquaSalInstance* pInst = GetSalData()->mpInstance; HIRect rc = ImplGetHIRectFromRectangle(rControlRegion); switch (nType) { case ControlType::Toolbar: { - drawBox(context, rc, NSColor.windowBackgroundColor); + if (bThemeLoaded) + drawBox(context, rc, colorFromRGB(ThemeColors::GetThemeColors().GetWindowColor())); + else + drawBox(context, rc, NSColor.windowBackgroundColor); bOK = true; } break; case ControlType::WindowBackground: { - drawBox(context, rc, NSColor.windowBackgroundColor); + if (bThemeLoaded) + drawBox(context, rc, colorFromRGB(ThemeColors::GetThemeColors().GetWindowColor())); + else + drawBox(context, rc, NSColor.windowBackgroundColor); bOK = true; } break; @@ -461,7 +480,10 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, { rc.size.width += 2; rc.size.height += 2; - drawBox(context, rc, NSColor.controlBackgroundColor); + if (bThemeLoaded) + drawBox(context, rc, colorFromRGB(ThemeColors::GetThemeColors().GetBaseColor())); + else + drawBox(context, rc, NSColor.controlBackgroundColor); bOK = true; } break; @@ -720,7 +742,10 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, ? static_cast(&aValue) : nullptr; if (nPart == ControlPart::DrawBackgroundVert || nPart == ControlPart::DrawBackgroundHorz) { - drawBox(context, rc, NSColor.controlBackgroundColor); + if (bThemeLoaded) + drawBox(context, rc, colorFromRGB(ThemeColors::GetThemeColors().GetBaseColor())); + else + drawBox(context, rc, NSColor.controlBackgroundColor); NSRect rect = { NSZeroPoint, NSMakeSize(rc.size.width, rc.size.height) }; NSScroller* pBar = [[NSScroller alloc] initWithFrame: rect]; From 2ed282bedf626ac93ce005906aed7fc2bb835a55 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 25 Nov 2024 21:15:18 +0100 Subject: [PATCH 261/373] sc: prefix members of ScConditionalFormat Change-Id: Ib8d6b19f4ff1a5a641039f7e06083430b53a6edb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177301 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/inc/conditio.hxx | 10 +++++----- sc/source/core/data/conditio.cxx | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 3d22a16c7d33..a179d8d8d875 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -617,8 +617,8 @@ public: // complete conditional formatting class ScConditionalFormat { - ScDocument* pDoc; - sal_uInt32 nKey; // Index in attributes + ScDocument* mpDoc; + sal_uInt32 mnKey; // Index in attributes std::vector> maEntries; ScRangeList maRanges; // Ranges for conditional format @@ -669,13 +669,13 @@ public: void DoRepaint(); - sal_uInt32 GetKey() const { return nKey; } - void SetKey(sal_uInt32 nNew) { nKey = nNew; } // only if not inserted! + sal_uInt32 GetKey() const { return mnKey; } + void SetKey(sal_uInt32 nNew) { mnKey = nNew; } // only if not inserted! bool MarkUsedExternalReferences() const; // sorted (via std::set) by Index - bool operator < ( const ScConditionalFormat& r ) const { return nKey < r.nKey; } + bool operator < ( const ScConditionalFormat& r ) const { return mnKey < r.mnKey; } void startRendering(); void endRendering(); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 29c1c2654f83..94ced759894a 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1786,8 +1786,8 @@ void ScColorFormatCache::Notify(const SfxHint& rHint) ScConditionalFormat::ScConditionalFormat(sal_uInt32 nNewKey, ScDocument* pDocument) : - pDoc( pDocument ), - nKey( nNewKey ) + mpDoc( pDocument ), + mnKey( nNewKey ) { } @@ -1795,9 +1795,9 @@ std::unique_ptr ScConditionalFormat::Clone(ScDocument* pNew { // Real copy of the formula (for Ref Undo/between documents) if (!pNewDoc) - pNewDoc = pDoc; + pNewDoc = mpDoc; - std::unique_ptr pNew(new ScConditionalFormat(nKey, pNewDoc)); + std::unique_ptr pNew(new ScConditionalFormat(mnKey, pNewDoc)); pNew->SetRange( maRanges ); // prerequisite for listeners for (const auto& rxEntry : maEntries) @@ -1863,7 +1863,7 @@ size_t ScConditionalFormat::size() const ScDocument* ScConditionalFormat::GetDocument() { - return pDoc; + return mpDoc; } ScConditionalFormat::~ScConditionalFormat() @@ -1941,7 +1941,7 @@ ScCondFormatData ScConditionalFormat::GetData( ScRefCellValue& rCell, const ScAd void ScConditionalFormat::DoRepaint() { // all conditional format cells - pDoc->RepaintRange( maRanges ); + mpDoc->RepaintRange( maRanges ); } void ScConditionalFormat::CompileAll() @@ -1967,7 +1967,7 @@ void ScConditionalFormat::UpdateReference( sc::RefUpdateContext& rCxt, bool bCop // ScConditionEntry::UpdateReference() obtains its aSrcPos from // maRanges and does not update it on URM_COPY, but it's needed later // for the moved position, so update maRanges beforehand. - maRanges.UpdateReference(URM_MOVE, pDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); + maRanges.UpdateReference(URM_MOVE, mpDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); for (auto& rxEntry : maEntries) rxEntry->UpdateReference(rCxt); } @@ -1975,7 +1975,7 @@ void ScConditionalFormat::UpdateReference( sc::RefUpdateContext& rCxt, bool bCop { for (auto& rxEntry : maEntries) rxEntry->UpdateReference(rCxt); - maRanges.UpdateReference(rCxt.meMode, pDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); + maRanges.UpdateReference(rCxt.meMode, mpDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); } ResetCache(); @@ -2162,8 +2162,8 @@ void ScConditionalFormat::CalcAll() void ScConditionalFormat::ResetCache() const { - if (!maRanges.empty() && pDoc) - mpCache = std::make_unique(*pDoc, maRanges); + if (!maRanges.empty() && mpDoc) + mpCache = std::make_unique(*mpDoc, maRanges); else mpCache.reset(); } From ea0b06415b35ff68959c8fb24355f2c15ad63e64 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 25 Nov 2024 18:12:39 +0100 Subject: [PATCH 262/373] external/postgresql: Include configure fix for C23 stdbool.h ...by backporting upstream "Assume that conforms to the C standard." to our REL_14_15 version. GCC 15 trunk defaults to C23 now, so started to fail with > In file included from fls.c:49: > ../../src/include/c.h:419:23: error: two or more data types in declaration specifiers > 419 | typedef unsigned char bool; > | ^~~~ > ../../src/include/c.h:419:1: warning: useless type name in empty declaration > 419 | typedef unsigned char bool; > | ^~~~~~~ > make: *** [: fls.o] Error 1 > make: Leaving directory 'workdir/UnpackedTarball/postgresql/src/port' (Removing HAVE__BOOL and HAVE_STDBOOL_H also from src/tools/msvc/Solution.pm is necessary to avoid failures like > "C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/workdir/UnpackedTarball/openssl\apps\openssl.exe" version 2>&1unused defines: HAVE_STDBOOL_H HAVE__BOOL at /home/tdf/jenkins/workspace/gerrit_windows/workdir/UnpackedTarball/postgresql/src/tools/msvc/Mkvcbuild.pm line 870. > make[1]: *** [C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/external/postgresql/ExternalProject_postgresql.mk:27: C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/workdir/ExternalProject/postgresql/build] Error 1 in MSVC builds.) Change-Id: I1f6bd0d613ae4d6ce70feaaf67aaf95496eeff87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177280 Reviewed-by: Michael Stahl Tested-by: Jenkins --- ...dbool.h-conforms-to-the-C-standard.patch.1 | 429 ++++++++++++++++++ .../postgresql/UnpackedTarball_postgresql.mk | 1 + 2 files changed, 430 insertions(+) create mode 100644 external/postgresql/0001-Assume-that-stdbool.h-conforms-to-the-C-standard.patch.1 diff --git a/external/postgresql/0001-Assume-that-stdbool.h-conforms-to-the-C-standard.patch.1 b/external/postgresql/0001-Assume-that-stdbool.h-conforms-to-the-C-standard.patch.1 new file mode 100644 index 000000000000..73c6461033cc --- /dev/null +++ b/external/postgresql/0001-Assume-that-stdbool.h-conforms-to-the-C-standard.patch.1 @@ -0,0 +1,429 @@ +From d5fb5a35816df670d329600e44fe22617b578415 Mon Sep 17 00:00:00 2001 +From: Thomas Munro +Date: Mon, 25 Nov 2024 13:11:28 +1300 +Subject: Assume that conforms to the C standard. + +Previously we checked "for that conforms to C99" using +autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL +12, so the test was redundant, and under C23 it was broken: autoconf +2.69's implementation doesn't understand C23's new empty header (the +macros it's looking for went away, replaced by language keywords). +Later autoconf versions fixed that, but let's just remove the +anachronistic test. + +HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they +weren't directly tested in core or likely extensions (except in 11, see +below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined +when sizeof(bool) is 1, which should be true on all modern systems. +Otherwise we define our own bool type and values of size 1, which would +fail to compile under C23 as revealed by the broken test. (We'll +probably clean that dead code up in master, but here we want a minimal +back-patchable change.) + +This came to our attention when GCC 15 recently started using using C23 +by default and failed to compile the replacement code, as reported by +Sam James and build farm animal alligator. + +Back-patch to all supported releases, and then two older versions that +also know about , per the recently-out-of-support policy[1]. +12 requires C99 so it's much like the supported releases, but 11 only +assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky +AC_HEADER_STDBOOL. (I could find no discussion of which historical +systems had but failed the conformance test; if they ever +existed, they surely aren't relevant to that policy's goals.) + +[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies + +Reported-by: Sam James +Reviewed-by: Peter Eisentraut (master version) +Reviewed-by: Tom Lane (approach) +Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org +(cherry picked from commit bc5a4dfcf7390145dc3ba3c1c18c5ce561b778cd) +Conflicts: + configure + meson.build + src/include/pg_config.h.in + src/tools/msvc/Solution.pm +--- + configure | 182 +++++++++---------------------------- + configure.ac | 13 +-- + src/include/c.h | 2 +- + src/include/pg_config.h.in | 6 -- + src/tools/msvc/Solution.pm | 2 - + 5 files changed, 48 insertions(+), 157 deletions(-) + +diff --git a/configure b/configure +index 7e6030e9e1..7a5bdeddbd 100755 +--- a/configure ++++ b/configure +@@ -2085,116 +2085,116 @@ $as_echo "$ac_res" >&6; } + + } # ac_fn_c_check_func + +-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +-# ------------------------------------------- +-# Tests whether TYPE exists after having included INCLUDES, setting cache +-# variable VAR accordingly. +-ac_fn_c_check_type () ++# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES ++# ---------------------------------------------------- ++# Tries to find if the field MEMBER exists in type AGGR, after including ++# INCLUDES, setting cache variable VAR accordingly. ++ac_fn_c_check_member () + { + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +-$as_echo_n "checking for $2... " >&6; } +-if eval \${$3+:} false; then : ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 ++$as_echo_n "checking for $2.$3... " >&6; } ++if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 + else +- eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-$4 ++$5 + int + main () + { +-if (sizeof ($2)) +- return 0; ++static $2 ac_aggr; ++if (ac_aggr.$3) ++return 0; + ; + return 0; + } + _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : ++ eval "$4=yes" ++else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-$4 ++$5 + int + main () + { +-if (sizeof (($2))) +- return 0; ++static $2 ac_aggr; ++if (sizeof ac_aggr.$3) ++return 0; + ; + return 0; + } + _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : +- ++ eval "$4=yes" + else +- eval "$3=yes" ++ eval "$4=no" + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi +-eval ac_res=\$$3 ++eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 + $as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +-} # ac_fn_c_check_type ++} # ac_fn_c_check_member + +-# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +-# ---------------------------------------------------- +-# Tries to find if the field MEMBER exists in type AGGR, after including +-# INCLUDES, setting cache variable VAR accordingly. +-ac_fn_c_check_member () ++# ac_fn_c_check_type LINENO TYPE VAR INCLUDES ++# ------------------------------------------- ++# Tests whether TYPE exists after having included INCLUDES, setting cache ++# variable VAR accordingly. ++ac_fn_c_check_type () + { + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +-$as_echo_n "checking for $2.$3... " >&6; } +-if eval \${$4+:} false; then : ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 ++$as_echo_n "checking for $2... " >&6; } ++if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 + else ++ eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-$5 ++$4 + int + main () + { +-static $2 ac_aggr; +-if (ac_aggr.$3) +-return 0; ++if (sizeof ($2)) ++ return 0; + ; + return 0; + } + _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : +- eval "$4=yes" +-else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-$5 ++$4 + int + main () + { +-static $2 ac_aggr; +-if (sizeof ac_aggr.$3) +-return 0; ++if (sizeof (($2))) ++ return 0; + ; + return 0; + } + _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : +- eval "$4=yes" ++ + else +- eval "$4=no" ++ eval "$3=yes" + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi +-eval ac_res=\$$4 ++eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 + $as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +-} # ac_fn_c_check_member ++} # ac_fn_c_check_type + + # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES + # -------------------------------------------- +@@ -13746,100 +13746,6 @@ fi + ## Header files + ## + +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +-$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +-if ${ac_cv_header_stdbool_h+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +- #include +- #ifndef bool +- "error: bool is not defined" +- #endif +- #ifndef false +- "error: false is not defined" +- #endif +- #if false +- "error: false is not 0" +- #endif +- #ifndef true +- "error: true is not defined" +- #endif +- #if true != 1 +- "error: true is not 1" +- #endif +- #ifndef __bool_true_false_are_defined +- "error: __bool_true_false_are_defined is not defined" +- #endif +- +- struct s { _Bool s: 1; _Bool t; } s; +- +- char a[true == 1 ? 1 : -1]; +- char b[false == 0 ? 1 : -1]; +- char c[__bool_true_false_are_defined == 1 ? 1 : -1]; +- char d[(bool) 0.5 == true ? 1 : -1]; +- /* See body of main program for 'e'. */ +- char f[(_Bool) 0.0 == false ? 1 : -1]; +- char g[true]; +- char h[sizeof (_Bool)]; +- char i[sizeof s.t]; +- enum { j = false, k = true, l = false * true, m = true * 256 }; +- /* The following fails for +- HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ +- _Bool n[m]; +- char o[sizeof n == m * sizeof n[0] ? 1 : -1]; +- char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; +- /* Catch a bug in an HP-UX C compiler. See +- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html +- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html +- */ +- _Bool q = true; +- _Bool *pq = &q; +- +-int +-main () +-{ +- +- bool e = &s; +- *pq |= q; +- *pq |= ! q; +- /* Refer to every declared value, to avoid compiler optimizations. */ +- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l +- + !m + !n + !o + !p + !q + !pq); +- +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_compile "$LINENO"; then : +- ac_cv_header_stdbool_h=yes +-else +- ac_cv_header_stdbool_h=no +-fi +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +-$as_echo "$ac_cv_header_stdbool_h" >&6; } +- ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +-if test "x$ac_cv_type__Bool" = xyes; then : +- +-cat >>confdefs.h <<_ACEOF +-#define HAVE__BOOL 1 +-_ACEOF +- +- +-fi +- +- +-if test $ac_cv_header_stdbool_h = yes; then +- +-$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h +- +-fi +- +- + for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/tas.h sys/uio.h sys/un.h termios.h ucred.h wctype.h + do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +@@ -15711,9 +15617,7 @@ $as_echo_n "checking size of bool... " >&6; } + if ${ac_cv_sizeof_bool+:} false; then : + $as_echo_n "(cached) " >&6 + else +- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (bool))" "ac_cv_sizeof_bool" "#ifdef HAVE_STDBOOL_H +-#include +-#endif ++ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (bool))" "ac_cv_sizeof_bool" "#include + "; then : + + else +@@ -15739,7 +15643,7 @@ _ACEOF + + + +-if test "$ac_cv_header_stdbool_h" = yes -a "$ac_cv_sizeof_bool" = 1; then ++if test "$ac_cv_sizeof_bool" = 1; then + + $as_echo "#define PG_USE_STDBOOL 1" >>confdefs.h + +diff --git a/configure.ac b/configure.ac +index 7a75d6e37c..5484c910f6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1418,8 +1418,6 @@ AC_SUBST(UUID_LIBS) + ## Header files + ## + +-AC_HEADER_STDBOOL +- + AC_CHECK_HEADERS(m4_normalize([ + atomic.h + copyfile.h +@@ -1734,14 +1732,11 @@ if test "$ac_cv_sizeof_off_t" -lt 8 -a "$segsize" != "1"; then + AC_MSG_ERROR([Large file support is not enabled. Segment size cannot be larger than 1GB.]) + fi + +-AC_CHECK_SIZEOF([bool], [], +-[#ifdef HAVE_STDBOOL_H +-#include +-#endif]) ++AC_CHECK_SIZEOF([bool], [], [#include ]) + +-dnl We use if we have it and it declares type bool as having +-dnl size 1. Otherwise, c.h will fall back to declaring bool as unsigned char. +-if test "$ac_cv_header_stdbool_h" = yes -a "$ac_cv_sizeof_bool" = 1; then ++dnl We use if bool has size 1 after including it. Otherwise, c.h ++dnl will fall back to declaring bool as unsigned char. ++if test "$ac_cv_sizeof_bool" = 1; then + AC_DEFINE([PG_USE_STDBOOL], 1, + [Define to 1 to use to define type bool.]) + fi +diff --git a/src/include/c.h b/src/include/c.h +index dd2e3b0f3e..cc19c23fb6 100644 +--- a/src/include/c.h ++++ b/src/include/c.h +@@ -398,7 +398,7 @@ typedef void (*pg_funcptr_t) (void); + * bool + * Boolean value, either true or false. + * +- * We use stdbool.h if available and its bool has size 1. That's useful for ++ * We use stdbool.h if bool has size 1 after including it. That's useful for + * better compiler and debugger output and for compatibility with third-party + * libraries. But PostgreSQL currently cannot deal with bool of other sizes; + * there are static assertions around the code to prevent that. +diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in +index 99e3731813..d9ef9a41bf 100644 +--- a/src/include/pg_config.h.in ++++ b/src/include/pg_config.h.in +@@ -517,9 +517,6 @@ + /* Define to 1 if you have the `SSL_CTX_set_num_tickets' function. */ + #undef HAVE_SSL_CTX_SET_NUM_TICKETS + +-/* Define to 1 if stdbool.h conforms to C99. */ +-#undef HAVE_STDBOOL_H +- + /* Define to 1 if you have the header file. */ + #undef HAVE_STDINT_H + +@@ -730,9 +727,6 @@ + /* Define to 1 if the assembler supports X86_64's POPCNTQ instruction. */ + #undef HAVE_X86_64_POPCNTQ + +-/* Define to 1 if the system has the type `_Bool'. */ +-#undef HAVE__BOOL +- + /* Define to 1 if your compiler understands __builtin_bswap16. */ + #undef HAVE__BUILTIN_BSWAP16 + +diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm +index 07cc7b7ba2..f0ce2ac804 100644 +--- a/src/tools/msvc/Solution.pm ++++ b/src/tools/msvc/Solution.pm +@@ -365,7 +365,6 @@ sub GenerateFiles + HAVE_SPINLOCKS => 1, + HAVE_SSL_CTX_SET_NUM_TICKETS => undef, + HAVE_SRANDOM => undef, +- HAVE_STDBOOL_H => 1, + HAVE_STDINT_H => 1, + HAVE_STDLIB_H => 1, + HAVE_STRCHRNUL => undef, +@@ -436,7 +435,6 @@ sub GenerateFiles + HAVE_X509_GET_SIGNATURE_NID => 1, + HAVE_X509_GET_SIGNATURE_INFO => undef, + HAVE_X86_64_POPCNTQ => undef, +- HAVE__BOOL => undef, + HAVE__BUILTIN_BSWAP16 => undef, + HAVE__BUILTIN_BSWAP32 => undef, + HAVE__BUILTIN_BSWAP64 => undef, +-- +2.47.0 + diff --git a/external/postgresql/UnpackedTarball_postgresql.mk b/external/postgresql/UnpackedTarball_postgresql.mk index 11fb603ef34f..44528b78d26f 100644 --- a/external/postgresql/UnpackedTarball_postgresql.mk +++ b/external/postgresql/UnpackedTarball_postgresql.mk @@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,postgresql, \ external/postgresql/windows.patch.0 \ external/postgresql/postgresql.exit.patch.0 \ external/postgresql/postgres-msvc-build.patch.1 \ + external/postgresql/0001-Assume-that-stdbool.h-conforms-to-the-C-standard.patch.1 \ $(if $(filter WNT_AARCH64,$(OS)_$(CPUNAME)), external/postgresql/arm64.patch.1) \ )) From c9cae91d0a37051e1009730ceadf3a1ca3f239ee Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 26 Nov 2024 08:19:00 +0100 Subject: [PATCH 263/373] a11y: Drop VCLXAccessibleComponent::supportsService overrides Like the base class implementation, they call cppu::supportsService, so there's no need to override the former. Change-Id: I6550edce0567502a411cac402923c2c02e02f58d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177311 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- accessibility/inc/extended/accessibleiconchoicectrl.hxx | 1 - accessibility/inc/extended/accessiblelistbox.hxx | 1 - accessibility/source/extended/accessibleiconchoicectrl.cxx | 6 ------ accessibility/source/extended/accessiblelistbox.cxx | 6 ------ 4 files changed, 14 deletions(-) diff --git a/accessibility/inc/extended/accessibleiconchoicectrl.hxx b/accessibility/inc/extended/accessibleiconchoicectrl.hxx index 5ead84ee3466..99adb175f8e8 100644 --- a/accessibility/inc/extended/accessibleiconchoicectrl.hxx +++ b/accessibility/inc/extended/accessibleiconchoicectrl.hxx @@ -62,7 +62,6 @@ namespace accessibility // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XAccessible diff --git a/accessibility/inc/extended/accessiblelistbox.hxx b/accessibility/inc/extended/accessiblelistbox.hxx index 55112facacbc..7570bdbb5afe 100644 --- a/accessibility/inc/extended/accessiblelistbox.hxx +++ b/accessibility/inc/extended/accessiblelistbox.hxx @@ -77,7 +77,6 @@ namespace accessibility // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // XAccessible diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx index 84283e20ee2c..612ef43a105a 100644 --- a/accessibility/source/extended/accessibleiconchoicectrl.cxx +++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx @@ -25,7 +25,6 @@ #include #include #include -#include namespace accessibility @@ -130,11 +129,6 @@ namespace accessibility u"com.sun.star.awt.AccessibleIconChoiceControl"_ustr}; } - sal_Bool SAL_CALL AccessibleIconChoiceCtrl::supportsService( const OUString& _rServiceName ) - { - return cppu::supportsService(this, _rServiceName); - } - // XAccessible Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleContext( ) diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx index bcb1c9f4b87c..8bdf8e84364a 100644 --- a/accessibility/source/extended/accessiblelistbox.cxx +++ b/accessibility/source/extended/accessiblelistbox.cxx @@ -26,7 +26,6 @@ #include #include #include -#include namespace accessibility @@ -261,11 +260,6 @@ namespace accessibility u"com.sun.star.awt.AccessibleTreeListBox"_ustr}; } - sal_Bool SAL_CALL AccessibleListBox::supportsService( const OUString& _rServiceName ) - { - return cppu::supportsService(this, _rServiceName); - } - // XAccessible Reference< XAccessibleContext > SAL_CALL AccessibleListBox::getAccessibleContext( ) From c7e210919ac940ca7734ec6dd9b2ecb76ab3d4d4 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 26 Nov 2024 08:27:06 +0100 Subject: [PATCH 264/373] a11y: Create VCLXAccessibleEdit::isComboBoxChild helper It will be reused in another method in an upcoming commit. Change-Id: Ie6b4559e268d9340b5b13844c906232c6ff38a6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177312 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- .../inc/standard/vclxaccessibleedit.hxx | 1 + .../source/standard/vclxaccessibleedit.cxx | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/accessibility/inc/standard/vclxaccessibleedit.hxx b/accessibility/inc/standard/vclxaccessibleedit.hxx index 187a03264718..107ff01f54de 100644 --- a/accessibility/inc/standard/vclxaccessibleedit.hxx +++ b/accessibility/inc/standard/vclxaccessibleedit.hxx @@ -101,6 +101,7 @@ public: virtual sal_Bool SAL_CALL setText( const OUString& sText ) override; private: + bool isComboBoxChild(); bool isEditable(); }; diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index f7ce36f3187e..bc528a5c2690 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -168,15 +168,7 @@ bool VCLXAccessibleEdit::PreferFullTextInTextChangedEvent() // for a combobox subedit, the Orca screen reader announces the new/added text // so always send the whole old and new text and not just // the changed characters, so the whole entry text gets announced - Reference xParent = getAccessibleParent(); - if (xParent.is()) - { - Reference xParentContext = xParent->getAccessibleContext(); - if (xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::COMBO_BOX) - return true; - } - - return false; + return isComboBoxChild(); } // XServiceInfo @@ -616,6 +608,18 @@ sal_Bool VCLXAccessibleEdit::setText( const OUString& sText ) return bReturn; } +bool VCLXAccessibleEdit::isComboBoxChild() +{ + Reference xParent = getAccessibleParent(); + if (xParent.is()) + { + Reference xParentContext = xParent->getAccessibleContext(); + if (xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::COMBO_BOX) + return true; + } + return false; +} + bool VCLXAccessibleEdit::isEditable() { VclPtr pEdit = GetAs(); From 4622e28f8308e5bd3b4d29f91da7b25760362373 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 26 Nov 2024 08:32:16 +0100 Subject: [PATCH 265/373] a11y: Drop misleading comment The "The role is always AccessibleRole::COMBO_BOX." comment for VCLXAccessibleBox::getAccessibleRole is misleading, as the actual implementation can also return AccessibleRole::PANEL. Change-Id: I15b089e168aa7ec0701eacc8630023123f3a10dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177313 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- accessibility/inc/standard/vclxaccessiblebox.hxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/accessibility/inc/standard/vclxaccessiblebox.hxx b/accessibility/inc/standard/vclxaccessiblebox.hxx index 2d0f0b46e8f7..c2db4a0cdd63 100644 --- a/accessibility/inc/standard/vclxaccessiblebox.hxx +++ b/accessibility/inc/standard/vclxaccessiblebox.hxx @@ -67,8 +67,7 @@ public: */ css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild (sal_Int64 i) override; - /** The role is always AccessibleRole::COMBO_BOX. - */ + sal_Int16 SAL_CALL getAccessibleRole() override; // XAccessibleAction From f81af8f7a5e8f86d4214bc328c44632841fbec2b Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 26 Nov 2024 08:41:33 +0100 Subject: [PATCH 266/373] a11y: Handle combobox subedit a11y name in VCLXAccessibleEdit Let VCLXAccessibleEdit::getAccessibleName take care of returning the same accessible name as the combobox parent for the combobox subedit instead of trying to set the same name when that combobox child is requested the first time. This makes sure the name remains in sync, and prevents trying to get the combobox a11y name while a dialog containing it might still be in the process of getting constructed by VclBuilder, in which case e.g. the AccessibleRelation::LABELLED_BY relation that gets used in Window::getDefaultAccessibleName may not have been set. That relation e.g. gets set if a label has the combobox set as its "mnemonic-widget" in a .ui file. The previous logic was triggering an assert when opening the "Fonts" page in the "Tools" -> "Options" dialog or using the search feature in that dialog on Windows with an AT (like NVDA) active when trying to set the a11y name of the "font2" combobox's entry (UI file: cui/uiconfig/ui/optfontspage.ui): Assertion failed: GetChildCount() == 4 || pWindowImpl->mbInDispose, file .../vcl/source/window/layout.cxx, line 1945 Backtrace: 1 abort ucrtbase 0x7ffad46e286e 2 get_wpgmptr ucrtbase 0x7ffad46e426e 3 get_wpgmptr ucrtbase 0x7ffad46e4165 4 wassert ucrtbase 0x7ffad46e44f1 5 VclScrolledWindow::get_child layout.cxx 1945 0x7ffa88f67e35 6 nextLogicalChildOfParent dialog.cxx 139 0x7ffa88f147cf 7 nextLogicalChildOfParent dialog.cxx 157 0x7ffa88f14884 8 nextLogicalChildOfParent dialog.cxx 157 0x7ffa88f14884 9 ImplGetSubChildWindow dlgctrl.cxx 137 0x7ffa88f197e1 10 ImplGetChildWindow dlgctrl.cxx 151 0x7ffa88f18dae 11 ImplGetNextWindow dlgctrl.cxx 180 0x7ffa88f19600 12 ImplFindDlgCtrlWindow dlgctrl.cxx 362 0x7ffa88f18a2b 13 vcl::ImplGetLabeledBy legacyaccessibility.cxx 122 0x7ffa88e65437 14 vcl::Window::getLegacyNonLayoutAccessibleRelationLabeledBy legacyaccessibility.cxx 178 0x7ffa88e657ac 15 vcl::Window::GetAccessibleRelationLabeledBy accessibility.cxx 604 0x7ffa88e6193a 16 vcl::Window::getDefaultAccessibleName accessibility.cxx 470 0x7ffa88e63c73 17 vcl::Window::GetAccessibleName accessibility.cxx 441 0x7ffa88e614ba 18 vcl::Window::SetAccessibleName accessibility.cxx 427 0x7ffa88e623bc 19 VCLXAccessibleBox::getAccessibleChild vclxaccessiblebox.cxx 319 0x7ffa853e3e02 20 AccObjectWinManager::InsertChildrenAccObj AccObjectWinManager.cxx 536 0x7ffa855b2ed1 21 AccEventListener::HandleChildChangedEvent AccEventListener.cxx 109 0x7ffa855b9593 22 AccEventListener::notifyEvent AccEventListener.cxx 64 0x7ffa855ba6ef 23 AccContainerEventListener::notifyEvent AccContainerEventListener.cxx 95 0x7ffa855bdfbc 24 comphelper::AccessibleEventNotifier::addEvent accessibleeventnotifier.cxx 256 0x7ffa916598c0 25 comphelper::OCommonAccessibleComponent::NotifyAccessibleEvent accessiblecomponenthelper.cxx 127 0x7ffa9165071e 26 VCLXAccessibleComponent::ProcessWindowChildEvent vclxaccessiblecomponent.cxx 165 0x7ffa8b7e6029 27 VCLXAccessibleComponent::WindowChildEventListener vclxaccessiblecomponent.cxx 124 0x7ffa8b7e6d62 28 VCLXAccessibleComponent::LinkStubWindowChildEventListener vclxaccessiblecomponent.cxx 114 0x7ffa8b7e5ee6 29 Link::Call link.hxx 111 0x7ffa88f3bf43 30 vcl::Window::CallEventListeners event.cxx 300 0x7ffa88f3c57c 31 vcl::Window::ImplSetReallyVisible window.cxx 1331 0x7ffa8904394d 32 vcl::Window::ImplSetReallyVisible window.cxx 1344 0x7ffa89043a1d 33 vcl::Window::Show window.cxx 2336 0x7ffa89047671 34 vcl::Window::Show window.cxx 2349 0x7ffa8904776e 35 vcl::Window::set_property window2.cxx 1537 0x7ffa8902d4b3 36 ComboBox::set_property combobox.cxx 1553 0x7ffa89097521 37 BuilderUtils::set_properties builder.cxx 2192 0x7ffa88ef13c5 38 VclBuilder::insertObject builder.cxx 2469 0x7ffa88ee18df 39 WidgetBuilder,PopupMenu,VclPtr>::handleObject widgetbuilder.hxx 230 0x7ffa88e23d54 40 WidgetBuilder,PopupMenu,VclPtr>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 41 WidgetBuilder,PopupMenu,VclPtr>::handleObject widgetbuilder.hxx 234 0x7ffa88e23dff 42 WidgetBuilder,PopupMenu,VclPtr>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 43 WidgetBuilder,PopupMenu,VclPtr>::handleObject widgetbuilder.hxx 234 0x7ffa88e23dff 44 WidgetBuilder,PopupMenu,VclPtr>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 45 WidgetBuilder,PopupMenu,VclPtr>::handleObject widgetbuilder.hxx 234 0x7ffa88e23dff 46 WidgetBuilder,PopupMenu,VclPtr>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 47 WidgetBuilder,PopupMenu,VclPtr>::handleObject widgetbuilder.hxx 234 0x7ffa88e23dff 48 WidgetBuilder,PopupMenu,VclPtr>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 49 WidgetBuilder,PopupMenu,VclPtr>::processUIFile widgetbuilder.hxx 70 0x7ffa88e24b4a 50 VclBuilder::VclBuilder builder.cxx 523 0x7ffa88ea53be 51 SalInstanceBuilder::SalInstanceBuilder salvtables.cxx 7088 0x7ffa895da3ff 52 std::make_unique memory 3434 0x7ffa895d44c8 53 SalInstance::CreateBuilder salvtables.cxx 7470 0x7ffa895ef18e 54 Application::CreateBuilder builder.cxx 198 0x7ffa88ebed2a 55 BuilderPage::BuilderPage weldutils.cxx 28 0x7ffa89684128 56 SfxTabPage::SfxTabPage tabdlg.cxx 137 0x7ffa8cd5f0e5 57 SvxFontSubstTabPage::SvxFontSubstTabPage fontsubs.cxx 36 0x7ffa8372d1cd 58 std::make_unique memory 3434 0x7ffa8372cdbf 59 SvxFontSubstTabPage::Create fontsubs.cxx 146 0x7ffa8372f692 60 CreateGeneralTabPage treeopt.cxx 289 0x7ffa8383199a 61 OfaTreeOptionsDialog::SelectHdl_Impl treeopt.cxx 1317 0x7ffa838372e7 62 OfaTreeOptionsDialog::ShowPageHdl_Impl treeopt.cxx 623 0x7ffa83837f11 63 OfaTreeOptionsDialog::LinkStubShowPageHdl_Impl treeopt.cxx 620 0x7ffa83834366 64 Link::Call link.hxx 111 0x7ffa88ebdf13 65 weld::TreeView::signal_changed weld.hxx 969 0x7ffa88ef210f 66 SalInstanceTreeView::SelectHdl salvtables.cxx 5304 0x7ffa895f4b39 67 SalInstanceTreeView::LinkStubSelectHdl salvtables.cxx 5299 0x7ffa895f38c6 68 Link::Call link.hxx 111 0x7ffa88ebe413 69 SvTreeListBox::SelectHdl treelistbox.cxx 454 0x7ffa892ba7a1 70 SvTreeListBox::Select treelistbox.cxx 2128 0x7ffa892ba514 71 SvImpLBox::SetCursor svimpbox.cxx 617 0x7ffa892d05e8 72 ImpLBSelEng::SetCursorAtPoint svimpbox.cxx 2596 0x7ffa892d08a9 73 SelectionEngine::SelMouseButtonDown seleng.cxx 174 0x7ffa88fd0071 74 SvImpLBox::MouseButtonDown svimpbox.cxx 2016 0x7ffa892cc580 75 SvTreeListBox::MouseButtonDown treelistbox.cxx 2277 0x7ffa892b71e2 76 ImplHandleMouseEvent winproc.cxx 708 0x7ffa89059867 77 ImplHandleSalMouseButtonDown winproc.cxx 2338 0x7ffa8905afef 78 ImplWindowFrameProc winproc.cxx 2683 0x7ffa8905ca47 79 SalFrame::CallCallback salframe.hxx 312 0x7ffa88e1ee56 80 ImplHandleMouseMsg salframe.cxx 3335 0x7ffa85c270bf 81 SalFrameWndProc salframe.cxx 5987 0x7ffa85c2de7d 82 SalFrameWndProcW salframe.cxx 6342 0x7ffa85c2ec60 83 CallWindowProcW USER32 0x7ffad61cef5c 84 DispatchMessageW USER32 0x7ffad61ce684 85 ImplSalDispatchMessage salinst.cxx 475 0x7ffa85b8cf98 86 ImplSalYield salinst.cxx 552 0x7ffa85b8d6bd 87 WinSalInstance::DoYield salinst.cxx 581 0x7ffa85b8cc61 88 ImplYield svapp.cxx 385 0x7ffa89656364 89 Application::Yield svapp.cxx 474 0x7ffa89659fe2 90 Dialog::Execute dialog.cxx 1077 0x7ffa88f0c017 91 SalInstanceDialog::run salvtables.cxx 1882 0x7ffa896149af 92 weld::DialogController::run weld.hxx 2691 0x7ffa88eef436 93 OfaTreeOptionsDialog::run treeopt.cxx 2514 0x7ffa83841dd2 94 CuiAbstractController_Impl::Execute dlgfact.cxx 144 0x7ffa837085c8 95 SfxApplication::OfaExec_Impl appserv.cxx 1641 0x7ffa8cb36506 96 SfxStubSfxApplicationOfaExec_Impl sfxslots.hxx 1307 0x7ffa8cb10165 97 SfxDispatcher::Call_Impl dispatch.cxx 257 0x7ffa8cc1f4ae 98 SfxDispatcher::Execute_ dispatch.cxx 754 0x7ffa8cc2260f 99 SfxBindings::Execute_Impl bindings.cxx 1062 0x7ffa8cc0086d 100 SfxDispatchController_Impl::dispatch unoctitm.cxx 736 0x7ffa8cc93caa 101 SfxOfficeDispatch::dispatch unoctitm.cxx 254 0x7ffa8cc945b0 102 framework::MenuBarManager::Select menubarmanager.cxx 821 0x7ffa8d8574d4 103 framework::MenuBarManager::LinkStubSelect menubarmanager.cxx 776 0x7ffa8d855796 104 Link

    ::Call link.hxx 111 0x7ffa88f77d88 105 Menu::Select menu.cxx 360 0x7ffa88f83e19 106 Menu::ImplCallSelect menu.cxx 2152 0x7ffa88f7c761 107 Menu::LinkStubImplCallSelect menu.cxx 2148 0x7ffa88f82366 108 Link::Call link.hxx 111 0x7ffa890529b3 109 ImplHandleUserEvent winproc.cxx 2288 0x7ffa8905ba97 110 ImplWindowFrameProc winproc.cxx 2850 0x7ffa8905d256 111 SalFrame::CallCallback salframe.hxx 312 0x7ffa88e1ee56 112 ImplHandleUserEvent salframe.cxx 4471 0x7ffa85c28fab 113 SalFrameWndProc salframe.cxx 6236 0x7ffa85c2e654 114 SalFrameWndProcW salframe.cxx 6342 0x7ffa85c2ec60 115 CallWindowProcW USER32 0x7ffad61cef5c 116 DispatchMessageW USER32 0x7ffad61ce684 117 ImplSalDispatchMessage salinst.cxx 475 0x7ffa85b8cf98 118 ImplSalYield salinst.cxx 506 0x7ffa85b8d09b 119 WinSalInstance::DoYield salinst.cxx 581 0x7ffa85b8cc61 120 ImplYield svapp.cxx 385 0x7ffa89656364 121 Application::Yield svapp.cxx 474 0x7ffa89659fe2 122 Application::Execute svapp.cxx 361 0x7ffa89653aa6 123 desktop::Desktop::Main app.cxx 1679 0x7ffa9336887f 124 ImplSVMain svmain.cxx 228 0x7ffa8966b310 125 SVMain svmain.cxx 247 0x7ffa8966baf2 126 soffice_main sofficemain.cxx 121 0x7ffa933b86f4 127 sal_main main.c 51 0x7ff64a491013 128 main main.c 49 0x7ff64a49105a 129 __scrt_common_main_seh exe_common.inl 288 0x7ff64a491344 130 BaseThreadInitThunk KERNEL32 0x7ffad5c07374 131 RtlUserThreadStart ntdll 0x7ffad679cc91 Change-Id: I3be8a8e4acd1c87fdfa495c755fd947e9a11b9aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177314 Reviewed-by: Michael Weghorn Tested-by: Jenkins Reviewed-by: Mike Kaganski --- accessibility/inc/standard/vclxaccessibleedit.hxx | 1 + accessibility/source/standard/vclxaccessiblebox.cxx | 6 +----- accessibility/source/standard/vclxaccessibleedit.cxx | 10 ++++++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/accessibility/inc/standard/vclxaccessibleedit.hxx b/accessibility/inc/standard/vclxaccessibleedit.hxx index 107ff01f54de..e5d810ccc016 100644 --- a/accessibility/inc/standard/vclxaccessibleedit.hxx +++ b/accessibility/inc/standard/vclxaccessibleedit.hxx @@ -63,6 +63,7 @@ public: // XAccessibleContext virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; + virtual OUString SAL_CALL getAccessibleName() override; virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; // XAccessibleAction diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx index cee19613a396..9e8569ce0826 100644 --- a/accessibility/source/standard/vclxaccessiblebox.cxx +++ b/accessibility/source/standard/vclxaccessiblebox.cxx @@ -313,12 +313,8 @@ Reference SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int64 if (m_aBoxType==COMBOBOX) { VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); - if (pComboBox!=nullptr && pComboBox->GetSubEdit()!=nullptr) - //Set the edit's acc name the same as parent - { - pComboBox->GetSubEdit()->SetAccessibleName(getAccessibleName()); + if (pComboBox && pComboBox->GetSubEdit()) m_xText = pComboBox->GetSubEdit()->GetAccessible(); - } } else if (m_bIsDropDownBox) m_xText = new VCLXAccessibleTextField (GetVCLXWindow(),this); diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index bc528a5c2690..73298a4ff255 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -202,6 +202,16 @@ Reference< XAccessible > VCLXAccessibleEdit::getAccessibleChild( sal_Int64 ) throw IndexOutOfBoundsException(); } +OUString VCLXAccessibleEdit::getAccessibleName() +{ + OExternalLockGuard aGuard(this); + + // for combobox edit, return name of the parent + if (isComboBoxChild()) + return getAccessibleParent()->getAccessibleContext()->getAccessibleName(); + + return VCLXAccessibleTextComponent::getAccessibleName(); +} sal_Int16 VCLXAccessibleEdit::getAccessibleRole( ) { From f395e6599facba41392eac3d646a0d505868e6fa Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Tue, 19 Nov 2024 18:04:04 +0100 Subject: [PATCH 267/373] Resolves tdf#163685 - Save user-defined formula Change-Id: I88a1c40d3e97d77c289c8b670b52dca50dea126f Co-authored-by: Rafael Lima Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176788 Reviewed-by: Rafael Lima Tested-by: Jenkins --- include/svl/hint.hxx | 1 + .../org/openoffice/Office/UI/MathCommands.xcu | 8 ++ .../schema/org/openoffice/Office/Math.xcs | 15 ++++ starmath/inc/ElementsDockingWindow.hxx | 12 ++- starmath/inc/cfgitem.hxx | 7 ++ starmath/inc/starmath.hrc | 1 + starmath/inc/strings.hrc | 3 + starmath/sdi/smath.sdi | 17 ++++ starmath/sdi/smslots.sdi | 5 ++ starmath/source/ElementsDockingWindow.cxx | 87 ++++++++++++++----- starmath/source/SmElementsPanel.cxx | 22 ++++- starmath/source/SmElementsPanel.hxx | 6 +- starmath/source/cfgitem.cxx | 44 +++++++++- starmath/source/view.cxx | 38 ++++++++ starmath/uiconfig/smath/menubar/menubar.xml | 1 + starmath/uiconfig/smath/popupmenu/edit.xml | 1 + .../uiconfig/smath/ui/sidebarelements_math.ui | 12 +++ 17 files changed, 253 insertions(+), 27 deletions(-) diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 7fb28c5588de..894bdeec6786 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -156,6 +156,7 @@ enum class SfxHintId { // STARMATH MathFormatChanged, + SmNewUserFormula, // Sw SwDrawViewsCreated, diff --git a/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu index b8bade9b3e4f..f760d782e23b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu @@ -161,6 +161,14 @@ Gap + + + Save as User-defined Formula + + + 1 + + diff --git a/officecfg/registry/schema/org/openoffice/Office/Math.xcs b/officecfg/registry/schema/org/openoffice/Office/Math.xcs index b7eb0f358df8..83563268a64d 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Math.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Math.xcs @@ -216,6 +216,16 @@ + + + Contains user-defined formulas. + + + + Specifies the formula. + + + @@ -1036,5 +1046,10 @@ Lists the defined symbols. + + + List of user-defined formulas. + + diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 971c2f3b6fb2..2e48afd10fdf 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -42,9 +42,12 @@ class SmElementsControl SmFormat maFormat; int mnCurrentSetIndex; sal_Int16 m_nSmSyntaxVersion; + bool m_bAllowDelete; + OUString m_sHoveredItem; std::vector> maItemDatas; std::unique_ptr mpIconView; + std::unique_ptr mxPopup; Link maSelectHdlLink; @@ -55,22 +58,27 @@ class SmElementsControl DECL_LINK(QueryTooltipHandler, const weld::TreeIter&, OUString); DECL_LINK(ElementActivatedHandler, weld::IconView&, bool); + DECL_LINK(MousePressHdl, const MouseEvent&, bool); static OUString GetElementSource(const OUString& itemId); static OUString GetElementHelpText(const OUString& itemId); + static int GetElementPos(const OUString& itemId); public: - explicit SmElementsControl(std::unique_ptr pIconView); + explicit SmElementsControl(std::unique_ptr pIconView, + std::unique_ptr pMenu); ~SmElementsControl(); static const std::vector& categories(); - void setElementSetIndex(int nSetIndex); + void setElementSetIndex(int nSetIndex, bool bForceBuild = false); void setSmSyntaxVersion(sal_Int16 nSmSyntaxVersion); void SetSelectHdl(const Link& rLink) { maSelectHdlLink = rLink; } + void SetAllowDelete(bool bAllow) { m_bAllowDelete = bAllow; } + static Color GetTextColor(); static Color GetControlBackground(); }; diff --git a/starmath/inc/cfgitem.hxx b/starmath/inc/cfgitem.hxx index 08a6e834f1fd..dbd477de9e7a 100644 --- a/starmath/inc/cfgitem.hxx +++ b/starmath/inc/cfgitem.hxx @@ -100,6 +100,7 @@ class SmMathConfig final : public utl::ConfigItem, public SfxBroadcaster std::unique_ptr pOther; std::unique_ptr pFontFormatList; std::unique_ptr pSymbolMgr; + css::uno::Sequence m_sUserDefinedNames; bool bIsOtherModified; bool bIsFormatModified; SmFontPickList vFontPickList[8]; @@ -169,6 +170,12 @@ public: const SmFormat& GetStandardFormat() const; void SetStandardFormat(const SmFormat& rFormat, bool bSaveFontFormatList = false); + css::uno::Sequence LoadUserDefinedNames(); + void GetUserDefinedFormula(std::u16string_view sName, OUString& sFormula); + bool HasUserDefinedFormula(std::u16string_view sName); + void SaveUserDefinedFormula(std::u16string_view sName, const OUString& sElement); + void DeleteUserDefinedFormula(std::u16string_view sName); + bool IsPrintTitle() const; void SetPrintTitle(bool bVal); bool IsPrintFormulaText() const; diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 1127e6660cbd..468fd444cbfa 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -74,5 +74,6 @@ class SfxUInt16Item; #define SID_SMEDITWINDOWZOOM TypedWhichId(SID_SMA_START + 129) #define SID_DEFAULT_SM_SYNTAX_VERSION TypedWhichId(SID_SMA_START + 130) #define SID_INLINE_EDIT_ENABLE TypedWhichId(SID_SMA_START + 131) +#define SID_SAVE_FORMULA (SID_SMA_START + 132) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index 4afb0d2598e6..8f891439e5ab 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -324,6 +324,7 @@ #define RID_CATEGORY_FORMATS NC_("RID_CATEGORY_FORMATS", "Formats" ) #define RID_CATEGORY_OTHERS NC_("RID_CATEGORY_OTHERS", "Others" ) #define RID_CATEGORY_EXAMPLES NC_("RID_CATEGORY_EXAMPLES", "Examples" ) +#define RID_CATEGORY_USERDEFINED NC_("RID_CATEGORY_USERDEFINED", "User-defined" ) #define RID_EXAMPLE_CIRCUMFERENCE_HELP NC_("RID_EXAMPLE_CIRCUMFERENCE_HELP", "Circumference" ) #define RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP NC_("RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP", "Mass–energy equivalence" ) @@ -406,6 +407,8 @@ #define RID_PRINTUIOPT_ORIGSIZE NC_("RID_PRINTUIOPT_ORIGSIZE", "O~riginal size" ) #define RID_PRINTUIOPT_FITTOPAGE NC_("RID_PRINTUIOPT_FITTOPAGE", "Fit to ~page" ) #define RID_PRINTUIOPT_SCALING NC_("RID_PRINTUIOPT_SCALING", "~Scaling" ) +#define STR_USER_DEFINED_FORMULA NC_("STR_USER_DEFINED_FORMULA", "Save formula as:" ) +#define STR_USER_DEFINED_FORMULA_EXISTS NC_("STR_USER_DEFINED_FORMULA_EXISTS", "The Formula %1 exists.\nDo you want to overwrite?" ) // clang-format on /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi index 48045629ecd7..f1578010d0a1 100644 --- a/starmath/sdi/smath.sdi +++ b/starmath/sdi/smath.sdi @@ -562,3 +562,20 @@ SfxVoidItem ZoomOut SID_ZOOMOUT ToolBoxConfig = TRUE, GroupId = SfxGroupId::View; ] + +SfxVoidItem SaveFormula SID_SAVE_FORMULA +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::View; +] \ No newline at end of file diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi index 2cf17fa342f4..0c3db53704ea 100644 --- a/starmath/sdi/smslots.sdi +++ b/starmath/sdi/smslots.sdi @@ -297,6 +297,11 @@ interface FormulaView ExecMethod = Execute ; StateMethod = GetState ; ] + SID_SAVE_FORMULA + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] } shell SmViewShell diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 351e4773b6bc..f202d1bd74e0 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -460,6 +460,7 @@ const std::vector s_a5Categories{ RID_CATEGORY_FORMATS, RID_CATEGORY_OTHERS, RID_CATEGORY_EXAMPLES, + RID_CATEGORY_USERDEFINED, }; template @@ -493,24 +494,30 @@ struct ElementData { OUString maElementSource; OUString maHelpText; - ElementData(const OUString& aElementSource, const OUString& aHelpText) + int maPos; + ElementData(const OUString& aElementSource, const OUString& aHelpText, const int& aPos) : maElementSource(aElementSource) , maHelpText(aHelpText) + , maPos(aPos) { } }; -SmElementsControl::SmElementsControl(std::unique_ptr pIconView) +SmElementsControl::SmElementsControl(std::unique_ptr pIconView, + std::unique_ptr pMenu) : mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT)) , mnCurrentSetIndex(-1) , m_nSmSyntaxVersion(SmModule::get()->GetConfig()->GetDefaultSmSyntaxVersion()) + , m_bAllowDelete(false) , mpIconView(std::move(pIconView)) + , mxPopup(std::move(pMenu)) { maParser.reset(starmathdatabase::GetVersionSmParser(m_nSmSyntaxVersion)); maParser->SetImportSymbolNames(true); mpIconView->connect_query_tooltip(LINK(this, SmElementsControl, QueryTooltipHandler)); mpIconView->connect_item_activated(LINK(this, SmElementsControl, ElementActivatedHandler)); + mpIconView->connect_mouse_press(LINK(this, SmElementsControl, MousePressHdl)); } SmElementsControl::~SmElementsControl() @@ -585,7 +592,7 @@ void SmElementsControl::addElement(const OUString& aElementVisual, const OUStrin pDevice->SetOutputSizePixel(aSize); SmDrawingVisitor(*pDevice, pDevice->PixelToLogic(Point(5, 0)), pNode.get(), maFormat); - maItemDatas.push_back(std::make_unique(aElementSource, aHelpText)); + maItemDatas.push_back(std::make_unique(aElementSource, aHelpText, maItemDatas.size())); const OUString aId(weld::toId(maItemDatas.back().get())); mpIconView->insert(-1, nullptr, &aId, pDevice, nullptr); if (mpIconView->get_item_width() < aSize.Width()) @@ -602,9 +609,14 @@ OUString SmElementsControl::GetElementHelpText(const OUString& itemId) return weld::fromId(itemId)->maHelpText; } -void SmElementsControl::setElementSetIndex(int nSetIndex) +int SmElementsControl::GetElementPos(const OUString& itemId) { - if (mnCurrentSetIndex == nSetIndex) + return weld::fromId(itemId)->maPos; +} + +void SmElementsControl::setElementSetIndex(int nSetIndex, bool bForceBuild) +{ + if (!bForceBuild && mnCurrentSetIndex == nSetIndex) return; mnCurrentSetIndex = nSetIndex; build(); @@ -617,25 +629,36 @@ void SmElementsControl::addElements(int nCategory) mpIconView->set_item_width(0); maItemDatas.clear(); - assert(nCategory >= 0 && o3tl::make_unsigned(nCategory) < s_a5CategoryDescriptions.size()); - - const auto& [aElementsArray, aElementsArraySize] = s_a5CategoryDescriptions[nCategory]; - - for (size_t i = 0; i < aElementsArraySize; i++) + if (o3tl::make_unsigned(nCategory) < s_a5CategoryDescriptions.size()) { - const auto& [element, elementHelp, elementVisual, visualTranslatable] = aElementsArray[i]; - if (element.empty()) + const auto& [aElementsArray, aElementsArraySize] = s_a5CategoryDescriptions[nCategory]; + + for (size_t i = 0; i < aElementsArraySize; i++) { - mpIconView->append_separator({}); + const auto& [element, elementHelp, elementVisual, visualTranslatable] = aElementsArray[i]; + if (element.empty()) + { + mpIconView->append_separator({}); + } + else + { + OUString aElement(element); + OUString aVisual(elementVisual.empty() ? aElement : OUString(elementVisual)); + if (visualTranslatable) + aVisual = aVisual.replaceFirst("$1", SmResId(visualTranslatable)); + OUString aHelp(elementHelp ? SmResId(elementHelp) : OUString()); + addElement(aVisual, aElement, aHelp); + } } - else + } + else + { + css::uno::Sequence sNames = SmModule::get()->GetConfig()->LoadUserDefinedNames(); + OUString sFormula; + for (int i = 0; i < sNames.getLength(); i++) { - OUString aElement(element); - OUString aVisual(elementVisual.empty() ? aElement : OUString(elementVisual)); - if (visualTranslatable) - aVisual = aVisual.replaceFirst("$1", SmResId(visualTranslatable)); - OUString aHelp(elementHelp ? SmResId(elementHelp) : OUString()); - addElement(aVisual, aElement, aHelp); + SmModule::get()->GetConfig()->GetUserDefinedFormula(sNames[i], sFormula); + addElement(sFormula, sFormula, sNames[i]); } } @@ -649,6 +672,7 @@ void SmElementsControl::build() { case 5: addElements(mnCurrentSetIndex); + m_sHoveredItem = "nil"; // if list is empty we must not use the previously hovered item break; case 6: default: @@ -671,7 +695,10 @@ void SmElementsControl::setSmSyntaxVersion(sal_Int16 nSmSyntaxVersion) IMPL_LINK(SmElementsControl, QueryTooltipHandler, const weld::TreeIter&, iter, OUString) { if (const OUString id = mpIconView->get_id(iter); !id.isEmpty()) + { + m_sHoveredItem = id; return GetElementHelpText(id); + } return {}; } @@ -684,4 +711,24 @@ IMPL_LINK_NOARG(SmElementsControl, ElementActivatedHandler, weld::IconView&, boo return true; } +IMPL_LINK(SmElementsControl, MousePressHdl, const MouseEvent&, rEvt, bool) +{ + if (rEvt.IsRight() && m_bAllowDelete && (m_sHoveredItem != "nil")) + { + mpIconView->select( GetElementPos(m_sHoveredItem) ); + OUString sElementId = mpIconView->get_selected_id(); + if (!sElementId.isEmpty()) + { + OUString sResponse = mxPopup->popup_at_rect( + mpIconView.get(), tools::Rectangle(rEvt.GetPosPixel(), Size(1, 1))); + if (sResponse == "delete") + { + SmModule::get()->GetConfig()->DeleteUserDefinedFormula( GetElementHelpText(m_sHoveredItem) ); + build(); //refresh view + } + mpIconView->unselect_all(); + } + } + return true; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/SmElementsPanel.cxx b/starmath/source/SmElementsPanel.cxx index ad0fb7089890..afe27a80fc50 100644 --- a/starmath/source/SmElementsPanel.cxx +++ b/starmath/source/SmElementsPanel.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include "SmElementsPanel.hxx" #include @@ -45,8 +46,8 @@ SmElementsPanel::SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBind u"modules/smath/ui/sidebarelements_math.ui"_ustr) , mrBindings(rBindings) , mxCategoryList(m_xBuilder->weld_combo_box(u"categorylist"_ustr)) - , mxElementsControl( - std::make_unique(m_xBuilder->weld_icon_view(u"elements"_ustr))) + , mxElementsControl(std::make_unique( + m_xBuilder->weld_icon_view(u"elements"_ustr), m_xBuilder->weld_menu("deletemenu"))) { for (const auto& rCategoryId : SmElementsControl::categories()) mxCategoryList->append_text(SmResId(rCategoryId)); @@ -58,6 +59,8 @@ SmElementsPanel::SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBind mxElementsControl->setElementSetIndex(0); mxElementsControl->SetSelectHdl(LINK(this, SmElementsPanel, ElementClickHandler)); + + StartListening(*GetView()); } SmElementsPanel::~SmElementsPanel() @@ -66,6 +69,15 @@ SmElementsPanel::~SmElementsPanel() mxCategoryList.reset(); } +void SmElementsPanel::Notify(SfxBroadcaster&, const SfxHint& rHint) +{ + if (rHint.GetId() == SfxHintId::SmNewUserFormula) + { + mxCategoryList->set_active_text(SmResId(RID_CATEGORY_USERDEFINED)); + mxElementsControl->setElementSetIndex(mxCategoryList->get_active(), true); + } +} + IMPL_LINK(SmElementsPanel, CategorySelectedHandle, weld::ComboBox&, rList, void) { const int nActive = rList.get_active(); @@ -74,6 +86,12 @@ IMPL_LINK(SmElementsPanel, CategorySelectedHandle, weld::ComboBox&, rList, void) mxElementsControl->setElementSetIndex(nActive); if (SmViewShell* pViewSh = GetView()) mxElementsControl->setSmSyntaxVersion(pViewSh->GetDoc()->GetSmSyntaxVersion()); + + // If the "User-defined" category is selected, allow deletion + if (mxCategoryList->get_active_text() == SmResId(RID_CATEGORY_USERDEFINED)) + mxElementsControl->SetAllowDelete(true); + else + mxElementsControl->SetAllowDelete(false); } IMPL_LINK(SmElementsPanel, ElementClickHandler, const OUString&, ElementSource, void) diff --git a/starmath/source/SmElementsPanel.hxx b/starmath/source/SmElementsPanel.hxx index c3dde01c6724..c1f4b2ab31f3 100644 --- a/starmath/source/SmElementsPanel.hxx +++ b/starmath/source/SmElementsPanel.hxx @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -32,10 +33,13 @@ namespace sm::sidebar { -class SmElementsPanel : public PanelLayout +class SmElementsPanel : public PanelLayout, public SfxListener { public: static std::unique_ptr Create(weld::Widget& rParent, const SfxBindings& rBindings); + + void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); + SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBindings); ~SmElementsPanel(); diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 78cdbc97e131..6f0134047d07 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -44,6 +44,7 @@ using namespace com::sun::star::beans; constexpr OUString SYMBOL_LIST = u"SymbolList"_ustr; constexpr OUString FONT_FORMAT_LIST = u"FontFormatList"_ustr; +constexpr OUString USER_DEFINED_LIST = u"User-Defined"_ustr; static Sequence< OUString > lcl_GetFontPropertyNames() { @@ -575,7 +576,6 @@ void SmMathConfig::SetSymbols( const std::vector< SmSym > &rNewSymbols ) StripFontFormatList( rNewSymbols ); } - SmFontFormatList & SmMathConfig::GetFontFormatList() { if (!pFontFormatList) @@ -585,7 +585,6 @@ SmFontFormatList & SmMathConfig::GetFontFormatList() return *pFontFormatList; } - void SmMathConfig::LoadFontFormatList() { if (!pFontFormatList) @@ -661,6 +660,47 @@ void SmMathConfig::ReadFontFormat( SmFontFormat &rFontFormat, OSL_ENSURE( bOK, "read FontFormat failed" ); } +css::uno::Sequence SmMathConfig::LoadUserDefinedNames() +{ + m_sUserDefinedNames = GetNodeNames(USER_DEFINED_LIST); + return m_sUserDefinedNames; +} + +void SmMathConfig::GetUserDefinedFormula(std::u16string_view sName, OUString &sFormula) +{ + css::uno::Sequence aNames(1); + OUString* pName = aNames.getArray(); + pName[0] = USER_DEFINED_LIST + "/" + sName + "/FormulaText"; + const Sequence aValues(GetProperties(aNames)); + const Any* pValues = aValues.getConstArray(); + const Any* pVal = pValues; + *pVal >>= sFormula; +} + +bool SmMathConfig::HasUserDefinedFormula(std::u16string_view sName) +{ + for (int i = 0; i < m_sUserDefinedNames.getLength(); i++) + if (m_sUserDefinedNames[i] == sName) + return true; + return false; +} + +void SmMathConfig::SaveUserDefinedFormula(std::u16string_view sName, const OUString& sElement) +{ + Sequence pValues(1); + auto pArgs = pValues.getArray(); + + pArgs[0].Name = USER_DEFINED_LIST + "/" + sName + "/FormulaText"; + pArgs[0].Value <<= sElement; + + SetSetProperties( USER_DEFINED_LIST, pValues ); +} + +void SmMathConfig::DeleteUserDefinedFormula(std::u16string_view sName) +{ + Sequence aElements { OUString(sName) }; + ClearNodeElements(USER_DEFINED_LIST, aElements); +} void SmMathConfig::SaveFontFormatList() { diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index f1130e5701de..da074984964d 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -89,6 +89,7 @@ #include #include #include "accessibility.hxx" +#include #include #include @@ -1840,6 +1841,39 @@ void SmViewShell::Execute(SfxRequest& rReq) GetViewFrame().GetBindings().Invalidate(bRTL ? SID_ATTR_PARA_LEFT_TO_RIGHT : SID_ATTR_PARA_RIGHT_TO_LEFT); } break; + case SID_SAVE_FORMULA: + { + OUString aName = "My Formula 1"; + OUString aDesc(SmResId(STR_USER_DEFINED_FORMULA)); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + ScopedVclPtr pDlg( + pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + + if (pDlg->Execute() == RET_OK) + { + aName = pDlg->GetName(); + if (SmModule::get()->GetConfig()->HasUserDefinedFormula(aName)) + { + std::unique_ptr xQuery(Application::CreateMessageDialog( + GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, + SmResId(STR_USER_DEFINED_FORMULA_EXISTS).replaceAll("%1", aName))); + if (xQuery->run() == RET_NO) + break; + } + SmEditWindow* pEditWin = GetEditWindow(); + SmModule::get()->GetConfig()->SaveUserDefinedFormula(aName, pEditWin->GetText()); + + // Show the Elements sidebar with the "User-defined" entry selected + GetViewFrame().ShowChildWindow(SID_SIDEBAR); + sfx2::sidebar::Sidebar::ShowPanel(u"MathElementsPanel", + GetViewFrame().GetFrame().GetFrameInterface()); + GetViewFrame().GetBindings().Invalidate( SID_ELEMENTSDOCKINGWINDOW ); + Broadcast(SfxHint(SfxHintId::SmNewUserFormula)); + rReq.Ignore (); + } + pDlg.disposeAndClear(); + } + break; } rReq.Done(); } @@ -1949,6 +1983,10 @@ void SmViewShell::GetState(SfxItemSet &rSet) case SID_ATTR_PARA_RIGHT_TO_LEFT: rSet.Put(SfxBoolItem(nWh, GetDoc()->GetFormat().IsRightToLeft())); break; + case SID_SAVE_FORMULA: + if (!pEditWin || pEditWin->IsEmpty()) + rSet.DisableItem(nWh); + break; } } } diff --git a/starmath/uiconfig/smath/menubar/menubar.xml b/starmath/uiconfig/smath/menubar/menubar.xml index 903ba7189664..74b478aaf3b0 100644 --- a/starmath/uiconfig/smath/menubar/menubar.xml +++ b/starmath/uiconfig/smath/menubar/menubar.xml @@ -125,6 +125,7 @@ + diff --git a/starmath/uiconfig/smath/popupmenu/edit.xml b/starmath/uiconfig/smath/popupmenu/edit.xml index c9626cc6a033..385baa4c33cd 100644 --- a/starmath/uiconfig/smath/popupmenu/edit.xml +++ b/starmath/uiconfig/smath/popupmenu/edit.xml @@ -15,6 +15,7 @@ + diff --git a/starmath/uiconfig/smath/ui/sidebarelements_math.ui b/starmath/uiconfig/smath/ui/sidebarelements_math.ui index b9a5736abb9d..8552baba3e18 100644 --- a/starmath/uiconfig/smath/ui/sidebarelements_math.ui +++ b/starmath/uiconfig/smath/ui/sidebarelements_math.ui @@ -2,6 +2,18 @@ + + True + False + + + True + False + Delete Formula + True + + + From 0a1025adeb3608b06df751225a97d84e5be87d48 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 4 Nov 2024 23:02:22 +0100 Subject: [PATCH 268/373] libetonyek: upgrade to 0.1.12 Generated with: ./autogen.sh ./configure make dist-xz Change-Id: I74ac661c5f8db9abf7644212d98b29c3ec5b422f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176036 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- download.lst | 4 +- .../0001-allow-0-size-message.patch.1 | 30 ---------- .../0001-fix-build-with-MSVC.patch.1 | 28 ---------- .../0002-fix-build-with-MSVC.patch.1 | 55 ------------------- .../libetonyek/UnpackedTarball_libetonyek.mk | 5 -- external/libetonyek/include.patch | 10 ---- external/libetonyek/warnings.patch | 11 ---- 7 files changed, 2 insertions(+), 141 deletions(-) delete mode 100644 external/libetonyek/0001-allow-0-size-message.patch.1 delete mode 100644 external/libetonyek/0001-fix-build-with-MSVC.patch.1 delete mode 100644 external/libetonyek/0002-fix-build-with-MSVC.patch.1 delete mode 100644 external/libetonyek/include.patch delete mode 100644 external/libetonyek/warnings.patch diff --git a/download.lst b/download.lst index 04de1629ef0e..7957fba48298 100644 --- a/download.lst +++ b/download.lst @@ -105,8 +105,8 @@ EPUBGEN_TARBALL := libepubgen-0.1.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -ETONYEK_SHA256SUM := b430435a6e8487888b761dc848b7981626eb814884963ffe25eb26a139301e9a -ETONYEK_VERSION_MICRO := 10 +ETONYEK_SHA256SUM := b9fa82fbeb8cb7a701101060e4f3e1e4ef7c38f574b2859d3ecbe43604c21f83 +ETONYEK_VERSION_MICRO := 12 ETONYEK_TARBALL := libetonyek-0.1.$(ETONYEK_VERSION_MICRO).tar.xz # three static lines # so that git cherry-pick diff --git a/external/libetonyek/0001-allow-0-size-message.patch.1 b/external/libetonyek/0001-allow-0-size-message.patch.1 deleted file mode 100644 index 62e584b815a0..000000000000 --- a/external/libetonyek/0001-allow-0-size-message.patch.1 +++ /dev/null @@ -1,30 +0,0 @@ -From 54762245feee35ce6885f7443da8f8443fccd5b5 Mon Sep 17 00:00:00 2001 -From: David Tardon -Date: Wed, 26 May 2021 20:39:41 +0200 -Subject: [PATCH] allow 0-size message - -It likely means the input is broken, but there is no need to reject it. -Let's just produce a dummy, empty message. - -Change-Id: I03a1e9827f21f6a0ce69d7e16dfcf2e9a0f2d44f ---- - src/lib/IWAMessage.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/lib/IWAMessage.cpp b/src/lib/IWAMessage.cpp -index c01b1b6..9456444 100644 ---- a/src/lib/IWAMessage.cpp -+++ b/src/lib/IWAMessage.cpp -@@ -42,7 +42,8 @@ IWAMessage::IWAMessage(const RVNGInputStreamPtr_t &input, unsigned long length) - : m_input(input) - , m_fields() - { -- assert(length > 0); -+ if (length == 0) -+ return; - - parse(length); - } --- -2.31.1 - diff --git a/external/libetonyek/0001-fix-build-with-MSVC.patch.1 b/external/libetonyek/0001-fix-build-with-MSVC.patch.1 deleted file mode 100644 index 2a72844dc79a..000000000000 --- a/external/libetonyek/0001-fix-build-with-MSVC.patch.1 +++ /dev/null @@ -1,28 +0,0 @@ -From 1aa22c746b41a688296f4daf4fc35710d2045a33 Mon Sep 17 00:00:00 2001 -From: David Tardon -Date: Wed, 19 May 2021 19:43:43 +0200 -Subject: [PATCH] fix build with MSVC - -error C2664: 'libetonyek::IWORKFormula::IWORKFormula(const boost::optional &)': cannot convert argument 1 from 'int' to 'const boost::optional &' - -Change-Id: Iaa3de2d0ef8f960495e5d5afebb75c5063955177 ---- - src/lib/IWAParser.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/lib/IWAParser.cpp b/src/lib/IWAParser.cpp -index 7fd95c3..a2bd292 100644 ---- a/src/lib/IWAParser.cpp -+++ b/src/lib/IWAParser.cpp -@@ -3403,7 +3403,7 @@ bool IWAParser::parseFormula(const IWAMessage &msg, IWORKFormulaPtr_t &formula) - } - else - { -- formula.reset(new IWORKFormula(0)); -+ formula.reset(new IWORKFormula(boost::make_optional(0u))); - formula->parse(stack[0]); - } - return ok; --- -2.31.1 - diff --git a/external/libetonyek/0002-fix-build-with-MSVC.patch.1 b/external/libetonyek/0002-fix-build-with-MSVC.patch.1 deleted file mode 100644 index 0eadb0912f6a..000000000000 --- a/external/libetonyek/0002-fix-build-with-MSVC.patch.1 +++ /dev/null @@ -1,55 +0,0 @@ -From 7b69af66227309e9c258beca3bc3934be454a221 Mon Sep 17 00:00:00 2001 -From: David Tardon -Date: Wed, 19 May 2021 21:11:40 +0200 -Subject: [PATCH] fix build with MSVC - -C:/PROGRA~2/MIB055~1/2019/COMMUN~1/VC/Tools/MSVC/1428~1.299/Include\xutility(138): error C2668: 'libetonyek::IWORKStyle::IWORKStyle': ambiguous call to overloaded function -C:\cygwin\home\tdf\lode\jenkins\workspace\gerrit_windows\workdir\UnpackedTarball\libetonyek\src\lib\IWORKStyle.h(32): note: could be 'libetonyek::IWORKStyle::IWORKStyle(const libetonyek::IWORKPropertyMap &,const boost::optional &,const libetonyek::IWORKStylePtr_t &)' -C:\cygwin\home\tdf\lode\jenkins\workspace\gerrit_windows\workdir\UnpackedTarball\libetonyek\src\lib\IWORKStyle.h(31): note: or 'libetonyek::IWORKStyle::IWORKStyle(const libetonyek::IWORKPropertyMap &,const boost::optional &,const boost::optional &)' -C:/PROGRA~2/MIB055~1/2019/COMMUN~1/VC/Tools/MSVC/1428~1.299/Include\xutility(137): note: while trying to match the argument list '(libetonyek::IWORKPropertyMap, const boost::none_t, _Ty)' - with - [ - _Ty=nullptr - ] -C:/PROGRA~2/MIB055~1/2019/COMMUN~1/VC/Tools/MSVC/1428~1.299/Include\memory(2186): note: see reference to function template instantiation 'void std::_Construct_in_place<_Ty,libetonyek::IWORKPropertyMap&,const boost::none_t&,nullptr>(_Ty &,libetonyek::IWORKPropertyMap &,const boost::none_t &,nullptr &&) noexcept(false)' being compiled - with - [ - _Ty=libetonyek::IWORKStyle - ] -C:/PROGRA~2/MIB055~1/2019/COMMUN~1/VC/Tools/MSVC/1428~1.299/Include\memory(2906): note: see reference to function template instantiation 'std::_Ref_count_obj2<_Ty>::_Ref_count_obj2(libetonyek::IWORKPropertyMap &,const boost::none_t &,nullptr &&)' being compiled - with - [ - _Ty=libetonyek::IWORKStyle - ] -C:/PROGRA~2/MIB055~1/2019/COMMUN~1/VC/Tools/MSVC/1428~1.299/Include\memory(2907): note: see reference to function template instantiation 'std::_Ref_count_obj2<_Ty>::_Ref_count_obj2(libetonyek::IWORKPropertyMap &,const boost::none_t &,nullptr &&)' being compiled - with - [ - _Ty=libetonyek::IWORKStyle - ] -C:/cygwin/home/tdf/lode/jenkins/workspace/gerrit_windows/workdir/UnpackedTarball/libetonyek/src/lib/IWAParser.cpp(2358): note: see reference to function template instantiation 'std::shared_ptr std::make_shared(libetonyek::IWORKPropertyMap &,const boost::none_t &,nullptr &&)' being compiled - -Change-Id: Idf871474b2a20f252073846388d018cccc15bc11 ---- - src/lib/IWAParser.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/lib/IWAParser.cpp b/src/lib/IWAParser.cpp -index a2bd292..1fdeae7 100644 ---- a/src/lib/IWAParser.cpp -+++ b/src/lib/IWAParser.cpp -@@ -2355,10 +2355,10 @@ void IWAParser::parseAuthorInComment(unsigned id) - IWORKPropertyMap props; - // normally yellow, but blue may be better in LO - props.put(IWORKColor(0,0,1,1)); -- spans[0]=std::make_shared(props, boost::none, nullptr); -+ spans[0]=std::make_shared(props, boost::none, IWORKStylePtr_t()); - // reset color to default, if not, comment will be blue colored - props.put(IWORKColor(0,0,0,1)); -- spans[unsigned(len)]=std::make_shared(props, boost::none, nullptr); -+ spans[unsigned(len)]=std::make_shared(props, boost::none, IWORKStylePtr_t()); - text.setSpans(spans); - text.parse(*m_currentText); - } --- -2.31.1 - diff --git a/external/libetonyek/UnpackedTarball_libetonyek.mk b/external/libetonyek/UnpackedTarball_libetonyek.mk index 788cf7607710..e13737cbe6a8 100644 --- a/external/libetonyek/UnpackedTarball_libetonyek.mk +++ b/external/libetonyek/UnpackedTarball_libetonyek.mk @@ -19,12 +19,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libetonyek,\ external/libetonyek/win_build.patch.1 \ external/libetonyek/ubsan.patch \ external/libetonyek/rpath.patch \ - external/libetonyek/warnings.patch \ - external/libetonyek/0001-fix-build-with-MSVC.patch.1 \ - external/libetonyek/0002-fix-build-with-MSVC.patch.1 \ - external/libetonyek/0001-allow-0-size-message.patch.1 \ external/libetonyek/enumarith.patch \ - external/libetonyek/include.patch \ )) ifneq ($(OS),MACOSX) diff --git a/external/libetonyek/include.patch b/external/libetonyek/include.patch deleted file mode 100644 index 4052d8093e0f..000000000000 --- a/external/libetonyek/include.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- src/lib/IWORKShape.cpp -+++ src/lib/IWORKShape.cpp -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - - #include - #include diff --git a/external/libetonyek/warnings.patch b/external/libetonyek/warnings.patch deleted file mode 100644 index 841d70cb68e8..000000000000 --- a/external/libetonyek/warnings.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- src/lib/IWORKXMLContext.cpp -+++ src/lib/IWORKXMLContext.cpp -@@ -18,7 +18,7 @@ - { - } - --void IWORKXMLContext::CDATA(const char */*value*/) -+void IWORKXMLContext::CDATA(const char * /*value*/) - { - ETONYEK_DEBUG_MSG(("IWORKXMLContext::cData: find unexpected CDATA block\n")); - } From 174d1d3f3b57547c86ff858d1c2ed931eca3bb37 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 26 Nov 2024 13:30:36 +0100 Subject: [PATCH 269/373] libqxp: fix copy&paste path Since commit 05aedcba6672979d317b540bbfa74f5c9b409402 Author: Stephan Bergmann Date: Thu Jan 21 23:19:20 2021 +0100 Fix use of -fvisibility=hidden with Clang in external/libcdr, external/libqxp Change-Id: Idb97eaea30f5a2b15379b18981455532de0308b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177330 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- external/libqxp/UnpackedTarball_libqxp.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/libqxp/UnpackedTarball_libqxp.mk b/external/libqxp/UnpackedTarball_libqxp.mk index 9f111bcb2b81..54d3e36addd4 100644 --- a/external/libqxp/UnpackedTarball_libqxp.mk +++ b/external/libqxp/UnpackedTarball_libqxp.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libqxp,0)) $(eval $(call gb_UnpackedTarball_add_patches,libqxp, \ external/libqxp/android-workaround.patch.1 \ - external/libcdr/ax_gcc_func_attribute.m4.patch \ + external/libqxp/ax_gcc_func_attribute.m4.patch \ )) # vim: set noet sw=4 ts=4: From 0e334b25b91b4585a8660e49355c3442ebfd334e Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 26 Nov 2024 13:39:23 +0100 Subject: [PATCH 270/373] libcdr: upgrade to 0.1.8 Generated with: ./autogen.sh ./configure make dist-xz Change-Id: I46b921f3c2ef41ab52e272df5afd82a1d9331f42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177332 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- download.lst | 4 ++-- external/libcdr/UnpackedTarball_libcdr.mk | 1 - external/libcdr/ax_gcc_func_attribute.m4.patch | 11 ----------- external/libcdr/libcdr-visibility-win.patch | 8 ++++---- 4 files changed, 6 insertions(+), 18 deletions(-) delete mode 100644 external/libcdr/ax_gcc_func_attribute.m4.patch diff --git a/download.lst b/download.lst index 7957fba48298..9ad2af9d2f22 100644 --- a/download.lst +++ b/download.lst @@ -45,8 +45,8 @@ CAIRO_TARBALL := cairo-1.17.$(CAIRO_VERSION_MICRO).tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -CDR_SHA256SUM := 5666249d613466b9aa1e987ea4109c04365866e9277d80f6cd9663e86b8ecdd4 -CDR_TARBALL := libcdr-0.1.7.tar.xz +CDR_SHA256SUM := ced677c8300b29c91d3004bb1dddf0b99761bf5544991c26c2ee8f427e87193c +CDR_TARBALL := libcdr-0.1.8.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts diff --git a/external/libcdr/UnpackedTarball_libcdr.mk b/external/libcdr/UnpackedTarball_libcdr.mk index f0e80f06f05f..fd227a2f7445 100644 --- a/external/libcdr/UnpackedTarball_libcdr.mk +++ b/external/libcdr/UnpackedTarball_libcdr.mk @@ -17,7 +17,6 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libcdr)) $(eval $(call gb_UnpackedTarball_add_patches,libcdr, \ external/libcdr/libcdr-visibility-win.patch \ - external/libcdr/ax_gcc_func_attribute.m4.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libcdr/ax_gcc_func_attribute.m4.patch b/external/libcdr/ax_gcc_func_attribute.m4.patch deleted file mode 100644 index 37f4edf0bd46..000000000000 --- a/external/libcdr/ax_gcc_func_attribute.m4.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- configure -+++ configure -@@ -19167,7 +19167,7 @@ - - _ACEOF - if ac_fn_cxx_try_link "$LINENO"; then : -- if test -s conftest.err; then : -+ if grep -- -Wattributes conftest.err; then : - ax_cv_have_func_attribute_visibility=no - else - ax_cv_have_func_attribute_visibility=yes diff --git a/external/libcdr/libcdr-visibility-win.patch b/external/libcdr/libcdr-visibility-win.patch index 7700cfd32f2f..5333b5e44b1f 100644 --- a/external/libcdr/libcdr-visibility-win.patch +++ b/external/libcdr/libcdr-visibility-win.patch @@ -1,11 +1,11 @@ --- configure.dt 2018-12-29 16:23:02.355271146 +0100 +++ configure 2018-12-29 16:23:21.644060142 +0100 -@@ -19116,6 +19116,8 @@ +@@ -23329,6 +23329,8 @@ - - if test $platform_win32 = yes; then : + if test $platform_win32 = yes + then : + HAVE_VISIBILITY_TRUE='#' + HAVE_VISIBILITY_FALSE= - else + else $as_nop From 7cfcfa30aa606536d7693ea09f39e57c60af00d6 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 26 Nov 2024 09:14:02 +0100 Subject: [PATCH 271/373] sfx2 lok: fix crash in SfxLokHelper::notifyUpdate() Crashreport signature: > kit-09946-09946 2024-11-25 16:46:13.180120 +0000 [ kitbroker_498 ] SIG Fatal signal received: SIGSEGV code: 1 for address: 0x0 > program/libmergedlo.so > SfxLokHelper::notifyUpdate(SfxViewShell const*, int) > sfx2/source/view/lokhelper.cxx:1072 > program/libswlo.so > SwViewShell::GetSfxViewShell() const > sw/inc/viewsh.hxx:472 > program/libswlo.so > SwCursorShell::UpdateCursor(unsigned short, bool) > sw/source/core/crsr/crsrsh.cxx:2382 ... > program/libmergedlo.so > framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) > framework/source/services/desktop.cxx:592 I.e. it can happen that during load we don't yet have a view, handle this in SfxLokHelper::notifyUpdate() till it takes a pointer and not a reference. Change-Id: Ifa5d9300029076e91ba8722152a7d91a1f2ecbc0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177343 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sfx2/source/view/lokhelper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 5bcb9ef22b98..ce3822502a36 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -1063,7 +1063,7 @@ void SfxLokHelper::getCommandValues(tools::JsonWriter& rJsonWriter, std::string_ void SfxLokHelper::notifyUpdate(SfxViewShell const* pThisView, int nType) { - if (DisableCallbacks::disabled()) + if (DisableCallbacks::disabled() || !pThisView) return; pThisView->libreOfficeKitViewUpdatedCallback(nType); From 2af9fcddba57632e4a13797dcd5894f4cfeb51a7 Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Tue, 26 Nov 2024 18:29:44 +1030 Subject: [PATCH 272/373] Operator should be logical AND instead of OR Change-Id: Ife1870da9979e974fa9dc11ca7dff87c8cfe66bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177310 Tested-by: Jenkins Reviewed-by: Aron Budea --- xmlsecurity/source/helper/documentsignaturehelper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index e3908fc5ee76..ca4446bdf740 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -371,7 +371,7 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( sal_Int64 nSize = 0; uno::Reference xPropertySet(xInputStream, uno::UNO_QUERY); xPropertySet->getPropertyValue(u"Size"_ustr) >>= nSize; - if (nSize >= 0 || nSize < SAL_MAX_INT32) + if (nSize >= 0 && nSize < SAL_MAX_INT32) { uno::Sequence aData; xInputStream->readBytes(aData, nSize); From 668dbfd99ada1888d5919cffedcfd7486c101717 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 26 Nov 2024 14:18:59 +0200 Subject: [PATCH 273/373] tdf#162815 Greyscale images not corrrectly exported to PDF regression from commit 21734247d58a6e915b058d8fa55ece949d049613 "drop internal support for 1-bit images" This only works on Linux because the HasGreyPaletteAny() check is returning false on Linux, because on linux the swap in/out is more aggressive, and after it is has gone through the swap in/out process, the image palette is no longer one that matches anything that HasGreyPaletteAny() checks for (it contains 256 entries, but only 2 of them are used) I'm not exactly sure why the greyscale bitmap generation code is generating bad PDF data, but the RGB code works great, so lets just use that rather. Change-Id: Ibb9e837540d5ed567c706e21e7ff93fe92118580 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177329 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/gdi/pdfwriter_impl.cxx | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 71c097d6b36e..3665709fd42b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9738,37 +9738,6 @@ bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& rObject, bool bMask ) aLine.append( "/ColorSpace" ); if( bTrueColor ) aLine.append( "/DeviceRGB\n" ); - else if( aBitmap.HasGreyPaletteAny() ) - { - aLine.append( "/DeviceGray\n" ); - if (aBitmap.getPixelFormat() == vcl::PixelFormat::N8_BPP) - { - // #i47395# 1 bit bitmaps occasionally have an inverted grey palette - sal_uInt16 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( COL_BLACK ) ); - assert( nBlackIndex == 0 || nBlackIndex == 1); - sal_uInt16 nWhiteIndex = pAccess->GetBestPaletteIndex( BitmapColor( COL_WHITE ) ); - if( pAccess->GetPalette()[nBlackIndex] == BitmapColor( COL_BLACK ) && - pAccess->GetPalette()[nWhiteIndex] == BitmapColor( COL_WHITE ) ) - { - // It is black and white - if( nBlackIndex == 1 ) - aLine.append( "/Decode[1 0]\n" ); - } - else - { - // It is two levels of grey - aLine.append( "/Decode[" ); - assert( pAccess->GetPalette()[0].GetRed() == pAccess->GetPalette()[0].GetGreen() && - pAccess->GetPalette()[0].GetRed() == pAccess->GetPalette()[0].GetBlue() && - pAccess->GetPalette()[1].GetRed() == pAccess->GetPalette()[1].GetGreen() && - pAccess->GetPalette()[1].GetRed() == pAccess->GetPalette()[1].GetBlue() ); - aLine.append( pAccess->GetPalette()[0].GetRed() / 255.0 ); - aLine.append( " " ); - aLine.append( pAccess->GetPalette()[1].GetRed() / 255.0 ); - aLine.append( "]\n" ); - } - } - } else { aLine.append( "[ /Indexed/DeviceRGB " ); From b5ac3d2092fce7d78f39ee501b509a353b8cd173 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 26 Nov 2024 15:31:02 +0100 Subject: [PATCH 274/373] svtools: Merge BrowseBox::ConstructImpl into ctor Change-Id: I9bd8a018dbe2c3416af9b50a6ca782ac5fb3a4ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177350 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- include/svtools/brwbox.hxx | 1 - svtools/source/brwbox/brwbox1.cxx | 100 ++++++++++++++---------------- 2 files changed, 47 insertions(+), 54 deletions(-) diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index 8fffe17108f2..ba0b5a4a7536 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -349,7 +349,6 @@ private: BrowserMode m_nCurrentMode; // last argument of SetMode (redundant, as our other members represent the current settings, too) private: - SVT_DLLPRIVATE void ConstructImpl(BrowserMode nMode); SVT_DLLPRIVATE void ExpandRowSelection( const BrowserMouseEvent& rEvt ); SVT_DLLPRIVATE void ToggleSelection(); diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 0863dd9870c7..185fc13848b5 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -59,58 +59,6 @@ namespace } } -void BrowseBox::ConstructImpl( BrowserMode nMode ) -{ - SAL_INFO("svtools", "BrowseBox:ConstructImpl " << this ); - bMultiSelection = false; - pColSel = nullptr; - pVScroll = nullptr; - pDataWin = VclPtr::Create( this ).get(); - m_pImpl.reset( new ::svt::BrowseBoxImpl() ); - - InitSettings_Impl( this ); - InitSettings_Impl( pDataWin ); - - bBootstrapped = false; - m_nDataRowHeight = 0; - nTitleLines = 1; - nFirstCol = 0; - nTopRow = 0; - nCurRow = BROWSER_ENDOFSELECTION; - nCurColId = 0; - nResizeX = 0; - nMinResizeX = 0; - nDragX = 0; - nResizeCol = 0; - bResizing = false; - bSelect = false; - bSelecting = false; - bScrolling = false; - bSelectionIsVisible = false; - bNotToggleSel = false; - bRowDividerDrag = false; - bHit = false; - mbInteractiveRowHeight = false; - bHideSelect = false; - bHideCursor = TRISTATE_FALSE; - nRowCount = 0; - m_bFocusOnlyCursor = true; - m_aCursorColor = COL_TRANSPARENT; - m_nCurrentMode = BrowserMode::NONE; - nControlAreaWidth = USHRT_MAX; - uRow.nSel = BROWSER_ENDOFSELECTION; - - aHScroll->SetLineSize(1); - aHScroll->SetScrollHdl( LINK( this, BrowseBox, HorzScrollHdl ) ); - pDataWin->Show(); - - SetMode( nMode ); - bSelectionIsVisible = bKeepHighlight; - bHasFocus = HasChildPathFocus(); - pDataWin->nCursorHidden = - ( bHasFocus ? 0 : 1 ) + ( GetUpdateMode() ? 0 : 1 ); -} - // we're just measuring the "real" NavigationBar class MeasureStatusBar final : public InterimItemWindow { @@ -172,7 +120,53 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode ) ,m_nActualCornerWidth(0) ,m_bNavigationBar(false) { - ConstructImpl( nMode ); + bMultiSelection = false; + pColSel = nullptr; + pVScroll = nullptr; + pDataWin = VclPtr::Create( this ).get(); + m_pImpl.reset( new ::svt::BrowseBoxImpl() ); + + InitSettings_Impl( this ); + InitSettings_Impl( pDataWin ); + + bBootstrapped = false; + m_nDataRowHeight = 0; + nTitleLines = 1; + nFirstCol = 0; + nTopRow = 0; + nCurRow = BROWSER_ENDOFSELECTION; + nCurColId = 0; + nResizeX = 0; + nMinResizeX = 0; + nDragX = 0; + nResizeCol = 0; + bResizing = false; + bSelect = false; + bSelecting = false; + bScrolling = false; + bSelectionIsVisible = false; + bNotToggleSel = false; + bRowDividerDrag = false; + bHit = false; + mbInteractiveRowHeight = false; + bHideSelect = false; + bHideCursor = TRISTATE_FALSE; + nRowCount = 0; + m_bFocusOnlyCursor = true; + m_aCursorColor = COL_TRANSPARENT; + m_nCurrentMode = BrowserMode::NONE; + nControlAreaWidth = USHRT_MAX; + uRow.nSel = BROWSER_ENDOFSELECTION; + + aHScroll->SetLineSize(1); + aHScroll->SetScrollHdl( LINK( this, BrowseBox, HorzScrollHdl ) ); + pDataWin->Show(); + + SetMode( nMode ); + bSelectionIsVisible = bKeepHighlight; + bHasFocus = HasChildPathFocus(); + pDataWin->nCursorHidden = + ( bHasFocus ? 0 : 1 ) + ( GetUpdateMode() ? 0 : 1 ); } BrowseBox::~BrowseBox() From 649d2de3dc195c457875ff2b031920e876cd0575 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 26 Nov 2024 15:42:33 +0100 Subject: [PATCH 275/373] svtools: Move THeaderCellMapFunctorDispose struct out of impl class Move to anonymous namespace in the only .cxx where it's used. Change-Id: Ifa1219c49e5673d3440a889b2fd814059a29b5bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177351 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- svtools/source/brwbox/brwbox1.cxx | 20 +++++++++++++++++++- svtools/source/brwbox/brwimpl.hxx | 18 ------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 185fc13848b5..a368eab2407a 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -48,12 +48,30 @@ using namespace svt; namespace { + struct THeaderCellMapFunctorDispose + { + void operator()(const svt::BrowseBoxImpl::THeaderCellMap::value_type& _aType) + { + css::uno::Reference xComp(_aType.second, css::uno::UNO_QUERY); + OSL_ENSURE(xComp.is() || !_aType.second.is(), "THeaderCellMapFunctorDispose: invalid accessible cell (no XComponent)!"); + if (xComp.is()) + try + { + xComp->dispose(); + } + catch(const css::uno::Exception&) + { + TOOLS_WARN_EXCEPTION("svtools", "THeaderCellMapFunctorDispose"); + } + } + }; + void disposeAndClearHeaderCell(::svt::BrowseBoxImpl::THeaderCellMap& _rHeaderCell) { ::std::for_each( _rHeaderCell.begin(), _rHeaderCell.end(), - ::svt::BrowseBoxImpl::THeaderCellMapFunctorDispose() + THeaderCellMapFunctorDispose() ); _rHeaderCell.clear(); } diff --git a/svtools/source/brwbox/brwimpl.hxx b/svtools/source/brwbox/brwimpl.hxx index 8c7017675a3f..6ce6fee6ed3c 100644 --- a/svtools/source/brwbox/brwimpl.hxx +++ b/svtools/source/brwbox/brwimpl.hxx @@ -35,24 +35,6 @@ namespace svt public: typedef ::std::map< sal_Int32, css::uno::Reference< css::accessibility::XAccessible > > THeaderCellMap; - struct THeaderCellMapFunctorDispose - { - void operator()(const THeaderCellMap::value_type& _aType) - { - css::uno::Reference< css::lang::XComponent > xComp( _aType.second, css::uno::UNO_QUERY ); - OSL_ENSURE( xComp.is() || !_aType.second.is(), "THeaderCellMapFunctorDispose: invalid accessible cell (no XComponent)!" ); - if ( xComp.is() ) - try - { - xComp->dispose(); - } - catch( const css::uno::Exception& ) - { - TOOLS_WARN_EXCEPTION( "svtools", "THeaderCellMapFunctorDispose" ); - } - } - }; - public: vcl::AccessibleFactoryAccess m_aFactoryAccess; rtl::Reference m_pAccessible; From c630dbc1ab0756ce25a65a6326b908313a35d17f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 26 Nov 2024 16:15:25 +0100 Subject: [PATCH 276/373] svtools a11y: Merge BrowseBoxImpl into BrowseBox Change-Id: I3667e47867eb85f18cf8ad620cff903cc13f38c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177352 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/svtools/brwbox.hxx | 21 ++++++++-- svtools/source/brwbox/brwbox1.cxx | 35 ++++++++-------- svtools/source/brwbox/brwbox3.cxx | 69 +++++++++++++++---------------- svtools/source/brwbox/brwimpl.hxx | 62 --------------------------- 4 files changed, 69 insertions(+), 118 deletions(-) delete mode 100644 svtools/source/brwbox/brwimpl.hxx diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index ba0b5a4a7536..a514e70dd524 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -28,10 +28,12 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -261,9 +263,10 @@ class SVT_DLLPUBLIC BrowseBox ,public vcl::IAccessibleTableProvider { friend class BrowserDataWin; - friend class ::svt::BrowseBoxImpl; public: + typedef ::std::map> THeaderCellMap; + static const sal_uInt16 HandleColumnId = 0; private: @@ -342,12 +345,16 @@ private: std::stack m_aGotoStack; - ::std::unique_ptr< ::svt::BrowseBoxImpl > m_pImpl; // impl structure of the BrowseBox object - bool m_bFocusOnlyCursor; // hide cursor if we don't have the focus Color m_aCursorColor; // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor BrowserMode m_nCurrentMode; // last argument of SetMode (redundant, as our other members represent the current settings, too) + vcl::AccessibleFactoryAccess m_aFactoryAccess; + rtl::Reference m_pAccessible; + + THeaderCellMap m_aColHeaderCellMap; + THeaderCellMap m_aRowHeaderCellMap; + private: SVT_DLLPRIVATE void ExpandRowSelection( const BrowserMouseEvent& rEvt ); SVT_DLLPRIVATE void ToggleSelection(); @@ -381,6 +388,14 @@ private: SAL_DLLPRIVATE sal_uInt16 ToggleSelectedColumn(); SAL_DLLPRIVATE void SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId); + /// @see AccessibleBrowseBox::getHeaderBar + css::uno::Reference + getAccessibleHeaderBar(AccessibleBrowseBoxObjType _eObjType); + + /// @see AccessibleBrowseBox::getTable + css::uno::Reference + getAccessibleTable(); + protected: /// retrieves the XAccessible implementation associated with the BrowseBox instance SAL_DLLPRIVATE ::vcl::IAccessibleFactory& getAccessibleFactory(); diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index a368eab2407a..11f750b96b5c 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -17,12 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include #include #include #include "datwin.hxx" +#include #include #include #include @@ -34,8 +36,8 @@ #include #include #include +#include #include -#include "brwimpl.hxx" #define SCROLL_FLAGS (ScrollFlags::Clip | ScrollFlags::NoChildren) @@ -50,7 +52,7 @@ namespace { struct THeaderCellMapFunctorDispose { - void operator()(const svt::BrowseBoxImpl::THeaderCellMap::value_type& _aType) + void operator()(const BrowseBox::THeaderCellMap::value_type& _aType) { css::uno::Reference xComp(_aType.second, css::uno::UNO_QUERY); OSL_ENSURE(xComp.is() || !_aType.second.is(), "THeaderCellMapFunctorDispose: invalid accessible cell (no XComponent)!"); @@ -66,7 +68,7 @@ namespace } }; - void disposeAndClearHeaderCell(::svt::BrowseBoxImpl::THeaderCellMap& _rHeaderCell) + void disposeAndClearHeaderCell(BrowseBox::THeaderCellMap& _rHeaderCell) { ::std::for_each( _rHeaderCell.begin(), @@ -142,7 +144,6 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode ) pColSel = nullptr; pVScroll = nullptr; pDataWin = VclPtr::Create( this ).get(); - m_pImpl.reset( new ::svt::BrowseBoxImpl() ); InitSettings_Impl( this ); InitSettings_Impl( pDataWin ); @@ -194,12 +195,12 @@ BrowseBox::~BrowseBox() void BrowseBox::DisposeAccessible() { - if (m_pImpl->m_pAccessible ) + if (m_pAccessible ) { - disposeAndClearHeaderCell(m_pImpl->m_aColHeaderCellMap); - disposeAndClearHeaderCell(m_pImpl->m_aRowHeaderCellMap); - m_pImpl->m_pAccessible->dispose(); - m_pImpl->m_pAccessible = nullptr; + disposeAndClearHeaderCell(m_aColHeaderCellMap); + disposeAndClearHeaderCell(m_aRowHeaderCellMap); + m_pAccessible->dispose(); + m_pAccessible = nullptr; } } @@ -819,13 +820,13 @@ void BrowseBox::RemoveColumns() commitBrowseBoxEvent( AccessibleEventId::CHILD, Any(), - Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)) + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)) ); // and now append it again commitBrowseBoxEvent( AccessibleEventId::CHILD, - Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)), + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)), Any() ); @@ -1139,13 +1140,13 @@ void BrowseBox::Clear() commitBrowseBoxEvent( AccessibleEventId::CHILD, Any(), - Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ) + Any(getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar)) ); // and now append it again commitBrowseBoxEvent( AccessibleEventId::CHILD, - Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ), + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)), Any() ); @@ -1382,25 +1383,25 @@ void BrowseBox::RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint ) commitBrowseBoxEvent( AccessibleEventId::CHILD, Any(), - Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ) + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)) ); // and now append it again commitBrowseBoxEvent( AccessibleEventId::CHILD, - Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)), + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)), Any() ); commitBrowseBoxEvent( AccessibleEventId::CHILD, Any(), - Any( m_pImpl->getAccessibleTable() ) + Any(getAccessibleTable()) ); // and now append it again commitBrowseBoxEvent( AccessibleEventId::CHILD, - Any( m_pImpl->getAccessibleTable() ), + Any(getAccessibleTable()), Any() ); } diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 1237060a1b89..be1a1b268c21 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -17,13 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include #include #include #include -#include "brwimpl.hxx" #include // Accessibility ============================================================== @@ -35,7 +35,7 @@ using namespace ::com::sun::star::accessibility; namespace svt { - static Reference< XAccessible > getHeaderCell( BrowseBoxImpl::THeaderCellMap& _raHeaderCells, + static Reference< XAccessible > getHeaderCell(BrowseBox::THeaderCellMap& _raHeaderCells, sal_Int32 _nPos, AccessibleBrowseBoxObjType _eType, const Reference< XAccessible >& _rParent, @@ -44,7 +44,7 @@ namespace svt ) { Reference< XAccessible > xRet; - BrowseBoxImpl::THeaderCellMap::iterator aFind = _raHeaderCells.find( _nPos ); + BrowseBox::THeaderCellMap::iterator aFind = _raHeaderCells.find(_nPos); if ( aFind == _raHeaderCells.end() ) { Reference< XAccessible > xAccessible = rFactory.createAccessibleBrowseBoxHeaderCell( @@ -60,42 +60,39 @@ namespace svt xRet = aFind->second; return xRet; } - - - Reference< XAccessible > BrowseBoxImpl::getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType ) - { - if ( m_pAccessible && m_pAccessible->isAlive() ) - return m_pAccessible->getHeaderBar( _eObjType ); - return nullptr; - } - - - Reference< XAccessible > BrowseBoxImpl::getAccessibleTable( ) - { - if ( m_pAccessible && m_pAccessible->isAlive() ) - return m_pAccessible->getTable( ); - return nullptr; - } } +Reference BrowseBox::getAccessibleHeaderBar(AccessibleBrowseBoxObjType _eObjType) +{ + if (m_pAccessible && m_pAccessible->isAlive()) + return m_pAccessible->getHeaderBar(_eObjType); + return nullptr; +} + +Reference BrowseBox::getAccessibleTable() +{ + if (m_pAccessible && m_pAccessible->isAlive()) + return m_pAccessible->getTable(); + return nullptr; +} Reference< XAccessible > BrowseBox::CreateAccessible() { vcl::Window* pParent = GetAccessibleParentWindow(); DBG_ASSERT( pParent, "BrowseBox::CreateAccessible - parent not found" ); - if( pParent && !m_pImpl->m_pAccessible) + if (pParent && !m_pAccessible) { Reference< XAccessible > xAccParent = pParent->GetAccessible(); if( xAccParent.is() ) { - m_pImpl->m_pAccessible = getAccessibleFactory().createAccessibleBrowseBox( + m_pAccessible = getAccessibleFactory().createAccessibleBrowseBox( xAccParent, *this ); } } - return m_pImpl->m_pAccessible; + return m_pAccessible; } @@ -104,10 +101,10 @@ Reference< XAccessible > BrowseBox::CreateAccessible() Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) { // BBINDEX_TABLE must be the table - OSL_ENSURE(m_pImpl->m_pAccessible,"Invalid call: Accessible is null"); + OSL_ENSURE(m_pAccessible,"Invalid call: Accessible is null"); - return m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell( - m_pImpl->getAccessibleTable(), + return m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell( + getAccessibleTable(), *this, nullptr, _nRow, @@ -120,12 +117,12 @@ Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_u Reference< XAccessible > BrowseBox::CreateAccessibleRowHeader( sal_Int32 _nRow ) { return svt::getHeaderCell( - m_pImpl->m_aRowHeaderCellMap, + m_aRowHeaderCellMap, _nRow, AccessibleBrowseBoxObjType::RowHeaderCell, - m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar), + getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar), *this, - m_pImpl->m_aFactoryAccess.getFactory() + m_aFactoryAccess.getFactory() ); } @@ -133,12 +130,12 @@ Reference< XAccessible > BrowseBox::CreateAccessibleRowHeader( sal_Int32 _nRow ) Reference< XAccessible > BrowseBox::CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) { return svt::getHeaderCell( - m_pImpl->m_aColHeaderCellMap, + m_aColHeaderCellMap, _nColumnPos, AccessibleBrowseBoxObjType::ColumnHeaderCell, - m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar), + getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar), *this, - m_pImpl->m_aFactoryAccess.getFactory() + m_aFactoryAccess.getFactory() ); } @@ -398,30 +395,30 @@ void BrowseBox::commitHeaderBarEvent(sal_Int16 nEventId, const Any& rNewValue, const Any& rOldValue, bool _bColumnHeaderBar ) { if ( isAccessibleAlive() ) - m_pImpl->m_pAccessible->commitHeaderBarEvent( nEventId, + m_pAccessible->commitHeaderBarEvent( nEventId, rNewValue, rOldValue, _bColumnHeaderBar ); } void BrowseBox::commitTableEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) { if ( isAccessibleAlive() ) - m_pImpl->m_pAccessible->commitTableEvent( _nEventId, _rNewValue, _rOldValue ); + m_pAccessible->commitTableEvent(_nEventId, _rNewValue, _rOldValue); } void BrowseBox::commitBrowseBoxEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) { if ( isAccessibleAlive() ) - m_pImpl->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); + m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); } ::vcl::IAccessibleFactory& BrowseBox::getAccessibleFactory() { - return m_pImpl->m_aFactoryAccess.getFactory(); + return m_aFactoryAccess.getFactory(); } bool BrowseBox::isAccessibleAlive( ) const { - return m_pImpl->m_pAccessible && m_pImpl->m_pAccessible->isAlive(); + return m_pAccessible && m_pAccessible->isAlive(); } // IAccessibleTableProvider diff --git a/svtools/source/brwbox/brwimpl.hxx b/svtools/source/brwbox/brwimpl.hxx deleted file mode 100644 index 6ce6fee6ed3c..000000000000 --- a/svtools/source/brwbox/brwimpl.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- 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 -#include -#include -#include -#include -#include - -#include - -namespace svt -{ - class BrowseBoxImpl - { - // member - public: - typedef ::std::map< sal_Int32, css::uno::Reference< css::accessibility::XAccessible > > THeaderCellMap; - - public: - vcl::AccessibleFactoryAccess m_aFactoryAccess; - rtl::Reference m_pAccessible; - THeaderCellMap m_aColHeaderCellMap; - THeaderCellMap m_aRowHeaderCellMap; - - public: - BrowseBoxImpl() - { - } - - - /// @see AccessibleBrowseBox::getHeaderBar - css::uno::Reference< css::accessibility::XAccessible > - getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType ); - - /// @see AccessibleBrowseBox::getTable - css::uno::Reference< css::accessibility::XAccessible > - getAccessibleTable( ); - - }; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From fd2c9abe5229f98e062b7b32994e9e015975ca90 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Tue, 26 Nov 2024 14:07:23 +0100 Subject: [PATCH 277/373] show extension link on startcenter for macosxsandbox case the ShowDonation has already a default value of true via the schema, so it is enough to override it to false for the macosxsandbox case similar to how it is done with the Infobar / using the install:module method Change-Id: I8f1ea6d3530e66806f66f9f2d2fb16ef0276e460 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177333 Tested-by: Jenkins Reviewed-by: Christian Lohmaier --- officecfg/Configuration_officecfg.mk | 1 + officecfg/registry/data/org/openoffice/Office/Common.xcu | 2 +- postprocess/CustomTarget_registry.mk | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/officecfg/Configuration_officecfg.mk b/officecfg/Configuration_officecfg.mk index 57ac28bbed51..868a6626755b 100644 --- a/officecfg/Configuration_officecfg.mk +++ b/officecfg/Configuration_officecfg.mk @@ -87,6 +87,7 @@ $(eval $(call gb_Configuration_add_spool_modules,registry,officecfg/registry/dat org/openoffice/Office/Common-unx.xcu \ org/openoffice/Office/Common-unixdesktop.xcu \ org/openoffice/Office/Common-macosx.xcu \ + org/openoffice/Office/Common-macosxsandbox.xcu \ org/openoffice/Office/Common-wnt.xcu \ org/openoffice/Office/Common-UseOOoFileDialogs.xcu \ org/openoffice/Office/Common-32bit.xcu \ diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 7c8bc8f15f35..48faa40b5549 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -458,7 +458,7 @@ true - true + false diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk index 20d68d3bc7aa..4be442c49ae4 100644 --- a/postprocess/CustomTarget_registry.mk +++ b/postprocess/CustomTarget_registry.mk @@ -309,6 +309,7 @@ endif ifneq ($(ENABLE_MACOSX_SANDBOX),) postprocess_FILES_main += $(postprocess_MOD)/org/openoffice/Office/UI/Infobar-macosxsandbox.xcu +postprocess_FILES_main += $(postprocess_MOD)/org/openoffice/Office/Common-macosxsandbox.xcu endif ifneq (,$(SYSTEM_LIBEXTTEXTCAT_DATA)) From b32d040d647812fed03f96be2f07a96ffddad4e9 Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Tue, 26 Nov 2024 15:18:41 +0100 Subject: [PATCH 278/373] Resolves tdf#126857 - Center object on page/slide * uno:AlignMiddle labeled "Middle" * uno:AlignOnPage added Change-Id: Iafc162bdd80d7c20fabd55234e93212c1fa3435a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177348 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- .../Office/UI/DrawImpressCommands.xcu | 22 +++++++++++++++++++ .../openoffice/Office/UI/GenericCommands.xcu | 2 +- sd/inc/app.hrc | 1 + sd/sdi/_drvwsh.sdi | 5 +++++ sd/sdi/sdraw.sdi | 16 ++++++++++++++ sd/source/ui/view/drviews2.cxx | 8 +++++++ sd/source/ui/view/drviews7.cxx | 1 + sd/uiconfig/sdraw/popupmenu/objectalign.xml | 2 ++ sd/uiconfig/sdraw/toolbar/alignmentbar.xml | 1 + .../sdraw/toolbar/drawingobjectbar.xml | 1 + .../sdraw/toolbar/graphicobjectbar.xml | 1 + .../simpress/popupmenu/objectalign.xml | 2 ++ sd/uiconfig/simpress/toolbar/alignmentbar.xml | 1 + .../simpress/toolbar/drawingobjectbar.xml | 1 + .../simpress/toolbar/graphicobjectbar.xml | 1 + 15 files changed, 64 insertions(+), 1 deletion(-) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index f51dcf7a4185..38c4485d565c 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -1786,6 +1786,28 @@ 1 + + + ~Center on Page + + + Center object vertically and horizontally + + + 1 + + + + + ~Center on Slide + + + Center object vertically and horizontally + + + .uno:AlignOnPage + + diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 703e2c476365..5c92e5147718 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -2633,7 +2633,7 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 - C~enter + ~Middle 1 diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 7a2334b47ed8..56cfc31ede21 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -451,5 +451,6 @@ #define SID_HIDE_LAST_LEVEL (SID_SD_START+448) #define SID_SHOW_NEXT_LEVEL (SID_SD_START+449) #define SID_PRESENTATION_MINIMIZER (SID_SD_START+450) +#define SID_ALIGN_PAGE (SID_SD_START+451) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 159b5ffc75e4..76fde4080010 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -2977,4 +2977,9 @@ interface DrawView ExecMethod = FuTemporary; StateMethod = GetAttrState; ] + SID_ALIGN_PAGE + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState; + ] } diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi index bfc38f92e51d..d98a938c1cfd 100644 --- a/sd/sdi/sdraw.sdi +++ b/sd/sdi/sdraw.sdi @@ -4720,3 +4720,19 @@ SfxBoolItem UnderlineDotted SID_ULINE_VAL_DOTTED ToolBoxConfig = TRUE, GroupId = SfxGroupId::Format; ] + +SfxVoidItem AlignOnPage SID_ALIGN_PAGE +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Modify; +] diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 2803fb0721eb..ce9359fbebc3 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -3139,6 +3139,14 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; + case SID_ALIGN_PAGE: + { + mpDrawView->AlignMarkedObjects(SdrHorAlign::Center, SdrVertAlign::Center); + Cancel(); + rReq.Done (); + } + break; + case SID_OBJECT_ALIGN_DOWN: // BASIC { mpDrawView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Bottom); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index b63253fa36e4..a561bf46f411 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1337,6 +1337,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) rSet.ClearItem(SID_3D_WIN); rSet.DisableItem(SID_OBJECT_ALIGN); + rSet.DisableItem(SID_ALIGN_PAGE); rSet.DisableItem(SID_ZOOM_TOOLBOX); rSet.DisableItem(SID_OBJECT_CHOOSE_MODE); rSet.DisableItem(SID_DRAWTBX_TEXT); diff --git a/sd/uiconfig/sdraw/popupmenu/objectalign.xml b/sd/uiconfig/sdraw/popupmenu/objectalign.xml index 4bb17386d158..446bd974bed3 100644 --- a/sd/uiconfig/sdraw/popupmenu/objectalign.xml +++ b/sd/uiconfig/sdraw/popupmenu/objectalign.xml @@ -15,4 +15,6 @@ + + diff --git a/sd/uiconfig/sdraw/toolbar/alignmentbar.xml b/sd/uiconfig/sdraw/toolbar/alignmentbar.xml index 38d0340a3d15..91eba5f2a09c 100644 --- a/sd/uiconfig/sdraw/toolbar/alignmentbar.xml +++ b/sd/uiconfig/sdraw/toolbar/alignmentbar.xml @@ -25,4 +25,5 @@ + \ No newline at end of file diff --git a/sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml b/sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml index 5dfd2a43849c..ba71c63c6a28 100644 --- a/sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml +++ b/sd/uiconfig/sdraw/toolbar/drawingobjectbar.xml @@ -29,6 +29,7 @@ + diff --git a/sd/uiconfig/sdraw/toolbar/graphicobjectbar.xml b/sd/uiconfig/sdraw/toolbar/graphicobjectbar.xml index 95113efc9f7d..fa7f90e05700 100644 --- a/sd/uiconfig/sdraw/toolbar/graphicobjectbar.xml +++ b/sd/uiconfig/sdraw/toolbar/graphicobjectbar.xml @@ -29,6 +29,7 @@ + diff --git a/sd/uiconfig/simpress/popupmenu/objectalign.xml b/sd/uiconfig/simpress/popupmenu/objectalign.xml index 4bb17386d158..168cd891ad43 100644 --- a/sd/uiconfig/simpress/popupmenu/objectalign.xml +++ b/sd/uiconfig/simpress/popupmenu/objectalign.xml @@ -15,4 +15,6 @@ + + diff --git a/sd/uiconfig/simpress/toolbar/alignmentbar.xml b/sd/uiconfig/simpress/toolbar/alignmentbar.xml index 38d0340a3d15..206dd8bed4a0 100644 --- a/sd/uiconfig/simpress/toolbar/alignmentbar.xml +++ b/sd/uiconfig/simpress/toolbar/alignmentbar.xml @@ -25,4 +25,5 @@ + \ No newline at end of file diff --git a/sd/uiconfig/simpress/toolbar/drawingobjectbar.xml b/sd/uiconfig/simpress/toolbar/drawingobjectbar.xml index 83203c672473..829657583355 100644 --- a/sd/uiconfig/simpress/toolbar/drawingobjectbar.xml +++ b/sd/uiconfig/simpress/toolbar/drawingobjectbar.xml @@ -29,6 +29,7 @@ + diff --git a/sd/uiconfig/simpress/toolbar/graphicobjectbar.xml b/sd/uiconfig/simpress/toolbar/graphicobjectbar.xml index e11ce441752a..a9f5d1c17b45 100644 --- a/sd/uiconfig/simpress/toolbar/graphicobjectbar.xml +++ b/sd/uiconfig/simpress/toolbar/graphicobjectbar.xml @@ -29,6 +29,7 @@ + From 82417b47bdeffd8f1051819bda94cd33a9fa48fa Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Tue, 26 Nov 2024 10:02:10 +0100 Subject: [PATCH 279/373] tdf#163992 Improve tooltip for opened documents Change-Id: I9d3cd55b05a684a8b21d5ee5a478202a3d0788c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177321 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- sc/uiconfig/scalc/ui/navigatorpanel.ui | 4 ++-- sd/uiconfig/simpress/ui/navigatorpanel.ui | 2 +- sw/uiconfig/swriter/ui/navigatorpanel.ui | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sc/uiconfig/scalc/ui/navigatorpanel.ui b/sc/uiconfig/scalc/ui/navigatorpanel.ui index 3934bdaac402..82609ecbdcfe 100644 --- a/sc/uiconfig/scalc/ui/navigatorpanel.ui +++ b/sc/uiconfig/scalc/ui/navigatorpanel.ui @@ -323,11 +323,11 @@ True True - Document + Open Documents Active Window - Displays the names of all open documents. + Lists currently open spreadsheets. diff --git a/sd/uiconfig/simpress/ui/navigatorpanel.ui b/sd/uiconfig/simpress/ui/navigatorpanel.ui index 329a4f7c756f..fc7441a211a5 100644 --- a/sd/uiconfig/simpress/ui/navigatorpanel.ui +++ b/sd/uiconfig/simpress/ui/navigatorpanel.ui @@ -62,7 +62,7 @@ True False - Document + Open Documents Active Window diff --git a/sw/uiconfig/swriter/ui/navigatorpanel.ui b/sw/uiconfig/swriter/ui/navigatorpanel.ui index 7d043cff1560..7fcfaeb6674e 100644 --- a/sw/uiconfig/swriter/ui/navigatorpanel.ui +++ b/sw/uiconfig/swriter/ui/navigatorpanel.ui @@ -1346,10 +1346,11 @@ True False - Document + Open Documents Active Window + Lists currently open documents. From 8068f5a5d0a9b09606165eec17e8ef5d26482fcf Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Tue, 26 Nov 2024 11:22:27 +0100 Subject: [PATCH 280/373] Fix typo Change-Id: I2a3df5cad1bd4daa18292cc106d5e8fedefca364 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177325 Reviewed-by: Julien Nabet Tested-by: Jenkins --- sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 5a5c103786f4..4847a47fb7b6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -1167,7 +1167,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentWithChildrenTdf163092) CPPUNIT_TEST_FIXTURE(Test, testTdf146269) { - // Given a focument with a field in a redline: + // Given a document with a field in a redline: createSwDoc("deleted_pageref.docx"); // It must open unmodified: { From 3c94289c22a64907150ca0d01451cf6227344656 Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Tue, 26 Nov 2024 11:23:54 +0100 Subject: [PATCH 281/373] Remove exec bits on odt file Change-Id: Ic528aa0d92d3d5e9ac971be8b5343a0b2b4da5c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177328 Reviewed-by: Julien Nabet Tested-by: Jenkins --- sw/qa/extras/uiwriter/data/tdf162326_list.odt | Bin 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 sw/qa/extras/uiwriter/data/tdf162326_list.odt diff --git a/sw/qa/extras/uiwriter/data/tdf162326_list.odt b/sw/qa/extras/uiwriter/data/tdf162326_list.odt old mode 100755 new mode 100644 From 500e79807d724efe8c68db0ee23b71415e219ed8 Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Tue, 26 Nov 2024 11:22:45 +0100 Subject: [PATCH 282/373] Fix typo Change-Id: Ia1395f64bdc649f8e0f450b9173d302efa058c9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177326 Reviewed-by: Julien Nabet Tested-by: Jenkins --- vcl/osx/salnativewidgets.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 88bccb7a6985..113049b8eeda 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -403,7 +403,7 @@ static void drawBox(CGContextRef context, const NSRect& rc, NSColor* pColor) // Related tdf#163945: Set fill color to NSColorTypeComponentBased color type // Many system colors have the NSColorTypeCatalog color type. For - // some unkown reason, setting the NSBox's fill color to a color set + // some unknown reason, setting the NSBox's fill color to a color set // to NSColorTypeCatalog causes drawing to take at least twice as long // as when the fill color is set to NSColorTypeComponentBased. So, // only draw with a fill color set to NSColorTypeComponentBased. From ab60c81f77f45315ba3cfc7cae6c1d9144588663 Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Tue, 26 Nov 2024 11:23:37 +0100 Subject: [PATCH 283/373] Fix typo Change-Id: Ifdd5f7cce7006b824397525f3a698df3f30ee17e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177327 Tested-by: Jenkins Reviewed-by: Julien Nabet --- xmloff/source/chart/SchXMLChartContext.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index a6cd20a3d54f..fbf06985cc93 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -752,7 +752,7 @@ void SchXMLChartContext::endFastElement(sal_Int32 ) // cleanup: remove empty chart type groups lcl_removeEmptyChartTypeGroups( xNewDoc ); - // Handle of-pie paramters. Is this the right place to do this? + // Handle of-pie parameters. Is this the right place to do this? if (maChartTypeServiceName == "com.sun.star.chart2.PieChartType") { Reference< chart2::XDiagram> xDia(xNewDoc->getFirstDiagram()); uno::Reference< beans::XPropertySet > xDiaProp( xDia, uno::UNO_QUERY ); From 082ba4a420ff30e8d9c40b2d2be6621fc0051936 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Tue, 26 Nov 2024 20:32:24 +0100 Subject: [PATCH 284/373] Update git submodules * Update helpcontent2 from branch 'master' to c7c79a8fc5bd529a081c2bc0360183d6cd819356 - Typo in Help page Change-Id: I5c149638fb6501e64f8255c843872e3570169036 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/177281 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index 143fba581c74..c7c79a8fc5bd 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 143fba581c7499e9e36971e52e18bada4a262be1 +Subproject commit c7c79a8fc5bd529a081c2bc0360183d6cd819356 From 77bcd4dbbb0e18bc15ebb42afd45bc382aa4e925 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 26 Nov 2024 19:24:12 +0100 Subject: [PATCH 285/373] NotoSerif: upgrade to v2.015 Downloaded from https://github.com/notofonts/latin-greek-cyrillic/releases/download/NotoSerif-v2.015/NotoSerif-v2.015.zip Change-Id: I2cf07988ddb411db69457998e8171b19c46ea356 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177362 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- download.lst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download.lst b/download.lst index 9ad2af9d2f22..c16498031d45 100644 --- a/download.lst +++ b/download.lst @@ -172,8 +172,8 @@ FONT_NOTO_SANS_TARBALL := NotoSans-v2.014.zip # three static lines # so that git cherry-pick # will not run into conflicts -FONT_NOTO_SERIF_SHA256SUM := 6abce0a80df4ef6d5a944d60c81099364481d6a7015b0721d87bc4c16acc1fd3 -FONT_NOTO_SERIF_TARBALL := NotoSerif-v2.014.zip +FONT_NOTO_SERIF_SHA256SUM := 0e9a43c8a4b94ac76f55069ed1d7385bbcaf6b99527a94deb5619e032b7e76c1 +FONT_NOTO_SERIF_TARBALL := NotoSerif-v2.015.zip # three static lines # so that git cherry-pick # will not run into conflicts From fafc2b9cd55c78d82cc0df9223f8563fb78d65b6 Mon Sep 17 00:00:00 2001 From: Sahil Gautam Date: Wed, 27 Nov 2024 01:11:18 +0530 Subject: [PATCH 286/373] Update git submodules * Update helpcontent2 from branch 'master' to 815ce1be85e4bd8e77ccbed66ec5d482863f4caa - tdf#85976 update help page for 'Handle Duplicate Records' dialog + use row/column instead of record to make it easier to understand + use field instead of record to describe the treeview entries in the 'Compare by' section as that's a more technically correct term. https://bugs.documentfoundation.org/show_bug.cgi?id=85976#c84 Change-Id: I05f2280a94507528a595436d2a8a52c6ed574d9e Reviewed-on: https://gerrit.libreoffice.org/c/help/+/177261 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index c7c79a8fc5bd..815ce1be85e4 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit c7c79a8fc5bd529a081c2bc0360183d6cd819356 +Subproject commit 815ce1be85e4bd8e77ccbed66ec5d482863f4caa From 1f60ba36f4e2fa2785d31200b2a95226920ec298 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Tue, 26 Nov 2024 09:02:55 -0500 Subject: [PATCH 287/373] tdf#147819 doc export: only ShapeFlag::Background if XATTR_FILL The mere presence of an object somewhere in the document was causing the document background to force a white color. This code was developed in the heady days of figuring out what bits meant what, so the documentation and code-reading is NOT clear. make CppunitTest_sw_ww8export \ CPPUNIT_TEST_NAME=testTdf41542_imagePadding (My ODT file had obviously spent some of its lifetime as a DOC because it had a white page background. I unzipped the file, and hand-adjusted styles.xml to set fo:background-color="transparent" and draw:fill="none") Change-Id: I41484ab7f71f4a3156e3193e49127b14e58949cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177347 Tested-by: Jenkins Reviewed-by: Justin Luth --- .../ww8export/data/tdf41542_imagePadding.odt | Bin 17926 -> 17370 bytes sw/qa/extras/ww8export/ww8export.cxx | 5 +++++ sw/source/filter/ww8/wrtw8esh.cxx | 12 +++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sw/qa/extras/ww8export/data/tdf41542_imagePadding.odt b/sw/qa/extras/ww8export/data/tdf41542_imagePadding.odt index 019e19f247e1045de95fe6fb74b396ab577605c3..8468e110195fa6d13a4c7ec3000be6db5b99666d 100644 GIT binary patch delta 12650 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 delta 13126 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 I6S+G3f2QEZ761SM diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index c62078af50d0..acfc4b674bc5 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -995,6 +996,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf41542_imagePadding) CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Top ); CPPUNIT_ASSERT_EQUAL( crop.Right, crop.Bottom ); CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Right ); + + // tdf#147819 - page background should not be forced to white color + const SwFrameFormat &rFormat = getSwDoc()->GetPageDesc(0).GetMaster(); + CPPUNIT_ASSERT(!rFormat.GetItemIfSet(RES_BACKGROUND)); } DECLARE_WW8EXPORT_TEST(testFdo77454, "fdo77454.doc") diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index db3a6b9674a9..e0b1f250db55 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2278,13 +2278,15 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) { OpenContainer( ESCHER_SpContainer ); - AddShape( ESCHER_ShpInst_Rectangle, - ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::Background, - nSecondShapeId ); + const SwFrameFormat &rDefaultPageStyle = mrWrt.m_rDoc.GetPageDesc(0).GetMaster(); + const SvxBrushItem* pBrush = rDefaultPageStyle.GetItemIfSet(RES_BACKGROUND); + ShapeFlag nFlags = ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty; + if (pBrush) // document has background + nFlags |= ShapeFlag::Background; + AddShape(ESCHER_ShpInst_Rectangle, nFlags, nSecondShapeId); EscherPropertyContainer aPropOpt; - const SwFrameFormat &rFormat = mrWrt.m_rDoc.GetPageDesc(0).GetMaster(); - if (const SvxBrushItem* pBrush = rFormat.GetItemIfSet(RES_BACKGROUND)) + if (pBrush) { WriteBrushAttr(*pBrush, aPropOpt); From aa6b56cdda0883ff86151f84c0aafe1e2bec7b53 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 26 Nov 2024 19:22:14 +0100 Subject: [PATCH 288/373] NotoSans: upgrade to v2.015 Downloaded from https://github.com/notofonts/latin-greek-cyrillic/releases/download/NotoSans-v2.015/NotoSans-v2.015.zip Change-Id: I924800998d31235eb7d2fcea83adfc64ff748ea2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177361 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- download.lst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download.lst b/download.lst index c16498031d45..1e3bc4fe0f49 100644 --- a/download.lst +++ b/download.lst @@ -167,8 +167,8 @@ FONT_NOTO_KUFI_ARABIC_TARBALL := NotoKufiArabic-v2.109.zip # three static lines # so that git cherry-pick # will not run into conflicts -FONT_NOTO_SANS_SHA256SUM := 1dffbaf31a0a699ee2c57dfb60c1a628010425301dd076cfb485adbe017352c1 -FONT_NOTO_SANS_TARBALL := NotoSans-v2.014.zip +FONT_NOTO_SANS_SHA256SUM := 0c34df072a3fa7efbb7cbf34950e1f971a4447cffe365d3a359e2d4089b958f5 +FONT_NOTO_SANS_TARBALL := NotoSans-v2.015.zip # three static lines # so that git cherry-pick # will not run into conflicts From d7bbc50f3144a7d08c8f37a93745ff9a9e7c7ff9 Mon Sep 17 00:00:00 2001 From: Bogdan Buzea Date: Tue, 26 Nov 2024 22:04:44 +0100 Subject: [PATCH 289/373] Update git submodules * Update helpcontent2 from branch 'master' to 6977846f119905354c5b449612e1e0b64fdf0722 - tdf#131332: Replace custom date formats with ISO 8601 Change-Id: I258013e509a72caf640032fe6dc258a734127fd1 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/177292 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index 815ce1be85e4..6977846f1199 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 815ce1be85e4bd8e77ccbed66ec5d482863f4caa +Subproject commit 6977846f119905354c5b449612e1e0b64fdf0722 From 03a701516ea94b786ba6e1b35bf6dad22cceced5 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Tue, 26 Nov 2024 22:05:45 +0100 Subject: [PATCH 290/373] Update git submodules * Update helpcontent2 from branch 'master' to ade9473eb6bb45b83d49c2e77f9448ac638e4425 - Untranslatable string made translatable Change-Id: I5cd51e885dce97d43559ddc95754f750ef842e9d Reviewed-on: https://gerrit.libreoffice.org/c/help/+/177368 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index 6977846f1199..ade9473eb6bb 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 6977846f119905354c5b449612e1e0b64fdf0722 +Subproject commit ade9473eb6bb45b83d49c2e77f9448ac638e4425 From 68699d3699fed08956e37e53664fa92e70487b8d Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 26 Nov 2024 23:08:04 +0500 Subject: [PATCH 291/373] Release CXNotifyingDataObject in separate thread The reported deadlocking situation at paste was: 1. Thread CMtaOleClipboard::run() is handling CXNotifyingDataObject::Release, which calls CWinClipboard::onReleaseDataObject before deleting self, and that eventually tries to lock solar mutex: sal3!osl_acquireMutex+0x49 [sal\osl\w32\mutex.cxx @ 65] vclplug_winlo!osl::Mutex::acquire+0xa [include\osl\mutex.hxx @ 63] vclplug_winlo!SalYieldMutex::doAcquire+0x91 [vcl\win\app\salinst.cxx @ 148] vcllo!osl::Guard::{ctor}+0xe [include\osl\mutex.hxx @ 144] vcllo!SolarMutexGuard::{ctor}+0x1b [include\vcl\svapp.hxx @ 1340] vcllo!TransferableHelper::lostOwnership+0x36 [vcl\source\treelist\transfer.cxx @ 487] vclplug_winlo!CXNotifyingDataObject::lostOwnership+0x61 [vcl\win\dtrans\XNotifyingDataObject.cxx @ 140] vclplug_winlo!CWinClipboard::onReleaseDataObject+0x57 [vcl\win\dtrans\WinClipboard.cxx @ 364] vclplug_winlo!CXNotifyingDataObject::Release+0x36 [vcl\win\dtrans\XNotifyingDataObject.cxx @ 77] combase!Ordinal230+0x1c9b ... combase!Ordinal87+0x3d19 USER32!DispatchMessageW+0x741 USER32!DispatchMessageW+0x201 vclplug_winlo!CMtaOleClipboard::run+0x18f [vcl\win\dtrans\MtaOleClipb.cxx @ 657] 2. Thread CMtaOleClipboard::clipboardChangedNotifierThreadProc() is handling the respective event, calling CWinClipboard::handleClipboardContentChanged, which notifies listeners, including SwClipboardChangeListener, which, in its changedContents, has locked solar mutex, and requests the clipboard content, which eventually calls CMtaOleClipboard::getClipboard posting a message to the CMtaOleClipboard::run() thread, and waiting the result: vclplug_winlo!`anonymous-namespace'::Win32Condition::wait+0x3b [vcl\win\dtrans\MtaOleClipb.cxx @ 92] vclplug_winlo!CMtaOleClipboard::getClipboard+0x220 [vcl\win\dtrans\MtaOleClipb.cxx @ 355] vclplug_winlo!CWinClipboard::getIDataObject+0x84 [vcl\win\dtrans\WinClipboard.cxx @ 161] vclplug_winlo!CDOTransferable::tryToGetIDataObjectIfAbsent+0x56 [vcl\win\dtrans\DOTransferable.cxx @ 413] vclplug_winlo!CDOTransferable::getClipboardData+0x79 [vcl\win\dtrans\DOTransferable.cxx @ 425] vclplug_winlo!CDOTransferable::getTransferData+0x163 [vcl\win\dtrans\DOTransferable.cxx @ 252] sotlo!GetTransferableAction_Impl+0x13d [sot\source\base\formats.cxx @ 1352] sotlo!SotExchange::GetExchangeAction+0xde [sot\source\base\formats.cxx @ 1429] swlo!SwTransferable::IsPaste+0xba [sw\source\uibase\dochdl\swdtflvr.cxx @ 1402] swlo!SwClipboardChangeListener::changedContents+0xac [sw\source\uibase\uiview\uivwimp.cxx @ 315] vclplug_winlo!comphelper::OInterfaceContainerHelper4::NotifySingleListener::operator()+0xc [include\comphelper\interfacecontainer4.hxx @ 274] vclplug_winlo!comphelper::OInterfaceContainerHelper4::forEach::NotifySingleListener >+0xb6 [include\comphelper\interfacecontainer4.hxx @ 304] vclplug_winlo!comphelper::OInterfaceContainerHelper4::notifyEach+0x28 [include\comphelper\interfacecontainer4.hxx @ 325] vclplug_winlo!CWinClipboard::handleClipboardContentChanged+0x156 [vcl\win\dtrans\WinClipboard.cxx @ 303] vclplug_winlo!CWinClipboard::onClipboardContentChanged+0x5c [vcl\win\dtrans\WinClipboard.cxx @ 387] vclplug_winlo!CMtaOleClipboard::clipboardChangedNotifierThreadProc+0x172 [vcl\win\dtrans\MtaOleClipb.cxx @ 699] This change tries to untie this, by creating a dedicated thread to call CWinClipboard::onReleaseDataObject and delete CXNotifyingDataObject outside of its Release (and of the CMtaOleClipboard::run() thread), so that locking happening in that process doesn't deadlock functional threads. Change-Id: I93da6fe79225319a84b332c81716793f4d9fb05d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177363 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- vcl/win/dtrans/WinClipboard.hxx | 2 +- vcl/win/dtrans/XNotifyingDataObject.cxx | 24 ++++++++++++++++++++---- vcl/win/dtrans/XNotifyingDataObject.hxx | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/vcl/win/dtrans/WinClipboard.hxx b/vcl/win/dtrans/WinClipboard.hxx index aba9689cb7a0..098f0816c557 100644 --- a/vcl/win/dtrans/WinClipboard.hxx +++ b/vcl/win/dtrans/WinClipboard.hxx @@ -52,7 +52,7 @@ class CWinClipboard final css::datatransfer::clipboard::XFlushableClipboard, css::lang::XServiceInfo> { - friend STDMETHODIMP_(ULONG) CXNotifyingDataObject::Release(); + friend CXNotifyingDataObject::~CXNotifyingDataObject(); css::uno::Reference m_xContext; const OUString m_itsName; diff --git a/vcl/win/dtrans/XNotifyingDataObject.cxx b/vcl/win/dtrans/XNotifyingDataObject.cxx index 9d7c563a5a28..cee9e63879ed 100644 --- a/vcl/win/dtrans/XNotifyingDataObject.cxx +++ b/vcl/win/dtrans/XNotifyingDataObject.cxx @@ -40,6 +40,12 @@ CXNotifyingDataObject::CXNotifyingDataObject( { } +CXNotifyingDataObject::~CXNotifyingDataObject() +{ + if (auto pWinClipImpl = m_pWinClipImpl.get()) + pWinClipImpl->onReleaseDataObject(*this); +} + STDMETHODIMP CXNotifyingDataObject::QueryInterface( REFIID iid, void** ppvObject ) { if ( nullptr == ppvObject ) @@ -64,6 +70,17 @@ STDMETHODIMP_(ULONG) CXNotifyingDataObject::AddRef( ) return static_cast< ULONG >( InterlockedIncrement( &m_nRefCnt ) ); } +namespace +{ +// delete CXNotifyingDataObject is a dedicated thread. It calls CWinClipboard::onReleaseDataObject, +// which may lock solar mutex, and if called in CMtaOleClipboard::run() thread, may deadlock. +unsigned __stdcall releaseAsyncProc(void* p) +{ + delete static_cast(p); + return 0; +} +} + STDMETHODIMP_(ULONG) CXNotifyingDataObject::Release( ) { ULONG nRefCnt = @@ -71,10 +88,9 @@ STDMETHODIMP_(ULONG) CXNotifyingDataObject::Release( ) if ( 0 == nRefCnt ) { - if (auto pWinClipImpl = m_pWinClipImpl.get()) - pWinClipImpl->onReleaseDataObject(*this); - - delete this; + auto handle = _beginthreadex(nullptr, 0, releaseAsyncProc, this, 0, nullptr); + assert(handle); + CloseHandle(reinterpret_cast(handle)); } return nRefCnt; diff --git a/vcl/win/dtrans/XNotifyingDataObject.hxx b/vcl/win/dtrans/XNotifyingDataObject.hxx index 04fb5b93d49f..ba15b143cbf5 100644 --- a/vcl/win/dtrans/XNotifyingDataObject.hxx +++ b/vcl/win/dtrans/XNotifyingDataObject.hxx @@ -48,7 +48,7 @@ public: const css::uno::Reference< css::datatransfer::clipboard::XClipboardOwner >& aXClipOwner, CWinClipboard* const theWinClipoard); - virtual ~CXNotifyingDataObject() {} + virtual ~CXNotifyingDataObject(); // ole interface implementation From cf108a359b77ce58c2f8bb7f4116f87a8c536ca5 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 26 Nov 2024 21:54:42 +0100 Subject: [PATCH 292/373] weld: Return unique_ptr in weld::Dialog::widget_for_response ... to make more obvious from the API that the caller owns the returned weld::Button* (but not the underlying toolkit widget). Change-Id: I64f57f80e4eea4c2c984fa7b615b5a2350ed892a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177375 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- dbaccess/source/ui/dlg/sqlmessage.cxx | 2 +- include/vcl/weld.hxx | 2 +- vcl/inc/jsdialog/jsdialogbuilder.hxx | 4 ++-- vcl/inc/qt5/QtInstanceDialog.hxx | 2 +- vcl/inc/qt5/QtInstanceMessageDialog.hxx | 2 +- vcl/inc/salvtables.hxx | 4 ++-- vcl/jsdialog/jsdialogbuilder.cxx | 23 ++++++++++++----------- vcl/qt5/QtInstanceDialog.cxx | 2 +- vcl/qt5/QtInstanceMessageDialog.cxx | 10 +++++----- vcl/source/app/salvtables.cxx | 8 ++++---- vcl/unx/gtk3/gtkinst.cxx | 6 +++--- 11 files changed, 33 insertions(+), 32 deletions(-) diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index 07891f773cfd..51459220ac9e 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -507,7 +507,7 @@ void OSQLMessageBox::impl_addDetailsButton() if ( bMoreDetailsAvailable ) { m_xDialog->add_button(GetStandardText(StandardButtonType::More), RET_MORE); - m_xMoreButton.reset(m_xDialog->weld_widget_for_response(RET_MORE)); + m_xMoreButton = m_xDialog->weld_widget_for_response(RET_MORE); m_xMoreButton->connect_clicked(LINK(this, OSQLMessageBox, ButtonClickHdl)); } } diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 98495b7496ec..350b0c1ae4ba 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -629,7 +629,7 @@ public: virtual void response(int response) = 0; virtual void add_button(const OUString& rText, int response, const OUString& rHelpId = {}) = 0; virtual void set_default_response(int response) = 0; - virtual Button* weld_widget_for_response(int response) = 0; + virtual std::unique_ptr