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