diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-08-06 17:02:42 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-08-07 13:43:38 +0200 |
commit | 654c673cef625861fed09ec2709f529bb4ee00b6 (patch) | |
tree | 08e3078228bb200afd8c44b81aaf7c2fd1f477d1 /sw/source/core | |
parent | df10efed1f8c9864b18bf41ce7b9cc29bbf19760 (diff) |
compatibility setting for MS Word wrapping text in less space (bnc#822908)
The document itself is stupid and uses a SURROUND_THROUGH object with a number
of empty lines that make it act is if it in fact was SURROUND_NONE, rather
than actually disabling wrapping for the object and be done with it.
But the difference was that Word still managed to fit those empty lines
next to the object into the little space that was there, while LO already
considered the space too small. So keep a compatibility setting for Word
documents in order to avoid problems with such lame documents and hopefully
that's enough.
Change-Id: I7d17b90de381fd86914ce5efd9c5a29fe4850edc
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/doc/doc.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/txtfly.cxx | 10 |
3 files changed, 14 insertions, 2 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index b71288c1a1ea..965a28ce03fb 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -195,6 +195,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case CLIPPED_PICTURES: return mbClippedPictures; case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings; case TAB_OVER_MARGIN: return mbTabOverMargin; + case SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall; case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked! case HTML_MODE: return mbHTMLMode; @@ -354,6 +355,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) mbTabOverMargin = value; break; + case SURROUND_TEXT_WRAP_SMALL: + mbSurroundTextWrapSmall = value; + break; + // COMPATIBILITY FLAGS END case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 9eb598321bfe..afe6b9cea75f 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -318,6 +318,7 @@ SwDoc::SwDoc() mbClippedPictures(false), mbBackgroundParaOverDrawings(false), mbTabOverMargin(false), + mbSurroundTextWrapSmall(false), mbLastBrowseMode( false ), n32DummyCompatabilityOptions1(0), n32DummyCompatabilityOptions2(0), diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 2a1aadaf0381..f65cb6673ff9 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -1342,6 +1342,9 @@ SwRect SwTxtFly::AnchoredObjToRect( const SwAnchoredObject* pAnchoredObj, // Wrap only on sides with at least 2cm space for the text #define TEXT_MIN 1134 +// MS Word wraps on sides with even less space (value guessed). +#define TEXT_MIN_SMALL 300 + // Wrap on both sides up to a frame width of 1.5cm #define FRAME_MAX 850 @@ -1398,9 +1401,12 @@ SwSurround SwTxtFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchoredO else nRight = 0; } - if( nLeft < TEXT_MIN ) + const int textMin = GetMaster()->GetNode() + ->getIDocumentSettingAccess()->get(IDocumentSettingAccess::SURROUND_TEXT_WRAP_SMALL ) + ? TEXT_MIN_SMALL : TEXT_MIN; + if( nLeft < textMin ) nLeft = 0; - if( nRight < TEXT_MIN ) + if( nRight < textMin ) nRight = 0; if( nLeft ) eSurroundForTextWrap = nRight ? SURROUND_PARALLEL : SURROUND_LEFT; |