38 "ContentControlDialog")
39 , m_rWrtShell(rWrtShell)
40 , m_xShowingPlaceHolderCB(m_xBuilder->weld_check_button(
"showing_place_holder"))
41 , m_xCheckboxFrame(m_xBuilder->weld_frame(
"checkboxframe"))
42 , m_xCheckedState(m_xBuilder->weld_entry(
"checkboxcheckedentry"))
43 , m_xCheckedStateBtn(m_xBuilder->weld_button(
"btncheckboxchecked"))
44 , m_xUncheckedState(m_xBuilder->weld_entry(
"checkboxuncheckedentry"))
45 , m_xUncheckedStateBtn(m_xBuilder->weld_button(
"btncheckboxunchecked"))
46 , m_xListItemsFrame(m_xBuilder->weld_frame(
"listitemsframe"))
47 , m_xListItems(m_xBuilder->weld_tree_view(
"listitems"))
48 , m_xListItemButtons(m_xBuilder->weld_box(
"listitembuttons"))
49 , m_xInsertBtn(m_xBuilder->weld_button(
"add"))
50 , m_xRenameBtn(m_xBuilder->weld_button(
"modify"))
51 , m_xDeleteBtn(m_xBuilder->weld_button(
"remove"))
52 , m_xMoveUpBtn(m_xBuilder->weld_button(
"moveup"))
53 , m_xMoveDownBtn(m_xBuilder->weld_button(
"movedown"))
54 , m_xDateFrame(m_xBuilder->weld_frame(
"dateframe"))
55 , m_xDateFormat(new
SwNumFormatTreeView(m_xBuilder->weld_tree_view(
"date_formats_treeview")))
56 , m_xOk(m_xBuilder->weld_button(
"ok"))
137 if (!sFormatString.isEmpty() && !sLang.isEmpty())
141 sal_uInt32 nFormat = pNumberFormatter->
GetEntryKey(sFormatString, aLangType);
144 sal_Int32 nCheckPos = 0;
146 pNumberFormatter->
PutEntry(sFormatString, nCheckPos, nType, nFormat,
166 if (!m_pContentControl)
171 bool bChanged =
false;
172 if (m_xShowingPlaceHolderCB->get_state_changed_from_saved())
174 bool bShowingPlaceHolder = m_xShowingPlaceHolderCB->get_state() ==
TRISTATE_TRUE;
175 m_pContentControl->SetShowingPlaceHolder(bShowingPlaceHolder);
179 if (m_xCheckedState->get_value_changed_from_saved())
181 m_pContentControl->SetCheckedState(m_xCheckedState->get_text());
184 if (m_xUncheckedState->get_value_changed_from_saved())
186 m_pContentControl->SetUncheckedState(m_xUncheckedState->get_text());
189 std::vector<SwContentControlListItem> aItems;
190 for (
int i = 0;
i < m_xListItems->n_children(); ++
i)
194 aItem.
m_aValue = m_xListItems->get_text(
i, 1);
195 aItems.push_back(aItem);
197 if (aItems != m_aSavedListItems)
199 m_pContentControl->SetListItems(aItems);
203 if (m_pContentControl->GetDate())
216 if (aLanguage != m_pContentControl->GetDateLanguage())
218 m_pContentControl->SetDateLanguage(aLanguage);
226 m_rWrtShell.GetDoc()->getIDocumentState().SetModified();
229 m_rWrtShell.HideCursor();
230 m_rWrtShell.ShowCursor();
241 if (&rButton == m_xCheckedStateBtn.get())
243 cBullet = m_pContentControl->GetCheckedState().iterateCodePoints(&nIndex);
245 else if (&rButton == m_xUncheckedStateBtn.get())
247 cBullet = m_pContentControl->GetUncheckedState().iterateCodePoints(&nIndex);
249 aMap.SetChar(cBullet);
255 cBullet =
aMap.GetChar();
256 if (&rButton == m_xCheckedStateBtn.get())
258 m_xCheckedState->set_text(OUString(&cBullet, 1));
260 else if (&rButton == m_xUncheckedStateBtn.get())
262 m_xUncheckedState->set_text(OUString(&cBullet, 1));
288 int nRow = m_xListItems->n_children();
290 m_xListItems->set_text(nRow, aItem.
m_aValue, 1);
295 int nRow = m_xListItems->get_selected_index();
303 aItem.
m_aValue = m_xListItems->get_text(nRow, 1);
324 m_xListItems->set_text(nRow, aItem.
m_aValue, 1);
329 int nRow = m_xListItems->get_selected_index();
335 m_xListItems->remove(nRow);
340 int nRow = m_xListItems->get_selected_index();
348 aItem.
m_aValue = m_xListItems->get_text(nRow, 1);
349 m_xListItems->remove(nRow);
352 m_xListItems->set_text(nRow, aItem.
m_aValue, 1);
353 m_xListItems->select(nRow);
358 int nRow = m_xListItems->get_selected_index();
359 int nEndPos = m_xListItems->n_children() - 1;
360 if (nRow < 0 || nRow >= nEndPos)
367 aItem.
m_aValue = m_xListItems->get_text(nRow, 1);
368 m_xListItems->remove(nRow);
371 m_xListItems->set_text(nRow, aItem.
m_aValue, 1);
372 m_xListItems->select(nRow);
377 if (!m_xListItems->has_focus())
382 int nRow = m_xListItems->get_selected_index();
385 m_xRenameBtn->set_sensitive(
false);
386 m_xDeleteBtn->set_sensitive(
false);
390 m_xRenameBtn->set_sensitive(
true);
391 m_xDeleteBtn->set_sensitive(
true);
396 m_xMoveUpBtn->set_sensitive(
false);
400 m_xMoveUpBtn->set_sensitive(
true);
403 int nEndPos = m_xListItems->n_children() - 1;
404 if (nRow < 0 || nRow >= nEndPos)
406 m_xMoveDownBtn->set_sensitive(
false);
410 m_xMoveDownBtn->set_sensitive(
true);
std::unique_ptr< weld::Frame > m_xListItemsFrame
#define LINK(Instance, Class, Member)
std::shared_ptr< SwContentControl > m_pContentControl
std::unique_ptr< weld::Button > m_xRenameBtn
Marks a position in the document model.
std::unique_ptr< weld::CheckButton > m_xShowingPlaceHolderCB
std::unique_ptr< weld::Entry > m_xCheckedState
The content control dialog allows editing the properties of the content control under the cursor...
LanguageType getLanguageType(bool bResolveSystem=true) const
std::unique_ptr< weld::Button > m_xOk
SfxPoolItem subclass that wraps an SwContentControl.
std::unique_ptr< weld::Button > m_xInsertBtn
std::unique_ptr< weld::Frame > m_xDateFrame
std::unique_ptr< weld::Button > m_xCheckedStateBtn
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, enum GetTextAttrMode const eMode=DEFAULT) const
get the innermost text attribute covering position nIndex.
virtual short Execute()=0
SwContentControlDlg(weld::Window *pParent, SwWrtShell &rSh)
Used by the UI to modify the document model.
constexpr tools::Long Width() const
HashMap_OWString_Interface aMap
std::unique_ptr< weld::Button > m_xMoveUpBtn
IMPL_LINK(SwContentControlDlg, SelectCharHdl, weld::Button &, rButton, void)
virtual VclPtr< AbstractSwContentControlListItemDlg > CreateSwContentControlListItemDlg(weld::Window *pParent, SwContentControlListItem &rItem)=0
Represents one list item in a content control dropdown list.
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
std::unique_ptr< SwNumFormatTreeView > m_xDateFormat
std::vector< SwContentControlListItem > m_aSavedListItems
virtual ~SwContentControlDlg() override
SwAbstractDialogFactory & GetFactory()
const SwFormatContentControl & GetContentControl() const
#define LANGUAGE_DONTKNOW
std::unique_ptr< weld::Frame > m_xCheckboxFrame
T static_txtattr_cast(S *s)
const SwPosition * Start() const
EXPAND : (Start < nIndex <= End)
SwTextNode is a paragraph in the document model.
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
sal_Int32 GetIndex() const
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Button > m_xMoveDownBtn
virtual int get_height_rows(int nRows) const =0
std::unique_ptr< weld::TreeView > m_xListItems
OUString m_aValue
This must not be empty.
std::unique_ptr< weld::Box > m_xListItemButtons
std::unique_ptr< weld::Button > m_xDeleteBtn
OUString m_aDisplayText
This may be empty, ToString() falls back to m_aValue.
IMPL_LINK_NOARG(SwContentControlDlg, OkHdl, weld::Button &, void)
std::unique_ptr< weld::Entry > m_xUncheckedState
std::unique_ptr< weld::Button > m_xUncheckedStateBtn
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.