diff options
author | offtkp <parisoplop@gmail.com> | 2022-12-12 13:03:43 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-12-13 06:44:03 +0000 |
commit | 618cef756b87f9816d0dcbe04af163ccd06a986e (patch) | |
tree | f5412b7eda5f98657e2f2fd8da93fdff686a49f3 /sw/source/uibase/wrtsh | |
parent | 229b0ce8d8453960c213da59770b8bb7b6dca895 (diff) |
docx: Do not remove showingPlcHdr until edit
When a placeholder has the showingPlcHdr attribute, the entire text is
selected upon click. This is no longer removed by selecting it once but
once the text has been edited.
Change-Id: I9a4d68289c8b95ab0098e55a5fa6edb1606c7df2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143985
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/uibase/wrtsh')
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh3.cxx | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index adf96052e8fa..b989343266cb 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -117,6 +117,7 @@ #include <UndoCore.hxx> #include <formatlinebreak.hxx> #include <formatcontentcontrol.hxx> +#include <textcontentcontrol.hxx> using namespace sw::mark; using namespace com::sun::star; @@ -262,6 +263,19 @@ void SwWrtShell::Insert( const OUString &rStr ) bCallIns ? SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr ); + // Check whether node is content control + SwTextContentControl* pTextContentControl = CursorInsideContentControl(); + if (pTextContentControl) + { + std::shared_ptr<SwContentControl> pContentControl = + pTextContentControl->GetContentControl().GetContentControl(); + if (pContentControl) + { + // Set showingPlcHdr to false as node has been edited + pContentControl->SetShowingPlaceHolder(false); + } + } + if( bStarted ) { EndUndo(); diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx index aa170d1374a4..4e80bfc1e3d1 100644 --- a/sw/source/uibase/wrtsh/wrtsh3.cxx +++ b/sw/source/uibase/wrtsh/wrtsh3.cxx @@ -125,10 +125,6 @@ bool SwWrtShell::GotoContentControl(const SwFormatContentControl& rContentContro (this->*m_fnKillSel)(nullptr, false); bool bRet = SwCursorShell::GotoFormatContentControl(rContentControl); - // Assume that once the placeholder is selected, the content is no longer the placeholder. - if (!bOnlyRefresh && pContentControl) - pContentControl->SetShowingPlaceHolder(false); - if (bRet && pContentControl && pContentControl->GetCheckbox()) { |