[Libreoffice-commits] core.git: 5 commits - linguistic/source svx/source sw/inc sw/source
Michael Stahl
mstahl at redhat.com
Fri Apr 10 14:41:58 PDT 2015
linguistic/source/lngsvcmgr.cxx | 8
svx/source/sdr/contact/viewcontactofsdrpage.cxx | 3
sw/inc/IDocumentSettingAccess.hxx | 1
sw/source/core/doc/DocumentSettingManager.cxx | 6
sw/source/core/doc/notxtfrm.cxx | 3
sw/source/core/inc/DocumentSettingManager.hxx | 1
sw/source/core/inc/frame.hxx | 4
sw/source/core/inc/frmtool.hxx | 3
sw/source/core/layout/findfrm.cxx | 3
sw/source/core/layout/frmtool.cxx | 3
sw/source/core/layout/hffrm.cxx | 2
sw/source/core/layout/paintfrm.cxx | 439 ++++++++++++------------
sw/source/core/layout/trvlfrm.cxx | 4
sw/source/core/layout/wsfrm.cxx | 6
sw/source/filter/xml/xmlimp.cxx | 7
sw/source/uibase/uno/SwXDocumentSettings.cxx | 17
16 files changed, 287 insertions(+), 223 deletions(-)
New commits:
commit 10237e59c371a7b7198b2e3cb6a8701586fb287c
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Apr 10 23:35:06 2015 +0200
typos
Change-Id: I6420205d87c85c88137b8fc11fa16e313f2fcb35
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 5849864..f115e0f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4309,7 +4309,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
}
else
{
- // create new subsidiardy lines
+ // create new subsidiary lines
gProp.pSSubsLines = new SwSubsRects;
bSubsLineRectsCreated = true;
}
@@ -4323,7 +4323,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
}
else
{
- // create new special subsidiardy lines
+ // create new special subsidiary lines
gProp.pSSpecSubsLines = new SwSubsRects;
bSpecSubsLineRectsCreated = true;
}
commit c5cf8824a619401627f18abc7b3049551c71ac2a
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Apr 10 23:02:01 2015 +0200
tdf#86578: sw: fix rendering of legacy documents with fly achored at fly
Resurrect the special hack "lcl_SubtractFlys" that effectively paints
"lower" flys on top of "higher" flys, defying the z-ordering, if the
lower fly is *anchored* in or at the higher fly.
It turns out that this is not obvious to emulate in any other way that it
is currently implemented:
One idea would be to split up painting of the fly background from the
foreground, by creating 2 different view objects per fly as children
of the SdrPage when decomposing it in svx; but the problem is, they will
be ordered in z-order of the flys, and the point would be to paint the
backgrounds first and in a different order, call it "anchoring order".
What that order should be is hard to tell, there is a conflict between
the defined z-order and the flys that are part of one "anchoring
hierarchy" and should have their backgrounds re-ordered, because
entirely unrelated flys that could belong to different "anchoring
hierarchies" but overlap the first ones may result in a cyclic ordering.
Painting one "anchoring hierarchy" recursively would not get
z-order of flys from different anchoring hierarchies right.
Another difficulty is that heaven-layer backgrounds would need to be
painted before hell-layer ones.
Another aspect of the lcl_SubtractFlys is that it entirely ignores
drawing shapes; only Writer's own flys are handled.
Since none of the above makes much sense, we clearly want to
deprecate the lcl_SubtractFlys rendering.
Introduce a new compatibility flag "SubtractFlysAnchoredAtFlys" so that
the legacy rendering is only active for legacy documents, while new ones
remain free from its taint.
(regression from 6e61ecd09679a66060f932835622821d39e92f01)
Change-Id: I710fe79710b89c8f865ebb7162e14713aac6cc4a
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 6aa4392..ab907b2 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -75,6 +75,7 @@ enum class DocumentSettingId
// MS Word still wraps text around objects with less space than LO would.
SURROUND_TEXT_WRAP_SMALL,
PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
+ SUBTRACT_FLYS,
// COMPATIBILITY FLAGS END
BROWSE_MODE,
HTML_MODE,
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index ba6511c..83ba90f 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -81,6 +81,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbTabOverMargin(false),
mbSurroundTextWrapSmall(false),
mbPropLineSpacingShrinksFirstLine(true),
+ mbSubtractFlys(false),
mApplyParagraphMarkFormatToNumbering(false),
mbLastBrowseMode( false )
@@ -156,6 +157,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::TAB_OVER_MARGIN: return mbTabOverMargin;
case DocumentSettingId::SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall;
case DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE: return mbPropLineSpacingShrinksFirstLine;
+ case DocumentSettingId::SUBTRACT_FLYS: return mbSubtractFlys;
case DocumentSettingId::BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the SwViewShell has to be asked!
case DocumentSettingId::HTML_MODE: return mbHTMLMode;
@@ -322,6 +324,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
mbPropLineSpacingShrinksFirstLine = value;
break;
+ case DocumentSettingId::SUBTRACT_FLYS:
+ mbSubtractFlys = value;
+ break;
+
// COMPATIBILITY FLAGS END
case DocumentSettingId::BROWSE_MODE: //can be used temporary (load/save) when no SwViewShell is available
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 60b9585..4839366 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -186,7 +186,8 @@ static void lcl_ClearArea( const SwFrm &rFrm,
if ( rFrm.GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigRect, false ) )
{
- const bool bDone(::DrawFillAttributes(aFillAttributes, aOrigRect, rPtArea, rOut));
+ SwRegionRects const region(rPtArea);
+ const bool bDone(::DrawFillAttributes(aFillAttributes, aOrigRect, region, rOut));
if(!bDone)
{
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 4057b6f..853ad75 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -148,6 +148,7 @@ class DocumentSettingManager :
bool mbTabOverMargin;
bool mbSurroundTextWrapSmall;
bool mbPropLineSpacingShrinksFirstLine; // fdo#79602
+ bool mbSubtractFlys; // tdf#86578
bool mApplyParagraphMarkFormatToNumbering;
bool mbLastBrowseMode : 1;
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 8f8771b..f621acf 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -45,6 +45,7 @@ class GraphicObject;
class GraphicAttr;
class SwPageDesc;
class SwFrmFmts;
+class SwRegionRects;
#define FAR_AWAY LONG_MAX - 20000 // initial position of a Fly
#define BROWSE_HEIGHT 56700L * 10L // 10 Meters
@@ -68,7 +69,7 @@ void DrawGraphic(
bool DrawFillAttributes(
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
const SwRect& rOriginalLayoutRect,
- const SwRect& rPaintRect,
+ const SwRegionRects& rPaintRegion,
OutputDevice& rOut);
void paintGraphicUsingPrimitivesHelper(
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 5e84032..5849864 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -82,6 +82,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
#include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
@@ -1532,172 +1533,168 @@ static void lcl_ExtendLeftAndRight( SwRect& _rRect,
}
}
-//static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
-// const SwRect &rRect, SwRegionRects &rRegion )
-//{
-// const SwSortedObjs& rObjs = *pPage->GetSortedObjs();
-// const SwFlyFrm* pSelfFly = pFrm->IsInFly() ? pFrm->FindFlyFrm() : gProp.pSRetoucheFly2;
-// if ( !gProp.pSRetoucheFly )
-// gProp.pSRetoucheFly = gProp.pSRetoucheFly2;
-//
-// for ( sal_uInt16 j = 0; (j < rObjs.Count()) && !rRegion.empty(); ++j )
-// {
-// const SwAnchoredObject* pAnchoredObj = rObjs[j];
-// const SdrObject* pSdrObj = pAnchoredObj->GetDrawObj();
-//
-// // Do not consider invisible objects
-// if ( !pPage->GetFmt()->GetDoc()->IsVisibleLayerId( pSdrObj->GetLayer() ) )
-// continue;
-//
-// if ( !pAnchoredObj->ISA(SwFlyFrm) )
-// continue;
-//
-// const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
-//
-// if ( pSelfFly == pFly || gProp.pSRetoucheFly == pFly || !rRect.IsOver( pFly->Frm() ) )
-// continue;
-//
-// if ( !pFly->GetFmt()->GetPrint().GetValue() &&
-// (OUTDEV_PRINTER == gProp.pSGlobalShell->GetOut()->GetOutDevType() ||
-// gProp.pSGlobalShell->IsPreview()))
-// continue;
-//
-// const bool bLowerOfSelf = pSelfFly && pFly->IsLowerOf( pSelfFly );
-//
-// //For character bound Flys only examine those Flys in which it is not
-// //anchored itself.
-// //Why only for character bound ones you may ask? It never makes sense to
-// //subtract frames in which it is anchored itself right?
-// if ( pSelfFly && pSelfFly->IsLowerOf( pFly ) )
-// continue;
-//
-// //Any why does it not apply for the RetoucheFly too?
-// if ( gProp.pSRetoucheFly && gProp.pSRetoucheFly->IsLowerOf( pFly ) )
-// continue;
-//
-//#if OSL_DEBUG_LEVEL > 0
-// //Flys who are anchored inside their own one, must have a bigger OrdNum
-// //or be character bound.
-// if ( pSelfFly && bLowerOfSelf )
-// {
-// OSL_ENSURE( pFly->IsFlyInCntFrm() ||
-// pSdrObj->GetOrdNumDirect() > pSelfFly->GetVirtDrawObj()->GetOrdNumDirect(),
-// "Fly with wrong z-Order" );
-// }
-//#endif
-//
-// bool bStopOnHell = true;
-// if ( pSelfFly )
-// {
-// const SdrObject *pTmp = pSelfFly->GetVirtDrawObj();
-// if ( pSdrObj->GetLayer() == pTmp->GetLayer() )
-// {
-// if ( pSdrObj->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
-// //In the same layer we only observe those that are above.
-// continue;
-// }
-// else
-// {
-// if ( !bLowerOfSelf && !pFly->GetFmt()->GetOpaque().GetValue() )
-// //From other layers we are only interested in non
-// //transparent ones or those that are internal
-// continue;
-// bStopOnHell = false;
-// }
-// }
-// if ( gProp.pSRetoucheFly )
-// {
-// const SdrObject *pTmp = gProp.pSRetoucheFly->GetVirtDrawObj();
-// if ( pSdrObj->GetLayer() == pTmp->GetLayer() )
-// {
-// if ( pSdrObj->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
-// //In the same layer we only observe those that are above.
-// continue;
-// }
-// else
-// {
-// if ( !pFly->IsLowerOf( gProp.pSRetoucheFly ) && !pFly->GetFmt()->GetOpaque().GetValue() )
-// //From other layers we are only interested in non
-// //transparent ones or those that are internal
-// continue;
-// bStopOnHell = false;
-// }
-// }
-//
-// //If the content of the Fly is transparent, we subtract it only if it's
-// //contained in the hell layer.
-// const IDocumentDrawModelAccess* pIDDMA = pFly->GetFmt()->getIDocumentDrawModelAccess();
-// bool bHell = pSdrObj->GetLayer() == pIDDMA->GetHellId();
-// if ( (bStopOnHell && bHell) ||
-// /// Change internal order of condition
-// /// first check "!bHell", then "..->Lower()" and "..->IsNoTxtFrm()"
-// /// have not to be performed, if frame is in "Hell"
-// ( !bHell && pFly->Lower() && pFly->Lower()->IsNoTxtFrm() &&
-// ( static_cast<SwNoTxtFrm*>(pFly->Lower())->IsTransparent() ||
-// static_cast<SwNoTxtFrm*>(pFly->Lower())->HasAnimation() ||
-// pFly->GetFmt()->GetSurround().IsContour()
-// )
-// )
-// )
-// continue;
-//
-// // Own if-statements for transparent background/shadow of fly frames
-// // in order to handle special conditions.
-// if ( pFly->IsBackgroundTransparent() )
-// {
-// // Background <pFly> is transparent drawn. Thus normally, its region
-// // have not to be subtracted from given region.
-// // But, if method is called for a fly frame and
-// // <pFly> is a direct lower of this fly frame and
-// // <pFly> inherites its transparent background brush from its parent,
-// // then <pFly> frame area have to be subtracted from given region.
-// // NOTE: Because in Status Quo transparent backgrounds can only be
-// // assigned to fly frames, the handle of this special case
-// // avoids drawing of transparent areas more than once, if
-// // a fly frame inherites a transparent background from its
-// // parent fly frame.
-// if ( pFrm->IsFlyFrm() &&
-// (pFly->GetAnchorFrm()->FindFlyFrm() == pFrm) &&
-// static_cast<const SwFlyFrmFmt*>(pFly->GetFmt())->IsBackgroundBrushInherited()
-// )
-// {
-// SwRect aRect;
-// SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly );
-// const SwBorderAttrs &rAttrs = *aAccess.Get();
-// ::lcl_CalcBorderRect( aRect, pFly, rAttrs, true );
-// rRegion -= aRect;
-// continue;
-// }
-// else
-// {
-// continue;
-// }
-// }
-// if ( pFly->IsShadowTransparent() )
-// {
-// continue;
-// }
-//
-// if ( bHell && pFly->GetAnchorFrm()->IsInFly() )
-// {
-// //So the border won't get dismantled by the background of the other
-// //Fly.
-// SwRect aRect;
-// SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly );
-// const SwBorderAttrs &rAttrs = *aAccess.Get();
-// ::lcl_CalcBorderRect( aRect, pFly, rAttrs, true );
-// rRegion -= aRect;
-// }
-// else
-// {
-// SwRect aRect( pFly->Prt() );
-// aRect += pFly->Frm().Pos();
-// rRegion -= aRect;
-// }
-// }
-// if ( gProp.pSRetoucheFly == gProp.pSRetoucheFly2 )
-// gProp.pSRetoucheFly = 0;
-//}
+static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
+ const SwRect &rRect, SwRegionRects &rRegion, SwPaintProperties & rProperties)
+{
+ const SwSortedObjs& rObjs = *pPage->GetSortedObjs();
+ const SwFlyFrm* pSelfFly = pFrm->IsInFly() ? pFrm->FindFlyFrm() : gProp.pSRetoucheFly2;
+ if (!gProp.pSRetoucheFly)
+ gProp.pSRetoucheFly = gProp.pSRetoucheFly2;
+
+ for (size_t j = 0; (j < rObjs.size()) && !rRegion.empty(); ++j)
+ {
+ const SwAnchoredObject* pAnchoredObj = rObjs[j];
+ const SdrObject* pSdrObj = pAnchoredObj->GetDrawObj();
+
+ // Do not consider invisible objects
+ if (!pPage->GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId(pSdrObj->GetLayer()))
+ continue;
+
+ if (!pAnchoredObj->ISA(SwFlyFrm))
+ continue;
+
+ const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
+
+ if (pSelfFly == pFly || gProp.pSRetoucheFly == pFly || !rRect.IsOver(pFly->Frm()))
+ continue;
+
+ if (!pFly->GetFmt()->GetPrint().GetValue() &&
+ (OUTDEV_PRINTER == gProp.pSGlobalShell->GetOut()->GetOutDevType() ||
+ gProp.pSGlobalShell->IsPreview()))
+ continue;
+
+ const bool bLowerOfSelf = pSelfFly && pFly->IsLowerOf( pSelfFly );
+
+ //For character bound Flys only examine those Flys in which it is not
+ //anchored itself.
+ //Why only for character bound ones you may ask? It never makes sense to
+ //subtract frames in which it is anchored itself right?
+ if (pSelfFly && pSelfFly->IsLowerOf(pFly))
+ continue;
+
+ //Any why does it not apply for the RetoucheFly too?
+ if (gProp.pSRetoucheFly && gProp.pSRetoucheFly->IsLowerOf(pFly))
+ continue;
+
+#if OSL_DEBUG_LEVEL > 0
+ //Flys who are anchored inside their own one, must have a bigger OrdNum
+ //or be character bound.
+ if (pSelfFly && bLowerOfSelf)
+ {
+ OSL_ENSURE( pFly->IsFlyInCntFrm() ||
+ pSdrObj->GetOrdNumDirect() > pSelfFly->GetVirtDrawObj()->GetOrdNumDirect(),
+ "Fly with wrong z-Order" );
+ }
+#endif
+
+ bool bStopOnHell = true;
+ if (pSelfFly)
+ {
+ const SdrObject *pTmp = pSelfFly->GetVirtDrawObj();
+ if (pSdrObj->GetLayer() == pTmp->GetLayer())
+ {
+ if (pSdrObj->GetOrdNumDirect() < pTmp->GetOrdNumDirect())
+ //In the same layer we only observe those that are above.
+ continue;
+ }
+ else
+ {
+ if (!bLowerOfSelf && !pFly->GetFmt()->GetOpaque().GetValue())
+ //From other layers we are only interested in non
+ //transparent ones or those that are internal
+ continue;
+ bStopOnHell = false;
+ }
+ }
+ if (gProp.pSRetoucheFly)
+ {
+ const SdrObject *pTmp = gProp.pSRetoucheFly->GetVirtDrawObj();
+ if ( pSdrObj->GetLayer() == pTmp->GetLayer() )
+ {
+ if ( pSdrObj->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
+ //In the same layer we only observe those that are above.
+ continue;
+ }
+ else
+ {
+ if (!pFly->IsLowerOf( gProp.pSRetoucheFly ) && !pFly->GetFmt()->GetOpaque().GetValue())
+ //From other layers we are only interested in non
+ //transparent ones or those that are internal
+ continue;
+ bStopOnHell = false;
+ }
+ }
+
+ //If the content of the Fly is transparent, we subtract it only if it's
+ //contained in the hell layer.
+ const IDocumentDrawModelAccess* pIDDMA = pFly->GetFmt()->getIDocumentDrawModelAccess();
+ bool bHell = pSdrObj->GetLayer() == pIDDMA->GetHellId();
+ if ( (bStopOnHell && bHell) ||
+ /// Change internal order of condition
+ /// first check "!bHell", then "..->Lower()" and "..->IsNoTxtFrm()"
+ /// have not to be performed, if frame is in "Hell"
+ ( !bHell && pFly->Lower() && pFly->Lower()->IsNoTxtFrm() &&
+ (static_cast<SwNoTxtFrm const*>(pFly->Lower())->IsTransparent() ||
+ static_cast<SwNoTxtFrm const*>(pFly->Lower())->HasAnimation() ||
+ pFly->GetFmt()->GetSurround().IsContour()
+ )
+ )
+ )
+ continue;
+
+ // Own if-statements for transparent background/shadow of fly frames
+ // in order to handle special conditions.
+ if (pFly->IsBackgroundTransparent())
+ {
+ // Background <pFly> is transparent drawn. Thus normally, its region
+ // have not to be subtracted from given region.
+ // But, if method is called for a fly frame and
+ // <pFly> is a direct lower of this fly frame and
+ // <pFly> inherites its transparent background brush from its parent,
+ // then <pFly> frame area have to be subtracted from given region.
+ // NOTE: Because in Status Quo transparent backgrounds can only be
+ // assigned to fly frames, the handle of this special case
+ // avoids drawing of transparent areas more than once, if
+ // a fly frame inherites a transparent background from its
+ // parent fly frame.
+ if (pFrm->IsFlyFrm() &&
+ (pFly->GetAnchorFrm()->FindFlyFrm() == pFrm) &&
+ static_cast<const SwFlyFrmFmt*>(pFly->GetFmt())->IsBackgroundBrushInherited()
+ )
+ {
+ SwRect aRect;
+ SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly );
+ const SwBorderAttrs &rAttrs = *aAccess.Get();
+ ::lcl_CalcBorderRect( aRect, pFly, rAttrs, true, rProperties );
+ rRegion -= aRect;
+ continue;
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ if (bHell && pFly->GetAnchorFrm()->IsInFly())
+ {
+ //So the border won't get dismantled by the background of the other
+ //Fly.
+ SwRect aRect;
+ SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly );
+ const SwBorderAttrs &rAttrs = *aAccess.Get();
+ ::lcl_CalcBorderRect( aRect, pFly, rAttrs, true, rProperties );
+ rRegion -= aRect;
+ }
+ else
+ {
+ SwRect aRect( pFly->Prt() );
+ aRect += pFly->Frm().Pos();
+ rRegion -= aRect;
+ }
+ }
+ if (gProp.pSRetoucheFly == gProp.pSRetoucheFly2)
+ gProp.pSRetoucheFly = 0;
+}
static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
OutputDevice* _pOut,
@@ -1859,16 +1856,16 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut,
bool DrawFillAttributes(
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
const SwRect& rOriginalLayoutRect,
- const SwRect& rPaintRect,
+ const SwRegionRects& rPaintRegion,
OutputDevice& rOut)
{
if(rFillAttributes.get() && rFillAttributes->isUsed())
{
basegfx::B2DRange aPaintRange(
- rPaintRect.Left(),
- rPaintRect.Top(),
- rPaintRect.Right(),
- rPaintRect.Bottom());
+ rPaintRegion.GetOrigin().Left(),
+ rPaintRegion.GetOrigin().Top(),
+ rPaintRegion.GetOrigin().Right(),
+ rPaintRegion.GetOrigin().Bottom());
if(!aPaintRange.isEmpty() &&
!basegfx::fTools::equalZero(aPaintRange.getWidth()) &&
@@ -1915,6 +1912,26 @@ bool DrawFillAttributes(
if(rSequence.getLength())
{
+ drawinglayer::primitive2d::Primitive2DSequence const*
+ pPrimitives(&rSequence);
+ drawinglayer::primitive2d::Primitive2DSequence primitives;
+ // tdf#86578 the awful lcl_SubtractFlys hack
+ if (rPaintRegion.size() > 1 || rPaintRegion[0] != rPaintRegion.GetOrigin())
+ {
+ tools::PolyPolygon tempRegion;
+ for (size_t i = 0; i < rPaintRegion.size(); ++i)
+ {
+ tempRegion.Insert(Polygon(rPaintRegion[i].SVRect()));
+ }
+ basegfx::B2DPolyPolygon const maskRegion(
+ tempRegion.getB2DPolyPolygon());
+ primitives.realloc(1);
+ primitives[0] = new drawinglayer::primitive2d::MaskPrimitive2D(
+ maskRegion, rSequence);
+ pPrimitives = &primitives;
+ }
+ assert(pPrimitives && pPrimitives->getLength());
+
const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
basegfx::B2DHomMatrix(),
rOut.GetViewTransformation(),
@@ -1928,7 +1945,7 @@ bool DrawFillAttributes(
if(pProcessor)
{
- pProcessor->process(rSequence);
+ pProcessor->process(*pPrimitives);
delete pProcessor;
@@ -4193,7 +4210,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
// parent fly frame area and the paint area <aRect>
const IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
- if ( bIsGraphicTransparent &&
+ if (bIsGraphicTransparent &&
+ GetFmt()->GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS) &&
GetVirtDrawObj()->GetLayer() == pIDDMA->GetHellId() &&
GetAnchorFrm()->FindFlyFrm() )
{
@@ -4649,7 +4667,7 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
void SwFrm::PaintBorderLine( const SwRect& rRect,
const SwRect& rOutRect,
- const SwPageFrm * /*pPage*/,
+ const SwPageFrm * pPage,
const Color *pColor,
const SvxBorderStyle nStyle ) const
{
@@ -4669,14 +4687,15 @@ void SwFrm::PaintBorderLine( const SwRect& rRect,
pColor = &SwViewOption::GetFontColor();
}
- //if ( pPage->GetSortedObjs() )
- //{
- // SwRegionRects aRegion( aOut, 4 );
- // ::lcl_SubtractFlys( this, pPage, aOut, aRegion );
- // for ( size_t i = 0; i < aRegion.size(); ++i )
- // gProp.pSLines->AddLineRect( aRegion[i], pColor, nStyle, pTab, nSubCol );
- //}
- //else
+ if (pPage->GetSortedObjs() &&
+ pPage->GetFmt()->GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS))
+ {
+ SwRegionRects aRegion( aOut, 4 );
+ ::lcl_SubtractFlys( this, pPage, aOut, aRegion, gProp );
+ for ( size_t i = 0; i < aRegion.size(); ++i )
+ gProp.pSLines->AddLineRect( aRegion[i], pColor, nStyle, pTab, nSubCol, gProp );
+ }
+ else
gProp.pSLines->AddLineRect( aOut, pColor, nStyle, pTab, nSubCol, gProp );
}
@@ -6568,7 +6587,6 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
if ( aRect.HasArea() )
{
SvxBrushItem* pNewItem = 0;
- //SwRegionRects aRegion( aRect );
if( pCol )
{
@@ -6579,10 +6597,12 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pCol));
}
- //if ( pPage->GetSortedObjs() )
- //{
- // ::lcl_SubtractFlys( this, pPage, aRect, aRegion );
- //}
+ SwRegionRects aRegion( aRect );
+ if (pPage->GetSortedObjs() &&
+ pSh->GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS))
+ {
+ ::lcl_SubtractFlys( this, pPage, aRect, aRegion, gProp );
+ }
// OD 06.08.2002 #99657# - determine, if background transparency
// have to be considered for drawing.
@@ -6598,7 +6618,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
if(aFillAttributes->isUsed())
{
// check if really something is painted
- bDone = DrawFillAttributes(aFillAttributes, aOrigBackRect, aRect, *pOut);
+ bDone = DrawFillAttributes(aFillAttributes, aOrigBackRect, aRegion, *pOut);
}
if(!bDone)
@@ -6618,27 +6638,27 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
if(!bDone)
{
- //for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
- //{
- // if ( 1 < aRegion.Count() )
- // {
- // ::SwAlignRect( aRegion[i], gProp.pSGlobalShell );
- // if( !aRegion[i].HasArea() )
- // continue;
- // }
+ for (size_t i = 0; i < aRegion.size(); ++i)
+ {
+ if (1 < aRegion.size())
+ {
+ ::SwAlignRect( aRegion[i], gProp.pSGlobalShell );
+ if( !aRegion[i].HasArea() )
+ continue;
+ }
// OD 06.08.2002 #99657# - add 6th parameter to indicate, if
// background transparency have to be considered
// Set missing 5th parameter to the default value GRFNUM_NO
// - see declaration in /core/inc/frmtool.hxx.
- if (IsTxtFrm() || !bOnlyTxtBackground)
- ::DrawGraphic(
- pItem,
- pOut,
- aOrigBackRect,
- aRect, // aRegion[i],
- GRFNUM_NO,
- bConsiderBackgroundTransparency );
- //}
+ if (IsTxtFrm() || !bOnlyTxtBackground)
+ ::DrawGraphic(
+ pItem,
+ pOut,
+ aOrigBackRect,
+ aRegion[i],
+ GRFNUM_NO,
+ bConsiderBackgroundTransparency );
+ }
}
if( pCol )
delete pNewItem;
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 496b37f..e9fda23 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1118,6 +1118,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
aSet.insert("BackgroundParaOverDrawings");
aSet.insert("TabOverMargin");
aSet.insert("PropLineSpacingShrinksFirstLine");
+ aSet.insert("SubtractFlysAnchoredAtFlys");
sal_Int32 nCount = aConfigProps.getLength();
const PropertyValue* pValues = aConfigProps.getConstArray();
@@ -1153,6 +1154,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
bool bBackgroundParaOverDrawings = false;
bool bTabOverMargin = false;
bool bPropLineSpacingShrinksFirstLine = false;
+ bool bSubtractFlysAnchoredAtFlys = false;
const PropertyValue* currentDatabaseDataSource = NULL;
const PropertyValue* currentDatabaseCommand = NULL;
@@ -1242,6 +1244,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
bTabOverMargin = true;
else if ( pValues->Name == "PropLineSpacingShrinksFirstLine" )
bPropLineSpacingShrinksFirstLine = true;
+ else if (pValues->Name == "SubtractFlysAnchoredAtFlys")
+ bSubtractFlysAnchoredAtFlys = true;
}
catch( Exception& )
{
@@ -1414,6 +1418,9 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
if (!bPropLineSpacingShrinksFirstLine)
xProps->setPropertyValue("PropLineSpacingShrinksFirstLine", makeAny(false));
+ if (!bSubtractFlysAnchoredAtFlys)
+ xProps->setPropertyValue("SubtractFlysAnchoredAtFlys", makeAny(true));
+
SwDoc *pDoc = getDoc();
SfxPrinter *pPrinter = pDoc->getIDocumentDeviceAccess().getPrinter( false );
if( pPrinter )
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index c323f72..b80a0c4 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -128,6 +128,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_SURROUND_TEXT_WRAP_SMALL,
HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
+ HANDLE_SUBTRACT_FLYS,
};
static MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -200,6 +201,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0, 0},
+ { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0, 0},
/*
* As OS said, we don't have a view when we need to set this, so I have to
* find another solution before adding them to this property set - MTG
@@ -817,6 +819,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
}
}
break;
+ case HANDLE_SUBTRACT_FLYS:
+ {
+ bool bTmp;
+ if (rValue >>= bTmp)
+ {
+ mpDoc->getIDocumentSettingAccess().set(
+ DocumentSettingId::SUBTRACT_FLYS, bTmp);
+ }
+ }
+ break;
default:
throw UnknownPropertyException();
}
@@ -1207,6 +1219,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE);
}
break;
+ case HANDLE_SUBTRACT_FLYS:
+ {
+ rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS);
+ }
+ break;
default:
throw UnknownPropertyException();
}
commit be096cbf64700466f621e51665d48650b0915635
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Apr 10 12:22:26 2015 +0200
svx: add an assertion to this fixed-size thing
Change-Id: I3d496f78fd60a3a47cc62d4237f31e5e131a9692
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index 9ead73a..24767b0 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -544,7 +544,8 @@ ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
case 7: return (ViewContact&)maViewContactOfHelplinesBack;
case 8: return (ViewContact&)maViewContactOfPageHierarchy;
case 9: return (ViewContact&)maViewContactOfGridFront;
- default: return (ViewContact&)maViewContactOfHelplinesFront;
+ case 10: case 11: return (ViewContact&)maViewContactOfHelplinesFront;
+ default: assert(false);
}
}
commit 233c94d225bc8043c5a1d4d5260e0864f6510a56
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Apr 9 15:32:40 2015 +0200
sw: replace some magic frame type numbers
Change-Id: I7d464cf33b0bfd29f4f6f750abcab2e59257788d
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 48e44e7..5db5538 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -1152,11 +1152,11 @@ inline bool SwFrm::IsNoTxtFrm() const
}
inline bool SwFrm::IsFlowFrm() const
{
- return (GetType() & 0xCA00) != 0; //TabFrm, CntntFrm, SectionFrm
+ return (GetType() & (FRM_CNTNT|FRM_TAB|FRM_SECTION)) != 0;
}
inline bool SwFrm::IsRetoucheFrm() const
{
- return (GetType() & 0xCA40) != 0; //TabFrm, CntntFrm, SectionFrm, Ftnfrm
+ return (GetType() & (FRM_CNTNT|FRM_TAB|FRM_SECTION|FRM_FTN)) != 0;
}
inline bool SwFrm::IsAccessibleFrm() const
{
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 6552055..f1aa832 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -519,7 +519,8 @@ SwFrm* SwFrm::FindFooterOrHeader()
{
SwFrm* pRet = this;
do
- { if ( pRet->GetType() & 0x0018 ) //header and footer
+ {
+ if (pRet->GetType() & FRM_HEADFOOT) //header and footer
return pRet;
else if ( pRet->GetUpper() )
pRet = pRet->GetUpper();
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 4b15cee..8323e18 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -583,7 +583,8 @@ SwLayNotify::~SwLayNotify()
if ( !IsLowersComplete() &&
!(pLay->GetType()&(FRM_FLY|FRM_SECTION) &&
pLay->Lower() && pLay->Lower()->IsColumnFrm()) &&
- (bPos || bNotify) && !(pLay->GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
+ (bPos || bNotify) &&
+ !(pLay->GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT)))
{
// #i44016# - force unlock of position of lower objects.
// #i43913# - no unlock of position of objects,
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx
index f85a820..26a87e1 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -375,7 +375,7 @@ void SwHeadFootFrm::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs)
}
mbValidSize = mbValidPrtArea = true;
}
- else //if ( GetType() & 0x0018 )
+ else //if (GetType() & FRM_HEADFOOT)
{
do
{
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 0a771c2..5e84032 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5402,11 +5402,10 @@ void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage,
const SwBorderAttrs &rAttrs ) const
{
// There's nothing (Row,Body,Ftn,Root,Column,NoTxt) need to do here
- if ( (GetType() & 0x90C5) )
+ if ((GetType() & (FRM_NOTXT|FRM_ROW|FRM_BODY|FRM_FTN|FRM_COLUMN|FRM_ROOT)))
return;
- if ( (GetType() & 0x2000) && //Cell
- !gProp.pSGlobalShell->GetViewOptions()->IsTable() )
+ if (IsCellFrm() && !gProp.pSGlobalShell->GetViewOptions()->IsTable())
return;
// #i29550#
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index deab86a..d777c3d 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -828,8 +828,8 @@ static bool lcl_UpDown( SwPaM *pPam, const SwCntntFrm *pStart,
//Otherwise I'll just refuse to leave to current area.
else if ( pCnt )
{
- const SwFrm *pUp = pStart->GetUpper(); //Head/Foot
- while ( pUp && pUp->GetUpper() && !(pUp->GetType() & 0x0018 ) )
+ const SwFrm *pUp = pStart->GetUpper();
+ while (pUp && pUp->GetUpper() && !(pUp->GetType() & FRM_HEADFOOT))
pUp = pUp->GetUpper();
bool bSame = false;
const SwFrm *pCntUp = pCnt->GetUpper();
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 50290ee..6be1b86 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2323,7 +2323,7 @@ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo )
_InvalidateAll();
InvalidatePage( pPage );
}
- if ( !(GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
+ if (!(GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT)))
NotifyLowerObjs();
if( IsCellFrm() )
@@ -2495,7 +2495,7 @@ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, bool bTst, bool bInfo )
SetCompletePaint();
}
- if ( !(GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
+ if (!(GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT)))
NotifyLowerObjs();
if( IsCellFrm() )
@@ -2990,7 +2990,7 @@ void SwLayoutFrm::Format( const SwBorderAttrs *pAttrs )
}
} while ( !mbValidSize );
}
- else if ( GetType() & 0x0018 )
+ else if (GetType() & FRM_HEADFOOT)
{
do
{ if ( Frm().Height() != pAttrs->GetSize().Height() )
commit 00a1f2089bb250a8a9130109baac4d0c93adc3d0
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Apr 8 21:37:43 2015 +0200
linguistic: try to avoid crash with null LngSvcMgr::pAvailGrammarSvcs
Most likely it was cleared by another thread while this one showed the
"no JRE" dialog.
Change-Id: Ib0e74c73a510f52778163ad24c20d7ae835ced11
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 58bfa77..c840b87 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -860,6 +860,8 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
SAL_WARN_IF( aKeyText.isEmpty(), "linguistic", "unexpected key (lang::Locale) string" );
if (rName.startsWith( aSpellCheckerList ))
{
+ osl::MutexGuard aGuard(GetLinguMutex());
+
// delete old cached data, needs to be acquired new on demand
clearSvcInfoArray(pAvailSpellSvcs);
@@ -885,6 +887,8 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
}
else if (rName.startsWith( aGrammarCheckerList ))
{
+ osl::MutexGuard aGuard(GetLinguMutex());
+
// delete old cached data, needs to be acquired new on demand
clearSvcInfoArray(pAvailGrammarSvcs);
@@ -913,6 +917,8 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
}
else if (rName.startsWith( aHyphenatorList ))
{
+ osl::MutexGuard aGuard(GetLinguMutex());
+
// delete old cached data, needs to be acquired new on demand
clearSvcInfoArray(pAvailHyphSvcs);
@@ -938,6 +944,8 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
}
else if (rName.startsWith( aThesaurusList ))
{
+ osl::MutexGuard aGuard(GetLinguMutex());
+
// delete old cached data, needs to be acquired new on demand
clearSvcInfoArray(pAvailThesSvcs);
More information about the Libreoffice-commits
mailing list