diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index f3181fea0059..4ad6ee815749 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -512,6 +512,14 @@
1
+
+
+ Content Control Properties
+
+
+ 1
+
+
Set Reminder
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index f4c4ce06e73d..dda2d5b54682 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -139,6 +139,7 @@ $(eval $(call gb_Library_add_exception_objects,swui,\
sw/source/ui/index/multmrk \
sw/source/ui/index/swuiidxmrk \
sw/source/ui/misc/bookmark \
+ sw/source/ui/misc/contentcontroldlg \
sw/source/ui/misc/docfnote \
sw/source/ui/misc/glosbib \
sw/source/ui/misc/glossary \
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index adfd271d4465..4278b5f30437 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -118,6 +118,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/columndialog \
sw/uiconfig/swriter/ui/columnpage \
sw/uiconfig/swriter/ui/columnwidth \
+ sw/uiconfig/swriter/ui/contentcontroldlg \
sw/uiconfig/swriter/ui/combobox \
sw/uiconfig/swriter/ui/comboboxfragment \
sw/uiconfig/swriter/ui/conditionpage \
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index a11bfd4e21df..0e1691d7ec2d 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -222,6 +222,7 @@ class SwUINumRuleItem;
#define FN_INSERT_OBJECT_DLG (FN_INSERT + 22) /* Object */
#define FN_INSERT_PAGEBREAK (FN_INSERT + 23) /* Page break*/
#define FN_INSERT_DROPDOWN_CONTENT_CONTROL (FN_INSERT + 24) /* Dropdown content control */
+#define FN_CONTENT_CONTROL_PROPERTIES (FN_INSERT + 25) /* Content control properties */
#define FN_POSTIT (FN_INSERT + 29) /* Insert/edit PostIt */
#define FN_INSERT_TABLE (FN_INSERT + 30) /* Insert Table */
#define FN_INSERT_STRING (FN_INSERT+31)
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index 09797fd00b0a..adf20db09162 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -69,8 +69,8 @@ public:
*/
void NotifyChangeTextNode(SwTextNode* pTextNode);
static SwFormatContentControl* CreatePoolDefault(sal_uInt16 nWhich);
- SwContentControl* GetContentControl() { return m_pContentControl.get(); }
- const SwContentControl* GetContentControl() const { return m_pContentControl.get(); }
+ std::shared_ptr GetContentControl() { return m_pContentControl; }
+ const std::shared_ptr& GetContentControl() const { return m_pContentControl; }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index cd6d4b3593dd..52964ba91177 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -389,6 +389,7 @@ public:
virtual VclPtr CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh,
SvStream* pStream) = 0;
virtual VclPtr CreateSwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh) = 0;
+ virtual VclPtr CreateSwContentControlDlg(weld::Window *pParent, SwWrtShell &rSh) = 0;
virtual std::shared_ptr CreateSwBreakDlg(weld::Window *pParent, SwWrtShell &rSh) = 0;
virtual VclPtr CreateSwChangeDBDlg(SwView& rVw) = 0;
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index 166a24ae9128..b4fd42352e80 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -342,7 +342,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlInsert)
auto pTextContentControl = static_txtattr_cast(pAttr);
auto& rFormatContentControl
= static_cast(pTextContentControl->GetAttr());
- SwContentControl* pContentControl = rFormatContentControl.GetContentControl();
+ std::shared_ptr pContentControl = rFormatContentControl.GetContentControl();
CPPUNIT_ASSERT(pContentControl->GetShowingPlaceHolder());
}
@@ -459,7 +459,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlCheckbox)
auto pTextContentControl = static_txtattr_cast(pAttr);
auto& rFormatContentControl
= static_cast(pTextContentControl->GetAttr());
- SwContentControl* pContentControl = rFormatContentControl.GetContentControl();
+ std::shared_ptr pContentControl = rFormatContentControl.GetContentControl();
CPPUNIT_ASSERT(pContentControl->GetCheckbox());
CPPUNIT_ASSERT(pContentControl->GetChecked());
CPPUNIT_ASSERT_EQUAL(OUString(u"☒"), pContentControl->GetCheckedState());
@@ -510,7 +510,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlDropdown)
auto pTextContentControl = static_txtattr_cast(pAttr);
auto& rFormatContentControl
= static_cast(pTextContentControl->GetAttr());
- SwContentControl* pContentControl = rFormatContentControl.GetContentControl();
+ std::shared_ptr pContentControl = rFormatContentControl.GetContentControl();
std::vector aListItems = pContentControl->GetListItems();
CPPUNIT_ASSERT_EQUAL(static_cast(3), aListItems.size());
CPPUNIT_ASSERT_EQUAL(OUString("red"), aListItems[0].m_aDisplayText);
diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx
index 2799a8213ead..6faf642e10e4 100644
--- a/sw/qa/uibase/wrtsh/wrtsh.cxx
+++ b/sw/qa/uibase/wrtsh/wrtsh.cxx
@@ -160,7 +160,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControl)
auto pTextContentControl = static_txtattr_cast(pAttr);
auto& rFormatContentControl
= static_cast(pTextContentControl->GetAttr());
- SwContentControl* pContentControl = rFormatContentControl.GetContentControl();
+ std::shared_ptr pContentControl = rFormatContentControl.GetContentControl();
// Without the accompanying fix in place, this test would have failed, the inserted content
// control wasn't a checkbox one.
CPPUNIT_ASSERT(pContentControl->GetCheckbox());
@@ -232,7 +232,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertDropdownContentControl)
auto pTextContentControl = static_txtattr_cast(pAttr);
auto& rFormatContentControl
= static_cast(pTextContentControl->GetAttr());
- SwContentControl* pContentControl = rFormatContentControl.GetContentControl();
+ std::shared_ptr pContentControl = rFormatContentControl.GetContentControl();
// Without the accompanying fix in place, this test would have failed:
// - Expected: 1
// - Actual : 0
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 1995156b79ae..4c4e042e45a5 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -290,6 +290,12 @@ interface BaseText
StateMethod = NoState ;
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
+ FN_CONTENT_CONTROL_PROPERTIES // status(final|play)
+ [
+ ExecMethod = ExecInsert ;
+ StateMethod = GetState ;
+ DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+ ]
FN_INSERT_COLUMN_BREAK // status(final|play)
[
ExecMethod = ExecInsert ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 123404e32c36..4bd53a1557d9 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -3083,6 +3083,23 @@ SfxVoidItem InsertDropdownContentControl FN_INSERT_DROPDOWN_CONTENT_CONTROL
GroupId = SfxGroupId::Insert;
]
+SfxVoidItem ContentControlProperties FN_CONTENT_CONTROL_PROPERTIES
+()
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Insert;
+]
+
SfxVoidItem InsertMultiIndex FN_INSERT_MULTI_TOX
()
[
diff --git a/sw/source/core/crsr/contentcontrolbutton.cxx b/sw/source/core/crsr/contentcontrolbutton.cxx
index c135e25bd188..00deb260981c 100644
--- a/sw/source/core/crsr/contentcontrolbutton.cxx
+++ b/sw/source/core/crsr/contentcontrolbutton.cxx
@@ -14,10 +14,10 @@
#include
-SwContentControlButton::SwContentControlButton(SwEditWin* pEditWin,
- const SwContentControl& rContentControl)
+SwContentControlButton::SwContentControlButton(
+ SwEditWin* pEditWin, const std::shared_ptr& pContentControl)
: Control(pEditWin, WB_DIALOGCONTROL)
- , m_rContentControl(rContentControl)
+ , m_pContentControl(pContentControl)
{
assert(GetParent());
assert(dynamic_cast(GetParent()));
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index bbb20f94ea47..e36cf1671007 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -856,7 +856,7 @@ bool SwCursorShell::GotoFootnoteAnchor(const SwTextFootnote& rTextFootnote)
bool SwCursorShell::GotoFormatContentControl(const SwFormatContentControl& rContentControl)
{
bool bRet = false;
- auto pContentControl = const_cast(rContentControl.GetContentControl());
+ std::shared_ptr pContentControl = rContentControl.GetContentControl();
if (!pContentControl->GetShowingPlaceHolder() && !pContentControl->GetCheckbox()
&& !pContentControl->GetSelectedListItem())
{
diff --git a/sw/source/core/crsr/dropdowncontentcontrolbutton.cxx b/sw/source/core/crsr/dropdowncontentcontrolbutton.cxx
index a1f73dc1b522..2fa456e41ee5 100644
--- a/sw/source/core/crsr/dropdowncontentcontrolbutton.cxx
+++ b/sw/source/core/crsr/dropdowncontentcontrolbutton.cxx
@@ -21,7 +21,7 @@
void SwDropDownContentControlButton::InitDropdown()
{
- std::vector aListItems = m_rContentControl.GetListItems();
+ std::vector aListItems = m_pContentControl->GetListItems();
for (const auto& rListItem : aListItems)
{
@@ -60,17 +60,16 @@ IMPL_LINK(SwDropDownContentControlButton, ListBoxHandler, weld::TreeView&, rBox,
{
SwView& rView = static_cast(GetParent())->GetView();
SwWrtShell& rWrtShell = rView.GetWrtShell();
- auto& rContentControl = const_cast(m_rContentControl);
- rContentControl.SetSelectedListItem(nSelection);
- rWrtShell.GotoContentControl(*m_rContentControl.GetFormatContentControl());
+ m_pContentControl->SetSelectedListItem(nSelection);
+ rWrtShell.GotoContentControl(*m_pContentControl->GetFormatContentControl());
}
return true;
}
SwDropDownContentControlButton::SwDropDownContentControlButton(
- SwEditWin* pEditWin, const SwContentControl& rContentControl)
- : SwContentControlButton(pEditWin, rContentControl)
+ SwEditWin* pEditWin, const std::shared_ptr& pContentControl)
+ : SwContentControlButton(pEditWin, pContentControl)
{
}
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index ff81dd74d8ca..6991ee8a7a95 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -640,7 +640,7 @@ void SwSelPaintRects::HighlightContentControl()
std::vector aContentControlRanges;
std::vector aLOKRectangles;
SwRect aLastPortionPaintArea;
- const SwContentControl* pContentControl = nullptr;
+ std::shared_ptr pContentControl;
if (m_bShowContentControlOverlay)
{
@@ -740,14 +740,14 @@ void SwSelPaintRects::HighlightContentControl()
{
auto& rEditWin = const_cast(pWrtShell->GetView().GetEditWin());
if (m_pContentControlButton
- && &m_pContentControlButton->GetContentControl() != pContentControl)
+ && m_pContentControlButton->GetContentControl() != pContentControl)
{
m_pContentControlButton.disposeAndClear();
}
if (!m_pContentControlButton)
{
m_pContentControlButton = VclPtr::Create(
- &rEditWin, *pContentControl);
+ &rEditWin, pContentControl);
}
m_pContentControlButton->CalcPosAndSize(aLastPortionPaintArea);
m_pContentControlButton->Show();
diff --git a/sw/source/core/inc/contentcontrolbutton.hxx b/sw/source/core/inc/contentcontrolbutton.hxx
index d840887fb460..a921680ed7d4 100644
--- a/sw/source/core/inc/contentcontrolbutton.hxx
+++ b/sw/source/core/inc/contentcontrolbutton.hxx
@@ -20,7 +20,8 @@ class SwContentControl;
class SwContentControlButton : public Control
{
public:
- SwContentControlButton(SwEditWin* pEditWin, const SwContentControl& rContentControl);
+ SwContentControlButton(SwEditWin* pEditWin,
+ const std::shared_ptr& pContentControl);
virtual ~SwContentControlButton() override;
virtual void dispose() override;
@@ -35,13 +36,13 @@ public:
virtual void LaunchPopup();
virtual void DestroyPopup();
- const SwContentControl& GetContentControl() const { return m_rContentControl; }
+ const std::shared_ptr& GetContentControl() const { return m_pContentControl; }
private:
tools::Rectangle m_aFramePixel;
protected:
- const SwContentControl& m_rContentControl;
+ std::shared_ptr m_pContentControl;
std::unique_ptr m_xPopupBuilder;
std::unique_ptr m_xPopup;
};
diff --git a/sw/source/core/inc/dropdowncontentcontrolbutton.hxx b/sw/source/core/inc/dropdowncontentcontrolbutton.hxx
index 5be95ae5adf6..6ca32974e196 100644
--- a/sw/source/core/inc/dropdowncontentcontrolbutton.hxx
+++ b/sw/source/core/inc/dropdowncontentcontrolbutton.hxx
@@ -28,7 +28,8 @@ private:
void InitDropdown();
public:
- SwDropDownContentControlButton(SwEditWin* pEditWin, const SwContentControl& rContentControl);
+ SwDropDownContentControlButton(SwEditWin* pEditWin,
+ const std::shared_ptr& pContentControl);
virtual ~SwDropDownContentControlButton() override;
virtual void LaunchPopup() override;
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index a94a1199cc70..877e8ded562a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -787,7 +787,7 @@ private:
rtl::Reference m_pSectionSpacingAttrList;
rtl::Reference m_pParagraphSpacingAttrList;
rtl::Reference m_pHyperlinkAttrList;
- const SwContentControl* m_pContentControl = nullptr;
+ std::shared_ptr m_pContentControl;
/// If the current SDT around runs should be ended before the current run.
bool m_bEndCharSdt;
/// Attributes of the run color
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 83634fbecb6d..01795a8ff001 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -834,6 +835,12 @@ VclPtr SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDl
return VclPtr::Create(std::make_shared(pParent, rSh));
}
+VclPtr SwAbstractDialogFactory_Impl::CreateSwContentControlDlg(weld::Window* pParent,
+ SwWrtShell &rSh)
+{
+ return VclPtr::Create(std::make_shared(pParent, rSh));
+}
+
std::shared_ptr SwAbstractDialogFactory_Impl::CreateSwBreakDlg(weld::Window* pParent, SwWrtShell &rSh)
{
return std::make_shared(std::make_unique(pParent, rSh));
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 867b37a467f6..6eb68355762c 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -658,6 +658,7 @@ public:
virtual VclPtr CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh,
SvStream* pStream) override;
virtual VclPtr CreateSwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh) override;
+ virtual VclPtr CreateSwContentControlDlg(weld::Window *pParent, SwWrtShell &rSh) override;
virtual std::shared_ptr CreateSwBreakDlg(weld::Window *pParent, SwWrtShell &rSh) override;
virtual VclPtr CreateSwChangeDBDlg(SwView& rVw) override;
virtual VclPtr CreateSwCharDlg(weld::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet,
diff --git a/sw/source/ui/misc/contentcontroldlg.cxx b/sw/source/ui/misc/contentcontroldlg.cxx
new file mode 100644
index 000000000000..d18c3077f24d
--- /dev/null
+++ b/sw/source/ui/misc/contentcontroldlg.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+
+using namespace com::sun::star;
+
+SwContentControlDlg::SwContentControlDlg(weld::Window* pParent, SwWrtShell& rWrtShell)
+ : SfxDialogController(pParent, "modules/swriter/ui/contentcontroldlg.ui",
+ "ContentControlDialog")
+ , m_rWrtShell(rWrtShell)
+ , m_xShowingPlaceHolderCB(m_xBuilder->weld_check_button("showing_place_holder"))
+ , m_xOk(m_xBuilder->weld_button("ok"))
+{
+ m_xOk->connect_clicked(LINK(this, SwContentControlDlg, OkHdl));
+
+ const SwPosition* pStart = rWrtShell.GetCursor()->Start();
+ SwTextNode* pTextNode = pStart->nNode.GetNode().GetTextNode();
+ if (!pTextNode)
+ {
+ return;
+ }
+
+ SwTextAttr* pAttr = pTextNode->GetTextAttrAt(pStart->nContent.GetIndex(),
+ RES_TXTATR_CONTENTCONTROL, SwTextNode::PARENT);
+ if (!pAttr)
+ {
+ return;
+ }
+
+ SwTextContentControl* pTextContentControl = static_txtattr_cast(pAttr);
+ const SwFormatContentControl& rFormatContentControl = pTextContentControl->GetContentControl();
+ m_pContentControl = rFormatContentControl.GetContentControl();
+
+ bool bShowingPlaceHolder = m_pContentControl->GetShowingPlaceHolder();
+ TriState eShowingPlaceHolder = bShowingPlaceHolder ? TRISTATE_TRUE : TRISTATE_FALSE;
+ m_xShowingPlaceHolderCB->set_state(eShowingPlaceHolder);
+ m_xShowingPlaceHolderCB->save_state();
+}
+
+SwContentControlDlg::~SwContentControlDlg() {}
+
+IMPL_LINK_NOARG(SwContentControlDlg, OkHdl, weld::Button&, void)
+{
+ bool bChanged = false;
+ if (m_xShowingPlaceHolderCB->get_state_changed_from_saved())
+ {
+ bool bShowingPlaceHolder = m_xShowingPlaceHolderCB->get_state() == TRISTATE_TRUE;
+ m_pContentControl->SetShowingPlaceHolder(bShowingPlaceHolder);
+ bChanged = true;
+ }
+
+ if (bChanged)
+ {
+ m_rWrtShell.GetDoc()->getIDocumentState().SetModified();
+ }
+
+ m_xDialog->response(RET_OK);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/contentcontroldlg.hxx b/sw/source/uibase/inc/contentcontroldlg.hxx
new file mode 100644
index 000000000000..6b354a39e7c4
--- /dev/null
+++ b/sw/source/uibase/inc/contentcontroldlg.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include
+#include
+
+class SwWrtShell;
+class SwContentControl;
+
+/**
+ * The content control dialog allows editing the properties of the content control under the
+ * cursor.
+ */
+class SwContentControlDlg final : public SfxDialogController
+{
+ SwWrtShell& m_rWrtShell;
+ std::shared_ptr m_pContentControl;
+
+ std::unique_ptr m_xShowingPlaceHolderCB;
+ std::unique_ptr m_xOk;
+
+ DECL_LINK(OkHdl, weld::Button&, void);
+
+public:
+ SwContentControlDlg(weld::Window* pParent, SwWrtShell& rSh);
+ virtual ~SwContentControlDlg() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index ef12a8a9908f..bd624db80afe 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -234,6 +234,18 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
rReq.Done();
break;
+ case FN_CONTENT_CONTROL_PROPERTIES:
+ {
+ SwWrtShell& rWrtSh = GetShell();
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ ScopedVclPtr pDlg(pFact->CreateSwContentControlDlg(GetView().GetFrameWeld(), rWrtSh));
+ VclAbstractDialog::AsyncContext aContext;
+ aContext.maEndDialogFn = [](sal_Int32){};
+ pDlg->StartExecuteAsync(aContext);
+ rReq.Done();
+ break;
+ }
+
case FN_INSERT_COLUMN_BREAK:
rSh.InsertColumnBreak();
rReq.Done();
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index c7686455318e..e74e47a98e39 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -2240,6 +2240,14 @@ void SwTextShell::GetState( SfxItemSet &rSet )
rSet.Put(SfxBoolItem(nWhich, bProtected));
}
break;
+ case FN_CONTENT_CONTROL_PROPERTIES:
+ {
+ if (!GetShell().CursorInsideContentControl())
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
}
nWhich = aIter.NextWhich();
}
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 3a2368015c38..1b9690b84dc8 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3383,7 +3383,7 @@ void SwXTextDocument::executeContentControlEvent(const StringMap& rArguments)
auto pTextContentControl = static_txtattr_cast(pAttr);
const SwFormatContentControl& rFormatContentControl = pTextContentControl->GetContentControl();
- auto pContentControl = const_cast(rFormatContentControl.GetContentControl());
+ std::shared_ptr pContentControl = rFormatContentControl.GetContentControl();
auto it = rArguments.find("type");
if (it == rArguments.end())
{
diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx
index 5225c7278357..c0567d03427b 100644
--- a/sw/source/uibase/wrtsh/wrtsh3.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh3.cxx
@@ -94,7 +94,7 @@ bool SwWrtShell::GotoContentControl(const SwFormatContentControl& rContentContro
bool bRet = SwCursorShell::GotoFormatContentControl(rContentControl);
- auto pContentControl = const_cast(rContentControl.GetContentControl());
+ std::shared_ptr pContentControl = rContentControl.GetContentControl();
if (bRet && pContentControl && pContentControl->GetCheckbox())
{
// Checkbox: GotoFormatContentControl() selected the old state.
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index 14c3705a3189..dda9338ce381 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -715,6 +715,7 @@
+
diff --git a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
index 83b8cd35d98a..147b4dd03d6e 100644
--- a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
+++ b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
@@ -19,6 +19,7 @@
+
diff --git a/sw/uiconfig/swriter/ui/contentcontroldlg.ui b/sw/uiconfig/swriter/ui/contentcontroldlg.ui
new file mode 100644
index 000000000000..5ac95091d71c
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/contentcontroldlg.ui
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+