summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx5
-rw-r--r--sw/source/core/doc/textboxhelper.cxx10
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx1
-rw-r--r--sw/source/core/inc/anchoredobjectposition.hxx4
-rw-r--r--sw/source/core/inc/txtfrm.hxx4
-rw-r--r--sw/source/core/objectpositioning/anchoredobjectposition.cxx24
-rw-r--r--sw/source/core/text/txtfrm.cxx13
-rw-r--r--sw/source/core/text/xmldump.cxx12
8 files changed, 66 insertions, 7 deletions
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 6970d1f8044e..02b927a55e3e 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -53,6 +53,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),
@@ -125,6 +126,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);
@@ -196,6 +198,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/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 57c64f107b26..e50c2385477b 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -27,6 +27,7 @@
#include <mvsave.hxx>
#include <sortedobjs.hxx>
#include <cntfrm.hxx>
+#include <fmtsrnd.hxx>
#include <editeng/unoprnms.hxx>
#include <editeng/charrotateitem.hxx>
@@ -264,6 +265,15 @@ sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject, std::set<const Sw
return pObject->GetOrdNum();
}
+void SwTextBoxHelper::getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough)
+{
+ std::map<SwFrameFormat*, SwFrameFormat*> aMap = findShapes(pTextBox->GetDoc());
+ std::map<SwFrameFormat*, SwFrameFormat*>::iterator it = aMap.find(const_cast<SwFrameFormat*>(pTextBox));
+ if (it != aMap.end())
+ // pTextBox is indeed a TextBox, it->second is its shape.
+ rWrapThrough = it->second->GetSurround().GetSurround() == SURROUND_THROUGHT;
+}
+
SwFrameFormat* SwTextBoxHelper::findTextBox(uno::Reference<drawing::XShape> xShape)
{
SwXShape* pShape = dynamic_cast<SwXShape*>(xShape.get());
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 9ff978c40b04..c83d6d86e619 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 ec9617aa769a..0be1facae9df 100644
--- a/sw/source/core/inc/anchoredobjectposition.hxx
+++ b/sw/source/core/inc/anchoredobjectposition.hxx
@@ -126,9 +126,9 @@ namespace objectpositioning
#i11860#
*/
- static SwTwips _GetTopForObjPos( const SwFrm& _rFrm,
+ SwTwips _GetTopForObjPos( const SwFrm& _rFrm,
const SwRectFn& _fnRect,
- const bool _bVert );
+ const bool _bVert ) const;
void _GetVertAlignmentValues( const SwFrm& _rVertOrientFrm,
const SwFrm& _rPageAlignLayFrm,
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 824480ac454b..690d92406816 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -68,6 +68,8 @@ class SwTextFrm: public SwContentFrm
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)
@@ -642,6 +644,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 ee354ce558e6..aed0003a96f2 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -37,6 +37,7 @@
#include <ndtxt.hxx>
#include <IDocumentSettingAccess.hxx>
#include <textboxhelper.hxx>
+#include <fmtsrnd.hxx>
using namespace ::com::sun::star;
using namespace objectpositioning;
@@ -156,7 +157,7 @@ SwTwips SwAnchoredObjectPosition::ToCharTopOfLine() const
*/
SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrm& _rFrm,
const SwRectFn& _fnRect,
- const bool _bVert )
+ const bool _bVert ) const
{
SwTwips nTopOfFrmForObjPos = (_rFrm.Frm().*_fnRect->fnGetTop)();
@@ -172,6 +173,17 @@ SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrm& _rFrm,
{
nTopOfFrmForObjPos +=
rTextFrm.GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid();
+
+ const SwFormatSurround& rSurround = mpFrameFormat->GetSurround();
+ bool bWrapThrough = rSurround.GetSurround() == SURROUND_THROUGHT;
+ // If the frame format is a TextBox of a draw shape, then use the
+ // surround of the original shape.
+ SwTextBoxHelper::getShapeWrapThrough(mpFrameFormat, bWrapThrough);
+
+ // 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.
+ nTopOfFrmForObjPos += rTextFrm.GetBaseVertOffsetForFly(!bWrapThrough);
}
}
@@ -685,10 +697,12 @@ void SwAnchoredObjectPosition::_GetHoriAlignmentValues( const SwFrm& _rHoriOrie
{
nWidth = (_rHoriOrientFrm.Frm().*fnRect->fnGetWidth)();
- // When positioning TextBoxes, always ignore flys anchored at the
- // text frame, as we do want to have the textbox overlap with its
- // draw shape.
- bool bIgnoreFlysAnchoredAtFrame = !_bObjWrapThrough || SwTextBoxHelper::isTextBox(&GetObject());
+ bool bWrapThrough = _bObjWrapThrough;
+ // If the frame format is a TextBox of a draw shape, then use the
+ // surround of the original shape.
+ SwTextBoxHelper::getShapeWrapThrough(mpFrameFormat, bWrapThrough);
+
+ bool bIgnoreFlysAnchoredAtFrame = !bWrapThrough;
nOffset = _rHoriOrientFrm.IsTextFrm() ?
static_cast<const SwTextFrm&>(_rHoriOrientFrm).GetBaseOfstForFly( bIgnoreFlysAnchoredAtFrame ) :
0;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index a4a707f9133a..8705945f3cf9 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -355,6 +355,7 @@ SwTextFrm::SwTextFrm(SwTextNode * const pNode, SwFrm* pSib )
, nThisLines( 0 )
, mnFlyAnchorOfst( 0 )
, mnFlyAnchorOfstNoWrap( 0 )
+ , mnFlyAnchorVertOfstNoWrap( 0 )
, mnFootnoteLine( 0 )
, mnHeightOfLastLine( 0 ) // OD 2004-03-17 #i11860#
, mnAdditionalFirstLineOffset( 0 )
@@ -2657,6 +2658,7 @@ void SwTextFrm::CalcBaseOfstForFly()
// Get first 'real' line and adjust position and height of line rectangle
// OD 08.09.2003 #110978#, #108749#, #110354# - 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();
@@ -2664,6 +2666,7 @@ void SwTextFrm::CalcBaseOfstForFly()
while( pLay && pLay->IsDummy() && pLay->GetNext() )
{
nTop += pLay->Height();
+ nFlyAnchorVertOfstNoWrap += pLay->Height();
pLay = pLay->GetNext();
}
if ( pLay )
@@ -2690,6 +2693,16 @@ void SwTextFrm::CalcBaseOfstForFly()
mnFlyAnchorOfst = nRet1 - nLeft;
mnFlyAnchorOfstNoWrap = nRet2 - nLeft;
+
+ if (!pNode->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
+ return;
+
+ mnFlyAnchorVertOfstNoWrap = nFlyAnchorVertOfstNoWrap;
+}
+
+SwTwips SwTextFrm::GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
+{
+ return bIgnoreFlysAnchoredAtThisFrame ? 0 : mnFlyAnchorVertOfstNoWrap;
}
/**
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 951b415ff565..06d7044fa563 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -22,6 +22,7 @@
#include <anchoredobject.hxx>
#include <libxml/xmlwriter.h>
#include <SwPortionHandler.hxx>
+#include <svx/svdobj.hxx>
class XmlPortionDumper:public SwPortionHandler
{
@@ -360,6 +361,14 @@ void SwFrm::dumpInfosAsXml( xmlTextWriterPtr writer ) const
xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", Frm().Width() );
xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", Frm().Height() );
xmlTextWriterEndElement( writer );
+
+ // output the Prt
+ xmlTextWriterStartElement( writer, BAD_CAST( "prtBounds" ) );
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", Prt().Left() );
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", Prt().Top() );
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", Prt().Width() );
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", Prt().Height() );
+ xmlTextWriterEndElement( writer );
}
// Hack: somehow conversion from "..." to va_list does
@@ -419,6 +428,9 @@ void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer ) const
xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", GetObjBoundRect().Height() );
xmlTextWriterEndElement( writer );
+ if (const SdrObject* pObject = GetDrawObj())
+ pObject->dumpAsXml(writer);
+
xmlTextWriterEndElement( writer );
if ( bCreateWriter )