LibreOffice Module sw (master)  1
glossary.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <hintids.hxx>
21 
22 #include <o3tl/any.hxx>
23 #include <vcl/event.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/weld.hxx>
26 #include <svl/stritem.hxx>
27 #include <svl/macitem.hxx>
28 #include <unotools/pathoptions.hxx>
29 #include <sfx2/request.hxx>
30 #include <sfx2/fcontnr.hxx>
31 #include <sfx2/docfilt.hxx>
32 
33 #include <svx/svxdlg.hxx>
34 #include <editeng/acorrcfg.hxx>
35 #include <sfx2/viewfrm.hxx>
36 #include <unotools.hxx>
38 #include <ucbhelper/content.hxx>
39 #include <com/sun/star/text/AutoTextContainer.hpp>
40 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
41 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
42 #include <svl/urihelper.hxx>
43 #include <unotools/charclass.hxx>
44 #include <swtypes.hxx>
45 #include <wrtsh.hxx>
46 #include <view.hxx>
47 #include <glossary.hxx>
48 #include <gloshdl.hxx>
49 #include <glosbib.hxx>
50 #include <initui.hxx>
51 #include <glosdoc.hxx>
52 #include <macassgn.hxx>
53 #include <docsh.hxx>
54 #include <shellio.hxx>
55 
56 #include <cmdid.h>
57 #include <sfx2/filedlghelper.hxx>
58 
59 #include <memory>
60 
61 #include <strings.hrc>
62 #include <iodetect.hxx>
63 
64 #include <officecfg/Office/Writer.hxx>
65 
66 using namespace ::com::sun::star;
67 using namespace ::com::sun::star::lang;
68 using namespace ::com::sun::star::uno;
69 using namespace ::com::sun::star::text;
70 using namespace ::com::sun::star::ucb;
71 using namespace ::com::sun::star::ui::dialogs;
72 using namespace ::ucbhelper;
73 using namespace ::sfx2;
74 
75 static OUString lcl_GetValidShortCut( const OUString& rName )
76 {
77  const sal_Int32 nSz = rName.getLength();
78 
79  if ( 0 == nSz )
80  return rName;
81 
82  sal_Int32 nStart = 1;
83  while( rName[nStart-1]==' ' && nStart < nSz )
84  nStart++;
85 
86  OUStringBuffer aBuf;
87  aBuf.append(rName[nStart-1]);
88 
89  for( ; nStart < nSz; ++nStart )
90  {
91  if( rName[nStart-1]==' ' && rName[nStart]!=' ')
92  aBuf.append(rName[nStart]);
93  }
94  return aBuf.makeStringAndClear();
95 }
96 
98 {
99  OUString sGroupName;
100  sal_uInt16 nPathIdx;
101  bool bReadonly;
102 
104  : nPathIdx(0),
105  bReadonly(false) {}
106 };
107 
108 // dialog for new block name
110 {
113 
114  std::unique_ptr<weld::Entry> m_xNewName;
115  std::unique_ptr<weld::Entry> m_xNewShort;
116  std::unique_ptr<weld::Button> m_xOk;
117  std::unique_ptr<weld::Entry> m_xOldName;
118  std::unique_ptr<weld::Entry> m_xOldShort;
119 
120 protected:
121  DECL_LINK(Modify, weld::Entry&, void);
122  DECL_LINK(Rename, weld::Button&, void);
123  DECL_LINK(TextFilterHdl, OUString&, bool);
124 
125 public:
127  const OUString& rOldName,
128  const OUString& rOldShort);
129 
130  OUString GetNewName() const { return m_xNewName->get_text(); }
131  OUString GetNewShort() const { return m_xNewShort->get_text(); }
132 };
133 
134 IMPL_LINK(SwNewGlosNameDlg, TextFilterHdl, OUString&, rTest, bool)
135 {
136  rTest = m_aNoSpaceFilter.filter(rTest);
137  return true;
138 }
139 
140 SwNewGlosNameDlg::SwNewGlosNameDlg(SwGlossaryDlg* pParent, const OUString& rOldName, const OUString& rOldShort)
141  : GenericDialogController(pParent->getDialog(), "modules/swriter/ui/renameautotextdialog.ui", "RenameAutoTextDialog")
142  , m_pParent(pParent)
143  , m_xNewName(m_xBuilder->weld_entry("newname"))
144  , m_xNewShort(m_xBuilder->weld_entry("newsc"))
145  , m_xOk(m_xBuilder->weld_button("ok"))
146  , m_xOldName(m_xBuilder->weld_entry("oldname"))
147  , m_xOldShort(m_xBuilder->weld_entry("oldsc"))
148 {
149  m_xNewShort->connect_insert_text(LINK(this, SwNewGlosNameDlg, TextFilterHdl));
150 
151  m_xOldName->set_text(rOldName);
152  m_xOldShort->set_text(rOldShort);
153  m_xNewName->connect_changed(LINK(this, SwNewGlosNameDlg, Modify ));
154  m_xNewShort->connect_changed(LINK(this, SwNewGlosNameDlg, Modify ));
155  m_xOk->connect_clicked(LINK(this, SwNewGlosNameDlg, Rename ));
156  m_xNewName->grab_focus();
157 }
158 
159 // query / set currently set group
161 {
162  if( !::GetCurrGlosGroup().isEmpty() )
164  return SwGlossaries::GetDefName();
165 }
166 
167 void SwGlossaryDlg::SetActGroup(const OUString &rGrp)
168 {
169  ::SetCurrGlosGroup(rGrp);
170 }
171 
172 IMPL_LINK(SwGlossaryDlg, TextFilterHdl, OUString&, rTest, bool)
173 {
174  rTest = m_aNoSpaceFilter.filter(rTest);
175  return true;
176 }
177 
179  SwGlossaryHdl * pGlosHdl, SwWrtShell *pWrtShell)
180  : SfxDialogController(pViewFrame->GetWindow().GetFrameWeld(), "modules/swriter/ui/autotext.ui", "AutoTextDialog")
181  , m_sReadonlyPath(SwResId(STR_READONLY_PATH))
182  , m_pGlossaryHdl(pGlosHdl)
183  , m_bResume(false)
184  , m_bSelection(pWrtShell->IsSelection())
185  , m_bReadOnly(false)
186  , m_bIsOld(false)
187  , m_bIsDocReadOnly(false)
188  , m_pShell(pWrtShell)
189  , m_xInsertTipCB(m_xBuilder->weld_check_button("inserttip"))
190  , m_xNameED(m_xBuilder->weld_entry("name"))
191  , m_xShortNameLbl(m_xBuilder->weld_label("shortnameft"))
192  , m_xShortNameEdit(m_xBuilder->weld_entry("shortname"))
193  , m_xCategoryBox(m_xBuilder->weld_tree_view("category"))
194  , m_xFileRelCB(m_xBuilder->weld_check_button("relfile"))
195  , m_xNetRelCB(m_xBuilder->weld_check_button("relnet"))
196  , m_xInsertBtn(m_xBuilder->weld_button("ok"))
197  , m_xEditBtn(m_xBuilder->weld_menu_button("autotext"))
198  , m_xBibBtn(m_xBuilder->weld_button("categories"))
199  , m_xPathBtn(m_xBuilder->weld_button("path"))
200 {
201  m_xCategoryBox->set_size_request(m_xCategoryBox->get_approximate_digit_width() * 52,
202  m_xCategoryBox->get_height_rows(12));
203 
204  Link<SwOneExampleFrame&,void> aLink(LINK(this, SwGlossaryDlg, PreviewLoadedHdl));
206  m_xExampleFrameWin.reset(new weld::CustomWeld(*m_xBuilder, "example", *m_xExampleFrame));
207  Size aSize = m_xExampleFrame->GetDrawingArea()->get_ref_device().LogicToPixel(
208  Size(82, 124), MapMode(MapUnit::MapAppFont));
209  m_xExampleFrame->set_size_request(aSize.Width(), aSize.Height());
210 
211  m_xShortNameEdit->connect_insert_text(LINK(this, SwGlossaryDlg, TextFilterHdl));
212 
213  m_xEditBtn->connect_toggled(LINK(this, SwGlossaryDlg, EnableHdl));
214  m_xEditBtn->connect_selected(LINK(this, SwGlossaryDlg, MenuHdl));
215  m_xPathBtn->connect_clicked(LINK(this, SwGlossaryDlg, PathHdl));
216 
217  m_xNameED->connect_changed(LINK(this,SwGlossaryDlg,NameModify));
218  m_xShortNameEdit->connect_changed(LINK(this,SwGlossaryDlg,NameModify));
219 
220  m_xCategoryBox->connect_row_activated(LINK(this, SwGlossaryDlg, NameDoubleClick));
221  m_xCategoryBox->connect_changed(LINK(this, SwGlossaryDlg, GrpSelect));
222  m_xCategoryBox->connect_key_press(LINK(this, SwGlossaryDlg, KeyInputHdl));
223  m_xBibBtn->connect_clicked(LINK(this,SwGlossaryDlg,BibHdl));
224 
225  m_xInsertBtn->connect_clicked(LINK(this,SwGlossaryDlg,InsertHdl));
226 
227  ShowPreview();
228 
231  if( m_bIsDocReadOnly )
232  m_xInsertBtn->set_sensitive(false);
233  m_xNameED->grab_focus();
234  m_xCategoryBox->make_sorted();
235  m_xCategoryBox->set_sort_order(true);
236 
237  Init();
238 }
239 
241 {
242 }
243 
244 namespace
245 {
246 
247 OUString getCurrentGlossary()
248 {
249  const OUString sTemp{ ::GetCurrGlosGroup() };
250 
251  // the zeroth path is not being recorded!
252  if (sTemp.getToken(1, GLOS_DELIM).startsWith("0"))
253  return sTemp.getToken(0, GLOS_DELIM);
254 
255  return sTemp;
256 }
257 
258 }
259 
260 // select new group
261 IMPL_LINK(SwGlossaryDlg, GrpSelect, weld::TreeView&, rBox, void)
262 {
263  std::unique_ptr<weld::TreeIter> xEntry = rBox.make_iterator();
264  if (!rBox.get_selected(xEntry.get()))
265  return;
266 
267  std::unique_ptr<weld::TreeIter> xParent = rBox.make_iterator(xEntry.get());
268  weld::TreeIter* pParent;
269  if (rBox.get_iter_depth(*xParent))
270  {
271  rBox.iter_parent(*xParent);
272  pParent = xParent.get();
273  }
274  else
275  pParent = xEntry.get();
276  GroupUserData* pGroupData = reinterpret_cast<GroupUserData*>(rBox.get_id(*pParent).toInt64());
277  ::SetCurrGlosGroup(pGroupData->sGroupName
278  + OUStringChar(GLOS_DELIM)
279  + OUString::number(pGroupData->nPathIdx));
280  m_pGlossaryHdl->SetCurGroup(::GetCurrGlosGroup());
281  // set current text block
282  m_bReadOnly = m_pGlossaryHdl->IsReadOnly();
283  EnableShortName( !m_bReadOnly );
284  m_xEditBtn->set_sensitive(!m_bReadOnly);
285  m_bIsOld = m_pGlossaryHdl->IsOld();
286  if( pParent != xEntry.get())
287  {
288  OUString aName(rBox.get_text(*xEntry));
289  m_xNameED->set_text(aName);
290  m_xShortNameEdit->set_text(rBox.get_id(*xEntry));
291  m_xInsertBtn->set_sensitive( !m_bIsDocReadOnly);
292  ShowAutoText(::GetCurrGlosGroup(), m_xShortNameEdit->get_text());
293  }
294  else
295  {
296  m_xNameED->set_text("");
297  m_xShortNameEdit->set_text("");
298  m_xShortNameEdit->set_sensitive(false);
299  ShowAutoText("", "");
300  }
301  // update controls
302  NameModify(*m_xShortNameEdit);
303  if( SfxRequest::HasMacroRecorder( m_pShell->GetView().GetViewFrame() ) )
304  {
305  SfxRequest aReq( m_pShell->GetView().GetViewFrame(), FN_SET_ACT_GLOSSARY );
306  aReq.AppendItem(SfxStringItem(FN_SET_ACT_GLOSSARY, getCurrentGlossary()));
307  aReq.Done();
308  }
309 }
310 
312 {
313  short nRet = SfxDialogController::run();
314  if (nRet == RET_OK)
315  Apply();
316  return nRet;
317 }
318 
320 {
321  const OUString aGlosName(m_xShortNameEdit->get_text());
322  if (!aGlosName.isEmpty())
323  {
324  m_pGlossaryHdl->InsertGlossary(aGlosName);
325  }
327  {
329  aReq.AppendItem(SfxStringItem(FN_INSERT_GLOSSARY, getCurrentGlossary()));
330  aReq.AppendItem(SfxStringItem(FN_PARAM_1, aGlosName));
331  aReq.Done();
332  }
333 }
334 
336 {
337  m_xShortNameLbl->set_sensitive(bOn);
338  m_xShortNameEdit->set_sensitive(bOn);
339 }
340 
341 // does the title exist in the selected group?
342 std::unique_ptr<weld::TreeIter> SwGlossaryDlg::DoesBlockExist(const OUString& rBlock,
343  const OUString& rShort)
344 {
345  // look for possible entry in TreeListBox
346  std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
347  if (m_xCategoryBox->get_selected(xEntry.get()))
348  {
349  if (m_xCategoryBox->get_iter_depth(*xEntry))
350  m_xCategoryBox->iter_parent(*xEntry);
351  if (!m_xCategoryBox->iter_children(*xEntry))
352  return nullptr;
353  do
354  {
355  if (rBlock == m_xCategoryBox->get_text(*xEntry) &&
356  (rShort.isEmpty() ||
357  rShort == m_xCategoryBox->get_id(*xEntry))
358  )
359  {
360  return xEntry;
361  }
362  }
363  while (m_xCategoryBox->iter_next_sibling(*xEntry));
364  }
365  return nullptr;
366 }
367 
368 IMPL_LINK(SwGlossaryDlg, NameModify, weld::Entry&, rEdit, void)
369 {
370  const OUString aName(m_xNameED->get_text());
371  bool bNameED = &rEdit == m_xNameED.get();
372  if( aName.isEmpty() )
373  {
374  if(bNameED)
375  m_xShortNameEdit->set_text(aName);
376  m_xInsertBtn->set_sensitive(false);
377  return;
378  }
379  const bool bNotFound = !DoesBlockExist(aName, bNameED ? OUString() : rEdit.get_text());
380  if(bNameED)
381  {
382  // did the text get in to the Listbox in the Edit with a click?
383  if(bNotFound)
384  {
385  m_xShortNameEdit->set_text( lcl_GetValidShortCut( aName ) );
386  EnableShortName();
387  }
388  else
389  {
390  m_xShortNameEdit->set_text(m_pGlossaryHdl->GetGlossaryShortName(aName));
391  EnableShortName(!m_bReadOnly);
392  }
393  m_xInsertBtn->set_sensitive(!bNotFound && !m_bIsDocReadOnly);
394  }
395  else
396  {
397  //ShortNameEdit
398  if(!bNotFound)
399  {
400  m_xInsertBtn->set_sensitive(!m_bIsDocReadOnly);
401  }
402  }
403 }
404 
405 IMPL_LINK( SwGlossaryDlg, NameDoubleClick, weld::TreeView&, rBox, bool )
406 {
407  std::unique_ptr<weld::TreeIter> xEntry = rBox.make_iterator();
408  if (rBox.get_selected(xEntry.get()) && rBox.get_iter_depth(*xEntry) && !m_bIsDocReadOnly)
409  m_xDialog->response(RET_OK);
410  return true;
411 }
412 
414 {
415  std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
416  bool bEntry = m_xCategoryBox->get_selected(xEntry.get());
417 
418  const OUString aEditText(m_xNameED->get_text());
419  const bool bHasEntry = !aEditText.isEmpty() && !m_xShortNameEdit->get_text().isEmpty();
420  const bool bExists = nullptr != DoesBlockExist(aEditText, m_xShortNameEdit->get_text());
421  const bool bIsGroup = bEntry && !m_xCategoryBox->get_iter_depth(*xEntry);
422  m_xEditBtn->set_item_visible("new", m_bSelection && bHasEntry && !bExists);
423  m_xEditBtn->set_item_visible("newtext", m_bSelection && bHasEntry && !bExists);
424  m_xEditBtn->set_item_visible("copy", bExists && !bIsGroup);
425  m_xEditBtn->set_item_visible("replace", m_bSelection && bExists && !bIsGroup && !m_bIsOld );
426  m_xEditBtn->set_item_visible("replacetext", m_bSelection && bExists && !bIsGroup && !m_bIsOld );
427  m_xEditBtn->set_item_visible("edit", bExists && !bIsGroup );
428  m_xEditBtn->set_item_visible("rename", bExists && !bIsGroup );
429  m_xEditBtn->set_item_visible("delete", bExists && !bIsGroup );
430  m_xEditBtn->set_item_visible("macro", bExists && !bIsGroup && !m_bIsOld &&
431  !m_pGlossaryHdl->IsReadOnly() );
432  m_xEditBtn->set_item_visible("import", bIsGroup && !m_bIsOld && !m_pGlossaryHdl->IsReadOnly() );
433 }
434 
435 IMPL_LINK(SwGlossaryDlg, MenuHdl, const OString&, rItemIdent, void)
436 {
437  if (rItemIdent == "edit")
438  {
439  std::unique_ptr<SwTextBlocks> pGroup = ::GetGlossaries()->GetGroupDoc ( GetCurrGrpName () );
440  pGroup.reset();
441  m_xDialog->response(RET_EDIT);
442  }
443  else if (rItemIdent == "replace")
444  {
445  m_pGlossaryHdl->NewGlossary(m_xNameED->get_text(),
446  m_xShortNameEdit->get_text());
447  }
448  else if (rItemIdent == "replacetext")
449  {
450  m_pGlossaryHdl->NewGlossary(m_xNameED->get_text(),
451  m_xShortNameEdit->get_text(),
452  false, true);
453  }
454  else if (rItemIdent == "new" || rItemIdent == "newtext")
455  {
456  bool bNoAttr = rItemIdent == "newtext";
457 
458  const OUString aStr(m_xNameED->get_text());
459  const OUString aShortName(m_xShortNameEdit->get_text());
460  if(m_pGlossaryHdl->HasShortName(aShortName))
461  {
462  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
463  VclMessageType::Info, VclButtonsType::Ok,
464  SwResId(STR_DOUBLE_SHORTNAME)));
465  xInfoBox->run();
466  m_xShortNameEdit->select_region(0, -1);
467  m_xShortNameEdit->grab_focus();
468  }
469  if(m_pGlossaryHdl->NewGlossary(aStr, aShortName, false, bNoAttr ))
470  {
471  std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
472  if (!m_xCategoryBox->get_selected(xEntry.get()))
473  xEntry.reset();
474  else if (m_xCategoryBox->get_iter_depth(*xEntry))
475  m_xCategoryBox->iter_parent(*xEntry);
476  m_xCategoryBox->insert(xEntry.get(), -1, &aStr, &aShortName,
477  nullptr, nullptr, false, nullptr);
478 
479  m_xNameED->set_text(aStr);
480  m_xShortNameEdit->set_text(aShortName);
481  NameModify(*m_xNameED); // for toggling the buttons
482 
483  if( SfxRequest::HasMacroRecorder( m_pShell->GetView().GetViewFrame() ) )
484  {
485  SfxRequest aReq(m_pShell->GetView().GetViewFrame(), FN_NEW_GLOSSARY);
486  aReq.AppendItem(SfxStringItem(FN_NEW_GLOSSARY, getCurrentGlossary()));
487  aReq.AppendItem(SfxStringItem(FN_PARAM_1, aShortName));
488  aReq.AppendItem(SfxStringItem(FN_PARAM_2, aStr));
489  aReq.Done();
490  }
491  }
492  }
493  else if (rItemIdent == "copy")
494  {
495  m_pGlossaryHdl->CopyToClipboard(*m_pShell, m_xShortNameEdit->get_text());
496  }
497  else if (rItemIdent == "rename")
498  {
499  m_xShortNameEdit->set_text(m_pGlossaryHdl->GetGlossaryShortName(m_xNameED->get_text()));
500  SwNewGlosNameDlg aNewNameDlg(this, m_xNameED->get_text(), m_xShortNameEdit->get_text());
501  if (aNewNameDlg.run() == RET_OK && m_pGlossaryHdl->Rename(m_xShortNameEdit->get_text(),
502  aNewNameDlg.GetNewShort(),
503  aNewNameDlg.GetNewName()))
504  {
505  std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
506  if (m_xCategoryBox->get_selected(xEntry.get()))
507  {
508  std::unique_ptr<weld::TreeIter> xOldEntry = m_xCategoryBox->make_iterator(xEntry.get());
509  if (m_xCategoryBox->get_iter_depth(*xEntry))
510  m_xCategoryBox->iter_parent(*xEntry);
511 
512  std::unique_ptr<weld::TreeIter> xNewEntry = m_xCategoryBox->make_iterator();
513  OUString sId(aNewNameDlg.GetNewShort());
514  OUString sName(aNewNameDlg.GetNewName());
515 
516  m_xCategoryBox->insert(xEntry.get(), -1, &sName, &sId,
517  nullptr, nullptr, false, xNewEntry.get());
518 
519  m_xCategoryBox->remove(*xOldEntry);
520  m_xCategoryBox->select(*xNewEntry);
521  m_xCategoryBox->scroll_to_row(*xNewEntry);
522  }
523  }
524  GrpSelect(*m_xCategoryBox);
525  }
526  else if (rItemIdent == "delete")
527  {
528  DeleteEntry();
529  }
530  else if (rItemIdent == "macro")
531  {
533 
534  SvxMacro aStart(OUString(), OUString(), STARBASIC);
535  SvxMacro aEnd(OUString(), OUString(), STARBASIC);
536  m_pGlossaryHdl->GetMacros(m_xShortNameEdit->get_text(), aStart, aEnd );
537 
538  SvxMacroItem aItem(RES_FRMMACRO);
539  if( aStart.HasMacro() )
540  aItem.SetMacro( SvMacroItemId::SwStartInsGlossary, aStart );
541  if( aEnd.HasMacro() )
542  aItem.SetMacro( SvMacroItemId::SwEndInsGlossary, aEnd );
543 
544  aSet.Put( aItem );
546 
547  const SfxPoolItem* pItem;
550  m_pShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() ));
551  if ( pMacroDlg && pMacroDlg->Execute() == RET_OK &&
552  SfxItemState::SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, false, &pItem ) )
553  {
554  const SvxMacroTableDtor& rTable = static_cast<const SvxMacroItem*>(pItem)->GetMacroTable();
555  m_pGlossaryHdl->SetMacros( m_xShortNameEdit->get_text(),
556  rTable.Get( SvMacroItemId::SwStartInsGlossary ),
557  rTable.Get( SvMacroItemId::SwEndInsGlossary ) );
558  }
559  }
560  else if (rItemIdent == "import")
561  {
562  // call the FileOpenDialog do find WinWord - Files with templates
563  FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE,
564  FileDialogFlags::NONE, m_xDialog.get());
565  uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
566 
567  SvtPathOptions aPathOpt;
568  xFP->setDisplayDirectory(aPathOpt.GetWorkPath() );
569 
570  SfxFilterMatcher aMatcher( SwDocShell::Factory().GetFactoryName() );
571  SfxFilterMatcherIter aIter( aMatcher );
572  std::shared_ptr<const SfxFilter> pFilter = aIter.First();
573  while ( pFilter )
574  {
575  if( pFilter->GetUserData() == FILTER_WW8 )
576  {
577  xFP->appendFilter( pFilter->GetUIName(),
578  pFilter->GetWildcard().getGlob() );
579  xFP->setCurrentFilter( pFilter->GetUIName() ) ;
580  }
581  else if( pFilter->GetUserData() == FILTER_DOCX )
582  {
583  xFP->appendFilter( pFilter->GetUIName(),
584  pFilter->GetWildcard().getGlob() );
585  xFP->setCurrentFilter( pFilter->GetUIName() ) ;
586  }
587 
588  pFilter = aIter.Next();
589  }
590 
591  if( aDlgHelper.Execute() == ERRCODE_NONE )
592  {
593  if( m_pGlossaryHdl->ImportGlossaries( xFP->getSelectedFiles().getConstArray()[0] ))
594  Init();
595  else
596  {
597  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
598  VclMessageType::Info, VclButtonsType::Ok,
599  SwResId(STR_NO_GLOSSARIES)));
600  xInfoBox->run();
601  }
602  }
603  }
604 }
605 
606 // dialog manage regions
608 {
609  SwGlossaries* pGloss = ::GetGlossaries();
610  if( pGloss->IsGlosPathErr() )
611  pGloss->ShowError();
612  else
613  {
614  //check if at least one glossary path is write enabled
615  SvtPathOptions aPathOpt;
616  const OUString& sGlosPath( aPathOpt.GetAutoTextPath() );
617  bool bIsWritable = false;
618  sal_Int32 nIdx {sGlosPath.isEmpty() ? -1 : 0};
619  while (nIdx>=0)
620  {
621  const OUString sPath = URIHelper::SmartRel2Abs(
622  INetURLObject(), sGlosPath.getToken(0, ';', nIdx),
624  try
625  {
626  Content aTestContent( sPath,
627  uno::Reference< XCommandEnvironment >(),
629  Any aAny = aTestContent.getPropertyValue( "IsReadOnly" );
630  if(aAny.hasValue())
631  {
632  bIsWritable = !*o3tl::doAccess<bool>(aAny);
633  }
634  }
635  catch (const Exception&)
636  {
637  }
638  if(bIsWritable)
639  break;
640  }
641  if(bIsWritable)
642  {
643 
644  SwGlossaryGroupDlg aDlg(m_xDialog.get(), pGloss->GetPathArray(), m_pGlossaryHdl);
645  if (aDlg.run() == RET_OK)
646  {
647  Init();
648  //if new groups were created - select one of them
649  const OUString sNewGroup = aDlg.GetCreatedGroupName();
650 
651  std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
652  bool bEntry = m_xCategoryBox->get_iter_first(*xEntry);
653 
654  while (!sNewGroup.isEmpty() && bEntry)
655  {
656  if (!m_xCategoryBox->get_iter_depth(*xEntry))
657  {
658  GroupUserData* pGroupData = reinterpret_cast<GroupUserData*>(m_xCategoryBox->get_id(*xEntry).toInt64());
659  const OUString sGroup = pGroupData->sGroupName
660  + OUStringChar(GLOS_DELIM)
661  + OUString::number(pGroupData->nPathIdx);
662  if(sGroup == sNewGroup)
663  {
664  m_xCategoryBox->select(*xEntry);
665  m_xCategoryBox->scroll_to_row(*xEntry);
666  GrpSelect(*m_xCategoryBox);
667  break;
668  }
669  }
670  bEntry = m_xCategoryBox->iter_next(*xEntry);
671  }
672 
673  }
674  }
675  else
676  {
677  std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
678  VclMessageType::Question, VclButtonsType::YesNo,
679  m_sReadonlyPath));
680  if (RET_YES == xBox->run())
681  PathHdl(*m_xPathBtn);
682  }
683  }
684 }
685 
686 // initialisation; from Ctor and after editing regions
688 {
689  m_xCategoryBox->freeze();
690  m_xCategoryBox->clear();
691  m_xGroupData.clear();
692  m_xCategoryBox->make_unsorted();
693 
694  // display text block regions
695  const size_t nCnt = m_pGlossaryHdl->GetGroupCnt();
696  std::unique_ptr<weld::TreeIter> xSelEntry;
697  const OUString sSelStr(::GetCurrGlosGroup().getToken(0, GLOS_DELIM));
698  const sal_Int32 nSelPath = ::GetCurrGlosGroup().getToken(1, GLOS_DELIM).toInt32();
699  // #i66304# - "My AutoText" comes from mytexts.bau, but should be translated
700  const OUString sMyAutoTextEnglish("My AutoText");
701  const OUString sMyAutoTextTranslated(SwResId(STR_MY_AUTOTEXT));
702  for(size_t nId = 0; nId < nCnt; ++nId )
703  {
704  OUString sTitle;
705  OUString sGroupName(m_pGlossaryHdl->GetGroupName(nId, &sTitle));
706  if(sGroupName.isEmpty())
707  continue;
708  sal_Int32 nIdx{ 0 };
709  const OUString sName{ sGroupName.getToken( 0, GLOS_DELIM, nIdx ) };
710  if(sTitle.isEmpty())
711  sTitle = sName;
712  if(sTitle == sMyAutoTextEnglish)
713  sTitle = sMyAutoTextTranslated;
714 
715  std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
716  m_xCategoryBox->append(xEntry.get());
717  m_xCategoryBox->set_text(*xEntry, sTitle, 0);
718  const sal_Int32 nPath = sGroupName.getToken( 0, GLOS_DELIM, nIdx ).toInt32();
719 
721  pData->sGroupName = sName;
722  pData->nPathIdx = static_cast< sal_uInt16 >(nPath);
723  pData->bReadonly = m_pGlossaryHdl->IsReadOnly(&sGroupName);
724  m_xGroupData.emplace_back(pData);
725 
726  m_xCategoryBox->set_id(*xEntry, OUString::number(reinterpret_cast<sal_Int64>(pData)));
727  if (sSelStr == pData->sGroupName && nSelPath == nPath)
728  xSelEntry = m_xCategoryBox->make_iterator(xEntry.get());
729 
730  // fill entries for the groups
731  {
732  m_pGlossaryHdl->SetCurGroup(sGroupName, false, true);
733  const sal_uInt16 nCount = m_pGlossaryHdl->GetGlossaryCnt();
734  for(sal_uInt16 i = 0; i < nCount; ++i)
735  {
736  OUString sEntryName = m_pGlossaryHdl->GetGlossaryName(i);
738  m_xCategoryBox->insert(xEntry.get(), -1, &sEntryName, &sId,
739  nullptr, nullptr, false, nullptr);
740  }
741  }
742  }
743  // set current group and display text blocks
744  if (!xSelEntry)
745  {
746  //find a non-readonly group
747  std::unique_ptr<weld::TreeIter> xSearch = m_xCategoryBox->make_iterator();
748  if (m_xCategoryBox->get_iter_first(*xSearch))
749  {
750  do
751  {
752  if (!m_xCategoryBox->get_iter_depth(*xSearch))
753  {
754  GroupUserData* pData = reinterpret_cast<GroupUserData*>(m_xCategoryBox->get_id(*xSearch).toInt64());
755  if (!pData->bReadonly)
756  {
757  xSelEntry = std::move(xSearch);
758  break;
759  }
760  }
761  }
762  while (m_xCategoryBox->iter_next(*xSearch));
763  }
764  if (!xSelEntry)
765  {
766  xSelEntry = std::move(xSearch);
767  if (!m_xCategoryBox->get_iter_first(*xSelEntry))
768  xSelEntry.reset();
769  }
770  }
771 
772  m_xCategoryBox->thaw();
773  m_xCategoryBox->make_sorted();
774 
775  if (xSelEntry)
776  {
777  m_xCategoryBox->expand_row(*xSelEntry);
778  m_xCategoryBox->select(*xSelEntry);
779  m_xCategoryBox->scroll_to_row(*xSelEntry);
780  GrpSelect(*m_xCategoryBox);
781  }
782 
783  const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get();
784  m_xFileRelCB->set_active( rCfg.IsSaveRelFile() );
785  m_xFileRelCB->connect_toggled(LINK(this, SwGlossaryDlg, CheckBoxHdl));
786  m_xNetRelCB->set_active( rCfg.IsSaveRelNet() );
787  m_xNetRelCB->connect_toggled(LINK(this, SwGlossaryDlg, CheckBoxHdl));
788  m_xInsertTipCB->set_active( rCfg.IsAutoTextTip() );
789  m_xInsertTipCB->set_sensitive(!officecfg::Office::Writer::AutoFunction::Text::ShowToolTip::isReadOnly());
790  m_xInsertTipCB->connect_toggled(LINK(this, SwGlossaryDlg, CheckBoxHdl));
791 }
792 
793 // KeyInput for ShortName - Edits without Spaces
794 IMPL_LINK( SwNewGlosNameDlg, Modify, weld::Entry&, rBox, void )
795 {
796  OUString aName(m_xNewName->get_text());
797  SwGlossaryDlg* pDlg = m_pParent;
798  if (&rBox == m_xNewName.get())
799  m_xNewShort->set_text(lcl_GetValidShortCut(aName));
800 
801  bool bEnable = !aName.isEmpty() && !m_xNewShort->get_text().isEmpty() &&
802  (!pDlg->DoesBlockExist(aName, m_xNewShort->get_text())
803  || aName == m_xOldName->get_text());
804  m_xOk->set_sensitive(bEnable);
805 }
806 
808 {
809  SwGlossaryDlg* pDlg = m_pParent;
810  OUString sNew = GetAppCharClass().uppercase(m_xNewShort->get_text());
811  if (pDlg->m_pGlossaryHdl->HasShortName(m_xNewShort->get_text())
812  && sNew != m_xOldShort->get_text())
813  {
814  std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
815  VclMessageType::Info, VclButtonsType::Ok,
816  SwResId(STR_DOUBLE_SHORTNAME)));
817  xBox->run();
818  m_xNewShort->grab_focus();
819  }
820  else
821  m_xDialog->response(RET_OK);
822 }
823 
824 IMPL_LINK(SwGlossaryDlg, CheckBoxHdl, weld::ToggleButton&, rBox, void)
825 {
827  bool bCheck = rBox.get_active();
828  if (&rBox == m_xInsertTipCB.get())
829  rCfg.SetAutoTextTip(bCheck);
830  else if (&rBox == m_xFileRelCB.get())
831  rCfg.SetSaveRelFile(bCheck);
832  else
833  rCfg.SetSaveRelNet(bCheck);
834  rCfg.Commit();
835 }
836 
837 IMPL_LINK(SwGlossaryDlg, KeyInputHdl, const KeyEvent&, rKEvt, bool)
838 {
839  if (rKEvt.GetKeyCode().GetCode() == KEY_DELETE)
840  {
841  DeleteEntry();
842  return true;
843  }
844  return false;
845 }
846 
848 {
849  std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
850  if (m_xCategoryBox->get_selected(xEntry.get()))
851  {
852  if (m_xCategoryBox->get_iter_depth(*xEntry))
853  m_xCategoryBox->iter_parent(*xEntry);
854  GroupUserData* pGroupData = reinterpret_cast<GroupUserData*>(m_xCategoryBox->get_id(*xEntry).toInt64());
855  return pGroupData->sGroupName + OUStringChar(GLOS_DELIM) + OUString::number(pGroupData->nPathIdx);
856  }
857  return OUString();
858 }
859 
861 {
864  SvtPathOptions aPathOpt;
865  const OUString sGlosPath( aPathOpt.GetAutoTextPath() );
866  pDlg->SetPath(sGlosPath);
867  if(RET_OK == pDlg->Execute())
868  {
869  const OUString sTmp(pDlg->GetPath());
870  if(sTmp != sGlosPath)
871  {
872  aPathOpt.SetAutoTextPath( sTmp );
873  ::GetGlossaries()->UpdateGlosPath( true );
874  Init();
875  }
876  }
877 }
878 
880 {
881  m_xDialog->response(RET_OK);
882 }
883 
885 {
887 };
888 
890 {
891  ResumeShowAutoText();
892 }
893 
894 void SwGlossaryDlg::ShowAutoText(const OUString& rGroup, const OUString& rShortName)
895 {
896  if (m_xExampleFrameWin->get_visible())
897  {
898  SetResumeData(rGroup, rShortName);
899  //try to make an Undo()
900  m_xExampleFrame->ClearDocument();
901  }
902 }
903 
905 {
906  OUString sGroup;
907  OUString sShortName;
908  if(GetResumeData(sGroup, sShortName) && m_xExampleFrameWin->get_visible())
909  {
910  if(!m_xAutoText.is())
911  {
912  //now the AutoText ListBoxes have to be filled
913  m_xAutoText = text::AutoTextContainer::create( comphelper::getProcessComponentContext() );
914  }
915 
916  uno::Reference< XTextCursor > & xCursor = m_xExampleFrame->GetTextCursor();
917  if(xCursor.is())
918  {
919  if (!sShortName.isEmpty())
920  {
921  uno::Any aGroup = m_xAutoText->getByName(sGroup);
922  uno::Reference< XAutoTextGroup > xGroup;
923  if((aGroup >>= xGroup) && xGroup->hasByName(sShortName))
924  {
925  uno::Any aEntry(xGroup->getByName(sShortName));
926  uno::Reference< XAutoTextEntry > xEntry;
927  aEntry >>= xEntry;
928  xEntry->applyTo(xCursor);
929  }
930  }
931  }
932  }
933  m_bResume = false;
934 }
935 
937 {
938  bool bEntry = m_xCategoryBox->get_selected(nullptr);
939 
940  const OUString aTitle(m_xNameED->get_text());
941  const OUString aShortName(m_xShortNameEdit->get_text());
942 
943  std::unique_ptr<weld::TreeIter> xParent;
944  std::unique_ptr<weld::TreeIter> xChild = DoesBlockExist(aTitle, aShortName);
945  if (xChild && m_xCategoryBox->get_iter_depth(*xChild))
946  {
947  xParent = m_xCategoryBox->make_iterator(xChild.get());
948  m_xCategoryBox->iter_parent(*xParent);
949  }
950 
951  const bool bExists = nullptr != xChild;
952  const bool bIsGroup = bEntry && !xParent;
953 
954  std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(m_xDialog.get(),
955  VclMessageType::Question, VclButtonsType::YesNo,
956  SwResId(STR_QUERY_DELETE)));
957  if (bExists && !bIsGroup && RET_YES == xQuery->run())
958  {
959  if (!aTitle.isEmpty() && m_pGlossaryHdl->DelGlossary(aShortName))
960  {
961  OSL_ENSURE(xChild, "entry not found!");
962  m_xCategoryBox->select(*xParent);
963  m_xCategoryBox->remove(*xChild);
964  m_xNameED->set_text(OUString());
965  NameModify(*m_xNameED);
966  }
967  }
968 }
969 
970 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const short RET_EDIT
Definition: gloshdl.cxx:50
SfxViewFrame * GetViewFrame() const
bool GetResumeData(OUString &rGroup, OUString &rShortName)
Definition: glossary.hxx:102
bool IsGlosPathErr() const
Definition: glosdoc.hxx:119
static SvxAutoCorrCfg & Get()
void Init()
std::shared_ptr< const SfxFilter > Next()
std::unique_ptr< weld::Entry > m_xOldShort
Definition: glossary.cxx:118
OUString sGroupName
Definition: glossary.cxx:99
std::unique_ptr< ContentProperties > pData
virtual const SfxItemSet * GetOutputItemSet() const =0
OUString GetGlossaryShortName(const OUString &rName)
Definition: gloshdl.cxx:233
bool m_bIsDocReadOnly
Definition: glossary.hxx:59
static SvxAbstractDialogFactory * Create()
void ShowAutoText(const OUString &rGroup, const OUString &rShortName)
Definition: glossary.cxx:894
std::shared_ptr< const SfxFilter > First()
std::unique_ptr< weld::Entry > m_xShortNameEdit
Definition: glossary.hxx:69
sal_uInt16 GetGlossaryCnt() const
Definition: gloshdl.cxx:215
virtual VclPtr< SfxAbstractDialog > CreateEventConfigDialog(weld::Widget *pParent, const SfxItemSet &rAttr, const css::uno::Reference< css::frame::XFrame > &rFrame)=0
aBuf
virtual ~SwGlossaryDlg() override
Definition: glossary.cxx:240
sal_Int16 nId
bool DelGlossary(const OUString &)
Definition: gloshdl.cxx:298
std::unique_ptr< weld::CheckButton > m_xNetRelCB
Definition: glossary.hxx:72
void SetSaveRelNet(bool bSet)
std::unique_ptr< SwTextBlocks > GetGroupDoc(const OUString &rName, bool bCreate=false)
Definition: glosdoc.cxx:157
static void SetActGroup(const OUString &rNewGroup)
Definition: glossary.cxx:167
std::unique_ptr< weld::Button > m_xOk
Definition: glossary.cxx:116
static OUString lcl_GetValidShortCut(const OUString &rName)
Definition: glossary.cxx:75
bool m_bResume
Definition: glossary.hxx:54
virtual void set_text(const OUString &rText)=0
size_t GetGroupCnt() const
Definition: gloshdl.cxx:136
std::unique_ptr< weld::Button > m_xInsertBtn
Definition: glossary.hxx:73
TextFilter m_aNoSpaceFilter
Definition: glossary.cxx:111
IMPL_LINK(SwNewGlosNameDlg, TextFilterHdl, OUString &, rTest, bool)
Definition: glossary.cxx:134
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
bool HasMacro() const
const SwView & GetView() const
Definition: wrtsh.hxx:428
RET_YES
std::unique_ptr< weld::Label > m_xShortNameLbl
Definition: glossary.hxx:67
int nCount
SwNewGlosNameDlg(SwGlossaryDlg *pParent, const OUString &rOldName, const OUString &rOldShort)
Definition: glossary.cxx:140
void SetCurGroup(const OUString &aGrp, bool bApi=false, bool bAlwaysCreateNew=false)
Definition: gloshdl.cxx:92
static bool HasMacroRecorder(SfxViewFrame const *pFrame)
SW_DLLPUBLIC SwGlossaries * GetGlossaries()
Definition: initui.cxx:160
SwGlossaryHdl * m_pGlossaryHdl
Definition: glossary.hxx:50
static SfxEventNamesItem AddEvents(DlgEventType eType)
Definition: macassgn.cxx:38
sal_uInt16 nPathIdx
Definition: glossary.cxx:100
const char * sName
void Apply()
Definition: glossary.cxx:319
static OUString GetCurrGroup()
Definition: glossary.cxx:160
void ShowError()
Definition: glosdoc.cxx:411
OUString GetGlossaryName(sal_uInt16)
Definition: gloshdl.cxx:220
#define FN_INSERT_GLOSSARY
Definition: cmdid.h:583
std::unique_ptr< weld::MenuButton > m_xEditBtn
Definition: glossary.hxx:74
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
virtual short run() override
Definition: glossary.cxx:311
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
std::unique_ptr< weld::Entry > m_xNameED
Definition: glossary.hxx:66
constexpr TypedWhichId< SvxMacroItem > RES_FRMMACRO(108)
OUString GetNewName() const
Definition: glossary.cxx:130
SwGlossaryDlg(SfxViewFrame const *pViewFrame, SwGlossaryHdl *pGlosHdl, SwWrtShell *pWrtShell)
Definition: glossary.cxx:178
bool IsAutoTextTip() const
std::unique_ptr< weld::CustomWeld > m_xExampleFrameWin
Definition: glossary.hxx:78
std::unique_ptr< weld::CheckButton > m_xFileRelCB
Definition: glossary.hxx:71
#define FILTER_DOCX
Definition: iodetect.hxx:38
std::unique_ptr< weld::Button > m_xBibBtn
Definition: glossary.hxx:75
tools::Long Width() const
static OUString GetDefName()
Definition: glosdoc.cxx:90
DECL_LINK(Modify, weld::Entry &, void)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
OUString GetCurrGrpName() const
Definition: glossary.cxx:847
bool IsReadOnly(const OUString *=nullptr) const
Definition: gloshdl.cxx:623
OUString GetGroupName(size_t, OUString *pTitle)
Definition: gloshdl.cxx:141
virtual VclPtr< AbstractSvxMultiPathDialog > CreateSvxPathSelectDialog(weld::Window *pParent)=0
std::unique_ptr< weld::Entry > m_xNewName
Definition: glossary.cxx:114
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
bool IsSaveRelFile() const
Shell * m_pShell
SwWrtShell * m_pShell
Definition: glossary.hxx:61
bool HasReadonlySel() const
Definition: crsrsh.cxx:3336
void EnableShortName(bool bOn=true)
Definition: glossary.cxx:335
std::unique_ptr< weld::TreeView > m_xCategoryBox
Definition: glossary.hxx:70
void UpdateGlosPath(bool bFull)
Definition: glosdoc.cxx:347
SwDocShell * GetDocShell()
Definition: view.cxx:1109
void SetMacro(SvMacroItemId nEvent, const SvxMacro &)
virtual OUString get_text() const =0
bool IsReadOnly() const
#define FILTER_WW8
WinWord 97 filter.
Definition: iodetect.hxx:33
std::unique_ptr< weld::Entry > m_xOldName
Definition: glossary.cxx:117
virtual OUString GetPath() const =0
void SetAutoTextPath(const OUString &rPath)
void SetSaveRelFile(bool bSet)
void ShowPreview()
Definition: glossary.cxx:884
SW_DLLPUBLIC const OUString & GetCurrGlosGroup()
Definition: initui.cxx:46
void ResumeShowAutoText()
Definition: glossary.cxx:904
const OUString & GetWorkPath() const
std::vector< std::unique_ptr< GroupUserData > > m_xGroupData
Definition: glossary.hxx:63
bool InsertGlossary(const OUString &rName)
Definition: gloshdl.cxx:487
bool HasShortName(const OUString &rShortName) const
Definition: gloshdl.cxx:250
css::uno::Reference< css::text::XAutoTextContainer2 > m_xAutoText
Definition: glossary.hxx:48
const SvxMacro * Get(SvMacroItemId nEvent) const
weld::Entry & rEdit
#define FN_SET_ACT_GLOSSARY
Definition: cmdid.h:585
SW_DLLPUBLIC void SetCurrGlosGroup(const OUString &sStr)
Definition: initui.cxx:51
std::vector< OUString > const & GetPathArray() const
Definition: glosdoc.hxx:120
virtual void SetPath(const OUString &rPath)=0
#define ERRCODE_NONE
std::unique_ptr< weld::Entry > m_xNewShort
Definition: glossary.cxx:115
std::unique_ptr< SwOneExampleFrame > m_xExampleFrame
Definition: glossary.hxx:77
OUString aName
RET_OK
Reference< XExecutableDialog > m_xDialog
tools::Long Height() const
Reference< XComponentContext > getProcessComponentContext()
const OUString & GetAutoTextPath() const
#define GLOS_DELIM
Definition: glosdoc.hxx:41
sal_Int32 getToken(const Context &rContext, const char *pToken)
bool m_bReadOnly
void SetAutoTextTip(bool bSet)
void DeleteEntry()
Definition: glossary.cxx:936
std::unique_ptr< weld::CheckButton > m_xInsertTipCB
Definition: glossary.hxx:65
OUString GetNewShort() const
Definition: glossary.cxx:131
OUString sId
void SetResumeData(const OUString &rGroup, const OUString &rShortName)
Definition: glossary.hxx:104
bool IsSaveRelNet() const
std::unique_ptr< weld::TreeIter > DoesBlockExist(const OUString &sBlock, const OUString &rShort)
Definition: glossary.cxx:342
void AppendItem(const SfxPoolItem &)
SwGlossaryDlg * m_pParent
Definition: glossary.cxx:112
constexpr sal_uInt16 KEY_DELETE
std::unique_ptr< weld::Button > m_xPathBtn
Definition: glossary.hxx:76
CharClass & GetAppCharClass()
Definition: init.cxx:708
#define EX_SHOW_ONLINE_LAYOUT
Definition: unotools.hxx:29
STARBASIC
aStr
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
#define FN_NEW_GLOSSARY
Definition: cmdid.h:584
IMPL_LINK_NOARG(SwGlossaryDlg, EnableHdl, weld::ToggleButton &, void)
Definition: glossary.cxx:413
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)