Kaydet (Commit) c5cf8824 authored tarafından Michael Stahl's avatar Michael Stahl

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 6e61ecd0)

Change-Id: I710fe79710b89c8f865ebb7162e14713aac6cc4a
üst be096cbf
......@@ -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,
......
......@@ -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
......
......@@ -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)
{
......
......@@ -148,6 +148,7 @@ class DocumentSettingManager :
bool mbTabOverMargin;
bool mbSurroundTextWrapSmall;
bool mbPropLineSpacingShrinksFirstLine; // fdo#79602
bool mbSubtractFlys; // tdf#86578
bool mApplyParagraphMarkFormatToNumbering;
bool mbLastBrowseMode : 1;
......
......@@ -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(
......
......@@ -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 )
......
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment