diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-10-30 15:12:33 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-11-23 14:30:35 +0100 |
commit | 39d4b3d3832f52f94f12879055151fa38dd751a2 (patch) | |
tree | ae16552100ee2fd368d0a9cb8973e4ce23cd9319 /sw/source/core | |
parent | 97ebbbafd34b3cff69eded5f78abe1505bda94c2 (diff) |
fdo#79602: sw: add new compatibiltiy flag PropLineSpacingShrinksFirstLine
This is enabled by default, to get the new formatting where the first
line of a paragraph is shrunk if a proportional line spacing < 100% is
applied; existing OOo documents get the previous (before LO 3.3)
formatting. Since the formatting in LO releases is broken anyway, it
does not matter much which way documents written by old LO get
formatted.
(cherry picked from commit 9605763e3dc8c85137787c77c31e8639553a35ed)
Conflicts:
sw/source/filter/ww8/ww8par.cxx
Change-Id: I0952f568a933c137bd03070759989cac3517d8b9
Reviewed-on: https://gerrit.libreoffice.org/12157
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/doc/DocumentSettingManager.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentSettingManager.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/uibase/uno/SwXDocumentSettings.cxx | 21 |
4 files changed, 29 insertions, 2 deletions
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 68ff9970b3b6..184b242d0749 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -75,6 +75,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbBackgroundParaOverDrawings(false), mbTabOverMargin(false), mbSurroundTextWrapSmall(false), + mbPropLineSpacingShrinksFirstLine(true), mApplyParagraphMarkFormatToNumbering(false), mbLastBrowseMode( false ) @@ -149,6 +150,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings; case TAB_OVER_MARGIN: return mbTabOverMargin; case SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall; + case PROP_LINE_SPACING_SHRINKS_FIRST_LINE: return mbPropLineSpacingShrinksFirstLine; case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the SwViewShell has to be asked! case HTML_MODE: return mbHTMLMode; @@ -311,6 +313,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo mbSurroundTextWrapSmall = value; break; + case PROP_LINE_SPACING_SHRINKS_FIRST_LINE: + mbPropLineSpacingShrinksFirstLine = value; + break; + // COMPATIBILITY FLAGS END case BROWSE_MODE: //can be used temporary (load/save) when no SwViewShell is available diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 2e8ab4bdf3a3..322627854ba8 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -85,6 +85,7 @@ class DocumentSettingManager : bool mbBackgroundParaOverDrawings; bool mbTabOverMargin; bool mbSurroundTextWrapSmall; + bool mbPropLineSpacingShrinksFirstLine; // fdo#79602 bool mApplyParagraphMarkFormatToNumbering; bool mbLastBrowseMode : 1; diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 4880013a7e4c..9dfa8ad9e4d2 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1743,7 +1743,8 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine ) case SVX_LINE_SPACE_AUTO: // shrink first line of paragraph too on spacing < 100% if (IsParaLine() && - pSpace->GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP) + pSpace->GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP + && GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::PROP_LINE_SPACING_SHRINKS_FIRST_LINE)) { long nTmp = pSpace->GetPropLineSpace(); // Word will render < 50% too but it's just not readable diff --git a/sw/source/core/uibase/uno/SwXDocumentSettings.cxx b/sw/source/core/uibase/uno/SwXDocumentSettings.cxx index 6ab7e5481236..fb64d02bbf13 100644 --- a/sw/source/core/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/core/uibase/uno/SwXDocumentSettings.cxx @@ -123,7 +123,8 @@ enum SwDocumentSettingsPropertyHandles HANDLE_EMBED_SYSTEM_FONTS, HANDLE_TAB_OVER_MARGIN, HANDLE_SURROUND_TEXT_WRAP_SMALL, - HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING + HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, + HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, }; static MasterPropertySetInfo * lcl_createSettingsInfo() @@ -195,6 +196,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0, 0}, { 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}, /* * 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 @@ -802,6 +804,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->set(IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, bTmp); } break; + case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE: + { + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->set( + IDocumentSettingAccess::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, bTmp); + } + } + break; default: throw UnknownPropertyException(); } @@ -1230,6 +1242,13 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue.setValue( &bTmp, ::getBooleanCppuType() ); } break; + case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE: + { + sal_Bool const bTmp(mpDoc->get( + IDocumentSettingAccess::PROP_LINE_SPACING_SHRINKS_FIRST_LINE)); + rValue <<= bTmp; + } + break; default: throw UnknownPropertyException(); } |