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