core.git: sd/source slideshow/source
sd/source/ui/slideshow/slideshowimpl.cxx | 12 slideshow/source/engine/slideshowimpl.cxx |8 2 files changed, 20 deletions(-) New commits: commit ba431d2bcb70b64bf0eaec29a09916ea37755235 Author: Armin Le Grand AuthorDate: Thu Apr 18 11:59:26 2024 +0200 Commit: Armin Le Grand CommitDate: Mon Apr 22 15:33:21 2024 +0200 Revert "IASS: Correct Buffering of last Slide" This reverts commit 77eb3f1a76892b6070e77324e260204408383ef4. Reason for revert: Better solution in https://gerrit.libreoffice.org/c/core/+/166177 which is 052c668da38b70943d24770895abc8119aace2a6 Change-Id: I42248771c993bcd04c2fe368795db4e1fe7a2586 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166212 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index f8163de5b34e..e11d42a89be9 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -500,18 +500,6 @@ void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow Any(aValue), PropertyState_DIRECT_VALUE); } -else if (-1 == nNextSlideNumber) -{ -// IASS: next slide does not exist, thus current slide is the last one. -// we need to signal to stop Prefetch since else SlideShowImpl *keeps* the -// last slide buffered and will just re-use it when asked to update, thus -// updates will not work. -aProperties.emplace_back( "Prefetch" , --1, -Any(false), -PropertyState_DIRECT_VALUE); -} - if (bSkipAllMainSequenceEffects) { // Add one property that prevents the slide transition from being diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index ee02fc8d8f69..1acc020414db 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1041,14 +1041,6 @@ public: seq[0] >>= mpSlideShowImpl->mxPrefetchSlide; seq[1] >>= mpSlideShowImpl->mxPrefetchAnimationNode; } -else // rProperty.Value might be tested to 'bool' and 'false' -{ -// IASS: There is no 'next' slide (last one is displayed), -// so end/flush Prefetch since that might still hold the -// last slide what would prevent updating/re-creating it -mpSlideShowImpl->mxPrefetchSlide.clear(); -mpSlideShowImpl->mpPrefetchSlide.reset(); -} } else if ( rProperty.Name == "SkipAllMainSequenceEffects" ) {
[Libreoffice-commits] core.git: bin/find-can-be-private-symbols.functions.results canvas/source include/vcl vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win
bin/find-can-be-private-symbols.functions.results |2 canvas/source/vcl/canvashelper.cxx|2 include/vcl/outdev.hxx|8 +-- vcl/headless/svpgdi.cxx |5 ++ vcl/inc/headless/svpgdi.hxx |1 vcl/inc/qt5/QtGraphics.hxx|2 vcl/inc/quartz/salgdi.h |2 vcl/inc/salgdi.hxx| 15 --- vcl/inc/salgdiimpl.hxx|4 + vcl/inc/skia/gdiimpl.hxx |2 vcl/inc/unx/GenPspGfxBackend.hxx |2 vcl/inc/unx/salgdi.h |2 vcl/inc/win/salgdi.h |2 vcl/qt5/QtGraphics_GDI.cxx|3 - vcl/quartz/AquaGraphicsBackend.cxx|2 vcl/skia/gdiimpl.cxx |7 +++ vcl/source/gdi/salgdilayout.cxx | 46 +- vcl/source/outdev/bitmap.cxx | 12 + vcl/source/outdev/bitmapex.cxx|7 --- vcl/unx/generic/gdi/gdiimpl.cxx |5 ++ vcl/unx/generic/gdi/gdiimpl.hxx |2 vcl/unx/generic/gdi/salgdi2.cxx |9 ++-- vcl/unx/generic/print/GenPspGfxBackend.cxx|2 vcl/win/gdi/gdiimpl.cxx |5 ++ vcl/win/gdi/gdiimpl.hxx |2 vcl/win/gdi/salgdi_gdiplus.cxx|9 ++-- 26 files changed, 92 insertions(+), 68 deletions(-) New commits: commit 2c6e2fa596d4ecb22adb062a837f1bbf4384fed2 Author: Armin Le Grand AuthorDate: Fri Dec 10 16:36:11 2021 +0100 Commit: Armin Le Grand CommitDate: Fri Dec 10 17:51:12 2021 +0100 Revert "Re-Enable DrawTransformBitmapExDirect for render backends" This reverts commit 7e5af164b7d293dd410710bed411e1ca64bbecf7. Reason for revert: Not the best/effective way to clear out the stuff remaining to be done, would need additional stuff Change-Id: Ia6ab90384da29a5e34eff0ab8881bad2ab49c58c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126601 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/bin/find-can-be-private-symbols.functions.results b/bin/find-can-be-private-symbols.functions.results index f5ebcac3d329..be8116b9ff90 100644 --- a/bin/find-can-be-private-symbols.functions.results +++ b/bin/find-can-be-private-symbols.functions.results @@ -2750,8 +2750,8 @@ SalGraphics::DrawTransformedBitmap(basegfx::B2DPoint const&, basegfx::B2DPoint c SalGraphics::FillFontSubsetInfo(vcl::TTGlobalFontInfo_ const&, rtl::OUString const&, FontSubsetInfo&) SalGraphics::GetBitmap(long, long, long, long, OutputDevice const&) SalGraphics::GetNativeControlRegion(ControlType, ControlPart, tools::Rectangle const&, ControlState, ImplControlValue const&, tools::Rectangle&, tools::Rectangle&, OutputDevice const&) -SalGraphics::ImplementsFastDrawTransformedBitmap(bool) const SalGraphics::GetPixel(long, long, OutputDevice const&) +SalGraphics::HasFastDrawTransformedBitmap() const SalGraphics::HitTestNativeScrollbar(ControlPart, tools::Rectangle const&, Point const&, bool&, OutputDevice const&) SalGraphics::Invert(long, long, long, long, SalInvert, OutputDevice const&) SalGraphics::Invert(unsigned int, Point const*, SalInvert, OutputDevice const&) diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 2ba45cbfa75d..918a8f5f97fe 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -721,7 +721,7 @@ namespace vclcanvas // itself serves this purpose return uno::Reference< rendering::XCachedPrimitive >(nullptr); } -else if( mpOutDevProvider->getOutDev().ImplementsFastDrawTransformedBitmap()) +else if( mpOutDevProvider->getOutDev().HasFastDrawTransformedBitmap()) { ::basegfx::B2DHomMatrix aSizeTransform; aSizeTransform.scale( aBmpEx.GetSizePixel().Width(), aBmpEx.GetSizePixel().Height() ); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index acf3c78c0d5c..eec957e14973 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1381,11 +1381,11 @@ public: const BitmapEx& rBitmapEx, double fAlpha = 1.0); -/** Return true if DrawTransformedBitmapEx() is implemented. It may still fail, -e.g when fAlpha != 1.0 and that aspect is not implemented. This is a hint -that calling it is worth a try +/** Return true if DrawTransformedBitmapEx() is fast. + +@since 7.2 */ -boolImplementsFastDrawTransformedBitmap() const; +boolHasFastDrawTransformedBitmap() const;
[Libreoffice-commits] core.git: cui/source editeng/source include/svl offapi/com sd/source sfx2/source svx/source
cui/source/tabpages/align.cxx | 13 ++--- cui/source/tabpages/chardlg.cxx| 21 +++-- editeng/source/uno/unotext.cxx |7 +++ include/svl/poolitem.hxx |3 --- offapi/com/sun/star/frame/status/ItemState.idl | 11 +++ sd/source/core/stlsheet.cxx|1 - sd/source/ui/unoidl/unopback.cxx |1 - sfx2/source/toolbox/tbxitem.cxx|2 +- svx/source/table/cell.cxx |1 - svx/source/unodraw/unoshape.cxx|1 - 10 files changed, 32 insertions(+), 29 deletions(-) New commits: commit f3b737ab76efaf1a70dfb22c6b60b08b340cf343 Author: Armin Le Grand AuthorDate: Sat Jun 5 21:30:30 2021 +0200 Commit: Armin Le Grand CommitDate: Tue Jun 8 10:44:21 2021 +0200 Remove SfxItemState::READONLY As I experimented with redesigning the whole Item/ItemSet/ItemPool paradigm, I alredy checked that SfxItemState::READONLY is not used (and no one really knows what it should do or stands for). Since a removal of complexity is needed to get forward with that redesign and I already made some experiences in branch item_refactor2, I propose to remove this state. It is not really used (gets never set). It is mirrored/used in the UNO API in css::frame::status::ItemState as 'READ_ONLY', but also not used in the office's code. ItenmState itself is used in three places, but all set the Item involved by using a SfxVoidItem to state SfxItemState::DISABLED, which I described in ItemState.idl. This means that no state of READ_ONLY in UNO API is ever imported to office code as DISABLED state at all, so not used. I also marked it as deprecated in the *.idl file. I think - including the experimenting in the mentioned branch - that this is safe for now. I already run a full 'make check' on the changed stuff. Change-Id: I8c15cf7b4f803076ecaaea67659f6e022ac7ef70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116752 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Armin Le Grand diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index 142a229f92eb..5ca1e49c8178 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -398,7 +398,6 @@ namespace rTriState.bTriStateEnabled = false; break; case SfxItemState::DISABLED: -case SfxItemState::READONLY: rBtn.set_sensitive(false); rTriState.bTriStateEnabled = false; break; @@ -437,7 +436,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) m_xLbHorAlign->hide(); break; case SfxItemState::DISABLED: -case SfxItemState::READONLY: +//case SfxItemState::READONLY: m_xLbHorAlign->set_sensitive(false); break; case SfxItemState::DONTCARE: @@ -481,7 +480,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) m_xFtIndent->hide(); break; case SfxItemState::DISABLED: -case SfxItemState::READONLY: +//case SfxItemState::READONLY: m_xEdIndent->set_sensitive(false); break; case SfxItemState::DONTCARE: @@ -505,7 +504,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) m_xFtVerAlign->hide(); break; case SfxItemState::DISABLED: -case SfxItemState::READONLY: +//case SfxItemState::READONLY: m_xLbVerAlign->set_sensitive(false); break; case SfxItemState::DONTCARE: @@ -546,7 +545,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) m_xCtrlDialWin->hide(); break; case SfxItemState::DISABLED: -case SfxItemState::READONLY: +//case SfxItemState::READONLY: m_xNfRotate->set_sensitive(false); m_xCtrlDialWin->set_sensitive(false); break; @@ -570,7 +569,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) m_xVsRefEdge->hide(); break; case SfxItemState::DISABLED: -case SfxItemState::READONLY: +//case SfxItemState::READONLY: m_xVsRefEdge->set_sensitive(false); break; case SfxItemState::DONTCARE: @@ -609,7 +608,7 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) m_xLbFrameDir->hide(); break; case SfxItemState::DISABLED: -case SfxItemState::READONLY: +//case SfxItemState::READONLY: m_xLbFrameDir->set_sensitive(false); break; case SfxItemState::DONTCARE: diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 5a40fed3fc00..9755bb7024af
[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - basegfx/source filter/source
basegfx/source/polygon/b2dpolygontools.cxx | 136 ++--- filter/source/msfilter/escherex.cxx| 122 -- 2 files changed, 90 insertions(+), 168 deletions(-) New commits: commit d7efa0382ef236293991e4c7c4f48ce6bb2d64c3 Author: Armin Le Grand AuthorDate: Wed Jul 4 10:13:16 2018 +0200 Commit: Thorsten Behrens CommitDate: Sat Sep 12 18:07:40 2020 +0200 Only access css::drawing::PointSequence when not empty Had to adapt EscherPropertyContainer::GetPolyPolygon due to it using conversions from UNO API drawing::PointSequence to old tools::polygon, containing unsafe memory accesses. It is not useful to fix that, use new tooling instead. Before correctly testing nCount for zero in b2dpolygontools.cxx when you look closely always a point was added - a random one due to accessing random memory. This is corrected, so in test case for "tdf104115.docx" a PolyPolygon with two polys is used, the first being empty (had one point due to the error mentioned above). When having no points, CreatePolygonProperties in escherex.cxx does badly calculate and alloc the pSegmentBuf array used to write to doc formats (in the test case - 20 bytes alloced, 22 written). This did not happen before due to having always a point due to the error before - argh! Corrected that and hopefully this will work now. To be on the safe side and to not need to redefine that whole CreatePolygonProperties I will turn back that little change and better sort-out empty polygons inside GetPolyPolygon alrteady. That should bring us back to the original state, at the same time avoiding that CreatePolygonProperties has to handle empty Polygons at all. That stuff urgently needs cleanup - I took a look and thought about using std::vector so no wrong alloc or write too much could happen, but that nTotalBezPoints needs to be pre-calculated because it gets itself written to that buffers... Change-Id: Iefc885928f5bb29bceaf36c2a1555346bb21fd26 Reviewed-on: https://gerrit.libreoffice.org/56927 Tested-by: Jenkins Reviewed-by: Armin Le Grand Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102533 Tested-by: Thorsten Behrens Reviewed-by: Thorsten Behrens diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index db3365eee313..94590d7483a8 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -3285,90 +3285,94 @@ namespace basegfx // prepare new polygon B2DPolygon aRetval; -const css::awt::Point* pPointSequence = rPointSequenceSource.getConstArray(); -const css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceSource.getConstArray(); -// get first point and flag -B2DPoint aNewCoordinatePair(pPointSequence->X, pPointSequence->Y); pPointSequence++; -css::drawing::PolygonFlags ePolygonFlag(*pFlagSequence); pFlagSequence++; -B2DPoint aControlA; -B2DPoint aControlB; +if(0 != nCount) +{ +const css::awt::Point* pPointSequence = rPointSequenceSource.getConstArray(); +const css::drawing::PolygonFlags* pFlagSequence = rFlagSequenceSource.getConstArray(); -// first point is not allowed to be a control point -OSL_ENSURE(ePolygonFlag != css::drawing::PolygonFlags_CONTROL, -"UnoPolygonBezierCoordsToB2DPolygon: Start point is a control point, illegal input polygon (!)"); +// get first point and flag +B2DPoint aNewCoordinatePair(pPointSequence->X, pPointSequence->Y); pPointSequence++; +css::drawing::PolygonFlags ePolygonFlag(*pFlagSequence); pFlagSequence++; +B2DPoint aControlA; +B2DPoint aControlB; -// add first point as start point -aRetval.append(aNewCoordinatePair); +// first point is not allowed to be a control point +OSL_ENSURE(ePolygonFlag != css::drawing::PolygonFlags_CONTROL, +"UnoPolygonBezierCoordsToB2DPolygon: Start point is a control point, illegal input polygon (!)"); -for(sal_uInt32 b(1); b < nCount;) -{ -// prepare loop -bool bControlA(false); -bool bControlB(false); +// add first point as start point +aRetval.append(aNewCoordinatePair); -// get next point and flag -aNewCoordinatePair = B2DPoint(pPointSequence->X, pPointSequence->Y); -ePolygonFlag = *pFlagSequence; -pPointSequence++; pFlagSequence++; b++; - -if(b < nCount && ePolygonFlag == css::drawing::PolygonFlags_CONTROL) +
[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - basegfx/Library_basegfx.mk basegfx/source include/basegfx include/svx oox/source qadevOOo/Jar_OOoRunner.mk solenv/clang-format svx
basegfx/Library_basegfx.mk|1 basegfx/source/tools/unotools.cxx | 256 -- include/basegfx/utils/unotools.hxx| 38 -- include/svx/unoprov.hxx | 43 +- include/svx/unoshape.hxx | 34 - oox/source/drawingml/shape.cxx| 13 qadevOOo/Jar_OOoRunner.mk |1 solenv/clang-format/blacklist |1 svx/source/customshapes/EnhancedCustomShapeEngine.cxx |3 svx/source/svdraw/svdoashp.cxx|3 svx/source/svdraw/svdopath.cxx| 14 svx/source/unodraw/XPropertyTable.cxx |6 svx/source/unodraw/unopage.cxx| 18 - svx/source/unodraw/unoprov.cxx| 27 - svx/source/unodraw/unoshap2.cxx | 323 ++ svx/source/unodraw/unoshape.cxx |3 svx/source/xoutdev/xattr.cxx | 10 sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 21 - sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |7 sw/qa/extras/rtfimport/rtfimport.cxx | 20 - xmloff/source/draw/xexptran.cxx |1 21 files changed, 212 insertions(+), 631 deletions(-) New commits: commit 6bb5303467309fdcdb04a81597fa494d5221df8b Author: Armin Le Grand AuthorDate: Thu Jun 28 19:48:59 2018 +0200 Commit: Thorsten Behrens CommitDate: Sat Sep 12 18:03:58 2020 +0200 tdf106792 Get rid of SvxShapePolyPolygonBezier SvxShapePolyPolygonBezier was an implementation for the UNO Shape group of polygons with bezier parts (filled/unfilled/ closed/open), e.g. com.sun.star.drawing.OpenBezierShape. It was differing from SvxShapePolyPolygon just by supporting drawing::PolyPolygonBezierCoords instead of the simple drawing::PointSequenceSequence and some details. This leads to problems - the ShapeType *does change* e.g. when you edit a non-bezier Shape in Draw/Impress and change parts to curve (also when closing, see ShapeTypes above). This is why SvxShape::getShapeType() already detects this identifier by using thze internal ShapePolyType (e.g. OBJ_PATHLINE). So there is no reason to have two separate UNO API imple- mentations for sthe same type of SvxShape at all. Get rid of the extra one and unify this implementation detail. Also cleaned up double basegfx tooling for conversions of UNO API Poly/bezier data and B2DPolygon. Adapted test for "tdf113946.docx", see comment there. Adapted test for "tdf90097.rtf", see comment there. Also needed to use the Linux values, also check comment there. Adapted test for "tdf105127.docx", see comment there. Adapted test for "tdf85232.docx", see comment there. Had to fic a problem with test for "tdf96674.docx"- the adaption of the RotateAngle for line objects goes havoc together with the UNO API when scaling is involved. That old aGeo rotate stuff just kills the existing rotation due to numerical inprecise stuff. The UNP API - in trying not just to apply a rptation, but manipulate the existing one then goes wrong in not re-getting the current rotation value anymore. ARGH! This is the original reason for the ols tdf#96674 task - i doubt that the additional code to make a line not exactly hor/ver is needed. Checked and it is not needed, thus removed the change from tdf#96674 in shape.cxx. Change-Id: I2bb8d4cfe33fee3671f3dad60e5c18609a394f9d Reviewed-on: https://gerrit.libreoffice.org/56614 Tested-by: Jenkins Reviewed-by: Armin Le Grand (cherry picked from commit 36bade04d3780bc54c51b46bb0b63e69789658a5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102370 Tested-by: Thorsten Behrens Reviewed-by: Thorsten Behrens diff --git a/basegfx/Library_basegfx.mk b/basegfx/Library_basegfx.mk index de744b5a15ce..76d06b777668 100644 --- a/basegfx/Library_basegfx.mk +++ b/basegfx/Library_basegfx.mk @@ -74,7 +74,6 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\ basegfx/source/tools/stringconversiontools \ basegfx/source/tools/tools \ basegfx/source/tools/unopolypolygon \ -basegfx/source/tools/unotools \ basegfx/source/tools/zoomtools \ basegfx/source/tuple/b2dtuple \ basegfx/source/tuple/b2i64tuple \ diff --git a/basegfx/source/tools/unotools.cxx b/basegfx/source/tools/unotools.cxx deleted file mode 100644 index a80b6b9994a3.. --- a/basegfx/source/tools/unotools.cxx +++ /dev/null @@ -1,256 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v.
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - cui/source
cui/source/tabpages/grfpage.cxx | 56 1 file changed, 45 insertions(+), 11 deletions(-) New commits: commit 5566618ad375617313abfb23829b3ea70bde0ee1 Author: Armin Le Grand AuthorDate: Wed Apr 1 19:21:13 2020 +0200 Commit: Andras Timar CommitDate: Wed May 13 17:56:15 2020 +0200 Avoid XOR paint in Crop dialog Change-Id: I9d3709f9d2a09de1eaace916dc6033de13dbff86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91528 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index 586f9806ce8d..091ef70faddf 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -35,6 +35,9 @@ #include #include #include +#include +#include +#include #define CM_1_TO_TWIP567 #define TWIP_TO_INCH1440 @@ -694,27 +697,58 @@ void SvxCropExample::SetDrawingArea(weld::DrawingArea* pDrawingArea) void SvxCropExample::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&) { -rRenderContext.Push(PushFlags::MAPMODE | PushFlags::RASTEROP); +rRenderContext.Push(PushFlags::MAPMODE); rRenderContext.SetMapMode(m_aMapMode); -Size aWinSize(rRenderContext.PixelToLogic(GetOutputSizePixel())); +// Win BG +const Size aWinSize(rRenderContext.PixelToLogic(GetOutputSizePixel())); rRenderContext.SetLineColor(); rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); rRenderContext.DrawRect(::tools::Rectangle(Point(), aWinSize)); -rRenderContext.SetLineColor(COL_WHITE); -::tools::Rectangle aRect(Point((aWinSize.Width() - m_aFrameSize.Width())/2, - (aWinSize.Height() - m_aFrameSize.Height())/2), - m_aFrameSize); +// use AA, the Graphic may be a metafile/svg and would then look ugly +rRenderContext.SetAntialiasing(AntialiasingFlags::EnableB2dDraw); + +// draw Graphic +::tools::Rectangle aRect( +Point((aWinSize.Width() - m_aFrameSize.Width())/2, (aWinSize.Height() - m_aFrameSize.Height())/2), +m_aFrameSize); m_aGrf.Draw(, aRect.TopLeft(), aRect.GetSize()); -rRenderContext.SetFillColor(COL_TRANSPARENT); -rRenderContext.SetRasterOp(RasterOp::Invert); -aRect.AdjustLeft(m_aTopLeft.Y() ); -aRect.AdjustTop(m_aTopLeft.X() ); +// Remove one more case that uses XOR paint (RasterOp::Invert). +// Get colors and logic DashLength from settings, use equal to +// PolygonMarkerPrimitive2D, may be changed to that primitive later. +// Use this to guarantee good visibility - that was the purpose of +// the former used XOR paint. +const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; +const Color aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor()); +const Color aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor()); +const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength()); +const basegfx::B2DVector aDashVector(rRenderContext.GetInverseViewTransformation() * basegfx::B2DVector(fStripeLength, 0.0)); +const double fLogicDashLength(aDashVector.getX()); + +// apply current crop settings +aRect.AdjustLeft(m_aTopLeft.Y()); +aRect.AdjustTop(m_aTopLeft.X()); aRect.AdjustRight(-m_aBottomRight.Y()); aRect.AdjustBottom(-m_aBottomRight.X()); -rRenderContext.DrawRect(aRect); + +// apply dash with direct paint callbacks +basegfx::utils::applyLineDashing( +basegfx::utils::createPolygonFromRect( +basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom())), +std::vector< double >(2, fLogicDashLength), +[,](const basegfx::B2DPolygon& rSnippet) +{ +rRenderContext.SetLineColor(aColA); +rRenderContext.DrawPolyLine(rSnippet); +}, +[,](const basegfx::B2DPolygon& rSnippet) +{ +rRenderContext.SetLineColor(aColB); +rRenderContext.DrawPolyLine(rSnippet); +}, +2.0 * fLogicDashLength); rRenderContext.Pop(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: drawinglayer/source filter/source include/drawinglayer include/toolkit svgio/CppunitTest_svgio.mk svgio/Library_svgio.mk svgio/source svx/source toolkit/inc toolkit/sou
drawinglayer/source/primitive2d/bitmapprimitive2d.cxx | 25 ++-- drawinglayer/source/primitive2d/controlprimitive2d.cxx|5 + drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx |6 + drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx | 17 ++--- drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |5 - drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx|6 + drawinglayer/source/primitive2d/patternfillprimitive2d.cxx|3 drawinglayer/source/primitive2d/sceneprimitive2d.cxx |6 + drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx |5 - drawinglayer/source/processor2d/hittestprocessor2d.cxx|7 +- drawinglayer/source/processor2d/vclprocessor2d.cxx|4 - drawinglayer/source/tools/emfphelperdata.cxx |5 + drawinglayer/source/tools/wmfemfhelper.cxx|3 filter/source/pdf/pdfdecomposer.cxx |4 - include/drawinglayer/primitive2d/bitmapprimitive2d.hxx| 31 +++--- include/toolkit/helper/vclunohelper.hxx |1 svgio/CppunitTest_svgio.mk|1 svgio/Library_svgio.mk|1 svgio/source/svgreader/svgimagenode.cxx |3 svx/source/sdr/contact/viewcontactofgraphic.cxx |4 - svx/source/sdr/overlay/overlaytools.cxx |6 + toolkit/inc/awt/vclxbitmap.hxx| 11 +++ toolkit/source/awt/vclxbitmap.cxx |7 ++ toolkit/source/helper/vclunohelper.cxx|5 + 24 files changed, 130 insertions(+), 41 deletions(-) New commits: commit ae743c6fae4543282f8930dc78175cc510fabbb3 Author: Armin Le Grand AuthorDate: Fri Apr 10 18:07:41 2020 +0200 Commit: Armin Le Grand CommitDate: Fri Apr 10 20:37:52 2020 +0200 Make BitmapPrimitive2D vcl-independent as preparation to have drawinglayer module independent from vcl in the future Change-Id: Iaa01370f27b51cba5114a54f37d1ec73d0719918 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92048 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx index 1953a36a71ac..f495d531d8ff 100644 --- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx @@ -19,15 +19,16 @@ #include #include +#include using namespace com::sun::star; namespace drawinglayer::primitive2d { -BitmapPrimitive2D::BitmapPrimitive2D(const BitmapEx& rBitmapEx, +BitmapPrimitive2D::BitmapPrimitive2D(const css::uno::Reference& rXBitmap, const basegfx::B2DHomMatrix& rTransform) : BasePrimitive2D() -, maBitmapEx(rBitmapEx) +, maXBitmap(rXBitmap) , maTransform(rTransform) { } @@ -38,8 +39,7 @@ bool BitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { const BitmapPrimitive2D& rCompare = static_cast(rPrimitive); -return (getBitmapEx() == rCompare.getBitmapEx() -&& getTransform() == rCompare.getTransform()); +return (getXBitmap() == rCompare.getXBitmap() && getTransform() == rCompare.getTransform()); } return false; @@ -53,7 +53,22 @@ BitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInforma return aRetval; } -sal_Int64 SAL_CALL BitmapPrimitive2D::estimateUsage() { return getBitmapEx().GetSizeBytes(); } +sal_Int64 SAL_CALL BitmapPrimitive2D::estimateUsage() +{ +if (!getXBitmap().is()) +{ +return 0; +} + +uno::Reference const xAcc(getXBitmap(), uno::UNO_QUERY); + +if (!xAcc.is()) +{ +return 0; +} + +return xAcc->estimateUsage(); +} // provide unique ID ImplPrimitive2DIDBlock(BitmapPrimitive2D, PRIMITIVE2D_ID_BITMAPPRIMITIVE2D) diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index a10f8810da73..600bb4be8a3f 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -37,6 +37,7 @@ #include #include #include +#include using namespace com::sun::star; @@ -205,7 +206,9 @@ namespace drawinglayer::primitive2d aBitmapSizeLogic.getX(), aBitmapSizeLogic.getY(), aTranslate.getX(), aTranslate.getY())); // create primitive -xRetval = new BitmapPrimitive2D(aContent, aBitmapTransform); +xRetval = new BitmapPrimitive2D( +VCLUnoHelper::CreateVCLXBitmap(aContent), +
[Libreoffice-commits] core.git: cui/source
cui/source/tabpages/grfpage.cxx | 56 1 file changed, 45 insertions(+), 11 deletions(-) New commits: commit 2a81384f499ef053ea1b52f05e8f74b13c0b6e0e Author: Armin Le Grand AuthorDate: Wed Apr 1 19:21:13 2020 +0200 Commit: Armin Le Grand CommitDate: Wed Apr 1 21:40:41 2020 +0200 Avoid XOR paint in Crop dialog Change-Id: I9d3709f9d2a09de1eaace916dc6033de13dbff86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91528 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index 96e2fcd1b9e2..7f334e2f11fc 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -35,6 +35,9 @@ #include #include #include +#include +#include +#include #define CM_1_TO_TWIP567 #define TWIP_TO_INCH1440 @@ -698,27 +701,58 @@ void SvxCropExample::SetDrawingArea(weld::DrawingArea* pDrawingArea) void SvxCropExample::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&) { -rRenderContext.Push(PushFlags::MAPMODE | PushFlags::RASTEROP); +rRenderContext.Push(PushFlags::MAPMODE); rRenderContext.SetMapMode(m_aMapMode); -Size aWinSize(rRenderContext.PixelToLogic(GetOutputSizePixel())); +// Win BG +const Size aWinSize(rRenderContext.PixelToLogic(GetOutputSizePixel())); rRenderContext.SetLineColor(); rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); rRenderContext.DrawRect(::tools::Rectangle(Point(), aWinSize)); -rRenderContext.SetLineColor(COL_WHITE); -::tools::Rectangle aRect(Point((aWinSize.Width() - m_aFrameSize.Width())/2, - (aWinSize.Height() - m_aFrameSize.Height())/2), - m_aFrameSize); +// use AA, the Graphic may be a metafile/svg and would then look ugly +rRenderContext.SetAntialiasing(AntialiasingFlags::EnableB2dDraw); + +// draw Graphic +::tools::Rectangle aRect( +Point((aWinSize.Width() - m_aFrameSize.Width())/2, (aWinSize.Height() - m_aFrameSize.Height())/2), +m_aFrameSize); m_aGrf.Draw(, aRect.TopLeft(), aRect.GetSize()); -rRenderContext.SetFillColor(COL_TRANSPARENT); -rRenderContext.SetRasterOp(RasterOp::Invert); -aRect.AdjustLeft(m_aTopLeft.Y() ); -aRect.AdjustTop(m_aTopLeft.X() ); +// Remove one more case that uses XOR paint (RasterOp::Invert). +// Get colors and logic DashLength from settings, use equal to +// PolygonMarkerPrimitive2D, may be changed to that primitive later. +// Use this to guarantee good visibility - that was the purpose of +// the former used XOR paint. +const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; +const Color aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor()); +const Color aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor()); +const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength()); +const basegfx::B2DVector aDashVector(rRenderContext.GetInverseViewTransformation() * basegfx::B2DVector(fStripeLength, 0.0)); +const double fLogicDashLength(aDashVector.getX()); + +// apply current crop settings +aRect.AdjustLeft(m_aTopLeft.Y()); +aRect.AdjustTop(m_aTopLeft.X()); aRect.AdjustRight(-m_aBottomRight.Y()); aRect.AdjustBottom(-m_aBottomRight.X()); -rRenderContext.DrawRect(aRect); + +// apply dash with direct paint callbacks +basegfx::utils::applyLineDashing( +basegfx::utils::createPolygonFromRect( +basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom())), +std::vector< double >(2, fLogicDashLength), +[,](const basegfx::B2DPolygon& rSnippet) +{ +rRenderContext.SetLineColor(aColA); +rRenderContext.DrawPolyLine(rSnippet); +}, +[,](const basegfx::B2DPolygon& rSnippet) +{ +rRenderContext.SetLineColor(aColB); +rRenderContext.DrawPolyLine(rSnippet); +}, +2.0 * fLogicDashLength); rRenderContext.Pop(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/tools/wmfemfhelper.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 5b14a18f4748c7b09b432cfae5577c966213a80b Author: Armin Le Grand AuthorDate: Wed Mar 25 17:40:20 2020 +0100 Commit: Armin Le Grand CommitDate: Wed Mar 25 18:45:44 2020 +0100 tdf#89901 corectly interpret COL_TRANSPARENT in wmfemfhelper when converting Metafile to sequence of Prmitives. In the MetafileActions MetaLineColorAction and MetaFillColorAction usage of COL_TRANSPARENT must switch off line draw/resp. fill Change-Id: Id5754773c06b7f4aa8824dce9b8b9e7e526e6067 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91061 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index b42124eddd38..80989a2edccf 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -2433,7 +2433,8 @@ namespace wmfemfhelper { /** CHECKED, WORKS WELL */ const MetaLineColorAction* pA = static_cast(pAction); -const bool bActive(pA->IsSetting()); +// tdf#89901 do as OutDev does: COL_TRANSPARENT deacvtivates line draw +const bool bActive(pA->IsSetting() && COL_TRANSPARENT != pA->GetColor()); rPropertyHolders.Current().setLineColorActive(bActive); if(bActive) @@ -2445,7 +2446,8 @@ namespace wmfemfhelper { /** CHECKED, WORKS WELL */ const MetaFillColorAction* pA = static_cast(pAction); -const bool bActive(pA->IsSetting()); +// tdf#89901 do as OutDev does: COL_TRANSPARENT deacvtivates polygon fill +const bool bActive(pA->IsSetting() && COL_TRANSPARENT != pA->GetColor()); rPropertyHolders.Current().setFillColorActive(bActive); if(bActive) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sc/source svx/source
sc/source/ui/navipi/content.cxx | 14 ++ svx/source/svdraw/svdxcgv.cxx | 12 +++- 2 files changed, 25 insertions(+), 1 deletion(-) New commits: commit 90f57175abf31ebad850c9653b41eccd230893b8 Author: Armin Le Grand AuthorDate: Tue Mar 10 16:15:45 2020 +0100 Commit: Xisco Faulí CommitDate: Tue Mar 17 14:05:17 2020 +0100 tdf#125520 create a persist correctly for OLE If the D described as in the task is an OLE object we need to create a Persist-object to copy the included EmbeddedObjectContainer Change-Id: Ib8b9677bbc3e6c5b3895abc55e6da5b0a96e33d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90263 Tested-by: Jenkins Reviewed-by: Armin Le Grand Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90336 diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index b3800f9505e6..9c556ecddd91 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -1230,7 +1230,21 @@ static void lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo SdrPageView* pPV = aEditView.GetSdrPageView(); aEditView.MarkObj(pObject, pPV); +// tdf125520 this is a D potentially with an OLE object. If +// so, we need to do similar as e.g. in ScDrawView::BeginDrag so that +// the temporary SdrModel for transfer does have a GetPersist() so +// that the EmbeddedObjectContainer gets copied. We noeed no CheckOle +// here, test is simpler. +ScDocShellRef aDragShellRef; +if(OBJ_OLE2 == pObject->GetObjIdentifier()) +{ +aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately +aDragShellRef->DoInitNew(); +} + +ScDrawLayer::SetGlobalDrawPersist(aDragShellRef.get()); std::unique_ptr pDragModel(aEditView.CreateMarkedObjModel()); +ScDrawLayer::SetGlobalDrawPersist(nullptr); TransferableObjectDescriptor aObjDesc; pSrcShell->FillTransferableObjectDescriptor( aObjDesc ); diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 8fcd742ec71f..88083f3e93e0 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -57,6 +57,7 @@ #include #include #include +#include using namespace com::sun::star; @@ -744,7 +745,16 @@ std::unique_ptr SdrExchangeView::CreateMarkedObjModel() const if(nullptr == pNewObj) { -// not cloned yet, use default way +// not cloned yet +if(pObj->GetObjIdentifier() == OBJ_OLE2 && nullptr == mpModel->GetPersist()) +{ +// tdf#125520 - former fix was wrong, the SdrModel +// has to have a GetPersist() already, see task. +// We can still warn here when this is not the case +SAL_WARN( "svx", "OLE gets cloned Persist, EmbeddedObjectContainer will not be copied" ); +} + +// use default way pNewObj = pObj->CloneSdrObject(*pNewModel); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/primitive2d/svggradientprimitive2d.cxx | 30 + 1 file changed, 21 insertions(+), 9 deletions(-) New commits: commit c20e70d28df21429bba92b6d8a7d7061c2aa5d8b Author: Armin Le Grand AuthorDate: Thu Mar 12 13:31:44 2020 +0100 Commit: Armin Le Grand CommitDate: Thu Mar 12 14:49:39 2020 +0100 tdf#124424 Corrections at SvgGradientHelper for EMF+ Change-Id: Ibda3568887de5df2bc45a9bc8cb424ba7658a768 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90382 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index 4367d8e3eb1a..20d3182e5ba8 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -240,29 +240,32 @@ namespace drawinglayer::primitive2d double fStart, double fEnd) const { +double fInt(0.0); +double fFrac(0.0); +double fEnd2(0.0); + if(SpreadMethod::Pad == getSpreadMethod()) { if(fStart < 0.0) { +fFrac = std::modf(fStart, ); const SvgGradientEntry& rFront(getGradientEntries().front()); -const SvgGradientEntry aTemp(fStart, rFront.getColor(), rFront.getOpacity()); -createAtom(rTargetColor, rTargetOpacity, aTemp, rFront, 0, 0); +const SvgGradientEntry aTemp(1.0 + fFrac, rFront.getColor(), rFront.getOpacity()); +createAtom(rTargetColor, rTargetOpacity, aTemp, rFront, static_cast(fInt - 1), 0); fStart = rFront.getOffset(); } -if(fEnd < 1.0) +if(fEnd > 1.0) { -const SvgGradientEntry& rBack(getGradientEntries().back()); -const SvgGradientEntry aTemp(fEnd, rBack.getColor(), rBack.getOpacity()); -createAtom(rTargetColor, rTargetOpacity, rBack, aTemp, 0, 0); -fEnd = rBack.getOffset(); +// change fEnd early, but create geometry later (after range below) +fEnd2 = fEnd; +fEnd = getGradientEntries().back().getOffset(); } } while(fStart < fEnd) { -double fInt(0.0); -double fFrac(std::modf(fStart, )); +fFrac = std::modf(fStart, ); if(fFrac < 0.0) { @@ -289,6 +292,15 @@ namespace drawinglayer::primitive2d fStart += 1.0; } } + +if(fEnd2 > 1.0) +{ +// create end run for SpreadMethod::Pad late to keep correct creation order +fFrac = std::modf(fEnd2, ); +const SvgGradientEntry& rBack(getGradientEntries().back()); +const SvgGradientEntry aTemp(fFrac, rBack.getColor(), rBack.getOpacity()); +createAtom(rTargetColor, rTargetOpacity, rBack, aTemp, 0, static_cast(fInt)); +} } void SvgGradientHelper::createResult( ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer
drawinglayer/source/primitive2d/svggradientprimitive2d.cxx | 461 +--- drawinglayer/source/tools/emfphelperdata.cxx| 14 include/drawinglayer/primitive2d/svggradientprimitive2d.hxx | 33 3 files changed, 242 insertions(+), 266 deletions(-) New commits: commit c3f0c527b31f5c88263ea63d3d0e332c4783917c Author: Armin Le Grand AuthorDate: Wed Mar 11 14:06:53 2020 +0100 Commit: Armin Le Grand CommitDate: Wed Mar 11 16:24:36 2020 +0100 tdf#124424 Enhanced SvgGradientHelper for EMF+ Added support for repeat modes in GDI+ support and saw that the SVG primitive gradient helpers are not capable to support these completely, so had to do some quite complex adaptions which OTOH will be useful for more complex gradients anyways Change-Id: Ib9a9e4a55115834a4fb00300b05abe17ae36d105 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90329 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index b6b85390a711..4367d8e3eb1a 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include using namespace com::sun::star; @@ -102,131 +104,191 @@ namespace drawinglayer::primitive2d if(rEntries.empty()) { -// no fill at all +// no fill at all, done +return; } -else -{ -const sal_uInt32 nCount(rEntries.size()); -if(1 == nCount) +// sort maGradientEntries by offset, small to big +std::sort(maGradientEntries.begin(), maGradientEntries.end()); + +// gradient with at least two colors +bool bAllInvisible(true); +bool bInvalidEntries(false); + +for(const SvgGradientEntry& rCandidate : rEntries) +{ +if(basegfx::fTools::equalZero(rCandidate.getOpacity())) { -// fill with single existing color -setSingleEntry(); +// invisible +mbFullyOpaque = false; +} +else if(basegfx::fTools::equal(rCandidate.getOpacity(), 1.0)) +{ +// completely opaque +bAllInvisible = false; } else { -// sort maGradientEntries when more than one -std::sort(maGradientEntries.begin(), maGradientEntries.end()); +// opacity +bAllInvisible = false; +mbFullyOpaque = false; +} -// gradient with at least two colors -bool bAllInvisible(true); + if(!basegfx::fTools::betweenOrEqualEither(rCandidate.getOffset(), 0.0, 1.0)) +{ +bInvalidEntries = true; +} +} -for(sal_uInt32 a(0); a < nCount; a++) -{ -const SvgGradientEntry& rCandidate = rEntries[a]; +if(bAllInvisible) +{ +// all invisible, nothing to do +return; +} -if(basegfx::fTools::equalZero(rCandidate.getOpacity())) -{ -// invisible -mbFullyOpaque = false; -} -else if(basegfx::fTools::equal(rCandidate.getOpacity(), 1.0)) -{ -// completely opaque -bAllInvisible = false; -} -else -{ -// opacity -bAllInvisible = false; -mbFullyOpaque = false; -} -} +if(bInvalidEntries) +{ +// invalid entries, do nothing +SAL_WARN("drawinglayer", "SvgGradientHelper got invalid SvgGradientEntries outside [0.0 .. 1.0]"); +return; +} -if(bAllInvisible) -{ -// all invisible, nothing to do -} -else -{ -const basegfx::B2DRange aPolyRange(getPolyPolygon().getB2DRange()); +const basegfx::B2DRange aPolyRange(getPolyPolygon().getB2DRange()); -if(aPolyRange.isEmpty()) -{ -// no range to fill,
[Libreoffice-commits] core.git: sc/source svx/source
sc/source/ui/navipi/content.cxx | 14 ++ svx/source/svdraw/svdxcgv.cxx | 15 ++- 2 files changed, 20 insertions(+), 9 deletions(-) New commits: commit f9e2cfc0d2e244c1550a0e2cc8de960f82eaf9cf Author: Armin Le Grand AuthorDate: Tue Mar 10 16:15:45 2020 +0100 Commit: Armin Le Grand CommitDate: Tue Mar 10 20:06:59 2020 +0100 tdf#125520 create a persist correctly for OLE If the D described as in the task is an OLE object we need to create a Persist-object to copy the included EmbeddedObjectContainer Change-Id: Ib8b9677bbc3e6c5b3895abc55e6da5b0a96e33d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90263 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 49558c8c19b1..48b95d965767 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -1137,7 +1137,21 @@ static bool lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo SdrPageView* pPV = aEditView.GetSdrPageView(); aEditView.MarkObj(pObject, pPV); +// tdf125520 this is a D potentially with an OLE object. If +// so, we need to do similar as e.g. in ScDrawView::BeginDrag so that +// the temporary SdrModel for transfer does have a GetPersist() so +// that the EmbeddedObjectContainer gets copied. We noeed no CheckOle +// here, test is simpler. +ScDocShellRef aDragShellRef; +if(OBJ_OLE2 == pObject->GetObjIdentifier()) +{ +aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately +aDragShellRef->DoInitNew(); +} + +ScDrawLayer::SetGlobalDrawPersist(aDragShellRef.get()); std::unique_ptr pDragModel(aEditView.CreateMarkedObjModel()); +ScDrawLayer::SetGlobalDrawPersist(nullptr); TransferableObjectDescriptor aObjDesc; pSrcShell->FillTransferableObjectDescriptor( aObjDesc ); diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index c3fccab27d74..e8c8a3218a89 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -47,6 +47,7 @@ #include #include #include +#include using namespace com::sun::star; @@ -735,16 +736,12 @@ std::unique_ptr SdrExchangeView::CreateMarkedObjModel() const if(nullptr == pNewObj) { // not cloned yet -if (pObj->GetObjIdentifier() == OBJ_OLE2) +if(pObj->GetObjIdentifier() == OBJ_OLE2 && nullptr == mpModel->GetPersist()) { -// tdf#125520 - temp SdrModel will need a comphelper::IEmbeddedHelper -// to successfully clone the OLE content, use the one from source model -// in the temporary SdrModel - it gets not deleted in SdrModel destructor. -// As long as the temporary SdrModel is used temporarily (and does NOT get -// extended to a full document) this *should* work. There stay some -// concerns about what may happen in BG and if saved/loaded from clipboard, -// so this *might* need to be enhanced in the future. -pNewModel->SetPersist(mpModel->GetPersist()); +// tdf#125520 - former fix was wrong, the SdrModel +// has to have a GetPersist() already, see task. +// We can still warn here when this is not the case +SAL_WARN( "svx", "OLE gets cloned Persist, EmbeddedObjectContainer will not be copied" ); } // use default way ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: drawinglayer/source vcl/headless vcl/opengl vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win
drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 23 - vcl/headless/svpgdi.cxx | 20 ++-- vcl/opengl/gdiimpl.cxx |7 + vcl/qt5/Qt5Graphics_GDI.cxx |6 + vcl/quartz/salgdicommon.cxx |9 +- vcl/skia/gdiimpl.cxx|8 - vcl/source/outdev/line.cxx |7 - vcl/source/outdev/polygon.cxx | 12 +- vcl/source/outdev/polyline.cxx |9 -- vcl/source/outdev/textline.cxx |3 vcl/source/outdev/transparent.cxx |8 - vcl/unx/generic/gdi/gdiimpl.cxx | 25 +++-- vcl/win/gdi/gdiimpl.cxx | 72 ++-- 13 files changed, 97 insertions(+), 112 deletions(-) New commits: commit dd117712bd5692f7bf3870ba91572a0bab54ab86 Author: Armin Le Grand AuthorDate: Thu Mar 5 19:24:30 2020 +0100 Commit: Armin Le Grand CommitDate: Fri Mar 6 10:10:55 2020 +0100 tdf#124848 partial refactor hairline logic With the handover of transformations to line draw calls it is no longer feasible to detect and prepare LineWidth stuff when the old office definition for hairlnes is used, a line width of zero. It was managed in the system-independent part, but now may have to be prepared in logic and not discrete (pixel) coordinates. To do so, find and cleanup all places where 1/1.0 was used as hairline line width. Adapt all seven graphic subsystems to handle the line width == 0/0.0 cases accordingly. Test as good as possible. Change-Id: I2badc045474dcd51612e50597b8406a55d9dc863 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90057 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 4bd490dcfe78..8cff84f3d3bf 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -166,26 +166,6 @@ namespace drawinglayer::processor2d const bool bStrokeAttributeNotUsed(rSource.getStrokeAttribute().isDefault() || 0.0 == rSource.getStrokeAttribute().getFullDotDashLen()); -// check if LineWidth can be simplified in world coordinates -double fLineWidth(rSource.getLineAttribute().getWidth()); - -if(basegfx::fTools::more(fLineWidth, 0.0)) -{ -basegfx::B2DVector aLineWidth(fLineWidth, 0.0); -aLineWidth = maCurrentTransformation * aLineWidth; -const double fWorldLineWidth(aLineWidth.getLength()); - -// draw simple hairline for small line widths -// see also RenderPolygonStrokePrimitive2D which is used if this try fails -bool bIsAntiAliasing = getOptionsDrawinglayer().IsAntiAliasing(); -if ( (basegfx::fTools::lessOrEqual(fWorldLineWidth, 1.0) && bIsAntiAliasing) -|| (basegfx::fTools::lessOrEqual(fWorldLineWidth, 1.5) && !bIsAntiAliasing)) -{ -// draw simple hairline -fLineWidth = 0.0; -} -} - const basegfx::BColor aLineColor( maBColorModifierStack.getModifiedColor( rSource.getLineAttribute().getColor())); @@ -197,7 +177,8 @@ namespace drawinglayer::processor2d return mpOutputDevice->DrawPolyLineDirect( maCurrentTransformation, rLocalPolygon, -fLineWidth, +// tdf#124848 use LineWidth direct, do not try to solve for zero-case (aka hairline) +rSource.getLineAttribute().getWidth(), fTransparency, bStrokeAttributeNotUsed ? nullptr : ().getDotDashArray(), rSource.getLineAttribute().getLineJoin(), diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index de105c5062f9..fb4514eba37d 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1525,22 +1525,20 @@ bool SvpSalGraphics::drawPolyLine( // need to check/handle LineWidth when ObjectToDevice transformation is used basegfx::B2DVector aLineWidth(rLineWidth); const bool bObjectToDeviceIsIdentity(rObjectToDevice.isIdentity()); -const basegfx::B2DVector aDeviceLineWidth(bObjectToDeviceIsIdentity ? rLineWidth : rObjectToDevice * rLineWidth); -const bool bCorrectLineWidth(!bObjectToDeviceIsIdentity && aDeviceLineWidth.getX() < 1.0 && aLineWidth.getX() >= 1.0); -// on-demand inverse of ObjectToDevice transformation -basegfx::B2DHomMatrix aObjectToDeviceInv; - -if(bCorrectLineWidth) +// tdf#124848
[Libreoffice-commits] core.git: svx/source
svx/source/svdraw/svdxcgv.cxx | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) New commits: commit d08d5c1857482cb3789ed2896921abeb83f4d217 Author: Armin Le Grand AuthorDate: Wed Mar 4 17:40:50 2020 +0100 Commit: Armin Le Grand CommitDate: Wed Mar 4 20:53:49 2020 +0100 tdf#125520 enhance internal OLE cloning For D/Copy te temp SdrModel had no IEmbeddedHelper/Persist, so use the one from the source SDrModel in the temporary one for transfer/cloning. Should be okay, the persist is part of the DocumentModels, handed to the SDrModel for usage and *not* destroyed when SdrModel gets destroyed Change-Id: I46e9e371ef8802d6c1c5bfe761b26651ae6e1f73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89986 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 1c5664a2602e..4ba25a6c1265 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -734,7 +734,20 @@ std::unique_ptr SdrExchangeView::CreateMarkedObjModel() const if(nullptr == pNewObj) { -// not cloned yet, use default way +// not cloned yet +if (pObj->GetObjIdentifier() == OBJ_OLE2) +{ +// tdf#125520 - temp SdrModel will need a comphelper::IEmbeddedHelper +// to succesfully clone the OLE content, use the one from source model +// in the temporary SdrModel - it gets not deleted in SdrModel destructor. +// As long as the temporary SdrModel is used temprary (and does NOT get +// extended to a full document) this *should* work. There stay some +// concerns about what may happen in BG and if saved/loaded from clipboard, +// so this *might* need to be enhanced in the future. +pNewModel->SetPersist(mpModel->GetPersist()); +} + +// use default way pNewObj = pObj->CloneSdrObject(*pNewModel); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/headless
vcl/headless/svpgdi.cxx | 367 +--- 1 file changed, 256 insertions(+), 111 deletions(-) New commits: commit 7c0378c0bea935c0aac2f519c53c30b2e4d8bbf9 Author: Armin Le Grand AuthorDate: Fri Feb 28 15:25:58 2020 +0100 Commit: Armin Le Grand CommitDate: Sat Feb 29 14:43:00 2020 +0100 tdf#130768 add a pre-scale version for cairo As explained in the task, suopport (2) by adding a cached pre-scaled cairo_surface_t buffer that works similar to a mip-map and thus uses as maximum a fa tor 0f 1.25 for speeding up painting of smaller versions of huge bitmaps Change-Id: I4fcc221a0fbb5a243fe93813f3fe1f3cdb4e0566 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89718 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 9a2fe936e782..de105c5062f9 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -251,13 +251,161 @@ namespace return pDst; } -class SourceHelper +// check for env var that decides for using downscale pattern +static const char* pDisableDownScale(getenv("SAL_DISABLE_CAIRO_DOWNSCALE")); +static bool bDisableDownScale(nullptr != pDisableDownScale); + +class SurfaceHelper +{ +private: +cairo_surface_t* pSurface; +std::unordered_map maDownscaled; + +SurfaceHelper(const SurfaceHelper&) = delete; +SurfaceHelper& operator=(const SurfaceHelper&) = delete; + +cairo_surface_t* implCreateOrReuseDownscale( +unsigned long nTargetWidth, +unsigned long nTargetHeight) +{ +const unsigned long nSourceWidth(cairo_image_surface_get_width(pSurface)); +const unsigned long nSourceHeight(cairo_image_surface_get_height(pSurface)); + +// zoomed in, need to stretch at paint, no pre-scale useful +if(nTargetWidth >= nSourceWidth || nTargetHeight >= nSourceHeight) +{ +return pSurface; +} + +// calculate downscale factor +unsigned long nWFactor(1); +unsigned long nW((nSourceWidth + 1) / 2); +unsigned long nHFactor(1); +unsigned long nH((nSourceHeight + 1) / 2); + +while(nW > nTargetWidth && nW > 1) +{ +nW = (nW + 1) / 2; +nWFactor *= 2; +} + +while(nH > nTargetHeight && nH > 1) +{ +nH = (nH + 1) / 2; +nHFactor *= 2; +} + +if(1 == nWFactor && 1 == nHFactor) +{ +// original size *is* best binary size, use it +return pSurface; +} + +// go up one scale again - look for no change +nW = (1 == nWFactor) ? nTargetWidth : nW * 2; +nH = (1 == nHFactor) ? nTargetHeight : nH * 2; + +// check if we have a downscaled version of required size +const unsigned long long key((nW * LONG_MAX) + nH); +auto isHit(maDownscaled.find(key)); + +if(isHit != maDownscaled.end()) +{ +return isHit->second; +} + +// create new surface in the targeted size +cairo_surface_t* pSurfaceTarget = cairo_surface_create_similar( +pSurface, +cairo_surface_get_content(pSurface), +nW, +nH); + +// did a version to scale self first that worked well, but wouuld've +// been hard to support CAIRO_FORMAT_A1 including bit shifting, so +// I decided to go with cairo itself - use CAIRO_FILTER_FAST or +// CAIRO_FILTER_GOOD though. Please modify as needed for +// performance/quality +cairo_t* cr = cairo_create(pSurfaceTarget); +const double fScaleX(static_cast(nW)/static_cast(nSourceWidth)); +const double fScaleY(static_cast(nH)/static_cast(nSourceHeight)); +cairo_scale(cr, fScaleX, fScaleY); +cairo_set_source_surface(cr, pSurface, 0.0, 0.0); +cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_GOOD); +cairo_paint(cr); +cairo_destroy(cr); + +// need to set device_scale for downscale surfaces to get +// them handled correctly +cairo_surface_set_device_scale(pSurfaceTarget, fScaleX, fScaleY); + +// add entry to cached entries +maDownscaled[key] = pSurfaceTarget; + +return pSurfaceTarget; +} + +protected: +cairo_surface_t* implGetSurface() const { return pSurface; } +void implSetSurface(cairo_surface_t* pNew) { pSurface = pNew; } + +bool isTrivial() const +{ +static unsigned long nMinimalSquareSizeToBuffer(64*64); +const unsigned
[Libreoffice-commits] core.git: sw/source
sw/source/core/doc/notxtfrm.cxx | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) New commits: commit 5f58ffce789c15e3849bceb9fe4844d838e9c40e Author: Armin Le Grand AuthorDate: Thu Feb 27 17:21:16 2020 +0100 Commit: Armin Le Grand CommitDate: Thu Feb 27 19:24:46 2020 +0100 tdf#130951 Use the correct OutputDevice In SwViewShell mode maybe isOutputToWindow, in that cases use GetWin() instead of GetOut() Change-Id: I181ac436000325f3aa93cd508e468d500a682131 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89644 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 12f6e6045b3d..53d878c684ec 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -1309,13 +1309,25 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect // repaint to VOC and Primitives, too. static const char* pDisableMM02Goodies(getenv("SAL_DISABLE_MM02_GOODIES")); static bool bUseViewObjectContactMechanism(nullptr == pDisableMM02Goodies); +// tdf#130951 for safety reasons use fallback if ViewObjectContactMechanism +// fails for some reason - usually could only be not to find the correct +// SdrPageWindow +bool bSucceeded(false); if(bUseViewObjectContactMechanism) { // MM02 use VOC-mechanism and buffer primitives SwViewShellImp* pImp(pShell->Imp()); -SdrPageView* pPageView(nullptr != pImp ? pImp->GetPageView() : nullptr); -SdrPageWindow* pPageWindow(nullptr != pPageView ? pPageView->FindPageWindow(*pShell->GetOut()) : nullptr); +SdrPageView* pPageView(nullptr != pImp +? pImp->GetPageView() +: nullptr); +// tdf#130951 caution - target may be Window, use the correct OutputDevice +OutputDevice* pTarget(pShell->isOutputToWindow() +? pShell->GetWin() +: pShell->GetOut()); +SdrPageWindow* pPageWindow(nullptr != pPageView && nullptr != pTarget +? pPageView->FindPageWindow(*pTarget) +: nullptr); if(nullptr != pPageWindow) { @@ -1334,9 +1346,11 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect nullptr == pGrfNd->GetFlyFormat() ? OUString() : pGrfNd->GetFlyFormat()->GetName(), rNoTNd.GetTitle(), rNoTNd.GetDescription()); +bSucceeded = true; } } -else + +if(!bSucceeded) { // MM02 fallback to direct paint with primitive-recreation // which will block reusage of system-dependent bitmap data ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/svx svx/source sw/source
include/svx/sdrpaintwindow.hxx |7 + svx/source/svdraw/sdrpagewindow.cxx |2 + svx/source/svdraw/sdrpaintwindow.cxx |3 +- svx/source/svdraw/svdpntv.cxx| 18 ++--- sw/source/core/view/viewsh.cxx | 46 ++- 5 files changed, 55 insertions(+), 21 deletions(-) New commits: commit 424312aa99307da9f0ee60ea6e3213b2b3dc26b4 Author: Armin Le Grand AuthorDate: Thu Feb 27 16:43:44 2020 +0100 Commit: Armin Le Grand CommitDate: Thu Feb 27 18:12:30 2020 +0100 tdf#130768 Make tiled writer paint reuse decomposes See more info in comment 23 of task. Roughly it's about correcting a helper that led to destroying the View and thus the OC and thus the whole primitive buffering - what was expensive, for the case where decompositions were expensive Change-Id: Ic661ae810083a35812eaa923b439b3856b34b9ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89640 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/svx/sdrpaintwindow.hxx b/include/svx/sdrpaintwindow.hxx index 55ecb22fd159..91183258a382 100644 --- a/include/svx/sdrpaintwindow.hxx +++ b/include/svx/sdrpaintwindow.hxx @@ -89,6 +89,9 @@ private: boolmbOutputToWindow : 1; +// ref to patched +SdrPaintWindow* mpPatched; + // helpers void impCreateOverlayManager(); @@ -96,6 +99,10 @@ public: SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut, vcl::Window* pWindow = nullptr); ~SdrPaintWindow(); +// allow reference to patched, see patchPaintWindow/unpatchPaintWindow +void setPatched(SdrPaintWindow* pPaintWindow) { mpPatched = pPaintWindow; } +SdrPaintWindow* getPatched() const { return mpPatched; } + // data read accesses OutputDevice& GetOutputDevice() const { return *mpOutputDevice; } vcl::Window* GetWindow() const { return mpWindow; } diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index b85ab66a9e12..31a28277cb71 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -173,6 +173,7 @@ void SdrPageWindow::patchPaintWindow(SdrPaintWindow& rPaintWindow) { mpImpl->mpOriginalPaintWindow = mpImpl->mpPaintWindow; mpImpl->mpPaintWindow = +mpImpl->mpOriginalPaintWindow->setPatched(); } void SdrPageWindow::unpatchPaintWindow() @@ -181,6 +182,7 @@ void SdrPageWindow::unpatchPaintWindow() if (mpImpl->mpOriginalPaintWindow) { mpImpl->mpPaintWindow = mpImpl->mpOriginalPaintWindow; +mpImpl->mpOriginalPaintWindow->setPatched(nullptr); mpImpl->mpOriginalPaintWindow = nullptr; } } diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index 6f396c7540ed..29bbec832122 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -241,7 +241,8 @@ SdrPaintWindow::SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut, mpWindow(pWindow), mrPaintView(rNewPaintView), mbTemporaryTarget(false), // #i72889# -mbOutputToWindow(OUTDEV_WINDOW == mpOutputDevice->GetOutDevType()) +mbOutputToWindow(OUTDEV_WINDOW == mpOutputDevice->GetOutDevType()), +mpPatched(nullptr) { } diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 16123f23c22b..32feb27b3f4f 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -66,10 +66,20 @@ using namespace ::com::sun::star; SdrPaintWindow* SdrPaintView::FindPaintWindow(const OutputDevice& rOut) const { -auto a = std::find_if(maPaintWindows.begin(), maPaintWindows.end(), -[](const std::unique_ptr& pWindow) { return &(pWindow->GetOutputDevice()) == }); -if (a != maPaintWindows.end()) -return a->get(); +// back to loop - there is more to test than a std::find_if and a lamba can do +for(auto& candidate : maPaintWindows) +{ +if(&(candidate->GetOutputDevice()) == ) +{ +return candidate.get(); +} + +// check for patched to allow finding in that state, too +if(nullptr != candidate->getPatched() && &(candidate->getPatched()->GetOutputDevice()) == ) +{ +return candidate->getPatched(); +} +} return nullptr; } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index d2ae3da70e6b..555f17436b03 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -72,6 +72,8 @@ #include #include #include +#include +#include #include #include @@ -1715,35 +1717,47 @@ class RenderContextGuard VclPtr& m_pRef; VclPtr m_pOriginalValue; SwViewShell* m_pShell; +std::unique_ptr m_TemporaryPaintWindow; +SdrPageWindow* m_pPatchedPageWindow; public:
[Libreoffice-commits] core.git: basegfx/source include/basegfx
basegfx/source/polygon/b2dpolygontools.cxx | 36 +++ basegfx/source/polygon/b3dpolygontools.cxx | 255 +++- include/basegfx/polygon/b2dpolygontools.hxx |2 include/basegfx/polygon/b3dpolygontools.hxx | 12 + 4 files changed, 216 insertions(+), 89 deletions(-) New commits: commit 62ac8333999c661432adb0a18245a399daa89dcb Author: Armin Le Grand AuthorDate: Fri Feb 14 16:47:14 2020 +0100 Commit: Armin Le Grand CommitDate: Fri Feb 14 19:19:49 2020 +0100 tdf#130655 callback interface for 3D and secure dash Added same interface for 3D but just for lines, it uses no gaps. Added the security mechanism mentioned in the task in comment (2) to 2D and 3D Change-Id: I5da303c01562088682d95ee4f294c99e1f17bf6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88728 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 68d1120bc2cb..c194a38dc9d2 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -16,6 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include #include @@ -32,8 +34,6 @@ #include #include -#include - // #i37443# #define ANGLE_BOUND_START_VALUE (2.25) #define ANGLE_BOUND_MINIMUM_VALUE (0.1) @@ -1231,6 +1231,32 @@ namespace basegfx::utils return; } +// precalculate maximal acceptable length of candidate polygon assuming +// we want to create a maximum of fNumberOfAllowedSnippets. For +// fNumberOfAllowedSnippets use ca. 65536, double due to line & gap. +static double fNumberOfAllowedSnippets(65535.0 * 2.0); +const double fAllowedLength((fNumberOfAllowedSnippets * fDotDashLength) / double(rDotDashArray.size())); +const double fCandidateLength(basegfx::utils::getLength(rCandidate)); +std::vector aDotDashArray(rDotDashArray); + +if(fCandidateLength > fAllowedLength) +{ +// we would produce more than fNumberOfAllowedSnippets, so +// adapt aDotDashArray to exactly produce assumed number. Also +// assert this to let the caller know about it. +// If this asserts: Please think about checking your DotDashArray +// before calling this function or evtl. use the callback version +// to *not* produce that much of data. Even then, you may still +// think about producing too much runtime (!) +assert(true && "applyLineDashing: potentially too expensive to do the requested dismantle - please consider stretched LineDash pattern (!)"); + +// calculate correcting factor, apply to aDotDashArray and fDotDashLength +// to enlarge these as needed +const double fFactor(fCandidateLength / fAllowedLength); +std::for_each(aDotDashArray.begin(), aDotDashArray.end(), [](double ){ f *= fFactor; }); +fDotDashLength *= fFactor; +} + // prepare current edge's start B2DCubicBezier aCurrentEdge; const bool bIsClosed(rCandidate.isClosed()); @@ -1240,7 +1266,7 @@ namespace basegfx::utils // prepare DotDashArray iteration and the line/gap switching bool sal_uInt32 nDotDashIndex(0); bool bIsLine(true); -double fDotDashMovingLength(rDotDashArray[0]); +double fDotDashMovingLength(aDotDashArray[0]); B2DPolygon aSnippet; // remember 1st and last snippets to try to merge after execution @@ -1303,7 +1329,7 @@ namespace basegfx::utils // prepare next DotDashArray step and flip line/gap flag fLastDotDashMovingLength = fDotDashMovingLength; -fDotDashMovingLength += rDotDashArray[(++nDotDashIndex) % nDotDashCount]; +fDotDashMovingLength += aDotDashArray[(++nDotDashIndex) % nDotDashCount]; bIsLine = !bIsLine; } @@ -1367,7 +1393,7 @@ namespace basegfx::utils // prepare next DotDashArray step and flip line/gap flag fLastDotDashMovingLength = fDotDashMovingLength; -fDotDashMovingLength += rDotDashArray[(++nDotDashIndex) % nDotDashCount]; +fDotDashMovingLength += aDotDashArray[(++nDotDashIndex) % nDotDashCount]; bIsLine = !bIsLine; } diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/headless
vcl/headless/svpgdi.cxx | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) New commits: commit 548a28b213e680a6ffd4c3822e97131a64311956 Author: Armin Le Grand AuthorDate: Sat Feb 8 12:14:09 2020 +0100 Commit: Armin Le Grand CommitDate: Wed Feb 12 21:38:28 2020 +0100 tdf#130478 add direct dash paint in cairo Make use of mentioned task's 1st commit now and implement direct dashing for cairo. All the data is now available (that was the work), make use of it. Keeping a local static bool to control it, so later if needed can be switched on/off e.g using some global var/setting. Cairo will now do buffering of complex polygon data in cairo path data (from some compexity on and timer/mem-controlled), but not dismantle to own, stroked data. With bDoDirectCairoStroke disabled, the dis- mantled data will be buffered - more mem, but should also help - at least it gets reused now that it is possible to keep it at the original geometry (incoming polygon) at all Change-Id: Ic08f659d7ccbedc910ec678b1509ee1a7f3f2112 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88262 Tested-by: Jenkins Reviewed-by: Armin Le Grand Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88557 Tested-by: Jenkins CollaboraOffice diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 8dcdcc5df44c..bcfde817b604 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1305,7 +1305,16 @@ bool SvpSalGraphics::drawPolyLine( const double fDotDashLength(nullptr != pStroke ? std::accumulate(pStroke->begin(), pStroke->end(), 0.0) : 0.0); const bool bStrokeUsed(0.0 != fDotDashLength); -if(pSystemDependentData_CairoPath) +// MM01 decide if to stroke direcly +static bool bDoDirectCairoStroke(true); + +// MM01 activate to stroke direcly +if(bDoDirectCairoStroke && bStrokeUsed) +{ +cairo_set_dash(cr, pStroke->data(), pStroke->size(), 0.0); +} + +if(!bDoDirectCairoStroke && pSystemDependentData_CairoPath) { // MM01 - check on stroke change. Used against not used, or if both used, // equal or different? @@ -1347,7 +1356,7 @@ bool SvpSalGraphics::drawPolyLine( // MM01 need to do line dashing as fallback stuff here now basegfx::B2DPolyPolygon aPolyPolygonLine; -if(bStrokeUsed) +if(!bDoDirectCairoStroke && bStrokeUsed) { // apply LineStyle basegfx::utils::applyLineDashing( @@ -1359,7 +1368,7 @@ bool SvpSalGraphics::drawPolyLine( } else { -// no line dashing, just copy +// no line dashing or direct stroke, just copy aPolyPolygonLine.append(rPolyLine); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/headless
vcl/headless/svpgdi.cxx | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) New commits: commit 9c9f76dd5b6fb115e521ac6568673c7a10879192 Author: Armin Le Grand AuthorDate: Sat Feb 8 12:14:09 2020 +0100 Commit: Armin Le Grand CommitDate: Sat Feb 8 16:24:27 2020 +0100 tdf#130478 add direct dash paint in cairo Make use of mentioned task's 1st commit now and implement direct dashing for cairo. All the data is now available (that was the work), make use of it. Keeping a local static bool to control it, so later if needed can be switched on/off e.g using some global var/setting. Cairo will now do buffering of complex polygon data in cairo path data (from some compexity on and timer/mem-controlled), but not dismantle to own, stroked data. With bDoDirectCairoStroke disabled, the dis- mantled data will be buffered - more mem, but should also help - at least it gets reused now that it is possible to keep it at the original geometry (incoming polygon) at all Change-Id: Ic08f659d7ccbedc910ec678b1509ee1a7f3f2112 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88262 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index b3bb3f780a5a..b015006e646e 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1322,7 +1322,16 @@ bool SvpSalGraphics::drawPolyLine( const double fDotDashLength(nullptr != pStroke ? std::accumulate(pStroke->begin(), pStroke->end(), 0.0) : 0.0); const bool bStrokeUsed(0.0 != fDotDashLength); -if(pSystemDependentData_CairoPath) +// MM01 decide if to stroke direcly +static bool bDoDirectCairoStroke(true); + +// MM01 activate to stroke direcly +if(bDoDirectCairoStroke && bStrokeUsed) +{ +cairo_set_dash(cr, pStroke->data(), pStroke->size(), 0.0); +} + +if(!bDoDirectCairoStroke && pSystemDependentData_CairoPath) { // MM01 - check on stroke change. Used against not used, or if both used, // equal or different? @@ -1366,7 +1375,7 @@ bool SvpSalGraphics::drawPolyLine( // MM01 need to do line dashing as fallback stuff here now basegfx::B2DPolyPolygon aPolyPolygonLine; -if(bStrokeUsed) +if(!bDoDirectCairoStroke && bStrokeUsed) { // apply LineStyle basegfx::utils::applyLineDashing( @@ -1378,7 +1387,7 @@ bool SvpSalGraphics::drawPolyLine( } else { -// no line dashing, just copy +// no line dashing or direct stroke, just copy aPolyPolygonLine.append(rPolyLine); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: cui/source
cui/source/tabpages/align.cxx | 37 +++-- 1 file changed, 19 insertions(+), 18 deletions(-) New commits: commit cf4e87469baf13fb2766d0f2593fcc2b9b33bc9b Author: Armin Le Grand AuthorDate: Tue Feb 4 14:32:49 2020 +0100 Commit: Armin Le Grand CommitDate: Tue Feb 4 16:38:28 2020 +0100 tdf#130428 SfxItemState::UNKNOWN replacements It's possible to remove seven usages in align.cxx which cannot happen due to AlignmentTabPage forcing used ItemIDs to be member of the used ItemSet. Checked that in the debugger. Safe, is all set and ceated when the Dialog and the TabPage gets created (see AlignmentTabPage::GetRange()) Change-Id: If8e7285b46792fb903a4fcd2ac6ec94a45ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87975 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index a0ecb03c7f69..c972313d9849 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -390,9 +390,13 @@ namespace SfxItemState eState = pSet->GetItemState(nWhich); switch (eState) { -case SfxItemState::UNKNOWN: -rBtn.hide(); -rTriState.bTriStateEnabled = false; +default: +// tdf#130428 SfxItemState::UNKNOWN cannot happen here, see s_pRanges. Input is (see below): +// SID_ATTR_ALIGN_STACKED +// SID_ATTR_ALIGN_ASIANVERTICAL +// SID_ATTR_ALIGN_LINEBREAK +// SID_ATTR_ALIGN_HYPHENATION +// SID_ATTR_ALIGN_SHRINKTOFIT break; case SfxItemState::DISABLED: case SfxItemState::READONLY: @@ -430,8 +434,8 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) SfxItemState eState = pCoreAttrs->GetItemState(nWhich); switch (eState) { -case SfxItemState::UNKNOWN: -m_xLbHorAlign->hide(); +default: +//tdf#130428 SfxItemState::UNKNOWN cannot happen here, see s_pRanges. Input is SID_ATTR_ALIGN_HOR_JUSTIFY: break; case SfxItemState::DISABLED: case SfxItemState::READONLY: @@ -473,9 +477,8 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) eState = pCoreAttrs->GetItemState(nWhich); switch (eState) { -case SfxItemState::UNKNOWN: -m_xEdIndent->hide(); -m_xFtIndent->hide(); +default: +//tdf#130428 SfxItemState::UNKNOWN cannot happen here, see s_pRanges. Input is SID_ATTR_ALIGN_INDENT: break; case SfxItemState::DISABLED: case SfxItemState::READONLY: @@ -497,9 +500,8 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) eState = pCoreAttrs->GetItemState(nWhich); switch (eState) { -case SfxItemState::UNKNOWN: -m_xLbVerAlign->hide(); -m_xFtVerAlign->hide(); +default: +//tdf#130428 SfxItemState::UNKNOWN cannot happen here, see s_pRanges. Input is SID_ATTR_ALIGN_VER_JUSTIFY: break; case SfxItemState::DISABLED: case SfxItemState::READONLY: @@ -538,9 +540,8 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) eState = pCoreAttrs->GetItemState(nWhich); switch (eState) { -case SfxItemState::UNKNOWN: -m_xNfRotate->hide(); -m_xCtrlDialWin->hide(); +default: +//tdf#130428 SfxItemState::UNKNOWN cannot happen here, see s_pRanges. Input is SID_ATTR_ALIGN_DEGREES: break; case SfxItemState::DISABLED: case SfxItemState::READONLY: @@ -563,8 +564,8 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) eState = pCoreAttrs->GetItemState(nWhich); switch (eState) { -case SfxItemState::UNKNOWN: -m_xVsRefEdge->hide(); +default: +//tdf#130428 SfxItemState::UNKNOWN cannot happen here, see s_pRanges. Input is SID_ATTR_ALIGN_LOCKPOS: break; case SfxItemState::DISABLED: case SfxItemState::READONLY: @@ -602,8 +603,8 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) eState = pCoreAttrs->GetItemState(nWhich); switch (eState) { -case SfxItemState::UNKNOWN: -m_xLbFrameDir->hide(); +default: +//tdf#130428 SfxItemState::UNKNOWN cannot happen here, see s_pRanges. Input is SID_ATTR_FRAMEDIRECTION: break; case SfxItemState::DISABLED: case SfxItemState::READONLY: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: basegfx/source include/basegfx vcl/headless vcl/inc
basegfx/source/tools/systemdependentdata.cxx | 59 ++- include/basegfx/polygon/b2dpolygon.hxx | 10 + include/basegfx/polygon/b2dpolypolygon.hxx | 10 + vcl/headless/svpgdi.cxx | 142 +-- vcl/inc/win/salbmp.h | 10 + 5 files changed, 127 insertions(+), 104 deletions(-) New commits: commit 2da7a82f6b7a78e1e4b34b0b3c7a27d2b3c47a35 Author: Armin Le Grand AuthorDate: Wed Jan 22 17:20:13 2020 +0100 Commit: Armin Le Grand CommitDate: Thu Jan 23 17:48:55 2020 +0100 tdf#129845: Better solution using already existing info Use calculateCombinedHoldCyclesInSeconds() in central places of system-dependent buffering and the zero value to early exclude data from buffering. This solves the problem on all system-dependent usages in a central place. Also enhanced to roughly allow buffering for bitmaps unchanged, for polygons starting with ca. 50 coordinate pairs. Added special treatments to Cairo version to allow temp buffer objects without copying the path data. This needed some extra stuff due to Cairo not allowing to work with it's cr-internal path object directly. Change-Id: Icd0a0d8091707fe356a82f5c7ec48f36ad44ccde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87199 Reviewed-by: Michael Meeks Tested-by: Jenkins diff --git a/basegfx/source/tools/systemdependentdata.cxx b/basegfx/source/tools/systemdependentdata.cxx index 223b607ffae0..53b1465eaf55 100644 --- a/basegfx/source/tools/systemdependentdata.cxx +++ b/basegfx/source/tools/systemdependentdata.cxx @@ -77,39 +77,48 @@ namespace basegfx if(0 == mnCalculatedCycles) { const sal_Int64 nBytes(estimateUsageInBytes()); -const sal_uInt32 nSeconds = 60; // HoldCyclesInSeconds -// default is Seconds (minimal is one) -sal_uInt32 nResult(0 == nSeconds ? 1 : nSeconds); - -if(0 != nBytes) +// tdf#129845 as indicator for no need to buffer trivial data, stay at and +// return zero. As border, use 450 bytes. For polygons, this means to buffer +// starting with ca. 50 points (GDIPLUS uses 9 bytes per coordinate). For +// Bitmap data this means to more or less always buffer (as it was before). +// For the future, a more sophisticated differentioation may be added +if(nBytes > 450) { -// use sqrt to get some curved shape. With a default of 60s we get -// a single second at 3600 byte. To get close to 10mb, multiply by -// a corresponding scaling factor -const double fScaleToMB(3600.0 / (1024.0 * 1024.0 * 10.0)); - -// also use a multiplier to move the start point higher -const double fMultiplierSeconds(10.0); +const sal_uInt32 nSeconds = 60; // HoldCyclesInSeconds -// calculate -nResult = static_cast((fMultiplierSeconds * nSeconds) / sqrt(nBytes * fScaleToMB)); +// default is Seconds (minimal is one) +sal_uInt32 nResult(0 == nSeconds ? 1 : nSeconds); -// minimal value is 1 -if(nResult < 1) +if(0 != nBytes) { -nResult = 1; +// use sqrt to get some curved shape. With a default of 60s we get +// a single second at 3600 byte. To get close to 10mb, multiply by +// a corresponding scaling factor +const double fScaleToMB(3600.0 / (1024.0 * 1024.0 * 10.0)); + +// also use a multiplier to move the start point higher +const double fMultiplierSeconds(10.0); + +// calculate +nResult = static_cast((fMultiplierSeconds * nSeconds) / sqrt(nBytes * fScaleToMB)); + +// minimal value is 1 +if(nResult < 1) +{ +nResult = 1; +} + +// maximal value is nSeconds +if(nResult > nSeconds) +{ +nResult = nSeconds; +} } -// maximal value is nSeconds -if(nResult > nSeconds) -{ -nResult = nSeconds; -} +// set locally (once, on-demand created, non-zero) +const_cast(this)->mnCalculatedCycles = nResult; } - -// set locally (once, on-demand created, non-zero) -const_cast(this)->mnCalculatedCycles = nResult; } return mnCalculatedCycles; diff --git a/include/basegfx/polygon/b2dpolygon.hxx b/include/basegfx/polygon/b2dpolygon.hxx index
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - svx/source
svx/source/svdraw/svdobj.cxx |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) New commits: commit 3afd9bad338ffee53d2542e7417f05607b61f955 Author: Armin Le Grand AuthorDate: Sat Sep 29 15:25:30 2018 +0200 Commit: Juergen Funk (CIB) CommitDate: Fri Nov 29 11:05:53 2019 +0100 tdf#120066 Only invalidate SdrModel when SdrObject has SdrPage trac#29781 Change-Id: If32dd85f8d04a3f597b033272ffc2fc0bb73fbad Reviewed-on: https://gerrit.libreoffice.org/61132 Tested-by: Jenkins Reviewed-by: Armin Le Grand Reviewed-on: https://gerrit.libreoffice.org/84034 Reviewed-by: Juergen Funk (CIB) Tested-by: Juergen Funk (CIB) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 7300dbe2f5b8..07a5473bd04d 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -930,7 +930,12 @@ void SdrObject::SetChanged() // of the next changes. It should not mean to have a SdrModel // set (this is guaranteed now), but should be connected to // being added to a SdrPage (?) -if(IsInserted()) +// tdf#120066 Indeed - This triggers e.g. by CustomShape +// geometry-presenting SdrObjects that are in a SdrObjGroup, +// but the SdrObjGroup is *by purpose* not inserted. +// Need to check deeper and maybe identify all ::IsInserted() +// calls by rename and let the compiler work... +if(nullptr != getSdrPageFromSdrObject()) { getSdrModelFromSdrObject().SetChanged(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - svx/source
svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 26 ++- 1 file changed, 25 insertions(+), 1 deletion(-) New commits: commit e8720057aa0f4e612000d68f6de682f3afb8a1ea Author: Armin Le Grand AuthorDate: Mon Nov 4 15:28:22 2019 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Tue Nov 5 15:02:00 2019 +0100 tdf#121963 apply GridOffset in isPrimitiveVisible Need to take evtl. GridOffset into account for Controls in ViewObjectContactOfUnoControl::isPrimitiveVisible to get same coordinates inside adjustControlGeometry_throw Change-Id: Id6f0d1c7a4de4ee5908b50ee1a2217a0b078ecf5 Reviewed-on: https://gerrit.libreoffice.org/82031 Tested-by: Xisco Faulí Tested-by: Jenkins Reviewed-by: Armin Le Grand (cherry picked from commit fd2174d55dadc3b4dcf6b15b5789077bb2951698) Reviewed-on: https://gerrit.libreoffice.org/82050 Reviewed-by: Adolfo Jayme Barrientos diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 9fcd285572e2..ae6ecf62623e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include /* @@ -1674,7 +1675,30 @@ namespace sdr { namespace contact { #endif if ( !rViewInformation.getViewport().isEmpty() ) -m_pImpl->positionAndZoomControl( rViewInformation.getObjectToViewTransformation() ); +{ +// tdf#121963 check and eventually pre-multiply ViewTransformation +// with GridOffset transformation to avoid alternating positions of +// FormControls which are victims of the non-linear calc ViewTransformation +// aka GridOffset. For other paths (e.g. repaint) this is included already +// as part of the object's sequence of B2DPrimitive - representation +// (see ViewObjectContact::getPrimitive2DSequence and how getGridOffset is used there) +basegfx::B2DHomMatrix aViewTransformation(rViewInformation.getObjectToViewTransformation()); + +if(GetObjectContact().supportsGridOffsets()) +{ +const basegfx::B2DVector& rGridOffset(getGridOffset()); + +if(0.0 != rGridOffset.getX() || 0.0 != rGridOffset.getY()) +{ +// pre-multiply: GridOffset needs to be applied directly to logic model data +// of object coordinates, so multiply GridOffset from right to make it +// work as 1st change - these objects may still be part of groups/hierarchies +aViewTransformation = aViewTransformation * basegfx::utils::createTranslateB2DHomMatrix(rGridOffset); +} +} + +m_pImpl->positionAndZoomControl(aViewTransformation); +} } return ViewObjectContactOfSdrObj::isPrimitiveVisible( _rDisplayInfo ); ___ 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/sdr/contact/viewobjectcontactofunocontrol.cxx | 26 ++- 1 file changed, 25 insertions(+), 1 deletion(-) New commits: commit fd2174d55dadc3b4dcf6b15b5789077bb2951698 Author: Armin Le Grand AuthorDate: Mon Nov 4 15:28:22 2019 +0100 Commit: Armin Le Grand CommitDate: Mon Nov 4 20:35:27 2019 +0100 tdf#121963 apply GridOffset in isPrimitiveVisible Need to take evtl. GridOffset into account for Controls in ViewObjectContactOfUnoControl::isPrimitiveVisible to get same coordinates inside adjustControlGeometry_throw Change-Id: Id6f0d1c7a4de4ee5908b50ee1a2217a0b078ecf5 Reviewed-on: https://gerrit.libreoffice.org/82031 Tested-by: Xisco Faulí Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 35e5f8f7dcdd..ed5459388400 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include /* @@ -1674,7 +1675,30 @@ namespace sdr { namespace contact { #endif if ( !rViewInformation.getViewport().isEmpty() ) -m_pImpl->positionAndZoomControl( rViewInformation.getObjectToViewTransformation() ); +{ +// tdf#121963 check and eventually pre-multiply ViewTransformation +// with GridOffset transformation to avoid alternating positions of +// FormControls which are victims of the non-linear calc ViewTransformation +// aka GridOffset. For other paths (e.g. repaint) this is included already +// as part of the object's sequence of B2DPrimitive - representation +// (see ViewObjectContact::getPrimitive2DSequence and how getGridOffset is used there) +basegfx::B2DHomMatrix aViewTransformation(rViewInformation.getObjectToViewTransformation()); + +if(GetObjectContact().supportsGridOffsets()) +{ +const basegfx::B2DVector& rGridOffset(getGridOffset()); + +if(0.0 != rGridOffset.getX() || 0.0 != rGridOffset.getY()) +{ +// pre-multiply: GridOffset needs to be applied directly to logic model data +// of object coordinates, so multiply GridOffset from right to make it +// work as 1st change - these objects may still be part of groups/hierarchies +aViewTransformation = aViewTransformation * basegfx::utils::createTranslateB2DHomMatrix(rGridOffset); +} +} + +m_pImpl->positionAndZoomControl(aViewTransformation); +} } return ViewObjectContactOfSdrObj::isPrimitiveVisible( _rDisplayInfo ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - vcl/win
vcl/win/gdi/gdiimpl.cxx | 15 +++ 1 file changed, 15 insertions(+) New commits: commit f101de99ff7d23b7e4316cfe463a3a7f6dc5dc07 Author: Armin Le Grand AuthorDate: Fri Jan 11 17:59:59 2019 +0100 Commit: Juergen Funk (CIB) CommitDate: Thu Sep 5 08:51:38 2019 +0200 tdf#122384 Added isPrinter support to WinSalGraphicsImpl::drawPolyLine trac#29436 As already guessed but not been sure (see 'One more hint' in WinSalGraphicsImpl::drawPolyPolygon) the strange WinGDI transform is also needed when printing for WinSalGraphicsImpl:: drawPolyLine. Change-Id: I39f89eac0c17e524949221306723a355c6e94a17 Reviewed-on: https://gerrit.libreoffice.org/66190 Tested-by: Jenkins Reviewed-by: Armin Le Grand (cherry picked from commit 6e3c4ae8bca898700cde9caaff43c3a8a61eebc2) Reviewed-on: https://gerrit.libreoffice.org/78623 Reviewed-by: Juergen Funk (CIB) Tested-by: Juergen Funk (CIB) diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 69da79a8a4a4..ffbde0a37cb1 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -2318,6 +2318,21 @@ bool WinSalGraphicsImpl::drawPolyLine( aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); } +if(mrParent.isPrinter()) +{ +// tdf#122384 As metioned above in WinSalGraphicsImpl::drawPolyPolygon +// (look for 'One more hint: This *may* also be needed now in'...). +// See comments in same spot above *uregntly* before doing changes here, +// these comments are *still fully valid* at this place (!) +const Gdiplus::REAL aDpiX(aGraphics.GetDpiX()); +const Gdiplus::REAL aDpiY(aGraphics.GetDpiY()); + +aGraphics.ScaleTransform( +Gdiplus::REAL(100.0) / aDpiX, +Gdiplus::REAL(100.0) / aDpiY, +Gdiplus::MatrixOrderAppend); +} + aGraphics.DrawPath( , &(*pGraphicsPath)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - chart2/Library_chartcontroller.mk chart2/Library_chartcore.mk chart2/source cui/source editeng/CppunitTest_editeng_core.mk editeng/Lib
chart2/Library_chartcontroller.mk |1 chart2/Library_chartcore.mk|1 chart2/source/controller/dialogs/res_DataLabel.cxx | 15 + chart2/source/controller/dialogs/tp_AxisLabel.cxx | 15 + chart2/source/controller/dialogs/tp_LegendPosition.cxx | 17 + chart2/source/controller/dialogs/tp_TitleRotation.cxx | 15 + chart2/source/view/main/ChartView.cxx | 17 + cui/source/tabpages/align.cxx | 68 +-- cui/source/tabpages/page.cxx | 31 ++- cui/source/tabpages/paragrph.cxx | 50 +++-- editeng/CppunitTest_editeng_core.mk|1 editeng/Library_editeng.mk |1 editeng/source/items/frmitems.cxx | 148 +++-- include/editeng/frmdiritem.hxx | 27 +++ include/item/base/ItemSet.hxx | 12 + include/item/simple/CntEnum.hxx| 103 +++ include/item/simple/CntInt16.hxx |2 include/svl/itempool.hxx |5 item/Library_item.mk |1 item/source/base/ItemBase.cxx | 81 + item/source/simple/CntEnum.cxx | 78 solenv/clang-format/blacklist |2 svl/source/items/itempool.cxx | 17 + 23 files changed, 619 insertions(+), 89 deletions(-) New commits: commit c3ddc678ae5e9d5624d2c45aeb98bd17f64c6ddb Author: Armin Le Grand AuthorDate: Tue Jun 25 18:53:20 2019 +0200 Commit: Armin Le Grand CommitDate: Fri Jul 19 20:40:32 2019 +0200 WIP: SvxFrameDirectionItem->Item::FrameDirection Start of op Now done initial Item, chart2 and cui Change-Id: I9125ec609e6a93808bc0c2877fa965c2dffa4820 diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index 02c8bcb75774..142ee73b8a73 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,chartcontroller,\ ucbhelper \ utl \ vcl \ +item \ )) $(eval $(call gb_Library_set_componentfile,chartcontroller,chart2/source/controller/chartcontroller)) diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index 4f98fc121251..e1a01bd8dd06 100644 --- a/chart2/Library_chartcore.mk +++ b/chart2/Library_chartcore.mk @@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,chartcore,\ ucbhelper \ utl \ vcl \ +item \ )) $(eval $(call gb_Library_set_componentfile,chartcore,chart2/source/chartcore)) diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index 2889bdb74f13..45caab6d94cc 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -291,7 +291,11 @@ void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const } if (m_xLB_TextDirection->get_active() != -1) -rOutAttrs->Put( SvxFrameDirectionItem( m_xLB_TextDirection->get_active_id(), EE_PARA_WRITINGDIR ) ); +{ +// I2TM + rOutAttrs->itemSet().setItem(Item::FrameDirection(m_xLB_TextDirection->get_active_id())); +// rOutAttrs->Put( SvxFrameDirectionItem( m_xLB_TextDirection->get_active_id(), EE_PARA_WRITINGDIR ) ); +} if( m_aDC_Dial.IsVisible() ) { @@ -339,8 +343,13 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) else m_xLB_LabelPlacement->set_active(-1); -if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, true, ) == SfxItemState::SET ) -m_xLB_TextDirection->set_active_id( static_cast(pPoolItem)->GetValue() ); +// I2TM +if(const auto Item(rInAttrs.itemSet().getStateAndItem()); Item.isSet()) +{ +m_xLB_TextDirection->set_active_id(Item.getItem().getValue()); +} +// if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, true, ) == SfxItemState::SET ) +// m_xLB_TextDirection->set_active_id( static_cast(pPoolItem)->GetValue() ); if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, true, ) == SfxItemState::SET ) { diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx index 36062526cdd4..ba999de9e63f 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx @@ -129,7 +129,11 @@ bool SchAxisLabelTabPage::FillItemSet( SfxItemSet* rOutAttrs ) rOutAttrs->Put( SfxBoolItem( SCHATTR_AXIS_SHOWDESCR, m_xCbShowDescription->get_active() ) ); if (m_xLbTextDirection->get_active() != -1) -rOutAttrs->Put( SvxFrameDirectionItem( m_xLbTextDirection->get_active_id(), EE_PARA_WRITINGDIR ) ); +
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/item item/source item/test svx/source
basctl/source/basicide/sbxitem.cxx |1 include/item/base/ItemBase.hxx |5 + include/item/base/ItemControlBlock.hxx | 19 include/item/base/ItemSet.hxx | 50 --- item/source/base/ItemControlBlock.cxx | 57 item/source/base/ItemSet.cxx | 150 ++--- item/test/ItemTest.cxx | 10 -- svx/source/items/TransformAnchor.cxx |1 8 files changed, 125 insertions(+), 168 deletions(-) New commits: commit 6c2f575f1ace404e6f97bec5cd740b6340851667 Author: Armin Le Grand AuthorDate: Mon Jun 3 21:36:34 2019 +0200 Commit: Armin Le Grand CommitDate: Mon Jun 3 21:36:34 2019 +0200 WIP: Use ItemControlBlock as TypeInfo Removed last big change to have a global static ItemControlBlock registry. Thought about things and what is needed/wanted is RTTI for the Items. Instead of using typeid(T).hash_code() it is equally possible to use the ItemControlBlock of each Item - it exists once as global static instance. So use it's address. That way e.g. the ItemSet holding it *will* hjave a direct reference to the ItemControlBlock, so no need for a global registration. Checked, tested, adapted, works. Change-Id: I4c9b6bfe4ba6858b234238d6125793378574af87 diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index b8488d3e04d8..3618bcb5d8b8 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -32,7 +32,6 @@ namespace Item static ::Item::ItemControlBlock aItemControlBlock( [](){ return new Sbx(ScriptDocument::getApplicationScriptDocument()); }, [](const ItemBase& rRef){ return new Sbx(static_cast(rRef)); }, -typeid(Sbx).hash_code(), "Sbx"); return aItemControlBlock; diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index ee465ad7f0f9..b780df6308ab 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -101,7 +101,12 @@ namespace Item // this way accessible for all incarnations - at the cost of // one local reference friend bool isDefault(const ItemBase& rCandidate); +friend class ItemSet; ItemControlBlock& m_rItemControlBlock; +const ItemControlBlock& getItemControlBlock() const +{ +return m_rItemControlBlock; +} protected: // PutValue/Any interface for automated instance creation from SfxType diff --git a/include/item/base/ItemControlBlock.hxx b/include/item/base/ItemControlBlock.hxx index 0b9e5a03069b..8029f79a8d9e 100755 --- a/include/item/base/ItemControlBlock.hxx +++ b/include/item/base/ItemControlBlock.hxx @@ -38,19 +38,14 @@ namespace Item std::unique_ptr m_aDefaultItem; std::function m_aConstructDefaultItem; std::function m_aCloneItem; -size_t m_aHashCode; OUStringm_aName; -// EmptyItemControlBlock: default constructor *only* for internal use -ItemControlBlock(); - public: ItemControlBlock( std::functionaConstructDefaultItem, std::functionaCloneItem, -size_t aHashCode, const OUString& rName); -~ItemControlBlock(); +~ItemControlBlock() = default; const ItemBase& getDefault() const; bool isDefault(const ItemBase& rItem) const; @@ -60,23 +55,11 @@ namespace Item return m_aName; } -size_t getHashCode() const -{ -return m_aHashCode; -} - // clone-op, secured by returning a std::unique_ptr to make // explicit the ownership you get when calling this std::unique_ptr clone(const ItemBase&) const; std::unique_ptr createFromAny(const ItemBase::AnyIDArgs& rArgs); - -// static access to registered ItemControlBlocks -static ItemControlBlock* getItemControlBlock(size_t HashCode); -template< typename TItem > ItemControlBlock* getItemControlBlock() -{ -return getItemControlBlock(typeid(TItem).HashCode()); -} }; } // end of namespace Item diff --git a/include/item/base/ItemSet.hxx b/include/item/base/ItemSet.hxx index e78d8a55565f..e400fff73959 100644 --- a/include/item/base/ItemSet.hxx +++ b/include/item/base/ItemSet.hxx @@ -216,14 +216,14 @@ namespace Item ModelSpecificItemValues::SharedPtr m_aModelSpecificIValues; // the items as content -std::unordered_map m_aItems; +std::unordered_map m_aItems; // helpers for reduction of template member implementations, -// all based on typeid().hash_code() -const ItemBase* implGetStateAndItem(size_t hash_code, IState& rIState, bool bSearchParent)
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - include/item include/svl include/svx sc/inc sc/source svl/source svx/source sw/inc sw/source
include/item/base/ItemBase.hxx | 55 include/svl/itempool.hxx|2 - include/svx/svdpool.hxx |2 - sc/inc/docpool.hxx |2 - sc/source/core/data/docpool.cxx |2 - svl/source/items/itempool.cxx |2 - svl/source/items/style.cxx |2 - svx/source/dialog/srchdlg.cxx |2 - svx/source/svdraw/svdattr.cxx |4 +- sw/inc/format.hxx |4 +- sw/inc/swatrset.hxx |2 - sw/source/core/crsr/crstrvl.cxx |2 - sw/source/uibase/app/docstyle.cxx |4 +- sw/source/uibase/utlui/attrdesc.cxx |4 +- 14 files changed, 72 insertions(+), 17 deletions(-) New commits: commit 203d0f02f5bbe89ed4c30c3addcd1a212e3c1787 Author: Armin Le Grand AuthorDate: Mon Jun 3 18:28:14 2019 +0200 Commit: Armin Le Grand CommitDate: Mon Jun 3 18:28:14 2019 +0200 WIP: Discussion methods at ItemBase Isloated quite some funcs in code to deep-dive functionality, commented quite some how to refactor these. Change-Id: Ie8808de6bc096449186af86d8a578269911890c1 diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index d099bb4a93ea..ee465ad7f0f9 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -129,10 +129,63 @@ namespace Item // clone-op, secured by returning a std::unique_ptr to make // explicit the ownership you get when calling this +// -> no longer virtual, no impls at the Items, one central method std::unique_ptr clone() const; // ca. 220 impls // /** @return true if it has a valid string representation */ +// +// Notes: +// used as 'GetPresentation' in old environment, at least in three +// incarnations: +// - virtual SfxPoolItem::GetPresentation inm all Items implementing this +// -> needs to be taken over for all transformend items (of course) +// - virtual SfxItemPool::GetPresentation in two forms: -> ItemPoolGetPresentation +// SfxItemPool::GetPresentation: +// Base impl just adds metric using GetMetric(rItem.Which()) +// thus usually from SfxItemPool, except that Items in Calc (see +// other comments about metrics) +// -> replace using metic from ModelSpecificItemValues directly +// -> for the mentioned Items in Calc: use fixed metric in the +// items GetPresentation implementation +// ScDocumentPool::GetPresentation +// Fallback to base impl, except for Items which use +// case ATTR_PAGE_TOPDOWN: +// case ATTR_PAGE_HEADERS: +// case ATTR_PAGE_NULLVALS: +// case ATTR_PAGE_FORMULAS: +// case ATTR_PAGE_NOTES: +// case ATTR_PAGE_GRID: +// case ATTR_PAGE_SCALETOPAGES: +// case ATTR_PAGE_FIRSTPAGENO: +// case ATTR_PAGE_SCALE: +// case ATTR_PAGE_HEADERSET: +// case ATTR_PAGE_FOOTERSET: +// -> adapt thse Items GetPresentation impl as needed, we +// will have one ItemType (derivation) per ID in the future +// -> also uses helper lcl_HFPresentation that iterates over ItemSet of +// SetItem to create a combined string using SfxItemIter for the +// WhichIDs +// ATTR_PAGE_ON: +// ATTR_PAGE_DYNAMIC: +// ATTR_PAGE_SHARED: +// ATTR_LRSPACE: +// So need to adapt GetPresentation for the new Items which will +// be used for this +// SdrItemPool::GetPresentation +// Uses fallback to rItem.GetPresentation, but adds 'TakeItemName' +// in front of the result. See SdrItemPool::TakeItemName which uses +// ResIDs to get the ItemNames. All that for Items in the WhichID ragnes of +// (nWhich>=SDRATTR_SHADOW_FIRST && nWhich<=SDRATTR_END) +// -> for Items SDRATTR_SHADOW_FIRST..SDRATTR_END use the WhichIDs from that +// ressoures as ItemName (already prepared for new Items) and +// add that in front of usual result in GetPresentation impl of those Items +// - SwAttrSet::GetPresentation -> AttrSetGetPresentation +// non-virtual, local helper at SwAttrSet +// uses SfxItemIter to create a combined presentation +// -> extend to include new items from itemSet() +// - SwFormat::GetPresentation -> SwFormatGetPresentation +// simple forwarder to SwAttrSet::GetPresentation
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/item item/source item/test svx/source
basctl/source/basicide/sbxitem.cxx |1 include/item/base/ItemBase.hxx |9 -- include/item/base/ItemControlBlock.hxx | 19 include/item/base/ItemSet.hxx | 24 ++--- item/source/base/ItemBase.cxx | 10 -- item/source/base/ItemControlBlock.cxx | 61 -- item/source/base/ItemSet.cxx | 142 - item/test/ItemTest.cxx | 10 ++ svx/source/items/TransformAnchor.cxx |1 9 files changed, 167 insertions(+), 110 deletions(-) New commits: commit d349e2f8acab44c26f803215369a6b64de5b121f Author: Armin Le Grand AuthorDate: Tue May 21 17:34:23 2019 +0200 Commit: Armin Le Grand CommitDate: Tue May 21 17:34:23 2019 +0200 WIP: Added global registry for ItemControlBlock Went back from the solution of Invaldate/DisableItem from using a member to hold the Default again. Basic problem is to get from having the hash_code of an Item (typeid(T).hash_code()) to an incarnation, e.g. the global Item's default value. I thought about a globally registered aspect of the new Items already quite a while, so the step is not far. ItemControlBlock is anyways the 'static' part of each Item derivation. Adding the hash_code and automatically register/deregister this static part of Item to a static global list is all that is needed. It would also be possible to use the already added/prepared name of each Item, btw. Returned to a single existing static incarnation of the exception-Items, isolated in the ItemSet cxx. Also unified the ItemSet-Default requester due to possible ItemSet-local defaults. Change-Id: I14c2923958d92f945ff833e184beeaf6b0e85207 diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index 3618bcb5d8b8..b8488d3e04d8 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -32,6 +32,7 @@ namespace Item static ::Item::ItemControlBlock aItemControlBlock( [](){ return new Sbx(ScriptDocument::getApplicationScriptDocument()); }, [](const ItemBase& rRef){ return new Sbx(static_cast(rRef)); }, +typeid(Sbx).hash_code(), "Sbx"); return aItemControlBlock; diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index 34901af80d72..d099bb4a93ea 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -95,15 +95,6 @@ namespace Item // mechanism (UNO API and sfx2 stuff) bool putAnyValues(const AnyIDArgs& rArgs); -// fast identifyer for invalidate/disable state extra-Items, -// only to be used internally for ItemSet stuff. This could be -// done using dynamic_cast, but is faster this way. This could -// be private or protected, but would require ItemSet to be -// declared as friend then. May be changed, but for now, use as -// simple public virtual bool methods -virtual bool isInvalidateItem() const; -virtual bool isDisableItem() const; - private: // local reference to instance of ItemControlBlock for this // incarnation - same as type::GetStaticItemControlBlock(), but diff --git a/include/item/base/ItemControlBlock.hxx b/include/item/base/ItemControlBlock.hxx index cb55bd7f6581..0b9e5a03069b 100755 --- a/include/item/base/ItemControlBlock.hxx +++ b/include/item/base/ItemControlBlock.hxx @@ -38,14 +38,19 @@ namespace Item std::unique_ptr m_aDefaultItem; std::function m_aConstructDefaultItem; std::function m_aCloneItem; +size_t m_aHashCode; OUStringm_aName; +// EmptyItemControlBlock: default constructor *only* for internal use +ItemControlBlock(); + public: ItemControlBlock( std::functionaConstructDefaultItem, std::functionaCloneItem, +size_t aHashCode, const OUString& rName); -ItemControlBlock(); +~ItemControlBlock(); const ItemBase& getDefault() const; bool isDefault(const ItemBase& rItem) const; @@ -55,11 +60,23 @@ namespace Item return m_aName; } +size_t getHashCode() const +{ +return m_aHashCode; +} + // clone-op, secured by returning a std::unique_ptr to make // explicit the ownership you get when calling this std::unique_ptr clone(const ItemBase&) const; std::unique_ptr createFromAny(const ItemBase::AnyIDArgs& rArgs); + +// static access to registered ItemControlBlocks +static ItemControlBlock* getItemControlBlock(size_t HashCode); +template< typename TItem > ItemControlBlock* getItemControlBlock() +{ +return
[Libreoffice-commits] core.git: include/svx sc/inc sc/source svx/source sw/inc sw/source
include/svx/autoformathelper.hxx | 72 ++-- sc/inc/autoform.hxx |3 sc/source/core/tool/autoform.cxx | 60 svx/source/items/autoformathelper.cxx | 43 +++ sw/inc/tblafmt.hxx|8 +- sw/source/core/doc/tblafmt.cxx| 122 ++ 6 files changed, 171 insertions(+), 137 deletions(-) New commits: commit 10d8682e4cf77361e0ebf68a4ea1b565f05e91a9 Author: Armin Le Grand AuthorDate: Thu May 16 11:33:38 2019 +0200 Commit: Armin Le Grand CommitDate: Sat May 18 01:29:25 2019 +0200 Adapt AutoFormatHelper to std::unique_ptr Change-Id: I3087a7e95e73dbcda798ca62705f7941a6466ccb Reviewed-on: https://gerrit.libreoffice.org/72401 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/svx/autoformathelper.hxx b/include/svx/autoformathelper.hxx index a2d72646cbce..c731ff70b5e0 100644 --- a/include/svx/autoformathelper.hxx +++ b/include/svx/autoformathelper.hxx @@ -93,47 +93,50 @@ class SVX_DLLPUBLIC AutoFormatBase protected: // common attributes of Calc and Writer // --- from 641 on: CJK and CTL font settings -std::shared_ptrm_aFont; -std::shared_ptr m_aHeight; -std::shared_ptr m_aWeight; -std::shared_ptr m_aPosture; - -std::shared_ptrm_aCJKFont; -std::shared_ptr m_aCJKHeight; -std::shared_ptr m_aCJKWeight; -std::shared_ptr m_aCJKPosture; - -std::shared_ptrm_aCTLFont; -std::shared_ptr m_aCTLHeight; -std::shared_ptr m_aCTLWeight; -std::shared_ptr m_aCTLPosture; - -std::shared_ptr m_aUnderline; -std::shared_ptrm_aOverline; -std::shared_ptr m_aCrossedOut; -std::shared_ptr m_aContour; -std::shared_ptrm_aShadowed; -std::shared_ptr m_aColor; -std::shared_ptr m_aBox; -std::shared_ptrm_aTLBR; -std::shared_ptrm_aBLTR; -std::shared_ptr m_aBackground; +std::unique_ptrm_aFont; +std::unique_ptr m_aHeight; +std::unique_ptr m_aWeight; +std::unique_ptr m_aPosture; + +std::unique_ptrm_aCJKFont; +std::unique_ptr m_aCJKHeight; +std::unique_ptr m_aCJKWeight; +std::unique_ptr m_aCJKPosture; + +std::unique_ptrm_aCTLFont; +std::unique_ptr m_aCTLHeight; +std::unique_ptr m_aCTLWeight; +std::unique_ptr m_aCTLPosture; + +std::unique_ptr m_aUnderline; +std::unique_ptrm_aOverline; +std::unique_ptr m_aCrossedOut; +std::unique_ptr m_aContour; +std::unique_ptrm_aShadowed; +std::unique_ptr m_aColor; +std::unique_ptr m_aBox; +std::unique_ptrm_aTLBR; +std::unique_ptrm_aBLTR; +std::unique_ptr m_aBackground; // Writer specific -std::shared_ptr m_aAdjust; +std::unique_ptr m_aAdjust; // Calc specific -std::shared_ptr m_aHorJustify; -std::shared_ptr m_aVerJustify; -std::shared_ptrm_aStacked; -std::shared_ptr m_aMargin; -std::shared_ptrm_aLinebreak; +std::unique_ptr m_aHorJustify; +std::unique_ptr m_aVerJustify; +std::unique_ptrm_aStacked; +std::unique_ptr m_aMargin; +std::unique_ptrm_aLinebreak; // from SO5, 504k on, rotated text -std::shared_ptr m_aRotateAngle; -std::shared_ptr m_aRotateMode; +std::unique_ptr m_aRotateAngle; +std::unique_ptr m_aRotateMode; + +// assignment-op is protected due to this being a tooling +// class, so callers need to be aware of what they do +AutoFormatBase& operator=(const AutoFormatBase&); -public: AutoFormatBase(); AutoFormatBase( const AutoFormatBase& rNew ); ~AutoFormatBase(); @@ -141,6 +144,7 @@ public: /// Comparing based of boxes backgrounds. bool operator==(const AutoFormatBase& rRight); +public: // The get-methods. const SvxFontItem () const{ return *m_aFont; } const SvxFontHeightItem () const { return *m_aHeight; } diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx index 5a6676f15500..8fad143b8400 100644 --- a/sc/inc/autoform.hxx +++ b/sc/inc/autoform.hxx @@ -112,6 +112,9 @@ public: ScAutoFormatDataField( const ScAutoFormatDataField& rCopy ); ~ScAutoFormatDataField(); +// block assignment operator +ScAutoFormatDataField& operator=(const ScAutoFormatDataField& rRef) = delete; + // number format const ScNumFormatAbbrev&GetNumFormat() const{ return aNumFormat; } diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/patattr.cxx | 18 -- sc/source/ui/drawfunc/drtxtob.cxx | 10 +- sc/source/ui/view/editsh.cxx |4 sc/source/ui/view/output2.cxx |9 ++--- 4 files changed, 31 insertions(+), 10 deletions(-) New commits: commit 7ed69df31bb5f3f4e89ca2ef914e103676836362 Author: Armin Le Grand AuthorDate: Thu May 16 10:36:01 2019 +0200 Commit: Armin Le Grand CommitDate: Thu May 16 17:41:55 2019 +0200 tdf#125054 fixed WhichIDs for cloned Items Cause of error is that former operator= for SfxPoolItem copies all but the WhichID from the source, so being quite (and dangerously) dfferent from Clone() method. There were quite some places (and will be) that use that from my POV 'hidden' functionality by creating an Item with the target-WhichID and then using operator= to assign data from an Item with different WhichID Change-Id: Ia7e78d6d1b8b34c9c34e936db10cc850928531d5 Reviewed-on: https://gerrit.libreoffice.org/72399 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 52bdfcda5b27..bf3d1dc115e2 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -717,20 +717,26 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r } else { -rEditSet.Put( *aColorItem ); +// tdf#125054 adapt WhichID +rEditSet.Put( *aColorItem, EE_CHAR_COLOR ); } -rEditSet.Put( *aFontItem ); -rEditSet.Put( *aCjkFontItem ); -rEditSet.Put( *aCtlFontItem ); +// tdf#125054 adapt WhichID +rEditSet.Put( *aFontItem, EE_CHAR_FONTINFO ); +rEditSet.Put( *aCjkFontItem, EE_CHAR_FONTINFO_CJK ); +rEditSet.Put( *aCtlFontItem, EE_CHAR_FONTINFO_CTL ); + rEditSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); rEditSet.Put( SvxFontHeightItem( nCjkHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); rEditSet.Put( SvxFontHeightItem( nCtlHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); rEditSet.Put( SvxWeightItem ( eWeight, EE_CHAR_WEIGHT ) ); rEditSet.Put( SvxWeightItem ( eCjkWeight, EE_CHAR_WEIGHT_CJK ) ); rEditSet.Put( SvxWeightItem ( eCtlWeight, EE_CHAR_WEIGHT_CTL ) ); -rEditSet.Put( *aUnderlineItem ); -rEditSet.Put( *aOverlineItem ); + +// tdf#125054 adapt WhichID +rEditSet.Put( *aUnderlineItem, EE_CHAR_UNDERLINE ); +rEditSet.Put( *aOverlineItem, EE_CHAR_OVERLINE ); + rEditSet.Put( SvxWordLineModeItem( bWordLine, EE_CHAR_WLM ) ); rEditSet.Put( SvxCrossedOutItem( eStrike, EE_CHAR_STRIKEOUT ) ); rEditSet.Put( SvxPostureItem( eItalic, EE_CHAR_ITALIC ) ); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 1100de6da90d..3c03fa2b2eba 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -239,7 +239,15 @@ void ScDrawTextObjectBar::Execute( SfxRequest ) if ( !aString.isEmpty() ) { SfxItemSet aSet( pOutliner->GetEmptyItemSet() ); -aSet.Put( *aNewItem ); +// tdf#125054 +// checked against original, indeed aNewItem looks as if it can have +// either WhichID EE_CHAR_FONTINFO or ATTR_FONT when it was reset +// above, original uses '= SvxFontItem(..., ATTR_FONT). +// BUT beware: the operator=() did not copy the WhichID when resetting, +// so it indeed has WhichID of EE_CHAR_FONTINFO despite copying an Item +// that was constructed using ATTR_FONT as WhichID (!) +aSet.Put( *aNewItem, EE_CHAR_FONTINFO ); + // If nothing is selected, then SetAttribs of the View selects a word pOutView->GetOutliner()->QuickSetAttribs( aSet, pOutView->GetSelection() ); pOutView->InsertText(aString); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 05ad3a5c4283..77c47994f19d 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -407,6 +407,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) { const OUString& aFontName(pFontItem->GetValue()); vcl::Font aFont(aFontName, Size(1,1)); // Size just because CTOR +// tdf#125054 see comment in drtxob.cxx, same ID aNewItem = std::make_shared( aFont.GetFamilyType(), aFont.GetFamilyName(), aFont.GetStyleName(), aFont.GetPitch(), @@ -416,6 +417,9 @@ void ScEditShell::Execute( SfxRequest& rReq ) { aNewItem.reset(static_cast(rItem.Clone())); } + +//
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - include/item include/svl item/source item/test svl/source
include/item/base/ItemBase.hxx |9 ++ include/item/base/ItemSet.hxx | 17 ++- include/item/simple/CntInt16.hxx| 17 +++ include/item/simple/CntOUString.hxx | 30 ++ include/svl/itemiter.hxx|9 ++ include/svl/itemset.hxx |7 - item/source/base/ItemBase.cxx | 10 ++ item/source/base/ItemSet.cxx| 156 +++- item/source/simple/CntOUString.cxx |8 + item/test/ItemTest.cxx | 102 +++ svl/source/items/itemset.cxx| 40 - 11 files changed, 352 insertions(+), 53 deletions(-) New commits: commit 8471a84bcd79557b5543d8fbaade014edb64f591 Author: Armin Le Grand AuthorDate: Tue May 14 17:47:23 2019 +0200 Commit: Armin Le Grand CommitDate: Tue May 14 17:47:23 2019 +0200 WIP: Deeper adaptions to SfxItemSet/Item::ItemSet To get forward I added more functionality to the used combination of SfxItemSet and Item::ItemSet. Changed internal state holding of Invalidate and Disable states. No longer using a single static instance of specialized Item:: derivations (exclusively and ilsolated in cxx impl parts of ::ItemSet), but incarnating these. Advantage is to have the ItemDefault stored with these and thus to have something to return when these Items are in that state. To do so, added small boolean virtual functions to iidentify, added descriptions how/why they are there. Added methods to ItemSet to get all Items or all in a special state, see header. Due to change above this can now come with ItemDefaults added as fallbacks. Added dumpAsXml plunged to where it is called from SfxItemSet currently to have that functional. Checked current SfxItemIter and commented there due to hard problems there, see comments. Added support for SetParent, forwarding to Item::ItemSet now to get that functional, too. Extended test for new functions. Change-Id: Ifb043a893bcef9e176a317801acbd848d5443122 diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index d099bb4a93ea..34901af80d72 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -95,6 +95,15 @@ namespace Item // mechanism (UNO API and sfx2 stuff) bool putAnyValues(const AnyIDArgs& rArgs); +// fast identifyer for invalidate/disable state extra-Items, +// only to be used internally for ItemSet stuff. This could be +// done using dynamic_cast, but is faster this way. This could +// be private or protected, but would require ItemSet to be +// declared as friend then. May be changed, but for now, use as +// simple public virtual bool methods +virtual bool isInvalidateItem() const; +virtual bool isDisableItem() const; + private: // local reference to instance of ItemControlBlock for this // incarnation - same as type::GetStaticItemControlBlock(), but diff --git a/include/item/base/ItemSet.hxx b/include/item/base/ItemSet.hxx index 0d66a4da7c56..785b78099779 100644 --- a/include/item/base/ItemSet.hxx +++ b/include/item/base/ItemSet.hxx @@ -221,8 +221,8 @@ namespace Item // helpers for reduction of template member implementations, // all based on typeid().hash_code() const ItemBase* implGetStateAndItem(size_t hash_code, IState& rIState, bool bSearchParent) const; -void implInvalidateItem(size_t hash_code); -void implDisableItem(size_t hash_code); +void implInvalidateItem(size_t hash_code, const ItemBase& rItemDefault); +void implDisableItem(size_t hash_code, const ItemBase& rItemDefault); bool implClearItem(size_t hash_code); protected: @@ -251,6 +251,10 @@ namespace Item void setItem(const ItemBase& rItem); void setItems(const ItemSet& rSource, bool bDontCareToDefault = true); +// get methods for a whole selection of Items +std::vector> getAllItemsAndStates() const; +std::vector getItemsOfState(IState eIState = IState::SET) const; + // from here are all the type-specific template methods, // as reduced as possible due to these being unfolded from // the compiler for each class. @@ -258,12 +262,12 @@ namespace Item // on the fetched TypeID template< typename TItem > void invalidateItem() { -implInvalidateItem(typeid(TItem).hash_code()); +implInvalidateItem(typeid(TItem).hash_code(), Item::getDefault()); } template< typename TItem > void disableItem() { -implDisableItem(typeid(TItem).hash_code()); +implDisableItem(typeid(TItem).hash_code(), Item::getDefault()); } template< typename TItem > const TItem& getDefault() const @@ -286,7 +290,10 @@ namespace Item IState
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - include/item item/source item/test
include/item/simple/CntInt16.hxx|2 - include/item/simple/CntOUString.hxx | 38 +++- item/source/simple/CntOUString.cxx | 56 item/test/ItemTest.cxx | 12 +++ 4 files changed, 94 insertions(+), 14 deletions(-) New commits: commit 61e538cd9c5c04f9311fe6f67203adbdde00a7aa Author: Armin Le Grand AuthorDate: Tue May 14 10:18:53 2019 +0200 Commit: Armin Le Grand CommitDate: Tue May 14 10:18:53 2019 +0200 WIP: Change Item class for rtl::OUString to shared Checked in debugger if nowadays rtl::OUString is shared at runtime office-wide, but that is not the case. Thus adapted the basic Item:: class for all rtl::OUString based Itens to use ItemBuffered and to share the instances of strings. That will in the future be office-wide during runtime and for all derived classes Change-Id: Iaebadc9f15edc94c5f156721b0defce15fbc2713 diff --git a/include/item/simple/CntInt16.hxx b/include/item/simple/CntInt16.hxx index a1bd7b51c91a..164e2afe85d9 100644 --- a/include/item/simple/CntInt16.hxx +++ b/include/item/simple/CntInt16.hxx @@ -36,7 +36,7 @@ namespace Item virtual bool operator==(const ItemBase&) const; sal_Int16 getValue() const { return m_nValue; } -void putValue(sal_Int16 nNew) { m_nValue = nNew; } +void setValue(sal_Int16 nNew) { m_nValue = nNew; } virtual bool getPresentation( SfxItemPresentation, diff --git a/include/item/simple/CntOUString.hxx b/include/item/simple/CntOUString.hxx index 9f72ee5e25f6..87cea1749d34 100644 --- a/include/item/simple/CntOUString.hxx +++ b/include/item/simple/CntOUString.hxx @@ -10,7 +10,7 @@ #ifndef INCLUDED_ITEM_SIMPLE_CNTOUSTRING_HXX #define INCLUDED_ITEM_SIMPLE_CNTOUSTRING_HXX -#include +#include #include /// @@ -21,11 +21,33 @@ namespace Item // this is a helper base class, so it has *no* method // static ItemControlBlock& GetStaticItemControlBlock(); // and also no public constructor (!), but implements all the -// tooling methods for Items using a sal_Int16 internally -class ITEM_DLLPUBLIC CntOUString : public ItemBase +// tooling methods for Items using a sal_Int16 internally. +// I checked if rtl::OUString nowadays already does some +// office-wide runtime matching and buffering to hold the +// string data only once, but this is not the case. Construction +// is optimized, but no shared data usage. Thus, use ItemBuffered +// as base class and implement shared ItemData for rtl::OUString +// here now to always only have one instance for CntOUString-based +// derivations. This will use ItemAdministrator_set, see *.cxx +// for details +class ITEM_DLLPUBLIC CntOUString : public ItemBuffered { -private: -rtl::OUString m_aValue; +protected: +// ItemData class for ref-counted rtl::OUString instances +class CntOUString_Data : public ItemData +{ +private: +rtl::OUString m_aValue; + +protected: +virtual ItemAdministrator& getItemAdministrator() const override; + +public: +CntOUString_Data(const rtl::OUString& rValue = rtl::OUString()); +virtual bool operator==(const ItemData& rRef) const override; +const rtl::OUString& getValue() const { return m_aValue; } +void setValue(const rtl::OUString& rValue) { m_aValue = rValue; } +}; protected: // constructor for derived classes that *have* to hand @@ -34,10 +56,10 @@ namespace Item public: CntOUString() = delete; -virtual bool operator==(const ItemBase&) const; +virtual bool operator==(const ItemBase&) const override; -const rtl::OUString& getValue() const { return m_aValue; } -void putValue(const rtl::OUString& rValue) { m_aValue = rValue; } +const rtl::OUString& getValue() const; +void setValue(const rtl::OUString& rValue); virtual bool getPresentation( SfxItemPresentation, diff --git a/item/source/simple/CntOUString.cxx b/item/source/simple/CntOUString.cxx index 08d91e618326..ba397337dc11 100644 --- a/item/source/simple/CntOUString.cxx +++ b/item/source/simple/CntOUString.cxx @@ -9,24 +9,70 @@ #include #include +#include #include /// namespace Item { -CntOUString::CntOUString(ItemControlBlock& rItemControlBlock, const rtl::OUString& rValue) -: ItemBase(rItemControlBlock), +ItemAdministrator& CntOUString::CntOUString_Data::getItemAdministrator() const +{ +static ItemAdministrator_set aItemAdministrator_set( +// hand over localized lambda call to construct a new instance of Item +[]() +{
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - include/item item/Library_item.mk item/source item/test svl/source
include/item/base/ItemBase.hxx| 46 + include/item/base/ItemBuffered.hxx|4 include/item/base/ModelSpecificItemValues.hxx | 74 include/item/simple/CntInt16.hxx | 21 +- include/item/simple/CntOUString.hxx | 29 ++- item/Library_item.mk | 11 - item/source/base/ItemBase.cxx | 90 ++ item/source/base/ItemBuffered.cxx |9 - item/source/base/ModelSpecificItemValues.cxx | 93 ++- item/source/simple/CntInt16.cxx | 46 +++-- item/source/simple/CntOUString.cxx| 45 +++-- item/test/ItemTest.cxx| 218 +++--- svl/source/items/itempool.cxx | 15 + 13 files changed, 575 insertions(+), 126 deletions(-) New commits: commit 144ae8582176d87f05850db19a35b920f2ea3a0a Author: Armin Le Grand AuthorDate: Mon May 13 22:31:49 2019 +0200 Commit: Armin Le Grand CommitDate: Mon May 13 22:31:49 2019 +0200 WIP: Continued Item stuff changes Checked what else is needed at the ItemBase stuff, checked and added getPresentation, scaleMetrics, query/putValue stuff and dunmAsXml, made quite some notes about it. Added basiic functionality to basic sal_Int16 and OUString-Items, also made these tooling base classes as preparation for type-safe simple derivations. Deep check of defaults at currentItemPool, two (static and default) are used, adapted ModelSpecificItemValues and added quite some comments about findings. This is highly copmplex calling stuff, esp. MapMode usages due to the apps using different basic MapModes what is not represented in the items - these have no unit. Adapted tests accordingly - test implementations/derivations of basic Item implementations used now Change-Id: Ieac1ef2c62b0bfae97753b15bd8bd61803c8906c diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index f0f746b5a036..d099bb4a93ea 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -23,13 +23,31 @@ #include #include #include +#include #include #include /// +// predefines + +class IntlWrapper; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +/// namespace Item { +/* +* The values of this enum describe the degree of textual +* representation of an item after calling the virtual +* method . +*/ +enum class SfxItemPresentation +{ +Nameless, +Complete +}; + class ItemControlBlock; // Baseclass for implementation of (refactored) Items. It is @@ -57,7 +75,7 @@ namespace Item // is reached. That again will - due to the Item-incarnation // referencing the ItemData - also have small footprint and simple // copyability, but be a bit harder to implement. -// Note: All Items can be implemented either way, the diecision should +// Note: All Items can be implemented either way, the decision should // be made upon size of one incarnation and copyability (some are better // refCnted). (2) has all the tooling to do that in a unified way. // For examples how to implement your Item, check @@ -75,7 +93,7 @@ namespace Item // PutValue/Any interface for automated instance creation from SfxType // mechanism (UNO API and sfx2 stuff) -void putAnyValues(const AnyIDArgs& rArgs); +bool putAnyValues(const AnyIDArgs& rArgs); private: // local reference to instance of ItemControlBlock for this @@ -88,7 +106,7 @@ namespace Item protected: // PutValue/Any interface for automated instance creation from SfxType // mechanism (UNO API and sfx2 stuff) -virtual void putAnyValue(const css::uno::Any& rVal, sal_uInt8 nMemberId); +virtual bool putAnyValue(const css::uno::Any& rVal, sal_uInt8 nMemberId); // constructor for derived classes, thus protected. Derived // classes hand in their specific ItemControlBlock to be used @@ -112,6 +130,28 @@ namespace Item // clone-op, secured by returning a std::unique_ptr to make // explicit the ownership you get when calling this std::unique_ptr clone() const; + +// ca. 220 impls +// /** @return true if it has a valid string representation */ +virtual bool getPresentation( +SfxItemPresentation ePresentation, +MapUnit eCoreMetric, +MapUnit ePresentationMetric, +OUString , +const IntlWrapper& rIntlWrapper) const; + +// ::ScaleMetrics 18 implementations +// used by sdr::properties::ScaleItemSet / itemSetTools only +// used by
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/item include/svx item/source item/test svx/source
basctl/source/basicide/sbxitem.cxx | 12 +++ include/item/base/ItemAdministrator.hxx | 19 - include/item/base/ItemBase.hxx | 50 -- include/item/base/ItemBuffered.hxx | 53 --- include/item/base/ItemControlBlock.hxx | 13 ++- include/item/simple/CntInt16.hxx|2 include/item/simple/CntOUString.hxx |2 include/svx/item/TransformAnchor.hxx|2 item/source/base/ItemAdministrator.cxx | 32 ++--- item/source/base/ItemBase.cxx | 22 -- item/source/base/ItemBuffered.cxx | 84 +--- item/source/base/ItemControlBlock.cxx |9 ++ item/source/simple/CntInt16.cxx |7 -- item/source/simple/CntOUString.cxx |7 -- item/test/ItemTest.cxx | 110 +++- svx/source/items/TransformAnchor.cxx|7 -- 16 files changed, 313 insertions(+), 118 deletions(-) New commits: commit 974feb26536435676f3135a2625477c90de2cb7a Author: Armin Le Grand AuthorDate: Tue May 7 21:16:10 2019 +0200 Commit: Armin Le Grand CommitDate: Tue May 7 21:16:10 2019 +0200 WIP: Stabilizing/simplifying clone() Added clone() functionality to ItemControlBlock, makes it safer and less error-prone in terms of forgetting to overload correctly. Added make_unique to have more alternatives for changing local data in case of BufferedItem. Added clone() for ItemData to ItemAdministrator. Added quite some comments, too. Adapted examples in TestCases, adapted all current implementations Change-Id: Ia5aaafed700a3a003d8049fbb5978291235c6263 diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index 99b1ab024c8b..3618bcb5d8b8 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -31,6 +31,7 @@ namespace Item { static ::Item::ItemControlBlock aItemControlBlock( [](){ return new Sbx(ScriptDocument::getApplicationScriptDocument()); }, +[](const ItemBase& rRef){ return new Sbx(static_cast(rRef)); }, "Sbx"); return aItemControlBlock; @@ -41,6 +42,17 @@ namespace Item static ::Item::ItemAdministrator_vector aItemAdministrator_vector( // hand over localized lambda call to construct a new instance of Item [](){ return new Sbx::SbxData(ScriptDocument::getApplicationScriptDocument()); }, +// hand over localized lambda call to clone an Item +[](const ItemData& rRef) +{ +const SbxData& rData(static_cast(rRef)); +return new SbxData( +rData.GetDocument(), +rData.GetLibName(), +rData.GetName(), +rData.GetMethodName(), +rData.GetType()); +}, // hand over localized lambda operator== [](ItemData* A, ItemData* B) { diff --git a/include/item/base/ItemAdministrator.hxx b/include/item/base/ItemAdministrator.hxx index 18a3a6eb953a..dbe96a9de653 100644 --- a/include/item/base/ItemAdministrator.hxx +++ b/include/item/base/ItemAdministrator.hxx @@ -34,11 +34,14 @@ namespace Item class ITEM_DLLPUBLIC ItemAdministrator { private: -std::functionm_aConstructItem; +std::function m_aConstructItemData; +std::function m_aCloneItemData; protected: public: -ItemAdministrator(std::function aConstructItem); +ItemAdministrator( +std::function aConstructItemData, +std::function aCloneItemData); virtual ~ItemAdministrator(); // noncopyable @@ -51,6 +54,9 @@ namespace Item // instance supplier ItemBuffered::ItemData* createNewDataInstance() const; + +// clone operator +ItemBuffered::ItemData* clone(const ItemBuffered::ItemData& rRef) const; }; } // end of namespace Item @@ -73,7 +79,8 @@ namespace Item protected: public: ItemAdministrator_set( -std::function aConstructItem, +std::function aConstructItemData, +std::function aCloneItemData, std::function aLess); // buffer accesses @@ -101,7 +108,8 @@ namespace Item protected: public: ItemAdministrator_unordered_set( -std::function aConstructItem, +std::function aConstructItemData, +std::function aCloneItemData, std::function aHash, std::function aCompare); @@ -139,7 +147,8 @@ namespace Item public: ItemAdministrator_vector( -std::function aConstructItem, +std::function aConstructItemData, +std::function aCloneItemData, std::function aSame); // buffer accesses diff --git
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - include/sfx2 sfx2/source
include/sfx2/unoctitm.hxx|2 +- sfx2/source/control/statcach.cxx |4 ++-- sfx2/source/control/unoctitm.cxx |4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 792c0ba7b5c8be39c4a1023037d7977dd30615e3 Author: Armin Le Grand AuthorDate: Tue May 7 12:59:25 2019 +0200 Commit: Armin Le Grand CommitDate: Tue May 7 12:59:25 2019 +0200 WIP: Small error in SfxStateCache fixed Change-Id: I3f753e202294c886580b6b0c48bf6c7bb8ec6361 diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx index 2b6608735017..fe7f7634b605 100644 --- a/include/sfx2/unoctitm.hxx +++ b/include/sfx2/unoctitm.hxx @@ -129,7 +129,7 @@ public: static OUString getSlaveCommand( const css::util::URL& rURL ); -voidStateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, SfxSlotServer const * pServ ); +voidStateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, const Item::ItemBase* pSlotItem, SfxSlotServer const * pServ ); virtual voidStateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, const Item::ItemBase* pSlotItem ) override; voidsetMasterSlaveCommand( bool bSet ); /// @throws css::uno::RuntimeException diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 59750ae7df01..4ac06a340215 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -432,7 +432,7 @@ void SfxStateCache::SetState_Impl } if ( pInternalController ) -static_cast(pInternalController)->StateChanged( nId, eState, pState, ); +static_cast(pInternalController)->StateChanged( nId, eState, pState, nullptr, ); // Remember new value if ( !IsInvalidItem(pLastItem) ) @@ -471,7 +471,7 @@ void SfxStateCache::SetCachedState( bool bAlways ) } if ( pInternalController ) -static_cast(pInternalController)->StateChanged( nId, eLastState, pLastItem, ); +static_cast(pInternalController)->StateChanged( nId, eLastState, pLastItem, nullptr, ); // Controller is now ok bCtrlDirty = true; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 72acacf472cd..116801148526 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -882,7 +882,7 @@ void SfxDispatchController_Impl::sendStatusChanged(const OUString& rURL, const c } } -void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, SfxSlotServer const * pSlotServ ) +void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, const Item::ItemBase* pSlotItem, SfxSlotServer const * pSlotServ ) { if ( !pDispatch ) return; @@ -969,7 +969,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, const Item::ItemBase* pSlotItem) { -StateChanged( nSID, eState, pState, pSlotItem ); +StateChanged( nSID, eState, pState, pSlotItem, nullptr ); } static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent, const SfxPoolItem* pState) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - include/item item/source
include/item/base/ItemAdministrator.hxx |2 +- include/item/base/ItemBase.hxx |6 -- include/item/base/ItemBuffered.hxx |8 +--- include/item/base/ItemControlBlock.hxx |5 +++-- item/source/base/ItemBase.cxx | 11 +++ item/source/base/ItemBuffered.cxx | 19 ++- item/source/base/ItemControlBlock.cxx |2 +- 7 files changed, 31 insertions(+), 22 deletions(-) New commits: commit 4b0409c319abd3248360345cf7d86d66b932d513 Author: Armin Le Grand AuthorDate: Mon May 6 15:45:26 2019 +0200 Commit: Armin Le Grand CommitDate: Mon May 6 15:45:26 2019 +0200 WIP: Linux build changes Change-Id: I3ea79f9a48f626681604e871143c0adec7c0cb7a diff --git a/include/item/base/ItemAdministrator.hxx b/include/item/base/ItemAdministrator.hxx index 4b77f5ffafca..18a3a6eb953a 100644 --- a/include/item/base/ItemAdministrator.hxx +++ b/include/item/base/ItemAdministrator.hxx @@ -31,7 +31,7 @@ namespace Item { -class ItemAdministrator +class ITEM_DLLPUBLIC ItemAdministrator { private: std::functionm_aConstructItem; diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index 44c597cddbed..b93d5b196ce9 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -42,7 +42,7 @@ namespace Item // PutValue/Any interface for automated instance creation from SfxType // mechanism (UNO API and sfx2 stuff) -virtual void putValues(const AnyIDArgs& rArgs); +virtual void putAnyValues(const AnyIDArgs& rArgs); private: // local reference to instance of ItemControlBlock for this @@ -55,10 +55,12 @@ namespace Item protected: // PutValue/Any interface for automated instance creation from SfxType // mechanism (UNO API and sfx2 stuff) -virtual void putValue(const css::uno::Any& rVal, sal_uInt8 nMemberId); +virtual void putAnyValue(const css::uno::Any& rVal, sal_uInt8 nMemberId); public: ItemBase(ItemControlBlock& rItemControlBlock); +virtual ~ItemBase(); + ItemBase(const ItemBase&); ItemBase& operator=(const ItemBase&); diff --git a/include/item/base/ItemBuffered.hxx b/include/item/base/ItemBuffered.hxx index 82647198efaf..43727586ffbf 100755 --- a/include/item/base/ItemBuffered.hxx +++ b/include/item/base/ItemBuffered.hxx @@ -29,6 +29,8 @@ namespace Item { +class ItemAdministrator; + class ITEM_DLLPUBLIC ItemBuffered : public ItemBase { public: @@ -44,7 +46,7 @@ namespace Item // PutValue/Any interface for automated instance creation from SfxType // mechanism (UNO API and sfx2 stuff) -virtual void putValue(const css::uno::Any& rVal, sal_uInt8 nMemberId); +virtual void putAnyValue(const css::uno::Any& rVal, sal_uInt8 nMemberId); public: ItemData(); @@ -67,7 +69,7 @@ namespace Item public: // PutValue/Any interface for automated instance creation from SfxType // mechanism (UNO API and sfx2 stuff) -virtual void putValues(const AnyIDArgs& rArgs); +virtual void putAnyValues(const AnyIDArgs& rArgs); protected: // Method to internally (thus protected) set a new ItemData @@ -90,7 +92,7 @@ namespace Item virtual ~ItemBuffered(); ItemBuffered& operator=(const ItemBuffered&); -virtual bool operator==(const ItemBuffered&) const; +virtual bool operator==(const ItemBase&) const; virtual std::unique_ptr clone() const; }; } // end of namespace Item diff --git a/include/item/base/ItemControlBlock.hxx b/include/item/base/ItemControlBlock.hxx index b83f37333d29..80effd85a24a 100755 --- a/include/item/base/ItemControlBlock.hxx +++ b/include/item/base/ItemControlBlock.hxx @@ -22,15 +22,16 @@ #include #include +#include #include +#include +#include /// namespace Item { // predefine - no need to include -class ItemBase; - class ITEM_DLLPUBLIC ItemControlBlock { private: diff --git a/item/source/base/ItemBase.cxx b/item/source/base/ItemBase.cxx index 158972837d15..40be2aeb73f8 100644 --- a/item/source/base/ItemBase.cxx +++ b/item/source/base/ItemBase.cxx @@ -8,7 +8,6 @@ */ #include -// #include #include #include @@ -86,18 +85,18 @@ Nonetheless these SlotItems STILL depend on the SfxItem-RANGES defined in the Sf namespace Item { -void ItemBase::putValues(const AnyIDArgs& rArgs) +void ItemBase::putAnyValues(const AnyIDArgs& rArgs) { if(!rArgs.empty()) { for(const auto& arg : rArgs) { -putValue(arg.first, arg.second); +putAnyValue(arg.first, arg.second); } } } -void ItemBase::putValue(const
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - 1299 commits - accessibility/inc accessibility/source android/README android/source animations/source apple_remote/source avmedia/inc
Rebased ref, commits from common ancestor: commit 6f72ff948b8f7581e2f46ded1e55803d94cb2606 Author: Armin Le Grand AuthorDate: Sun May 5 17:09:42 2019 +0200 Commit: Armin Le Grand CommitDate: Sun May 5 23:10:50 2019 +0200 WIP: Re-simplified StateChanged interface Added rebase correctiojns Change-Id: Ib0aa5e964fe1bb9365cd1f9d4fffe448134663cb diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx index e75ba15aa390..191adfa913a9 100644 --- a/avmedia/source/framework/mediatoolbox.cxx +++ b/avmedia/source/framework/mediatoolbox.cxx @@ -84,7 +84,7 @@ MediaToolBoxControl::~MediaToolBoxControl() } -void MediaToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState, const std::unique_ptr& /*rSlotItem*/ ) +void MediaToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState, const Item::ItemBase* /*pSlotItem*/ ) { MediaToolBoxControl_Impl* pCtrl = static_cast< MediaToolBoxControl_Impl* >( GetToolBox().GetItemWindow( GetId() ) ); diff --git a/basctl/source/basicide/IDEComboBox.cxx b/basctl/source/basicide/IDEComboBox.cxx index edb312499a4f..1ff980a0baa5 100644 --- a/basctl/source/basicide/IDEComboBox.cxx +++ b/basctl/source/basicide/IDEComboBox.cxx @@ -60,7 +60,7 @@ LibBoxControl::LibBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) { } -void LibBoxControl::StateChanged(sal_uInt16, SfxItemState eState, const SfxPoolItem* pState, const ::std::unique_ptr& /*rSlotItem*/) +void LibBoxControl::StateChanged(sal_uInt16, SfxItemState eState, const SfxPoolItem* pState, const ::Item::ItemBase* /*pSlotItem*/) { LibBox* pBox = static_cast(GetToolBox().GetItemWindow(GetId())); @@ -337,7 +337,7 @@ LanguageBoxControl::LanguageBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolB { } -void LanguageBoxControl::StateChanged(sal_uInt16, SfxItemState eState, const SfxPoolItem* pItem, const ::std::unique_ptr& /*rSlotItem*/) +void LanguageBoxControl::StateChanged(sal_uInt16, SfxItemState eState, const SfxPoolItem* pItem, const ::Item::ItemBase* /*pSlotItem*/) { if (LanguageBox* pBox = static_cast(GetToolBox().GetItemWindow(GetId( { diff --git a/basctl/source/inc/IDEComboBox.hxx b/basctl/source/inc/IDEComboBox.hxx index aa67d1d7576e..8b05ecf15ce9 100644 --- a/basctl/source/inc/IDEComboBox.hxx +++ b/basctl/source/inc/IDEComboBox.hxx @@ -60,7 +60,7 @@ public: * @param pState -- */ virtual void StateChanged(sal_uInt16 nSlotID, SfxItemState eState, - const SfxPoolItem* pState, const ::std::unique_ptr& rSlotItem) override; + const SfxPoolItem* pState, const ::Item::ItemBase* pSlotItem) override; /*! * Create combobox of Macro and Dialog Library * @@ -189,7 +189,7 @@ public: * @param pState -- */ virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState, const ::std::unique_ptr& rSlotItem) override; + const SfxPoolItem* pState, const ::Item::ItemBase* pSlotItem) override; /*! * Create ComboBox of Language * diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index 53c07d4e9115..0bfbe9025d48 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -57,7 +57,7 @@ void SvxHlinkCtrl::dispose() } void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState, const std::unique_ptr& /*rSlotItem*/ ) + const SfxPoolItem* pState, const Item::ItemBase* /*pSlotItem*/ ) { if ( eState == SfxItemState::DEFAULT && !pParent->IsDisposed() ) { diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx index bb7dc8ee05b2..62e9a3f3f6f4 100644 --- a/cui/source/inc/cuihyperdlg.hxx +++ b/cui/source/inc/cuihyperdlg.hxx @@ -61,7 +61,7 @@ public: virtual void dispose() override; virtual voidStateChanged( sal_uInt16 nSID, SfxItemState eState, -const SfxPoolItem* pState, const std::unique_ptr& rSlotItem ) override; +const SfxPoolItem* pState, const Item::ItemBase* pSlotItem ) override; }; diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx index a70751ab2d78..cfe7902d6961 100644 --- a/include/avmedia/mediatoolbox.hxx +++ b/include/avmedia/mediatoolbox.hxx @@ -39,7 +39,7 @@ public: MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbX ); virtual ~MediaToolBoxControl() override; -virtual voidStateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, const std::unique_ptr& rSlotItem ) override; +virtual
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - 2 commits - avmedia/source basctl/source cui/source include/avmedia include/item include/sfx2 include/svx item/Library_item.mk item/so
avmedia/source/framework/mediatoolbox.cxx |2 basctl/source/basicide/IDEComboBox.cxx |4 basctl/source/basicide/basides1.cxx | 92 - basctl/source/basicide/bastype2.cxx | 26 basctl/source/basicide/moduldl2.cxx | 26 basctl/source/basicide/moduldlg.cxx | 104 - basctl/source/basicide/sbxitem.cxx | 72 basctl/source/inc/IDEComboBox.hxx |4 basctl/source/inc/sbxitem.hxx | 64 cui/source/dialogs/cuihyperdlg.cxx |2 cui/source/inc/cuihyperdlg.hxx |2 cui/source/tabpages/swpossizetabpage.cxx|8 include/avmedia/mediatoolbox.hxx|2 include/item/base/ItemAdministrator.hxx | 171 -- include/item/base/ItemBase.hxx | 147 - include/item/base/ItemBuffered.hxx | 101 + include/item/base/ItemControlBlock.hxx | 38 include/item/base/ItemSet.hxx | 83 - include/item/base/ModelSpecificItemValues.hxx | 10 include/item/simple/CntInt16.hxx| 19 include/item/simple/CntOUString.hxx | 18 include/sfx2/ctrlitem.hxx |4 include/sfx2/dispatch.hxx |4 include/sfx2/msg.hxx| 14 include/sfx2/sfxstatuslistener.hxx |6 include/sfx2/sidebar/ControllerItem.hxx |2 include/sfx2/stbitem.hxx|2 include/sfx2/tbxctrl.hxx|2 include/sfx2/unoctitm.hxx |2 include/svx/ParaSpacingControl.hxx |4 include/svx/bmpmask.hxx |2 include/svx/clipboardctl.hxx|2 include/svx/fillctrl.hxx|2 include/svx/float3d.hxx |4 include/svx/fontwork.hxx|2 include/svx/formatpaintbrushctrl.hxx|2 include/svx/grafctrl.hxx|4 include/svx/imapdlg.hxx |2 include/svx/insctrl.hxx |2 include/svx/item/TransformAnchor.hxx| 12 include/svx/layctrl.hxx |4 include/svx/lboxctrl.hxx|2 include/svx/linectrl.hxx|4 include/svx/modctrl.hxx |2 include/svx/pszctrl.hxx |2 include/svx/selctrl.hxx |2 include/svx/tbcontrl.hxx|4 include/svx/tbxctl.hxx |2 include/svx/verttexttbxctrl.hxx |2 include/svx/xmlsecctrl.hxx |2 include/svx/zoomctrl.hxx|2 include/svx/zoomsliderctrl.hxx |2 item/Library_item.mk|1 item/source/base/ItemAdministrator.cxx | 183 -- item/source/base/ItemBase.cxx | 188 -- item/source/base/ItemBuffered.cxx | 166 ++ item/source/base/ItemControlBlock.cxx | 42 item/source/base/ItemSet.cxx| 138 + item/source/base/ModelSpecificItemValues.cxx| 38 item/source/simple/CntInt16.cxx | 54 item/source/simple/CntOUString.cxx | 54 item/test/ItemTest.cxx | 1595 ++-- reportdesign/source/ui/misc/statusbarcontroller.cxx |6 sc/inc/NumberFormatControl.hxx |2 sc/source/ui/cctrl/tbzoomsliderctrl.cxx |2 sc/source/ui/inc/navcitem.hxx |2 sc/source/ui/inc/tbzoomsliderctrl.hxx |2 sc/source/ui/navipi/navcitem.cxx|2 sc/source/ui/sidebar/NumberFormatControl.cxx|2 sd/source/ui/app/tmplctrl.cxx |2 sd/source/ui/dlg/animobjs.cxx |2 sd/source/ui/dlg/diactrl.cxx|2 sd/source/ui/dlg/gluectrl.cxx |4 sd/source/ui/dlg/navigatr.cxx |4 sd/source/ui/inc/animobjs.hxx |2 sd/source/ui/inc/diactrl.hxx|2 sd/source/ui/inc/gluectrl.hxx |2 sd/source/ui/inc/navigatr.hxx |4 sd/source/ui/inc/tmplctrl.hxx |2 sd/source/ui/view/sdruler.cxx |4 sfx2/inc/inettbc.hxx|2
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/item include/svx item/test svx/source
basctl/source/basicide/sbxitem.cxx |1 + basctl/source/inc/sbxitem.hxx |1 - include/item/base/ItemAdministrator.hxx |2 +- include/item/base/ItemControlBlock.hxx |1 + include/svx/item/TransformAnchor.hxx|1 + item/test/ItemTest.cxx |8 svx/source/items/TransformAnchor.cxx|1 + 7 files changed, 9 insertions(+), 6 deletions(-) New commits: commit c05419aa624b39dc008673d74ebecfa533441cfa Author: Armin Le Grand AuthorDate: Sat Apr 13 14:49:33 2019 +0200 Commit: Armin Le Grand CommitDate: Sat Apr 13 14:49:33 2019 +0200 WIP: Changes 4 linux build Change-Id: If8b0e0769ab1e41a9c4aab9b0259c38e79cc886b diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index e4d7e0b5e84a..fc0e820e3aa9 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -20,6 +20,7 @@ #include #include #include +#include namespace basctl { diff --git a/basctl/source/inc/sbxitem.hxx b/basctl/source/inc/sbxitem.hxx index 56b62d3e4ed4..8e83dad12359 100644 --- a/basctl/source/inc/sbxitem.hxx +++ b/basctl/source/inc/sbxitem.hxx @@ -24,7 +24,6 @@ // I2TM #include -//#include // ~I2TM namespace basctl diff --git a/include/item/base/ItemAdministrator.hxx b/include/item/base/ItemAdministrator.hxx index e3e14aea126a..32c1b1e04f19 100644 --- a/include/item/base/ItemAdministrator.hxx +++ b/include/item/base/ItemAdministrator.hxx @@ -24,7 +24,7 @@ #include #include #include -//#include +#include /// diff --git a/include/item/base/ItemControlBlock.hxx b/include/item/base/ItemControlBlock.hxx index 5f658e8c4b07..566c9c73c5a3 100755 --- a/include/item/base/ItemControlBlock.hxx +++ b/include/item/base/ItemControlBlock.hxx @@ -21,6 +21,7 @@ #define INCLUDED_ITEM_BASE_ITEMCONTROLBLOCK_HXX #include +#include /// diff --git a/include/svx/item/TransformAnchor.hxx b/include/svx/item/TransformAnchor.hxx index 4a9175244daf..acb53e0c516b 100755 --- a/include/svx/item/TransformAnchor.hxx +++ b/include/svx/item/TransformAnchor.hxx @@ -12,6 +12,7 @@ #include #include +#include /// diff --git a/item/test/ItemTest.cxx b/item/test/ItemTest.cxx index 5cc0de4ce341..ea4b8f77a7f7 100644 --- a/item/test/ItemTest.cxx +++ b/item/test/ItemTest.cxx @@ -29,7 +29,7 @@ namespace Item class MultiValueAB : public ItemBase { public: -static ItemControlBlock& MultiValueAB::GetStaticItemControlBlock() +static ItemControlBlock& GetStaticItemControlBlock() { static ItemControlBlock aItemControlBlock( std::shared_ptr(new IAdministrator_vector()), @@ -117,7 +117,7 @@ namespace Item class MultiValueABC : public MultiValueAB { public: -static ItemControlBlock& MultiValueABC::GetStaticItemControlBlock() +static ItemControlBlock& GetStaticItemControlBlock() { static ItemControlBlock aItemControlBlock( std::shared_ptr(new IAdministrator_vector()), @@ -197,7 +197,7 @@ namespace Item class MultiValueABD : public MultiValueAB { public: -static ItemControlBlock& MultiValueABD::GetStaticItemControlBlock() +static ItemControlBlock& GetStaticItemControlBlock() { static ItemControlBlock aItemControlBlock( std::shared_ptr(new IAdministrator_vector()), @@ -241,7 +241,7 @@ namespace Item class MultiValueABCD : public MultiValueABC { public: -static ItemControlBlock& MultiValueABCD::GetStaticItemControlBlock() +static ItemControlBlock& GetStaticItemControlBlock() { static ItemControlBlock aItemControlBlock( std::shared_ptr(new IAdministrator_vector()), diff --git a/svx/source/items/TransformAnchor.cxx b/svx/source/items/TransformAnchor.cxx index 12cade78b1c9..92787903c390 100755 --- a/svx/source/items/TransformAnchor.cxx +++ b/svx/source/items/TransformAnchor.cxx @@ -10,6 +10,7 @@ #include #include #include +#include /// ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/item include/svl item/Library_item.mk item/source item/test sfx2/source svl/source svx/source
basctl/source/basicide/sbxitem.cxx |2 include/item/base/ItemControlBlock.hxx |2 include/item/base/ItemSet.hxx | 115 - include/item/base/SlotSet.hxx | 89 - include/svl/itemset.hxx|4 - item/Library_item.mk |1 item/source/base/ItemControlBlock.cxx |4 - item/source/base/ItemSet.cxx | 100 item/source/base/SlotSet.cxx | 56 item/source/simple/CntInt16.cxx|2 item/source/simple/CntOUString.cxx |2 item/test/ItemTest.cxx |8 +- sfx2/source/appl/appuno.cxx| 20 + sfx2/source/control/dispatch.cxx |4 - svl/source/items/itemset.cxx | 12 --- svx/source/items/TransformAnchor.cxx |4 - 16 files changed, 163 insertions(+), 262 deletions(-) New commits: commit 0d81dd6c99fac78210208c244babaa7d6218337e Author: Armin Le Grand AuthorDate: Fri Apr 12 18:14:51 2019 +0200 Commit: Armin Le Grand CommitDate: Fri Apr 12 18:14:51 2019 +0200 WIP: Three changes: ItemControlBlock: Made ConstructDefaultItem optional. If given, a explicit default to be created can be defined, else the ConstructItem will be used to construct the default item. ItemSet: Optimized to make the template methods as small as possible due to tese being expanded by each type when compiled. Also allowed me to move static fallback items completely to *.cxx file. SlotSet: Completely removed for now. The strategy is to solely use ItemSet - under the vost that for each Item a type has to be defined (by derivation). Something like SlotSet may also be used in the future if a combination of the new Items and identifier is needed for some reason. In principle, everyone is able to use and handle ::BaseItem shared_ptr's as wanted - keep them in an array or whetever. In principle there is no need for specialized classes handling these - ::ItemSet is only for convenience and to have a transition point Change-Id: Ic6bfa9598a560acde22a124f6e3c893a595f9ac9 diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index c33c9477c885..e4d7e0b5e84a 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -30,7 +30,7 @@ namespace Item { static ::Item::ItemControlBlock aItemControlBlock( std::shared_ptr<::Item::ItemAdministrator>(new ::Item::IAdministrator_vector()), -[](){ return new Sbx(Sbx::GetStaticItemControlBlock()); }, +nullptr, [](){ return new Sbx(Sbx::GetStaticItemControlBlock()); }, "Sbx"); diff --git a/include/item/base/ItemControlBlock.hxx b/include/item/base/ItemControlBlock.hxx index daf5d68a9ffd..5f658e8c4b07 100755 --- a/include/item/base/ItemControlBlock.hxx +++ b/include/item/base/ItemControlBlock.hxx @@ -30,6 +30,8 @@ namespace Item class ItemAdministrator; class ItemBase; +// The ConstructDefaultItem may be zero, instead the +// ConstructItem lambda will be used class ITEM_DLLPUBLIC ItemControlBlock { private: diff --git a/include/item/base/ItemSet.hxx b/include/item/base/ItemSet.hxx index 142fe53d4467..b5a19316f7e0 100644 --- a/include/item/base/ItemSet.hxx +++ b/include/item/base/ItemSet.hxx @@ -212,26 +212,6 @@ namespace Item }; private: -// helper class for an ImplInvalidateItem - placeholder for InvaidateState -// SfxItemState::DONTCARE -> IsInvalidItem -> pItem == INVALID_POOL_ITEM -> reinterpret_cast(-1) -class ImplInvalidateItem : public ItemBase -{ -private: -ItemControlBlock m_aItemControlBlock; -public: -ImplInvalidateItem() : ItemBase(m_aItemControlBlock), m_aItemControlBlock() {} -}; - -// helper class for a ImplDisableItem - placeholder for InvaidateState -// SfxItemState::DISABLED -> IsVoidItem() -> instance of SfxVoidItem, virtual bool IsVoidItem() -class ImplDisableItem : public ItemBase -{ -private: -ItemControlBlock m_aItemControlBlock; -public: -ImplDisableItem() : ItemBase(m_aItemControlBlock), m_aItemControlBlock() {} -}; - // the Parent of this ItemSet SharedPtr m_aParent; @@ -242,21 +222,13 @@ namespace Item // the items as content std::unordered_map> m_aItems; -// single global static instance for helper class ImplInvalidateItem -static const std::shared_ptr& getInvalidateItem() -{ -static std::shared_ptr aImplInvalidateItem(new ImplInvalidateItem()); - -return aImplInvalidateItem; -} - -// single global static instance for helper class ImplDisableItem -static const
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/item item/source item/test svx/source
basctl/source/basicide/sbxitem.cxx |3 ++- include/item/base/ItemControlBlock.hxx | 10 +- item/source/base/ItemControlBlock.cxx |6 -- item/source/simple/CntInt16.cxx|3 ++- item/source/simple/CntOUString.cxx |3 ++- item/test/ItemTest.cxx | 12 svx/source/items/TransformAnchor.cxx |3 ++- 7 files changed, 29 insertions(+), 11 deletions(-) New commits: commit 54ca9cac1871d269cf608ac1d18441849b7be6c2 Author: Armin Le Grand AuthorDate: Thu Apr 11 20:29:49 2019 +0200 Commit: Armin Le Grand CommitDate: Thu Apr 11 20:29:49 2019 +0200 WIP: Added a Name to ItemControlBlock ...and thus to Item-Implementations. Will be needed at some time anyways, currently already in the ressources and used to stream out infos or similar. Change-Id: Ie23d839b9444cd3cbc6403c366629bd7d55de542 diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index 1243535c22f4..c33c9477c885 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -31,7 +31,8 @@ namespace Item static ::Item::ItemControlBlock aItemControlBlock( std::shared_ptr<::Item::ItemAdministrator>(new ::Item::IAdministrator_vector()), [](){ return new Sbx(Sbx::GetStaticItemControlBlock()); }, -[](){ return new Sbx(Sbx::GetStaticItemControlBlock()); }); +[](){ return new Sbx(Sbx::GetStaticItemControlBlock()); }, +"Sbx"); return aItemControlBlock; } diff --git a/include/item/base/ItemControlBlock.hxx b/include/item/base/ItemControlBlock.hxx index d61b8e79d07d..daf5d68a9ffd 100755 --- a/include/item/base/ItemControlBlock.hxx +++ b/include/item/base/ItemControlBlock.hxx @@ -37,12 +37,14 @@ namespace Item std::shared_ptr m_aDefaultItem; std::function m_aConstructDefaultItem; std::function m_aConstructItem; +OUStringm_aName; public: ItemControlBlock( const std::shared_ptr& rItemAdministrator, std::functionconstructDefaultItem, -std::functionconstructItem); +std::functionconstructItem, +const OUString& rName); ItemControlBlock(); const std::shared_ptr& GetItemAdministrator() @@ -58,7 +60,13 @@ namespace Item } std::shared_ptr CreateFromAny(const ItemBase::AnyIDArgs& rArgs); + bool IsDefault(const ItemBase& rItem) const; + +const OUString& GetName() const +{ +return m_aName; +} }; } // end of namespace Item diff --git a/item/source/base/ItemControlBlock.cxx b/item/source/base/ItemControlBlock.cxx index ffd32e7c4a86..16f31efcb0d2 100755 --- a/item/source/base/ItemControlBlock.cxx +++ b/item/source/base/ItemControlBlock.cxx @@ -17,11 +17,13 @@ namespace Item ItemControlBlock::ItemControlBlock( const std::shared_ptr& rItemAdministrator, std::functionconstructDefaultItem, -std::functionconstructItem) +std::functionconstructItem, +const OUString& rName) : m_aItemAdministrator(rItemAdministrator), m_aDefaultItem(), m_aConstructDefaultItem(constructDefaultItem), -m_aConstructItem(constructItem) +m_aConstructItem(constructItem), +m_aName(rName) { assert(rItemAdministrator && "nullptr not allowed, an ItemAdministrator *is* required (!)"); } diff --git a/item/source/simple/CntInt16.cxx b/item/source/simple/CntInt16.cxx index 9da54cdf2ae7..493d63bcdc1f 100644 --- a/item/source/simple/CntInt16.cxx +++ b/item/source/simple/CntInt16.cxx @@ -21,7 +21,8 @@ namespace Item static ItemControlBlock aItemControlBlock( std::shared_ptr(new IAdministrator_set()), [](){ return new CntInt16(CntInt16::GetStaticItemControlBlock()); }, -[](){ return new CntInt16(CntInt16::GetStaticItemControlBlock()); }); +[](){ return new CntInt16(CntInt16::GetStaticItemControlBlock()); }, +"CntInt16"); return aItemControlBlock; } diff --git a/item/source/simple/CntOUString.cxx b/item/source/simple/CntOUString.cxx index 47de99947372..c25e7fb9a116 100644 --- a/item/source/simple/CntOUString.cxx +++ b/item/source/simple/CntOUString.cxx @@ -21,7 +21,8 @@ namespace Item static ItemControlBlock aItemControlBlock( std::shared_ptr(new IAdministrator_unordered_set()), [](){ return new CntOUString(CntOUString::GetStaticItemControlBlock()); }, -[](){ return new CntOUString(CntOUString::GetStaticItemControlBlock()); }); +[](){ return new CntOUString(CntOUString::GetStaticItemControlBlock()); }, +"CntOUString"); return aItemControlBlock; } diff --git a/item/test/ItemTest.cxx b/item/test/ItemTest.cxx index
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/item include/svx item/source item/test svx/source
basctl/source/basicide/sbxitem.cxx | 27 +- basctl/source/inc/sbxitem.hxx |2 include/item/base/ItemBase.hxx | 14 - include/item/base/ItemControlBlock.hxx | 16 - include/item/base/ItemSet.hxx |9 include/item/base/SlotSet.hxx |2 include/item/simple/CntInt16.hxx |6 include/item/simple/CntOUString.hxx|5 include/svx/item/TransformAnchor.hxx |5 item/source/base/ItemBase.cxx | 29 -- item/source/base/ItemControlBlock.cxx | 24 +- item/source/simple/CntInt16.cxx| 19 - item/source/simple/CntOUString.cxx | 19 - item/test/ItemTest.cxx | 326 + svx/source/items/TransformAnchor.cxx | 21 +- 15 files changed, 359 insertions(+), 165 deletions(-) New commits: commit 0c1b918b84c1b47a35dbb7a9a995728f3fcb1d7c Author: Armin Le Grand AuthorDate: Thu Apr 11 16:54:36 2019 +0200 Commit: Armin Le Grand CommitDate: Thu Apr 11 16:54:36 2019 +0200 WIP: Further basic changes Decided to have a reference to the ItemControlBlock in each incarnation of Item to make accesses from the incarnations more simple. This avoids the hierarchical virtual GetItemControlBlock implementations which just call the local static ones - easy to forget when implementing items. Instead, hand over a reference when constructing an Item - anyways inside the protected constructors, not in ::Create methods. Adapted ItemControlBlock accordingly to get now two lambdas (construct and default-construct). The default no longer gets pre-constructed, that may lead to endless loops when inside the 1st constructor call the static ItemControlBlock gets created Change-Id: Id4629578ef46668652c949f3ec831ba4a784cb6e diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index 33b3adca54e7..1243535c22f4 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -30,19 +30,20 @@ namespace Item { static ::Item::ItemControlBlock aItemControlBlock( std::shared_ptr<::Item::ItemAdministrator>(new ::Item::IAdministrator_vector()), -std::shared_ptr(new Sbx()), -[](){ return new Sbx(); }); +[](){ return new Sbx(Sbx::GetStaticItemControlBlock()); }, +[](){ return new Sbx(Sbx::GetStaticItemControlBlock()); }); return aItemControlBlock; } -::Item::ItemControlBlock& Sbx::GetItemControlBlock() const -{ -return Sbx::GetStaticItemControlBlock(); -} - -Sbx::Sbx(const ScriptDocument* pDocument, const OUString& aLibName, const OUString& aName, const OUString& aMethodName, ItemType eType) -: ::Item::ItemBase(), +Sbx::Sbx( +::Item::ItemControlBlock& rItemControlBlock, +const ScriptDocument* pDocument, +const OUString& aLibName, +const OUString& aName, +const OUString& aMethodName, +ItemType eType) +: ::Item::ItemBase(rItemControlBlock), m_aDocument(nullptr != pDocument ? *pDocument : ScriptDocument::getApplicationScriptDocument()), m_aLibName(aLibName), m_aName(aName), @@ -65,7 +66,13 @@ namespace Item { return std::static_pointer_cast( Sbx::GetStaticItemControlBlock().GetItemAdministrator()->Create( -new Sbx(, aLibName, aName, aMethodName, eType))); +new Sbx( +Sbx::GetStaticItemControlBlock(), +, +aLibName, +aName, +aMethodName, +eType))); } bool Sbx::operator==(const ItemBase& rCandidate) const diff --git a/basctl/source/inc/sbxitem.hxx b/basctl/source/inc/sbxitem.hxx index fe6cc705b83d..56b62d3e4ed4 100644 --- a/basctl/source/inc/sbxitem.hxx +++ b/basctl/source/inc/sbxitem.hxx @@ -47,7 +47,6 @@ namespace Item { public: static ::Item::ItemControlBlock& GetStaticItemControlBlock(); -virtual ::Item::ItemControlBlock& GetItemControlBlock() const override; private: const ScriptDocumentm_aDocument; @@ -58,6 +57,7 @@ namespace Item protected: Sbx( +::Item::ItemControlBlock& rItemControlBlock, const ScriptDocument* pDocument = nullptr, const OUString& aLibName = OUString(), const OUString& aName = OUString(), diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index f356d5edadc1..f7fbd889a640 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -98,6 +98,12 @@ namespace Item typedef std::vector AnyIDArgs; private: +// local reference to instance of ItemControlBlock for this +// incarnation - same as type::GetStaticItemControlBlock(), but +// this way accessible for all
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - 2 commits - basctl/source cui/source include/item include/sfx2 include/svx item/source item/test sfx2/source svx/Library_svxcore.mk sv
basctl/source/basicide/basides1.cxx | 90 ++--- basctl/source/basicide/bastype2.cxx | 40 +++ basctl/source/basicide/moduldl2.cxx | 40 +++ basctl/source/basicide/moduldlg.cxx | 160 +++ basctl/source/basicide/sbxitem.cxx |7 + cui/source/tabpages/swpossizetabpage.cxx |8 - include/item/base/ItemBase.hxx |3 include/sfx2/dispatch.hxx|8 - include/svx/item/TransformAnchor.hxx | 39 +++ item/source/base/ItemBase.cxx| 16 +-- item/source/simple/CntInt16.cxx |7 - item/source/simple/CntOUString.cxx |6 - item/test/ItemTest.cxx | 23 +--- sfx2/source/control/dispatch.cxx | 26 +++-- svx/Library_svxcore.mk |2 svx/source/items/TransformAnchor.cxx | 52 ++ sw/source/uibase/shells/drwbassh.cxx | 11 +- 17 files changed, 332 insertions(+), 206 deletions(-) New commits: commit 520ea875cba4dbb40193d73924131045b76bb363 Author: Armin Le Grand AuthorDate: Wed Apr 10 11:56:52 2019 +0200 Commit: Armin Le Grand CommitDate: Wed Apr 10 11:56:52 2019 +0200 WIP: Replaced SID_ATTR_TRANSFORM_ANCHOR with Item by implementing Item::TransformAnchor and using it type-safe. This is an example of a direct derive from an existing (simple) Item (CntInt16) and thus re-using the same ItemAdministrator. Slightly adapted implementations and tests Change-Id: I1a0222f04f59130bb51e29e3871d0bf7766b84ee diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index bb5e518f72ce..33b3adca54e7 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -70,8 +70,13 @@ namespace Item bool Sbx::operator==(const ItemBase& rCandidate) const { -assert(ItemBase::operator==(rCandidate)); +if(ItemBase::operator==(rCandidate)) // compares ptrs +{ +return true; +} + const Sbx& rCand(static_cast(rCandidate)); + return (GetDocument() == rCand.GetDocument() && GetLibName() == rCand.GetLibName() && GetName() == rCand.GetName() diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 2c81c13b124c..e8fc7daba175 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -35,7 +35,7 @@ #include // I2TM -#include +#include // ~I2TM using namespace ::com::sun::star::text; @@ -751,7 +751,7 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet) if(bAnchorChanged) { // I2TM -rSet->slotSet().SetSlot(SID_ATTR_TRANSFORM_ANCHOR, Item::CntInt16::Create(static_cast(nAnchor))); +rSet->itemSet().SetItem(Item::TransformAnchor::Create(nAnchor)); // ~I2TM bModified = true; } @@ -900,9 +900,9 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet) RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA; // I2TM -if(const auto Slot(rSet->slotSet().GetSlot(SID_ATTR_TRANSFORM_ANCHOR)); Slot) +if(const auto Item(rSet->itemSet().GetStateAndItem()); Item.HasItem()) { -nAnchorType = static_cast(Slot->GetValue()); +nAnchorType = Item.GetItem()->GetAnchorType(); // I2TM switch(nAnchorType) { diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index 6af2858e8d0a..f356d5edadc1 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -124,9 +124,6 @@ namespace Item // to create instances ItemBase(); -// basic RTTI TypeCheck to secure e.g. operator== and similar -bool CheckSameType(const ItemBase& rCmp) const; - // PutValue/Any interface for automated instance creation from SfxType // mechanism (UNO API and sfx2 stuff) friend class ItemControlBlock; diff --git a/include/svx/item/TransformAnchor.hxx b/include/svx/item/TransformAnchor.hxx new file mode 100755 index ..d78c5e2a93c5 --- /dev/null +++ b/include/svx/item/TransformAnchor.hxx @@ -0,0 +1,39 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SVX_ITEM_TRANSFORMANCHOR_HXX +#define INCLUDED_SVX_ITEM_TRANSFORMANCHOR_HXX + +#include +#include + +/// + +namespace Item +{ +class SVX_DLLPUBLIC TransformAnchor : public CntInt16 +{ +public: +static ItemControlBlock& GetStaticItemControlBlock(); +virtual ItemControlBlock&
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - 2 commits - avmedia/source basctl/source cui/source idl/source include/avmedia include/item include/sfx2 include/svx item/Library_item
avmedia/source/framework/mediatoolbox.cxx |2 basctl/source/basicide/IDEComboBox.cxx |4 basctl/source/basicide/basides1.cxx |2 basctl/source/basicide/sbxitem.cxx | 35 + basctl/source/inc/IDEComboBox.hxx |4 basctl/source/inc/sbxitem.hxx | 19 - cui/source/dialogs/cuihyperdlg.cxx |2 cui/source/inc/cuihyperdlg.hxx |2 idl/source/objects/slot.cxx |2 idl/source/objects/types.cxx|9 include/avmedia/mediatoolbox.hxx|2 include/item/base/ItemAdministrator.hxx | 30 - include/item/base/ItemBase.hxx | 30 + include/item/base/ItemBaseStaticHelper.hxx | 75 --- include/item/base/ItemControlBlock.hxx | 71 +++ include/item/base/ItemSet.hxx | 22 - include/item/base/ModelSpecificItemValues.hxx |8 include/item/base/SlotSet.hxx | 13 include/item/simple/CntInt16.hxx| 20 - include/item/simple/CntOUString.hxx | 20 - include/sfx2/ctrlitem.hxx |4 include/sfx2/msg.hxx| 18 include/sfx2/sfxstatuslistener.hxx |2 include/sfx2/sidebar/ControllerItem.hxx |2 include/sfx2/stbitem.hxx|2 include/sfx2/tbxctrl.hxx|2 include/sfx2/unoctitm.hxx |2 include/svx/ParaSpacingControl.hxx |4 include/svx/bmpmask.hxx |2 include/svx/clipboardctl.hxx|2 include/svx/fillctrl.hxx|2 include/svx/float3d.hxx |4 include/svx/fontwork.hxx|2 include/svx/formatpaintbrushctrl.hxx|2 include/svx/grafctrl.hxx|4 include/svx/imapdlg.hxx |2 include/svx/insctrl.hxx |2 include/svx/layctrl.hxx |4 include/svx/lboxctrl.hxx|2 include/svx/linectrl.hxx|4 include/svx/modctrl.hxx |2 include/svx/pszctrl.hxx |2 include/svx/selctrl.hxx |2 include/svx/tbcontrl.hxx|4 include/svx/tbxctl.hxx |2 include/svx/verttexttbxctrl.hxx |2 include/svx/xmlsecctrl.hxx |2 include/svx/zoomctrl.hxx|2 include/svx/zoomsliderctrl.hxx |2 item/Library_item.mk|1 item/source/base/ItemAdministrator.cxx | 54 +- item/source/base/ItemBase.cxx | 48 +- item/source/base/ItemControlBlock.cxx | 53 ++ item/source/base/ItemSet.cxx|8 item/source/base/ModelSpecificItemValues.cxx| 14 item/source/base/SlotSet.cxx|4 item/source/simple/CntInt16.cxx | 31 + item/source/simple/CntOUString.cxx | 29 + item/test/ItemTest.cxx | 377 reportdesign/source/ui/misc/statusbarcontroller.cxx |4 sc/inc/NumberFormatControl.hxx |2 sc/source/ui/cctrl/tbzoomsliderctrl.cxx |2 sc/source/ui/inc/navcitem.hxx |2 sc/source/ui/inc/tbzoomsliderctrl.hxx |2 sc/source/ui/navipi/navcitem.cxx|2 sc/source/ui/sidebar/NumberFormatControl.cxx|2 sd/source/ui/app/tmplctrl.cxx |2 sd/source/ui/dlg/animobjs.cxx |2 sd/source/ui/dlg/diactrl.cxx|2 sd/source/ui/dlg/gluectrl.cxx |2 sd/source/ui/dlg/navigatr.cxx |4 sd/source/ui/inc/animobjs.hxx |2 sd/source/ui/inc/diactrl.hxx|2 sd/source/ui/inc/gluectrl.hxx |2 sd/source/ui/inc/navigatr.hxx |4 sd/source/ui/inc/tmplctrl.hxx |2 sd/source/ui/view/sdruler.cxx |4 sfx2/inc/inettbc.hxx|2 sfx2/source/appl/appuno.cxx |4 sfx2/source/control/bindings.cxx|2 sfx2/source/control/ctrlitem.cxx|4
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - cui/Library_cui.mk cui/source include/item item/source svl/source sw/Library_sw.mk sw/source
cui/Library_cui.mk |1 cui/source/tabpages/swpossizetabpage.cxx | 18 ++--- include/item/base/ItemSet.hxx| 60 +++ item/source/base/ItemSet.cxx | 19 + svl/source/items/itemset.cxx | 10 + sw/Library_sw.mk |1 sw/source/uibase/shells/drwbassh.cxx | 21 +++--- 7 files changed, 118 insertions(+), 12 deletions(-) New commits: commit 09ef433f3ea8ab803492d4c24970e301d02fa700 Author: Armin Le Grand AuthorDate: Fri Apr 5 14:33:26 2019 +0200 Commit: Armin Le Grand CommitDate: Fri Apr 5 14:33:26 2019 +0200 WIP: Started SfxInt16Item replacement First replace SID_ATTR_TRANSFORM_ANCHOR by adding/using a slot for it and replacing usages. Slot is used since it allows using existing typed items as Item::CntInt16 as key/value pair with an ID Change-Id: Ie6c1e5dea6dac5afb5b2cc4ad9799464f860d5f0 diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 8ede124d16be..488335bea9f9 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -59,6 +59,7 @@ $(eval $(call gb_Library_use_libraries,cui,\ ucbhelper \ utl \ vcl \ +item \ )) $(eval $(call gb_Library_use_externals,cui,\ diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index b2c159dda940..2c81c13b124c 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -34,6 +34,10 @@ #include #include +// I2TM +#include +// ~I2TM + using namespace ::com::sun::star::text; #define SwFPos SvxSwFramePosString @@ -746,7 +750,9 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet) bool bModified = false; if(bAnchorChanged) { -rSet->Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, static_cast(nAnchor))); +// I2TM +rSet->slotSet().SetSlot(SID_ATTR_TRANSFORM_ANCHOR, Item::CntInt16::Create(static_cast(nAnchor))); +// ~I2TM bModified = true; } if (m_xPositionCB->get_state_changed_from_saved()) @@ -890,12 +896,14 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet) void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet) { -const SfxPoolItem* pItem = GetItem( *rSet, SID_ATTR_TRANSFORM_ANCHOR ); bool bInvalidateAnchor = false; RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA; -if(pItem) + +// I2TM +if(const auto Slot(rSet->slotSet().GetSlot(SID_ATTR_TRANSFORM_ANCHOR)); Slot) { -nAnchorType = static_cast(static_cast(pItem)->GetValue()); +nAnchorType = static_cast(Slot->GetValue()); +// I2TM switch(nAnchorType) { case RndStdIds::FLY_AT_PAGE: m_xToPageRB->set_active(true); break; @@ -920,7 +928,7 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet) m_xToFrameRB->set_sensitive( false ); } -pItem = GetItem( *rSet, SID_ATTR_TRANSFORM_PROTECT_POS ); +const SfxPoolItem* pItem = GetItem( *rSet, SID_ATTR_TRANSFORM_PROTECT_POS ); if (pItem) { bool bProtected = static_cast(pItem)->GetValue(); diff --git a/include/item/base/ItemSet.hxx b/include/item/base/ItemSet.hxx index ed4e03176963..f2d42ef28247 100644 --- a/include/item/base/ItemSet.hxx +++ b/include/item/base/ItemSet.hxx @@ -87,6 +87,64 @@ // static const ::sal_Int16 UNKNOWN = (sal_Int16)0; // /// +// +// SfxItemSet::PutExtended usages: +// voidPutExtended( const SfxItemSet&, +// SfxItemState eDontCareAs, +// SfxItemState eDefaultAs ); +// +// rDestSet.PutExtended( rSourceSet, SfxItemState::DONTCARE, SfxItemState::DEFAULT ); +// aDestSub.PutExtended( rSrcSub, SfxItemState::DONTCARE, SfxItemState::DEFAULT ); +// aDestSub.PutExtended( rSrcSub, SfxItemState::DONTCARE, SfxItemState::DEFAULT ); +// pStyles[i].pDest->GetItemSet().PutExtended( +// pStyles[i].pSource->GetItemSet(), SfxItemState::DONTCARE, SfxItemState::DEFAULT); +// aSetItem.GetItemSet().PutExtended( rCoreSet, SfxItemState::DONTCARE, SfxItemState::SET ); +// pFound[i].pDest->GetItemSet().PutExtended(pFound[i].pSource->GetItemSet(), SfxItemState::DONTCARE, SfxItemState::DEFAULT); +// +// -> all eDontCareAs -> SfxItemState::DONTCARE -> Not needed +// -> only one eDefaultAs different from SfxItemState::DEFAULT +// -> check ScViewUtil::PutItemScript is this is needed (sc\source\ui\view\viewutil.cxx) +// +// SvxScriptSetItem aSetItem( rPool.GetSlotId(nWhichId), rPool ); +// SvxScriptSetItem::SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ) +// : SfxSetItem( nSlotId, std::make_unique( rPool, +// svl::Items{} )) +// { +// sal_uInt16 nLatin, nAsian, nComplex; +// GetWhichIds(
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2-3' - sw/source
sw/source/core/doc/notxtfrm.cxx | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) New commits: commit 1100ca5407e7ffd9ce58fc0c2f4afe7e8e60e0f8 Author: Armin Le Grand AuthorDate: Tue Apr 2 17:59:40 2019 +0200 Commit: Michael Stahl CommitDate: Thu Apr 4 14:39:14 2019 +0200 tdf#124272 use ClipRegion's geometry if not a rectangle By error the ClipRegion's geometry was replaced by it's BoundRect expanded to PixelBounds. If the ClipRegion is not a rectangle, this will create wrong results. To do both - extend to PixelBounds and have the original geometry included - use the PolyPolygon topology as needed (see comment in code for details) Change-Id: If3f75223144eba8eb23909a7c701ad544346099b Reviewed-on: https://gerrit.libreoffice.org/70146 Tested-by: Jenkins Reviewed-by: Armin Le Grand (cherry picked from commit 362c1cf2bd580f6dc8bf27bdcd79174111bc1b5c) Reviewed-on: https://gerrit.libreoffice.org/70154 Reviewed-by: Thorsten Behrens (cherry picked from commit 2b7b1a1501b88474ed5d691bafb45d465d8ab9f6) Reviewed-on: https://gerrit.libreoffice.org/70181 Tested-by: Xisco Faulí Tested-by: Thorsten Behrens Reviewed-by: Xisco Faulí Reviewed-by: Michael Stahl diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 51c43fa0e2a1..04e556277738 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -982,9 +982,34 @@ void paintGraphicUsingPrimitivesHelper( ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()), ceil(aClipRange.getMaxY() + aSinglePixelXY.getY())); +// create the enclosing rectangle as polygon +basegfx::B2DPolyPolygon aTarget(basegfx::utils::createPolygonFromRect(aExpandedClipRange)); + +// tdf#124272 the fix above (tdf#114076) was too rough - the +// clip region used may be a PolyPolygon. In that case that +// PolyPolygon would have to be scaled to mentioned PixelBounds. +// Since that is not really possible geometrically (would need +// more some 'grow in outside direction' but with unequal grow +// values in all directions - just maaany problems +// involved), use a graphical trick: The topology of the +// PolyPolygon uses the stndard FillRule, so adding the now +// guaranteed to be bigger or equal bounding (enclosing) +// rectangle twice as polygon will expand the BoundRange, but +// not change the geometry visualization at all +if(!rOutputDevice.GetClipRegion().IsRectangle()) +{ +// double the outer rectangle range polygon to have it +// included twice +aTarget.append(aTarget.getB2DPolygon(0)); + +// add the original clip 'inside' (due to being smaller +// or equal). That PolyPolygon may have an unknown number +// of polygons (>=1) +aTarget.append(aClip); +} + aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D( -basegfx::B2DPolyPolygon( -basegfx::utils::createPolygonFromRect(aExpandedClipRange)), +aTarget, aContent); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/source
sw/source/core/doc/notxtfrm.cxx | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) New commits: commit c2ae30b19d8145271f1189c9757d59d43de391c7 Author: Armin Le Grand AuthorDate: Tue Apr 2 17:59:40 2019 +0200 Commit: Thorsten Behrens CommitDate: Wed Apr 3 12:32:38 2019 +0200 tdf#124272 use ClipRegion's geometry if not a rectangle By error the ClipRegion's geometry was replaced by it's BoundRect expanded to PixelBounds. If the ClipRegion is not a rectangle, this will create wrong results. To do both - extend to PixelBounds and have the original geometry included - use the PolyPolygon topology as needed (see comment in code for details) Reviewed-on: https://gerrit.libreoffice.org/70146 Tested-by: Jenkins Reviewed-by: Armin Le Grand (cherry picked from commit 362c1cf2bd580f6dc8bf27bdcd79174111bc1b5c) Conflicts: sw/source/core/doc/notxtfrm.cxx Change-Id: If3f75223144eba8eb23909a7c701ad544346099b Reviewed-on: https://gerrit.libreoffice.org/70158 Tested-by: Xisco Faulí Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 6dd910fab9ee..6055384ac8a7 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -988,9 +988,34 @@ void paintGraphicUsingPrimitivesHelper( ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()), ceil(aClipRange.getMaxY() + aSinglePixelXY.getY())); +// create the enclosing rectangle as polygon +basegfx::B2DPolyPolygon aTarget(basegfx::utils::createPolygonFromRect(aExpandedClipRange)); + +// tdf#124272 the fix above (tdf#114076) was too rough - the +// clip region used may be a PolyPolygon. In that case that +// PolyPolygon would have to be scaled to mentioned PixelBounds. +// Since that is not really possible geometrically (would need +// more some 'grow in outside direction' but with unequal grow +// values in all directions - just maaany problems +// involved), use a graphical trick: The topology of the +// PolyPolygon uses the stndard FillRule, so adding the now +// guaranteed to be bigger or equal bounding (enclosing) +// rectangle twice as polygon will expand the BoundRange, but +// not change the geometry visualization at all +if(!rOutputDevice.GetClipRegion().IsRectangle()) +{ +// double the outer rectangle range polygon to have it +// included twice +aTarget.append(aTarget.getB2DPolygon(0)); + +// add the original clip 'inside' (due to being smaller +// or equal). That PolyPolygon may have an unknown number +// of polygons (>=1) +aTarget.append(aClip); +} + aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D( -basegfx::B2DPolyPolygon( - basegfx::utils::createPolygonFromRect(aExpandedClipRange)), +aTarget, aContent); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/source
sw/source/core/doc/notxtfrm.cxx | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) New commits: commit 2b7b1a1501b88474ed5d691bafb45d465d8ab9f6 Author: Armin Le Grand AuthorDate: Tue Apr 2 17:59:40 2019 +0200 Commit: Thorsten Behrens CommitDate: Wed Apr 3 00:18:53 2019 +0200 tdf#124272 use ClipRegion's geometry if not a rectangle By error the ClipRegion's geometry was replaced by it's BoundRect expanded to PixelBounds. If the ClipRegion is not a rectangle, this will create wrong results. To do both - extend to PixelBounds and have the original geometry included - use the PolyPolygon topology as needed (see comment in code for details) Change-Id: If3f75223144eba8eb23909a7c701ad544346099b Reviewed-on: https://gerrit.libreoffice.org/70146 Tested-by: Jenkins Reviewed-by: Armin Le Grand (cherry picked from commit 362c1cf2bd580f6dc8bf27bdcd79174111bc1b5c) Reviewed-on: https://gerrit.libreoffice.org/70154 Reviewed-by: Thorsten Behrens diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 51c43fa0e2a1..04e556277738 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -982,9 +982,34 @@ void paintGraphicUsingPrimitivesHelper( ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()), ceil(aClipRange.getMaxY() + aSinglePixelXY.getY())); +// create the enclosing rectangle as polygon +basegfx::B2DPolyPolygon aTarget(basegfx::utils::createPolygonFromRect(aExpandedClipRange)); + +// tdf#124272 the fix above (tdf#114076) was too rough - the +// clip region used may be a PolyPolygon. In that case that +// PolyPolygon would have to be scaled to mentioned PixelBounds. +// Since that is not really possible geometrically (would need +// more some 'grow in outside direction' but with unequal grow +// values in all directions - just maaany problems +// involved), use a graphical trick: The topology of the +// PolyPolygon uses the stndard FillRule, so adding the now +// guaranteed to be bigger or equal bounding (enclosing) +// rectangle twice as polygon will expand the BoundRange, but +// not change the geometry visualization at all +if(!rOutputDevice.GetClipRegion().IsRectangle()) +{ +// double the outer rectangle range polygon to have it +// included twice +aTarget.append(aTarget.getB2DPolygon(0)); + +// add the original clip 'inside' (due to being smaller +// or equal). That PolyPolygon may have an unknown number +// of polygons (>=1) +aTarget.append(aClip); +} + aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D( -basegfx::B2DPolyPolygon( -basegfx::utils::createPolygonFromRect(aExpandedClipRange)), +aTarget, aContent); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/source
sw/source/core/doc/notxtfrm.cxx | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) New commits: commit 362c1cf2bd580f6dc8bf27bdcd79174111bc1b5c Author: Armin Le Grand AuthorDate: Tue Apr 2 17:59:40 2019 +0200 Commit: Armin Le Grand CommitDate: Tue Apr 2 21:03:07 2019 +0200 tdf#124272 use ClipRegion's geometry if not a rectangle By error the ClipRegion's geometry was replaced by it's BoundRect expanded to PixelBounds. If the ClipRegion is not a rectangle, this will create wrong results. To do both - extend to PixelBounds and have the original geometry included - use the PolyPolygon topology as needed (see comment in code for details) Change-Id: If3f75223144eba8eb23909a7c701ad544346099b Reviewed-on: https://gerrit.libreoffice.org/70146 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 004e11dc9160..17e41bab5579 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -987,9 +987,34 @@ void paintGraphicUsingPrimitivesHelper( ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()), ceil(aClipRange.getMaxY() + aSinglePixelXY.getY())); +// create the enclosing rectangle as polygon +basegfx::B2DPolyPolygon aTarget(basegfx::utils::createPolygonFromRect(aExpandedClipRange)); + +// tdf#124272 the fix above (tdf#114076) was too rough - the +// clip region used may be a PolyPolygon. In that case that +// PolyPolygon would have to be scaled to mentioned PixelBounds. +// Since that is not really possible geometrically (would need +// more some 'grow in outside direction' but with unequal grow +// values in all directions - just maaany problems +// involved), use a graphical trick: The topology of the +// PolyPolygon uses the stndard FillRule, so adding the now +// guaranteed to be bigger or equal bounding (enclosing) +// rectangle twice as polygon will expand the BoundRange, but +// not change the geometry visualization at all +if(!rOutputDevice.GetClipRegion().IsRectangle()) +{ +// double the outer rectangle range polygon to have it +// included twice +aTarget.append(aTarget.getB2DPolygon(0)); + +// add the original clip 'inside' (due to being smaller +// or equal). That PolyPolygon may have an unknown number +// of polygons (>=1) +aTarget.append(aClip); +} + aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D( -basegfx::B2DPolyPolygon( -basegfx::utils::createPolygonFromRect(aExpandedClipRange)), +aTarget, aContent); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - 2 commits - basctl/source include/item item/source
basctl/source/basicide/sbxitem.cxx |7 + basctl/source/inc/sbxitem.hxx | 12 + include/item/base/ItemAdministrator.hxx|2 - include/item/base/ItemBase.hxx | 18 +++--- include/item/base/ItemBaseStaticHelper.hxx | 35 - include/item/base/ItemSet.hxx |1 include/item/base/SlotSet.hxx |3 +- include/item/simple/CntInt16.hxx | 14 ++- include/item/simple/CntOUString.hxx| 14 ++- item/source/base/ItemAdministrator.cxx | 10 item/source/simple/CntInt16.cxx|7 + item/source/simple/CntOUString.cxx |7 + 12 files changed, 85 insertions(+), 45 deletions(-) New commits: commit 75fb94c28243f1925a0e258ac26f673991f8303d Author: Armin Le Grand AuthorDate: Fri Mar 29 20:33:12 2019 +0100 Commit: Armin Le Grand CommitDate: Fri Mar 29 20:33:12 2019 +0100 changed back to derivations of ItemBase Instead of deriving ItemBaseStaticHelper from ItemBase already, changed back (had this at the beginning) to derive from ItemBaseStaticHelper and ItemBase individually. This is necessary when an Item is derived from an already implemented one, else ItemBase would be derived multiple times. This comes at the cost of having to define some stuff in each implementation - not too much, though. Also made ItemAdministrator being the friend of ItemBase narrower (one access function, not whole class) Change-Id: I2edb3ffda0936d392b63ce477dbf02338155c5b0 diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index aba31041228e..cc51573f5faf 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -25,8 +25,15 @@ namespace basctl // I2TM namespace Item { +// need internal access to ItemAdministrator +::Item::ItemAdministrator* Sbx::GetIAdministrator() const +{ +return (); +} + Sbx::Sbx(const ScriptDocument* pDocument, const OUString& aLibName, const OUString& aName, const OUString& aMethodName, ItemType eType) : SbxStaticHelper(), +::Item::ItemBase(), m_aDocument(nullptr != pDocument ? *pDocument : ScriptDocument::getApplicationScriptDocument()), m_aLibName(aLibName), m_aName(aName), diff --git a/basctl/source/inc/sbxitem.hxx b/basctl/source/inc/sbxitem.hxx index 1c89b30e2865..89ee646a35ae 100644 --- a/basctl/source/inc/sbxitem.hxx +++ b/basctl/source/inc/sbxitem.hxx @@ -45,8 +45,17 @@ namespace Item class Sbx; typedef ::Item::ItemBaseStaticHelper SbxStaticHelper; -class Sbx final : public SbxStaticHelper +class Sbx final : public SbxStaticHelper, public ::Item::ItemBase { +public: +// SharedPtr typedef to be used handling instances of given type +typedef std::shared_ptr SharedPtr; + +private: +// need to offer internal access to ItemAdministrator +// in each derivation - just calls GetStaticAdmin internally +virtual ::Item::ItemAdministrator* GetIAdministrator() const override; + private: const ScriptDocumentm_aDocument; const OUString m_aLibName; @@ -67,6 +76,7 @@ namespace Item public: virtual ~Sbx(); +// SharedPtr-construtcor static std::shared_ptr Create( const ScriptDocument& rDocument, const OUString& aLibName = OUString(), diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx index 675af691fa1f..7511dee4a485 100644 --- a/include/item/base/ItemBase.hxx +++ b/include/item/base/ItemBase.hxx @@ -36,10 +36,12 @@ namespace Item // Base class for ItemBase and thus for all new implementation of // Items. Items are in general read-only instances. The constructor // is protected now so that no one is able to create own instances. -// The reason for that is that for all Items only a single value- +// The reason for this is that for all Items only a single value- // specific instance shall exist at any time, guaranteed by being // administrated by an instance of ItemAdministrator associated with // each implemented type of ItemBase Item. +// To create and/or implement constructors (SharedPtr-constructor's) +// use/implement public ::Create.* methods. // To construct, use the ::Create methods. These are in general // static member functions. These have to use the protected // constructor(s) from which also any number may be defined to @@ -58,7 +60,7 @@ namespace Item // thus making runtime existance of Items safe. It also uses typed // derivations and templates to ensure throghout usage of typed // Items. -// That Items are in general read-only instances also means that there +// That Items are read-only instances also means that there // will
[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/sfx2 item/source sfx2/sdi
basctl/source/basicide/basides1.cxx | 26 +++--- basctl/source/basicide/bastype2.cxx | 20 + basctl/source/basicide/moduldl2.cxx | 10 +- basctl/source/basicide/moduldlg.cxx | 33 +- basctl/source/basicide/sbxitem.cxx | 52 basctl/source/inc/sbxitem.hxx | 27 -- include/sfx2/sfxsids.hrc|4 ++ include/sfx2/sfxstatuslistener.hxx |1 include/sfx2/stbitem.hxx|1 item/source/base/ItemBase.cxx | 31 + sfx2/sdi/sfx.sdi|6 ++-- sfx2/sdi/sfxitems.sdi |5 ++- 12 files changed, 59 insertions(+), 157 deletions(-) New commits: commit 3d182e90b24d593c79aa43d8955859ccef53a195 Author: Armin Le Grand AuthorDate: Fri Mar 29 15:50:18 2019 +0100 Commit: Armin Le Grand CommitDate: Fri Mar 29 15:50:18 2019 +0100 cleanups && linux build adaptions Change-Id: I5081ce778b72da263382969ea4452af3e2164acc diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index ad44cbf52e7b..32eb37cd05b2 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -572,6 +572,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) case SID_BASICIDE_SBXINSERTED: { DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); +// I2TM const auto aSbxItem = rReq.GetArgs()->slotSet().GetSlot(SID_BASICIDE_ARG_SBX); const ScriptDocument& aDocument( aSbxItem->GetDocument() ); const OUString& aLibName( aSbxItem->GetLibName() ); @@ -587,28 +588,15 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) FindDlgWin(aDocument, aLibName, aName, true); } } -// const SbxItem& rSbxItem = rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); -// const ScriptDocument& aDocument( rSbxItem.GetDocument() ); -// const OUString& aLibName( rSbxItem.GetLibName() ); -// const OUString& aName( rSbxItem.GetName() ); -// if ( m_aCurLibName.isEmpty() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) ) -// { -// if ( rSbxItem.GetType() == TYPE_MODULE ) -// FindBasWin( aDocument, aLibName, aName, true ); -// else if ( rSbxItem.GetType() == TYPE_DIALOG ) -// FindDlgWin( aDocument, aLibName, aName, true ); -// } } break; case SID_BASICIDE_SBXDELETED: { DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); +// I2TM const auto aSbxItem = rReq.GetArgs()->slotSet().GetSlot(SID_BASICIDE_ARG_SBX); const ScriptDocument& aDocument(aSbxItem->GetDocument()); VclPtr pWin = FindWindow(aDocument, aSbxItem->GetLibName(), aSbxItem->GetName(), aSbxItem->GetType(), true); -// const SbxItem& rSbxItem = rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); -// const ScriptDocument& aDocument( rSbxItem.GetDocument() ); -// VclPtr pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), true ); if ( pWin ) RemoveWindow( pWin, true ); } @@ -616,27 +604,23 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) case SID_BASICIDE_SHOWSBX: { DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); +// I2TM const auto aSbxItem = rReq.GetArgs()->slotSet().GetSlot(SID_BASICIDE_ARG_SBX); const ScriptDocument& aDocument(aSbxItem->GetDocument()); const OUString& aLibName(aSbxItem->GetLibName()); const OUString& aName(aSbxItem->GetName()); -// const SbxItem& rSbxItem = rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); -// const ScriptDocument& aDocument( rSbxItem.GetDocument() ); -// const OUString& aLibName( rSbxItem.GetLibName() ); -// const OUString& aName( rSbxItem.GetName() ); + SetCurLib( aDocument, aLibName ); BaseWindow* pWin = nullptr; -// if ( rSbxItem.GetType() == TYPE_DIALOG ) + if(TYPE_DIALOG == aSbxItem->GetType()) { pWin = FindDlgWin( aDocument, aLibName, aName, true ); } -// else if ( rSbxItem.GetType() == TYPE_MODULE ) else if(TYPE_MODULE == aSbxItem->GetType()) { pWin = FindBasWin( aDocument, aLibName, aName, true ); } -// else if ( rSbxItem.GetType() == TYPE_METHOD ) else if(TYPE_METHOD == aSbxItem->GetType()) { pWin = FindBasWin( aDocument, aLibName, aName, true ); diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index
[Libreoffice-commits] core.git: Changes to 'feature/item_refactor2'
New branch 'feature/item_refactor2' available with the following commits: commit 8cb2a04d6c2f6a93a32c642cbeaeab71037fc622 Author: Armin Le Grand Date: Thu Mar 28 17:15:06 2019 +0100 WIP: continued replacement Item::IBase, ::ISet stuff Completely changed SbxItem to new mechanisms, to do so created Item::Sbx implementation, adapted all usages of SbxItem and added quirte some mechanisms to do so. Gloal was to completely run (unchanged) wothout the original SbxItem - that was achieved and can be seen as proof of concept and example how to acto in doing so. Adapted ::StateChanged to include a Item::ItemBase::SharedPtr to an Item for future compatibility - will/should be completely changed when transition is done. Added to SfxItemSet which is still used as transport mechanism the ability to get on-demands of ::ItemSet and ::SlotSet to have a source/target for the new Items. Adapted the IDLC compiler to be able to generate needed new stuff on demand, together with new SlotItems as alternative to SfxPoolItems. Currently both in place, the latter can go after transition. Check for CreateSlotItem. Needed to add a static ::CreateFromAny with an array of arguments to keep new ::Item implementations read-only, adapted usages. Added a new ExecuteList method that uses SlotItems/SlotSets. Added some I2TM tags which I will use to mark stuff in transit as a uniquely greppable tag (temporary). Change-Id: If98d20fc08abe9cd6e186c233f2c90883c5e47d3 commit e0e5ac22619c5e3b5b64a1ef243066089ddf7f5b Author: Armin Le Grand Date: Thu Mar 28 10:48:56 2019 +0100 WIP: continued replacement Item::IBase, ::ISet stuff Added SlotSet stuff Adapted ::StateChanged to hand around SlotItem info Adapted SlotItem creation CreateItem -> CreateSfxPoolItem Added CreateSlotItem handling where CreateSfxPoolItem did something - not complete Note: May change all that to use StateAndItem due to StateChanged also using/needing a SfxItemState, but better to do that when Items are transfered. Note: SlotItem in ::StateChanged is not yet used anywhere, but will replace SfxPoolItem there in the long run Change-Id: Ie11e07ecb814ce46bafa17cb9b97d58c090cab85 commit c721df42bb2d04a594b453d1ac5c39a7a77c Author: Armin Le Grand Date: Wed Mar 20 13:57:39 2019 +0100 WIP: Started replacement Item::IBase, ::ISet stuff To have a base for replacing SfxItem* stuff in the long term I started to implement some basic stuff, please see comments in new part tree item and includes and testfiles to see how it works. Extended docu will be done during (hopefully) progressing Change-Id: I59245f9ed0897943e72bfd53f8d1136a30f2db16 commit 91fe1f2de88ace126feff269a4d0b2749512292b Author: Armin Le Grand Date: Wed Mar 20 13:57:39 2019 +0100 WIP: Started replacement Item::IBase, ::ISet stuff To have a base for replacing SfxItem* stuff in the long term I started to implement some basic stuff, please see comments in new part tree item and includes and testfiles to see how it works. Extended docu will be done during (hopefully) progressing Change-Id: I59245f9ed0897943e72bfd53f8d1136a30f2db16 ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits