diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-11-16 18:47:29 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-11-18 13:07:47 +0100 |
commit | 487ac20ecd73cf3d98071ba30cf5597d957017f7 (patch) | |
tree | 8777e0a1e7917ab054723327a59089b264c4a567 /sw/source/core/layout/flylay.cxx | |
parent | 059469926e359153b9b291790ef2df84fa63fda9 (diff) |
RotateFlyFrame3: add support for AutoContour
For transformed FlyFrames with no Border and no Padding it
would be nice to immediately start using AutoContour, added
first implementation to do so.
Added several conditions for AutoContour, need to
work on reaction on changes to these. Corrected
needed transform adaptions to Contour(s)
Change-Id: Ia3d7845fd5d50c8a413d592ae07ce2041ccc91b9
Diffstat (limited to 'sw/source/core/layout/flylay.cxx')
-rw-r--r-- | sw/source/core/layout/flylay.cxx | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 8a8c714ef351..8f6452b9b874 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -27,6 +27,7 @@ #include <hints.hxx> #include <sectfrm.hxx> #include <notxtfrm.hxx> +#include <txtfly.hxx> #include <svx/svdpage.hxx> #include <editeng/ulspitem.hxx> @@ -42,6 +43,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentDrawModelAccess.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> using namespace ::com::sun::star; @@ -87,6 +89,8 @@ void SwFlyFreeFrame::DestroyImpl() SwFlyFreeFrame::~SwFlyFreeFrame() { + // we are possibly in ContourCache, make sure we vanish + ::ClrContourCache(GetVirtDrawObj()); } // #i28701# @@ -268,6 +272,14 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } else { + // RotateFlyFrame3: Also need to clear ContourCache (if used), + // usually done in SwFlyFrame::NotifyDrawObj, but there relies on + // being in transform mode which is already resetted then + if(isTransformableSwFrame()) + { + ::ClrContourCache(GetVirtDrawObj()); + } + // reset transformations to show that they are not used mpTransformableSwFrame.reset(); } @@ -283,6 +295,65 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) #endif } +bool SwFlyFreeFrame::supportsAutoContour() const +{ + if(!isTransformableSwFrame()) + { + // support only when transformed, else there is no free space + return false; + } + + // Check for Borders. If we have Borders, do (currently) not support, + // since borders do not transform with the object. + // (Will need to be enhanced to take into account if we have Borders and if these + // transform with the object) + SwBorderAttrAccess aAccess(SwFrame::GetCache(), this); + const SwBorderAttrs &rAttrs(*aAccess.Get()); + + if(rAttrs.IsLine()) + { + return false; + } + + // Check for Padding. Do not support when padding is used, this will + // produce a covered space around the object (filled with fill defines) + const SfxPoolItem* pItem(nullptr); + + if(GetFormat() && SfxItemState::SET == GetFormat()->GetItemState(RES_BOX, false, &pItem)) + { + const SvxBoxItem& rBox = *static_cast< const SvxBoxItem* >(pItem); + + if(rBox.HasBorder(/*bTreatPaddingAsBorder*/true)) + { + return false; + } + } + + // check for Fill - if we have fill, it will fill the gaps and we will not + // support AutoContour + if(GetFormat() && GetFormat()->supportsFullDrawingLayerFillAttributeSet()) + { + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(GetFormat()->getSdrAllFillAttributesHelper()); + + if(aFillAttributes.get() && aFillAttributes->isUsed()) + { + return false; + } + } + else + { + const SvxBrushItem aBack(GetFormat()->makeBackgroundBrushItem()); + + if(aBack.isUsed()) + { + return false; + } + } + + // else, support + return true; +} + // RotateFlyFrame3 - Support for Transformations - outer frame basegfx::B2DHomMatrix SwFlyFreeFrame::getFrameAreaTransformation() const { |