diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 12:58:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 14:58:23 +0200 |
commit | eb0f43f2b4d894cfe0aa0b70d7228ea3b0036161 (patch) | |
tree | 4b8f9e4a9cc4fc2c38a976d4538edeb50a4553b2 /svx | |
parent | 16fc591ddd8c4cd4d59fe85abc767b961edcf61f (diff) |
loplugin:flatten in svx/sdr
Change-Id: I553d01dc51515930fc7f96fe44d19ed14416e6f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100234
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
19 files changed, 1040 insertions, 1040 deletions
diff --git a/svx/source/sdr/animation/animationstate.cxx b/svx/source/sdr/animation/animationstate.cxx index 2c23b91b79b2..17db39768aa7 100644 --- a/svx/source/sdr/animation/animationstate.cxx +++ b/svx/source/sdr/animation/animationstate.cxx @@ -72,35 +72,35 @@ namespace sdr::animation // getSmallestNextTime will be zero when animation ended. If not zero, a next step // exists - if(!::basegfx::fTools::equalZero(fNextTime)) - { - // next time point exists, use it - sal_uInt32 nNextTime; + if(::basegfx::fTools::equalZero(fNextTime)) + return; - if(fNextTime >= double(0xffffff00)) - { - // take care for very late points in time, e.g. when a text animation stops - // in a defined AnimationEntryFixed with endless (0xffffffff) duration - nNextTime = GetTime() + (1000 * 60 * 60); // one hour, works with vcl timers, 0xffffff00 was too much... - } - else - { - nNextTime = static_cast<sal_uInt32>(fNextTime); - } + // next time point exists, use it + sal_uInt32 nNextTime; - // ensure step forward in integer timing, the floating step difference maybe smaller than 1.0. Use - // at least 25ms for next step - const sal_uInt32 nMinimumStepTime(static_cast<sal_uInt32>(fCurrentTime) + 25); + if(fNextTime >= double(0xffffff00)) + { + // take care for very late points in time, e.g. when a text animation stops + // in a defined AnimationEntryFixed with endless (0xffffffff) duration + nNextTime = GetTime() + (1000 * 60 * 60); // one hour, works with vcl timers, 0xffffff00 was too much... + } + else + { + nNextTime = static_cast<sal_uInt32>(fNextTime); + } - if(nNextTime <= nMinimumStepTime) - { - nNextTime = nMinimumStepTime; - } + // ensure step forward in integer timing, the floating step difference maybe smaller than 1.0. Use + // at least 25ms for next step + const sal_uInt32 nMinimumStepTime(static_cast<sal_uInt32>(fCurrentTime) + 25); - // set time and reactivate by re-adding to the scheduler - SetTime(nNextTime); - mrVOContact.GetObjectContact().getPrimitiveAnimator().InsertEvent(*this); + if(nNextTime <= nMinimumStepTime) + { + nNextTime = nMinimumStepTime; } + + // set time and reactivate by re-adding to the scheduler + SetTime(nNextTime); + mrVOContact.GetObjectContact().getPrimitiveAnimator().InsertEvent(*this); } PrimitiveAnimation::PrimitiveAnimation(sdr::contact::ViewObjectContact& rVOContact, const drawinglayer::primitive2d::Primitive2DContainer& rAnimatedPrimitives) diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index 77962bdb71a8..cd0b2fcc8872 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -179,28 +179,28 @@ namespace drawinglayer::attribute mbFormTextMirror(rSet.Get(XATTR_FORMTXTMIRROR).GetValue()), mbFormTextOutline(rSet.Get(XATTR_FORMTXTOUTLINE).GetValue()) { - if(getFormTextOutline()) + if(!getFormTextOutline()) + return; + + const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); + + // also need to prepare attributes for outlines { - const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); - - // also need to prepare attributes for outlines - { - const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); - - maOutline = SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); - } - - if(XFormTextShadow::NONE != getFormTextShadow()) - { - // also need to prepare attributes for shadow outlines - const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); - - maShadowOutline = SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); - } + const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); + + maOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } + + if(XFormTextShadow::NONE != getFormTextShadow()) + { + // also need to prepare attributes for shadow outlines + const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); + + maShadowOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); } } diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index b0b8bf8f336b..aaf62ea9dd99 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -107,20 +107,20 @@ namespace drawinglayer::attribute mbWrongSpell(bWrongSpell), mbChainable(bChainable) { - if(pSdrText) - { - if(XFormTextStyle::NONE != eFormTextStyle) - { - // text on path. Create FormText attribute - const SfxItemSet& rSet = pSdrText->GetItemSet(); - maSdrFormTextAttribute = SdrFormTextAttribute(rSet); - } + if(!pSdrText) + return; - // #i101556# init with version number to detect changes of single text - // attribute and/or style sheets in primitive data without having to - // copy that data locally (which would be better from principle) - maPropertiesVersion = pSdrText->GetObject().GetProperties().getVersion(); + if(XFormTextStyle::NONE != eFormTextStyle) + { + // text on path. Create FormText attribute + const SfxItemSet& rSet = pSdrText->GetItemSet(); + maSdrFormTextAttribute = SdrFormTextAttribute(rSet); } + + // #i101556# init with version number to detect changes of single text + // attribute and/or style sheets in primitive data without having to + // copy that data locally (which would be better from principle) + maPropertiesVersion = pSdrText->GetObject().GetProperties().getVersion(); } ImpSdrTextAttribute() diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx index 0fbecf79315b..83dcc051588a 100644 --- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx +++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx @@ -74,58 +74,58 @@ void ObjectContactOfObjListPainter::ProcessDisplay(DisplayInfo& rDisplayInfo) { const sal_uInt32 nCount(GetPaintObjectCount()); - if(nCount) + if(!nCount) + return; + + OutputDevice* pTargetDevice = TryToGetOutputDevice(); + + if(!pTargetDevice) + return; + + // update current ViewInformation2D at the ObjectContact + const GDIMetaFile* pMetaFile = pTargetDevice->GetConnectMetaFile(); + const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); + basegfx::B2DRange aViewRange; + + // create ViewRange + if(!bOutputToRecordingMetaFile) + { + // use visible pixels, but transform to world coordinates + const Size aOutputSizePixel(pTargetDevice->GetOutputSizePixel()); + aViewRange = ::basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight()); + aViewRange.transform(pTargetDevice->GetInverseViewTransformation()); + } + + // update local ViewInformation2D + const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D( + basegfx::B2DHomMatrix(), + pTargetDevice->GetViewTransformation(), + aViewRange, + GetXDrawPageForSdrPage(const_cast< SdrPage* >(mpProcessedPage)), + 0.0, + css::uno::Sequence<css::beans::PropertyValue>()); + updateViewInformation2D(aNewViewInformation2D); + + // collect primitive data in a sequence; this will already use the updated ViewInformation2D + drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence; + + for(sal_uInt32 a(0); a < nCount; a++) + { + const ViewObjectContact& rViewObjectContact = GetPaintObjectViewContact(a).GetViewObjectContact(*this); + + xPrimitiveSequence.append(rViewObjectContact.getPrimitive2DSequenceHierarchy(rDisplayInfo)); + } + + // if there is something to show, use a vclProcessor to render it + if(!xPrimitiveSequence.empty()) { - OutputDevice* pTargetDevice = TryToGetOutputDevice(); + std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createProcessor2DFromOutputDevice( + *pTargetDevice, + getViewInformation2D())); - if(pTargetDevice) + if(pProcessor2D) { - // update current ViewInformation2D at the ObjectContact - const GDIMetaFile* pMetaFile = pTargetDevice->GetConnectMetaFile(); - const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); - basegfx::B2DRange aViewRange; - - // create ViewRange - if(!bOutputToRecordingMetaFile) - { - // use visible pixels, but transform to world coordinates - const Size aOutputSizePixel(pTargetDevice->GetOutputSizePixel()); - aViewRange = ::basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight()); - aViewRange.transform(pTargetDevice->GetInverseViewTransformation()); - } - - // update local ViewInformation2D - const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D( - basegfx::B2DHomMatrix(), - pTargetDevice->GetViewTransformation(), - aViewRange, - GetXDrawPageForSdrPage(const_cast< SdrPage* >(mpProcessedPage)), - 0.0, - css::uno::Sequence<css::beans::PropertyValue>()); - updateViewInformation2D(aNewViewInformation2D); - - // collect primitive data in a sequence; this will already use the updated ViewInformation2D - drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence; - - for(sal_uInt32 a(0); a < nCount; a++) - { - const ViewObjectContact& rViewObjectContact = GetPaintObjectViewContact(a).GetViewObjectContact(*this); - - xPrimitiveSequence.append(rViewObjectContact.getPrimitive2DSequenceHierarchy(rDisplayInfo)); - } - - // if there is something to show, use a vclProcessor to render it - if(!xPrimitiveSequence.empty()) - { - std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createProcessor2DFromOutputDevice( - *pTargetDevice, - getViewInformation2D())); - - if(pProcessor2D) - { - pProcessor2D->process(xPrimitiveSequence); - } - } + pProcessor2D->process(xPrimitiveSequence); } } } diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 7676bb535fbc..7e214b76199e 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -210,43 +210,43 @@ const basegfx::B2DRange& ViewObjectContact::getObjectRange() const void ViewObjectContact::ActionChanged() { - if(!mbLazyInvalidate) - { - // set local flag - mbLazyInvalidate = true; + if(mbLazyInvalidate) + return; - // force ObjectRange - getObjectRange(); + // set local flag + mbLazyInvalidate = true; - if(!maObjectRange.isEmpty()) - { - // invalidate current valid range - GetObjectContact().InvalidatePartOfView(maObjectRange); + // force ObjectRange + getObjectRange(); - // reset ObjectRange, it needs to be recalculated - maObjectRange.reset(); - } + if(!maObjectRange.isEmpty()) + { + // invalidate current valid range + GetObjectContact().InvalidatePartOfView(maObjectRange); - // register at OC for lazy invalidate - GetObjectContact().setLazyInvalidate(*this); + // reset ObjectRange, it needs to be recalculated + maObjectRange.reset(); } + + // register at OC for lazy invalidate + GetObjectContact().setLazyInvalidate(*this); } void ViewObjectContact::triggerLazyInvalidate() { - if(mbLazyInvalidate) - { - // reset flag - mbLazyInvalidate = false; + if(!mbLazyInvalidate) + return; - // force ObjectRange - getObjectRange(); + // reset flag + mbLazyInvalidate = false; - if(!maObjectRange.isEmpty()) - { - // invalidate current valid range - GetObjectContact().InvalidatePartOfView(maObjectRange); - } + // force ObjectRange + getObjectRange(); + + if(!maObjectRange.isEmpty()) + { + // invalidate current valid range + GetObjectContact().InvalidatePartOfView(maObjectRange); } } @@ -268,22 +268,22 @@ void ViewObjectContact::checkForPrimitive2DAnimations() mpPrimitiveAnimation.reset(); // check for animated primitives - if(!mxPrimitive2DSequence.empty()) + if(mxPrimitive2DSequence.empty()) + return; + + const bool bTextAnimationAllowed(GetObjectContact().IsTextAnimationAllowed()); + const bool bGraphicAnimationAllowed(GetObjectContact().IsGraphicAnimationAllowed()); + + if(bTextAnimationAllowed || bGraphicAnimationAllowed) { - const bool bTextAnimationAllowed(GetObjectContact().IsTextAnimationAllowed()); - const bool bGraphicAnimationAllowed(GetObjectContact().IsGraphicAnimationAllowed()); + AnimatedExtractingProcessor2D aAnimatedExtractor(GetObjectContact().getViewInformation2D(), + bTextAnimationAllowed, bGraphicAnimationAllowed); + aAnimatedExtractor.process(mxPrimitive2DSequence); - if(bTextAnimationAllowed || bGraphicAnimationAllowed) + if(!aAnimatedExtractor.getPrimitive2DSequence().empty()) { - AnimatedExtractingProcessor2D aAnimatedExtractor(GetObjectContact().getViewInformation2D(), - bTextAnimationAllowed, bGraphicAnimationAllowed); - aAnimatedExtractor.process(mxPrimitive2DSequence); - - if(!aAnimatedExtractor.getPrimitive2DSequence().empty()) - { - // derived primitiveList is animated, setup new PrimitiveAnimation - mpPrimitiveAnimation.reset( new sdr::animation::PrimitiveAnimation(*this, aAnimatedExtractor.getPrimitive2DSequence()) ); - } + // derived primitiveList is animated, setup new PrimitiveAnimation + mpPrimitiveAnimation.reset( new sdr::animation::PrimitiveAnimation(*this, aAnimatedExtractor.getPrimitive2DSequence()) ); } } } diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx index d1636bd289a7..16faa132a7a4 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx @@ -88,45 +88,45 @@ Size ViewObjectContactOfSdrMediaObj::getPreferredSize() const void ViewObjectContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) const { #if HAVE_FEATURE_AVMEDIA - if( mpMediaWindow ) - { - mpMediaWindow->updateMediaItem( rItem ); + if( !mpMediaWindow ) + return; - // show/hide is now dependent of play state - if(avmedia::MediaState::Stop == rItem.getState()) - { - mpMediaWindow->hide(); - } - else - { - basegfx::B2DRange aViewRange(getObjectRange()); - aViewRange.transform(GetObjectContact().getViewInformation2D().getViewTransformation()); - - const tools::Rectangle aViewRectangle( - static_cast<sal_Int32>(floor(aViewRange.getMinX())), static_cast<sal_Int32>(floor(aViewRange.getMinY())), - static_cast<sal_Int32>(ceil(aViewRange.getMaxX())), static_cast<sal_Int32>(ceil(aViewRange.getMaxY()))); - - // mpMediaWindow contains a SalObject window and gtk won't accept - // the size until after the SalObject widget is shown but if we - // show it before setting a size then vcl will detect that the - // vcl::Window has no size and make it invisible instead. If we - // call setPosSize twice with the same size before and after show - // then the second attempt is a no-op as vcl caches the size. - - // so call it initially with a size arbitrarily 1 pixel wider than - // we want so we have an initial size to make vcl happy - tools::Rectangle aInitialRect(aViewRectangle); - aInitialRect.AdjustRight(1); - mpMediaWindow->setPosSize(aInitialRect); - - // then make it visible - mpMediaWindow->show(); - - // set the final desired size which is different to let vcl send it - // through to gtk which will now accept it as the underlying - // m_pSocket of GtkSalObject::SetPosSize is now visible - mpMediaWindow->setPosSize(aViewRectangle); - } + mpMediaWindow->updateMediaItem( rItem ); + + // show/hide is now dependent of play state + if(avmedia::MediaState::Stop == rItem.getState()) + { + mpMediaWindow->hide(); + } + else + { + basegfx::B2DRange aViewRange(getObjectRange()); + aViewRange.transform(GetObjectContact().getViewInformation2D().getViewTransformation()); + + const tools::Rectangle aViewRectangle( + static_cast<sal_Int32>(floor(aViewRange.getMinX())), static_cast<sal_Int32>(floor(aViewRange.getMinY())), + static_cast<sal_Int32>(ceil(aViewRange.getMaxX())), static_cast<sal_Int32>(ceil(aViewRange.getMaxY()))); + + // mpMediaWindow contains a SalObject window and gtk won't accept + // the size until after the SalObject widget is shown but if we + // show it before setting a size then vcl will detect that the + // vcl::Window has no size and make it invisible instead. If we + // call setPosSize twice with the same size before and after show + // then the second attempt is a no-op as vcl caches the size. + + // so call it initially with a size arbitrarily 1 pixel wider than + // we want so we have an initial size to make vcl happy + tools::Rectangle aInitialRect(aViewRectangle); + aInitialRect.AdjustRight(1); + mpMediaWindow->setPosSize(aInitialRect); + + // then make it visible + mpMediaWindow->show(); + + // set the final desired size which is different to let vcl send it + // through to gtk which will now accept it as the underlying + // m_pSocket of GtkSalObject::SetPosSize is now visible + mpMediaWindow->setPosSize(aViewRectangle); } #else (void) rItem; diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 6f9ecf61ce3b..e54918f51ce7 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1729,21 +1729,21 @@ namespace sdr::contact { ViewObjectContactOfSdrObj::ActionChanged(); const ControlHolder& rControl(m_pImpl->getExistentControl()); - if(rControl.is() && !rControl.isDesignMode()) + if(!(rControl.is() && !rControl.isDesignMode())) + return; + + // #i93180# if layer visibility has changed and control is in live mode, it is necessary + // to correct visibility to make those control vanish on SdrObject LayerID changes + const SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); + + if(pSdrPageView) { - // #i93180# if layer visibility has changed and control is in live mode, it is necessary - // to correct visibility to make those control vanish on SdrObject LayerID changes - const SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); + const SdrObject& rObject = getSdrObject(); + const bool bIsLayerVisible( rObject.IsVisible() && pSdrPageView->GetVisibleLayers().IsSet(rObject.GetLayer())); - if(pSdrPageView) + if(rControl.isVisible() != bIsLayerVisible) { - const SdrObject& rObject = getSdrObject(); - const bool bIsLayerVisible( rObject.IsVisible() && pSdrPageView->GetVisibleLayers().IsSet(rObject.GetLayer())); - - if(rControl.isVisible() != bIsLayerVisible) - { - rControl.setVisible(bIsLayerVisible); - } + rControl.setVisible(bIsLayerVisible); } } } diff --git a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx index d659accb7f4c..967e9665b807 100644 --- a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx +++ b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx @@ -85,27 +85,27 @@ namespace sdr::overlay void OverlayAnimatedBitmapEx::Trigger(sal_uInt32 nTime) { - if(getOverlayManager()) - { - // #i53216# produce event after nTime + x - SetTime(nTime + mnBlinkTime); - - // switch state - if(mbOverlayState) - { - mbOverlayState = false; - } - else - { - mbOverlayState = true; - } + if(!getOverlayManager()) + return; - // re-insert me as event - getOverlayManager()->InsertEvent(*this); + // #i53216# produce event after nTime + x + SetTime(nTime + mnBlinkTime); - // register change (after change) - objectChange(); + // switch state + if(mbOverlayState) + { + mbOverlayState = false; } + else + { + mbOverlayState = true; + } + + // re-insert me as event + getOverlayManager()->InsertEvent(*this); + + // register change (after change) + objectChange(); } } // end of namespace diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 4c831869a6b4..6f4068227acb 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -39,52 +39,52 @@ namespace sdr::overlay { const sal_uInt32 nSize(maOverlayObjects.size()); - if(nSize) - { - const AntialiasingFlags nOriginalAA(rDestinationDevice.GetAntialiasing()); - const bool bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing()); + if(!nSize) + return; - // create processor - std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice( - rDestinationDevice, - getCurrentViewInformation2D())); + const AntialiasingFlags nOriginalAA(rDestinationDevice.GetAntialiasing()); + const bool bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing()); - if(pProcessor) + // create processor + std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice( + rDestinationDevice, + getCurrentViewInformation2D())); + + if(pProcessor) + { + for(const auto& rpOverlayObject : maOverlayObjects) { - for(const auto& rpOverlayObject : maOverlayObjects) + OSL_ENSURE(rpOverlayObject, "Corrupted OverlayObject List (!)"); + const OverlayObject& rCandidate = *rpOverlayObject; + + if(rCandidate.isVisible()) { - OSL_ENSURE(rpOverlayObject, "Corrupted OverlayObject List (!)"); - const OverlayObject& rCandidate = *rpOverlayObject; + const drawinglayer::primitive2d::Primitive2DContainer& rSequence = rCandidate.getOverlayObjectPrimitive2DSequence(); - if(rCandidate.isVisible()) + if(!rSequence.empty()) { - const drawinglayer::primitive2d::Primitive2DContainer& rSequence = rCandidate.getOverlayObjectPrimitive2DSequence(); - - if(!rSequence.empty()) + if(rRange.overlaps(rCandidate.getBaseRange())) { - if(rRange.overlaps(rCandidate.getBaseRange())) + if(bIsAntiAliasing && rCandidate.allowsAntiAliase()) { - if(bIsAntiAliasing && rCandidate.allowsAntiAliase()) - { - rDestinationDevice.SetAntialiasing(nOriginalAA | AntialiasingFlags::EnableB2dDraw); - } - else - { - rDestinationDevice.SetAntialiasing(nOriginalAA & ~AntialiasingFlags::EnableB2dDraw); - } - - pProcessor->process(rSequence); + rDestinationDevice.SetAntialiasing(nOriginalAA | AntialiasingFlags::EnableB2dDraw); } + else + { + rDestinationDevice.SetAntialiasing(nOriginalAA & ~AntialiasingFlags::EnableB2dDraw); + } + + pProcessor->process(rSequence); } } } - - pProcessor.reset(); } - // restore AA settings - rDestinationDevice.SetAntialiasing(nOriginalAA); + pProcessor.reset(); } + + // restore AA settings + rDestinationDevice.SetAntialiasing(nOriginalAA); } void OverlayManager::ImpStripeDefinitionChanged() @@ -231,19 +231,19 @@ namespace sdr::overlay void OverlayManager::completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice) const { - if(!rRegion.IsEmpty() && !maOverlayObjects.empty()) - { - // check for changed MapModes. That may influence the - // logical size of pixel based OverlayObjects (like BitmapHandles) - //ImpCheckMapModeChange(); + if(rRegion.IsEmpty() || maOverlayObjects.empty()) + return; - // paint members - const tools::Rectangle aRegionBoundRect(rRegion.GetBoundRect()); - const basegfx::B2DRange aRegionRange = vcl::unotools::b2DRectangleFromRectangle(aRegionBoundRect); + // check for changed MapModes. That may influence the + // logical size of pixel based OverlayObjects (like BitmapHandles) + //ImpCheckMapModeChange(); - OutputDevice& rTarget = pPreRenderDevice ? *pPreRenderDevice : getOutputDevice(); - ImpDrawMembers(aRegionRange, rTarget); - } + // paint members + const tools::Rectangle aRegionBoundRect(rRegion.GetBoundRect()); + const basegfx::B2DRange aRegionRange = vcl::unotools::b2DRectangleFromRectangle(aRegionBoundRect); + + OutputDevice& rTarget = pPreRenderDevice ? *pPreRenderDevice : getOutputDevice(); + ImpDrawMembers(aRegionRange, rTarget); } void OverlayManager::flush() diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 89f35a025b90..3052246cbadb 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -194,155 +194,155 @@ namespace sdr::overlay // stop timer maBufferIdle.Stop(); - if(!maBufferRememberedRangePixel.isEmpty()) - { - // logic size for impDrawMember call - basegfx::B2DRange aBufferRememberedRangeLogic( - maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(), - maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY()); - aBufferRememberedRangeLogic.transform(getOutputDevice().GetInverseViewTransformation()); + if(maBufferRememberedRangePixel.isEmpty()) + return; - // prepare cursor handling - const bool bTargetIsWindow(OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); - bool bCursorWasEnabled(false); + // logic size for impDrawMember call + basegfx::B2DRange aBufferRememberedRangeLogic( + maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(), + maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY()); + aBufferRememberedRangeLogic.transform(getOutputDevice().GetInverseViewTransformation()); - // #i80730# switch off VCL cursor during overlay refresh - if(bTargetIsWindow) - { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); - vcl::Cursor* pCursor = rWindow.GetCursor(); + // prepare cursor handling + const bool bTargetIsWindow(OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); + bool bCursorWasEnabled(false); - if(pCursor && pCursor->IsVisible()) - { - pCursor->Hide(); - bCursorWasEnabled = true; - } + // #i80730# switch off VCL cursor during overlay refresh + if(bTargetIsWindow) + { + vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + vcl::Cursor* pCursor = rWindow.GetCursor(); + + if(pCursor && pCursor->IsVisible()) + { + pCursor->Hide(); + bCursorWasEnabled = true; } + } + + // refresh with prerendering + { + // #i73602# ensure valid and sized mpOutputBufferDevice + const Size aDestinationSizePixel(mpBufferDevice->GetOutputSizePixel()); + const Size aOutputBufferSizePixel(mpOutputBufferDevice->GetOutputSizePixel()); - // refresh with prerendering + if(aDestinationSizePixel != aOutputBufferSizePixel) { - // #i73602# ensure valid and sized mpOutputBufferDevice - const Size aDestinationSizePixel(mpBufferDevice->GetOutputSizePixel()); - const Size aOutputBufferSizePixel(mpOutputBufferDevice->GetOutputSizePixel()); + mpOutputBufferDevice->SetOutputSizePixel(aDestinationSizePixel); + } - if(aDestinationSizePixel != aOutputBufferSizePixel) - { - mpOutputBufferDevice->SetOutputSizePixel(aDestinationSizePixel); - } + mpOutputBufferDevice->SetMapMode(getOutputDevice().GetMapMode()); + mpOutputBufferDevice->EnableMapMode(false); + mpOutputBufferDevice->SetDrawMode(mpBufferDevice->GetDrawMode()); + mpOutputBufferDevice->SetSettings(mpBufferDevice->GetSettings()); + mpOutputBufferDevice->SetAntialiasing(mpBufferDevice->GetAntialiasing()); - mpOutputBufferDevice->SetMapMode(getOutputDevice().GetMapMode()); - mpOutputBufferDevice->EnableMapMode(false); - mpOutputBufferDevice->SetDrawMode(mpBufferDevice->GetDrawMode()); - mpOutputBufferDevice->SetSettings(mpBufferDevice->GetSettings()); - mpOutputBufferDevice->SetAntialiasing(mpBufferDevice->GetAntialiasing()); - - // calculate sizes - tools::Rectangle aRegionRectanglePixel( - maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(), - maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY()); - - // truncate aRegionRectanglePixel to destination pixel size, more does - // not need to be prepared since destination is a buffer for a window. So, - // maximum size indirectly shall be limited to getOutputDevice().GetOutputSizePixel() - if(aRegionRectanglePixel.Left() < 0) - { - aRegionRectanglePixel.SetLeft( 0 ); - } + // calculate sizes + tools::Rectangle aRegionRectanglePixel( + maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(), + maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY()); - if(aRegionRectanglePixel.Top() < 0) - { - aRegionRectanglePixel.SetTop( 0 ); - } + // truncate aRegionRectanglePixel to destination pixel size, more does + // not need to be prepared since destination is a buffer for a window. So, + // maximum size indirectly shall be limited to getOutputDevice().GetOutputSizePixel() + if(aRegionRectanglePixel.Left() < 0) + { + aRegionRectanglePixel.SetLeft( 0 ); + } - if(aRegionRectanglePixel.Right() > aDestinationSizePixel.getWidth()) - { - aRegionRectanglePixel.SetRight( aDestinationSizePixel.getWidth() ); - } + if(aRegionRectanglePixel.Top() < 0) + { + aRegionRectanglePixel.SetTop( 0 ); + } - if(aRegionRectanglePixel.Bottom() > aDestinationSizePixel.getHeight()) - { - aRegionRectanglePixel.SetBottom( aDestinationSizePixel.getHeight() ); - } + if(aRegionRectanglePixel.Right() > aDestinationSizePixel.getWidth()) + { + aRegionRectanglePixel.SetRight( aDestinationSizePixel.getWidth() ); + } - // get sizes - const Point aTopLeft(aRegionRectanglePixel.TopLeft()); - const Size aSize(aRegionRectanglePixel.GetSize()); + if(aRegionRectanglePixel.Bottom() > aDestinationSizePixel.getHeight()) + { + aRegionRectanglePixel.SetBottom( aDestinationSizePixel.getHeight() ); + } - { - const bool bMapModeWasEnabledDest(mpBufferDevice->IsMapModeEnabled()); - mpBufferDevice->EnableMapMode(false); + // get sizes + const Point aTopLeft(aRegionRectanglePixel.TopLeft()); + const Size aSize(aRegionRectanglePixel.GetSize()); - mpOutputBufferDevice->DrawOutDev( - aTopLeft, aSize, // destination - aTopLeft, aSize, // source - *mpBufferDevice); + { + const bool bMapModeWasEnabledDest(mpBufferDevice->IsMapModeEnabled()); + mpBufferDevice->EnableMapMode(false); - // restore MapModes - mpBufferDevice->EnableMapMode(bMapModeWasEnabledDest); - } + mpOutputBufferDevice->DrawOutDev( + aTopLeft, aSize, // destination + aTopLeft, aSize, // source + *mpBufferDevice); - // paint overlay content for remembered region, use - // method from base class directly - mpOutputBufferDevice->EnableMapMode(); - OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, *mpOutputBufferDevice); - mpOutputBufferDevice->EnableMapMode(false); + // restore MapModes + mpBufferDevice->EnableMapMode(bMapModeWasEnabledDest); + } - // copy to output - { - const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled()); - getOutputDevice().EnableMapMode(false); + // paint overlay content for remembered region, use + // method from base class directly + mpOutputBufferDevice->EnableMapMode(); + OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, *mpOutputBufferDevice); + mpOutputBufferDevice->EnableMapMode(false); - getOutputDevice().DrawOutDev( - aTopLeft, aSize, // destination - aTopLeft, aSize, // source - *mpOutputBufferDevice); + // copy to output + { + const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled()); + getOutputDevice().EnableMapMode(false); - // debug - /*getOutputDevice().SetLineCOL_RED); - getOutputDevice().SetFillColor(); - getOutputDevice().DrawRect(Rectangle(aTopLeft, aSize));*/ + getOutputDevice().DrawOutDev( + aTopLeft, aSize, // destination + aTopLeft, aSize, // source + *mpOutputBufferDevice); - // restore MapModes - getOutputDevice().EnableMapMode(bMapModeWasEnabledDest); - } - } + // debug + /*getOutputDevice().SetLineCOL_RED); + getOutputDevice().SetFillColor(); + getOutputDevice().DrawRect(Rectangle(aTopLeft, aSize));*/ - // VCL hack for transparent child windows - // Problem is e.g. a radiobutton form control in life mode. The used window - // is a transparence vcl childwindow. This flag only allows the parent window to - // paint into the child windows area, but there is no mechanism which takes - // care for a repaint of the child window. A transparent child window is NOT - // a window which always keeps it's content consistent over the parent, but it's - // more like just a paint flag for the parent. - // To get the update, the windows in question are updated manually here. - if(bTargetIsWindow) - { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); - - const tools::Rectangle aRegionRectanglePixel( - maBufferRememberedRangePixel.getMinX(), - maBufferRememberedRangePixel.getMinY(), - maBufferRememberedRangePixel.getMaxX(), - maBufferRememberedRangePixel.getMaxY()); - PaintTransparentChildren(rWindow, aRegionRectanglePixel); + // restore MapModes + getOutputDevice().EnableMapMode(bMapModeWasEnabledDest); } + } - // #i80730# restore visibility of VCL cursor - if(bCursorWasEnabled) - { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); - vcl::Cursor* pCursor = rWindow.GetCursor(); + // VCL hack for transparent child windows + // Problem is e.g. a radiobutton form control in life mode. The used window + // is a transparence vcl childwindow. This flag only allows the parent window to + // paint into the child windows area, but there is no mechanism which takes + // care for a repaint of the child window. A transparent child window is NOT + // a window which always keeps it's content consistent over the parent, but it's + // more like just a paint flag for the parent. + // To get the update, the windows in question are updated manually here. + if(bTargetIsWindow) + { + vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + + const tools::Rectangle aRegionRectanglePixel( + maBufferRememberedRangePixel.getMinX(), + maBufferRememberedRangePixel.getMinY(), + maBufferRememberedRangePixel.getMaxX(), + maBufferRememberedRangePixel.getMaxY()); + PaintTransparentChildren(rWindow, aRegionRectanglePixel); + } - if(pCursor) - { - // check if cursor still exists. It may have been deleted from someone - pCursor->Show(); - } - } + // #i80730# restore visibility of VCL cursor + if(bCursorWasEnabled) + { + vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + vcl::Cursor* pCursor = rWindow.GetCursor(); - // forget remembered Region - maBufferRememberedRangePixel.reset(); + if(pCursor) + { + // check if cursor still exists. It may have been deleted from someone + pCursor->Show(); + } } + + // forget remembered Region + maBufferRememberedRangePixel.reset(); } OverlayManagerBuffered::OverlayManagerBuffered( @@ -396,43 +396,43 @@ namespace sdr::overlay void OverlayManagerBuffered::invalidateRange(const basegfx::B2DRange& rRange) { - if(!rRange.isEmpty()) + if(rRange.isEmpty()) + return; + + // buffered output, do not invalidate but use the timer + // to trigger a timer event for refresh + maBufferIdle.Start(); + + // add the discrete range to the remembered region + // #i75163# use double precision and floor/ceil rounding to get overlapped pixel region, even + // when the given logic region has a width/height of 0.0. This does NOT work with LogicToPixel + // since it just transforms the top left and bottom right points equally without taking + // discrete pixel coverage into account. An empty B2DRange and thus empty logic Rectangle translated + // to an also empty discrete pixel rectangle - what is wrong. + basegfx::B2DRange aDiscreteRange(rRange); + aDiscreteRange.transform(getOutputDevice().GetViewTransformation()); + + if(maDrawinglayerOpt.IsAntiAliasing()) { - // buffered output, do not invalidate but use the timer - // to trigger a timer event for refresh - maBufferIdle.Start(); - - // add the discrete range to the remembered region - // #i75163# use double precision and floor/ceil rounding to get overlapped pixel region, even - // when the given logic region has a width/height of 0.0. This does NOT work with LogicToPixel - // since it just transforms the top left and bottom right points equally without taking - // discrete pixel coverage into account. An empty B2DRange and thus empty logic Rectangle translated - // to an also empty discrete pixel rectangle - what is wrong. - basegfx::B2DRange aDiscreteRange(rRange); - aDiscreteRange.transform(getOutputDevice().GetViewTransformation()); - - if(maDrawinglayerOpt.IsAntiAliasing()) - { - // assume AA needs one pixel more and invalidate one pixel more - const double fDiscreteOne(getDiscreteOne()); - const basegfx::B2IPoint aTopLeft( - static_cast<sal_Int32>(floor(aDiscreteRange.getMinX() - fDiscreteOne)), - static_cast<sal_Int32>(floor(aDiscreteRange.getMinY() - fDiscreteOne))); - const basegfx::B2IPoint aBottomRight( - static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxX() + fDiscreteOne)), - static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxY() + fDiscreteOne))); - - maBufferRememberedRangePixel.expand(aTopLeft); - maBufferRememberedRangePixel.expand(aBottomRight); - } - else - { - const basegfx::B2IPoint aTopLeft(static_cast<sal_Int32>(floor(aDiscreteRange.getMinX())), static_cast<sal_Int32>(floor(aDiscreteRange.getMinY()))); - const basegfx::B2IPoint aBottomRight(static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxX())), static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxY()))); + // assume AA needs one pixel more and invalidate one pixel more + const double fDiscreteOne(getDiscreteOne()); + const basegfx::B2IPoint aTopLeft( + static_cast<sal_Int32>(floor(aDiscreteRange.getMinX() - fDiscreteOne)), + static_cast<sal_Int32>(floor(aDiscreteRange.getMinY() - fDiscreteOne))); + const basegfx::B2IPoint aBottomRight( + static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxX() + fDiscreteOne)), + static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxY() + fDiscreteOne))); + + maBufferRememberedRangePixel.expand(aTopLeft); + maBufferRememberedRangePixel.expand(aBottomRight); + } + else + { + const basegfx::B2IPoint aTopLeft(static_cast<sal_Int32>(floor(aDiscreteRange.getMinX())), static_cast<sal_Int32>(floor(aDiscreteRange.getMinY()))); + const basegfx::B2IPoint aBottomRight(static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxX())), static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxY()))); - maBufferRememberedRangePixel.expand(aTopLeft); - maBufferRememberedRangePixel.expand(aBottomRight); - } + maBufferRememberedRangePixel.expand(aTopLeft); + maBufferRememberedRangePixel.expand(aBottomRight); } } } // end of namespace diff --git a/svx/source/sdr/overlay/overlayrectangle.cxx b/svx/source/sdr/overlay/overlayrectangle.cxx index cf02b349862f..617c6d4dc7bf 100644 --- a/svx/source/sdr/overlay/overlayrectangle.cxx +++ b/svx/source/sdr/overlay/overlayrectangle.cxx @@ -85,27 +85,27 @@ namespace sdr::overlay void OverlayRectangle::Trigger(sal_uInt32 nTime) { - if(getOverlayManager()) - { - // #i53216# produce event after nTime + x - SetTime(nTime + mnBlinkTime); - - // switch state - if(mbOverlayState) - { - mbOverlayState = false; - } - else - { - mbOverlayState = true; - } + if(!getOverlayManager()) + return; - // re-insert me as event - getOverlayManager()->InsertEvent(*this); + // #i53216# produce event after nTime + x + SetTime(nTime + mnBlinkTime); - // register change (after change) - objectChange(); + // switch state + if(mbOverlayState) + { + mbOverlayState = false; } + else + { + mbOverlayState = true; + } + + // re-insert me as event + getOverlayManager()->InsertEvent(*this); + + // register change (after change) + objectChange(); } } // end of namespace diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx index e3988797b0de..31e520d3b419 100644 --- a/svx/source/sdr/overlay/overlaytools.cxx +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -223,31 +223,31 @@ ImplPrimitive2DIDBlock(OverlayStaticRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYRE { // use the prepared Viewport information accessible using getViewport() - if(!getViewport().isEmpty()) - { - basegfx::B2DPolygon aPolygon; - - aPolygon.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY())); - aPolygon.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY())); - - rContainer.push_back( - new PolygonMarkerPrimitive2D( - aPolygon, - getRGBColorA(), - getRGBColorB(), - getDiscreteDashLength())); - - aPolygon.clear(); - aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY())); - aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY())); - - rContainer.push_back( - new PolygonMarkerPrimitive2D( - aPolygon, - getRGBColorA(), - getRGBColorB(), - getDiscreteDashLength())); - } + if(getViewport().isEmpty()) + return; + + basegfx::B2DPolygon aPolygon; + + aPolygon.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY())); + aPolygon.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY())); + + rContainer.push_back( + new PolygonMarkerPrimitive2D( + aPolygon, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + + aPolygon.clear(); + aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY())); + aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY())); + + rContainer.push_back( + new PolygonMarkerPrimitive2D( + aPolygon, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); } bool OverlayCrosshairPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const @@ -414,69 +414,69 @@ ImplPrimitive2DIDBlock(OverlayStaticRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYRE { // use the prepared Viewport information accessible using getViewport() - if(!getViewport().isEmpty()) + if(getViewport().isEmpty()) + return; + + switch(getStyle()) { - switch(getStyle()) + case HELPLINESTYLE_VERTICAL : { - case HELPLINESTYLE_VERTICAL : - { - basegfx::B2DPolygon aLine; - - aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY())); - aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY())); - - rContainer.push_back( - new PolygonMarkerPrimitive2D( - aLine, - getRGBColorA(), - getRGBColorB(), - getDiscreteDashLength())); - break; - } + basegfx::B2DPolygon aLine; + + aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY())); + aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY())); + + rContainer.push_back( + new PolygonMarkerPrimitive2D( + aLine, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + break; + } - case HELPLINESTYLE_HORIZONTAL : - { - basegfx::B2DPolygon aLine; - - aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY())); - aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY())); - - rContainer.push_back( - new PolygonMarkerPrimitive2D( - aLine, - getRGBColorA(), - getRGBColorB(), - getDiscreteDashLength())); - break; - } + case HELPLINESTYLE_HORIZONTAL : + { + basegfx::B2DPolygon aLine; + + aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY())); + aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY())); + + rContainer.push_back( + new PolygonMarkerPrimitive2D( + aLine, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + break; + } - default: // case HELPLINESTYLE_POINT : - { - const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength()); - basegfx::B2DPolygon aLineA, aLineB; - - aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() - fDiscreteUnit)); - aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() + fDiscreteUnit)); - - rContainer.push_back( - new PolygonMarkerPrimitive2D( - aLineA, - getRGBColorA(), - getRGBColorB(), - getDiscreteDashLength())); - - aLineB.append(basegfx::B2DPoint(getBasePosition().getX() - fDiscreteUnit, getBasePosition().getY())); - aLineB.append(basegfx::B2DPoint(getBasePosition().getX() + fDiscreteUnit, getBasePosition().getY())); - - rContainer.push_back( - new PolygonMarkerPrimitive2D( - aLineB, - getRGBColorA(), - getRGBColorB(), - getDiscreteDashLength())); - - break; - } + default: // case HELPLINESTYLE_POINT : + { + const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength()); + basegfx::B2DPolygon aLineA, aLineB; + + aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() - fDiscreteUnit)); + aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() + fDiscreteUnit)); + + rContainer.push_back( + new PolygonMarkerPrimitive2D( + aLineA, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + + aLineB.append(basegfx::B2DPoint(getBasePosition().getX() - fDiscreteUnit, getBasePosition().getY())); + aLineB.append(basegfx::B2DPoint(getBasePosition().getX() + fDiscreteUnit, getBasePosition().getY())); + + rContainer.push_back( + new PolygonMarkerPrimitive2D( + aLineB, + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); + + break; } } } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 4795be7e147e..391f1f69cb8b 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -1054,28 +1054,28 @@ namespace drawinglayer::primitive2d } } - if(0.0 != rfCornerRadiusY) - { - const double fHalfObjectHeight(rObjectRange.getHeight() * 0.5); - - if(0.0 != fHalfObjectHeight) - { - if(rfCornerRadiusY < 0.0) - { - rfCornerRadiusY = 0.0; - } + if(0.0 == rfCornerRadiusY) + return; - if(rfCornerRadiusY > fHalfObjectHeight) - { - rfCornerRadiusY = fHalfObjectHeight; - } + const double fHalfObjectHeight(rObjectRange.getHeight() * 0.5); - rfCornerRadiusY /= fHalfObjectHeight; - } - else + if(0.0 != fHalfObjectHeight) + { + if(rfCornerRadiusY < 0.0) { rfCornerRadiusY = 0.0; } + + if(rfCornerRadiusY > fHalfObjectHeight) + { + rfCornerRadiusY = fHalfObjectHeight; + } + + rfCornerRadiusY /= fHalfObjectHeight; + } + else + { + rfCornerRadiusY = 0.0; } } diff --git a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx index 9799417209f8..5c227e446207 100644 --- a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx @@ -72,102 +72,102 @@ namespace mfAngle(fAngle), maOffsets() { - if (rStyle.IsUsed()) + if (!rStyle.IsUsed()) + return; + + svx::frame::RefMode aRefMode(rStyle.GetRefMode()); + Color aPrim(rStyle.GetColorPrim()); + Color aSecn(rStyle.GetColorSecn()); + const bool bSecnUsed(0.0 != rStyle.Secn()); + + // Get the single segment line widths. This is the point where the + // minimal discrete unit will be used if given (fMinimalDiscreteUnit). If + // not given it's 0.0 and thus will have no influence. + double fPrim(snapToDiscreteUnit(rStyle.Prim(), fMinimalDiscreteUnit)); + const double fDist(snapToDiscreteUnit(rStyle.Dist(), fMinimalDiscreteUnit)); + double fSecn(snapToDiscreteUnit(rStyle.Secn(), fMinimalDiscreteUnit)); + + // Of course also do not use svx::frame::Style::GetWidth() for obvious + // reasons. + const double fStyleWidth(fPrim + fDist + fSecn); + + if(bMirrored) { - svx::frame::RefMode aRefMode(rStyle.GetRefMode()); - Color aPrim(rStyle.GetColorPrim()); - Color aSecn(rStyle.GetColorSecn()); - const bool bSecnUsed(0.0 != rStyle.Secn()); - - // Get the single segment line widths. This is the point where the - // minimal discrete unit will be used if given (fMinimalDiscreteUnit). If - // not given it's 0.0 and thus will have no influence. - double fPrim(snapToDiscreteUnit(rStyle.Prim(), fMinimalDiscreteUnit)); - const double fDist(snapToDiscreteUnit(rStyle.Dist(), fMinimalDiscreteUnit)); - double fSecn(snapToDiscreteUnit(rStyle.Secn(), fMinimalDiscreteUnit)); - - // Of course also do not use svx::frame::Style::GetWidth() for obvious - // reasons. - const double fStyleWidth(fPrim + fDist + fSecn); - - if(bMirrored) + switch(aRefMode) { - switch(aRefMode) - { - case svx::frame::RefMode::Begin: aRefMode = svx::frame::RefMode::End; break; - case svx::frame::RefMode::End: aRefMode = svx::frame::RefMode::Begin; break; - default: break; - } - - if(bSecnUsed) - { - std::swap(aPrim, aSecn); - std::swap(fPrim, fSecn); - } + case svx::frame::RefMode::Begin: aRefMode = svx::frame::RefMode::End; break; + case svx::frame::RefMode::End: aRefMode = svx::frame::RefMode::Begin; break; + default: break; } - if (svx::frame::RefMode::Centered != aRefMode) + if(bSecnUsed) { - const double fHalfWidth(fStyleWidth * 0.5); - - if (svx::frame::RefMode::Begin == aRefMode) - { - // move aligned below vector - mfRefModeOffset = fHalfWidth; - } - else if (svx::frame::RefMode::End == aRefMode) - { - // move aligned above vector - mfRefModeOffset = -fHalfWidth; - } + std::swap(aPrim, aSecn); + std::swap(fPrim, fSecn); } + } + + if (svx::frame::RefMode::Centered != aRefMode) + { + const double fHalfWidth(fStyleWidth * 0.5); - if (bSecnUsed) + if (svx::frame::RefMode::Begin == aRefMode) { - // both or all three lines used - const bool bPrimTransparent(0xff == rStyle.GetColorPrim().GetTransparency()); - const bool bDistTransparent(!rStyle.UseGapColor() || 0xff == rStyle.GetColorGap().GetTransparency()); - const bool bSecnTransparent(0xff == aSecn.GetTransparency()); + // move aligned below vector + mfRefModeOffset = fHalfWidth; + } + else if (svx::frame::RefMode::End == aRefMode) + { + // move aligned above vector + mfRefModeOffset = -fHalfWidth; + } + } - if(!bPrimTransparent || !bDistTransparent || !bSecnTransparent) - { - const double a(mfRefModeOffset - (fStyleWidth * 0.5)); - const double b(a + fPrim); - const double c(b + fDist); - const double d(c + fSecn); - - maOffsets.push_back( - OffsetAndHalfWidthAndColor( - (a + b) * 0.5, - fPrim * 0.5, - nullptr != pForceColor ? *pForceColor : aPrim)); - - maOffsets.push_back( - OffsetAndHalfWidthAndColor( - (b + c) * 0.5, - fDist * 0.5, - rStyle.UseGapColor() - ? (nullptr != pForceColor ? *pForceColor : rStyle.GetColorGap()) - : COL_TRANSPARENT)); - - maOffsets.push_back( - OffsetAndHalfWidthAndColor( - (c + d) * 0.5, - fSecn * 0.5, - nullptr != pForceColor ? *pForceColor : aSecn)); - } + if (bSecnUsed) + { + // both or all three lines used + const bool bPrimTransparent(0xff == rStyle.GetColorPrim().GetTransparency()); + const bool bDistTransparent(!rStyle.UseGapColor() || 0xff == rStyle.GetColorGap().GetTransparency()); + const bool bSecnTransparent(0xff == aSecn.GetTransparency()); + + if(!bPrimTransparent || !bDistTransparent || !bSecnTransparent) + { + const double a(mfRefModeOffset - (fStyleWidth * 0.5)); + const double b(a + fPrim); + const double c(b + fDist); + const double d(c + fSecn); + + maOffsets.push_back( + OffsetAndHalfWidthAndColor( + (a + b) * 0.5, + fPrim * 0.5, + nullptr != pForceColor ? *pForceColor : aPrim)); + + maOffsets.push_back( + OffsetAndHalfWidthAndColor( + (b + c) * 0.5, + fDist * 0.5, + rStyle.UseGapColor() + ? (nullptr != pForceColor ? *pForceColor : rStyle.GetColorGap()) + : COL_TRANSPARENT)); + + maOffsets.push_back( + OffsetAndHalfWidthAndColor( + (c + d) * 0.5, + fSecn * 0.5, + nullptr != pForceColor ? *pForceColor : aSecn)); } - else + } + else + { + // one line used, push two values, from outer to inner + if(0xff != rStyle.GetColorPrim().GetTransparency()) { - // one line used, push two values, from outer to inner - if(0xff != rStyle.GetColorPrim().GetTransparency()) - { - maOffsets.push_back( - OffsetAndHalfWidthAndColor( - mfRefModeOffset, - fPrim * 0.5, - nullptr != pForceColor ? *pForceColor : aPrim)); - } + maOffsets.push_back( + OffsetAndHalfWidthAndColor( + mfRefModeOffset, + fPrim * 0.5, + nullptr != pForceColor ? *pForceColor : aPrim)); } } } @@ -207,19 +207,19 @@ namespace bool bMirrored, double fMinimalDiscreteUnit) { - if(rStyle.IsUsed() && !basegfx::areParallel(rMyVector, rOtherVector)) - { - // create angle between both. angle() needs vectors pointing away from the same point, - // so take the mirrored one. Add F_PI to get from -pi..+pi to [0..F_PI2] for sorting - const double fAngle(basegfx::B2DVector(-rMyVector.getX(), -rMyVector.getY()).angle(rOtherVector) + F_PI); - maEntries.emplace_back( - rStyle, - rOtherVector, - fAngle, - bMirrored, - nullptr, - fMinimalDiscreteUnit); - } + if(!(rStyle.IsUsed() && !basegfx::areParallel(rMyVector, rOtherVector))) + return; + + // create angle between both. angle() needs vectors pointing away from the same point, + // so take the mirrored one. Add F_PI to get from -pi..+pi to [0..F_PI2] for sorting + const double fAngle(basegfx::B2DVector(-rMyVector.getX(), -rMyVector.getY()).angle(rOtherVector) + F_PI); + maEntries.emplace_back( + rStyle, + rOtherVector, + fAngle, + bMirrored, + nullptr, + fMinimalDiscreteUnit); } void sort() @@ -315,164 +315,164 @@ namespace const basegfx::B2DVector& rPerpendX, // normalized perpendicular to own vector const std::vector< StyleVectorCombination >& rStyleVector) // other vectors emerging in this point { - if(!rCombination.empty() && !rStyleVector.empty() && rCombination.size() == rExtendSet.size()) + if(!(!rCombination.empty() && !rStyleVector.empty() && rCombination.size() == rExtendSet.size())) + return; + + const size_t nOffsetA(rCombination.size()); + + if(1 == nOffsetA) { - const size_t nOffsetA(rCombination.size()); + Color aMyColor; double fMyOffset(0.0); double fMyHalfWidth(0.0); + rCombination.getColorAndOffsetAndHalfWidth(0, aMyColor, fMyOffset, fMyHalfWidth); - if(1 == nOffsetA) + if(0xff != aMyColor.GetTransparency()) { - Color aMyColor; double fMyOffset(0.0); double fMyHalfWidth(0.0); - rCombination.getColorAndOffsetAndHalfWidth(0, aMyColor, fMyOffset, fMyHalfWidth); + const basegfx::B2DPoint aLeft(rOrigin + (rPerpendX * (fMyOffset - fMyHalfWidth))); + const basegfx::B2DPoint aRight(rOrigin + (rPerpendX * (fMyOffset + fMyHalfWidth))); + std::vector< CutSet > aCutSets; - if(0xff != aMyColor.GetTransparency()) + for(const auto& rStyleCandidate : rStyleVector) { - const basegfx::B2DPoint aLeft(rOrigin + (rPerpendX * (fMyOffset - fMyHalfWidth))); - const basegfx::B2DPoint aRight(rOrigin + (rPerpendX * (fMyOffset + fMyHalfWidth))); - std::vector< CutSet > aCutSets; + const basegfx::B2DVector aOtherPerpend(basegfx::getNormalizedPerpendicular(rStyleCandidate.getB2DVector())); + const size_t nOffsetB(rStyleCandidate.size()); - for(const auto& rStyleCandidate : rStyleVector) + for(size_t other(0); other < nOffsetB; other++) { - const basegfx::B2DVector aOtherPerpend(basegfx::getNormalizedPerpendicular(rStyleCandidate.getB2DVector())); - const size_t nOffsetB(rStyleCandidate.size()); + Color aOtherColor; double fOtherOffset(0.0); double fOtherHalfWidth(0.0); + rStyleCandidate.getColorAndOffsetAndHalfWidth(other, aOtherColor, fOtherOffset, fOtherHalfWidth); - for(size_t other(0); other < nOffsetB; other++) + if(0xff != aOtherColor.GetTransparency()) { - Color aOtherColor; double fOtherOffset(0.0); double fOtherHalfWidth(0.0); - rStyleCandidate.getColorAndOffsetAndHalfWidth(other, aOtherColor, fOtherOffset, fOtherHalfWidth); - - if(0xff != aOtherColor.GetTransparency()) - { - const basegfx::B2DPoint aOtherLeft(rOrigin + (aOtherPerpend * (fOtherOffset - fOtherHalfWidth))); - const basegfx::B2DPoint aOtherRight(rOrigin + (aOtherPerpend * (fOtherOffset + fOtherHalfWidth))); + const basegfx::B2DPoint aOtherLeft(rOrigin + (aOtherPerpend * (fOtherOffset - fOtherHalfWidth))); + const basegfx::B2DPoint aOtherRight(rOrigin + (aOtherPerpend * (fOtherOffset + fOtherHalfWidth))); - CutSet aNewCutSet; - getCutSet(aNewCutSet, aLeft, aRight, rCombination.getB2DVector(), aOtherLeft, aOtherRight, rStyleCandidate.getB2DVector()); - aCutSets.push_back(aNewCutSet); - } + CutSet aNewCutSet; + getCutSet(aNewCutSet, aLeft, aRight, rCombination.getB2DVector(), aOtherLeft, aOtherRight, rStyleCandidate.getB2DVector()); + aCutSets.push_back(aNewCutSet); } } + } - if(!aCutSets.empty()) + if(!aCutSets.empty()) + { + CutSet aCutSet(aCutSets[0]); + const size_t nNumCutSets(aCutSets.size()); + + if(1 != nNumCutSets) { - CutSet aCutSet(aCutSets[0]); - const size_t nNumCutSets(aCutSets.size()); + double fCutSet(aCutSet.getSum()); - if(1 != nNumCutSets) + for(size_t a(1); a < nNumCutSets; a++) { - double fCutSet(aCutSet.getSum()); + const CutSet& rCandidate(aCutSets[a]); + const double fCandidate(rCandidate.getSum()); - for(size_t a(1); a < nNumCutSets; a++) + if(basegfx::fTools::equalZero(fCandidate - fCutSet)) { - const CutSet& rCandidate(aCutSets[a]); - const double fCandidate(rCandidate.getSum()); - - if(basegfx::fTools::equalZero(fCandidate - fCutSet)) - { - // both have equal center point, use medium cut - const double fNewOLML(std::max(std::min(rCandidate.mfOLML, rCandidate.mfORML), std::min(aCutSet.mfOLML, aCutSet.mfORML))); - const double fNewORML(std::min(std::max(rCandidate.mfOLML, rCandidate.mfORML), std::max(aCutSet.mfOLML, aCutSet.mfORML))); - const double fNewOLMR(std::max(std::min(rCandidate.mfOLMR, rCandidate.mfORMR), std::min(aCutSet.mfOLMR, aCutSet.mfORMR))); - const double fNewORMR(std::min(std::max(rCandidate.mfOLMR, rCandidate.mfORMR), std::max(aCutSet.mfOLMR, aCutSet.mfORMR))); - aCutSet.mfOLML = fNewOLML; - aCutSet.mfORML = fNewORML; - aCutSet.mfOLMR = fNewOLMR; - aCutSet.mfORMR = fNewORMR; - fCutSet = aCutSet.getSum(); - } - else if(fCandidate < fCutSet) - { - // get minimum - fCutSet = fCandidate; - aCutSet = rCandidate; - } + // both have equal center point, use medium cut + const double fNewOLML(std::max(std::min(rCandidate.mfOLML, rCandidate.mfORML), std::min(aCutSet.mfOLML, aCutSet.mfORML))); + const double fNewORML(std::min(std::max(rCandidate.mfOLML, rCandidate.mfORML), std::max(aCutSet.mfOLML, aCutSet.mfORML))); + const double fNewOLMR(std::max(std::min(rCandidate.mfOLMR, rCandidate.mfORMR), std::min(aCutSet.mfOLMR, aCutSet.mfORMR))); + const double fNewORMR(std::min(std::max(rCandidate.mfOLMR, rCandidate.mfORMR), std::max(aCutSet.mfOLMR, aCutSet.mfORMR))); + aCutSet.mfOLML = fNewOLML; + aCutSet.mfORML = fNewORML; + aCutSet.mfOLMR = fNewOLMR; + aCutSet.mfORMR = fNewORMR; + fCutSet = aCutSet.getSum(); + } + else if(fCandidate < fCutSet) + { + // get minimum + fCutSet = fCandidate; + aCutSet = rCandidate; } } + } - ExtendSet& rExt(rExtendSet[0]); + ExtendSet& rExt(rExtendSet[0]); - rExt.mfExtLeft = std::min(aCutSet.mfOLML, aCutSet.mfORML); - rExt.mfExtRight = std::min(aCutSet.mfOLMR, aCutSet.mfORMR); - } + rExt.mfExtLeft = std::min(aCutSet.mfOLML, aCutSet.mfORML); + rExt.mfExtRight = std::min(aCutSet.mfOLMR, aCutSet.mfORMR); } } - else + } + else + { + size_t nVisEdgeUp(0); + size_t nVisEdgeDn(0); + + for(size_t my(0); my < nOffsetA; my++) { - size_t nVisEdgeUp(0); - size_t nVisEdgeDn(0); + Color aMyColor; double fMyOffset(0.0); double fMyHalfWidth(0.0); + rCombination.getColorAndOffsetAndHalfWidth(my, aMyColor, fMyOffset, fMyHalfWidth); - for(size_t my(0); my < nOffsetA; my++) + if(0xff != aMyColor.GetTransparency()) { - Color aMyColor; double fMyOffset(0.0); double fMyHalfWidth(0.0); - rCombination.getColorAndOffsetAndHalfWidth(my, aMyColor, fMyOffset, fMyHalfWidth); + const basegfx::B2DPoint aLeft(rOrigin + (rPerpendX * (fMyOffset - fMyHalfWidth))); + const basegfx::B2DPoint aRight(rOrigin + (rPerpendX * (fMyOffset + fMyHalfWidth))); + const bool bUpper(my <= (nOffsetA >> 1)); + const StyleVectorCombination& rStyleCandidate(bUpper ? rStyleVector.front() : rStyleVector.back()); + const basegfx::B2DVector aOtherPerpend(basegfx::getNormalizedPerpendicular(rStyleCandidate.getB2DVector())); + const size_t nOffsetB(rStyleCandidate.size()); + std::vector< CutSet > aCutSets; - if(0xff != aMyColor.GetTransparency()) + for(size_t other(0); other < nOffsetB; other++) { - const basegfx::B2DPoint aLeft(rOrigin + (rPerpendX * (fMyOffset - fMyHalfWidth))); - const basegfx::B2DPoint aRight(rOrigin + (rPerpendX * (fMyOffset + fMyHalfWidth))); - const bool bUpper(my <= (nOffsetA >> 1)); - const StyleVectorCombination& rStyleCandidate(bUpper ? rStyleVector.front() : rStyleVector.back()); - const basegfx::B2DVector aOtherPerpend(basegfx::getNormalizedPerpendicular(rStyleCandidate.getB2DVector())); - const size_t nOffsetB(rStyleCandidate.size()); - std::vector< CutSet > aCutSets; - - for(size_t other(0); other < nOffsetB; other++) - { - Color aOtherColor; double fOtherOffset(0.0); double fOtherHalfWidth(0.0); - rStyleCandidate.getColorAndOffsetAndHalfWidth(other, aOtherColor, fOtherOffset, fOtherHalfWidth); - - if(0xff != aOtherColor.GetTransparency()) - { - const basegfx::B2DPoint aOtherLeft(rOrigin + (aOtherPerpend * (fOtherOffset - fOtherHalfWidth))); - const basegfx::B2DPoint aOtherRight(rOrigin + (aOtherPerpend * (fOtherOffset + fOtherHalfWidth))); - CutSet aCutSet; - getCutSet(aCutSet, aLeft, aRight, rCombination.getB2DVector(), aOtherLeft, aOtherRight, rStyleCandidate.getB2DVector()); - aCutSets.push_back(aCutSet); - } - } + Color aOtherColor; double fOtherOffset(0.0); double fOtherHalfWidth(0.0); + rStyleCandidate.getColorAndOffsetAndHalfWidth(other, aOtherColor, fOtherOffset, fOtherHalfWidth); - if(!aCutSets.empty()) + if(0xff != aOtherColor.GetTransparency()) { - // sort: min to start, max to end - std::sort(aCutSets.begin(), aCutSets.end()); - const bool bOtherUpper(rStyleCandidate.getAngle() > F_PI); - - // check if we need min or max - // bUpper bOtherUpper MinMax - // t t max - // t f min - // f f max - // f t min - const bool bMax(bUpper == bOtherUpper); - size_t nBaseIndex(0); - const size_t nNumCutSets(aCutSets.size()); - - if(bMax) - { - // access at end - nBaseIndex = nNumCutSets - 1 - (bUpper ? nVisEdgeUp : nVisEdgeDn); - } - else - { - // access at start - nBaseIndex = bUpper ? nVisEdgeUp : nVisEdgeDn; - } - - const size_t nSecuredIndex(std::min(nNumCutSets - 1, std::max(nBaseIndex, static_cast< size_t >(0)))); - const CutSet& rCutSet(aCutSets[nSecuredIndex]); - ExtendSet& rExt(rExtendSet[my]); - - rExt.mfExtLeft = std::min(rCutSet.mfOLML, rCutSet.mfORML); - rExt.mfExtRight = std::min(rCutSet.mfOLMR, rCutSet.mfORMR); + const basegfx::B2DPoint aOtherLeft(rOrigin + (aOtherPerpend * (fOtherOffset - fOtherHalfWidth))); + const basegfx::B2DPoint aOtherRight(rOrigin + (aOtherPerpend * (fOtherOffset + fOtherHalfWidth))); + CutSet aCutSet; + getCutSet(aCutSet, aLeft, aRight, rCombination.getB2DVector(), aOtherLeft, aOtherRight, rStyleCandidate.getB2DVector()); + aCutSets.push_back(aCutSet); } + } + + if(!aCutSets.empty()) + { + // sort: min to start, max to end + std::sort(aCutSets.begin(), aCutSets.end()); + const bool bOtherUpper(rStyleCandidate.getAngle() > F_PI); + + // check if we need min or max + // bUpper bOtherUpper MinMax + // t t max + // t f min + // f f max + // f t min + const bool bMax(bUpper == bOtherUpper); + size_t nBaseIndex(0); + const size_t nNumCutSets(aCutSets.size()); - if(bUpper) + if(bMax) { - nVisEdgeUp++; + // access at end + nBaseIndex = nNumCutSets - 1 - (bUpper ? nVisEdgeUp : nVisEdgeDn); } else { - nVisEdgeDn++; + // access at start + nBaseIndex = bUpper ? nVisEdgeUp : nVisEdgeDn; } + + const size_t nSecuredIndex(std::min(nNumCutSets - 1, std::max(nBaseIndex, static_cast< size_t >(0)))); + const CutSet& rCutSet(aCutSets[nSecuredIndex]); + ExtendSet& rExt(rExtendSet[my]); + + rExt.mfExtLeft = std::min(rCutSet.mfOLML, rCutSet.mfORML); + rExt.mfExtRight = std::min(rCutSet.mfOLMR, rCutSet.mfORMR); + } + + if(bUpper) + { + nVisEdgeUp++; + } + else + { + nVisEdgeDn++; } } } diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 8d12cb83876e..dd02d5348cc0 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -55,76 +55,76 @@ namespace drawinglayer::primitive2d bScaleContent = true; } #endif - if(GraphicType::NONE != aGraphic.GetType()) + if(GraphicType::NONE == aGraphic.GetType()) + return; + + const GraphicObject aGraphicObject(aGraphic); + const GraphicAttr aGraphicAttr; + + if(bScaleContent) { - const GraphicObject aGraphicObject(aGraphic); - const GraphicAttr aGraphicAttr; + // get transformation atoms + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getObjectTransform().decompose(aScale, aTranslate, fRotate, fShearX); - if(bScaleContent) + // get PrefSize from the graphic in 100th mm + Size aPrefSize(aGraphic.GetPrefSize()); + + if(MapUnit::MapPixel == aGraphic.GetPrefMapMode().GetMapUnit()) { - // get transformation atoms - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - getObjectTransform().decompose(aScale, aTranslate, fRotate, fShearX); - - // get PrefSize from the graphic in 100th mm - Size aPrefSize(aGraphic.GetPrefSize()); - - if(MapUnit::MapPixel == aGraphic.GetPrefMapMode().GetMapUnit()) - { - aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MapMode(MapUnit::Map100thMM)); - } - else - { - aPrefSize = OutputDevice::LogicToLogic(aPrefSize, aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)); - } - - const double fOffsetX((aScale.getX() - aPrefSize.getWidth()) / 2.0); - const double fOffsetY((aScale.getY() - aPrefSize.getHeight()) / 2.0); - - if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0)) - { - // if content fits into frame, create it - basegfx::B2DHomMatrix aInnerObjectMatrix(basegfx::utils::createScaleTranslateB2DHomMatrix( - aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY)); - aInnerObjectMatrix = basegfx::utils::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) - * aInnerObjectMatrix; - - const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( - new drawinglayer::primitive2d::GraphicPrimitive2D( - aInnerObjectMatrix, - aGraphicObject, - aGraphicAttr)); - rContainer.push_back(aGraphicPrimitive); - } + aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MapMode(MapUnit::Map100thMM)); } else { - // create graphic primitive for content + aPrefSize = OutputDevice::LogicToLogic(aPrefSize, aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)); + } + + const double fOffsetX((aScale.getX() - aPrefSize.getWidth()) / 2.0); + const double fOffsetY((aScale.getY() - aPrefSize.getHeight()) / 2.0); + + if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0)) + { + // if content fits into frame, create it + basegfx::B2DHomMatrix aInnerObjectMatrix(basegfx::utils::createScaleTranslateB2DHomMatrix( + aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY)); + aInnerObjectMatrix = basegfx::utils::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) + * aInnerObjectMatrix; + const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( new drawinglayer::primitive2d::GraphicPrimitive2D( - getObjectTransform(), + aInnerObjectMatrix, aGraphicObject, aGraphicAttr)); rContainer.push_back(aGraphicPrimitive); } + } + else + { + // create graphic primitive for content + const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( + new drawinglayer::primitive2d::GraphicPrimitive2D( + getObjectTransform(), + aGraphicObject, + aGraphicAttr)); + rContainer.push_back(aGraphicPrimitive); + } - // a standard gray outline is created for scaled content - if(bScaleContent) - { - const svtools::ColorConfig aColorConfig; - const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES)); - - if(aColor.bIsVisible) - { - basegfx::B2DPolygon aOutline(basegfx::utils::createUnitPolygon()); - const Color aVclColor(aColor.nColor); - aOutline.transform(getObjectTransform()); - const drawinglayer::primitive2d::Primitive2DReference xOutline( - new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aVclColor.getBColor())); - rContainer.push_back(xOutline); - } - } + // a standard gray outline is created for scaled content + if(!bScaleContent) + return; + + const svtools::ColorConfig aColorConfig; + const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES)); + + if(aColor.bIsVisible) + { + basegfx::B2DPolygon aOutline(basegfx::utils::createUnitPolygon()); + const Color aVclColor(aColor.nColor); + aOutline.transform(getObjectTransform()); + const drawinglayer::primitive2d::Primitive2DReference xOutline( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aVclColor.getBColor())); + rContainer.push_back(xOutline); } } diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index dbed60b8a520..55dbf646210e 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -76,22 +76,22 @@ namespace sdr::properties // after this method -> memory leak (!) DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (!)"); - if(pNewStyleSheet) + if(!pNewStyleSheet) + return; + + // local remember + mpStyleSheet = pNewStyleSheet; + + if(HasSfxItemSet()) { - // local remember - mpStyleSheet = pNewStyleSheet; + // register as listener + StartListening(*pNewStyleSheet->GetPool()); + StartListening(*pNewStyleSheet); - if(HasSfxItemSet()) + // only apply the following when we have an SfxItemSet already, else + if(GetStyleSheet()) { - // register as listener - StartListening(*pNewStyleSheet->GetPool()); - StartListening(*pNewStyleSheet); - - // only apply the following when we have an SfxItemSet already, else - if(GetStyleSheet()) - { - ImpSetParentAtSfxItemSet(bDontRemoveHardAttr); - } + ImpSetParentAtSfxItemSet(bDontRemoveHardAttr); } } } @@ -198,22 +198,22 @@ namespace sdr::properties } } - if(pTargetStyleSheet) + if(!pTargetStyleSheet) + return; + + if(HasSfxItemSet()) { - if(HasSfxItemSet()) - { - // The SfxItemSet has been cloned and exists, - // we can directly set the SfxStyleSheet at it - ImpAddStyleSheet(pTargetStyleSheet, true); - } - else - { - // No SfxItemSet exists yet (there is none in - // the source, so none was cloned). Remember the - // SfxStyleSheet to set it when the SfxItemSet - // got constructed on-demand - mpStyleSheet = pTargetStyleSheet; - } + // The SfxItemSet has been cloned and exists, + // we can directly set the SfxStyleSheet at it + ImpAddStyleSheet(pTargetStyleSheet, true); + } + else + { + // No SfxItemSet exists yet (there is none in + // the source, so none was cloned). Remember the + // SfxStyleSheet to set it when the SfxItemSet + // got constructed on-demand + mpStyleSheet = pTargetStyleSheet; } } diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index 2110ece186b9..fb0c4c59369f 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -47,41 +47,41 @@ namespace sdr::properties DefaultProperties::DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj) : BaseProperties(rObj) { - if(rProps.mpItemSet) + if(!rProps.mpItemSet) + return; + + // Clone may be to another model and thus another ItemPool. + // SfxItemSet supports that thus we are able to Clone all + // SfxItemState::SET items to the target pool. + mpItemSet = rProps.mpItemSet->Clone( + true, + &rObj.getSdrModelFromSdrObject().GetItemPool()); + + // React on ModelChange: If metric has changed, scale items. + // As seen above, clone is supported, but scale is not included, + // thus: TTTT maybe add scale to SfxItemSet::Clone() (?) + // tdf#117707 correct ModelChange detection + const bool bModelChange(&rObj.getSdrModelFromSdrObject() != &rProps.GetSdrObject().getSdrModelFromSdrObject()); + + if(bModelChange) { - // Clone may be to another model and thus another ItemPool. - // SfxItemSet supports that thus we are able to Clone all - // SfxItemState::SET items to the target pool. - mpItemSet = rProps.mpItemSet->Clone( - true, - &rObj.getSdrModelFromSdrObject().GetItemPool()); - - // React on ModelChange: If metric has changed, scale items. - // As seen above, clone is supported, but scale is not included, - // thus: TTTT maybe add scale to SfxItemSet::Clone() (?) - // tdf#117707 correct ModelChange detection - const bool bModelChange(&rObj.getSdrModelFromSdrObject() != &rProps.GetSdrObject().getSdrModelFromSdrObject()); - - if(bModelChange) - { - const MapUnit aOldUnit(rProps.GetSdrObject().getSdrModelFromSdrObject().GetScaleUnit()); - const MapUnit aNewUnit(rObj.getSdrModelFromSdrObject().GetScaleUnit()); - const bool bScaleUnitChanged(aNewUnit != aOldUnit); + const MapUnit aOldUnit(rProps.GetSdrObject().getSdrModelFromSdrObject().GetScaleUnit()); + const MapUnit aNewUnit(rObj.getSdrModelFromSdrObject().GetScaleUnit()); + const bool bScaleUnitChanged(aNewUnit != aOldUnit); - if(bScaleUnitChanged) - { - const Fraction aMetricFactor(GetMapFactor(aOldUnit, aNewUnit).X()); + if(bScaleUnitChanged) + { + const Fraction aMetricFactor(GetMapFactor(aOldUnit, aNewUnit).X()); - ScaleItemSet(*mpItemSet, aMetricFactor); - } + ScaleItemSet(*mpItemSet, aMetricFactor); } + } - // do not keep parent info, this may be changed by later constructors. - // This class just copies the ItemSet, ignore parent. - if(mpItemSet && mpItemSet->GetParent()) - { - mpItemSet->SetParent(nullptr); - } + // do not keep parent info, this may be changed by later constructors. + // This class just copies the ItemSet, ignore parent. + if(mpItemSet && mpItemSet->GetParent()) + { + mpItemSet->SetParent(nullptr); } } diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx index baf3a48d3d74..95a9e9e433ce 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -164,26 +164,26 @@ namespace sdr::properties const bool bFillBitmap = rItemSet.GetItemState(XATTR_FILLBITMAP, false) == SfxItemState::SET; const bool bFillGradient = rItemSet.GetItemState(XATTR_FILLGRADIENT, false) == SfxItemState::SET; const bool bFillHatch = rItemSet.GetItemState(XATTR_FILLHATCH, false) == SfxItemState::SET; - if( bFillBitmap || bFillGradient || bFillHatch ) + if( !(bFillBitmap || bFillGradient || bFillHatch) ) + return; + + const XFillStyleItem* pFillStyleItem = rItemSet.GetItem(XATTR_FILLSTYLE); + if( !pFillStyleItem ) + return; + + if( bFillBitmap && (pFillStyleItem->GetValue() != drawing::FillStyle_BITMAP) ) { - const XFillStyleItem* pFillStyleItem = rItemSet.GetItem(XATTR_FILLSTYLE); - if( pFillStyleItem ) - { - if( bFillBitmap && (pFillStyleItem->GetValue() != drawing::FillStyle_BITMAP) ) - { - rItemSet.ClearItem( XATTR_FILLBITMAP ); - } - - if( bFillGradient && (pFillStyleItem->GetValue() != drawing::FillStyle_GRADIENT) ) - { - rItemSet.ClearItem( XATTR_FILLGRADIENT ); - } - - if( bFillHatch && (pFillStyleItem->GetValue() != drawing::FillStyle_HATCH) ) - { - rItemSet.ClearItem( XATTR_FILLHATCH ); - } - } + rItemSet.ClearItem( XATTR_FILLBITMAP ); + } + + if( bFillGradient && (pFillStyleItem->GetValue() != drawing::FillStyle_GRADIENT) ) + { + rItemSet.ClearItem( XATTR_FILLGRADIENT ); + } + + if( bFillHatch && (pFillStyleItem->GetValue() != drawing::FillStyle_HATCH) ) + { + rItemSet.ClearItem( XATTR_FILLHATCH ); } } diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index e2cedd10f983..8a90de5c848b 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -201,28 +201,28 @@ namespace sdr::properties AttributeProperties::ItemChange( nWhich, pNewItem ); // #i25616# - if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange()) - { - const sal_Int32 nNewLineWidth(GetItem(XATTR_LINEWIDTH).GetValue()); - const sal_Int32 nDifference((nNewLineWidth - nOldLineWidth) / 2); + if(!(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())) + return; - if(nDifference) - { - const bool bLineVisible(drawing::LineStyle_NONE != GetItem(XATTR_LINESTYLE).GetValue()); + const sal_Int32 nNewLineWidth(GetItem(XATTR_LINEWIDTH).GetValue()); + const sal_Int32 nDifference((nNewLineWidth - nOldLineWidth) / 2); - if(bLineVisible) - { - const sal_Int32 nLeftDist(GetItem(SDRATTR_TEXT_LEFTDIST).GetValue()); - const sal_Int32 nRightDist(GetItem(SDRATTR_TEXT_RIGHTDIST).GetValue()); - const sal_Int32 nUpperDist(GetItem(SDRATTR_TEXT_UPPERDIST).GetValue()); - const sal_Int32 nLowerDist(GetItem(SDRATTR_TEXT_LOWERDIST).GetValue()); - - SetObjectItemDirect(makeSdrTextLeftDistItem(nLeftDist + nDifference)); - SetObjectItemDirect(makeSdrTextRightDistItem(nRightDist + nDifference)); - SetObjectItemDirect(makeSdrTextUpperDistItem(nUpperDist + nDifference)); - SetObjectItemDirect(makeSdrTextLowerDistItem(nLowerDist + nDifference)); - } - } + if(!nDifference) + return; + + const bool bLineVisible(drawing::LineStyle_NONE != GetItem(XATTR_LINESTYLE).GetValue()); + + if(bLineVisible) + { + const sal_Int32 nLeftDist(GetItem(SDRATTR_TEXT_LEFTDIST).GetValue()); + const sal_Int32 nRightDist(GetItem(SDRATTR_TEXT_RIGHTDIST).GetValue()); + const sal_Int32 nUpperDist(GetItem(SDRATTR_TEXT_UPPERDIST).GetValue()); + const sal_Int32 nLowerDist(GetItem(SDRATTR_TEXT_LOWERDIST).GetValue()); + + SetObjectItemDirect(makeSdrTextLeftDistItem(nLeftDist + nDifference)); + SetObjectItemDirect(makeSdrTextRightDistItem(nRightDist + nDifference)); + SetObjectItemDirect(makeSdrTextUpperDistItem(nUpperDist + nDifference)); + SetObjectItemDirect(makeSdrTextLowerDistItem(nLowerDist + nDifference)); } } @@ -392,133 +392,133 @@ namespace sdr::properties // now the standard TextProperties stuff SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); - if(!rObj.IsTextEditActive() && !rObj.IsLinkedText()) + if(rObj.IsTextEditActive() || rObj.IsLinkedText()) + return; + + std::unique_ptr<Outliner> pOutliner = SdrMakeOutliner(OutlinerMode::OutlineObject, rObj.getSdrModelFromSdrObject()); + const svx::ITextProvider& rTextProvider(getTextProvider()); + sal_Int32 nText = rTextProvider.getTextCount(); + while (nText--) { - std::unique_ptr<Outliner> pOutliner = SdrMakeOutliner(OutlinerMode::OutlineObject, rObj.getSdrModelFromSdrObject()); - const svx::ITextProvider& rTextProvider(getTextProvider()); - sal_Int32 nText = rTextProvider.getTextCount(); - while (nText--) - { - SdrText* pText = rTextProvider.getText( nText ); + SdrText* pText = rTextProvider.getText( nText ); - OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr; - if( !pParaObj ) - continue; + OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr; + if( !pParaObj ) + continue; - pOutliner->SetText(*pParaObj); + pOutliner->SetText(*pParaObj); - sal_Int32 nParaCount(pOutliner->GetParagraphCount()); + sal_Int32 nParaCount(pOutliner->GetParagraphCount()); - if(nParaCount) + if(nParaCount) + { + bool bBurnIn(false); + + for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++) { - bool bBurnIn(false); + SfxStyleSheet* pSheet = pOutliner->GetStyleSheet(nPara); - for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++) + if(pSheet) { - SfxStyleSheet* pSheet = pOutliner->GetStyleSheet(nPara); - - if(pSheet) + SfxItemSet aParaSet(pOutliner->GetParaAttribs(nPara)); + SfxItemSet aSet(*aParaSet.GetPool()); + aSet.Put(pSheet->GetItemSet()); + + /** the next code handles a special case for paragraphs that contain a + url field. The color for URL fields is either the system color for + urls or the char color attribute that formats the portion in which the + url field is contained. + When we set a char color attribute to the paragraphs item set from the + styles item set, we would have this char color attribute as an attribute + that is spanned over the complete paragraph after xml import due to some + problems in the xml import (using a XCursor on import so it does not know + the paragraphs and can't set char attributes to paragraphs ). + + To avoid this, as soon as we try to set a char color attribute from the style + we + 1. check if we have at least one url field in this paragraph + 2. if we found at least one url field, we span the char color attribute over + all portions that are not url fields and remove the char color attribute + from the paragraphs item set + */ + + bool bHasURL(false); + + if(aSet.GetItemState(EE_CHAR_COLOR) == SfxItemState::SET) { - SfxItemSet aParaSet(pOutliner->GetParaAttribs(nPara)); - SfxItemSet aSet(*aParaSet.GetPool()); - aSet.Put(pSheet->GetItemSet()); - - /** the next code handles a special case for paragraphs that contain a - url field. The color for URL fields is either the system color for - urls or the char color attribute that formats the portion in which the - url field is contained. - When we set a char color attribute to the paragraphs item set from the - styles item set, we would have this char color attribute as an attribute - that is spanned over the complete paragraph after xml import due to some - problems in the xml import (using a XCursor on import so it does not know - the paragraphs and can't set char attributes to paragraphs ). - - To avoid this, as soon as we try to set a char color attribute from the style - we - 1. check if we have at least one url field in this paragraph - 2. if we found at least one url field, we span the char color attribute over - all portions that are not url fields and remove the char color attribute - from the paragraphs item set - */ - - bool bHasURL(false); - - if(aSet.GetItemState(EE_CHAR_COLOR) == SfxItemState::SET) - { - EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine())); - std::vector<EECharAttrib> aAttribs; - pEditEngine->GetCharAttribs(nPara, aAttribs); + EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine())); + std::vector<EECharAttrib> aAttribs; + pEditEngine->GetCharAttribs(nPara, aAttribs); - for(const auto& rAttrib : aAttribs) + for(const auto& rAttrib : aAttribs) + { + if(rAttrib.pAttr && EE_FEATURE_FIELD == rAttrib.pAttr->Which()) { - if(rAttrib.pAttr && EE_FEATURE_FIELD == rAttrib.pAttr->Which()) + const SvxFieldItem* pFieldItem = static_cast<const SvxFieldItem*>(rAttrib.pAttr); + + if(pFieldItem) { - const SvxFieldItem* pFieldItem = static_cast<const SvxFieldItem*>(rAttrib.pAttr); + const SvxFieldData* pData = pFieldItem->GetField(); - if(pFieldItem) + if(dynamic_cast<const SvxURLField*>( pData)) { - const SvxFieldData* pData = pFieldItem->GetField(); - - if(dynamic_cast<const SvxURLField*>( pData)) - { - bHasURL = true; - break; - } + bHasURL = true; + break; } } } + } - if(bHasURL) - { - SfxItemSet aColorSet(*aSet.GetPool(), svl::Items<EE_CHAR_COLOR, EE_CHAR_COLOR>{} ); - aColorSet.Put(aSet, false); + if(bHasURL) + { + SfxItemSet aColorSet(*aSet.GetPool(), svl::Items<EE_CHAR_COLOR, EE_CHAR_COLOR>{} ); + aColorSet.Put(aSet, false); - ESelection aSel(nPara, 0); + ESelection aSel(nPara, 0); - for(const auto& rAttrib : aAttribs) + for(const auto& rAttrib : aAttribs) + { + if(EE_FEATURE_FIELD == rAttrib.pAttr->Which()) { - if(EE_FEATURE_FIELD == rAttrib.pAttr->Which()) - { - aSel.nEndPos = rAttrib.nStart; + aSel.nEndPos = rAttrib.nStart; - if(aSel.nStartPos != aSel.nEndPos) - pEditEngine->QuickSetAttribs(aColorSet, aSel); + if(aSel.nStartPos != aSel.nEndPos) + pEditEngine->QuickSetAttribs(aColorSet, aSel); - aSel.nStartPos = rAttrib.nEnd; - } + aSel.nStartPos = rAttrib.nEnd; } + } - aSel.nEndPos = pEditEngine->GetTextLen(nPara); + aSel.nEndPos = pEditEngine->GetTextLen(nPara); - if(aSel.nStartPos != aSel.nEndPos) - { - pEditEngine->QuickSetAttribs( aColorSet, aSel ); - } + if(aSel.nStartPos != aSel.nEndPos) + { + pEditEngine->QuickSetAttribs( aColorSet, aSel ); } - } - aSet.Put(aParaSet, false); + } - if(bHasURL) - { - aSet.ClearItem(EE_CHAR_COLOR); - } + aSet.Put(aParaSet, false); - pOutliner->SetParaAttribs(nPara, aSet); - bBurnIn = true; // #i51163# Flag was set wrong + if(bHasURL) + { + aSet.ClearItem(EE_CHAR_COLOR); } - } - if(bBurnIn) - { - std::unique_ptr<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount); - rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp),pText); + pOutliner->SetParaAttribs(nPara, aSet); + bBurnIn = true; // #i51163# Flag was set wrong } } - pOutliner->Clear(); + if(bBurnIn) + { + std::unique_ptr<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount); + rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp),pText); + } } + + pOutliner->Clear(); } } @@ -535,66 +535,66 @@ namespace sdr::properties AttributeProperties::Notify(rBC, rHint); SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); - if(rObj.HasText()) + if(!rObj.HasText()) + return; + + const svx::ITextProvider& rTextProvider(getTextProvider()); + if(dynamic_cast<const SfxStyleSheet *>(&rBC) != nullptr) { - const svx::ITextProvider& rTextProvider(getTextProvider()); - if(dynamic_cast<const SfxStyleSheet *>(&rBC) != nullptr) + SfxHintId nId(rHint.GetId()); + + if(SfxHintId::DataChanged == nId) { - SfxHintId nId(rHint.GetId()); + sal_Int32 nText = rTextProvider.getTextCount(); + while (nText--) + { + OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject(); + if( pParaObj ) + pParaObj->ClearPortionInfo(); + } + rObj.SetTextSizeDirty(); - if(SfxHintId::DataChanged == nId) + if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight()) { - sal_Int32 nText = rTextProvider.getTextCount(); - while (nText--) - { - OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject(); - if( pParaObj ) - pParaObj->ClearPortionInfo(); - } - rObj.SetTextSizeDirty(); + // here only repaint wanted + rObj.ActionChanged(); + //rObj.BroadcastObjectChange(); + } - if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight()) - { - // here only repaint wanted - rObj.ActionChanged(); - //rObj.BroadcastObjectChange(); - } + // #i101556# content of StyleSheet has changed -> new version + maVersion++; + } - // #i101556# content of StyleSheet has changed -> new version - maVersion++; + if(SfxHintId::Dying == nId) + { + sal_Int32 nText = rTextProvider.getTextCount(); + while (nText--) + { + OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject(); + if( pParaObj ) + pParaObj->ClearPortionInfo(); } + } + } + else if(dynamic_cast<const SfxStyleSheetBasePool *>(&rBC) != nullptr) + { + const SfxStyleSheetModifiedHint* pExtendedHint = dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint); - if(SfxHintId::Dying == nId) + if(pExtendedHint + && SfxHintId::StyleSheetModified == pExtendedHint->GetId()) + { + const OUString& aOldName(pExtendedHint->GetOldName()); + OUString aNewName(pExtendedHint->GetStyleSheet()->GetName()); + SfxStyleFamily eFamily = pExtendedHint->GetStyleSheet()->GetFamily(); + + if(aOldName != aNewName) { sal_Int32 nText = rTextProvider.getTextCount(); while (nText--) { OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject(); if( pParaObj ) - pParaObj->ClearPortionInfo(); - } - } - } - else if(dynamic_cast<const SfxStyleSheetBasePool *>(&rBC) != nullptr) - { - const SfxStyleSheetModifiedHint* pExtendedHint = dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint); - - if(pExtendedHint - && SfxHintId::StyleSheetModified == pExtendedHint->GetId()) - { - const OUString& aOldName(pExtendedHint->GetOldName()); - OUString aNewName(pExtendedHint->GetStyleSheet()->GetName()); - SfxStyleFamily eFamily = pExtendedHint->GetStyleSheet()->GetFamily(); - - if(aOldName != aNewName) - { - sal_Int32 nText = rTextProvider.getTextCount(); - while (nText--) - { - OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject(); - if( pParaObj ) - pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName); - } + pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName); } } } |