diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2023-02-21 02:34:33 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-02-28 11:30:53 +0000 |
commit | 0bb169dcfa14e6db44bc0eaeabe12d0d3b62ffd8 (patch) | |
tree | 1fc1e56839ee7f9fb9a7d2c9be43c450f3815c97 /editeng | |
parent | 11451781d4c562f506a3aae3732e35b92387b4db (diff) |
tdf#148966: pptx: workaround for multiline fields followed by linebreaks
In Impress after fields that span multiple lines, a
linebreak is already forced. (PowerPoint doesn't have such
behaviour)
Therefore if the imported pptx file has a line break after
the multiline field - Impress ends up displaying an extra
line break.
This patch implements ignoring of a linebreak that follows
after a multiline field during paint (when not in EditMode),
using a compatibility flag. (IgnoreBreakAfterMultilineField)
Change-Id: I1e6772424cc0eead06b53d104b06820038a81ea1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147408
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/outleeng.hxx (renamed from editeng/source/outliner/outleeng.hxx) | 5 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 20 | ||||
-rw-r--r-- | editeng/source/outliner/outleeng.cxx | 12 | ||||
-rw-r--r-- | editeng/source/outliner/outlin2.cxx | 2 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 2 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 2 |
6 files changed, 39 insertions, 4 deletions
diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/inc/outleeng.hxx index d19b54eba06a..449b5ca44ce8 100644 --- a/editeng/source/outliner/outleeng.hxx +++ b/editeng/inc/outleeng.hxx @@ -21,6 +21,8 @@ #include <editeng/outliner.hxx> #include <editeng/editeng.hxx> +enum class SdrCompatibilityFlag; + typedef std::vector<EENotify> NotifyList; class OutlinerEditEng : public EditEngine @@ -75,6 +77,9 @@ public: virtual tools::Rectangle GetBulletArea( sal_Int32 nPara ) override; + /// @returns state of the SdrCompatibilityFlag + std::optional<bool> GetCompatFlag(SdrCompatibilityFlag eFlag) const; + virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override; // belongs into class Outliner, move there before incompatible update! diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 3191b7a874e7..376d1df7ad13 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -24,6 +24,7 @@ #include <vcl/settings.hxx> #include <vcl/window.hxx> +#include <editeng/outliner.hxx> #include <editeng/tstpitem.hxx> #include <editeng/lspcitem.hxx> #include <editeng/flditem.hxx> @@ -44,11 +45,14 @@ #include <editeng/scriptspaceitem.hxx> #include <editeng/charscaleitem.hxx> #include <editeng/numitem.hxx> +#include <outleeng.hxx> #include <svtools/colorcfg.hxx> #include <svl/ctloptions.hxx> #include <svl/asiancfg.hxx> +#include <svx/compatflags.hxx> + #include <editeng/hngpnctitem.hxx> #include <editeng/forbiddencharacterstable.hxx> @@ -3606,6 +3610,22 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po nTextStart = *curIt; nTextLen = nTextLen - nTextStart; bParsingFields = false; + + if (nLine + 1 < nLines) + { + // tdf#148966 don't paint the line break following a + // multiline field based on a compat flag + OutlinerEditEng* pOutlEditEng{ dynamic_cast<OutlinerEditEng*>(pEditEngine) }; + if (pOutlEditEng + && pOutlEditEng->GetCompatFlag(SdrCompatibilityFlag::IgnoreBreakAfterMultilineField) + .value_or(false)) + { + int nStartNextLine = pPortion->GetLines()[nLine + 1].GetStartPortion(); + const TextPortion& rNextTextPortion = pPortion->GetTextPortions()[nStartNextLine]; + if (rNextTextPortion.GetKind() == PortionKind::LINEBREAK) + ++nLine; //ignore the following linebreak + } + } } } diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx index 275636b6581e..0a7f8aef28de 100644 --- a/editeng/source/outliner/outleeng.cxx +++ b/editeng/source/outliner/outleeng.cxx @@ -21,9 +21,10 @@ #include <editeng/eerdll.hxx> #include <editeng/outliner.hxx> -#include "outleeng.hxx" +#include <outleeng.hxx> #include "paralist.hxx" #include <editeng/editrids.hrc> +#include <optional> #include <svl/itemset.hxx> #include <editeng/editstat.hxx> #include "outlundo.hxx" @@ -69,6 +70,15 @@ tools::Rectangle OutlinerEditEng::GetBulletArea( sal_Int32 nPara ) return aBulletArea; } +std::optional<bool> OutlinerEditEng::GetCompatFlag(SdrCompatibilityFlag eFlag) const +{ + if(pOwner) + { + return pOwner->GetCompatFlag(eFlag); + } + return {}; +} + void OutlinerEditEng::ParagraphInserted( sal_Int32 nNewParagraph ) { pOwner->ParagraphInserted( nNewParagraph ); diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index 68b1d0fb802e..013c680df152 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -30,7 +30,7 @@ #include <editeng/outliner.hxx> #include "paralist.hxx" -#include "outleeng.hxx" +#include <outleeng.hxx> #include <editeng/editstat.hxx> diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 84097ae2a14b..fa0e7958ce79 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -30,7 +30,7 @@ #include <editeng/outliner.hxx> #include "paralist.hxx" #include <editeng/outlobj.hxx> -#include "outleeng.hxx" +#include <outleeng.hxx> #include "outlundo.hxx" #include <editeng/eeitem.hxx> #include <editeng/editstat.hxx> diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index d5f426abbf53..705b5e10b06b 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -30,7 +30,7 @@ #include <i18nlangtag/languagetag.hxx> #include <editeng/outliner.hxx> -#include "outleeng.hxx" +#include <outleeng.hxx> #include "paralist.hxx" #include "outlundo.hxx" #include <editeng/outlobj.hxx> |