Re: draw:image vs draw:fill-image & multiple copies
* Regina Henschel (rb.hensc...@t-online.de) wrote: > Hi David, Hi Regina, Thanks for the quick reply. > Dr. David Alan Gilbert schrieb am 18.07.2024 um 19:37: > > Hi, > >(Context: PDF importing a weird document with thousands of identical > > images https://bugs.documentfoundation.org/show_bug.cgi?id=88914 ) > > > > If you insert an image into a Draw document you get a > >draw:frame with a draw:image inside, with the image data > > The picture itself is only inside the draw:image element, if you use the > flat format (.fodp). Otherwise there is only a link to the image that is in > a separate folder. > > > > > If you duplicate that image (copy/paste), you get a second > > draw:frame and second draw:image with the data again. > > The image itself is only onetime in the folder. All copies have a link to > the same image. > > > > > Is there any way with draw:image not to copy the data? > > That would be only relevant for a document in flat format. Oh! Right, that confused me; I tend to use the flat formats when debugging. Indeed I can see in the folder it has de-duped. > > I wondered if it was doable with a > >draw:image xlink:href=hmmsomething > > but couldn't figure out if it was possible to link back to your > > own images? > > The links are set automatically all to the same image. Nothing to do for > you. Great; ah OK. > > But the other route is a > >draw:custom-shape > > to a style with a draw:fill-image-name > > to a draw:fill-image > > > > and then you can have multiple draw:custom-shape's sharing the > > draw:fill-image - and hopefully the style. > > Is there any downside to that? > > It depends on the kind of image, what you will do with the image and in > which module you use the image. > > The element can contains more than one child > element. That is used for example for a svg-image. These child elements have > different mime-types, so that a consumer can take that one it is able to > render. If a consumer is not able to render the vector graphic, it can take > the bitmap, for example. That is not possible with a style with image-fill. > > Compared to shapes, images have specialized features: > * You can adjust color/contrast/brightness/gamma/transparency without > actually changing the image. > > * The image need not be in the document itself, but can be an external > resource. > > * You can define an "Image Map". > > * You can define a "Contour Wrap". > > * Images have events to trigger macros. > > On the other hand, a custom-shape with bitmap fill can be used in 3D-mode. > That allows perspective and 3-dimensional rotation. Thanks for the explanation! Dave > Kind regards, > Regina > > > > > > > -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
draw:image vs draw:fill-image & multiple copies
Hi, (Context: PDF importing a weird document with thousands of identical images https://bugs.documentfoundation.org/show_bug.cgi?id=88914 ) If you insert an image into a Draw document you get a draw:frame with a draw:image inside, with the image data If you duplicate that image (copy/paste), you get a second draw:frame and second draw:image with the data again. Is there any way with draw:image not to copy the data? I wondered if it was doable with a draw:image xlink:href=hmmsomething but couldn't figure out if it was possible to link back to your own images? But the other route is a draw:custom-shape to a style with a draw:fill-image-name to a draw:fill-image and then you can have multiple draw:custom-shape's sharing the draw:fill-image - and hopefully the style. Is there any downside to that? Dave -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
Re: Build fail in mariadb on fedora 40
* Julien Nabet (serval2...@yahoo.fr) wrote: > On 17/05/2024 15:47, Dr. David Alan Gilbert wrote: > > Hi, > >I'm getting: > > > > workdir/UnpackedTarball/mariadb-connector-c/libmariadb/ma_client_plugin.c:87:207: > > error: initialization of ‘struct st_mysql_client_plugin *’ from > > incompatible pointer type ‘struct st_mysql_client_plugin_AUTHENTICATION *’ > > [-Wincompatible-pointer-types] > > 87 |(struct st_mysql_client_plugin *)_socket_client_plugin, > > (struct st_mysql_client_plugin *)_sha2_password_client_plugin, > > (struct st_mysql_client_plugin *)_native_password_client_plugin, > > (struct st_mysql_client_plugin_AUTHENTICATION > > *)_gssapi_client_client_plugin, > >| > > > >^ > > /discs/fast/core/workdir/UnpackedTarball/mariadb-connector-c/libmariadb/ma_client_plugin.c:87:207: > > note: (near initialization for ‘mysql_client_builtins[3]’) > > make[1]: *** [/discs/fast/core/solenv/gbuild/LinkTarget.mk:366: > > /discs/fast/core/workdir/GenCObject/UnpackedTarball/mariadb-connector-c/libmariadb/ma_client_plugin.o] > > Error 1 > > make[1]: *** Waiting for unfinished jobs > > make: *** [Makefile:294: build] Error 2 > > > > Host: Fedora 40, x86-64 > > configured with: > > ./configure --srcdir=/discs/fast/core --enable-option-checking=fatal > > --enable-debug > > > > using --with-system-mariadb fixed it. > > Hello David, Hi Julien, Thanks for the reply. > Sorry, I don't know why you encounter this :-( It looks like others started hitting it; see: https://gerrit.libreoffice.org/c/core/+/167806 (I believe as a windows user) > If it can help, here's the content of my autogen.input: > > CC=clang > CXX=clang++ Hmm I'm using gcc instead, but I don't see how the cast would be valid: UnpackedTarball/mariadb-connector-c/include/mysql/client_plugin.h has: #include struct st_mysql_client_plugin_AUTHENTICATION { MYSQL_CLIENT_PLUGIN_HEADER int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); }; although, hmm, that header also defines: #define mysql_declare_client_plugin(X) \ struct st_mysql_client_plugin_ ## X\ _mysql_client_plugin_declaration_ = { \ MYSQL_CLIENT_ ## X ## _PLUGIN,\ MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION, #define mysql_end_client_plugin } which is curiously different from the system /usr/include/mysql/server/mysql/client_plugin.h #define mysql_declare_client_plugin(X) \ C_MODE_START MYSQL_PLUGIN_EXPORT_C \ struct st_mysql_client_plugin_ ## X\ _mysql_client_plugin_declaration_ = { \ MYSQL_CLIENT_ ## X ## _PLUGIN,\ MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION, #define mysql_end_client_plugin }; C_MODE_END so those C_MODE_START/END make me think someone is doing something funky with the compiler anyway. Dave > --enable-ld=lld > --enable-online-update > --enable-dbgutil > --enable-evolution2 > --enable-gtk4 > --enable-qt5 > --enable-kf5 > --enable-gtk3-kde5 > --enable-skia=debug > --enable-ext-nlpsolver > --enable-ext-numbertext > --enable-ext-wiki-publisher > --enable-dbus > --enable-werror > --enable-dependency-tracking > --enable-python=fully-internal > --without-system-mariadb > --enable-bundle-mariadb > --enable-symbols > --enable-avahi > --enable-eot > --enable-odk > --with-lang=en-US de es fr hu it ja nl pt pt-BR ru nb nn > --with-myspell-dicts > > Julien > -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
Build fail in mariadb on fedora 40
Hi, I'm getting: workdir/UnpackedTarball/mariadb-connector-c/libmariadb/ma_client_plugin.c:87:207: error: initialization of ‘struct st_mysql_client_plugin *’ from incompatible pointer type ‘struct st_mysql_client_plugin_AUTHENTICATION *’ [-Wincompatible-pointer-types] 87 |(struct st_mysql_client_plugin *)_socket_client_plugin, (struct st_mysql_client_plugin *)_sha2_password_client_plugin, (struct st_mysql_client_plugin *)_native_password_client_plugin, (struct st_mysql_client_plugin_AUTHENTICATION *)_gssapi_client_client_plugin, | ^ /discs/fast/core/workdir/UnpackedTarball/mariadb-connector-c/libmariadb/ma_client_plugin.c:87:207: note: (near initialization for ‘mysql_client_builtins[3]’) make[1]: *** [/discs/fast/core/solenv/gbuild/LinkTarget.mk:366: /discs/fast/core/workdir/GenCObject/UnpackedTarball/mariadb-connector-c/libmariadb/ma_client_plugin.o] Error 1 make[1]: *** Waiting for unfinished jobs make: *** [Makefile:294: build] Error 2 Host: Fedora 40, x86-64 configured with: ./configure --srcdir=/discs/fast/core --enable-option-checking=fatal --enable-debug using --with-system-mariadb fixed it. I originally filed this as: https://bugs.documentfoundation.org/show_bug.cgi?id=161141 However Ilmari pointed out that being a build bug it should be here. See the bug for my config.log. (cc'ing Julien since I see they did some stuff around there.) Dave -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
Re: Isolating qa data?
* Miklos Vajna (vmik...@collabora.com) wrote: > Hi Dave, > > On Wed, Apr 03, 2024 at 03:26:42PM +0000, "Dr. David Alan Gilbert" > wrote: > > What I'm thinking is that a cautious packager could set it up so > > that during the build qa/data wasn't readable, then having built and > > copied their installation out, then they could perform a make check > > having reenabled access to qa/data/ > > I wonder if this would be doable also at the current setup. Something > like search for all "data" directories under */qa/, delete them, do the > build, 'git checkout -f' to do undo the delete and then 'make check'? Yeh, I guess possible; I'm not sure what's easiest for packagers. (I was thinking along the lines of a permissions or blank directory mounted over it). Actually, a quick hunt for where we have docs shows they're a bit more spread around; e.g. ./sw/qa/core/exportdata/rtf/pass ./sc/qa/extras/testdocuments ./odk/examples/basic/sheet ./pyuno/qa/pytests/testdocuments so a simplefind . -path .*qa/*/data isn't sufficient. Dave > > Regards, > > Miklos -- -----Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
Isolating qa data?
Hi, Given the xz hack, would it make sense to isolate the qa data files under a single directory, e.g. qa/data/vcl/cppunit/pdfexport rather than vcl/qa/cppunit/pdfexport ? What I'm thinking is that a cautious packager could set it up so that during the build qa/data wasn't readable, then having built and copied their installation out, then they could perform a make check having reenabled access to qa/data/ To be clear I'm not worrying particularly about LO, but fundamentally a lot of the test files start off as random bug reports and it's rare to look inside the test files for anything odd. Just an idea, Dave -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
core.git: sdext/source
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 42 -- 1 file changed, 20 insertions(+), 22 deletions(-) New commits: commit 1a7f06f01315992b9dfb05e1f9c46307cd72dac8 Author: Dr. David Alan Gilbert AuthorDate: Mon Mar 4 01:56:56 2024 + Commit: Noel Grandin CommitDate: Thu Mar 7 07:04:08 2024 +0100 sdext.pdfimport: Use std::unique_ptr as per Noel's suggestion - this also ends up fixing some leaks as well. Change-Id: Ia6099afc1955c341256ec0de5a0f839c005d9b76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164446 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index ec2632b74899..603155a2036e 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -453,8 +453,8 @@ static void flipSplashBitmap(SplashBitmap *pBitmap) auto nRowSize = static_cast(pBitmap->getRowSize()); auto nAlphaRowSize = static_cast(pBitmap->getAlphaRowSize()); -auto aTmpRow = new unsigned char[nRowSize]; -auto aTmpAlphaRow = new unsigned char[nAlphaRowSize]; +std::unique_ptr aTmpRow(new unsigned char[nRowSize]); +std::unique_ptr aTmpAlphaRow(new unsigned char[nAlphaRowSize]); auto pBitmapData = pBitmap->getDataPtr(); auto pAlphaData = pBitmap->getAlphaPtr(); @@ -470,16 +470,14 @@ static void flipSplashBitmap(SplashBitmap *pBitmap) nCur++, pCurRowA+=nRowSize, pCurRowB-=nRowSize, pCurAlphaA+=nAlphaRowSize, pCurAlphaB-=nAlphaRowSize) { -memcpy(aTmpRow, pCurRowA, nRowSize); +memcpy(aTmpRow.get(), pCurRowA, nRowSize); memcpy(pCurRowA, pCurRowB, nRowSize); -memcpy(pCurRowB, aTmpRow, nRowSize); +memcpy(pCurRowB, aTmpRow.get(), nRowSize); -memcpy(aTmpAlphaRow, pCurAlphaA, nAlphaRowSize); +memcpy(aTmpAlphaRow.get(), pCurAlphaA, nAlphaRowSize); memcpy(pCurAlphaA, pCurAlphaB, nAlphaRowSize); -memcpy(pCurAlphaB, aTmpAlphaRow, nAlphaRowSize); +memcpy(pCurAlphaB, aTmpAlphaRow.get(), nAlphaRowSize); } -delete[] aTmpRow; -delete[] aTmpAlphaRow; } int PDFOutDev::parseFont( long long nNewId, GfxFont* gfxFont, const GfxState* state ) const @@ -1268,13 +1266,15 @@ poppler_bool PDFOutDev::tilingPatternFill(GfxState *state, Gfx *, Catalog *, auto pSplashGfx = new Gfx(m_pDoc, pSplashOut, pResDict, , nullptr); pSplashGfx->display(aStr); -auto pSplashBitmap = pSplashOut->takeBitmap(); +std::unique_ptr pSplashBitmap(pSplashOut->takeBitmap()); +// Poppler tells us to free the splash device immediately after taking the +// bitmap delete pSplashGfxState; delete pSplashGfx; delete pSplashOut; // Add a vertical flip, we can't do this in LO for an image filled poly -flipSplashBitmap(pSplashBitmap); +flipSplashBitmap(pSplashBitmap.get()); auto nBitmapWidth = static_cast(pSplashBitmap->getWidth()); auto nBitmapHeight = static_cast(pSplashBitmap->getHeight()); @@ -1300,23 +1300,21 @@ poppler_bool PDFOutDev::tilingPatternFill(GfxState *state, Gfx *, Catalog *, } } -auto pRgbStr = new MemStream(pBitmapData, 0, -nBitmapWidth * nBitmapHeight * 3, Object(objNull)); -auto pAlphaStr = new MemStream(reinterpret_cast(pSplashBitmap->getAlphaPtr()), 0, -nBitmapWidth * nBitmapHeight, Object(objNull)); +std::unique_ptr pRgbStr(new MemStream(pBitmapData, 0, +nBitmapWidth * nBitmapHeight * 3, Object(objNull))); +std::unique_ptr pAlphaStr(new MemStream(reinterpret_cast(pSplashBitmap->getAlphaPtr()), +0, nBitmapWidth * nBitmapHeight, Object(objNull))); auto aDecode = Object(objNull); -auto pRgbIdentityColorMap = new GfxImageColorMap(8, , new GfxDeviceRGBColorSpace()); -auto pGrayIdentityColorMap = new GfxImageColorMap(8, , new GfxDeviceGrayColorSpace()); +std::unique_ptr pRgbIdentityColorMap(new GfxImageColorMap(8, , +new GfxDeviceRGBColorSpace())); +std::unique_ptr pGrayIdentityColorMap(new GfxImageColorMap(8, , +new GfxDeviceGrayColorSpace())); OutputBuffer aBuf; initBuf(aBuf); -writePng_(aBuf, pRgbStr, nBitmapWidth, nBitmapHeight, pRgbIdentityColorMap, -pAlphaStr, nBitmapWidth, nBitmapHeight, pGrayIdentityColorMap); +writePng_(aBuf, pRgbStr.get(), nBitmapWidth, nBitmapHeight, pRgbIdentityColorMap.get(), +pAlphaStr.get(), nBitmapWidth, nBitmapHeight, pGrayIdentityColorMap.get()); writeBinaryBuffer(aBuf); -delete pAlphaStr; -delete pRgbStr; -delete pSplashBitmap; - // If we return false here we can fall back to the slow path return true; }
core.git: sdext/source
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit cf776a6fa697924deb7df5c0561e12bbd7cda16a Author: Dr. David Alan Gilbert AuthorDate: Sun Feb 18 22:01:43 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:28:48 2024 +0100 tdf#113050 sdext.pdfimport: Enable tilingPatternFill Now we've got everything wired up, turn it on. Change-Id: I2333e5163493ef0312619f54d2f90ae266fc655b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163575 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx index f38bf423423b..2a8078422def 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx @@ -284,7 +284,7 @@ namespace pdfi static void setPageNum( int nNumPages ); void setSkipImages ( bool bSkipImages ); #if POPPLER_CHECK_VERSION(21, 3, 0) -poppler_bool useTilingPatternFill() override { return false; }; +poppler_bool useTilingPatternFill() override { return true; }; poppler_bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1,
core.git: sdext/source
sdext/source/pdfimport/tree/drawtreevisiting.cxx |2 ++ sdext/source/pdfimport/tree/pdfiprocessor.cxx |7 ++- sdext/source/pdfimport/tree/writertreevisiting.cxx |3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) New commits: commit 81fbaf4bb9ddc385d4452257d731e4097dfed079 Author: Dr. David Alan Gilbert AuthorDate: Thu Feb 15 00:18:01 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:28:31 2024 +0100 tdf#113050 sdext.pdfimport: Set and write TileWidth/Height Set the tile width/height from the step size and write it into the draw:fill-image-width/height properties. Change-Id: I70d69a6d5e77929bd14282731dd68d3bcafa9c1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163574 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index 2c02adde8874..7897dbae9d08 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -826,6 +826,8 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::uniqu aGCProps[ "draw:fill-image-name" ] = m_rStyleContainer.getStyleName( m_rStyleContainer.getStyleId(style)); +aGCProps[ "draw:fill-image-width" ] = unitMMString(convPx2mm(elem.TileWidth)); +aGCProps[ "draw:fill-image-height" ] = unitMMString(convPx2mm(elem.TileHeight)); } diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 6f4b45f21a40..2483144250b8 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -428,12 +428,17 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1, } // TODO: That clipping might shift the fill pattern offsets +double transformedxStep = nxStep * rMat.m00 + nyStep * rMat.m01; +double transformedyStep = nxStep * rMat.m10 + nyStep * rMat.m11; + auto pPolyElement = ElementFactory::createPolyPolyElement( m_pCurElement, getGCId(getCurrentContext()), aB2DPoly, PATH_EOFILL, // Hmm how do I know if this should be EO or not? -nTile, 0, 0 ); +nTile, +transformedxStep * aScale.getX(), +transformedyStep * -aScale.getY()); pPolyElement->updateGeometry(); pPolyElement->ZOrder = m_nNextZOrder++; } diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index 746fc9e77eb2..9012aaa21038 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -1004,7 +1004,8 @@ void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::uni aGCProps[ "draw:fill-image-name" ] = m_rStyleContainer.getStyleName( m_rStyleContainer.getStyleId(style)); - +aGCProps[ "draw:fill-image-width" ] = unitMMString(convPx2mm(elem.TileWidth)); +aGCProps[ "draw:fill-image-height" ] = unitMMString(convPx2mm(elem.TileHeight)); } // TODO(F1): check whether stuff could be emulated by gradient/bitmap/hatch
core.git: sdext/source
sdext/source/pdfimport/inc/genericelements.hxx | 11 --- sdext/source/pdfimport/tree/genericelements.cxx |8 ++-- sdext/source/pdfimport/tree/pdfiprocessor.cxx |8 3 files changed, 18 insertions(+), 9 deletions(-) New commits: commit 784696e47c7f28dac111b95e61f06a9a1f7cdc97 Author: Dr. David Alan Gilbert AuthorDate: Wed Feb 14 00:25:13 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:28:08 2024 +0100 tdf#113050 sdext.pdfimport: Add TileWidth and TileHeight fields We need to scale the tiled image that fills our polygon, so add width and height fields, we'll fill in and process them in subsequent patches. Change-Id: Ib066170ccbc0f4a4c971e1d6df72c3f7df14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163573 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/inc/genericelements.hxx b/sdext/source/pdfimport/inc/genericelements.hxx index 4332d4f1372b..705773b9893a 100644 --- a/sdext/source/pdfimport/inc/genericelements.hxx +++ b/sdext/source/pdfimport/inc/genericelements.hxx @@ -213,7 +213,8 @@ namespace pdfi friend class ElementFactory; PolyPolyElement( Element* pParent, sal_Int32 nGCId, const basegfx::B2DPolyPolygon& rPolyPoly, - sal_Int8 nAction, ImageId nFillImage ); + sal_Int8 nAction, ImageId nFillImage, + double nTileWidth, double nTileHeight ); public: virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr >::const_iterator& rParentIt ) override; @@ -226,6 +227,8 @@ namespace pdfi basegfx::B2DPolyPolygon PolyPoly; sal_Int8Action; ImageId FillImage; +double TileWidth; +double TileHeight; }; struct ImageElement final : public DrawElement @@ -300,8 +303,10 @@ namespace pdfi createPolyPolyElement( Element* pParent, sal_Int32 nGCId, const basegfx::B2DPolyPolygon& rPolyPoly, - sal_Int8 nAction, ImageId nFillImage ) -{ return new PolyPolyElement( pParent, nGCId, rPolyPoly, nAction, nFillImage ); } + sal_Int8 nAction, ImageId nFillImage, + double nTileWidth, double nTileHeight ) +{ return new PolyPolyElement( pParent, nGCId, rPolyPoly, nAction, + nFillImage, nTileWidth, nTileHeight ); } static ImageElement* createImageElement( Element* pParent, sal_Int32 nGCId, ImageId nImage ) { return new ImageElement( pParent, nGCId, nImage ); } diff --git a/sdext/source/pdfimport/tree/genericelements.cxx b/sdext/source/pdfimport/tree/genericelements.cxx index 100e145608aa..aec9c999fcf6 100644 --- a/sdext/source/pdfimport/tree/genericelements.cxx +++ b/sdext/source/pdfimport/tree/genericelements.cxx @@ -125,11 +125,15 @@ PolyPolyElement::PolyPolyElement( Element* pParent, sal_Int32 nGCId, const basegfx::B2DPolyPolygon& rPolyPoly, sal_Int8 nAction, - ImageIdnFillImage ) + ImageIdnFillImage, + double nTileWidth, + double nTileHeight ) : DrawElement( pParent, nGCId ), PolyPoly( rPolyPoly ), Action( nAction ), - FillImage( nFillImage ) + FillImage( nFillImage ), + TileWidth( nTileWidth ), + TileHeight( nTileHeight ) { } diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 0ef30a176ed2..6f4b45f21a40 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -433,7 +433,7 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1, getGCId(getCurrentContext()), aB2DPoly, PATH_EOFILL, // Hmm how do I know if this should be EO or not? -nTile ); +nTile, 0, 0 ); pPolyElement->updateGeometry(); pPolyElement->ZOrder = m_nNextZOrder++; } @@ -448,7 +448,7 @@ void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D getGCId(getCurrentContext()), aPoly, PATH_STROKE, --1 ); +-1, 0, 0 ); pPoly->updateGeometry(); pPoly->ZOrder = m_nNextZOrder++; } @@ -463,7 +463,7 @@ void PDFIProcessor::fillPath( const uno::Reference< rendering::XPolyPol
core.git: sdext/source
sdext/source/pdfimport/tree/drawtreevisiting.cxx | 21 - sdext/source/pdfimport/tree/writertreevisiting.cxx | 21 - 2 files changed, 40 insertions(+), 2 deletions(-) New commits: commit 4b295b1b77b33c9a5b5fcfab58132ca0dcb7f90b Author: Dr. David Alan Gilbert AuthorDate: Mon Feb 12 01:24:07 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:27:48 2024 +0100 tdf#113050 sdext.pdfimport: Create the fill-image style and use it In a poly which is being image filled, we need to create a style with the actual image definition in the 'Contents' and then set the (automatically created) name of this in the prop on the main style. Also we need to set draw:fill to "bitmap" rather than "solid" Change-Id: I253704519011e98fd106331ccfb139ad93ef6dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163572 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index 5aae54415800..2c02adde8874 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -817,10 +817,29 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::uniqu aGCProps[ "draw:stroke" ] = "none"; } +if (elem.FillImage != -1) +{ +PropertyMap props; +// The image isn't actually in a prop, it's in an extra chunk inside. +StyleContainer::Style style("draw:fill-image"_ostr, std::move(props)); +style.Contents = m_rProcessor.getImages().asBase64EncodedString(elem.FillImage); +aGCProps[ "draw:fill-image-name" ] = +m_rStyleContainer.getStyleName( +m_rStyleContainer.getStyleId(style)); + +} + // TODO(F1): check whether stuff could be emulated by gradient/bitmap/hatch if( elem.Action & (PATH_FILL | PATH_EOFILL) ) { -aGCProps[ "draw:fill" ] = "solid"; +if (elem.FillImage == -1) +{ +aGCProps[ "draw:fill" ] = "solid"; +} +else +{ +aGCProps[ "draw:fill" ] = "bitmap"; +} aGCProps[ "draw:fill-color" ] = getColorString(rGC.FillColor); if (rGC.FillColor.Alpha != 1.0) aGCProps["draw:opacity"] = getPercentString(rGC.FillColor.Alpha * 100.0); diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index 9ecce8f48be4..746fc9e77eb2 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -995,10 +995,29 @@ void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::uni aGCProps[ "draw:stroke" ] = "none"; } +if (elem.FillImage != -1) +{ +PropertyMap props; +// The image isn't actually in a prop, it's in an extra chunk inside. +StyleContainer::Style style("draw:fill-image"_ostr, std::move(props)); +style.Contents = m_rProcessor.getImages().asBase64EncodedString(elem.FillImage); +aGCProps[ "draw:fill-image-name" ] = +m_rStyleContainer.getStyleName( +m_rStyleContainer.getStyleId(style)); + +} + // TODO(F1): check whether stuff could be emulated by gradient/bitmap/hatch if( elem.Action & (PATH_FILL | PATH_EOFILL) ) { -aGCProps[ "draw:fill" ] = "solid"; +if (elem.FillImage == -1) +{ +aGCProps[ "draw:fill" ] = "solid"; +} +else +{ +aGCProps[ "draw:fill" ] = "bitmap"; +} aGCProps[ "draw:fill-color" ] = getColorString( rGC.FillColor ); } else
core.git: sdext/source
sdext/source/pdfimport/inc/pdfiprocessor.hxx |1 + 1 file changed, 1 insertion(+) New commits: commit 9f21f816a16914e06ff141a800a63f0966e387b2 Author: Dr. David Alan Gilbert AuthorDate: Mon Feb 12 01:29:38 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:26:58 2024 +0100 tdf#113050 sdext.pdfimport: Expose the ImageContainer const I need the finalisers to be able to read an image, they have a ref to the processor but not the emitter; so allow the container to be read via the processor reference. Change-Id: Ifd3b2af1d456561ad42ae3e7c664f03b2e0c971c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163571 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx b/sdext/source/pdfimport/inc/pdfiprocessor.hxx index 40cdbfdd48c9..89a09d1780bf 100644 --- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx +++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx @@ -71,6 +71,7 @@ namespace pdfi const GraphicsContext& getGraphicsContext( sal_Int32 nGCId ) const; GraphicsContext& getCurrentContext() { return m_aGCStack.back(); } const GraphicsContext& getCurrentContext() const { return m_aGCStack.back(); } +const ImageContainer& getImages() const { return m_aImages; }; const css::uno::Reference< css::task::XStatusIndicator >& getStatusIndicator() const { return m_xStatusIndicator; }
core.git: sdext/source
sdext/source/pdfimport/inc/genericelements.hxx |7 --- sdext/source/pdfimport/tree/genericelements.cxx |6 -- sdext/source/pdfimport/tree/pdfiprocessor.cxx | 15 ++- 3 files changed, 18 insertions(+), 10 deletions(-) New commits: commit 2bf5664823e7ef71d917fe95a2c3d92e46d77c32 Author: Dr. David Alan Gilbert AuthorDate: Mon Feb 12 01:14:06 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:26:40 2024 +0100 tdf#113050 sdext.pdfimport: Add FillImage field to PolyPolyElement Use -1 to mean the existing solid fill, otherwise it's the ID of the image to use as the fill. Change-Id: I596c26145f5285f75af631a3bb7ddf09600982a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163570 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/inc/genericelements.hxx b/sdext/source/pdfimport/inc/genericelements.hxx index 6d1459a1f032..4332d4f1372b 100644 --- a/sdext/source/pdfimport/inc/genericelements.hxx +++ b/sdext/source/pdfimport/inc/genericelements.hxx @@ -213,7 +213,7 @@ namespace pdfi friend class ElementFactory; PolyPolyElement( Element* pParent, sal_Int32 nGCId, const basegfx::B2DPolyPolygon& rPolyPoly, - sal_Int8 nAction ); + sal_Int8 nAction, ImageId nFillImage ); public: virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr >::const_iterator& rParentIt ) override; @@ -225,6 +225,7 @@ namespace pdfi basegfx::B2DPolyPolygon PolyPoly; sal_Int8Action; +ImageId FillImage; }; struct ImageElement final : public DrawElement @@ -299,8 +300,8 @@ namespace pdfi createPolyPolyElement( Element* pParent, sal_Int32 nGCId, const basegfx::B2DPolyPolygon& rPolyPoly, - sal_Int8 nAction) -{ return new PolyPolyElement( pParent, nGCId, rPolyPoly, nAction ); } + sal_Int8 nAction, ImageId nFillImage ) +{ return new PolyPolyElement( pParent, nGCId, rPolyPoly, nAction, nFillImage ); } static ImageElement* createImageElement( Element* pParent, sal_Int32 nGCId, ImageId nImage ) { return new ImageElement( pParent, nGCId, nImage ); } diff --git a/sdext/source/pdfimport/tree/genericelements.cxx b/sdext/source/pdfimport/tree/genericelements.cxx index 1d11cd0d914e..100e145608aa 100644 --- a/sdext/source/pdfimport/tree/genericelements.cxx +++ b/sdext/source/pdfimport/tree/genericelements.cxx @@ -124,10 +124,12 @@ void ImageElement::visitedBy( ElementTreeVisitor& rVisi PolyPolyElement::PolyPolyElement( Element* pParent, sal_Int32 nGCId, const basegfx::B2DPolyPolygon& rPolyPoly, - sal_Int8 nAction ) + sal_Int8 nAction, + ImageIdnFillImage ) : DrawElement( pParent, nGCId ), PolyPoly( rPolyPoly ), - Action( nAction ) + Action( nAction ), + FillImage( nFillImage ) { } diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 32280f8fd110..0ef30a176ed2 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -389,9 +389,10 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1, double nxStep, double nyStep, int /* nPaintType */, css::geometry::AffineMatrix2D& rMat, - const css::uno::Sequence& /*xTile*/) + const css::uno::Sequence& xTile) { const GraphicsContext& rGC(getCurrentContext()); +auto nTile = m_aImages.addImage(xTile); basegfx::B2DTuple aScale, aTranslation; double fRotate, fShearX; @@ -431,7 +432,8 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1, m_pCurElement, getGCId(getCurrentContext()), aB2DPoly, -PATH_EOFILL ); // Hmm how do I know if this should be EO or not? +PATH_EOFILL, // Hmm how do I know if this should be EO or not? +nTile ); pPolyElement->updateGeometry(); pPolyElement->ZOrder = m_nNextZOrder++; } @@ -445,7 +447,8 @@ void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D m_pCurElement, getGCId(getCurrentContext()), aPoly, -PATH_ST
core.git: sdext/source
sdext/source/pdfimport/inc/imagecontainer.hxx |1 sdext/source/pdfimport/tree/imagecontainer.cxx | 31 + 2 files changed, 32 insertions(+) New commits: commit d7e5eae44e18ab89e85a0e6ed633853ede70ec71 Author: Dr. David Alan Gilbert AuthorDate: Mon Feb 12 00:44:31 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:26:04 2024 +0100 tdf#113050 sdext.pdfimport: Add ImageContainer::asBase64EncodedString' For fill-images we need the image as a string. Change-Id: I4a8429563b0e19ad977b4e933a0ffee378dab244 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163569 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/inc/imagecontainer.hxx b/sdext/source/pdfimport/inc/imagecontainer.hxx index d21ed7504f63..03672e8ca8b2 100644 --- a/sdext/source/pdfimport/inc/imagecontainer.hxx +++ b/sdext/source/pdfimport/inc/imagecontainer.hxx @@ -42,6 +42,7 @@ namespace pdfi ImageId addImage( const css::uno::Sequence< css::beans::PropertyValue>& xBitmap ); void writeBase64EncodedStream( ImageId nImageId, EmitContext& rContext ); +OUString asBase64EncodedString( ImageId nId ) const; }; } diff --git a/sdext/source/pdfimport/tree/imagecontainer.cxx b/sdext/source/pdfimport/tree/imagecontainer.cxx index a7154164d771..b9f7ef52e061 100644 --- a/sdext/source/pdfimport/tree/imagecontainer.cxx +++ b/sdext/source/pdfimport/tree/imagecontainer.cxx @@ -141,6 +141,37 @@ void ImageContainer::writeBase64EncodedStream( ImageId nId, EmitContext& rContex rContext.rEmitter.write( encodeBase64( aData.getConstArray(), aData.getLength() )); } +OUString ImageContainer::asBase64EncodedString( ImageId nId ) const +{ +OSL_ASSERT( nId >= 0 && o3tl::make_unsigned(nId) < m_aImages.size() ); + +const uno::Sequence& rEntry( m_aImages[nId] ); + +// find "InputSequence" property +const beans::PropertyValue* pAry(rEntry.getConstArray()); +const sal_Int32 nLen(rEntry.getLength()); +const beans::PropertyValue* pValue( +std::find_if(pAry, pAry+nLen, +[] (beans::PropertyValue const& v) -> bool { +return v.Name == "InputSequence"; +})); + +if (pValue == pAry + nLen ) +{ +SAL_WARN("sdext.pdfimport", "InputSequence not found"); +return ""; +} + +uno::Sequence aData; +if( !(pValue->Value >>= aData) ) +{ +SAL_WARN("sdext.pdfimport", "Wrong data type"); +return ""; +} + +return encodeBase64( aData.getConstArray(), aData.getLength() ); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
core.git: sdext/source
sdext/source/pdfimport/tree/style.cxx |4 1 file changed, 4 insertions(+) New commits: commit ff160e93d32c62e09b28393979b3535e01057cdc Author: Dr. David Alan Gilbert AuthorDate: Mon Feb 12 00:38:42 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:25:35 2024 +0100 tdf#113050 sdext.pdfimport: In styles wrap 'Contents' For draw:fill-image we need output like: Base64stuff https://gerrit.libreoffice.org/c/core/+/163568 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx index b97b1d3e9cdf..969fdc0e9648 100644 --- a/sdext/source/pdfimport/tree/style.cxx +++ b/sdext/source/pdfimport/tree/style.cxx @@ -197,7 +197,11 @@ void StyleContainer::impl_emitStyle( sal_Int32 nStyleId, for(sal_Int32 nSubStyle : rStyle.SubStyles) impl_emitStyle( nSubStyle, rContext, rContainedElemVisitor ); if( !rStyle.Contents.isEmpty() ) +{ +rContext.rEmitter.beginTag( "office:binary-data", PropertyMap() ); rContext.rEmitter.write( rStyle.Contents ); +rContext.rEmitter.endTag( "office:binary-data" ); +} if( rStyle.ContainedElement ) rStyle.ContainedElement->visitedBy( rContainedElemVisitor, std::list>::iterator() );
core.git: sdext/source
sdext/source/pdfimport/tree/style.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit bc5bd022a9ea8128bd5e9ba02bda48332dccbbe4 Author: Dr. David Alan Gilbert AuthorDate: Sat Feb 10 01:00:18 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:25:08 2024 +0100 tdf#113050 sdext.pdfimport: In styles Specialise draw:fill-image Like stroke-dash, draw:fill-image needs the name setting in the draw:name attribute. Change-Id: Ib9c888765af8bfb0849f0f1ef15f9774808a1661 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163567 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx index 3f1d20eb4244..b97b1d3e9cdf 100644 --- a/sdext/source/pdfimport/tree/style.cxx +++ b/sdext/source/pdfimport/tree/style.cxx @@ -190,7 +190,7 @@ void StyleContainer::impl_emitStyle( sal_Int32 nStyleId, PropertyMap aProps( rStyle.Properties ); if( !rStyle.IsSubStyle ) aProps[ "style:name" ] = getStyleName( nStyleId ); -if (rStyle.Name == "draw:stroke-dash") +if (rStyle.Name == "draw:stroke-dash" || rStyle.Name == "draw:fill-image") aProps[ "draw:name" ] = aProps[ "style:name" ]; rContext.rEmitter.beginTag( rStyle.Name.getStr(), aProps );
core.git: sdext/source
sdext/source/pdfimport/tree/pdfiprocessor.cxx | 52 -- 1 file changed, 48 insertions(+), 4 deletions(-) New commits: commit 2350357d5cc2ac1787816ce887af6e9f36b8d252 Author: Dr. David Alan Gilbert AuthorDate: Fri Feb 9 02:42:30 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:24:48 2024 +0100 tdf#113050 sdext.pdfimport: Create poly for tiling pattern Create a poly for the tiling pattern fill. Change-Id: Iaeadfe51bed6d4de87f36b3a78145829ea8443e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163566 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index cf65223f167a..32280f8fd110 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -28,6 +28,8 @@ #include +#include + #include #include #include @@ -383,13 +385,55 @@ void PDFIProcessor::drawAlphaMaskedImage(const uno::Sequence& /*xTile*/) { -// TODO +const GraphicsContext& rGC(getCurrentContext()); + +basegfx::B2DTuple aScale, aTranslation; +double fRotate, fShearX; +auto rTfm = rGC.Transformation; +rTfm.decompose(aScale, aTranslation, fRotate, fShearX); + +// Build a poly covering the whole fill area +double np0x = nX0 * nxStep; +double np0y = nY0 * nyStep; +double np1x = nX1 * nxStep; +double np1y = nY1 * nyStep; + +// Transform with the rMat passed in +double tmpx, tmpy; +tmpx = np0x * rMat.m00 + np0y * rMat.m01 + rMat.m02; +tmpy = np0x * rMat.m10 + np0y * rMat.m11 + rMat.m12; +np0x = tmpx; +np0y = tmpy; +tmpx = np1x * rMat.m00 + np1y * rMat.m01 + rMat.m02; +tmpy = np1x * rMat.m10 + np1y * rMat.m11 + rMat.m12; +np1x = tmpx; +np1y = tmpy; + +auto aB2DPoly = basegfx::B2DPolyPolygon(basegfx::utils::createPolygonFromRect(basegfx::B2DRange(np0x, np0y, np1x, np1y))); +aB2DPoly.transform(getCurrentContext().Transformation); + +// Clip against current clip path, if any +basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip; +if( aCurClip.count() ) { +aB2DPoly = basegfx::utils::clipPolyPolygonOnPolyPolygon( aB2DPoly, aCurClip, + true, /* bInside, keep parts inside the clip */ + false /* bStroke, filled not stroked */ ); +} +// TODO: That clipping might shift the fill pattern offsets + +auto pPolyElement = ElementFactory::createPolyPolyElement( +m_pCurElement, +getGCId(getCurrentContext()), +aB2DPoly, +PATH_EOFILL ); // Hmm how do I know if this should be EO or not? +pPolyElement->updateGeometry(); +pPolyElement->ZOrder = m_nNextZOrder++; } void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D >& rPath )
core.git: sdext/qa sdext/source
sdext/qa/unit/pdfimport.cxx |8 sdext/source/pdfimport/inc/contentsink.hxx|5 + sdext/source/pdfimport/inc/pdfiprocessor.hxx |6 ++ sdext/source/pdfimport/tree/pdfiprocessor.cxx |9 + sdext/source/pdfimport/wrapper/wrapper.cxx| 11 +++ 5 files changed, 35 insertions(+), 4 deletions(-) New commits: commit 4a13e1890e8a0ed81e8fb17009185fa2b15ebff7 Author: Dr. David Alan Gilbert AuthorDate: Sun Feb 18 22:06:02 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:24:17 2024 +0100 tdf#113050 sdext.pdfimport: Plumb tiling pattern fill to pdfiprocessor Change-Id: I68459834fd903d31c9b2e57d637265dd67da4f56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163565 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/qa/unit/pdfimport.cxx b/sdext/qa/unit/pdfimport.cxx index 377d08d351f8..18988d6845de 100644 --- a/sdext/qa/unit/pdfimport.cxx +++ b/sdext/qa/unit/pdfimport.cxx @@ -428,6 +428,14 @@ namespace { } +virtual void tilingPatternFill(int, int, int, int, + double, double, + int, + css::geometry::AffineMatrix2D&, + const css::uno::Sequence&) override +{ +} + typedef std::unordered_map IdToFontMap; typedef std::unordered_map FontToIdMap; diff --git a/sdext/source/pdfimport/inc/contentsink.hxx b/sdext/source/pdfimport/inc/contentsink.hxx index 44f609c3caaa..5354e4370f14 100644 --- a/sdext/source/pdfimport/inc/contentsink.hxx +++ b/sdext/source/pdfimport/inc/contentsink.hxx @@ -171,6 +171,11 @@ namespace pdfi css::beans::PropertyValue>& xImage, const css::uno::Sequence< css::beans::PropertyValue>& xMask) = 0; +virtual void tilingPatternFill(int nX0, int nY0, int nX1, int nY1, + double nxStep, double nyStep, + int nPaintType, + css::geometry::AffineMatrix2D& rMat, + const css::uno::Sequence& xTile) = 0; }; typedef std::shared_ptr ContentSinkSharedPtr; diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx b/sdext/source/pdfimport/inc/pdfiprocessor.hxx index 3fdc146716b3..40cdbfdd48c9 100644 --- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx +++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx @@ -150,6 +150,12 @@ namespace pdfi const css::uno::Sequence< css::beans::PropertyValue>& xMask) override; +virtual void tilingPatternFill(int nX0, int nY0, int nX1, int nY1, + double nxStep, double nyStep, + int nPaintType, + css::geometry::AffineMatrix2D& rMat, + const css::uno::Sequence& xTile) override; + void startIndicator( const OUString& rText ); void endIndicator(); diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 44485f4c2525..cf65223f167a 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -383,6 +383,15 @@ void PDFIProcessor::drawAlphaMaskedImage(const uno::Sequence& /*xTile*/) +{ +// TODO +} + void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D >& rPath ) { basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath); diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 6094bfabcbbc..d99103b9867a 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -838,10 +838,13 @@ void LineParser::readTilingPatternFill() readDouble(aMat.m12); // The tile is an image with alpha -[[maybe_unused]]const uno::Sequence aTile ( readImageImpl() ); -(void)aTile; // Unused until later patch -// TODO -// use the parsed data +const uno::Sequence aTile ( readImageImpl() ); + +m_parser.m_pSink->tilingPatternFill( nX0, nY0, nX1, nY1, + nXStep, nYStep, + nPaintType, + aMat, + aTile ); } void Parser::parseLine( std::string_view aLine )
core.git: sdext/source
sdext/source/pdfimport/wrapper/keyword_list |1 sdext/source/pdfimport/wrapper/wrapper.cxx | 33 2 files changed, 34 insertions(+) New commits: commit ec0b9062dc8dba82509183eb865da55827bde4d5 Author: Dr. David Alan Gilbert AuthorDate: Wed Jan 24 02:10:18 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:23:54 2024 +0100 tdf#113050 sdext.pdfimport Tiling pattern fill parser Add a parser for the TilingPatternFill entry from the poppler wrapper. This doesn't get triggered yet until the wrapper enables the tilingPatternFill. Change-Id: I34ab84ba1ab9d6773f33d667b324bef5d6c6e409 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163564 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/wrapper/keyword_list b/sdext/source/pdfimport/wrapper/keyword_list index bf15ddb2460f..4d1e6d2d4013 100644 --- a/sdext/source/pdfimport/wrapper/keyword_list +++ b/sdext/source/pdfimport/wrapper/keyword_list @@ -38,6 +38,7 @@ setTextRenderMode,SETTEXTRENDERMODE setTransformation,SETTRANSFORMATION startPage,STARTPAGE strokePath,STROKEPATH +tilingPatternFill,TILINGPATTERNFILL updateBlendMode,UPDATEBLENDMODE updateCtm,UPDATECTM updateFillColor,UPDATEFILLCOLOR diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index ade4dc5edb6b..6094bfabcbbc 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -107,6 +107,7 @@ enum parseKey { SETTRANSFORMATION, STARTPAGE, STROKEPATH, +TILINGPATTERNFILL, UPDATEBLENDMODE, UPDATECTM, UPDATEFILLCOLOR, @@ -195,6 +196,7 @@ public: void readLink(); void readMaskedImage(); void readSoftMaskedImage(); +void readTilingPatternFill(); }; /** Unescapes line-ending characters in input string. These @@ -813,6 +815,35 @@ void LineParser::readSoftMaskedImage() m_parser.m_pSink->drawAlphaMaskedImage( aImage, aMask ); } +void LineParser::readTilingPatternFill() +{ +sal_Int32 nX0, nY0, nX1, nY1, nPaintType; +double nXStep, nYStep; +geometry::AffineMatrix2D aMat; +readInt32(nX0); +readInt32(nY0); +readInt32(nX1); +readInt32(nY1); + +readDouble(nXStep); +readDouble(nYStep); + +readInt32(nPaintType); + +readDouble(aMat.m00); +readDouble(aMat.m10); +readDouble(aMat.m01); +readDouble(aMat.m11); +readDouble(aMat.m02); +readDouble(aMat.m12); + +// The tile is an image with alpha +[[maybe_unused]]const uno::Sequence aTile ( readImageImpl() ); +(void)aTile; // Unused until later patch +// TODO +// use the parsed data +} + void Parser::parseLine( std::string_view aLine ) { OSL_PRECOND( m_pSink, "Invalid sink" ); @@ -865,6 +896,8 @@ void Parser::parseLine( std::string_view aLine ) } case STROKEPATH: m_pSink->strokePath(lp.readPath()); break; +case TILINGPATTERNFILL: +lp.readTilingPatternFill(); break; case UPDATECTM: lp.readTransformation(); break; case UPDATEFILLCOLOR:
core.git: sdext/source
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 44 +- 1 file changed, 42 insertions(+), 2 deletions(-) New commits: commit b7a63d26466bac7eb7b25233a5a53788bed88c81 Author: Dr. David Alan Gilbert AuthorDate: Sun Feb 18 22:00:37 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:23:28 2024 +0100 tdf#113050 sdext.pdfimport: Flip bitmap We need to flip the bitmap between the wrapper and LO, but there's no easy way to do this in a Poly image fill in LO, so do it as a simple bitmap flip in the wrapper. Change-Id: Ifd84d37926c21edf30654d3884be975849a6dca3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163563 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index 57eb30092141..ec2632b74899 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -432,8 +432,6 @@ static void writeImage_( OutputBuffer& o_rOutputBuf, } // forwarders - - static void writeImageLF( OutputBuffer& o_rOutputBuf, Stream* str, int width, @@ -445,6 +443,45 @@ static void writeMaskLF( OutputBuffer& o_rOutputBuf, int height, bool bInvert ) { writeMask_(o_rOutputBuf,str,width,height,bInvert); } +// Vertically flip the bitmap +static void flipSplashBitmap(SplashBitmap *pBitmap) +{ +if (pBitmap->getRowSize() <= 0) +return; + +auto nBitmapHeight = static_cast(pBitmap->getHeight()); +auto nRowSize = static_cast(pBitmap->getRowSize()); +auto nAlphaRowSize = static_cast(pBitmap->getAlphaRowSize()); + +auto aTmpRow = new unsigned char[nRowSize]; +auto aTmpAlphaRow = new unsigned char[nAlphaRowSize]; + +auto pBitmapData = pBitmap->getDataPtr(); +auto pAlphaData = pBitmap->getAlphaPtr(); + +// Set up pairs of pointers working from each end of the bitmap +auto pCurRowA = pBitmapData; +auto pCurAlphaA = pAlphaData; +auto pCurRowB = pBitmapData+nRowSize*(nBitmapHeight-1); +auto pCurAlphaB = pAlphaData+nAlphaRowSize*(nBitmapHeight-1); + +for (size_t nCur = 0; + nCur < nBitmapHeight/2; + nCur++, pCurRowA+=nRowSize, pCurRowB-=nRowSize, + pCurAlphaA+=nAlphaRowSize, pCurAlphaB-=nAlphaRowSize) +{ +memcpy(aTmpRow, pCurRowA, nRowSize); +memcpy(pCurRowA, pCurRowB, nRowSize); +memcpy(pCurRowB, aTmpRow, nRowSize); + +memcpy(aTmpAlphaRow, pCurAlphaA, nAlphaRowSize); +memcpy(pCurAlphaA, pCurAlphaB, nAlphaRowSize); +memcpy(pCurAlphaB, aTmpAlphaRow, nAlphaRowSize); +} +delete[] aTmpRow; +delete[] aTmpAlphaRow; +} + int PDFOutDev::parseFont( long long nNewId, GfxFont* gfxFont, const GfxState* state ) const { FontAttributes aNewFont; @@ -1236,6 +1273,9 @@ poppler_bool PDFOutDev::tilingPatternFill(GfxState *state, Gfx *, Catalog *, delete pSplashGfx; delete pSplashOut; +// Add a vertical flip, we can't do this in LO for an image filled poly +flipSplashBitmap(pSplashBitmap); + auto nBitmapWidth = static_cast(pSplashBitmap->getWidth()); auto nBitmapHeight = static_cast(pSplashBitmap->getHeight());
core.git: sdext/source
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 64 +- 1 file changed, 62 insertions(+), 2 deletions(-) New commits: commit 8ac5f40b330c6cd248073b8686c05f566ecd7195 Author: Dr. David Alan Gilbert AuthorDate: Sun Feb 18 21:45:42 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:22:38 2024 +0100 tdf#113050 sdext.pdfimport: Write the tiling pattern image Render the tile down to a common format using Splash and write it to the stream. Change-Id: Iccc451d1a02ed2ad77538883ab3fe5542fc633e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163562 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index e7afe67afef4..57eb30092141 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -1182,13 +1182,15 @@ void PDFOutDev::setSkipImages( bool bSkipImages ) } #if POPPLER_CHECK_VERSION(21, 3, 0) -poppler_bool PDFOutDev::tilingPatternFill(GfxState *, Gfx *, Catalog *, +poppler_bool PDFOutDev::tilingPatternFill(GfxState *state, Gfx *, Catalog *, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) { const double *pBbox = tPat->getBBox(); const int nPaintType = tPat->getPaintType(); +Dict *pResDict = tPat->getResDict(); +Object *aStr = tPat->getContentStream(); double nWidth = pBbox[2] - pBbox[0]; double nHeight = pBbox[3] - pBbox[1]; @@ -1215,7 +1217,65 @@ poppler_bool PDFOutDev::tilingPatternFill(GfxState *, Gfx *, Catalog *, normalize(mat[4]), normalize(mat[5]) ); -// TODO: Write the image +PDFRectangle aBox; +aBox.x1 = pBbox[0]; +aBox.y1 = pBbox[1]; +aBox.x2 = pBbox[2]; +aBox.y2 = pBbox[3]; + +const int nDPI = 72; // GfxState seems to have 72.0 as magic for some reason +auto pSplashGfxState = new GfxState(nDPI, nDPI, , 0, false); +auto pSplashOut = new SplashOutputDev(splashModeRGB8, 1, false, nullptr); +pSplashOut->setEnableFreeType(false); +pSplashOut->startPage(0 /* pageNum */, pSplashGfxState, nullptr /* xref */); + +auto pSplashGfx = new Gfx(m_pDoc, pSplashOut, pResDict, , nullptr); +pSplashGfx->display(aStr); +auto pSplashBitmap = pSplashOut->takeBitmap(); +delete pSplashGfxState; +delete pSplashGfx; +delete pSplashOut; + +auto nBitmapWidth = static_cast(pSplashBitmap->getWidth()); +auto nBitmapHeight = static_cast(pSplashBitmap->getHeight()); + +char *pBitmapData = reinterpret_cast(pSplashBitmap->getDataPtr()); +if (nPaintType == 2) +{ +// My understanding is Type 2 fills are just bitmaps of *what* to fill +// in the current fill colour. +// sending it to LO as a flat colour image with the alpha map is easiest +GfxRGB aCurFill; +unsigned char r,g,b; +state->getFillColorSpace()->getRGB(state->getFillColor(), ); +r = colToByte(aCurFill.r); +g = colToByte(aCurFill.g); +b = colToByte(aCurFill.b); + +for(size_t i=0; i < (nBitmapWidth * nBitmapHeight * 3); i+=3) +{ +pBitmapData[i ] = r; +pBitmapData[i+1] = g; +pBitmapData[i+2] = b; +} +} + +auto pRgbStr = new MemStream(pBitmapData, 0, +nBitmapWidth * nBitmapHeight * 3, Object(objNull)); +auto pAlphaStr = new MemStream(reinterpret_cast(pSplashBitmap->getAlphaPtr()), 0, +nBitmapWidth * nBitmapHeight, Object(objNull)); +auto aDecode = Object(objNull); +auto pRgbIdentityColorMap = new GfxImageColorMap(8, , new GfxDeviceRGBColorSpace()); +auto pGrayIdentityColorMap = new GfxImageColorMap(8, , new GfxDeviceGrayColorSpace()); + +OutputBuffer aBuf; initBuf(aBuf); +writePng_(aBuf, pRgbStr, nBitmapWidth, nBitmapHeight, pRgbIdentityColorMap, +pAlphaStr, nBitmapWidth, nBitmapHeight, pGrayIdentityColorMap); +writeBinaryBuffer(aBuf); + +delete pAlphaStr; +delete pRgbStr; +delete pSplashBitmap; // If we return false here we can fall back to the slow path return true;
core.git: sdext/source
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 64 +- sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx |7 + 2 files changed, 70 insertions(+), 1 deletion(-) New commits: commit 8e4a351f12d777ad9102086298741d0a97e5eeb9 Author: Dr. David Alan Gilbert AuthorDate: Mon Jan 15 02:09:39 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:21:09 2024 +0100 tdf#113050 sdext.pdfimport: Write the tiling pattern header Add the 'tilingPatternFill' hook to our output device, but don't enable it yet; we can do that at the end of the series. Change-Id: Id52b023c3025f5addce1ab09663da9b8bd8a75e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163561 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index 2517618e1019..e7afe67afef4 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -20,6 +20,25 @@ #include "pdfioutdev_gpl.hxx" #include "pnghelper.hxx" +#if defined __GNUC__ || defined __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +#elif defined _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4100) // unreferenced formal parameter +#pragma warning(disable : 4121) // alignment of a member was sensitive to packing in Gfx.h/Operator +#endif + +#include +#include +#include +#if defined __GNUC__ || defined __clang__ +# pragma GCC diagnostic pop +#elif defined _MSC_VER +#pragma warning(pop) +#endif + + #include #include #include @@ -426,7 +445,6 @@ static void writeMaskLF( OutputBuffer& o_rOutputBuf, int height, bool bInvert ) { writeMask_(o_rOutputBuf,str,width,height,bInvert); } - int PDFOutDev::parseFont( long long nNewId, GfxFont* gfxFont, const GfxState* state ) const { FontAttributes aNewFont; @@ -1163,6 +1181,50 @@ void PDFOutDev::setSkipImages( bool bSkipImages ) m_bSkipImages = bSkipImages; } +#if POPPLER_CHECK_VERSION(21, 3, 0) +poppler_bool PDFOutDev::tilingPatternFill(GfxState *, Gfx *, Catalog *, + GfxTilingPattern *tPat, const double *mat, + int x0, int y0, int x1, int y1, + double xStep, double yStep) +{ +const double *pBbox = tPat->getBBox(); +const int nPaintType = tPat->getPaintType(); +double nWidth = pBbox[2] - pBbox[0]; +double nHeight = pBbox[3] - pBbox[1]; + +// If our wrapper is skipping images then we don't need to do anything +// but return 'true' so that Poppler doesn't do the slow method +if (m_bSkipImages) +return true; + +// Copied from the Cairo output dev; I think this is patterns +// with gaps, let poppler do the slow method for now. +if (xStep != nWidth || yStep != nHeight) +return false; + +printf( "tilingPatternFill %d %d %d %d %f %f " +"%d " +"%f %f %f %f %f %f", // No ending space! + +x0, y0, x1, y1, normalize(xStep), normalize(yStep), + +nPaintType, + +normalize(mat[0]), normalize(mat[1]), +normalize(mat[2]), normalize(mat[3]), +normalize(mat[4]), normalize(mat[5]) +); + +// TODO: Write the image + +// If we return false here we can fall back to the slow path +return true; +} + +// This could be implemented for earlier versions, but the interface keeps +// changing a little; not having it is only a problem for inputs with +// large patterns. +#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx index b34fad1ba90a..f38bf423423b 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx @@ -283,6 +283,13 @@ namespace pdfi static void setPageNum( int nNumPages ); void setSkipImages ( bool bSkipImages ); +#if POPPLER_CHECK_VERSION(21, 3, 0) +poppler_bool useTilingPatternFill() override { return false; }; +poppler_bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, + GfxTilingPattern *tPat, const double *mat, + int x0, int y0, int x1, int y1, + double xStep, double yStep) override; +#endif }; }
core.git: external/poppler
external/poppler/StaticLibrary_poppler.mk | 13 + external/poppler/disable-freetype.patch.1 | 68 ++ external/poppler/poppler-config.patch.1 |2 3 files changed, 82 insertions(+), 1 deletion(-) New commits: commit 18a1c3d6c98348d4e3da6e6c9740d6923ab2fba1 Author: Dr. David Alan Gilbert AuthorDate: Thu Jan 11 01:26:04 2024 + Commit: Noel Grandin CommitDate: Thu Feb 29 08:20:20 2024 +0100 tdf#113050 poppler: Enable splash Enable the splash module, to be used in the xpdf conversion for tiled patterns. I've jumped through a couple of hoops to avoid splash bringing in freetype, extending the existing hack. This might cause us problems if someone tries to use text as a tile, but otherwise isOK. Change-Id: I76ad1268f44137ae5e3205d56170c3a7c55a2dc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163560 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk index 7b6f958245ac..726663d983a4 100644 --- a/external/poppler/StaticLibrary_poppler.mk +++ b/external/poppler/StaticLibrary_poppler.mk @@ -136,6 +136,7 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\ UnpackedTarball/poppler/poppler/SecurityHandler \ UnpackedTarball/poppler/poppler/SignatureInfo \ UnpackedTarball/poppler/poppler/Sound \ + UnpackedTarball/poppler/poppler/SplashOutputDev \ UnpackedTarball/poppler/poppler/Stream \ UnpackedTarball/poppler/poppler/StructElement \ UnpackedTarball/poppler/poppler/StructTreeRoot \ @@ -146,7 +147,19 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\ UnpackedTarball/poppler/poppler/UnicodeTypeTable \ UnpackedTarball/poppler/poppler/ViewerPreferences \ UnpackedTarball/poppler/poppler/XRef \ + UnpackedTarball/poppler/splash/Splash \ UnpackedTarball/poppler/splash/SplashBitmap \ + UnpackedTarball/poppler/splash/SplashClip \ + UnpackedTarball/poppler/splash/SplashFont \ + UnpackedTarball/poppler/splash/SplashFontEngine \ + UnpackedTarball/poppler/splash/SplashFontFile \ + UnpackedTarball/poppler/splash/SplashFontFileID \ + UnpackedTarball/poppler/splash/SplashPath \ + UnpackedTarball/poppler/splash/SplashPattern \ + UnpackedTarball/poppler/splash/SplashScreen \ + UnpackedTarball/poppler/splash/SplashState \ + UnpackedTarball/poppler/splash/SplashXPath \ + UnpackedTarball/poppler/splash/SplashXPathScanner \ )) # vim: set noet sw=4 ts=4: diff --git a/external/poppler/disable-freetype.patch.1 b/external/poppler/disable-freetype.patch.1 index 3c4d1d0f7a8a..d12374f088f9 100644 --- a/external/poppler/disable-freetype.patch.1 +++ b/external/poppler/disable-freetype.patch.1 @@ -39,3 +39,71 @@ disable freetype dependent code } std::string Form::getFallbackFontForChar(Unicode uChar, const GfxFont ) const +--- poppler/splash/SplashFontEngine.cc.orig2024-02-21 01:28:10.479645185 + popller/splash/SplashFontEngine.cc 2023-09-05 22:15:14.0 +0100 +@@ -66,9 +66,9 @@ + delete font; + } + +-if (ftEngine) { +-delete ftEngine; +-} ++//if (ftEngine) { ++//delete ftEngine; ++//} + } + + SplashFontFile *SplashFontEngine::getFontFile(SplashFontFileID *id) +--- poppler/splash/SplashFTFontEngine.h.orig 2023-09-05 22:15:14.0 +0100 poppler/splash/SplashFTFontEngine.h2024-02-21 13:53:29.715423742 + +@@ -26,8 +26,8 @@ + #ifndef SPLASHFTFONTENGINE_H + #define SPLASHFTFONTENGINE_H + +-#include +-#include FT_FREETYPE_H ++//#include ++//#include FT_FREETYPE_H + + class SplashFontFile; + class SplashFontFileID; +@@ -40,7 +40,7 @@ + class SplashFTFontEngine + { + public: +-static SplashFTFontEngine *init(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHinting); ++static SplashFTFontEngine *init(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHinting) { return nullptr; }; + + ~SplashFTFontEngine(); + +@@ -48,22 +48,22 @@ + SplashFTFontEngine =(const SplashFTFontEngine &) = delete; + + // Load fonts. +-SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); +-SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); +-SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); +-SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src); +-SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen); +-SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen, int faceIndex = 0); ++SplashFontFile *loadType1Font(SplashFontFileID
core.git: sw/CppunitTest_sw_pdf_test.mk
sw/CppunitTest_sw_pdf_test.mk |2 ++ 1 file changed, 2 insertions(+) New commits: commit 56f45bf76f6cd6683e81b9d30131a7a4c5696340 Author: Dr. David Alan Gilbert AuthorDate: Thu Feb 22 11:36:14 2024 + Commit: Mike Kaganski CommitDate: Fri Feb 23 17:02:25 2024 +0100 CppunitTest_sw_pdf_test: Add dependency on xpdfimport The missing dependency would trigger the failure in: ::HybridPdfTest::testNoHybridDataInPDF warn:sal.osl:3173303:3173368:sal/osl/unx/process.cxx:349: Failed to launch child process, child reports ENOENT ? Couldn't exec xpdfimport? Change-Id: I5e887129d2119c71b993d9a3e26b9b17bb912452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163771 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/CppunitTest_sw_pdf_test.mk b/sw/CppunitTest_sw_pdf_test.mk index 0d9fd16985e7..6e4126fd3b06 100644 --- a/sw/CppunitTest_sw_pdf_test.mk +++ b/sw/CppunitTest_sw_pdf_test.mk @@ -43,6 +43,8 @@ $(eval $(call gb_CppunitTest_use_externals,sw_pdf_test,\ libxml2 \ )) +$(eval $(call gb_CppunitTest_use_executable,sw_pdf_test,xpdfimport)) + $(eval $(call gb_CppunitTest_set_include,sw_pdf_test,\ -I$(SRCDIR)/sw/inc \ -I$(SRCDIR)/sw/source/core/inc \
Re: Is it still possible to compile LibreOffice 24 for Linux 32-bit? (part 2)
* Escuelas Linux (escuelasli...@gmail.com) wrote: > Thanks to Dan Horák and Rene Engelhard for their answers! Best to keep the reply on the thread! > Dan said: > > > -"Because 32-bit system means max 4GB address space for a process and ld > runs as a single process". > > > I installed a PAE kernel, so it can effectively use more than 4 GB. PAE isn't quite that powerful. It can let the system use more than 4GB total, but any one process can't use more than 2 or 3GB. So it doesn't help if, say your linker process, decides it needs loads of RAM. Fundamentally that's a limit of using 32bit address space. > > -"You can try disabling or reducing the size of debuginfo to reduce the > size of the *.o files if it's used, you can disable LTO and there are some > options for ld to reduce its memory usage a bit". > > > I tried several permutations to reduce the amount of memory used. One of > them was to reduce the number of processors in my autogen.input: > > > --with-parallelism=1 Good. > Another one was to add this parameter when running make: > > > make LDFLAGS="-Wl,--reduce-memory-overheads" That looks like it's a specific trade off; not any of the specific things mentioned about debuginfo and ensuring LTO is disabled. If possible you should probably also include the exact command line of the process that dies. > > I also increased the available memory on the VM from 12 to 15 GB. But no > results, always got the exhausted memory message. Right, see what I said above about PAE not being that smart. > I also tried several other possible solutions, but it feels like going on a > wild goose chase without knowing exactly what to do, relying on some > general random advices found on the web. Dave > > - > > Rene said: > > > -"Debian still ships LibreOffice on 32bit archs, as do other distributions." > > > Oh! Thanks for the tip! I was not aware that Debian even has binary > LibreOffice 24.2 32-bit packages, albeit in the unstable branch. > > I was even able to build LibreOffice from source: > > > apt-get --build source libreoffice > > > This proves to me that the LibreOffice source code has not dropped 32-bit > support, but I still don't know why my own compilation attempts always > failed with a memory exhausted message, even with the same VM configuration. > > Would it be possible for me to just use the Debian LibreOffice 24.2 > binaries or its source packages? Not quite, as they also have a lot of > dependencies on packages that are only available in the unstable branch, so > they would not be suitable for a distribution intended for a stable Debian > 12 bookworm base. > > > -"I do -g1 in Debian. LTO works". > > > Where should I add the -g1 parameter? > > > -"make check fails. I do a minimal set (testtools bridgetest, smoketest, > sal, the other public libraries) to at least not get something > fundamentally broken". > > > My autogen.input file is: > > --with-parallelism=16 > > --with-distro=LibreOfficeLinux > > --with-lang=es > > --with-myspell-dicts > > --enable-release-build > > --with-package-format=deb > > --disable-dependency-tracking > > --with-jdk-home=/usr/lib/jvm/java-11-openjdk-i386/ > > --with-privacy-policy-url=NO-URL > > > -"And somehow the testtools bridgetest fails when building with gcc >= 13, > 12 works. Haven't found a solution yet.)" > > > I'm using gcc 13! Maybe this could be the cause of my compilation failures? > > I'll make some more attempts to compile LibreOffice 32-bit now using gcc > 12, any additional ideas or suggestions would be more than welcome. > > > Thanks again. -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
core.git: filter/source include/svx svx/source
filter/source/msfilter/escherex.cxx |8 filter/source/msfilter/msdffimp.cxx |9 include/svx/EnhancedCustomShapeGeometry.hxx |3 svx/source/customshapes/EnhancedCustomShapeGeometry.cxx | 376 svx/source/svdraw/svdoashp.cxx |8 5 files changed, 202 insertions(+), 202 deletions(-) New commits: commit 80785bb26a1f96d5f5bced7940473d22af00cb60 Author: Dr. David Alan Gilbert AuthorDate: Mon Jul 3 18:31:26 2023 +0100 Commit: Hossein CommitDate: Tue Dec 12 10:57:20 2023 +0100 tdf#147021 Use std::span to avoid SAL_N_ELEMENTS in CustomShape The final set of these, nailing the 'handles'. Again, most of the changes are mechanical Change-Id: Ic65cec21db2366bcfa6ac40bcf9041b081c2ed71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153889 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index caf07865941e..2e2e957e6cf0 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -2539,13 +2539,13 @@ bool EscherPropertyContainer::IsDefaultObject( void EscherPropertyContainer::LookForPolarHandles( const MSO_SPT eShapeType, sal_Int32& nAdjustmentsWhichNeedsToBeConverted ) { const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eShapeType ); -if ( !(pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles) ) +if ( !pDefCustomShape || pDefCustomShape->pHandles.empty() ) return; -sal_Int32 k, nkCount = pDefCustomShape->nHandles; -const SvxMSDffHandle* pData = pDefCustomShape->pHandles; -for ( k = 0; k < nkCount; k++, pData++ ) +sal_Int32 k, nkCount = pDefCustomShape->pHandles.size(); +for (k = 0; k < nkCount; k++) { +const SvxMSDffHandle* pData = >pHandles[k]; if ( pData->nFlags & SvxMSDffHandleFlags::POLAR ) { if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) ) diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 0c9875cf43af..e0e378f53430 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -2175,12 +2175,13 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt else { const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( rObjData.eShapeType ); -if ( pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles ) +if (pDefCustomShape && !pDefCustomShape->pHandles.empty()) { -sal_uInt32 i, nCnt = pDefCustomShape->nHandles; -const SvxMSDffHandle* pData = pDefCustomShape->pHandles; -for ( i = 0; i < nCnt; i++, pData++ ) +// TODO: This is very similar to EscherPropertyContainer::LookForPolarHandles +sal_uInt32 i, nCnt = pDefCustomShape->pHandles.size(); +for (i = 0; i < nCnt; i++) { +const SvxMSDffHandle* pData = >pHandles[i]; if ( pData->nFlags & SvxMSDffHandleFlags::POLAR ) { if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) ) diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx index b95501c288c3..626cede2a88d 100644 --- a/include/svx/EnhancedCustomShapeGeometry.hxx +++ b/include/svx/EnhancedCustomShapeGeometry.hxx @@ -81,8 +81,7 @@ struct mso_CustomShape sal_Int32 nXRef; sal_Int32 nYRef; std::span pGluePoints; -SvxMSDffHandle* pHandles; -sal_uInt32 nHandles; +std::span pHandles; }; #define MSO_I | sal_Int32(0x8000) diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index a70b25292e33..7db0ff931ac4 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -135,7 +135,7 @@ const mso_CustomShape msoArc = 21600, 21600, MIN_INT32, MIN_INT32, std::span(), -const_cast(mso_sptArcHandle), SAL_N_ELEMENTS( mso_sptArcHandle )// handles +std::span(mso_sptArcHandle), }; const SvxMSDffVertPair mso_sptTextSimpleVert[] = @@ -152,7 +152,7 @@ const mso_CustomShape msoTextSimple = 21600, 21600, MIN_INT32, MIN_INT32, std::span(), -nullptr, 0 // handles +std::span() // handles }; const SvxMSDffVertPair mso_sptRectangleVert[] = @@ -169,7 +169,7 @@ const mso_CustomShape msoRectangle = 21600, 2160
core.git: include/svx svx/source
include/svx/EnhancedCustomShapeGeometry.hxx |3 svx/source/customshapes/EnhancedCustomShapeGeometry.cxx | 376 svx/source/svdraw/svdoashp.cxx | 18 3 files changed, 198 insertions(+), 199 deletions(-) New commits: commit abdb93ce28febd7c4b4e5dad164ee8a394b499b9 Author: Dr. David Alan Gilbert AuthorDate: Mon Jul 3 15:42:09 2023 +0100 Commit: Hossein CommitDate: Sat Dec 9 00:51:23 2023 +0100 tdf#147021 Use std::span to avoid SAL_N_ELEMENTS in CustomShape as for previous set, this time for TextRectangles Again the data is mechanically search/replaced. Change-Id: I836a0c8384d08da6d8c05cfc6ef9f55c1c90fc12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153885 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx index c776daff606a..b95501c288c3 100644 --- a/include/svx/EnhancedCustomShapeGeometry.hxx +++ b/include/svx/EnhancedCustomShapeGeometry.hxx @@ -75,8 +75,7 @@ struct mso_CustomShape sal_uInt32 nElements; std::span pCalculation; sal_Int32* pDefData; -SvxMSDffTextRectangles* pTextRect; -sal_uInt32 nTextRect; +std::span pTextRect; sal_Int32 nCoordWidth; sal_Int32 nCoordHeight; sal_Int32 nXRef; diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index 31085c48b9a2..a70b25292e33 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -131,7 +131,7 @@ const mso_CustomShape msoArc = const_cast(mso_sptArcSegm), sizeof( mso_sptArcSegm ) >> 1, std::span(mso_sptArcCalc), const_cast(mso_sptArcDefault), -nullptr, 0, +std::span(), 21600, 21600, MIN_INT32, MIN_INT32, std::span(), @@ -148,7 +148,7 @@ const mso_CustomShape msoTextSimple = nullptr, 0, std::span(), nullptr, -nullptr, 0, +std::span(), 21600, 21600, MIN_INT32, MIN_INT32, std::span(), @@ -165,7 +165,7 @@ const mso_CustomShape msoRectangle = nullptr, 0, std::span(), nullptr, -nullptr, 0, +std::span(), 21600, 21600, MIN_INT32, MIN_INT32, std::span(), @@ -210,7 +210,7 @@ const mso_CustomShape msoRoundRectangle = const_cast(mso_sptRoundRectangleSegm), sizeof( mso_sptRoundRectangleSegm ) >> 1, std::span(mso_sptRoundRectangleCalc), const_cast(mso_sptDefault3600), -const_cast(mso_sptRoundRectangleTextRect), SAL_N_ELEMENTS( mso_sptRoundRectangleTextRect ), +std::span(mso_sptRoundRectangleTextRect), 21600, 21600, 10800, 10800, std::span(), @@ -235,7 +235,7 @@ const mso_CustomShape msoRightTriangle = nullptr, 0, std::span(), nullptr, -const_cast(mso_sptRightTriangleTextRect), SAL_N_ELEMENTS( mso_sptRightTriangleTextRect ), +std::span(mso_sptRightTriangleTextRect), 21600, 21600, MIN_INT32, MIN_INT32, std::span(mso_sptRightTriangleGluePoints), @@ -264,7 +264,7 @@ const mso_CustomShape msoEllipse = const_cast(mso_sptEllipseSegm), sizeof( mso_sptEllipseSegm ) >> 1, std::span(), nullptr, -const_cast(mso_sptEllipseTextRect), SAL_N_ELEMENTS( mso_sptEllipseTextRect ), +std::span(mso_sptEllipseTextRect), 21600, 21600, MIN_INT32, MIN_INT32, std::span(mso_sptEllipseGluePoints), @@ -315,7 +315,7 @@ const mso_CustomShape msoParallelogram = const_cast(mso_sptParallelogramSegm), sizeof( mso_sptParallelogramSegm ) >> 1, std::span(mso_sptParallelogramCalc), const_cast(mso_sptDefault5400), -const_cast(mso_sptParallelogramTextRect), SAL_N_ELEMENTS( mso_sptParallelogramTextRect ), +std::span(mso_sptParallelogramTextRect), 21600, 21600, MIN_INT32, MIN_INT32, std::span(mso_sptParallelogramGluePoints), @@ -336,7 +336,7 @@ const mso_CustomShape msoDiamond = nullptr, 0, std::span(), nullptr, -const_cast(mso_sptDiamondTextRect), SAL_N_ELEMENTS( mso_sptDiamondTextRect ), +std::span(mso_sptDiamondTextRect), 21600, 21600, MIN_INT32, MIN_INT32, std::span(mso_sptStandardGluePoints), @@ -380,7 +380,7 @@ const mso_CustomShape msoTrapezoid = const_cast(mso_sptTrapezoidSegm), sizeof( mso_sptTrapezoidSegm ) >> 1, std::span(mso_sptTrapezoidCalc), const_cast(mso_sptDefault5400), -const_cast(mso_sptTrapezoidTextRect), SAL_N_ELEMENTS( mso_sptTrapezoidTextRect ), +std::span(mso_sptTrapezoidTextRect), 21600, 21600, MIN_INT32, MIN_INT32, std::span(mso_sptTrapezoidGluePoints), @@ -471,7 +471,7 @@ const mso_CustomShape msoOctagon =
core.git: include/svx svx/source
include/svx/EnhancedCustomShapeGeometry.hxx |3 svx/source/customshapes/EnhancedCustomShapeGeometry.cxx | 377 +++- svx/source/svdraw/svdoashp.cxx | 22 3 files changed, 202 insertions(+), 200 deletions(-) New commits: commit 4a49d7a3a98ccdca52ea0a4475d05235a111ec0a Author: Dr. David Alan Gilbert AuthorDate: Mon Jul 3 15:30:04 2023 +0100 Commit: Hossein CommitDate: Sat Dec 9 00:47:13 2023 +0100 tdf#147021 Use std::span to avoid SAL_N_ELEMENTS in CustomShape as for previous set, this time for Calculations. Again the size is mostly mechanical: In vim load into a: :+4,+4s/const_cast[(]\([^)]*\)[)],.*/o3tl::span(\1),/ :+4,+4s/nullptr, 0/o3tl::span() and run :%g/^const mso_C.*=/@a (But has had some fixups after conversion from o3tl to std) Change-Id: I11cdfffdfb61678c173d3136a8e948fd0c224af7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153884 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx index 3191f1e5d14f..c776daff606a 100644 --- a/include/svx/EnhancedCustomShapeGeometry.hxx +++ b/include/svx/EnhancedCustomShapeGeometry.hxx @@ -73,8 +73,7 @@ struct mso_CustomShape std::span pVertices; sal_uInt16* pElements; sal_uInt32 nElements; -SvxMSDffCalculationData*pCalculation; -sal_uInt32 nCalculation; +std::span pCalculation; sal_Int32* pDefData; SvxMSDffTextRectangles* pTextRect; sal_uInt32 nTextRect; diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index ad87e34d5da3..31085c48b9a2 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include #include @@ -130,7 +129,7 @@ const mso_CustomShape msoArc = { std::span(mso_sptArcVert), const_cast(mso_sptArcSegm), sizeof( mso_sptArcSegm ) >> 1, -const_cast(mso_sptArcCalc), SAL_N_ELEMENTS( mso_sptArcCalc ), +std::span(mso_sptArcCalc), const_cast(mso_sptArcDefault), nullptr, 0, 21600, 21600, @@ -147,7 +146,7 @@ const mso_CustomShape msoTextSimple = { std::span(mso_sptTextSimpleVert), nullptr, 0, -nullptr, 0, +std::span(), nullptr, nullptr, 0, 21600, 21600, @@ -164,7 +163,7 @@ const mso_CustomShape msoRectangle = { std::span(mso_sptRectangleVert), nullptr, 0, -nullptr, 0, +std::span(), nullptr, nullptr, 0, 21600, 21600, @@ -209,7 +208,7 @@ const mso_CustomShape msoRoundRectangle = { std::span(mso_sptRoundRectangleVert), const_cast(mso_sptRoundRectangleSegm), sizeof( mso_sptRoundRectangleSegm ) >> 1, -const_cast(mso_sptRoundRectangleCalc), SAL_N_ELEMENTS( mso_sptRoundRectangleCalc ), +std::span(mso_sptRoundRectangleCalc), const_cast(mso_sptDefault3600), const_cast(mso_sptRoundRectangleTextRect), SAL_N_ELEMENTS( mso_sptRoundRectangleTextRect ), 21600, 21600, @@ -234,7 +233,7 @@ const mso_CustomShape msoRightTriangle = { std::span(mso_sptRightTriangleVert), nullptr, 0, -nullptr, 0, +std::span(), nullptr, const_cast(mso_sptRightTriangleTextRect), SAL_N_ELEMENTS( mso_sptRightTriangleTextRect ), 21600, 21600, @@ -263,7 +262,7 @@ const mso_CustomShape msoEllipse = { std::span(mso_sptEllipseVert), const_cast(mso_sptEllipseSegm), sizeof( mso_sptEllipseSegm ) >> 1, -nullptr, 0, +std::span(), nullptr, const_cast(mso_sptEllipseTextRect), SAL_N_ELEMENTS( mso_sptEllipseTextRect ), 21600, 21600, @@ -314,7 +313,7 @@ const mso_CustomShape msoParallelogram = { std::span(mso_sptParallelogramVert), const_cast(mso_sptParallelogramSegm), sizeof( mso_sptParallelogramSegm ) >> 1, -const_cast(mso_sptParallelogramCalc), SAL_N_ELEMENTS( mso_sptParallelogramCalc ), +std::span(mso_sptParallelogramCalc), const_cast(mso_sptDefault5400), const_cast(mso_sptParallelogramTextRect), SAL_N_ELEMENTS( mso_sptParallelogramTextRect ), 21600, 21600, @@ -335,7 +334,7 @@ const mso_CustomShape msoDiamond = { std::span(mso_sptDiamondVert), nullptr, 0, -nullptr, 0, +std::span(), nullptr, const_cast(mso_sptDiamondTextRect), SAL_N_ELEMENTS( mso_sptDiamondTextRect ), 21600, 21600, @@ -379,7 +378,7 @@ const mso_CustomShape msoTrapezoid = { std::span(mso_sptTrapezoidVert), const_cast(mso_sptTrapezoidSegm), sizeof( mso_sptTrapezoidSegm ) >> 1, -const_cast(mso_sptT
core.git: include/svx svx/source
include/svx/EnhancedCustomShapeGeometry.hxx |3 svx/source/customshapes/EnhancedCustomShapeGeometry.cxx | 379 svx/source/svdraw/svdoashp.cxx | 10 3 files changed, 196 insertions(+), 196 deletions(-) New commits: commit 82f30ac55a90a0f0915d4016c760c5c38db087f1 Author: Dr. David Alan Gilbert AuthorDate: Mon Jul 3 15:05:03 2023 +0100 Commit: Hossein CommitDate: Sat Dec 9 00:46:06 2023 +0100 tdf#147021 Use std::span to avoid SAL_N_ELEMENTS in CustomShape as for previous set, this time the GluePoints. Again the size is mostly mechanical: In vim into the A register: :+9,+9s/const_cast[(]\([^)]*\)[)],.*/o3tl::span(\1),/ :+9,+9s/nullptr, 0/o3tl::span() and then: :%g/^const mso_C.*=/@a for the tables. (But has had some fixups since switching from o3tl to std) Change-Id: I966275caf38a6af469d334a0161053159e726f22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153883 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx index db8fe5a5944f..3191f1e5d14f 100644 --- a/include/svx/EnhancedCustomShapeGeometry.hxx +++ b/include/svx/EnhancedCustomShapeGeometry.hxx @@ -82,8 +82,7 @@ struct mso_CustomShape sal_Int32 nCoordHeight; sal_Int32 nXRef; sal_Int32 nYRef; -SvxMSDffVertPair* pGluePoints; -sal_uInt32 nGluePoints; +std::span pGluePoints; SvxMSDffHandle* pHandles; sal_uInt32 nHandles; }; diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index 2fa97e30b32d..ad87e34d5da3 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + #include #include @@ -134,7 +135,7 @@ const mso_CustomShape msoArc = nullptr, 0, 21600, 21600, MIN_INT32, MIN_INT32, -nullptr, 0, +std::span(), const_cast(mso_sptArcHandle), SAL_N_ELEMENTS( mso_sptArcHandle )// handles }; @@ -151,7 +152,7 @@ const mso_CustomShape msoTextSimple = nullptr, 0, 21600, 21600, MIN_INT32, MIN_INT32, -nullptr, 0, +std::span(), nullptr, 0 // handles }; @@ -168,7 +169,7 @@ const mso_CustomShape msoRectangle = nullptr, 0, 21600, 21600, MIN_INT32, MIN_INT32, -nullptr, 0, +std::span(), nullptr, 0 // handles }; @@ -213,7 +214,7 @@ const mso_CustomShape msoRoundRectangle = const_cast(mso_sptRoundRectangleTextRect), SAL_N_ELEMENTS( mso_sptRoundRectangleTextRect ), 21600, 21600, 10800, 10800, -nullptr, 0, +std::span(), const_cast(mso_sptRoundRectangleHandle), SAL_N_ELEMENTS( mso_sptRoundRectangleHandle ) // handles }; @@ -238,7 +239,7 @@ const mso_CustomShape msoRightTriangle = const_cast(mso_sptRightTriangleTextRect), SAL_N_ELEMENTS( mso_sptRightTriangleTextRect ), 21600, 21600, MIN_INT32, MIN_INT32, -const_cast(mso_sptRightTriangleGluePoints), SAL_N_ELEMENTS( mso_sptRightTriangleGluePoints ), +std::span(mso_sptRightTriangleGluePoints), nullptr, 0 // handles }; @@ -267,7 +268,7 @@ const mso_CustomShape msoEllipse = const_cast(mso_sptEllipseTextRect), SAL_N_ELEMENTS( mso_sptEllipseTextRect ), 21600, 21600, MIN_INT32, MIN_INT32, -const_cast(mso_sptEllipseGluePoints), SAL_N_ELEMENTS( mso_sptEllipseGluePoints ), +std::span(mso_sptEllipseGluePoints), nullptr, 0 // handles }; @@ -318,7 +319,7 @@ const mso_CustomShape msoParallelogram = const_cast(mso_sptParallelogramTextRect), SAL_N_ELEMENTS( mso_sptParallelogramTextRect ), 21600, 21600, MIN_INT32, MIN_INT32, -const_cast(mso_sptParallelogramGluePoints), SAL_N_ELEMENTS( mso_sptParallelogramGluePoints ), +std::span(mso_sptParallelogramGluePoints), const_cast(mso_sptParallelogramHandle), SAL_N_ELEMENTS( mso_sptParallelogramHandle )// handles }; @@ -339,7 +340,7 @@ const mso_CustomShape msoDiamond = const_cast(mso_sptDiamondTextRect), SAL_N_ELEMENTS( mso_sptDiamondTextRect ), 21600, 21600, MIN_INT32, MIN_INT32, -const_cast(mso_sptStandardGluePoints), SAL_N_ELEMENTS( mso_sptStandardGluePoints ), +std::span(mso_sptStandardGluePoints), nullptr, 0 // handles }; @@ -383,7 +384,7 @@ const mso_CustomShape msoTrapezoid = const_cast(mso_sptTrapezoidTextRect), SAL_N_ELEMENTS( mso_sptTrapezoidTextRect ), 21600, 21600, MIN_INT32, MIN_INT32, -const_cast(mso_sptTrapezoidGluePoints), SAL_N_ELEMENTS
core.git: include/svx svx/source
include/svx/EnhancedCustomShapeGeometry.hxx |3 svx/source/customshapes/EnhancedCustomShapeGeometry.cxx | 377 svx/source/svdraw/svdoashp.cxx | 10 3 files changed, 195 insertions(+), 195 deletions(-) New commits: commit 9924561a094f1b3b2b78700bd1f1638d9608f881 Author: Dr. David Alan Gilbert AuthorDate: Mon Jul 3 13:16:42 2023 +0100 Commit: Hossein CommitDate: Fri Dec 8 17:13:53 2023 +0100 tdf#147021 Use std::span to avoid SAL_N_ELEMENTS in CustomShape EnhancedCustomShapeGeometry has a set of predefined shapes defined with classic arrays and each is used in a structure initialisation like: const mso_CustomShape msoArc = { -const_cast(mso_sptArcVert), SAL_N_ELEMENTS( mso_sptArcVert ), by using a span we can turn that into: +std::span(mso_sptArcVert), There's potential to get rid of some numbered loops later as well. The patch is large mostly because of mechanical replacement Loading EnhancedCustomShapeGeometry.cxx into vim then: into register A put: :+2,+2s/const_cast[(]\([^)]*\)[)],.*/o3tl::span(\1),/ and do: :%g/^const mso_C.*=/@a (since fixed up to std:: ) Change-Id: Ia670b6aa7cc9f662650de2af76ee271a4469f1f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153882 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx index a52dc4820b6e..db8fe5a5944f 100644 --- a/include/svx/EnhancedCustomShapeGeometry.hxx +++ b/include/svx/EnhancedCustomShapeGeometry.hxx @@ -70,8 +70,7 @@ struct SvxMSDffHandle }; struct mso_CustomShape { -SvxMSDffVertPair* pVertices; -sal_uInt32 nVertices; +std::span pVertices; sal_uInt16* pElements; sal_uInt32 nElements; SvxMSDffCalculationData*pCalculation; diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index 8e9ee89fb716..2fa97e30b32d 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -126,7 +127,7 @@ const SvxMSDffHandle mso_sptArcHandle[] = }; const mso_CustomShape msoArc = { -const_cast(mso_sptArcVert), SAL_N_ELEMENTS( mso_sptArcVert ), +std::span(mso_sptArcVert), const_cast(mso_sptArcSegm), sizeof( mso_sptArcSegm ) >> 1, const_cast(mso_sptArcCalc), SAL_N_ELEMENTS( mso_sptArcCalc ), const_cast(mso_sptArcDefault), @@ -143,7 +144,7 @@ const SvxMSDffVertPair mso_sptTextSimpleVert[] = }; const mso_CustomShape msoTextSimple = { -const_cast(mso_sptTextSimpleVert), SAL_N_ELEMENTS( mso_sptTextSimpleVert ), +std::span(mso_sptTextSimpleVert), nullptr, 0, nullptr, 0, nullptr, @@ -160,7 +161,7 @@ const SvxMSDffVertPair mso_sptRectangleVert[] = }; const mso_CustomShape msoRectangle = { -const_cast(mso_sptRectangleVert), SAL_N_ELEMENTS( mso_sptRectangleVert ), +std::span(mso_sptRectangleVert), nullptr, 0, nullptr, 0, nullptr, @@ -205,7 +206,7 @@ const SvxMSDffHandle mso_sptRoundRectangleHandle[] = }; const mso_CustomShape msoRoundRectangle = { -const_cast(mso_sptRoundRectangleVert), SAL_N_ELEMENTS( mso_sptRoundRectangleVert ), +std::span(mso_sptRoundRectangleVert), const_cast(mso_sptRoundRectangleSegm), sizeof( mso_sptRoundRectangleSegm ) >> 1, const_cast(mso_sptRoundRectangleCalc), SAL_N_ELEMENTS( mso_sptRoundRectangleCalc ), const_cast(mso_sptDefault3600), @@ -230,7 +231,7 @@ const SvxMSDffVertPair mso_sptRightTriangleGluePoints[] = }; const mso_CustomShape msoRightTriangle = { -const_cast(mso_sptRightTriangleVert), SAL_N_ELEMENTS( mso_sptRightTriangleVert ), +std::span(mso_sptRightTriangleVert), nullptr, 0, nullptr, 0, nullptr, @@ -259,7 +260,7 @@ const SvxMSDffVertPair mso_sptEllipseGluePoints[] = }; const mso_CustomShape msoEllipse = { -const_cast(mso_sptEllipseVert), SAL_N_ELEMENTS( mso_sptEllipseVert ), +std::span(mso_sptEllipseVert), const_cast(mso_sptEllipseSegm), sizeof( mso_sptEllipseSegm ) >> 1, nullptr, 0, nullptr, @@ -310,7 +311,7 @@ const SvxMSDffHandle mso_sptParallelogramHandle[] = }; const mso_CustomShape msoParallelogram = { -const_cast(mso_sptParallelogramVert), SAL_N_ELEMENTS( mso_sptParallelogramVert ), +std::span(mso_sptParallelogramVert), const_cast(mso_sptParallelogramSegm), sizeof( mso_sptParallelogramSegm ) >> 1, const_cast(mso_sptParallelogramCalc), SAL_N_ELEMENTS( mso_sptParallelogramCalc ), const_cast(mso_sptDefault5400), @@ -331,7 +332,7 @@ cons
[Libreoffice-commits] core.git: editeng/source
editeng/source/editeng/impedit3.cxx | 32 ++-- 1 file changed, 6 insertions(+), 26 deletions(-) New commits: commit ab42fe0c09a4f5fefe9ba46b3be11dff4deff472 Author: Dr. David Alan Gilbert AuthorDate: Thu Jul 13 15:25:29 2023 +0100 Commit: Noel Grandin CommitDate: Sun Jul 16 12:55:52 2023 +0200 editeng: Use RotateAround rather than another copy Replace lcl_ImplCalcRotatedPos by Tools::Point's RotateAround. Signed-off-by: Dr. David Alan Gilbert Change-Id: Id1d8baebafb019f1bc574acc71078150442f20dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154394 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index dff400a5517d..0052fb5e720d 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -226,22 +226,6 @@ static void lcl_DrawRedLines( OutputDevice& rOutDev, } } -static Point lcl_ImplCalcRotatedPos( Point rPos, Point rOrigin, double nSin, double nCos ) -{ -Point aRotatedPos; -// Translation... -Point aTranslatedPos( rPos); -aTranslatedPos -= rOrigin; - -aRotatedPos.setX( static_cast( nCos*aTranslatedPos.X() + nSin*aTranslatedPos.Y() ) ); -aRotatedPos.setY( static_cast(- ( nSin*aTranslatedPos.X() - nCos*aTranslatedPos.Y() )) ); -aTranslatedPos = aRotatedPos; -// Translation... -aTranslatedPos += rOrigin; - -return aTranslatedPos; -} - // For Kashidas from sw/source/core/text/porlay.cxx #define IS_JOINING_GROUP(c, g) ( u_getIntPropertyValue( (c), UCHAR_JOINING_GROUP ) == U_JG_##g ) @@ -3327,13 +3311,6 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po // un-scrolled. // The rectangle is infinite. const Point aOrigin( aStartPos ); -double nCos = 0.0, nSin = 0.0; -if ( nOrientation ) -{ -double nRealOrientation = toRadians(nOrientation); -nCos = cos( nRealOrientation ); -nSin = sin( nRealOrientation ); -} // #110496# Added some more optional metafile comments. This // change: factored out some duplicated code. @@ -3797,7 +3774,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po aTmpFont.SetEscapement( 0 ); } -aOutPos = lcl_ImplCalcRotatedPos( aOutPos, aOrigin, nSin, nCos ); +aOrigin.RotateAround(aOutPos, nOrientation); aTmpFont.SetOrientation( aTmpFont.GetOrientation()+nOrientation ); aTmpFont.SetPhysFont(rOutDev); @@ -3845,7 +3822,10 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po comphelper::string::padToLength( aBlanks, nTextLen, ' ' ); Point aUnderlinePos( aOutPos ); if ( nOrientation ) -aUnderlinePos = lcl_ImplCalcRotatedPos( aTmpPos, aOrigin, nSin, nCos ); +{ +aUnderlinePos = aTmpPos; + aOrigin.RotateAround(aUnderlinePos, nOrientation); +} rOutDev.DrawStretchText( aUnderlinePos, aSz.Width(), aBlanks.makeStringAndClear(), 0, nTextLen ); aTmpFont.SetUnderline( LINESTYLE_NONE ); @@ -3879,7 +3859,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po Point aTopLeft( aTmpPos ); aTopLeft.AdjustY( -(pLine->GetMaxAscent()) ); if ( nOrientation ) -aTopLeft = lcl_ImplCalcRotatedPos( aTopLeft, aOrigin, nSin, nCos ); +aOrigin.RotateAround(aTopLeft, nOrientation); tools::Rectangle aRect( aTopLeft, rTextPortion.GetSize() ); rOutDev.DrawRect( aRect ); }
[Libreoffice-commits] core.git: editeng/source
editeng/source/outliner/outliner.cxx | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) New commits: commit 80b4e90e055825e3fef6fa11796bf4f40627c478 Author: Dr. David Alan Gilbert AuthorDate: Thu Jul 13 14:52:07 2023 +0100 Commit: Noel Grandin CommitDate: Sun Jul 16 12:55:19 2023 +0200 editeng/Outliner: Use RotateAround rather than open coding In PaintBullet, use Tools::Point's RotateAround instead of open coding. Signed-off-by: Dr. David Alan Gilbert Change-Id: I4f5a50a70d8fcadd2e5af60e365de80f2e9a271e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154393 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 04f55eb7dbdb..5af4573bf659 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -945,18 +945,8 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point& { // Both TopLeft and bottom left is not quite correct, // since in EditEngine baseline ... -double nRealOrientation = toRadians(nOrientation); -double nCos = cos( nRealOrientation ); -double nSin = sin( nRealOrientation ); -Point aRotatedPos; -// Translation... -aTextPos -= rOrigin; -// Rotation... -aRotatedPos.setX(static_cast(nCos*aTextPos.X() + nSin*aTextPos.Y()) ); -aRotatedPos.setY(static_cast(- (nSin*aTextPos.X() - nCos*aTextPos.Y())) ); -aTextPos = aRotatedPos; -// Translation... -aTextPos += rOrigin; +rOrigin.RotateAround(aTextPos, nOrientation); + vcl::Font aRotatedFont( aBulletFont ); aRotatedFont.SetOrientation( nOrientation ); rOutDev.SetFont( aRotatedFont );
[Libreoffice-commits] core.git: editeng/source include/tools slideshow/Library_OGLTrans.mk vcl/CppunitTest_vcl_animation.mk
editeng/source/editeng/editeng.cxx |2 +- editeng/source/editeng/impedit.hxx |1 - editeng/source/editeng/impedit3.cxx | 26 ++ include/tools/gen.hxx |3 ++- slideshow/Library_OGLTrans.mk |1 + vcl/CppunitTest_vcl_animation.mk|1 + 6 files changed, 7 insertions(+), 27 deletions(-) New commits: commit 38372f103aa5035ec32570972e55656e07647791 Author: Dr. David Alan Gilbert AuthorDate: Thu Jul 13 14:32:44 2023 +0100 Commit: Noel Grandin CommitDate: Sun Jul 16 12:54:58 2023 +0200 editeng: Use Tools::Point::RotateAround instead of our own Remove our own Rotate function by calls to Tools::Point's RotateAround method. Add a comment on RotateAround to emphasise that the point rotated is the parameter and the This object is used as the origin. Using TOOLS_DLLPUBLIC to fix link error (as suggested by Arnaud) Added tl to slideshow (from Neil) Signed-off-by: Dr. David Alan Gilbert Change-Id: I296bbdf910d262401bfa18f0fc4f431b9e79b8f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154392 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 19ed11229645..9e6696cd5546 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -217,7 +217,7 @@ void EditEngine::Draw( OutputDevice& rOutDev, const Point& rStartPos, Degree10 n if ( IsEffectivelyVertical() ) { aStartPos.AdjustX(GetPaperSize().Width() ); -aStartPos = Rotate( aStartPos, nOrientation, rStartPos ); +rStartPos.RotateAround(aStartPos, nOrientation); } pImpEditEngine->Paint(rOutDev, aBigRect, aStartPos, false, nOrientation); if( rOutDev.GetConnectMetaFile() ) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index b59d934beadf..815c42328ba8 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1360,7 +1360,6 @@ inline vcl::Cursor* ImpEditView::GetCursor() void ConvertItem( std::unique_ptr& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit ); void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit = nullptr, const MapUnit* pDestUnit = nullptr ); AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar ); -Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin ); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index ba7c2ed04ae3..dff400a5517d 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -114,28 +114,6 @@ struct TabInfo } -Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin ) -{ -double nRealOrientation = toRadians(nOrientation); -double nCos = cos( nRealOrientation ); -double nSin = sin( nRealOrientation ); - -Point aRotatedPos; -Point aTranslatedPos( rPoint ); - -// Translation -aTranslatedPos -= rOrigin; - -// Rotation... -aRotatedPos.setX( static_cast( nCos*aTranslatedPos.X() + nSin*aTranslatedPos.Y() ) ); -aRotatedPos.setY( static_cast(- ( nSin*aTranslatedPos.X() - nCos*aTranslatedPos.Y() )) ); -aTranslatedPos = aRotatedPos; - -// Translation... -aTranslatedPos += rOrigin; -return aTranslatedPos; -} - AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar ) { switch ( cChar ) @@ -231,8 +209,8 @@ static void lcl_DrawRedLines( OutputDevice& rOutDev, if (nOrientation) { -aPoint1 = Rotate(aPoint1, nOrientation, rOrigin); -aPoint2 = Rotate(aPoint2, nOrientation, rOrigin); +rOrigin.RotateAround(aPoint1, nOrientation); +rOrigin.RotateAround(aPoint2, nOrientation); } { diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 11d26b0372f2..c6372d7c92dc 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -74,7 +74,7 @@ inline bool equal(Pair const & p1, Pair const & p2) // Point class Size; -class SAL_WARN_UNUSED UNLESS_MERGELIBS(SAL_DLLPUBLIC_EXPORT) Point final : protected Pair +class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Point final : protected Pair { public: constexpr Point() {} @@ -88,6 +88,7 @@ public: tools::LongAdjustX( tools::Long nHorzMove ) { mnA += nHorzMove; return mnA; } tools::LongAdjustY( tools::Long nVertMove ) { mnB += nVertMove; return mnB; } +// Rotate parameter point using This as origin; store result back into parameter point voidRotateAround( tools::Long& rX, tools::Long& rY, Degree10 nOrientation ) const; voidRotateAround( Point&, Degree10 nOrientation )
[Libreoffice-commits] core.git: include/svx sd/source svx/source
include/svx/constructhelper.hxx |6 ++ sd/source/ui/func/fuconrec.cxx| 31 --- svx/source/svdraw/constructhelper.cxx |9 + 3 files changed, 15 insertions(+), 31 deletions(-) New commits: commit a780c820f5cf3bfbb5d88bd5c6ca670e0a0c730f Author: Dr. David Alan Gilbert AuthorDate: Sat Jul 1 14:34:19 2023 +0100 Commit: Caolán McNamara CommitDate: Mon Jul 3 22:21:18 2023 +0200 tdf#155630 Use common getPolygon for sd Unfortunately the SetLineEnds in sw is different enough from sw and sc to make sharing it a pain. However we can share the GetPolygon function we already moved into svx. Expose the svx function into the header and use it in sd. Change-Id: I05b0f820286c8ce848fa0d6c69603d3625c2b4d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153828 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/svx/constructhelper.hxx b/include/svx/constructhelper.hxx index 449a7ba7d1d0..928e6b1d3c68 100644 --- a/include/svx/constructhelper.hxx +++ b/include/svx/constructhelper.hxx @@ -19,15 +19,21 @@ #pragma once +#include #include #include +#include +class SdrModel; class SdrObject; class SfxItemSet; class SVXCORE_DLLPUBLIC ConstructHelper { public: +// Helper to find the shape for a given line end +static ::basegfx::B2DPolyPolygon GetLineEndPoly(TranslateId pResId, const SdrModel& rModel); + // set line starts and ends for newly created objects static void SetLineEnds(SfxItemSet& rAttr, const SdrObject& rObj, sal_uInt16 nSlotId, tools::Long nWidth); diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index a1f4e5f3c6cf..3561a6eb8c47 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -666,30 +667,6 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj) /** * set line starts and ends for the object to be created */ -static ::basegfx::B2DPolyPolygon getPolygon(TranslateId pResId, const SdrModel& rModel) -{ -::basegfx::B2DPolyPolygon aRetval; -XLineEndListRef pLineEndList(rModel.GetLineEndList()); - -if( pLineEndList.is() ) -{ -OUString aArrowName(SvxResId(pResId)); -::tools::Long nCount = pLineEndList->Count(); -::tools::Long nIndex; -for( nIndex = 0; nIndex < nCount; nIndex++ ) -{ -const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex); -if( pEntry->GetName() == aArrowName ) -{ -aRetval = pEntry->GetLineEnd(); -break; -} -} -} - -return aRetval; -} - void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj) { if ( !((rObj.GetObjIdentifier() == SdrObjKind::Edge && @@ -710,7 +687,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj SdrModel& rModel(rObj.getSdrModelFromSdrObject()); // arrowhead -::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) ); +::basegfx::B2DPolyPolygon aArrow(ConstructHelper::GetLineEndPoly(RID_SVXSTR_ARROW, rModel)); if( !aArrow.count() ) { ::basegfx::B2DPolygon aNewArrow; @@ -722,7 +699,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj } // Circles -::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) ); +::basegfx::B2DPolyPolygon aCircle(ConstructHelper::GetLineEndPoly(RID_SVXSTR_CIRCLE, rModel)); if( !aCircle.count() ) { ::basegfx::B2DPolygon aNewCircle = ::basegfx::utils::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0); @@ -731,7 +708,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj } // Square -::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) ); +::basegfx::B2DPolyPolygon aSquare(ConstructHelper::GetLineEndPoly(RID_SVXSTR_SQUARE, rModel)); if( !aSquare.count() ) { ::basegfx::B2DPolygon aNewSquare; diff --git a/svx/source/svdraw/constructhelper.cxx b/svx/source/svdraw/constructhelper.cxx index f09d11787809..d7c7f20a5cc8 100644 --- a/svx/source/svdraw/constructhelper.cxx +++ b/svx/source/svdraw/constructhelper.cxx @@ -34,7 +34,8 @@ //using namespace ::com::sun::star; -static ::basegfx::B2DPolyPolygon lcl_getPolygon(TranslateId pResId, const SdrModel& rModel) +::basegfx::B2DPolyPolygon ConstructHelper::GetLineEndPoly(TranslateId pResId, + const SdrModel& rModel) { ::basegfx::B2DPolyPolygon aRetval; XLineEndListRef pLineEndList(rModel.GetLineE
[Libreoffice-commits] core.git: sw/source
sw/source/core/frmedt/feshview.cxx | 163 - 1 file changed, 2 insertions(+), 161 deletions(-) New commits: commit f239b3dec1acbe7ad70df31e8264bb16ac095502 Author: Dr. David Alan Gilbert AuthorDate: Sat Jul 1 00:05:32 2023 +0100 Commit: Caolán McNamara CommitDate: Mon Jul 3 21:34:23 2023 +0200 tdf#155630 Use common SetLineEnds in sw Use the shared SetLineEnds code from sw. Change-Id: Ie388bb00401b6eb956ad5dc9032f1fae2d62d471 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153827 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 1c19ffb4eca4..537070f08c24 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -105,38 +106,6 @@ using namespace com::sun::star; -/** - * set line starts and ends for the object to be created - */ - -namespace { - -::basegfx::B2DPolyPolygon getPolygon(TranslateId pResId, const SdrModel& rModel) -{ -::basegfx::B2DPolyPolygon aRetval; -XLineEndListRef pLineEndList(rModel.GetLineEndList()); - -if( pLineEndList.is() ) -{ -OUString aArrowName( SvxResId(pResId) ); -tools::Long nCount = pLineEndList->Count(); -tools::Long nIndex; -for( nIndex = 0; nIndex < nCount; nIndex++ ) -{ -const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex); -if( pEntry->GetName() == aArrowName ) -{ -aRetval = pEntry->GetLineEnd(); -break; -} -} -} - -return aRetval; -} - -} - SwFlyFrame *GetFlyFromMarked( const SdrMarkList *pLst, SwViewShell *pSh ) { if ( !pLst ) @@ -953,135 +922,7 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst ) void SwFEShell::SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj, sal_uInt16 nSlotId) { -SdrModel& rModel(rObj.getSdrModelFromSdrObject()); - -if ( !(nSlotId == SID_LINE_ARROW_START || - nSlotId == SID_LINE_ARROW_END|| - nSlotId == SID_LINE_ARROWS || - nSlotId == SID_LINE_ARROW_CIRCLE || - nSlotId == SID_LINE_CIRCLE_ARROW || - nSlotId == SID_LINE_ARROW_SQUARE || - nSlotId == SID_LINE_SQUARE_ARROW || - nSlotId == SID_DRAW_MEASURELINE) ) -return; - -// set attributes of line start and ends - -// arrowhead -::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) ); -if( !aArrow.count() ) -{ -::basegfx::B2DPolygon aNewArrow; -aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0)); -aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0)); -aNewArrow.append(::basegfx::B2DPoint(20.0, 30.0)); -aNewArrow.setClosed(true); -aArrow.append(aNewArrow); -} - -// Circles -::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) ); -if( !aCircle.count() ) -{ -::basegfx::B2DPolygon aNewCircle = ::basegfx::utils::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0); -aNewCircle.setClosed(true); -aCircle.append(aNewCircle); -} - -// Square -::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) ); -if( !aSquare.count() ) -{ -::basegfx::B2DPolygon aNewSquare; -aNewSquare.append(::basegfx::B2DPoint(0.0, 0.0)); -aNewSquare.append(::basegfx::B2DPoint(10.0, 0.0)); -aNewSquare.append(::basegfx::B2DPoint(10.0, 10.0)); -aNewSquare.append(::basegfx::B2DPoint(0.0, 10.0)); -aNewSquare.setClosed(true); -aSquare.append(aNewSquare); -} - -SfxItemSet aSet( rModel.GetItemPool() ); -tools::Long nWidth = 100; // (1/100th mm) - -// determine line width and calculate with it the line end width -if( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) -{ -tools::Long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue(); -if( nValue > 0 ) -nWidth = nValue * 3; -} - -switch (nSlotId) -{ -case SID_LINE_ARROWS: -case SID_DRAW_MEASURELINE: -{ -// connector with arrow ends -rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); -rAttr.Put(XLineStartWidthItem(nWidth)); -rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); -rAttr.Put(XLineEndWidthItem(nWidth)); -} -break; - -case SID_LINE_ARROW_START: -case SID_LINE_ARROW_CIRCLE: -case SID_LINE_ARROW_SQUARE: -{ -// connector with arrow start -rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow)); -rAttr.Put(XLineStartWidthItem(n
[Libreoffice-commits] core.git: include/svx sc/source svx/Library_svxcore.mk svx/source
include/svx/constructhelper.hxx | 37 ++ sc/source/ui/drawfunc/fuconrec.cxx| 163 - svx/Library_svxcore.mk|3 svx/source/svdraw/constructhelper.cxx | 190 ++ 4 files changed, 231 insertions(+), 162 deletions(-) New commits: commit 32fd602d3918be032d79322f76021c6ebc27ccba Author: Dr. David Alan Gilbert AuthorDate: Fri Jun 30 23:41:15 2023 +0100 Commit: Caolán McNamara CommitDate: Mon Jul 3 21:33:44 2023 +0200 tdf#155630 Move sc's SetLineEnds into svx SetLineEnds is duped in sc,sd and sw. Swing SetLineEnds into svx where we'll share it. Note: a) We also move it's helper function getPolygon b) sc, sd and sw use different values for the magic nWidth value so parameterise Change-Id: I6011b41d9db7b7fab364038227e1866fb9d64b02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153826 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/svx/constructhelper.hxx b/include/svx/constructhelper.hxx new file mode 100644 index ..449a7ba7d1d0 --- /dev/null +++ b/include/svx/constructhelper.hxx @@ -0,0 +1,37 @@ +/* -*- 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 + +class SdrObject; +class SfxItemSet; + +class SVXCORE_DLLPUBLIC ConstructHelper +{ +public: +// set line starts and ends for newly created objects +static void SetLineEnds(SfxItemSet& rAttr, const SdrObject& rObj, sal_uInt16 nSlotId, +tools::Long nWidth); +}; + +// +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx index d73915ca450e..0f06de3d82db 100644 --- a/sc/source/ui/drawfunc/fuconrec.cxx +++ b/sc/source/ui/drawfunc/fuconrec.cxx @@ -22,6 +22,7 @@ #include #include +#include // Create default drawing objects via keyboard #include #include @@ -50,38 +51,6 @@ FuConstRectangle::~FuConstRectangle() { } -/** - * set line starts and ends for the object to be created - */ - -namespace { - -::basegfx::B2DPolyPolygon getPolygon(TranslateId pResId, const SdrModel& rModel) -{ -::basegfx::B2DPolyPolygon aRetval; -XLineEndListRef pLineEndList(rModel.GetLineEndList()); - -if( pLineEndList.is() ) -{ -OUString aArrowName( SvxResId(pResId) ); -tools::Long nCount = pLineEndList->Count(); -tools::Long nIndex; -for( nIndex = 0; nIndex < nCount; nIndex++ ) -{ -const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex); -if( pEntry->GetName() == aArrowName ) -{ -aRetval = pEntry->GetLineEnd(); -break; -} -} -} - -return aRetval; -} - -} - bool FuConstRectangle::MouseButtonDown(const MouseEvent& rMEvt) { // remember button state for creation of own MouseEvents @@ -206,135 +175,7 @@ void FuConstRectangle::Activate() void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject& rObj, sal_uInt16 nSlotId) { -SdrModel& rModel(rObj.getSdrModelFromSdrObject()); - -if ( !(nSlotId == SID_LINE_ARROW_START || - nSlotId == SID_LINE_ARROW_END|| - nSlotId == SID_LINE_ARROWS || - nSlotId == SID_LINE_ARROW_CIRCLE || - nSlotId == SID_LINE_CIRCLE_ARROW || - nSlotId == SID_LINE_ARROW_SQUARE || - nSlotId == SID_LINE_SQUARE_ARROW || - nSlotId == SID_DRAW_MEASURELINE) ) -return; - - -// set attributes of line start and ends - -// arrowhead -::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) ); -if( !aArrow.count() ) -{ -::basegfx::B2DPolygon aNewArrow; -aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0)); -aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0)); -aNewArrow.append(::basegfx::B2D
[Libreoffice-commits] core.git: sc/source
sc/source/filter/excel/xlformula.cxx | 22 +++--- sc/source/filter/oox/formulabase.cxx | 22 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) New commits: commit c437ccaab235320995af8c272705ac7c01784dd8 Author: Dr. David Alan Gilbert AuthorDate: Sat Jun 10 01:58:09 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Jun 13 16:24:55 2023 +0200 tdf#147021: sc/source/filter SAL_N_ELEMENTS usage Two blocks that just use SAL_N_ELEMENTS in a form: func(array, array+SAL_N_ELEMENTS(array)) just use std::end for the end of it; I'm not seeing an easier way to pass the whole array in one. Change-Id: I1a229d735385cad6d3d4d7c48a6841906f3a8150 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152807 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index e2e082ac2651..2612f0d3dc45 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -656,21 +656,21 @@ XclFunctionProvider::XclFunctionProvider( const XclRoot& rRoot ) from earlier tables. */ XclBiff eBiff = rRoot.GetBiff(); if( eBiff >= EXC_BIFF2 ) -(this->*pFillFunc)(saFuncTable_2, saFuncTable_2 + SAL_N_ELEMENTS(saFuncTable_2)); +(this->*pFillFunc)(saFuncTable_2, std::end(saFuncTable_2)); if( eBiff >= EXC_BIFF3 ) -(this->*pFillFunc)(saFuncTable_3, saFuncTable_3 + SAL_N_ELEMENTS(saFuncTable_3)); +(this->*pFillFunc)(saFuncTable_3, std::end(saFuncTable_3)); if( eBiff >= EXC_BIFF4 ) -(this->*pFillFunc)(saFuncTable_4, saFuncTable_4 + SAL_N_ELEMENTS(saFuncTable_4)); +(this->*pFillFunc)(saFuncTable_4, std::end(saFuncTable_4)); if( eBiff >= EXC_BIFF5 ) -(this->*pFillFunc)(saFuncTable_5, saFuncTable_5 + SAL_N_ELEMENTS(saFuncTable_5)); +(this->*pFillFunc)(saFuncTable_5, std::end(saFuncTable_5)); if( eBiff >= EXC_BIFF8 ) -(this->*pFillFunc)(saFuncTable_8, saFuncTable_8 + SAL_N_ELEMENTS(saFuncTable_8)); -(this->*pFillFunc)(saFuncTable_Oox, saFuncTable_Oox + SAL_N_ELEMENTS(saFuncTable_Oox)); -(this->*pFillFunc)(saFuncTable_2010, saFuncTable_2010 + SAL_N_ELEMENTS(saFuncTable_2010)); -(this->*pFillFunc)(saFuncTable_2013, saFuncTable_2013 + SAL_N_ELEMENTS(saFuncTable_2013)); -(this->*pFillFunc)(saFuncTable_2016, saFuncTable_2016 + SAL_N_ELEMENTS(saFuncTable_2016)); -(this->*pFillFunc)(saFuncTable_Odf, saFuncTable_Odf + SAL_N_ELEMENTS(saFuncTable_Odf)); -(this->*pFillFunc)(saFuncTable_OOoLO, saFuncTable_OOoLO + SAL_N_ELEMENTS(saFuncTable_OOoLO)); +(this->*pFillFunc)(saFuncTable_8, std::end(saFuncTable_8)); +(this->*pFillFunc)(saFuncTable_Oox, std::end(saFuncTable_Oox)); +(this->*pFillFunc)(saFuncTable_2010, std::end(saFuncTable_2010)); +(this->*pFillFunc)(saFuncTable_2013, std::end(saFuncTable_2013)); +(this->*pFillFunc)(saFuncTable_2016, std::end(saFuncTable_2016)); +(this->*pFillFunc)(saFuncTable_Odf, std::end(saFuncTable_Odf)); +(this->*pFillFunc)(saFuncTable_OOoLO, std::end(saFuncTable_OOoLO)); } const XclFunctionInfo* XclFunctionProvider::GetFuncInfoFromXclFunc( sal_uInt16 nXclFunc ) const diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index 8594bce693b8..7603d0f17833 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -999,17 +999,17 @@ FunctionProviderImpl::FunctionProviderImpl( bool bImportFilter ) /* Add functions supported in the current BIFF version only. Function tables from later BIFF versions may overwrite single functions from earlier tables. */ -initFuncs(saFuncTableBiff2, saFuncTableBiff2 + SAL_N_ELEMENTS(saFuncTableBiff2), bImportFilter); -initFuncs(saFuncTableBiff3, saFuncTableBiff3 + SAL_N_ELEMENTS(saFuncTableBiff3), bImportFilter); -initFuncs(saFuncTableBiff4, saFuncTableBiff4 + SAL_N_ELEMENTS(saFuncTableBiff4), bImportFilter); -initFuncs(saFuncTableBiff5, saFuncTableBiff5 + SAL_N_ELEMENTS(saFuncTableBiff5), bImportFilter); -initFuncs(saFuncTableBiff8, saFuncTableBiff8 + SAL_N_ELEMENTS(saFuncTableBiff8), bImportFilter); -initFuncs(saFuncTableOox , saFuncTableOox + SAL_N_ELEMENTS(saFuncTableOox ), bImportFilter); -initFuncs(saFuncTable2010 , saFuncTable2010 + SAL_N_ELEMENTS(saFuncTable2010 ), bImportFilter); -initFuncs(saFuncTable2013 , saFuncTable2013 + SAL_N_ELEMENTS(saFuncTable2013 ), bImportFilter); -initFuncs(saFuncTable2016 , saFuncTable2016 + SAL_N_ELEMENTS(saFuncTable2016 ), bImportFilter); -initFuncs(saFuncTableOdf , saFuncTableOdf + SAL_N_ELEMENTS(saFuncTableOdf ), bImportFilter); -initFuncs(saFuncTableOOoLO, saFuncTableOOoLO + SAL_N_ELEMENTS(saFuncTableOOoLO), bImpo
[Libreoffice-commits] core.git: vcl/unx vcl/win
vcl/unx/generic/app/keysymnames.cxx | 30 +++--- vcl/win/window/keynames.cxx | 14 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) New commits: commit 880bc4255099132557fe8d7d36a50c06f05cf5a1 Author: Dr. David Alan Gilbert AuthorDate: Thu Jun 8 21:56:02 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Jun 13 16:22:27 2023 +0200 tdf#147021: vcl/* KeyboardReplacements SAL_N_ELEMENTS removal A couple more tables using SAL_N_ELEMENTS. (I do wonder why these are separate). Note, I've not attacked the 'for' use of SAL_N_ELEMENTS in these files since they require some separate thinking about their indexing. Change-Id: I7fe66510fce7d59bda34b1f22417a2fb6070b065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152775 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx index 16ffaa4b91c6..d4842df95589 100644 --- a/vcl/unx/generic/app/keysymnames.cxx +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -461,21 +461,21 @@ namespace vcl_sal { const struct KeyboardReplacements aKeyboards[] = { -{ "ca", aImplReplacements_Catalan, SAL_N_ELEMENTS(aImplReplacements_Catalan) }, -{ "de", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, -{ "sl", aImplReplacements_Slovenian, SAL_N_ELEMENTS(aImplReplacements_Slovenian) }, -{ "es", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, -{ "et", aImplReplacements_Estonian, SAL_N_ELEMENTS(aImplReplacements_Estonian) }, -{ "fr", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, -{ "hu", aImplReplacements_Hungarian, SAL_N_ELEMENTS(aImplReplacements_Hungarian) }, -{ "it", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, -{ "lt", aImplReplacements_Lithuanian, SAL_N_ELEMENTS(aImplReplacements_Lithuanian) }, -{ "nl", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, -{ "no", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, -{ "pt", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, -{ "ru", aImplReplacements_Russian, SAL_N_ELEMENTS(aImplReplacements_Russian) }, -{ "sv", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, -{ "tr", aImplReplacements_Turkish, SAL_N_ELEMENTS(aImplReplacements_Turkish) }, +{ "ca", aImplReplacements_Catalan, std::size(aImplReplacements_Catalan) }, +{ "de", aImplReplacements_German, std::size(aImplReplacements_German) }, +{ "sl", aImplReplacements_Slovenian, std::size(aImplReplacements_Slovenian) }, +{ "es", aImplReplacements_Spanish, std::size(aImplReplacements_Spanish) }, +{ "et", aImplReplacements_Estonian, std::size(aImplReplacements_Estonian) }, +{ "fr", aImplReplacements_French, std::size(aImplReplacements_French) }, +{ "hu", aImplReplacements_Hungarian, std::size(aImplReplacements_Hungarian) }, +{ "it", aImplReplacements_Italian, std::size(aImplReplacements_Italian) }, +{ "lt", aImplReplacements_Lithuanian, std::size(aImplReplacements_Lithuanian) }, +{ "nl", aImplReplacements_Dutch, std::size(aImplReplacements_Dutch) }, +{ "no", aImplReplacements_Norwegian, std::size(aImplReplacements_Norwegian) }, +{ "pt", aImplReplacements_Portuguese, std::size(aImplReplacements_Portuguese) }, +{ "ru", aImplReplacements_Russian, std::size(aImplReplacements_Russian) }, +{ "sv", aImplReplacements_Swedish, std::size(aImplReplacements_Swedish) }, +{ "tr", aImplReplacements_Turkish, std::size(aImplReplacements_Turkish) }, }; // translate keycodes, used within the displayed menu shortcuts diff --git a/vcl/win/window/keynames.cxx b/vcl/win/window/keynames.cxx index 8f0996445cb6..e30f7284caa4 100644 --- a/vcl/win/window/keynames.cxx +++ b/vcl/win/window/keynames.cxx @@ -192,13 +192,13 @@ namespace vcl_sal { const struct KeyboardReplacements aKeyboards[] = { -{ "ast",aImplReplacements_Asturian, SAL_N_ELEMENTS(aImplReplacements_Asturian) }, -{ "ca", aImplReplacements_Catalan, SAL_N_ELEMENTS(aImplReplacements_Catalan) }, -{ "et", aImplReplacements_Estonian, SAL_N_ELEMENTS(aImplReplacements_Estonian) }, -{ "hu", aImplReplacements_Hungarian, SAL_N_ELEMENTS(aImplReplacements_Hungarian) }, -{ "lt", aImplReplaceme
[Libreoffice-commits] core.git: sw/source
sw/source/ui/frmdlg/frmpage.cxx | 84 +++--- sw/source/uibase/fldui/fldmgr.cxx | 78 +-- 2 files changed, 81 insertions(+), 81 deletions(-) New commits: commit 9bc3c4fa8d380bd7ae5689692cc80f815bed4707 Author: Dr. David Alan Gilbert AuthorDate: Thu Jun 8 21:43:15 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Jun 13 16:22:00 2023 +0200 tdf#147021: sw/source use std::size() instead of SAL_N_ELEMENTS Three big chunks of repeated use of SAL_N_ELEMENTS. Change-Id: I1250b22a4bfadb4868382b996208f40c32235268 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152774 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index dc4e98da5b84..19bed7ba0476 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -407,46 +407,46 @@ static size_t lcl_GetFrameMapCount( const FrameMap* pMap) if ( pMap ) { if( pMap == aVParaHtmlMap) -return SAL_N_ELEMENTS(aVParaHtmlMap); +return std::size(aVParaHtmlMap); if( pMap == aVAsCharHtmlMap) -return SAL_N_ELEMENTS(aVAsCharHtmlMap); +return std::size(aVAsCharHtmlMap); if( pMap == aHParaHtmlMap) -return SAL_N_ELEMENTS(aHParaHtmlMap); +return std::size(aHParaHtmlMap); if( pMap == aHParaHtmlAbsMap) -return SAL_N_ELEMENTS(aHParaHtmlAbsMap); +return std::size(aHParaHtmlAbsMap); if ( pMap == aVPageMap ) -return SAL_N_ELEMENTS(aVPageMap); +return std::size(aVPageMap); if ( pMap == aVPageHtmlMap ) -return SAL_N_ELEMENTS(aVPageHtmlMap); +return std::size(aVPageHtmlMap); if ( pMap == aVAsCharMap ) -return SAL_N_ELEMENTS(aVAsCharMap); +return std::size(aVAsCharMap); if ( pMap == aVParaMap ) -return SAL_N_ELEMENTS(aVParaMap); +return std::size(aVParaMap); if ( pMap == aHParaMap ) -return SAL_N_ELEMENTS(aHParaMap); +return std::size(aHParaMap); if ( pMap == aHFrameMap ) -return SAL_N_ELEMENTS(aHFrameMap); +return std::size(aHFrameMap); if ( pMap == aVFrameMap ) -return SAL_N_ELEMENTS(aVFrameMap); +return std::size(aVFrameMap); if ( pMap == aHCharMap ) -return SAL_N_ELEMENTS(aHCharMap); +return std::size(aHCharMap); if ( pMap == aHCharHtmlMap ) -return SAL_N_ELEMENTS(aHCharHtmlMap); +return std::size(aHCharHtmlMap); if ( pMap == aHCharHtmlAbsMap ) -return SAL_N_ELEMENTS(aHCharHtmlAbsMap); +return std::size(aHCharHtmlAbsMap); if ( pMap == aVCharMap ) -return SAL_N_ELEMENTS(aVCharMap); +return std::size(aVCharMap); if ( pMap == aVCharHtmlMap ) -return SAL_N_ELEMENTS(aVCharHtmlMap); +return std::size(aVCharHtmlMap); if ( pMap == aVCharHtmlAbsMap ) -return SAL_N_ELEMENTS(aVCharHtmlAbsMap); +return std::size(aVCharHtmlAbsMap); if ( pMap == aHPageHtmlMap ) -return SAL_N_ELEMENTS(aHPageHtmlMap); +return std::size(aHPageHtmlMap); if ( pMap == aHFlyHtmlMap ) -return SAL_N_ELEMENTS(aHFlyHtmlMap); +return std::size(aHFlyHtmlMap); if ( pMap == aVFlyHtmlMap ) -return SAL_N_ELEMENTS(aVFlyHtmlMap); -return SAL_N_ELEMENTS(aHPageMap); +return std::size(aVFlyHtmlMap); +return std::size(aHPageMap); } return 0; } @@ -742,27 +742,27 @@ namespace void SwFramePage::setOptimalFrameWidth() { static FrameMaps const aMaps[] = { -{ aHPageMap, SAL_N_ELEMENTS(aHPageMap) }, -{ aHPageHtmlMap, SAL_N_ELEMENTS(aHPageHtmlMap) }, -{ aVPageMap, SAL_N_ELEMENTS(aVPageMap) }, -{ aVPageHtmlMap, SAL_N_ELEMENTS(aVPageHtmlMap) }, -{ aHFrameMap, SAL_N_ELEMENTS(aHFrameMap) }, -{ aHFlyHtmlMap, SAL_N_ELEMENTS(aHFlyHtmlMap) }, -{ aVFrameMap, SAL_N_ELEMENTS(aVFrameMap) }, -{ aVFlyHtmlMap, SAL_N_ELEMENTS(aVFlyHtmlMap) }, -{ aHParaMap, SAL_N_ELEMENTS(aHParaMap) }, -{ aHParaHtmlMap, SAL_N_ELEMENTS(aHParaHtmlMap) }, -{ aHParaHtmlAbsMap, SAL_N_ELEMENTS(aHParaHtmlAbsMap) }, -{ aVParaMap, SAL_N_ELEMENTS(aVParaMap) }, -{ aVParaHtmlMap, SAL_N_ELEMENTS(aVParaHtmlMap) }, -{ aHCharMap, SAL_N_ELEMENTS(aHCharMap) }, -{ aHCharHtmlMap, SAL_N_ELEMENTS(aHCharHtmlMap) }, -{ aHCharHtmlAbsMap, SAL_N_ELEMENTS(aHCharHtmlAbsMap) }, -{ aVCharMap, SAL_N_ELEMENTS(aVCharMap) }, -{ aVCharHtmlMap, SAL_N_ELEMENTS(aVCharHtmlMap) }, -{ aVCharHtmlAbsMap, SAL_N_ELEMENTS(aVCharHtmlAbsMap) }, -{ aVAsCharMap
[Libreoffice-commits] core.git: filter/qa sal/qa sc/qa svl/qa sw/qa xmloff/qa
filter/qa/cppunit/priority-test.cxx | 13 +-- sal/qa/rtl/strings/test_oustring_convert.cxx |4 sal/qa/rtl/strings/test_oustring_endswith.cxx | 19 +--- sal/qa/rtl/textenc/rtl_textcvt.cxx| 71 + sal/qa/rtl/uri/rtl_testuri.cxx| 34 +++- sc/qa/unit/subsequent_export_test.cxx | 22 ++--- svl/qa/unit/svl.cxx | 24 ++--- svl/qa/unit/test_URIHelper.cxx| 105 +++--- sw/qa/core/macros-test.cxx|6 - sw/qa/extras/odfexport/odfexport2.cxx |4 xmloff/qa/unit/uxmloff.cxx| 13 +-- 11 files changed, 146 insertions(+), 169 deletions(-) New commits: commit 7bec1689fcbe9102aa220739b6113118d9a8dd1f Author: Dr. David Alan Gilbert AuthorDate: Wed May 31 01:58:18 2023 +0100 Commit: Mike Kaganski CommitDate: Fri Jun 2 16:58:57 2023 +0200 tdf#145538,tdf#147021: qa: range based loops A bunch of range based loop changes in various qa sections that also take out about 1% of SAL_N_ELEMENTS Change-Id: I8ef000e9aa400cd8363b48f6175f6ab258cefbd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152422 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/filter/qa/cppunit/priority-test.cxx b/filter/qa/cppunit/priority-test.cxx index 18e63c3188ee..7b37ce07e6ee 100644 --- a/filter/qa/cppunit/priority-test.cxx +++ b/filter/qa/cppunit/priority-test.cxx @@ -50,20 +50,17 @@ void PriorityFilterTest::testPriority() // TODO: expand this to check more of these priorities }; -for (size_t i = 0; i < SAL_N_ELEMENTS(aToCheck); i++) +for (auto const[pURL, pFormat] : aToCheck) { -OUString aURL = OUString::createFromAscii(aToCheck[i].pURL); +OUString aURL = OUString::createFromAscii(pURL); try { OUString aTypeName = xDetection->queryTypeByURL(aURL); -OUString aFormatCorrect = OUString::createFromAscii(aToCheck[i].pFormat); +OUString aFormatCorrect = OUString::createFromAscii(pFormat); OUString aMsg = "Mis-matching formats " -"'" + -aTypeName + -"' should be '" + -aFormatCorrect + -"'"; +"'" + +aTypeName + "' should be '" + aFormatCorrect + "'"; CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(aMsg, RTL_TEXTENCODING_UTF8).getStr(), aFormatCorrect, aTypeName); diff --git a/sal/qa/rtl/strings/test_oustring_convert.cxx b/sal/qa/rtl/strings/test_oustring_convert.cxx index da930a03f244..e74276a11b0f 100644 --- a/sal/qa/rtl/strings/test_oustring_convert.cxx +++ b/sal/qa/rtl/strings/test_oustring_convert.cxx @@ -170,8 +170,8 @@ void test::oustring::Convert::convertToString() OUSTRING_TO_OSTRING_CVTFLAGS, "A?B", "A?B" } }; -for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) -testConvertToString(aTests[i]); +for (auto const& aTest : aTests) +testConvertToString(aTest); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/qa/rtl/strings/test_oustring_endswith.cxx b/sal/qa/rtl/strings/test_oustring_endswith.cxx index bf01577e28be..9ec08fa55045 100644 --- a/sal/qa/rtl/strings/test_oustring_endswith.cxx +++ b/sal/qa/rtl/strings/test_oustring_endswith.cxx @@ -93,20 +93,17 @@ void test::oustring::EndsWith::endsWith() RTL_CONSTASCII_STRINGPARAM("b\0c"), true }, { RTL_CONSTASCII_STRINGPARAM("a\0b\0c"), RTL_CONSTASCII_STRINGPARAM("b"), false } }; -for (size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { +for (auto const[pStr1, nStr1Len, pStr2, nStr2Len, bEndsWith] : data) +{ OStringBuffer msg; -appendString(msg, OString(data[i].str1, data[i].str1Len)); +appendString(msg, OString(pStr1, nStr1Len)); msg.append(".endsWithIgnoreAsciiCaseAsciiL("); -appendString(msg, OString(data[i].str2, data[i].str2Len)); +appendString(msg, OString(pStr2, nStr2Len)); msg.append(") == "); -msg.append(data[i].endsWith); -CPPUNIT_ASSERT_EQUAL_MESSAGE( -msg.getStr(), -data[i].endsWith, -OUString( -data[i].str1, data[i].str1Len, -RTL_TEXTENCODING_ASCII_US).endsWithIgnoreAsciiCaseAsciiL( -data[i].str2, data[i].str2Len)); +msg.append(bEndsWith); +CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.getStr(), bEndsWith, + OUString(pStr1, nStr1Len, RTL_TEXTENCODING_ASCII_US) +
[Libreoffice-commits] core.git: 2 commits - sc/source sw/source
sc/source/core/data/conditio.cxx |2 ++ sw/source/core/unocore/unofield.cxx |6 +++--- sw/source/ui/dbui/mmaddressblockpage.cxx |8 sw/source/ui/fldui/flddinf.cxx |4 ++-- sw/source/ui/fldui/fldref.cxx|6 +++--- sw/source/ui/misc/outline.cxx|4 ++-- sw/source/uibase/dbui/mmconfigitem.cxx |4 ++-- sw/source/uibase/sidebar/PageFormatPanel.cxx | 12 ++-- sw/source/uibase/utlui/initui.cxx|4 ++-- sw/source/uibase/utlui/unotools.cxx | 17 - 10 files changed, 30 insertions(+), 37 deletions(-) New commits: commit 4998370216bbea3bcaff7fac2d62cbb4ac978c5d Author: Dr. David Alan Gilbert AuthorDate: Thu May 25 02:44:21 2023 +0100 Commit: Mike Kaganski CommitDate: Tue May 30 15:37:47 2023 +0200 tdf#145538,tdf#147021: sw/source: range based loops A bunch of range based loop changes in sw/source that also take out SAL_N_ELEMENTS usages Change-Id: I28b929d2ecbe40c1b257454f21b5d2ff51d617e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152251 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 36a4f5b27bc6..78b43b3158bd 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -183,9 +183,9 @@ const ServiceIdResId aServiceToRes[] = static SwFieldIds lcl_ServiceIdToResId(SwServiceType nServiceId) { -for (size_t i=0; i 0 OSL_FAIL("service id not found"); #endif diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index ad4a7bfc4b83..48d4e3dce117 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -494,10 +494,10 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog( m_xAddressElementsLB->append(OUString::number(USER_DATA_SALUTATION), SwResId(ST_SALUTATION)); m_xAddressElementsLB->append(OUString::number(USER_DATA_PUNCTUATION), SwResId(ST_PUNCTUATION)); m_xAddressElementsLB->append(OUString::number(USER_DATA_TEXT), SwResId(ST_TEXT)); -for (size_t i = 0; i < SAL_N_ELEMENTS(RA_SALUTATION); ++i) -m_aSalutations.push_back(SwResId(RA_SALUTATION[i])); -for (size_t i = 0; i < SAL_N_ELEMENTS(RA_PUNCTUATION); ++i) -m_aPunctuations.push_back(SwResId(RA_PUNCTUATION[i])); +for (auto const& aID : RA_SALUTATION) +m_aSalutations.push_back(SwResId(aID)); +for (auto const& aID : RA_PUNCTUATION) +m_aPunctuations.push_back(SwResId(aID)); m_xDragED->SetText(""); m_xDialog->set_title(SwResId(eType == GREETING_MALE ? ST_TITLE_MALE : ST_TITLE_FEMALE)); m_xAddressElementsFT->set_label(SwResId(ST_SALUTATIONELEMENTS)); diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index 3fa401211b1f..7cb69c1d0e49 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -46,8 +46,8 @@ using namespace com::sun::star; void FillFieldSelect(weld::TreeView& rListBox) { -for (size_t i = 0; i < SAL_N_ELEMENTS(FLD_SELECT); ++i) -rListBox.append_text(SwResId(FLD_SELECT[i])); +for (auto const& aID : FLD_SELECT) +rListBox.append_text(SwResId(aID)); } SwFieldDokInfPage::SwFieldDokInfPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *const pCoreSet) diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index bd6fef539478..54f9c9fc98dc 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -70,10 +70,10 @@ SwFieldRefPage::SwFieldRefPage(weld::Container* pPage, weld::DialogController* p { m_xSelectionLB->make_sorted(); // #i83479# -for (size_t i = 0; i < SAL_N_ELEMENTS(FLD_REF_PAGE_TYPES); ++i) +for (auto const& aID : FLD_REF_PAGE_TYPES) { -m_xTypeLB->append_text(SwResId(FLD_REF_PAGE_TYPES[i])); -m_xFormatLB->append_text(SwResId(FLD_REF_PAGE_TYPES[i])); +m_xTypeLB->append_text(SwResId(aID)); +m_xFormatLB->append_text(SwResId(aID)); } m_sBookmarkText = m_xTypeLB->get_text(0); diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 429cfb71915c..6500bfdd6eca 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -118,8 +118,8 @@ SwNumNamesDlg::SwNumNamesDlg(weld::Window *pParent) , m_xFormBox(m_xBuilder->weld_tree_view("form")) , m_xOKBtn(m_xBuilder->weld_button("ok")) { -for (size_t i = 0; i < SAL_N_ELEMENTS(OUTLINE_STYLE); ++i) -m_xFormBox->append_text(SwResId(OUTLINE_STYLE[i])); +for (auto const& aID : OUTLINE_ST
[Libreoffice-commits] core.git: vcl/qa
vcl/qa/cppunit/timer.cxx | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) New commits: commit b20eb3367436de4fb189dc82d14412539c02d30c Author: Dr. David Alan Gilbert AuthorDate: Thu May 25 01:31:11 2023 +0100 Commit: Noel Grandin CommitDate: Mon May 29 14:48:37 2023 +0200 cppunit/timer: Use a range based loop and cleanup Use a range based loop in testDurations re tdf#145538 which also nails a SAL_N_ELEMENTS tdf#147021 and takes out a sal_uLong tdf#114441 while here, clean out the rest of the sal_uLong's in that file to be sal_uInt64 to match timer.hxx which was changed by 9c7016b5b5 way back in 2015. Change-Id: Ie065885939a340d9a73af797fb4d7d6f76530242 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152250 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx index 15493b953639..467d7b1a776d 100644 --- a/vcl/qa/cppunit/timer.cxx +++ b/vcl/qa/cppunit/timer.cxx @@ -160,7 +160,7 @@ class TimerBool : public Timer { bool public: -TimerBool( sal_uLong nMS, bool ) : +TimerBool( sal_uInt64 nMS, bool ) : Timer( "TimerBool" ), mrBool( rBool ) { SetTimeout( nMS ); @@ -178,11 +178,10 @@ public: void TimerTest::testDurations() { -static const sal_uLong aDurations[] = { 0, 1, 500, 1000 }; -for (size_t i = 0; i < SAL_N_ELEMENTS( aDurations ); i++) +for (auto const nDuration : { 0, 1, 500, 1000 }) { bool bDone = false; -TimerBool aTimer( aDurations[i], bDone ); +TimerBool aTimer( nDuration, bDone ); // coverity[loop_top] - Application::Yield allows the timer to fire and toggle bDone while( !bDone ) { @@ -199,7 +198,7 @@ class AutoTimerCount : public AutoTimer const sal_Int32 mnMaxCount; public: -AutoTimerCount( sal_uLong nMS, sal_Int32 , +AutoTimerCount( sal_uInt64 nMS, sal_Int32 , const sal_Int32 nMaxCount = -1 ) : AutoTimer( "AutoTimerCount" ) , mrCount( rCount ) @@ -340,7 +339,7 @@ namespace { class YieldTimer : public Timer { public: -explicit YieldTimer( sal_uLong nMS ) : Timer( "YieldTimer" ) +explicit YieldTimer( sal_uInt64 nMS ) : Timer( "YieldTimer" ) { SetTimeout( nMS ); Start(); @@ -370,7 +369,7 @@ class SlowCallbackTimer : public Timer { bool public: -SlowCallbackTimer( sal_uLong nMS, bool ) : +SlowCallbackTimer( sal_uInt64 nMS, bool ) : Timer( "SlowCallbackTimer" ), mbSlow( bBeenSlow ) { SetTimeout( nMS );
[Libreoffice-commits] core.git: sc/source svx/source
sc/source/core/data/documen3.cxx | 12 svx/source/dialog/langbox.cxx|4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) New commits: commit da398ad3bb511e33451f9d3bf24b0c5abd55ce25 Author: Dr. David Alan Gilbert AuthorDate: Wed May 24 13:57:16 2023 +0100 Commit: Noel Grandin CommitDate: Mon May 29 14:48:04 2023 +0200 replace find_if by any_of A few cases where find_if is used just to test if there are any matches; use any_of as per tdf#153109 In document3 we can merge two identical loops. In langbox we can optimise the arg capture (Arkadiy's suggestion) Change-Id: I480b80ec1b859980b651c6d727e7fb5d01d390e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152201 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 72839483dae6..b1cf5fe81b8c 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -87,10 +87,6 @@ void sortAndRemoveDuplicates(std::vector& rStrings, bool bCaseSe std::vector::iterator it = std::unique(rStrings.begin(), rStrings.end(), ScTypedStrData::EqualCaseSensitive()); rStrings.erase(it, rStrings.end()); -if (std::find_if(rStrings.begin(), rStrings.end(), -[](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); }) != rStrings.end()) { -std::stable_sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessHiddenRows()); -} } else { @@ -98,10 +94,10 @@ void sortAndRemoveDuplicates(std::vector& rStrings, bool bCaseSe std::vector::iterator it = std::unique(rStrings.begin(), rStrings.end(), ScTypedStrData::EqualCaseInsensitive()); rStrings.erase(it, rStrings.end()); -if (std::find_if(rStrings.begin(), rStrings.end(), -[](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); }) != rStrings.end()) { -std::stable_sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessHiddenRows()); -} +} +if (std::any_of(rStrings.begin(), rStrings.end(), +[](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); })) { +std::stable_sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessHiddenRows()); } } diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 76d9b3de1fe5..b489ea58a546 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -183,8 +183,8 @@ void SvxLanguageBox::AddLanguages(const std::vector< LanguageType >& rLanguageTy weld::ComboBoxEntry aNewEntry(BuildEntry(nLang)); if (aNewEntry.sString.isEmpty()) continue; -if (std::find_if(rEntries.begin(), rEntries.end(), - [=](const weld::ComboBoxEntry& rEntry){ return rEntry.sId == aNewEntry.sId; }) != rEntries.end()) +if (std::any_of(rEntries.begin(), rEntries.end(), + [&](const weld::ComboBoxEntry& rEntry){ return rEntry.sId == aNewEntry.sId; })) continue; rEntries.push_back(aNewEntry); }
[Libreoffice-commits] core.git: comphelper/source sc/source vcl/source
comphelper/source/misc/docpasswordhelper.cxx |5 ++--- sc/source/ui/app/scmod.cxx |4 ++-- vcl/source/filter/graphicfilter.cxx |2 +- 3 files changed, 5 insertions(+), 6 deletions(-) New commits: commit b480552d9c4ac9be1f53edc6cac21bc45cfe29ca Author: Dr. David Alan Gilbert AuthorDate: Wed May 24 13:47:22 2023 +0100 Commit: Noel Grandin CommitDate: Fri May 26 12:49:14 2023 +0200 replace find_if by none_of A set of cases where find_if is used just to test if there are no matches; use none_of as per tdf#153109 Change-Id: I6c705ab7a8289914743199722a444ee40d11d746 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152200 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index d26a30e0ff20..5489690fae6a 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -621,11 +621,10 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( if (eResult == DocPasswordVerifierResult::OK && !aPassword.isEmpty()) { -if (std::find_if(std::cbegin(aEncData), std::cend(aEncData), +if (std::none_of(std::cbegin(aEncData), std::cend(aEncData), [](const css::beans::NamedValue& val) { return val.Name == PACKAGE_ENCRYPTIONDATA_SHA256UTF8; - }) -== std::cend(aEncData)) + })) { // tdf#118639: We need ODF encryption data for autorecovery, where password // will already be unavailable, so generate and append it here diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 2f84555fd3ca..93b74d70e68e 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2192,11 +2192,11 @@ void ScModule::RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr, weld::Window*>> & rlRefWindow = m_mapRefController[nSlotId]; -if (std::find_if(rlRefWindow.begin(), rlRefWindow.end(), +if (std::none_of(rlRefWindow.begin(), rlRefWindow.end(), [rWnd](const std::pair, weld::Window*>& rCandidate) { return rCandidate.first.get() == rWnd.get(); - }) == rlRefWindow.end()) + })) { rlRefWindow.emplace_back(rWnd, pWndAncestor); } diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 441d32a28adf..bb478922b5a5 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -691,7 +691,7 @@ void GraphicFilter::MakeGraphicsAvailableThreaded(std::vector& graphic { // Graphic objects share internal ImpGraphic, do not process any of those twice. const auto predicate = [graphic](Graphic* item) { return item->ImplGetImpGraphic() == graphic->ImplGetImpGraphic(); }; -if( std::find_if(toLoad.begin(), toLoad.end(), predicate ) == toLoad.end()) +if( std::none_of(toLoad.begin(), toLoad.end(), predicate )) toLoad.push_back( graphic ); } }
[Libreoffice-commits] core.git: svx/source
svx/source/svdraw/clonelist.cxx | 50 1 file changed, 15 insertions(+), 35 deletions(-) New commits: commit 69384d208a2c40c14de73d67d3620596678bf502 Author: Dr. David Alan Gilbert AuthorDate: Sun May 21 18:29:16 2023 +0100 Commit: Noel Grandin CommitDate: Wed May 24 08:13:16 2023 +0200 CloneList::CopyConnections: Replace duplicated code by loop There's a chunk of code copied for the two ends of the connection; replace it by a loop with the original code. Change-Id: I80d80f61879a08612dd8314963cccb35651c2091 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152073 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/svx/source/svdraw/clonelist.cxx b/svx/source/svdraw/clonelist.cxx index 1fe6bd99e478..ffb1ccc6766c 100644 --- a/svx/source/svdraw/clonelist.cxx +++ b/svx/source/svdraw/clonelist.cxx @@ -78,46 +78,26 @@ void CloneList::CopyConnections() const if(pOriginalEdge && pCloneEdge) { -SdrObject* pOriginalNode1 = pOriginalEdge->GetConnectedNode(true); -SdrObject* pOriginalNode2 = pOriginalEdge->GetConnectedNode(false); - -if(pOriginalNode1) +for (bool bTail1 : { true, false }) { -std::vector::const_iterator it = std::find(maOriginalList.begin(), - maOriginalList.end(), - pOriginalNode1); - -sal_uInt32 nPos = it - maOriginalList.begin(); - -if(it != maOriginalList.end()) +SdrObject* pOriginalNode = pOriginalEdge->GetConnectedNode(bTail1); +if (pOriginalNode) { -SdrObject *cObj = nullptr; +std::vector::const_iterator it = std::find(maOriginalList.begin(), + maOriginalList.end(), + pOriginalNode); -if (nPos < cloneCount) -cObj = GetClone(nPos); - -if(pOriginalEdge->GetConnectedNode(true) != cObj) -pCloneEdge->ConnectToNode(true, cObj); -} -} - -if(pOriginalNode2) -{ -std::vector::const_iterator it = std::find(maOriginalList.begin(), - maOriginalList.end(), - pOriginalNode2); - -sal_uInt32 nPos = it - maOriginalList.begin(); - -if(it != maOriginalList.end()) -{ -SdrObject *cObj = nullptr; +if(it != maOriginalList.end()) +{ +sal_uInt32 nPos = it - maOriginalList.begin(); +SdrObject *cObj = nullptr; -if (nPos < cloneCount) -cObj = GetClone(nPos); +if (nPos < cloneCount) +cObj = GetClone(nPos); -if(pOriginalEdge->GetConnectedNode(false) != cObj) -pCloneEdge->ConnectToNode(false, cObj); +if(pOriginalNode != cObj) +pCloneEdge->ConnectToNode(bTail1, cObj); +} } } }
[Libreoffice-commits] core.git: svx/source
svx/source/svdraw/svdpage.cxx | 58 ++ 1 file changed, 9 insertions(+), 49 deletions(-) New commits: commit 26b0870f4e16a8ce53129045d6feea4f8139487f Author: Dr. David Alan Gilbert AuthorDate: Sun May 21 13:44:49 2023 +0100 Commit: Noel Grandin CommitDate: Tue May 23 15:05:05 2023 +0200 tdf#120283 CopyObjects: Use CloneList to wire up connectors Remove the old connector wiring code and replace it by CloneList. The copy/paste code uses CloneList to do this work, and CloneList knows how to deal with groups; and not dealing with groups is the cause of tdf#120283 Change-Id: I48476a93a89c1a14f55ba206e0c8354823d0e8c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152070 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index b2a839a3c785..55d3e7f5aa6b 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -131,6 +132,8 @@ SdrObject* SdrObjList::getSdrObjectFromSdrObjList() const void SdrObjList::CopyObjects(const SdrObjList& rSrcList) { +CloneList aCloneList; + // clear SdrObjects with broadcasting ClearSdrObjList(); @@ -157,6 +160,7 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList) if(pDO) { NbcInsertObject(pDO.get(), SAL_MAX_SIZE); +aCloneList.AddPair(pSO, pDO.get()); } else { @@ -164,53 +168,11 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList) } } -// and now for the Connectors -// The new objects would be shown in the rSrcList -// and then the object connections are made. -// Similar implementation are setup as the following: -//void SdrObjList::CopyObjects(const SdrObjList& rSrcList) -//SdrModel* SdrExchangeView::CreateMarkedObjModel() const -//BOOL SdrExchangeView::Paste(const SdrModel& rMod,...) -//void SdrEditView::CopyMarked() -if (nCloneErrCnt==0) { -for (size_t no=0; no( pSrcOb ); -if (pSrcEdge!=nullptr) { -SdrObject* pSrcNode1=pSrcEdge->GetConnectedNode(true); -SdrObject* pSrcNode2=pSrcEdge->GetConnectedNode(false); -if (pSrcNode1!=nullptr && pSrcNode1->getParentSdrObjListFromSdrObject()!=pSrcEdge->getParentSdrObjListFromSdrObject()) pSrcNode1=nullptr; // can't do this -if (pSrcNode2!=nullptr && pSrcNode2->getParentSdrObjListFromSdrObject()!=pSrcEdge->getParentSdrObjListFromSdrObject()) pSrcNode2=nullptr; // across all lists (yet) -if (pSrcNode1!=nullptr || pSrcNode2!=nullptr) { -SdrObject* pEdgeObjTmp=GetObj(no); -SdrEdgeObj* pDstEdge=dynamic_cast( pEdgeObjTmp ); -if (pDstEdge!=nullptr) { -if (pSrcNode1!=nullptr) { -sal_uInt32 nDstNode1=pSrcNode1->GetOrdNum(); -SdrObject* pDstNode1=GetObj(nDstNode1); -if (pDstNode1!=nullptr) { // else we get an error! -pDstEdge->ConnectToNode(true,pDstNode1); -} else { -OSL_FAIL("SdrObjList::operator=(): pDstNode1==NULL!"); -} -} -if (pSrcNode2!=nullptr) { -sal_uInt32 nDstNode2=pSrcNode2->GetOrdNum(); -SdrObject* pDstNode2=GetObj(nDstNode2); -if (pDstNode2!=nullptr) { // else the node was probably not selected -pDstEdge->ConnectToNode(false,pDstNode2); -} else { -OSL_FAIL("SdrObjList::operator=(): pDstNode2==NULL!"); -} -} -} else { -OSL_FAIL("SdrObjList::operator=(): pDstEdge==NULL!"); -} -} -} -} -} else { +// Wires up the connections +aCloneList.CopyConnections(); #ifdef DBG_UTIL +if (nCloneErrCnt != 0) +{ OStringBuffer aStr("SdrObjList::operator=(): Error when cloning "); if(nCloneErrCnt == 1) @@ -223,11 +185,9 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList) + " drawing objects."); } -aStr.append(" Not copying connectors."); - OSL_FAIL(aStr.getStr()); -#endif } +#endif } void SdrObjList::RecalcObjOrdNums()
[Libreoffice-commits] core.git: sw/source
sw/source/core/doc/doccomp.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit fb41d0d2969726a00bcb5ac381ca77f4cb7230bd Author: Dr. David Alan Gilbert AuthorDate: Thu May 11 00:49:17 2023 +0100 Commit: Julien Nabet CommitDate: Sat May 13 08:42:53 2023 +0200 tdf#148251 doccomp: Use std::swap instead of using temporary values Another swap case in LgstCommonSubseq::FindL Change-Id: Ida1e3f4f2a40bb4bc6da84e29d3fb969ff24fe6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151655 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 2941112bc5d8..32ec6bb85aaa 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -2475,9 +2475,7 @@ void LgstCommonSubseq::FindL( int *pL, int nStt1, int nEnd1, else currL[j] = std::max( currL[j - 1], prevL[j] ); } -int *tmp = currL; -currL = prevL; -prevL = tmp; +std::swap( currL, prevL ); } memcpy( pL, prevL, ( nLen2 + 1 ) * sizeof( *prevL ) ); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtGraphics_GDI.cxx | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) New commits: commit 389b801cea9c9f3c311dcbe9d32df62a66e5ea4a Author: Dr. David Alan Gilbert AuthorDate: Wed May 10 23:55:14 2023 +0100 Commit: Michael Weghorn CommitDate: Sat May 13 06:36:47 2023 +0200 tdf#148251 qt: Use std::swap instead of using temporary values Another std::swap case in drawLine Change-Id: I207fe3c8c6c88532c23faf3aa3188acdcda3a5b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151654 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index 08116f85a529..28bab34a7cca 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -198,19 +198,10 @@ void QtGraphicsBackend::drawLine(tools::Long nX1, tools::Long nY1, tools::Long n QtPainter aPainter(*this); aPainter.drawLine(nX1, nY1, nX2, nY2); -tools::Long tmp; if (nX1 > nX2) -{ -tmp = nX1; -nX1 = nX2; -nX2 = tmp; -} +std::swap(nX1, nX2); if (nY1 > nY2) -{ -tmp = nY1; -nY1 = nY2; -nY2 = tmp; -} +std::swap(nY1, nY2); aPainter.update(nX1, nY1, nX2 - nX1 + 1, nY2 - nY1 + 1); }
Re: ESC tendering policy changes ...
asily. > > + and otherwise to completely ignore this step, or > at least explain what extra purpose it tries to solve > > + Obvious hostages to fortune: > > "Only non-Conflicted Members can vote in the ESC." > > + this needs to be profoundly (and redundantly) > specialized - in the text - to avoid its mis-use, > and mis-quoting outside the context of this policy. > > + please add many more un-necessary words - Carlo > has made a nice neat text, but the messy political > reality is of constant word twisting at TDF. > > + the sign that we need a 'Note:' here to stop > people panic-ing - is a good one that this > will cause problems and mis-understandings > in future. > > + wherever there is a note - make the text > more verbose, and clearer as to scope at > the expense of redundancy. > > + this will save much acrimony & discussion > in future - the definition of Conflicted here > is excessively broad for no obvious reason, it > should not be widely applied. > > With those fixed, it looks fine - plenty of non-controversial & well > drafted stuff in there. In fact - I'm rather pleased with the tone, approach > and balance in general - it's refreshing. > > Since the ESC has (as yet) not been poisoned, and still works by > consensus - it seems good to build a social solution on top of that here > that can work well to avoid the (AFAICS) totally theoretical problem of > people advising the board to invest in one thing or another. > > As I said in the call, there are ideas to have simpler ways to avoid all > of this legalese: for example having the Trustees vote on things they > particularly like / want - although - generally (having helped to run the > ranking in the past) - it is like pulling teeth even getting enough > individuals of the ESC to spend the hour(s) it takes to read all the > proposals, give them a fair hearing and provide a sensible ranking for them. > Possibly this could be a bonus for membership. > > Then again the ESC has traditionally focused on on-sexy, technical debt > type things that we can be sure no-one else will be able to do for fun / > afford. > > Regards, > > Michael. > > -- > michael.me...@collabora.com <><, GM Collabora Productivity > Hangout: mejme...@gmail.com, Skype: mmeeks > (M) +44 7795 666 147 - timezone usually UK / Europe -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
Re: Moving to LibreOffice 8?
* Italo Vignoli (it...@libreoffice.org) wrote: > Moving to LibreOffice 8 (instead of 7.6) makes sense for marketing purposes, > as media is looking at LibreOffice as the real innovator in the open source > office suite market, and the feeling of journalists is that we are forever > stuck at 7.x. > > We all know that the next version will not include any significant > innovation which can justify the change of version, apart from the new build > system for Windows and the availability of LibreOffice for Arm processors on > Windows (which has not been announced). Some time ago, I suggested some cleanups (replacement of sal_Int* types by their standardised versions). Someone pointed out at the time it wasn't possible because it would be an API break, but perhaps we could do it on a major version bump. This was when 7.x was young. So, I'm saying if you are going to bump the major version, it would benefit from some planning ahead rather than a last minute number change so that any other incompatibilities people want to tidy up can be put in. (Irrespective of whether people like my particular change suggestion) Dave > Playing with the number 8, which can be rotated 90° to become the "infinite" > symbol, we can frame the next version as LibreOffice for an infinite number > of users, as we cover all hardware platforms and all operating systems for > personal productivity. > > This is my opinion. If the community wants to stick with 7.6, I won't > insist. I have received enough insults both public and private for the > marketing plan, and I am still receiving them from a few people, that I am > not willing to enter into that process again (even if the decision on the > "community" tag has not been mine, but it looks like people have a very > short memory). > > Looking forward to your thoughts. > -- > Italo Vignoli - LibreOffice Marketing & PR > mobile/signal +39.348.5653829 - email it...@libreoffice.org > hangout/jabber italo.vign...@gmail.com > GPG Key ID - 0xAAB8D5C0 > DB75 1534 3FD0 EA5F 56B5 FDA6 DE82 934C AAB8 D5C0 > -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
Re: Won't save my spread sheets
* Yve Betar (yvecbe...@gmail.com) wrote: > Help! I’ve been using libreoffice on my Mac laptop for a few years > successfully, then yesterday it started refusing to save my files. So I > downloaded an update. But it still won’t “save" or "save as". > > I downloaded java. Still won’t save. > > I’d like to keep using g it, but can’t if it won’t save. Any suggestions? When you say 'won't save' what happens if you try? Dave > Thanks! Yve -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
Re: Crash test update
* crashtest (nore...@documentfoundation.org) wrote: > Hi, > > New crashtest update available at > <https://dev-builds.libreoffice.org/crashtest/9bef99518e910db078149bef08e300afc8b4aaf2/>. Are there any docs on this script? It would be nice if this mail included a pointer to: a) The script b) The test documents (some are easier to find than others) c) Some pointers to how to debug, if those pointers exist. I was looking through the backtraces/ dir and other than looking through the backtrace for the name of the doc file it's not obvious how to associate them. Is this test run with --enable-debug builds? If so it would be nice to capture diag from failed runs. (Out of the 3 I've tried so far, only one fails for me locally, the import from ooo 84576/laisvos_programos-vaiku_lavinimui.odt dies from command line, gives a pretty error from the gui, and either way gives 'MarkManager::makeMark(..) - refusing to create mark on non-textnode' ) Dave > 38 files have crashed during import. > > 16 files have crashed during export. > > 0 files have differences compared to the baseline, which is core.git commit . > (17764 files are excluded.) > > - Your friendly crashtest bot -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-3' - sal/osl
sal/osl/unx/tempfile.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit df994d621261141ae024ead711f2ee957347476b Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 5 18:44:05 2022 + Commit: Christian Lohmaier CommitDate: Wed Nov 16 18:23:17 2022 +0100 TempFile: clear handle on close If we close the file on error, then clear the handle we returned to the caller so it doesn't try and close it again or do anything else with it. Change-Id: Idd054f92f4f3cbc3427896ec9795e588471292d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142344 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 0d9613b77fc653c6144b5e4f0136c0536300c0db) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142306 Reviewed-by: Michael Stahl (cherry picked from commit 84d292960bee73f24450857ff141953be2570094) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142434 Reviewed-by: Eike Rathke Reviewed-by: Xisco Fauli Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/sal/osl/unx/tempfile.cxx b/sal/osl/unx/tempfile.cxx index 29a4d453f80c..3a7138b5218d 100644 --- a/sal/osl/unx/tempfile.cxx +++ b/sal/osl/unx/tempfile.cxx @@ -330,7 +330,13 @@ oslFileError SAL_CALL osl_createTempFile( } if (temp_file_handle) +{ osl_closeFile(temp_file_handle); +if (pHandle) +{ +*pHandle = nullptr; +} +} rtl_uString_release(base_directory);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-3' - comphelper/source
comphelper/source/misc/backupfilehelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 47f7a2bd06e8a1cbdc20196aeef54d74636c8b20 Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 5 18:33:07 2022 + Commit: Christian Lohmaier CommitDate: Wed Nov 16 18:14:45 2022 +0100 TempFile: Initialise handle If the tempfile creation fails, the handle is left uninitialised but we still try and close it, and we explode with various pthread locking corruptions. I think this could be the cause of a bunch of the: https://crashreport.libreoffice.org/stats/signature/osl_closeFile I can trigger it on Linux by setting TMPDIR to a bogus value, but I don't think that's all the cases that we see in the crash reports. Initialising it to null makes the close take a safe path. Change-Id: If66c5629b6bce62e6c4b18a97ecb901abedd4ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142343 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit fa40ea19dbea5f0618d86da8626c35e734bb5220) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142305 Reviewed-by: Michael Stahl (cherry picked from commit f7adc60d6a17f43c14496560e9fbfcc638ff4c41) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142435 Reviewed-by: Eike Rathke Reviewed-by: Xisco Fauli Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index d225b9f301d9..e9b173a47369 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -1244,7 +1244,7 @@ namespace { // need to create a new pack file, do this in a temp file to which data // will be copied from local file (so keep it here until this is done) -oslFileHandle aHandle; +oslFileHandle aHandle = nullptr; OUString aTempURL; // open target temp file - it exists until deleted
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - comphelper/source
comphelper/source/misc/backupfilehelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f7adc60d6a17f43c14496560e9fbfcc638ff4c41 Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 5 18:33:07 2022 + Commit: Michael Stahl CommitDate: Tue Nov 8 11:00:14 2022 +0100 TempFile: Initialise handle If the tempfile creation fails, the handle is left uninitialised but we still try and close it, and we explode with various pthread locking corruptions. I think this could be the cause of a bunch of the: https://crashreport.libreoffice.org/stats/signature/osl_closeFile I can trigger it on Linux by setting TMPDIR to a bogus value, but I don't think that's all the cases that we see in the crash reports. Initialising it to null makes the close take a safe path. Change-Id: If66c5629b6bce62e6c4b18a97ecb901abedd4ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142343 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit fa40ea19dbea5f0618d86da8626c35e734bb5220) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142305 Reviewed-by: Michael Stahl diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index d225b9f301d9..e9b173a47369 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -1244,7 +1244,7 @@ namespace { // need to create a new pack file, do this in a temp file to which data // will be copied from local file (so keep it here until this is done) -oslFileHandle aHandle; +oslFileHandle aHandle = nullptr; OUString aTempURL; // open target temp file - it exists until deleted
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sal/osl
sal/osl/unx/tempfile.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 84d292960bee73f24450857ff141953be2570094 Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 5 18:44:05 2022 + Commit: Michael Stahl CommitDate: Tue Nov 8 10:59:22 2022 +0100 TempFile: clear handle on close If we close the file on error, then clear the handle we returned to the caller so it doesn't try and close it again or do anything else with it. Change-Id: Idd054f92f4f3cbc3427896ec9795e588471292d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142344 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 0d9613b77fc653c6144b5e4f0136c0536300c0db) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142306 Reviewed-by: Michael Stahl diff --git a/sal/osl/unx/tempfile.cxx b/sal/osl/unx/tempfile.cxx index 29a4d453f80c..3a7138b5218d 100644 --- a/sal/osl/unx/tempfile.cxx +++ b/sal/osl/unx/tempfile.cxx @@ -330,7 +330,13 @@ oslFileError SAL_CALL osl_createTempFile( } if (temp_file_handle) +{ osl_closeFile(temp_file_handle); +if (pHandle) +{ +*pHandle = nullptr; +} +} rtl_uString_release(base_directory);
[Libreoffice-commits] core.git: sal/osl
sal/osl/unx/file.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit 503195ad4df320da568fe089b4d0de2f761be660 Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 5 18:50:15 2022 + Commit: Noel Grandin CommitDate: Mon Nov 7 09:11:30 2022 +0100 file: Use calloc Current code does, malloc->memset, that's what calloc is for. Change-Id: Ie3a4872249f78442b96f98c9dad9d7170afe784c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142345 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index ac93ffacd13f..a39365b9b115 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -202,9 +202,7 @@ FileHandle_Impl::FileHandle_Impl(int fd, enum Kind kind, OString path) if (pagesize != size_t(-1)) { m_bufsiz = pagesize; -m_buffer = static_cast(malloc(m_bufsiz)); -if (m_buffer) -memset(m_buffer, 0, m_bufsiz); +m_buffer = static_cast(calloc(1, m_bufsiz)); } } }
[Libreoffice-commits] core.git: sal/osl
sal/osl/unx/tempfile.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 0d9613b77fc653c6144b5e4f0136c0536300c0db Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 5 18:44:05 2022 + Commit: Noel Grandin CommitDate: Mon Nov 7 09:11:04 2022 +0100 TempFile: clear handle on close If we close the file on error, then clear the handle we returned to the caller so it doesn't try and close it again or do anything else with it. Change-Id: Idd054f92f4f3cbc3427896ec9795e588471292d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142344 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sal/osl/unx/tempfile.cxx b/sal/osl/unx/tempfile.cxx index 29a4d453f80c..3a7138b5218d 100644 --- a/sal/osl/unx/tempfile.cxx +++ b/sal/osl/unx/tempfile.cxx @@ -330,7 +330,13 @@ oslFileError SAL_CALL osl_createTempFile( } if (temp_file_handle) +{ osl_closeFile(temp_file_handle); +if (pHandle) +{ +*pHandle = nullptr; +} +} rtl_uString_release(base_directory);
[Libreoffice-commits] core.git: comphelper/source
comphelper/source/misc/backupfilehelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit fa40ea19dbea5f0618d86da8626c35e734bb5220 Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 5 18:33:07 2022 + Commit: Noel Grandin CommitDate: Mon Nov 7 09:09:14 2022 +0100 TempFile: Initialise handle If the tempfile creation fails, the handle is left uninitialised but we still try and close it, and we explode with various pthread locking corruptions. I think this could be the cause of a bunch of the: https://crashreport.libreoffice.org/stats/signature/osl_closeFile I can trigger it on Linux by setting TMPDIR to a bogus value, but I don't think that's all the cases that we see in the crash reports. Initialising it to null makes the close take a safe path. Change-Id: If66c5629b6bce62e6c4b18a97ecb901abedd4ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142343 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index d225b9f301d9..e9b173a47369 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -1244,7 +1244,7 @@ namespace { // need to create a new pack file, do this in a temp file to which data // will be copied from local file (so keep it here until this is done) -oslFileHandle aHandle; +oslFileHandle aHandle = nullptr; OUString aTempURL; // open target temp file - it exists until deleted
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qa vcl/source
vcl/qa/cppunit/pdfexport/pdfexport.cxx |6 ++ vcl/source/gdi/pdfwriter_impl.cxx | 16 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) New commits: commit da7b06425155938fb0d02c6c178d63fd95ad0cd4 Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 13 01:33:06 2021 + Commit: Xisco Fauli CommitDate: Thu Mar 10 10:26:23 2022 +0100 tdf#143216: pdfwriter: Don't treat semi-valid URIs as local paths Currently the PDF writer treats URIs that are rejected by INetURIObject, as local files, and prepends a path to them. For URIs that are valid according to the basic URI syntax, but unhandled by INetURIObject (such as http://user:password@domain) this produces a confusing result with a ./uri in the PDF. Avoid the prefixing where the URI follows the basic URI syntax, even if INetURIObject didn't like it. Change-Id: I87c599885a40fd7101c678ae79f83f594d0f23ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125202 Reviewed-by: Stephan Bergmann Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131259 diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index b6e251509d06..8934e11c0e9f 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -2962,6 +2962,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) "file://localfile.odt/", true, }, +{ +// tdf 143216 +"http://username:passw...@example.com;, +"http://username:passw...@example.com;, +true, +}, { "git://git.example.org/project/example", "git://git.example.org/project/example", diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b5e94882a0fb..141c4f823fc1 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -3280,6 +3281,7 @@ we check in the following sequence: boolbTargetHasPDFExtension = false; INetProtocol eTargetProtocol = aTargetURL.GetProtocol(); boolbIsUNCPath = false; +boolbUnparsedURI = false; // check if the protocol is a known one, or if there is no protocol at all (on target only) // if there is no protocol, make the target relative to the current document directory @@ -3292,14 +3294,14 @@ we check in the following sequence: } else { -INetURLObject aNewBase( aDocumentURL );//duplicate document URL -aNewBase.removeSegment(); //remove last segment from it, obtaining the base URL of the - //target document -aNewBase.insertName( url ); -aTargetURL = aNewBase;//reassign the new target URL +INetURLObject aNewURL(rtl::Uri::convertRelToAbs(m_aContext.BaseURL, url)); +aTargetURL = aNewURL; //reassign the new target URL + //recompute the target protocol, with the new URL //normal URL processing resumes eTargetProtocol = aTargetURL.GetProtocol(); + +bUnparsedURI = eTargetProtocol == INetProtocol::NotValid; } } @@ -3415,7 +3417,9 @@ we check in the following sequence: //substitute the fragment aTargetURL.SetMark( OStringToOUString(aLineLoc.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US) ); } -OUString aURL = aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DecodeMechanism::WithCharset : INetURLObject::DecodeMechanism::NONE ); +OUString aURL = bUnparsedURI ? url : + aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DecodeMechanism::WithCharset : + INetURLObject::DecodeMechanism::NONE ); appendLiteralStringEncrypt(bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL, INetURLObject::EncodeMechanism::WasEncoded, bFileSpec ? INetURLObject::DecodeMechanism::WithCharset : INetURLObject::DecodeMechanism::NONE
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qa
vcl/qa/cppunit/pdfexport/pdfexport.cxx | 73 +++-- 1 file changed, 44 insertions(+), 29 deletions(-) New commits: commit cc86bc599c8b3ce786e05246e8255917ab12 Author: Dr. David Alan Gilbert AuthorDate: Sat Feb 19 15:13:01 2022 + Commit: Xisco Fauli CommitDate: Thu Mar 10 10:25:56 2022 +0100 pdfwriter: Add check without relativeFsys Set relativeFsys on a per-test basis and add a test with relativeFsys off. Change-Id: I43b1d82200aca37b2cf8ac71d77a4aa61df543ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130197 Tested-by: Jenkins Reviewed-by: Stephan Bergmann Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131258 diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 62f4c56efcb9..b6e251509d06 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -2950,28 +2950,43 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) { OUString in; OString out; -} URIs[] = { { - "http://example.com/;, - "http://example.com/;, - }, - { - "file://localfile.odt/", - "file://localfile.odt/", - }, - { - "git://git.example.org/project/example", - "git://git.example.org/project/example", - }, - { - // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' - "filebypath.odt", - "filebypath.pdf", - }, - { - // This also gets made relative due to 'ExportLinksRelativeFsys' - utl::TempFile::GetTempNameBaseDirectory() + "fileintempdir.odt", - "fileintempdir.pdf", - } }; +bool relativeFsys; +} URIs[] += { { +"http://example.com/;, +"http://example.com/;, +true, +}, +{ +"file://localfile.odt/", +"file://localfile.odt/", +true, +}, +{ +"git://git.example.org/project/example", +"git://git.example.org/project/example", +true, +}, +{ +// The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' +"filebypath.odt", +"filebypath.pdf", +true, +}, +{ +// The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' +// but this time with ExportLinksRelativeFsys off the path is added +"filebypath.odt", +OUStringToOString(utl::TempFile::GetTempNameBaseDirectory(), RTL_TEXTENCODING_UTF8) ++ "filebypath.pdf", +false, +}, +{ +// This also gets made relative due to 'ExportLinksRelativeFsys' +utl::TempFile::GetTempNameBaseDirectory() + "fileintempdir.odt", +"fileintempdir.pdf", +true, +} }; // Create an empty document. // Note: The test harness gets very upset if we try and create multiple @@ -2986,15 +3001,15 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) uno::Reference xModel(mxComponent, uno::UNO_QUERY); xModel->attachResource(maTempFile.GetURL(), xModel->getArgs()); -// Test the filename rewriting -uno::Sequence aFilterData(comphelper::InitPropertySequence({ -{ "ExportLinksRelativeFsys", uno::makeAny(true) }, -{ "ConvertOOoTargetToPDFTarget", uno::makeAny(true) }, -})); -aMediaDescriptor["FilterData"] <<= aFilterData; - for (unsigned int i = 0; i < (sizeof(URIs) / sizeof(URIs[0])); i++) { +// Test the filename rewriting +uno::Sequence aFilterData(comphelper::InitPropertySequence({ +{ "ExportLinksRelativeFsys", uno::makeAny(URIs[i].relativeFsys) }, +{ "ConvertOOoTargetToPDFTarget", uno::makeAny(true) }, +})); +aMediaDescriptor["FilterData"] <<= aFilterData; + // Add a link (based on testNestedHyperlink in rtfexport3) xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qa
vcl/qa/cppunit/pdfexport/pdfexport.cxx | 96 + 1 file changed, 96 insertions(+) New commits: commit 0e6e1f37ee1d9fb6de41f6f18759b12d17344310 Author: Dr. David Alan Gilbert AuthorDate: Sun Nov 14 15:26:51 2021 + Commit: Xisco Fauli CommitDate: Thu Mar 10 10:25:40 2022 +0100 pdfwriter: Check URIs exported Check the URIs that are exported. Change-Id: I2d8b00f767a61c5abdb9163701fe497bb258c790 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125203 Tested-by: Jenkins Reviewed-by: Stephan Bergmann Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131257 diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 4050c8a5d7e9..62f4c56efcb9 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -2944,6 +2944,102 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testPdfImageHyperlink) #endif } +CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) +{ +struct +{ +OUString in; +OString out; +} URIs[] = { { + "http://example.com/;, + "http://example.com/;, + }, + { + "file://localfile.odt/", + "file://localfile.odt/", + }, + { + "git://git.example.org/project/example", + "git://git.example.org/project/example", + }, + { + // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' + "filebypath.odt", + "filebypath.pdf", + }, + { + // This also gets made relative due to 'ExportLinksRelativeFsys' + utl::TempFile::GetTempNameBaseDirectory() + "fileintempdir.odt", + "fileintempdir.pdf", + } }; + +// Create an empty document. +// Note: The test harness gets very upset if we try and create multiple +// documents, or recreate it; so reuse one instance for all the links +mxComponent = loadFromDesktop("private:factory/swriter"); +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xText = xTextDocument->getText(); +uno::Reference xCursor = xText->createTextCursor(); +xText->insertString(xCursor, "Test pdf", /*bAbsorb=*/false); + +// Set the name so it can do relative name replacement +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +xModel->attachResource(maTempFile.GetURL(), xModel->getArgs()); + +// Test the filename rewriting +uno::Sequence aFilterData(comphelper::InitPropertySequence({ +{ "ExportLinksRelativeFsys", uno::makeAny(true) }, +{ "ConvertOOoTargetToPDFTarget", uno::makeAny(true) }, +})); +aMediaDescriptor["FilterData"] <<= aFilterData; + +for (unsigned int i = 0; i < (sizeof(URIs) / sizeof(URIs[0])); i++) +{ +// Add a link (based on testNestedHyperlink in rtfexport3) +xCursor->gotoStart(/*bExpand=*/false); +xCursor->gotoEnd(/*bExpand=*/true); +uno::Reference xCursorProps(xCursor, uno::UNO_QUERY); +xCursorProps->setPropertyValue("HyperLinkURL", uno::makeAny(URIs[i].in)); + +// Save as PDF. +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); +xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + +// Use the filter rather than the pdfium route, as per the tdf105093 test, it's +// easier to parse the annotations +vcl::filter::PDFDocument aDocument; + +// Parse the export result. +SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ); +CPPUNIT_ASSERT(aDocument.Read(aStream)); + +// The document has one page. +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); +auto pAnnots = dynamic_cast(aPages[0]->Lookup("Annots")); +CPPUNIT_ASSERT(pAnnots); + +// There should be one annotation +CPPUNIT_ASSERT_EQUAL(static_cast(1), pAnnots->GetElements().size()); +auto pAnnotReference += dynamic_cast(pAnnots->GetElements()[0]); +CPPUNIT_ASSERT(pAnnotReference); +vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject(); +CPPUNIT_ASSERT(pAnnot); +// We're expecting something like /Type /Annot /A << /Type /Action /S /URI /URI (path) +CPPUNIT_ASSERT_EQUAL(
[Libreoffice-commits] core.git: vcl/qa vcl/source
vcl/qa/cppunit/pdfexport/pdfexport.cxx |6 ++ vcl/source/gdi/pdfwriter_impl.cxx | 16 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) New commits: commit 9579737b36e5055d5eb72abc0ace2b9b65600c76 Author: Dr. David Alan Gilbert AuthorDate: Sat Nov 13 01:33:06 2021 + Commit: Stephan Bergmann CommitDate: Wed Mar 9 14:05:27 2022 +0100 tdf#143216: pdfwriter: Don't treat semi-valid URIs as local paths Currently the PDF writer treats URIs that are rejected by INetURIObject, as local files, and prepends a path to them. For URIs that are valid according to the basic URI syntax, but unhandled by INetURIObject (such as http://user:password@domain) this produces a confusing result with a ./uri in the PDF. Avoid the prefixing where the URI follows the basic URI syntax, even if INetURIObject didn't like it. Change-Id: I87c599885a40fd7101c678ae79f83f594d0f23ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125202 Reviewed-by: Stephan Bergmann Tested-by: Jenkins diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 35ca1c9bc051..e7f2354b9118 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -3049,6 +3049,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) "file://localfile.odt/", true, }, +{ +// tdf 143216 +"http://username:passw...@example.com;, +"http://username:passw...@example.com;, +true, +}, { "git://git.example.org/project/example", "git://git.example.org/project/example", diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 21f085fe2660..51291604fe51 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -3280,6 +3281,7 @@ we check in the following sequence: boolbTargetHasPDFExtension = false; INetProtocol eTargetProtocol = aTargetURL.GetProtocol(); boolbIsUNCPath = false; +boolbUnparsedURI = false; // check if the protocol is a known one, or if there is no protocol at all (on target only) // if there is no protocol, make the target relative to the current document directory @@ -3292,14 +3294,14 @@ we check in the following sequence: } else { -INetURLObject aNewBase( aDocumentURL );//duplicate document URL -aNewBase.removeSegment(); //remove last segment from it, obtaining the base URL of the - //target document -aNewBase.insertName( url ); -aTargetURL = aNewBase;//reassign the new target URL +INetURLObject aNewURL(rtl::Uri::convertRelToAbs(m_aContext.BaseURL, url)); +aTargetURL = aNewURL; //reassign the new target URL + //recompute the target protocol, with the new URL //normal URL processing resumes eTargetProtocol = aTargetURL.GetProtocol(); + +bUnparsedURI = eTargetProtocol == INetProtocol::NotValid; } } @@ -3415,7 +3417,9 @@ we check in the following sequence: //substitute the fragment aTargetURL.SetMark( OStringToOUString(aLineLoc.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US) ); } -OUString aURL = aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DecodeMechanism::WithCharset : INetURLObject::DecodeMechanism::NONE ); +OUString aURL = bUnparsedURI ? url : + aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DecodeMechanism::WithCharset : + INetURLObject::DecodeMechanism::NONE ); appendLiteralStringEncrypt(bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL, INetURLObject::EncodeMechanism::WasEncoded, bFileSpec ? INetURLObject::DecodeMechanism::WithCharset : INetURLObject::DecodeMechanism::NONE
[Libreoffice-commits] core.git: vcl/qa
vcl/qa/cppunit/pdfexport/pdfexport.cxx | 73 +++-- 1 file changed, 44 insertions(+), 29 deletions(-) New commits: commit d8c5fdcb3f1e2fdaacc6a7e403a2077d93207c82 Author: Dr. David Alan Gilbert AuthorDate: Sat Feb 19 15:13:01 2022 + Commit: Stephan Bergmann CommitDate: Wed Mar 9 14:05:03 2022 +0100 pdfwriter: Add check without relativeFsys Set relativeFsys on a per-test basis and add a test with relativeFsys off. Change-Id: I43b1d82200aca37b2cf8ac71d77a4aa61df543ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130197 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 60ac42adf707..35ca1c9bc051 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -3037,28 +3037,43 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) { OUString in; OString out; -} URIs[] = { { - "http://example.com/;, - "http://example.com/;, - }, - { - "file://localfile.odt/", - "file://localfile.odt/", - }, - { - "git://git.example.org/project/example", - "git://git.example.org/project/example", - }, - { - // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' - "filebypath.odt", - "filebypath.pdf", - }, - { - // This also gets made relative due to 'ExportLinksRelativeFsys' - utl::TempFile::GetTempNameBaseDirectory() + "fileintempdir.odt", - "fileintempdir.pdf", - } }; +bool relativeFsys; +} URIs[] += { { +"http://example.com/;, +"http://example.com/;, +true, +}, +{ +"file://localfile.odt/", +"file://localfile.odt/", +true, +}, +{ +"git://git.example.org/project/example", +"git://git.example.org/project/example", +true, +}, +{ +// The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' +"filebypath.odt", +"filebypath.pdf", +true, +}, +{ +// The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' +// but this time with ExportLinksRelativeFsys off the path is added +"filebypath.odt", +OUStringToOString(utl::TempFile::GetTempNameBaseDirectory(), RTL_TEXTENCODING_UTF8) ++ "filebypath.pdf", +false, +}, +{ +// This also gets made relative due to 'ExportLinksRelativeFsys' +utl::TempFile::GetTempNameBaseDirectory() + "fileintempdir.odt", +"fileintempdir.pdf", +true, +} }; // Create an empty document. // Note: The test harness gets very upset if we try and create multiple @@ -3073,15 +3088,15 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) uno::Reference xModel(mxComponent, uno::UNO_QUERY); xModel->attachResource(maTempFile.GetURL(), xModel->getArgs()); -// Test the filename rewriting -uno::Sequence aFilterData(comphelper::InitPropertySequence({ -{ "ExportLinksRelativeFsys", uno::makeAny(true) }, -{ "ConvertOOoTargetToPDFTarget", uno::makeAny(true) }, -})); -aMediaDescriptor["FilterData"] <<= aFilterData; - for (unsigned int i = 0; i < (sizeof(URIs) / sizeof(URIs[0])); i++) { +// Test the filename rewriting +uno::Sequence aFilterData(comphelper::InitPropertySequence({ +{ "ExportLinksRelativeFsys", uno::makeAny(URIs[i].relativeFsys) }, +{ "ConvertOOoTargetToPDFTarget", uno::makeAny(true) }, +})); +aMediaDescriptor["FilterData"] <<= aFilterData; + // Add a link (based on testNestedHyperlink in rtfexport3) xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true);
[Libreoffice-commits] core.git: vcl/qa
vcl/qa/cppunit/pdfexport/pdfexport.cxx | 96 + 1 file changed, 96 insertions(+) New commits: commit 2a57ef5512a018bfcfac85a8cd63f2e528f7cdca Author: Dr. David Alan Gilbert AuthorDate: Sun Nov 14 15:26:51 2021 + Commit: Stephan Bergmann CommitDate: Mon Feb 7 11:40:48 2022 +0100 pdfwriter: Check URIs exported Check the URIs that are exported. Change-Id: I2d8b00f767a61c5abdb9163701fe497bb258c790 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125203 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 9bc315fcb2bd..4326b53b80bb 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -2978,6 +2978,102 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testPdfImageHyperlink) #endif } +CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) +{ +struct +{ +OUString in; +OString out; +} URIs[] = { { + "http://example.com/;, + "http://example.com/;, + }, + { + "file://localfile.odt/", + "file://localfile.odt/", + }, + { + "git://git.example.org/project/example", + "git://git.example.org/project/example", + }, + { + // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' + "filebypath.odt", + "filebypath.pdf", + }, + { + // This also gets made relative due to 'ExportLinksRelativeFsys' + utl::TempFile::GetTempNameBaseDirectory() + "fileintempdir.odt", + "fileintempdir.pdf", + } }; + +// Create an empty document. +// Note: The test harness gets very upset if we try and create multiple +// documents, or recreate it; so reuse one instance for all the links +mxComponent = loadFromDesktop("private:factory/swriter"); +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xText = xTextDocument->getText(); +uno::Reference xCursor = xText->createTextCursor(); +xText->insertString(xCursor, "Test pdf", /*bAbsorb=*/false); + +// Set the name so it can do relative name replacement +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +xModel->attachResource(maTempFile.GetURL(), xModel->getArgs()); + +// Test the filename rewriting +uno::Sequence aFilterData(comphelper::InitPropertySequence({ +{ "ExportLinksRelativeFsys", uno::makeAny(true) }, +{ "ConvertOOoTargetToPDFTarget", uno::makeAny(true) }, +})); +aMediaDescriptor["FilterData"] <<= aFilterData; + +for (unsigned int i = 0; i < (sizeof(URIs) / sizeof(URIs[0])); i++) +{ +// Add a link (based on testNestedHyperlink in rtfexport3) +xCursor->gotoStart(/*bExpand=*/false); +xCursor->gotoEnd(/*bExpand=*/true); +uno::Reference xCursorProps(xCursor, uno::UNO_QUERY); +xCursorProps->setPropertyValue("HyperLinkURL", uno::makeAny(URIs[i].in)); + +// Save as PDF. +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); +xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + +// Use the filter rather than the pdfium route, as per the tdf105093 test, it's +// easier to parse the annotations +vcl::filter::PDFDocument aDocument; + +// Parse the export result. +SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ); +CPPUNIT_ASSERT(aDocument.Read(aStream)); + +// The document has one page. +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); +auto pAnnots = dynamic_cast(aPages[0]->Lookup("Annots")); +CPPUNIT_ASSERT(pAnnots); + +// There should be one annotation +CPPUNIT_ASSERT_EQUAL(static_cast(1), pAnnots->GetElements().size()); +auto pAnnotReference += dynamic_cast(pAnnots->GetElements()[0]); +CPPUNIT_ASSERT(pAnnotReference); +vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject(); +CPPUNIT_ASSERT(pAnnot); +// We're expecting something like /Type /Annot /A << /Type /Action /S /URI /URI (path) +CPPUNIT_ASSERT_EQUAL( +OString("Annot"), + static_cast(pAnnot->Lookup("Type&
[Libreoffice-commits] core.git: svx/source
svx/source/stbctrls/pszctrl.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 4c577a0ada8c47483fb8a80a97478ffd3e2b37d3 Author: Dr. David Alan Gilbert AuthorDate: Wed Nov 10 21:44:40 2021 + Commit: Stephan Bergmann CommitDate: Mon Nov 22 10:03:22 2021 +0100 pszctrl: cppcheck undefined shift cppcheck noticed that the shift in: for ( sal_uInt16 nCheck = 1; nCheck < 32; ++nCheck ) if ( nCheckEncoded & (1 << nCheck) ) is undefined since 1 << 31 is implementation defined. Make it 1u, and the others around. (Not that we define bits that high, but we are explicitly checking it) Change-Id: Ieb780ac999af71df2b48ce64daaf4b2878162e35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125016 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx index f273afcdbc61..129ac67eb085 100644 --- a/svx/source/stbctrls/pszctrl.cxx +++ b/svx/source/stbctrls/pszctrl.cxx @@ -162,7 +162,7 @@ FunctionPopup_Impl::FunctionPopup_Impl(sal_uInt32 nCheckEncoded) , m_nSelected(nCheckEncoded) { for ( sal_uInt16 nCheck = 1; nCheck < 32; ++nCheck ) -if ( nCheckEncoded & (1 << nCheck) ) +if ( nCheckEncoded & (1u << nCheck) ) m_xMenu->set_active(function_to_id(nCheck), true); } @@ -174,10 +174,10 @@ sal_uInt32 FunctionPopup_Impl::GetSelected(std::string_view curident) const nSelected = ( 1 << PSZ_FUNC_NONE ); else { -nSelected &= (~( 1 << PSZ_FUNC_NONE )); // Clear the "None" bit -nSelected ^= ( 1 << nCurItemId ); // Toggle the bit corresponding to nCurItemId +nSelected &= (~( 1u << PSZ_FUNC_NONE )); // Clear the "None" bit +nSelected ^= ( 1u << nCurItemId ); // Toggle the bit corresponding to nCurItemId if ( !nSelected ) -nSelected = ( 1 << PSZ_FUNC_NONE ); +nSelected = ( 1u << PSZ_FUNC_NONE ); } return nSelected; }
[Libreoffice-commits] core.git: stoc/test
stoc/test/testcorefl.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit a00fab4e6b7b62a2d9447127a0454da06c83ed54 Author: Dr. David Alan Gilbert AuthorDate: Thu Nov 11 00:24:08 2021 + Commit: Michael Stahl CommitDate: Mon Nov 15 14:44:07 2021 +0100 test_corefl: Fix OSL_ENSURE bracketing cppcheck spotted a couple of misplaced brackets where the error text was ,'d after the end of OSL_ENSURE Change-Id: I5ab2c79b2438b764956e8064df95e713997ad2c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125018 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/stoc/test/testcorefl.cxx b/stoc/test/testcorefl.cxx index 26e469c64063..cd873670b733 100644 --- a/stoc/test/testcorefl.cxx +++ b/stoc/test/testcorefl.cxx @@ -139,10 +139,10 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) typelib_typedescription_release( pTD ); OSL_ENSURE(xClass->getSuperclasses().getLength() == 1, "test_RegCoreReflection(): error 9"); -OSL_ENSURE(xClass->getSuperclasses().getArray()[0]->getName() == "ModuleC.XInterfaceA"), "test_RegCoreReflection(): error 10"; +OSL_ENSURE(xClass->getSuperclasses().getArray()[0]->getName() == "ModuleC.XInterfaceA", "test_RegCoreReflection(): error 10"); OSL_ENSURE(xClass->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11"); OSL_ENSURE(xA->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11a"); -OSL_ENSURE(xClass->getMethods().getArray()[3]->getName() == "methodA"), "test_RegCoreReflection(): 12"; +OSL_ENSURE(xClass->getMethods().getArray()[3]->getName() == "methodA", "test_RegCoreReflection(): 12"); OSL_ENSURE(xClass->getMethods().getArray()[3]->getReturnType()->getTypeClass() == TypeClass_VOID, "test_RegCoreReflection(): error 13"); OSL_ENSURE(xClass->getMethods().getArray()[3]->getParameterTypes().getLength() == 0, "test_RegCoreReflection(): error 14"); OSL_ENSURE(xClass->getMethods().getArray()[3]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 15");
[Libreoffice-commits] core.git: sw/qa
sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit f75974f95f04efef92c2a17eed498d9dd189c7a0 Author: Dr. David Alan Gilbert AuthorDate: Thu Nov 11 00:02:31 2021 + Commit: Xisco Fauli CommitDate: Thu Nov 11 15:42:03 2021 +0100 ooxmlexport test: fix ?: identical values cppcheck spotted a pair of: CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 11331 : 11331), xChildGroup->getPosition().Y); where the ?: has the same values; from https://gerrit.libreoffice.org/c/core/+/115668 squash the ?: Change-Id: I3c1756bd63699408f722824684d71b74c6ea9b7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125017 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 2cc4334b4a4a..9c9604cd9c8b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -368,12 +368,12 @@ DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeChildPosition, "dml-groupshape-childpo uno::Reference xGroup(getShape(1), uno::UNO_QUERY); uno::Reference xChildGroup(xGroup->getByIndex(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(-2123), xChildGroup->getPosition().X); -CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 11331 : 11331), xChildGroup->getPosition().Y); +CPPUNIT_ASSERT_EQUAL(sal_Int32(11331), xChildGroup->getPosition().Y); xGroup.set(xChildGroup, uno::UNO_QUERY); xChildGroup.set(xGroup->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1859), xChildGroup->getPosition().X); -CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 11331 : 11331), xChildGroup->getPosition().Y); +CPPUNIT_ASSERT_EQUAL(sal_Int32(11331), xChildGroup->getPosition().Y); xChildGroup.set(xGroup->getByIndex(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(-2123), xChildGroup->getPosition().X);
[Libreoffice-commits] core.git: lotuswordpro/source sc/source vcl/source
lotuswordpro/source/filter/explode.cxx |2 +- sc/source/core/tool/appoptio.cxx |2 +- sc/source/ui/view/tabvwsha.cxx |2 +- vcl/source/fontsubset/sft.cxx |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) New commits: commit c3a8fe7b40465134e500d5698b1455d2181aed4f Author: Dr. David Alan Gilbert AuthorDate: Sat Jan 30 17:30:39 2021 + Commit: Michael Stahl CommitDate: Mon Feb 1 12:25:35 2021 +0100 cppcheck: Clean up signed 32 bit shift by 31 cppcheck moans about 1<https://gerrit.libreoffice.org/c/core/+/110173 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/lotuswordpro/source/filter/explode.cxx b/lotuswordpro/source/filter/explode.cxx index 359aab5f36cd..4b4ffa25c6cf 100644 --- a/lotuswordpro/source/filter/explode.cxx +++ b/lotuswordpro/source/filter/explode.cxx @@ -197,7 +197,7 @@ sal_uInt32 Decompression::ReadBits(sal_uInt16 iCount, sal_uInt32 & nBits) m_nBitsLeft -= iCount; /* return need bits, zeroing the bits above that */ -nBits = val & ((1 << iCount) - 1); +nBits = val & ((1U << iCount) - 1); return 0; } diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx index fda7236be3c6..1bc0b2540e6b 100644 --- a/sc/source/core/tool/appoptio.cxx +++ b/sc/source/core/tool/appoptio.cxx @@ -252,7 +252,7 @@ static sal_uInt32 lcl_ConvertStatusBarFuncSetToSingle( sal_uInt32 nFuncSet ) if ( !nFuncSet ) return 0; for ( sal_uInt32 nFunc = 1; nFunc < 32; ++nFunc ) -if ( nFuncSet & ( 1 << nFunc ) ) +if ( nFuncSet & ( 1U << nFunc ) ) return nFunc; return 0; } diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 95eb9160f772..07c915ad7b7f 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -73,7 +73,7 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode ) bool bFirst = true; for ( sal_uInt16 nFunc = 0; nFunc < 32; nFunc++ ) { -if ( !(nFuncs & (1 << nFunc)) ) +if ( !(nFuncs & (1U << nFunc)) ) continue; ScSubTotalFunc eFunc = static_cast(nFunc); diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 9fcf26f97d9c..bc4db89582d0 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2234,7 +2234,7 @@ append(std::bitset & rSet, size_t const nOffset, sal_uInt32 const nValue) { for (size_t i = 0; i < 32; ++i) { -rSet.set(nOffset + i, (nValue & (1 << i)) != 0); +rSet.set(nOffset + i, (nValue & (1U << i)) != 0); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: basegfx/source
basegfx/source/polygon/b3dpolygontools.cxx | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) New commits: commit 167f4edc54bca5f62f098dcff2bff3cce4a51c58 Author: Dr. David Alan Gilbert AuthorDate: Sat Jan 23 20:43:43 2021 + Commit: Noel Grandin CommitDate: Sun Jan 31 11:32:37 2021 +0100 basegfx::utils::applyLineDashing simplify !aLineTargetCallBack checks cppcheck points out that there's an early check and return for !aLineTargetCallback: if(fTools::lessOrEqual(fDotDashLength, 0.0) || !aLineTargetCallback || !nPointCount) { return; } so we don't need to test it later. Change-Id: I93fead38ced03ad52c6a81701902cf9deda3bb58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109847 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index 19f885b2e826..1282ddbd216e 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -251,9 +251,7 @@ namespace basegfx::utils while(fTools::less(fDotDashMovingLength, fEdgeLength)) { // new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength] -const bool bHandleLine(bIsLine && aLineTargetCallback); - -if(bHandleLine) +if(bIsLine) { if(!aSnippet.count()) { @@ -274,9 +272,7 @@ namespace basegfx::utils } // append snippet [fLastDotDashMovingLength, fEdgeLength] -const bool bHandleLine(bIsLine && aLineTargetCallback); - -if(bHandleLine) +if(bIsLine) { if(!aSnippet.count()) { @@ -297,15 +293,13 @@ namespace basegfx::utils // append last intermediate results (if exists) if(aSnippet.count()) { -const bool bHandleLine(bIsLine && aLineTargetCallback); - -if(bHandleLine) +if(bIsLine) { implHandleSnippet(aSnippet, aLineTargetCallback, aFirstLine, aLastLine); } } -if(bIsClosed && aLineTargetCallback) +if(bIsClosed) { implHandleFirstLast(aLineTargetCallback, aFirstLine, aLastLine); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/msvbahelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 8f69a05ad7404590f2e4a1ba8d4d69fe896523ce Author: Dr. David Alan Gilbert AuthorDate: Sun Jan 24 01:14:39 2021 + Commit: Noel Grandin CommitDate: Sat Jan 30 08:13:13 2021 +0100 msfilter: msvbahelper, applyShortCutKeyBinding typo'd variable name (Spotted by cppcheck) There's a warning that MacroName is overwritten without being used, and I think it's right; to me it looks like a typo, however I have exactly zero understanding of VBA macros. The function starts with: OUString MacroName( rMacroName ); if ( !MacroName.isEmpty() ) { OUString aMacroName = MacroName.trim(); if( aMacroName.startsWith("!") ) 733 MacroName = aMacroName.copy(1).trim(); . MacroResolvedInfo aMacroInfo = resolveVBAMacro( pShell, aMacroName ); if( !aMacroInfo.mbFound ) throw uno::RuntimeException( "The procedure doesn't exist" ); 745 MacroName = aMacroInfo.msResolvedMacro; cppcheck is complaining MacroName written at 733 is always overwritten at 745 without being used; I think this is a typo and it should be 'aMacroName' that's assigned at 733. Change-Id: Iac568fea4cb6d1a5430bc32a6cf08311edcb1003 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109849 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index d6e4442c2584..6d29cd972fae 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -730,7 +730,7 @@ void applyShortCutKeyBinding ( const uno::Reference< frame::XModel >& rxModel, c { OUString aMacroName = MacroName.trim(); if( aMacroName.startsWith("!") ) -MacroName = aMacroName.copy(1).trim(); +aMacroName = aMacroName.copy(1).trim(); SfxObjectShell* pShell = nullptr; if ( rxModel.is() ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: l10ntools/source
l10ntools/source/helpmerge.cxx | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) New commits: commit 4c7332e5f439774363f29cc7d47494854cc981f5 Author: Dr. David Alan Gilbert AuthorDate: Sun Jan 24 19:01:34 2021 + Commit: Noel Grandin CommitDate: Sat Jan 30 08:12:47 2021 +0100 HelpParser::ProcessHelp: Tidy Null checks cppcheck spotted a repeated nullptr pair of if's near the start that can be squashed. Those gurantee that later pXMLElement is non-null, so we don't need the test later. Change-Id: Ie8fc24490ef031416709d55e6fbdd99e9853c4f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110157 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index e1beff7a5da4..8fed8ffcb452 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -200,9 +200,8 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResDa if( pXMLElement == nullptr ) { printf("Error: Can't find en-US entry\n"); -} -if( pXMLElement == nullptr ) return; +} OString sNewText; OString sNewdata; @@ -239,13 +238,10 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResDa } if (!sNewdata.isEmpty()) { -if( pXMLElement != nullptr ) -{ -XMLData *data = new XMLData( sNewdata , nullptr ); // Add new one -pXMLElement->RemoveAndDeleteAllChildren(); -pXMLElement->AddChild( data ); -aLangHM->erase( sCur ); -} +XMLData *data = new XMLData( sNewdata , nullptr ); // Add new one +pXMLElement->RemoveAndDeleteAllChildren(); +pXMLElement->AddChild( data ); +aLangHM->erase( sCur ); } else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: cppcheck algorithm suggestions
* Lubo?? Lu???k (l.lu...@collabora.com) wrote: > On Saturday 23 of January 2021, Dr. David Alan Gilbert wrote: > > Hi, > > What are peoples feelings for cppcheck's suggestions for stl algorithms? > > In https://gerrit.libreoffice.org/c/core/+/109846 I did a 'any_of' > > and a 'accumulate' that it suggested; the any_of does look better, > > the accumulate seems marginally better. > > To me they both seem as a regression. I find the original code easily > readable, I just look and see, while I need to "decypher" the std algo code. That's fair enough; I think that's especially true of the 'accumulate' one where you still actually have to do the addition and pass a total around. It's a real shame that the algorithm code needs the x.begin(), x.end() that makes it more verbose than I'd have expected. > > Does the project/people have general preferences on whether it's > > worth tackling these suggestions? > > > > I was less sure what to do with the suggestions for 'transform'; > > some of them were replacing very simple loops; another > > was using emplace_back to add the results to the destination and I wasn't > > sure what I'd pass into transform for the equivalent. > > Suggestions from an automated tool are just that, suggestions. IMO common > sense should be a higher priority than blindly following an automated tool. Sure, that's why I asked before plunging in and doing a zillion of them. Dave > -- > Lubo?? Lu??ák > l.lu...@collabora.com > ___ > LibreOffice mailing list > LibreOffice@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/libreoffice -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: compilerplugins/clang
compilerplugins/clang/constfieldsrewrite.cxx |3 --- 1 file changed, 3 deletions(-) New commits: commit 506036ba3f98db5fd83abaf494d3a9ab85561c18 Author: Dr. David Alan Gilbert AuthorDate: Sun Jan 24 17:54:31 2021 + Commit: Noel Grandin CommitDate: Mon Jan 25 14:30:36 2021 +0100 clang/constfieldsrewrite.cxx: Remove duped lines Spotted by cppcheck. A duplicated if and comment; looks like a merge screwup ? Change-Id: Iceed88d85d42be601975b7a1daff7a1f002644d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109863 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/compilerplugins/clang/constfieldsrewrite.cxx b/compilerplugins/clang/constfieldsrewrite.cxx index 03fb3d0c3609..52da9a153455 100644 --- a/compilerplugins/clang/constfieldsrewrite.cxx +++ b/compilerplugins/clang/constfieldsrewrite.cxx @@ -91,9 +91,6 @@ bool ConstFieldsRewrite::VisitFieldDecl(const FieldDecl* fieldDecl) fieldDecl->getCanonicalDecl()->getLocation( return true; // in case we've already processed this field -if (fieldDecl->getType().isConstQualified()) -return true; -// in case we've already processed this field if (fieldDecl->getType().isConstQualified()) return true; // TODO rewriting T& is a bit trickier ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/source
chart2/source/view/axes/VAxisProperties.cxx |3 +-- chart2/source/view/main/VLegend.cxx |5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) New commits: commit 0d5a0bf753dbc5ec3c3320a47972ccbe819787bb Author: Dr. David Alan Gilbert AuthorDate: Sun Jan 24 17:44:39 2021 + Commit: Samuel Mehrbrodt CommitDate: Mon Jan 25 07:57:44 2021 +0100 chart2: Merge some if's Spotted by cppchecker, some sets of if's that can be merged since they have identical conditions. Change-Id: I28c35767eb96e31ab059abcfc014423704c988f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109862 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx index 27a4950a886b..c6e296e277ed 100644 --- a/chart2/source/view/axes/VAxisProperties.cxx +++ b/chart2/source/view/axes/VAxisProperties.cxx @@ -286,10 +286,9 @@ void AxisProperties::init( bool bCartesian ) { maLabelAlignment.mfLabelDirection *= -1.0; maLabelAlignment.mfInnerTickDirection *= -1.0; -} -if( bIsYAxisPosition ) maLabelAlignment.meAlignment = lcl_getLabelAlignmentForYAxis(*this); +} else maLabelAlignment.meAlignment = lcl_getLabelAlignmentForXAxis(*this); } diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 704a48872bf5..77e6b5800dc5 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -348,10 +348,9 @@ awt::Size lcl_placeLegendEntries( //all good proceed with next entry continue; } -} -if( nCurrentColumn < nCurrentColumnCount ) + aColumnWidths[nCurrentColumn] = std::max( nNewWidth, aColumnWidths[nCurrentColumn] ); -else +} else aColumnWidths.push_back(nNewWidth); //do the columns still fit into the given size? ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sdext/source
sdext/source/presenter/PresenterSlideSorter.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit 4e55bf7553fd90639769184e7027f275d31ca0b1 Author: Dr. David Alan Gilbert AuthorDate: Sun Jan 24 02:57:52 2021 + Commit: Samuel Mehrbrodt CommitDate: Mon Jan 25 07:54:37 2021 +0100 PresenterSlideSorter::mouseMoved: Merge identical if cppchecker spotted a pair of neighbouring if's with identical conditions; merge them. Change-Id: I29e13eb5eeca157d06f98c94587167c1a2ddec12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109850 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx b/sdext/source/presenter/PresenterSlideSorter.cxx index e87cb442df25..1f8adc555693 100644 --- a/sdext/source/presenter/PresenterSlideSorter.cxx +++ b/sdext/source/presenter/PresenterSlideSorter.cxx @@ -541,11 +541,9 @@ void SAL_CALL PresenterSlideSorter::mouseMoved (const css::awt::MouseEvent& rEve const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y); sal_Int32 nSlideIndex (mpLayout->GetSlideIndexForPosition(aPosition)); -if (nSlideIndex < 0) -mnSlideIndexMousePressed = -1; - if (nSlideIndex < 0) { +mnSlideIndexMousePressed = -1; mpMouseOverManager->SetSlide(nSlideIndex, awt::Rectangle(0,0,0,0)); } else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: svx/source
svx/source/svdraw/svdmrkv.cxx |4 1 file changed, 4 deletions(-) New commits: commit 2149960b862b83ff7678ce3cba37c226269edbd9 Author: Dr. David Alan Gilbert AuthorDate: Sun Jan 24 03:05:43 2021 + Commit: Noel Grandin CommitDate: Sun Jan 24 17:21:47 2021 +0100 SdrMarkView::SetMarkHandles Merge identical if's Two neighbouring if's spotted by cppcheck with identical conditions; squash. Change-Id: I0b8822991564b994a9c908b28dcf3f2636bb68be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109852 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index dcb8c6037f1b..446020ef48d5 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1092,10 +1092,6 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) if (!bLimitedRotation && !bWdt0) { maHdlList.AddHdl(std::make_unique(aRect.LeftCenter(), SdrHdlKind::Left )); -} - -if (!bLimitedRotation && !bWdt0) -{ maHdlList.AddHdl(std::make_unique(aRect.RightCenter(), SdrHdlKind::Right)); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: svx/source
svx/source/dialog/langbox.cxx |8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) New commits: commit 22070dfc6b9645346de46d90858b6a6b17d8259f Author: Dr. David Alan Gilbert AuthorDate: Sun Jan 24 03:01:42 2021 + Commit: Noel Grandin CommitDate: Sun Jan 24 17:20:07 2021 +0100 SvxLanguageBox::SetLanguageList Merge if's Cppcheck noticed a run of 3 if's with the same condition next to each other; they're fall out of e54d65dea830c which simplified the conditions to all be the same. Squash them. Change-Id: I5f0b928b9a629dc43cc62cc03ab6ced2a4b42b2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109851 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 5b7526d94084..49f608629890 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -224,14 +224,10 @@ void SvxLanguageBox::SetLanguageList(SvxLanguageListFlags nLangList, bool bHasLa { aTmp = xAvail->getAvailableLocales( SN_SPELLCHECKER ); aSpellAvailLang = lcl_LocaleSeqToLangSeq( aTmp ); -} -if (bAddAvailable) -{ + aTmp = xAvail->getAvailableLocales( SN_HYPHENATOR ); aHyphAvailLang = lcl_LocaleSeqToLangSeq( aTmp ); -} -if (bAddAvailable) -{ + aTmp = xAvail->getAvailableLocales( SN_THESAURUS ); aThesAvailLang = lcl_LocaleSeqToLangSeq( aTmp ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
cppcheck algorithm suggestions
Hi, What are peoples feelings for cppcheck's suggestions for stl algorithms? In https://gerrit.libreoffice.org/c/core/+/109846 I did a 'any_of' and a 'accumulate' that it suggested; the any_of does look better, the accumulate seems marginally better. Does the project/people have general preferences on whether it's worth tackling these suggestions? I was less sure what to do with the suggestions for 'transform'; some of them were replacing very simple loops; another was using emplace_back to add the results to the destination and I wasn't sure what I'd pass into transform for the equivalent. Dave -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: understanding ImpForceLineAngle, aGeo and friends
(Replying to my own mail) I'm still following this through - I think I'm going to end up following it through to what it actually reads when it draws the line. In the case of my vertical line, SdrPathObj::NbcResize calls SdrTextObj::NbcResize and that completely rebuilds the rotation angle and aGeo. Still, the maPathPolygon looked OK afterwards so...hmm I'll keep digging. I'd expected the maPathPolygon to be the important bit; (Pointers to the code that actually draws the line would be appreciated). Dave Some of my random debug: SdrPathObj::ImpForceKind this=0x513e4c0 meKind in:2 SdrPathObj::ImpForceKind mod meKind: 2 bClosed: 0 SdrPathObj::ImpForceLineAngle: aPoint0,1: 560,1315,560,5940 aDelt: 0,4625 orig Rot: 31500 Shear: 0 sin/Cos:-0.707107/0.707107 maRect: 57x57@(0,0) SdrPathObj::ImpForceLineAngle: new Rot: -9000 Shear: 0 sin/Cos:-1/2.83277e-16 maRect: 0x4625@(560,1315) SSPP:setPVI PP: [1:<2:(560.126,1315.28)--(560.126,5940.28)>] SvxShapePolyPolygon::setPropertyValueImpl this:0x5115fd0 'TextAutoGrowHeight' nWID: 1069= SvxShapePolyPolygon::setPropertyValueImpl this:0x5115fd0 'TextLeftDistance' nWID: 1071= SvxShapePolyPolygon::setPropertyValueImpl this:0x5115fd0 'TextLowerDistance' nWID: 1074= SvxShapePolyPolygon::setPropertyValueImpl this:0x5115fd0 'TextRightDistance' nWID: 1072= SvxShapePolyPolygon::setPropertyValueImpl this:0x5115fd0 'TextUpperDistance' nWID: 1073= SvxShapePolyPolygon::setPropertyValueImpl this:0x5115fd0 'TextVerticalAdjust' nWID: 1075= SvxShapePolyPolygon::setPropertyValueImpl this:0x5115fd0 'TextWordWrap' nWID: 1091= createAndInsert applying props rot case: mnRotation:0 at 1276 createAndInsert applying props rot case: mnRotation:0 at 1288 SvxShapePolyPolygon::getPropertyValueImpl this:0x5115fd0 'InteropGrabBag' nWID: 3991 SvxShapePolyPolygon::setPropertyValueImpl this:0x5115fd0 'InteropGrabBag' nWID: 3991= createAndInsert applying props rot case: mnRotation:0 at 1311 createAndInsert applying props rot case: mnRotation:0 at 1354 createAndInsert applying props rot case: mnRotation:0 at 1435 createAndInsert LineShape wps special position: 988,2320 createAndInsert applying props rot case: mnRotation:0 at 1444 createAndInsert applying props rot case: mnRotation:0 at 1511 createAndInsert rotation bit: bUseRotT1 mnRot0 nCameraRotation: 0 createAndInsert applying props rot case: mnRotation:0 at 1597 createAndInsert applying props rot case: mnRotation:0 at 1601 SvxShapePolyPolygon::getPropertyValueImpl this:0x5115fd0 'InteropGrabBag' nWID: 3991 Props_name: Shape5 SdrPathObj::NbcResize fResizeX: 1 Y: 1.00022 SdrPathObj::NbcResize transform: [1 0 0; 0 1.00022 -0.284324; 0 0 1] SdrPathObj::NbcResize pre-polys: [1:<2:(560.126,1315.28)--(560.126,5940.28)>] SdrPathObj::NbcResize post-transform-polys: [1:<2:(560.126,1315.28)--(560.126,5941.28)>] SdrTextObj::NbcResize nShearAngle: 0 nRotatationAngle: -9000 bRotate90: 1 bNotSheared: 1 bMirr X/Y:0,0 SdrTextObj::NbcResize (b) maRect in: 0x4625@(560,1315) nRotationAngle: -9000 SdrTextObj::NbcResize (b) maRect out: 0x0@(560,1315) nRotationAngle: 0 SdrTextObj::NbcResize (c) bRota90: 1 nRotationAngle: 0 * Dr. David Alan Gilbert (d...@treblig.org) wrote: > * Regina Henschel (rb.hensc...@t-online.de) wrote: > > Hi David, > > Hi Regina, > Thanks for the reply, > > > Dr. David Alan Gilbert schrieb am 02.01.2021 um 04:35: > > > Hi, > > >I'd appreciate some pointers on shape creation and in > > > particular why ImpForceLineAngle exists. > > > > ImpForceLineAngle() exists from the beginning. I see it already in OOo1.1.5. > > You will find it as ImpForceLineWink() in the history of svdopath.cxx. > > Yep, learnt another word of German :-) > > > [..] > > >a) What is ImpForceLineAngle for, why calculate an angle > > > from the line you've just created? >b) Is that angle supposed to be > > > applied to that line - or > > > is it intended just for something else ? > > > > The purpose is, that the user gets a simple way to have text along the line. > > Without this rotation, the text would always be horizontal, although the > > user creates a non horizontal line. > > Yep, that bit makes sense. > > > I think, at some point between OOo2.4 and OOo3.2.1 this rotation was > > extended to polylines. > > I think this is the bit that's confusing here; most lines get loaded > OK, but for some reason this one is different (and possibly only in Writer); > you'd think if you were going to build a line out of two points stating > where you want them, then you wouldn't expect it to get rotated > (If it always did it, wouldn't all lines end up horizontal). > > > The member aGeo contains the transformation angles. When you apply this > > shear and rotation to the left/top corner of the logic rectangle (membe
Re: understanding ImpForceLineAngle, aGeo and friends
* Regina Henschel (rb.hensc...@t-online.de) wrote: > Hi David, Hi Regina, Thanks for the reply, > Dr. David Alan Gilbert schrieb am 02.01.2021 um 04:35: > > Hi, > >I'd appreciate some pointers on shape creation and in > > particular why ImpForceLineAngle exists. > > ImpForceLineAngle() exists from the beginning. I see it already in OOo1.1.5. > You will find it as ImpForceLineWink() in the history of svdopath.cxx. Yep, learnt another word of German :-) > [..] > >a) What is ImpForceLineAngle for, why calculate an angle > > from the line you've just created? >b) Is that angle supposed to be > > applied to that line - or > > is it intended just for something else ? > > The purpose is, that the user gets a simple way to have text along the line. > Without this rotation, the text would always be horizontal, although the > user creates a non horizontal line. Yep, that bit makes sense. > I think, at some point between OOo2.4 and OOo3.2.1 this rotation was > extended to polylines. I think this is the bit that's confusing here; most lines get loaded OK, but for some reason this one is different (and possibly only in Writer); you'd think if you were going to build a line out of two points stating where you want them, then you wouldn't expect it to get rotated (If it always did it, wouldn't all lines end up horizontal). > The member aGeo contains the transformation angles. When you apply this > shear and rotation to the left/top corner of the logic rectangle (member > maRect) you get the snap rectangle (member maSnapRect). These angles are > part of the API. You need to know, that vertical flip introduces an > additional 180° rotation. OK. > Custom shapes are special in that they have properties mirror vertical and > mirror horizontal in their enhanced geometry, that SdrObjCustomShape has the > true rotation angle as member fObjectRotation, and that they allow text > rotation independent from object rotation in their enhanced geometry. Is there anything I should be reading about this? Dave > Kind regards > Regina > > ___ > LibreOffice mailing list > LibreOffice@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/libreoffice -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
understanding ImpForceLineAngle, aGeo and friends
Hi, I'd appreciate some pointers on shape creation and in particular why ImpForceLineAngle exists. I'm chasing a bug where a line in a docx document ends up 90deg rotated; it's the docx in https://bugs.documentfoundation.org/show_bug.cgi?id=139297 and 'Shape5' - the vertical line at the left that turns out to be horizontal. (That bug has *lots* of other problems, but mostly related to groups, which that shape isn't in, and most of the other issues are location/stretching not transform). I've convinced myself that the polypoly that Shape::createAndInsert creates is correct; a nice simple line with the X's the same, and the Y different; But I'm a bit confused by the call to ImpForceLineAngle - it sets aGeo.nRotationAngle based on the points in the line and ends up with it at -9000; if I force that to 0 then my line stays where I expect it, vertical; (The fact that this is still called when I load a similar pptx and it works, confuses me). a) What is ImpForceLineAngle for, why calculate an angle from the line you've just created? b) Is that angle supposed to be applied to that line - or is it intended just for something else ? Any pointers appreciated! The ImpForceLineAngle is triggered by createAndInsert's PropertySet( xSet ).setProperties( aShapeProps ); call, I think because of the PolyPolygon property. The trace looks like: #0 0x7fa77bd8b530 in SdrPathObj::ImpForceLineAngle() () at /discs/fast/core/instdir/program/libsvxcorelo.so #1 0x7fa77bd8c180 in SdrPathObj::ImpForceKind() () at /discs/fast/core/instdir/program/libsvxcorelo.so #2 0x7fa77bd8ceab in SdrPathObj::NbcSetPathPoly(basegfx::B2DPolyPolygon const&) () at /discs/fast/core/instdir/program/libsvxcorelo.so #3 0x7fa77bd8cf3c in SdrPathObj::SetPathPoly(basegfx::B2DPolyPolygon const&) () at /discs/fast/core/instdir/program/libsvxcorelo.so #4 0x7fa77bee71cc in SvxShapePolyPolygon::SetPolygon(basegfx::B2DPolyPolygon const&) () at /discs/fast/core/instdir/program/libsvxcorelo.so #5 0x7fa77beeaefb in SvxShapePolyPolygon::setPropertyValueImpl(rtl::OUString const&, SfxItemPropertySimpleEntry const*, com::sun::star::uno::Any const&) () at /discs/fast/core/instdir/program/libsvxcorelo.so #6 0x7fa77bf098ab in SvxShape::_setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) () at /discs/fast/core/instdir/program/libsvxcorelo.so #7 0x7fa760acb2bf in SwXShape::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) () at /discs/fast/core/instdir/program/../program/libswlo.so #8 0x7fa77bf07e11 in SvxShape::setPropertyValues(com::sun::star::uno::Sequence const&, com::sun::star::uno::Sequence const&) () at /discs/fast/core/instdir/program/libsvxcorelo.so #9 0x7fa7618fd152 in oox::PropertySet::setProperties(com::sun::star::uno::Sequence const&, com::sun::star::uno::Sequence const&) () at /discs/fast/core/instdir/program/../program/libooxlo.so #10 0x7fa7618fd274 in oox::PropertySet::setProperties(oox::PropertyMap const&) () at /discs/fast/core/instdir/program/../program/libooxlo.so #11 0x7fa7618149d6 in oox::drawingml::Shape::createAndInsert(oox::core::XmlFilterBase&, rtl::OUString const&, oox::drawingml::Theme const*, com::sun::star::uno::Reference const&, bool, bool, basegfx::B2DHomMatrix&, oox::drawingml::FillProperties&, bool) () at /discs/fast/core/instdir/program/../program/libooxlo.so #12 0x7fa7618226bf in oox::drawingml::Shape::addShape(oox::core::XmlFilterBase&, oox::drawingml::Theme const*, com::sun::star::uno::Reference const&, basegfx::B2DHomMatrix const&, oox::drawingml::FillProperties&, std::map, std::less, std::allocator > > >*, bool) () at /discs/fast/core/instdir/program/../program/libooxlo.so #13 0x7fa76198891c in oox::shape::ShapeContextHandler::getShape() () at /discs/fast/core/instdir/program/../program/libooxlo.so #14 0x7fa75e882417 in writerfilter::ooxml::OOXMLFastContextHandlerShape::sendShape(int) () at /discs/fast/core/instdir/program/../program/libwriterfilterlo.so #15 0x7fa75e886391 in writerfilter::ooxml::OOXMLFastContextHandlerShape::lcl_endFastElement(int) () at /discs/fast/core/instdir/program/../program/libwriterfilterlo.so Thanks for any pointers, Dave -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: oox/source
oox/source/export/vmlexport.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 02195a17e88f668fce79937719215c6f5c318245 Author: Dr. David Alan Gilbert AuthorDate: Sun Nov 22 00:56:34 2020 + Commit: Noel Grandin CommitDate: Sun Nov 22 12:52:30 2020 +0100 oox: VML export: Output coordsize even when top/left is 0,0 For a polyline which is written as a shape with a path, the path coordinates are defined by the coordsize; if it's missing we end up writing hmm's when the reader is probably expecting 1000th of parent. Note groups are still very broken. (e.g. try ./sw/qa/extras/ooxmlexport/data/kde216114-1.odt) This fixes the offsetting seen in part 3 of tdf#138374 Change-Id: I61ba36527ee7716db0bda491df7fd9c7e4652dd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106330 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index c708be927ef3..430ade878bf2 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -542,7 +542,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rProps.GetOpt( ESCHER_Prop_geoRight, nRight ); } -if(nTop!=0 && nLeft!=0 && nBottom!=0 && nRight!=0 ) +if(nBottom!=0 && nRight!=0 ) m_pShapeAttrList->add( XML_coordsize, OStringBuffer( 20 ).append( sal_Int32( nRight ) - sal_Int32( nLeft ) ) .append( "," ).append( sal_Int32( nBottom ) - sal_Int32( nTop ) ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/source
oox/source/export/vmlexport.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 553cbea8f66abc08be9ebb9638b8a17b7ecf37a2 Author: Dr. David Alan Gilbert AuthorDate: Fri Nov 20 03:14:58 2020 + Commit: Noel Grandin CommitDate: Sun Nov 22 11:53:01 2020 +0100 Fix ESCHER_Prop_pVertices/ESCHER_Prop_pSegmentInfo output Commit f1ec5dcfca45e reworked the output code to: OString pathString = aPath.makeStringAndClear(); if ( !aPath.isEmpty() && pathString != "xe" ) Unfortunately the 'AndClear' means that the isEmpty is always true so we never get the path string. This happens on complex polygons; e.g. the orange arrows in tdf#138374 Change-Id: I41e69f2e5eb73b49ff512d2c1ca94423bc0bb202 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106212 Tested-by: Noel Grandin Reviewed-by: Noel Grandin diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index e3ed8547aaed..c708be927ef3 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -651,7 +651,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& } } OString pathString = aPath.makeStringAndClear(); -if ( !aPath.isEmpty() && pathString != "xe" ) +if ( !pathString.isEmpty() && pathString != "xe" ) m_pShapeAttrList->add( XML_path, pathString ); } else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/mstoolbar.cxx | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 9aa11d79ce424ec96111763849a0b4de3b440c3e Author: Dr. David Alan Gilbert AuthorDate: Fri Oct 16 14:52:28 2020 +0100 Commit: Caolán McNamara CommitDate: Fri Oct 16 20:26:46 2020 +0200 msfilter: Fix 0x%d debug printfs Generally you want either %d or 0x%x, this had a few 0x%d debugs. Change-Id: Ibe55addd5efb18b17b958f96e53ca1441ae55720 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104440 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx index 43d31aeccd25..fee6cae04c2d 100644 --- a/filter/source/msfilter/mstoolbar.cxx +++ b/filter/source/msfilter/mstoolbar.cxx @@ -211,9 +211,9 @@ void TBCHeader::Print( FILE* fp ) indent_printf(fp," tbct 0x%x\n", static_cast< unsigned int >( tbct )); indent_printf(fp," bPriority 0x%x\n", bPriority ); if ( width.get() ) -indent_printf(fp," width 0x%d(0x%x)\n", *width, *width); +indent_printf(fp," width %d(0x%x)\n", *width, *width); if ( height.get() ) -indent_printf(fp," height 0x%d(0x%x)\n", *height, *height); +indent_printf(fp," height %d(0x%x)\n", *height, *height); } #endif @@ -698,16 +698,16 @@ void TBCCDData::Print( FILE* fp) { Indent a; indent_printf(fp,"[ 0x%x ] TBCCDData -- dump\n", nOffSet ); -indent_printf(fp," cwstrItems items in wstrList 0x%d\n", cwstrItems); +indent_printf(fp," cwstrItems items in wstrList %d\n", cwstrItems); for ( sal_Int32 index=0; index < cwstrItems; ++index ) { Indent b; indent_printf(fp, " wstrList[%d] %s", static_cast< int >( index ), OUStringToOString( wstrList[index].getString(), RTL_TEXTENCODING_UTF8 ).getStr() ); } -indent_printf(fp," cwstrMRU num most recently used string 0x%d item\n", cwstrMRU); -indent_printf(fp," iSel index of selected item 0x%d item\n", iSel); -indent_printf(fp," cLines num of suggested lines to display 0x%d", cLines); -indent_printf(fp," dxWidth width in pixels 0x%d", dxWidth); +indent_printf(fp," cwstrMRU num most recently used string %d item\n", cwstrMRU); +indent_printf(fp," iSel index of selected item %d item\n", iSel); +indent_printf(fp," cLines num of suggested lines to display %d", cLines); +indent_printf(fp," dxWidth width in pixels %d", dxWidth); indent_printf(fp," wstrEdit %s", OUStringToOString( wstrEdit.getString(), RTL_TEXTENCODING_UTF8 ).getStr() ); } #endif ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: tools/CppunitTest_tools_test.mk tools/qa
tools/CppunitTest_tools_test.mk|3 - tools/qa/cppunit/test_cpu_runtime_detection_SSE2.cxx | 20 +-- tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx | 35 + tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx |1 4 files changed, 41 insertions(+), 18 deletions(-) New commits: commit 15a5a56326761b79c9ea56b99a05faee457f1a1b Author: Dr. David Alan Gilbert AuthorDate: Sun Sep 27 03:14:51 2020 +0100 Commit: Tomaž Vajngerl CommitDate: Mon Sep 28 13:22:11 2020 +0200 Fix SSE2 cpuid checks As per afb62b0e96e9bf91ec99857cc16ddb094bcaa3be swing the actual check into a separate file and make only that file be compiled with the specific flag. Change-Id: If848a041fc3a26cfaa79f945d63f6c43f8cf3772 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103497 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk index 23bb86642769..ae22813a61fd 100644 --- a/tools/CppunitTest_tools_test.mk +++ b/tools/CppunitTest_tools_test.mk @@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \ tools/qa/cppunit/test_GenericTypeSerializer \ tools/qa/cppunit/test_cpuid \ tools/qa/cppunit/test_cpu_runtime_detection_AVX2 \ +tools/qa/cppunit/test_cpu_runtime_detection_SSE2 \ tools/qa/cppunit/test_cpu_runtime_detection_SSSE3 \ )) @@ -41,7 +42,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\ )) $(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\ -tools/qa/cppunit/test_cpu_runtime_detection_SSE2, $(CXXFLAGS_INTRINSICS_SSE2) \ +tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check, $(CXXFLAGS_INTRINSICS_SSE2) \ )) $(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\ diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_SSE2.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_SSE2.cxx index 7455d0191844..6da1850a135a 100644 --- a/tools/qa/cppunit/test_cpu_runtime_detection_SSE2.cxx +++ b/tools/qa/cppunit/test_cpu_runtime_detection_SSE2.cxx @@ -9,7 +9,7 @@ #include -#ifdef LO_SSE2_AVAILABLE +#include "test_cpu_runtime_detection_x86_checks.hxx" #include #include @@ -23,7 +23,6 @@ namespace class CpuRuntimeDetection_SSE2 : public CppUnit::TestFixture { public: -void checkSSE2(); void testCpuRuntimeDetection(); CPPUNIT_TEST_SUITE(CpuRuntimeDetection_SSE2); @@ -33,26 +32,13 @@ public: void CpuRuntimeDetection_SSE2::testCpuRuntimeDetection() { -// can only run if this function if CPU supports SSE2 +// can only run this function if CPU supports SSE2 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::SSE2)) -checkSSE2(); -} - -void CpuRuntimeDetection_SSE2::checkSSE2() -{ -// Try some SSE2 intrinsics calculation -__m128i a = _mm_set1_epi32(15); -__m128i b = _mm_set1_epi32(15); -__m128i c = _mm_xor_si128(a, b); - -// Check zero -CPPUNIT_ASSERT_EQUAL(0x, _mm_movemask_epi8(_mm_cmpeq_epi32(c, _mm_setzero_si128(; +CpuRuntimeDetectionX86Checks::checkSSE2(); } CPPUNIT_TEST_SUITE_REGISTRATION(CpuRuntimeDetection_SSE2); } // end anonymous namespace -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx new file mode 100644 index ..14bcc78717d8 --- /dev/null +++ b/tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx @@ -0,0 +1,35 @@ +/* -*- 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 "test_cpu_runtime_detection_x86_checks.hxx" + +void CpuRuntimeDetectionX86Checks::checkSSE2() +{ +#ifdef LO_SSE2_AVAILABLE +// Try some SSE2 intrinsics calculation +__m128i a = _mm_set1_epi32(15); +__m128i b = _mm_set1_epi32(15); +__m128i c = _mm_xor_si128(a, b); + +// Check zero +CPPUNIT_ASSERT_EQUAL(0x, _mm_movemask_epi8(_mm_cmpeq_epi32(c, _mm_setzero_si128(; +#endif +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx b/tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx index 8321216c05b1..0046985acdeb 100644 --- a/tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx +++ b/tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx @@ -14,6 +14,7 @@ class CpuRuntimeDetectionX86Checks { public: static void checkAVX2(); +static void checkSSE2
[Libreoffice-commits] core.git: tools/CppunitTest_tools_test.mk tools/qa
tools/CppunitTest_tools_test.mk |3 tools/qa/cppunit/test_cpu_runtime_detection_SSSE3.cxx | 20 -- tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx | 37 tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx |1 4 files changed, 43 insertions(+), 18 deletions(-) New commits: commit dc4ba0a287d0aebb8d99716025a316f113fee98d Author: Dr. David Alan Gilbert AuthorDate: Sun Sep 27 03:08:54 2020 +0100 Commit: Tomaž Vajngerl CommitDate: Mon Sep 28 13:21:46 2020 +0200 Fix SSSE3 cpuid checks As per afb62b0e96e9bf91ec99857cc16ddb094bcaa3be swing the actual check into a separate file and make only that file be compiled with the specific flag. Change-Id: I7f75453f21271f38e0099bdf6b40f9138d8b4cff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103496 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk index 48c667425ce4..23bb86642769 100644 --- a/tools/CppunitTest_tools_test.mk +++ b/tools/CppunitTest_tools_test.mk @@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \ tools/qa/cppunit/test_GenericTypeSerializer \ tools/qa/cppunit/test_cpuid \ tools/qa/cppunit/test_cpu_runtime_detection_AVX2 \ +tools/qa/cppunit/test_cpu_runtime_detection_SSSE3 \ )) $(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\ @@ -44,7 +45,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\ )) $(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\ -tools/qa/cppunit/test_cpu_runtime_detection_SSSE3, $(CXXFLAGS_INTRINSICS_SSSE3) \ +tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check, $(CXXFLAGS_INTRINSICS_SSSE3) \ )) $(eval $(call gb_CppunitTest_use_sdk_api,tools_test)) diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3.cxx index 9e63e59c7835..290d073745da 100644 --- a/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3.cxx +++ b/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3.cxx @@ -9,7 +9,7 @@ #include -#ifdef LO_SSSE3_AVAILABLE +#include "test_cpu_runtime_detection_x86_checks.hxx" #include #include @@ -23,7 +23,6 @@ namespace class CpuRuntimeDetection_SSSE3 : public CppUnit::TestFixture { public: -void checkSSSE3(); void testCpuRuntimeDetection(); CPPUNIT_TEST_SUITE(CpuRuntimeDetection_SSSE3); @@ -33,26 +32,13 @@ public: void CpuRuntimeDetection_SSSE3::testCpuRuntimeDetection() { -// can only run if this function if CPU supports SSSE3 +// can only run this function if CPU supports SSSE3 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::SSSE3)) -checkSSSE3(); -} - -void CpuRuntimeDetection_SSSE3::checkSSSE3() -{ -// Try some SSSE3 intrinsics calculation -__m128i a = _mm_set1_epi32(3); -__m128i b = _mm_set1_epi32(3); -__m128i c = _mm_maddubs_epi16(a, b); - -// Check result is 9 -CPPUNIT_ASSERT_EQUAL(0x, _mm_movemask_epi8(_mm_cmpeq_epi32(c, _mm_set1_epi32(9; +CpuRuntimeDetectionX86Checks::checkSSSE3(); } CPPUNIT_TEST_SUITE_REGISTRATION(CpuRuntimeDetection_SSSE3); } // end anonymous namespace -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx new file mode 100644 index ..5fd46e62c185 --- /dev/null +++ b/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx @@ -0,0 +1,37 @@ +/* -*- 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_cpu_runtime_detection_x86_checks.hxx" + +/* WARNING: This file is compiled with SSSE3 support, don't call + * any function without checking cpuid to check the CPU can actually + * handle it. + */ +void CpuRuntimeDetectionX86Checks::checkSSSE3() +{ +#ifdef LO_SSSE3_AVAILABLE +// Try some SSSE3 intrinsics calculation +__m128i a = _mm_set1_epi32(3); +__m128i b = _mm_set1_epi32(3); +__m128i c = _mm_maddubs_epi16(a, b); + +// Check result is 9 +CPPUNIT_ASSERT_EQUAL(0x, _mm_movemask_epi8(_mm_cmpeq_epi32(c, _mm_set1_epi32(9; +#endif +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx b/tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx index 94396bf6285d..8321216c05b1 100644 --- a/tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx ++
[Libreoffice-commits] core.git: tools/CppunitTest_tools_test.mk tools/qa
tools/CppunitTest_tools_test.mk|3 tools/qa/cppunit/test_cpu_runtime_detection_AVX2.cxx | 38 - tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx | 54 + tools/qa/cppunit/test_cpu_runtime_detection_x86_checks.hxx | 21 + 4 files changed, 80 insertions(+), 36 deletions(-) New commits: commit afb62b0e96e9bf91ec99857cc16ddb094bcaa3be Author: Dr. David Alan Gilbert AuthorDate: Sun Sep 20 16:36:57 2020 +0100 Commit: Tomaž Vajngerl CommitDate: Tue Sep 22 08:32:58 2020 +0200 Fix AVX2 cpuid checks At the moment test_cpu_runtime_detection_AVX2.cxx is compiled with -mavx2 to allow it to use the intrinsics; however the compiler jumps at the chance to use newer instructions outside the actual test; in my case using AVX in the string manipulation in addTestsToSuite when my CPU doesn't actually have AVX. Swing the actual check into a separate file and only compile that with the extra flag. We probably need the same change for the SSE* checks as well. Change-Id: I1683231932fff264a87c96ac95ac1d24b921163a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103075 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk index aa5ac4606d02..48c667425ce4 100644 --- a/tools/CppunitTest_tools_test.mk +++ b/tools/CppunitTest_tools_test.mk @@ -32,10 +32,11 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \ tools/qa/cppunit/test_xmlwalker \ tools/qa/cppunit/test_GenericTypeSerializer \ tools/qa/cppunit/test_cpuid \ +tools/qa/cppunit/test_cpu_runtime_detection_AVX2 \ )) $(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\ -tools/qa/cppunit/test_cpu_runtime_detection_AVX2, $(CXXFLAGS_INTRINSICS_AVX2) \ +tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check, $(CXXFLAGS_INTRINSICS_AVX2) \ )) $(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\ diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_AVX2.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_AVX2.cxx index 0c98f2fc8c98..5a3a1ee26638 100644 --- a/tools/qa/cppunit/test_cpu_runtime_detection_AVX2.cxx +++ b/tools/qa/cppunit/test_cpu_runtime_detection_AVX2.cxx @@ -8,8 +8,7 @@ */ #include - -#ifdef LO_AVX2_AVAILABLE +#include "test_cpu_runtime_detection_x86_checks.hxx" #include #include @@ -23,7 +22,6 @@ namespace class CpuRuntimeDetection_AVX2 : public CppUnit::TestFixture { public: -void checkAVX2(); void testCpuRuntimeDetection(); CPPUNIT_TEST_SUITE(CpuRuntimeDetection_AVX2); @@ -33,43 +31,13 @@ public: void CpuRuntimeDetection_AVX2::testCpuRuntimeDetection() { -// can only run if this function if CPU supports AVX2 +// can only run this function if CPU supports AVX2 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::AVX2)) -checkAVX2(); -} - -void CpuRuntimeDetection_AVX2::checkAVX2() -{ -__m256i a = _mm256_set_epi64x(1, 4, 8, 3); -__m256i b = _mm256_set_epi64x(2, 1, 1, 5); -__m256i c = _mm256_xor_si256(a, b); - -sal_Int64 values[4]; -_mm256_storeu_si256(reinterpret_cast<__m256i*>(), c); - -CPPUNIT_ASSERT_EQUAL(sal_Int64(6), values[0]); -CPPUNIT_ASSERT_EQUAL(sal_Int64(9), values[1]); -CPPUNIT_ASSERT_EQUAL(sal_Int64(5), values[2]); -CPPUNIT_ASSERT_EQUAL(sal_Int64(3), values[3]); - -__m256i d = _mm256_set_epi64x(3, 5, 1, 0); - -__m256i result = _mm256_cmpeq_epi64(d, c); - -// Compare equals -sal_Int64 compare[4]; -_mm256_storeu_si256(reinterpret_cast<__m256i*>(), result); - -CPPUNIT_ASSERT_EQUAL(sal_Int64(0), compare[0]); -CPPUNIT_ASSERT_EQUAL(sal_Int64(0), compare[1]); -CPPUNIT_ASSERT_EQUAL(sal_Int64(-1), compare[2]); -CPPUNIT_ASSERT_EQUAL(sal_Int64(-1), compare[3]); +CpuRuntimeDetectionX86Checks::checkAVX2(); } CPPUNIT_TEST_SUITE_REGISTRATION(CpuRuntimeDetection_AVX2); } // end anonymous namespace -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx new file mode 100644 index ..b5948223752c --- /dev/null +++ b/tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx @@ -0,0 +1,54 @@ +/* -*- 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_cpu_runtime_detection_x86_checks.hxx" + +/* WARNING: This file is compiled with AVX2 support, don't call + * any
Re: ppt import(?) bug hunting
* Caol?n McNamara (caol...@redhat.com) wrote: > On Sun, 2020-09-13 at 17:58 +0100, Dr. David Alan Gilbert wrote: > > > OK great, I'll look at sending a fix over the weekend. > > > > Done; https://gerrit.libreoffice.org/c/core/+/102542/1 > > > > https://gerrit.libreoffice.org/c/core/+/102590/1 > > looks good to me, merged now, thanks for that Thanks! Dave > ___ > LibreOffice mailing list > LibreOffice@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/libreoffice -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: sd/qa
sd/qa/unit/data/ppt/tdf49856.ppt |binary sd/qa/unit/import-tests.cxx | 18 ++ 2 files changed, 18 insertions(+) New commits: commit f580114e9da5b96a2ba61bbf527e33ab127b2a8d Author: Dr. David Alan Gilbert AuthorDate: Sun Sep 13 17:41:23 2020 +0100 Commit: Caolán McNamara CommitDate: Mon Sep 14 10:09:47 2020 +0200 tdf#49856 Add a test Check that we get the right bullet character. Change-Id: I2e6af6940606d3bacc71bcdf485f7c3b6fa7602b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102590 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sd/qa/unit/data/ppt/tdf49856.ppt b/sd/qa/unit/data/ppt/tdf49856.ppt new file mode 100644 index ..3e6053d4584a Binary files /dev/null and b/sd/qa/unit/data/ppt/tdf49856.ppt differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 3d3032e2e3bd..a6aa1c134738 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -228,6 +228,7 @@ public: void testTdf127964(); void testTdf106638(); void testTdf113198(); +void testTdf49856(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -335,6 +336,7 @@ public: CPPUNIT_TEST(testTdf128684); CPPUNIT_TEST(testTdf113198); CPPUNIT_TEST(testTdf119187); +CPPUNIT_TEST(testTdf49856); CPPUNIT_TEST(testShapeGlowEffectPPTXImpoer); CPPUNIT_TEST(testShapeBlurPPTXImport); @@ -3172,6 +3174,22 @@ void SdImportTest::testTdf119187() } } +void SdImportTest::testTdf49856() +{ +sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/ppt/tdf49856.ppt"), PPT); +const SdrPage *pPage = GetPage(1, xDocShRef); +SdrTextObj *pTxtObj = dynamic_cast(pPage->GetObj(1)); +CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr); +const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); +const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET); +CPPUNIT_ASSERT(pNumFmt); +const sal_Unicode aBullet = pNumFmt->GetNumRule()->GetLevel(0).GetBulletChar(); +CPPUNIT_ASSERT_EQUAL(OUString("More level 2"), aEdit.GetText(2)); +CPPUNIT_ASSERT_EQUAL(u'\x2022', aBullet); + +xDocShRef->DoClose(); +} + void SdImportTest::testShapeGlowEffectPPTXImpoer() { sd::DrawDocShellRef xDocShRef ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/svdfppt.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit f52932218c5365cbe1635f88d310d9e1189ed182 Author: Dr. David Alan Gilbert AuthorDate: Sat Sep 12 20:31:46 2020 +0100 Commit: Caolán McNamara CommitDate: Mon Sep 14 10:09:29 2020 +0200 tdf#49856 Fix level 0 bullet/style on ppt import Long ago, styles were read in starting in slot 1 and slot 0 was backfilled using the last read rule. That changed in 8a64144fddde61dd050da4cb93b4a7242a495bb2 when stuff started at 0; unfortunately the back filling at 0 code was left in, overwritting level 0. Remove it, fixing cases which used level 0; in particular a shift-tab to go up a level ended up with the wrong style. Fixes: 8a64144fddde61dd050da4cb93b4a7242a495bb2 Change-Id: Ic29f3fca9f1c809de69a1d83fca017bdafdd2447 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102542 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index a8e2905ce70d..4e2811d04772 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -4387,8 +4387,6 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd { for ( ;nDepth < nLevels; nDepth++ ) aRule.SetLevel( nDepth, aNumberFormat ); -if ( eNumRuleType == SvxNumRuleType::PRESENTATION_NUMBERING ) -aRule.SetLevel( 0, aNumberFormat ); } } mpNumBulletItem[ i ] = new SvxNumBulletItem( aRule, EE_PARA_NUMBULLET ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
Re: ppt import(?) bug hunting
* Dr. David Alan Gilbert (d...@treblig.org) wrote: > * Caol?n McNamara (caol...@redhat.com) wrote: > > On Sun, 2020-09-06 at 16:30 +0100, Dr. David Alan Gilbert wrote: > > > So I'm now even more convinced that the right thing to do is just > > > nuke these two lines > > > > That does look convincing, that it was left over and accidentally not > > updated at 8a64144fddde61dd050da4cb93b4a7242a495bb2 to the new reality > > OK great, I'll look at sending a fix over the weekend. Done; https://gerrit.libreoffice.org/c/core/+/102542/1 > > > suggest how else I should test it? > > > > Along with your change to fix this, the ideal thing is to also add a > > test to (probably) sd/qa/unit/import-tests.cxx to assert the desired > > value for the numbering level > > I guess the fun is trying to find the right data - maybe like testTdf90626? that ends up as: https://gerrit.libreoffice.org/c/core/+/102590/1 Dave > Dave > > > > > ___ > > LibreOffice mailing list > > LibreOffice@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/libreoffice > -- > -Open up your eyes, open up your mind, open up your code --- > / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ > \dave @ treblig.org | | In Hex / > \ _|_ http://www.treblig.org |___/ > ___ > LibreOffice mailing list > LibreOffice@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/libreoffice -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
David Gilbert license statement
All of my past & future contributions to LibreOffice may be licensed under the MPLv2/LGPLv3+ dual license. (aka freedesk...@treblig.org ) Dave -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: ppt import(?) bug hunting
* Caol?n McNamara (caol...@redhat.com) wrote: > On Sun, 2020-09-06 at 16:30 +0100, Dr. David Alan Gilbert wrote: > > So I'm now even more convinced that the right thing to do is just > > nuke these two lines > > That does look convincing, that it was left over and accidentally not > updated at 8a64144fddde61dd050da4cb93b4a7242a495bb2 to the new reality OK great, I'll look at sending a fix over the weekend. > > suggest how else I should test it? > > Along with your change to fix this, the ideal thing is to also add a > test to (probably) sd/qa/unit/import-tests.cxx to assert the desired > value for the numbering level I guess the fun is trying to find the right data - maybe like testTdf90626? Dave > > ___ > LibreOffice mailing list > LibreOffice@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/libreoffice -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: ppt import(?) bug hunting
* Dr. David Alan Gilbert (d...@treblig.org) wrote: > * Dennis Roczek (dennisroc...@libreoffice.org) wrote: > > Hi Dave, > > > > Am 04.09.2020 um 16:48 schrieb Dr. David Alan Gilbert: > > > * Dennis Roczek (dennisroc...@libreoffice.org) wrote: > > >> Hi Dave, > > > > > > Thanks for the reply, > > > > > >> Am 04.09.2020 um 02:52 schrieb Dr. David Alan Gilbert: > > >>> That code predates the move of the msfilters into that directory - > > >>> is there a tree with history older than that still around so I can > > >>> find the bug/history/reasoning of where that pair of lines came from? > > >> > > >> Yep, there is: > > >> https://cgit.freedesktop.org/libreoffice/filters/tree/filter/source/msfilter?h=libreoffice-3-3-4 > > >> > > >> (Branch might need to be adjusted) > > > > > > Thanks; I'm not sure that goes back far enough - I see commit 6e07a590d4 > > > in there, which pulls the code in and it's titled: > > > > > > '#i106421#: move msfilter to filter' > > and that is > > https://bz.apache.org/ooo/show_bug.cgi?id=106421 > > > > Wow, you went back in time to 2009... > > New bugs are boring - this bug goes back a bit > before that, at least to: > https://bz.apache.org/ooo/show_bug.cgi?id=99843 > in OOo 3.0.1 > > > > and it's all additions, no removals or moves; > > > so it's pulling the code in from somewhere else. > > Yep. You're back in core (sd/source/filter/eppt/) now. > > I'm not sure if it is that - this is the import code > and there seem to (currently) be sd/source/filter/ppt/pptin.cxx > and filter/source/msfilter/svdfppt.cxx - it's the svdfppt.cxx > the code is currently in. I think I've found the cause of this problem, I've not found the original source of this line of code, but I see the commit that broke it. That overwrite of level 0 has been there at least as far back as 1.1.1-4 in 2004; if ( eNumRuleType == SVX_RULETYPE_PRESENTATION_NUMBERING ) aRule.SetLevel( 0, aNumberFormat ); but the idea of the depth changed in https://bz.apache.org/ooo/show_bug.cgi?id=75927 commit 8a64144fddde61dd050da4cb93b4a7242a495bb2 Author: Rüdiger Timm Date: Fri Jun 6 11:34:05 2008 + INTEGRATION: CWS impressodf12 (1.158.12); FILE MERGED 2008/06/04 14:29:44 sj 1.158.12.8: #i90357# fixed bullet indentation when bullets are turned off 2008/05/30 11:59:21 cl 1.158.12.7: fixed unix compile errors 2008/05/30 09:36:37 sj 1.158.12.6: #i75927# taking care of outliner core changes (numbering) 2008/05/29 11:35:40 sj 1.158.12.5: #i75927# taking care of outliner core changes (numbering) 2008/05/26 11:43:09 cl 1.158.12.4: #i35937# code cleanup after bullet rework 2008/04/25 09:00:00 cl 1.158.12.3: RESYNC: (1.158-1.159); FILE MERGED 2008/04/24 15:30:07 cl 1.158.12.2: #i35937# converted EE_PARA_BULLETSTATE to bool item 2008/04/10 16:50:56 cl 1.158.12.1: #i35937# allow paragraph depth of -1 to switch of numbering https://bz.apache.org/ooo/show_bug.cgi?id=75927 the way this code used to work before that commit was that it read in data from the wire into slots 1..4 and then duped them from 5..9 (or was it 10) Then those two lines filled in the empty slot 0. the code used to have: case TSS_TYPE_BODY : case TSS_TYPE_HALFBODY : case TSS_TYPE_QUARTERBODY : nDepth = 1; nLevels = 9; eNumRuleType = SVX_RULETYPE_PRESENTATION_NUMBERING; which is what started reading it at 0. Now in that commit from June 2008 (somewhere just before OOo 3.0.0) it looks like the outliner code changed how the numbering worked (see that bz 75927), and it has: case TSS_TYPE_BODY : case TSS_TYPE_HALFBODY : case TSS_TYPE_QUARTERBODY : -nDepth = 1; -nLevels = 9; +nLevels = 10; so it starts reading straight into slot 0 - but it leaves in my favourite two lines above that nuke slot 0, which now isn't really the same slot 0 as it was previously. So I'm now even more convinced that the right thing to do is just nuke these two lines; does anyone understand this code better before I do this, or suggest how else I should test it? Dave > > I cannot remember if we merged all history from hg, svn, cws to git... > > > > If not, somebody else (Thorsten? *g*) has to help as these old > > repositories are no longer online, if I remember correctly. > > Would be nice! > > Dave > > > Best > > > > Dennis > > > > > > -- > -Open up your eyes, open up your mind, open up your code --- > / Dr. David Alan Gilbert| Run
Re: ppt import(?) bug hunting
* Dennis Roczek (dennisroc...@libreoffice.org) wrote: > Hi Dave, > > Am 04.09.2020 um 16:48 schrieb Dr. David Alan Gilbert: > > * Dennis Roczek (dennisroc...@libreoffice.org) wrote: > >> Hi Dave, > > > > Thanks for the reply, > > > >> Am 04.09.2020 um 02:52 schrieb Dr. David Alan Gilbert: > >>> That code predates the move of the msfilters into that directory - > >>> is there a tree with history older than that still around so I can > >>> find the bug/history/reasoning of where that pair of lines came from? > >> > >> Yep, there is: > >> https://cgit.freedesktop.org/libreoffice/filters/tree/filter/source/msfilter?h=libreoffice-3-3-4 > >> > >> (Branch might need to be adjusted) > > > > Thanks; I'm not sure that goes back far enough - I see commit 6e07a590d4 > > in there, which pulls the code in and it's titled: > > > > '#i106421#: move msfilter to filter' > and that is > https://bz.apache.org/ooo/show_bug.cgi?id=106421 > > Wow, you went back in time to 2009... New bugs are boring - this bug goes back a bit before that, at least to: https://bz.apache.org/ooo/show_bug.cgi?id=99843 in OOo 3.0.1 > > and it's all additions, no removals or moves; > > so it's pulling the code in from somewhere else. > Yep. You're back in core (sd/source/filter/eppt/) now. I'm not sure if it is that - this is the import code and there seem to (currently) be sd/source/filter/ppt/pptin.cxx and filter/source/msfilter/svdfppt.cxx - it's the svdfppt.cxx the code is currently in. > I cannot remember if we merged all history from hg, svn, cws to git... > > If not, somebody else (Thorsten? *g*) has to help as these old > repositories are no longer online, if I remember correctly. Would be nice! Dave > Best > > Dennis > -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: ppt import(?) bug hunting
* Dennis Roczek (dennisroc...@libreoffice.org) wrote: > Hi Dave, Thanks for the reply, > Am 04.09.2020 um 02:52 schrieb Dr. David Alan Gilbert: > > That code predates the move of the msfilters into that directory - > > is there a tree with history older than that still around so I can > > find the bug/history/reasoning of where that pair of lines came from? > > Yep, there is: > https://cgit.freedesktop.org/libreoffice/filters/tree/filter/source/msfilter?h=libreoffice-3-3-4 > > (Branch might need to be adjusted) Thanks; I'm not sure that goes back far enough - I see commit 6e07a590d4 in there, which pulls the code in and it's titled: '#i106421#: move msfilter to filter' and it's all additions, no removals or moves; so it's pulling the code in from somewhere else. Dave > Best regards, > > Dennis Roczek > -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
ppt import(?) bug hunting
Hi, I've been poking about trying to understand a pet bug: https://bugs.documentfoundation.org/show_bug.cgi?id=49856 which is related to bullets in documents that go through a ppt export->import cycle; I've not yet quite convinced myself of whether it's an export or import bug, but I'm down to a couple of lines of code that look suspicious but I could do with a hand understanding why they exist. In the test case, you end up where shift-tab'ing the victim line ends up indenting and switching to a >> bullet rather than doing a simple unindent and getting a round-blob bullet. I've followed the import code, found a situation where the number formats had that >> bullet in the first slot and followed it back, and got as far as svdfppt.cxx, PPTStyleSheet::PPTStyleSheet which, near the bottom has: for ( sal_uInt16 nCount = 0; nDepth < nLevels; nCount++ ) { const PPTParaLevel& rParaLevel = mpParaSheet[ i ]->maParaLevel[ nCount ]; const PPTCharLevel& rCharLevel = mpCharSheet[ i ]->maCharLevel[ nCount ]; SvxNumberFormat aNumberFormat( SVX_NUM_CHAR_SPECIAL ); aNumberFormat.SetBulletChar( ' ' ); GetNumberFormat( rManager, aNumberFormat, nCount, rParaLevel, rCharLevel, i ); aRule.SetLevel( nDepth++, aNumberFormat ); if ( nCount >= 4 ) { for ( ;nDepth < nLevels; nDepth++ ) aRule.SetLevel( nDepth, aNumberFormat ); >>>> if ( eNumRuleType == SvxNumRuleType::PRESENTATION_NUMBERING ) >>>> aRule.SetLevel( 0, aNumberFormat ); } } It seems to be that rule that's overwriting the 0th level with the 4th (?) level - but I don't understand what that line is intended to do or why it's needed. That code predates the move of the msfilters into that directory - is there a tree with history older than that still around so I can find the bug/history/reasoning of where that pair of lines came from? If I remove those 2 lines then my bug disappears - but I'm loathed to submit a patch to do that without understanding why they are there in the first place. (The variable usage in general in that loop is a little odd to me; there's nCount and nDepth but I don't see a situation in which they diverge). I'm also a bit confused why this doesn't cause a bigger problem, it doesn't seem to be level 0 is always wrong, but I've not figured out why. Thanks in advance, Dave -- -Open up your eyes, open up your mind, open up your code --- / Dr. David Alan Gilbert| Running GNU/Linux | Happy \ \dave @ treblig.org | | In Hex / \ _|_ http://www.treblig.org |___/ ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice