summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx5
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx1
-rw-r--r--sw/source/core/inc/anchoredobjectposition.hxx7
-rw-r--r--sw/source/core/inc/txtfrm.hxx4
-rw-r--r--sw/source/core/objectpositioning/anchoredobjectposition.cxx16
-rw-r--r--sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx20
-rw-r--r--sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx4
-rw-r--r--sw/source/core/text/txtfrm.cxx13
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx13
9 files changed, 66 insertions, 17 deletions
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index b2d251c07c72..bdcc1ea2e39a 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -54,6 +54,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
// COMPATIBILITY FLAGS START
mbAddFlyOffsets(false),
+ mbAddVerticalFlyOffsets(false),
mbUseHiResolutionVirtualDevice(true),
mbMathBaselineAlignment(false), // default for *old* documents is 'off'
mbStylesNoDefault(false),
@@ -143,6 +144,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::PARA_SPACE_MAX_AT_PAGES: return mbParaSpaceMaxAtPages; //(n8Dummy1 & DUMMY_PARASPACEMAX_AT_PAGES);
case DocumentSettingId::TAB_COMPAT: return mbTabCompat; //(n8Dummy1 & DUMMY_TAB_COMPAT);
case DocumentSettingId::ADD_FLY_OFFSETS: return mbAddFlyOffsets; //(n8Dummy2 & DUMMY_ADD_FLY_OFFSETS);
+ case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS: return mbAddVerticalFlyOffsets;
case DocumentSettingId::ADD_EXT_LEADING: return mbAddExternalLeading; //(n8Dummy2 & DUMMY_ADD_EXTERNAL_LEADING);
case DocumentSettingId::USE_VIRTUAL_DEVICE: return mbUseVirtualDevice; //(n8Dummy1 & DUMMY_USE_VIRTUAL_DEVICE);
case DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE: return mbUseHiResolutionVirtualDevice; //(n8Dummy2 & DUMMY_USE_HIRES_VIR_DEV);
@@ -214,6 +216,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
case DocumentSettingId::ADD_FLY_OFFSETS:
mbAddFlyOffsets = value;
break;
+ case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS:
+ mbAddVerticalFlyOffsets = value;
+ break;
case DocumentSettingId::ADD_EXT_LEADING:
mbAddExternalLeading = value;
break;
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 4e08d01008a4..eebd1db35b39 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -108,6 +108,7 @@ class DocumentSettingManager :
bool mbTabCompat : 1;
bool mbUseVirtualDevice : 1;
bool mbAddFlyOffsets : 1;
+ bool mbAddVerticalFlyOffsets : 1;
bool mbAddExternalLeading : 1;
bool mbUseHiResolutionVirtualDevice : 1;
bool mbOldLineSpacing : 1; // #i11859#
diff --git a/sw/source/core/inc/anchoredobjectposition.hxx b/sw/source/core/inc/anchoredobjectposition.hxx
index 5547e3cfe051..d6c62242ee8a 100644
--- a/sw/source/core/inc/anchoredobjectposition.hxx
+++ b/sw/source/core/inc/anchoredobjectposition.hxx
@@ -128,13 +128,15 @@ namespace objectpositioning
*/
static SwTwips _GetTopForObjPos( const SwFrame& _rFrame,
const SwRectFn& _fnRect,
- const bool _bVert );
+ const bool _bVert,
+ bool bWrapThrough );
void _GetVertAlignmentValues( const SwFrame& _rVertOrientFrame,
const SwFrame& _rPageAlignLayFrame,
const sal_Int16 _eRelOrient,
SwTwips& _orAlignAreaHeight,
- SwTwips& _orAlignAreaOffset ) const;
+ SwTwips& _orAlignAreaOffset,
+ bool bWrapThrough ) const;
// #i26791# - add output parameter <_roVertOffsetToFrameAnchorPos>
SwTwips _GetVertRelPos( const SwFrame& _rVertOrientFrame,
@@ -144,6 +146,7 @@ namespace objectpositioning
const SwTwips _nVertPos,
const SvxLRSpaceItem& _rLRSpacing,
const SvxULSpaceItem& _rULSpacing,
+ bool bWrapThrough,
SwTwips& _roVertOffsetToFrameAnchorPos ) const;
/** adjust calculated vertical in order to keep object inside
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 09e1b38fe98b..7c021eab4ce1 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -68,6 +68,8 @@ class SwTextFrame: public SwContentFrame
SwTwips mnFlyAnchorOfst;
// The x position for wrap-through flys anchored at this paragraph.
SwTwips mnFlyAnchorOfstNoWrap;
+ /// The y position for wrap-through flys anchored at this paragraph.
+ SwTwips mnFlyAnchorVertOfstNoWrap;
SwTwips mnFootnoteLine;
// OD 2004-03-17 #i11860# - re-factoring of #i11859#
// member for height of last line (value needed for proportional line spacing)
@@ -621,6 +623,8 @@ public:
mnFlyAnchorOfstNoWrap );
}
+ SwTwips GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const;
+
inline SwTwips GetHeightOfLastLine() const
{
return mnHeightOfLastLine;
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index e6903851d850..fbadb3a10d74 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -156,7 +156,8 @@ SwTwips SwAnchoredObjectPosition::ToCharTopOfLine() const
*/
SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrame& _rFrame,
const SwRectFn& _fnRect,
- const bool _bVert )
+ const bool _bVert,
+ bool bWrapThrough )
{
SwTwips nTopOfFrameForObjPos = (_rFrame.Frame().*_fnRect->fnGetTop)();
@@ -172,6 +173,11 @@ SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrame& _rFrame,
{
nTopOfFrameForObjPos +=
rTextFrame.GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid();
+
+ // Get the offset between the top of the text frame and the top of
+ // the first line inside the frame that has more than just fly
+ // portions.
+ nTopOfFrameForObjPos += rTextFrame.GetBaseVertOffsetForFly(!bWrapThrough);
}
}
@@ -183,13 +189,14 @@ void SwAnchoredObjectPosition::_GetVertAlignmentValues(
const SwFrame& _rPageAlignLayFrame,
const sal_Int16 _eRelOrient,
SwTwips& _orAlignAreaHeight,
- SwTwips& _orAlignAreaOffset ) const
+ SwTwips& _orAlignAreaOffset,
+ bool bWrapThrough ) const
{
SwTwips nHeight = 0;
SwTwips nOffset = 0;
SWRECTFN( (&_rVertOrientFrame) )
// #i11860# - top of <_rVertOrientFrame> for object positioning
- const SwTwips nVertOrientTop = _GetTopForObjPos( _rVertOrientFrame, fnRect, bVert );
+ const SwTwips nVertOrientTop = _GetTopForObjPos( _rVertOrientFrame, fnRect, bVert, bWrapThrough );
// #i11860# - upper space amount of <_rVertOrientFrame> considered
// for previous frame
const SwTwips nVertOrientUpperSpaceForPrevFrameAndPageGrid =
@@ -320,6 +327,7 @@ SwTwips SwAnchoredObjectPosition::_GetVertRelPos(
const SwTwips _nVertPos,
const SvxLRSpaceItem& _rLRSpacing,
const SvxULSpaceItem& _rULSpacing,
+ bool bWrapThrough,
SwTwips& _roVertOffsetToFrameAnchorPos ) const
{
SwTwips nRelPosY = 0;
@@ -328,7 +336,7 @@ SwTwips SwAnchoredObjectPosition::_GetVertRelPos(
SwTwips nAlignAreaHeight;
SwTwips nAlignAreaOffset;
_GetVertAlignmentValues( _rVertOrientFrame, _rPageAlignLayFrame,
- _eRelOrient, nAlignAreaHeight, nAlignAreaOffset );
+ _eRelOrient, nAlignAreaHeight, nAlignAreaOffset, bWrapThrough );
nRelPosY = nAlignAreaOffset;
const SwRect aObjBoundRect( GetAnchoredObj().GetObjRect() );
diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index f51d0612dad6..5abf15ba629b 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -248,7 +248,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
SwTwips nAlignAreaOffset;
_GetVertAlignmentValues( *pOrientFrame, rPageAlignLayFrame,
aVert.GetRelationOrient(),
- nAlignAreaHeight, nAlignAreaOffset );
+ nAlignAreaHeight, nAlignAreaOffset, bWrapThrough );
// determine relative vertical position
SwTwips nRelPosY = nAlignAreaOffset;
@@ -380,16 +380,16 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
{
// #i11860# - use new method <_GetTopForObjPos>
// to get top of frame for object positioning.
- const SwTwips nTopOfOrient = _GetTopForObjPos( *pOrientFrame, fnRect, bVert );
+ const SwTwips nTopOfOrient = _GetTopForObjPos( *pOrientFrame, fnRect, bVert, bWrapThrough );
nRelPosY += (*fnRect->fnYDiff)( nTopOfOrient,
- _GetTopForObjPos( rAnchorTextFrame, fnRect, bVert ) );
+ _GetTopForObjPos( rAnchorTextFrame, fnRect, bVert, bWrapThrough ) );
}
// #i42124# - capture object inside vertical
// layout environment.
{
const SwTwips nTopOfAnch =
- _GetTopForObjPos( *pOrientFrame, fnRect, bVert );
+ _GetTopForObjPos( *pOrientFrame, fnRect, bVert, bWrapThrough );
const SwLayoutFrame& rVertEnvironLayFrame =
aEnvOfObj.GetVertEnvironmentLayoutFrame(
*(pOrientFrame->GetUpper()) );
@@ -486,7 +486,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
{
// #i11860# - use new method <_GetTopForObjPos>
// to get top of frame for object positioning.
- SwTwips nTopOfOrient = _GetTopForObjPos( *pOrientFrame, fnRect, bVert );
+ SwTwips nTopOfOrient = _GetTopForObjPos( *pOrientFrame, fnRect, bVert, bWrapThrough );
if ( aVert.GetRelationOrient() == text::RelOrientation::CHAR )
{
nVertOffsetToFrameAnchorPos = (*fnRect->fnYDiff)(
@@ -509,7 +509,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
// #i11860# - use new method <_GetTopForObjPos>
// to get top of frame for object positioning.
const SwTwips nTopOfOrient =
- _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+ _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
// Increase <nRelPosY> by margin height,
// if position is vertical aligned to "paragraph text area"
if ( aVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA )
@@ -562,7 +562,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
maOffsetToFrameAnchorPos.Y() = nVertOffsetToFrameAnchorPos;
// #i11860# - use new method <_GetTopForObjPos>
// to get top of frame for object positioning.
- const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+ const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
if( nRelPosY <= 0 )
{
// Allow negative position, but keep it
@@ -717,7 +717,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
// We need to calculate the part's absolute position, in order for
// it to be put onto the right page and to be pulled into the
// LayLeaf's PrtArea
- const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+ const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
if( bVert )
{
// --> OD 2009-08-31 #monglianlayout#
@@ -979,7 +979,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
// set calculated vertical position in order to determine correct
// frame, the horizontal position is oriented at.
- const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+ const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
if( bVert )
{
// --> OD 2009-08-31 #mongolianlayout#
@@ -1039,7 +1039,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
}
// set absolute position at object
- const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+ const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
if( bVert )
{
// --> OD 2009-08-31 #mongolianlayout#
diff --git a/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx
index 45d8f09762d6..09b6172f7bbd 100644
--- a/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx
@@ -81,10 +81,12 @@ void SwToLayoutAnchoredObjectPosition::CalcPosition()
}
// #i26791# - get vertical offset to frame anchor position.
SwTwips nVertOffsetToFrameAnchorPos( 0L );
+ const SwFormatSurround& rSurround = rFrameFormat.GetSurround();
+ const bool bWrapThrough = rSurround.GetSurround() == SURROUND_THROUGHT;
SwTwips nRelPosY =
_GetVertRelPos( GetAnchorFrame(), GetAnchorFrame(), eVertOrient,
aVert.GetRelationOrient(), aVert.GetPos(),
- rLR, rUL, nVertOffsetToFrameAnchorPos );
+ rLR, rUL, bWrapThrough, nVertOffsetToFrameAnchorPos );
// keep the calculated relative vertical position - needed for filters
// (including the xml-filter)
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 49028e0c8802..cd1decb998e2 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -354,6 +354,7 @@ SwTextFrame::SwTextFrame(SwTextNode * const pNode, SwFrame* pSib )
, mnThisLines( 0 )
, mnFlyAnchorOfst( 0 )
, mnFlyAnchorOfstNoWrap( 0 )
+ , mnFlyAnchorVertOfstNoWrap( 0 )
, mnFootnoteLine( 0 )
, mnHeightOfLastLine( 0 )
, mnAdditionalFirstLineOffset( 0 )
@@ -2647,6 +2648,7 @@ void SwTextFrame::CalcBaseOfstForFly()
// Get first 'real' line and adjust position and height of line rectangle.
// Correct behaviour if no 'real' line exists
// (empty paragraph with and without a dummy portion)
+ SwTwips nFlyAnchorVertOfstNoWrap = 0;
{
SwTwips nTop = (aFlyRect.*fnRect->fnGetTop)();
const SwLineLayout* pLay = GetPara();
@@ -2654,6 +2656,7 @@ void SwTextFrame::CalcBaseOfstForFly()
while( pLay && pLay->IsDummy() && pLay->GetNext() )
{
nTop += pLay->Height();
+ nFlyAnchorVertOfstNoWrap += pLay->Height();
pLay = pLay->GetNext();
}
if ( pLay )
@@ -2680,6 +2683,16 @@ void SwTextFrame::CalcBaseOfstForFly()
mnFlyAnchorOfst = nRet1 - nLeft;
mnFlyAnchorOfstNoWrap = nRet2 - nLeft;
+
+ if (!pNode->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
+ return;
+
+ mnFlyAnchorVertOfstNoWrap = nFlyAnchorVertOfstNoWrap;
+}
+
+SwTwips SwTextFrame::GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
+{
+ return bIgnoreFlysAnchoredAtThisFrame ? 0 : mnFlyAnchorVertOfstNoWrap;
}
/**
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 09bdde21294e..0ef134d0a09b 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -86,6 +86,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_PRINTER_INDEPENDENT_LAYOUT,
HANDLE_IS_LABEL_DOC,
HANDLE_IS_ADD_FLY_OFFSET,
+ HANDLE_IS_ADD_VERTICAL_FLY_OFFSET,
HANDLE_IS_ADD_EXTERNAL_LEADING,
HANDLE_OLD_NUMBERING,
HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
@@ -159,6 +160,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
{ OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
{ OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
+ { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
{ OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
{ OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
{ OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
@@ -552,6 +554,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_FLY_OFFSETS, bTmp);
}
break;
+ case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
+ {
+ bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS, bTmp);
+ }
+ break;
case HANDLE_IS_ADD_EXTERNAL_LEADING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
@@ -1020,6 +1028,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_FLY_OFFSETS);
}
break;
+ case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
+ {
+ rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS);
+ }
+ break;
case HANDLE_IS_ADD_EXTERNAL_LEADING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING);