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/transfer.hxx>
26#include <vcl/weld.hxx>
27#include <svl/stritem.hxx>
28#include <svl/macitem.hxx>
30#include <sfx2/request.hxx>
31#include <sfx2/fcontnr.hxx>
32#include <sfx2/docfilt.hxx>
33#include <osl/diagnose.h>
34
35#include <svx/svxdlg.hxx>
36#include <editeng/acorrcfg.hxx>
37#include <sfx2/viewfrm.hxx>
38#include <unotools.hxx>
40#include <ucbhelper/content.hxx>
41#include <com/sun/star/text/AutoTextContainer.hpp>
42#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
43#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
44#include <svl/urihelper.hxx>
46#include <swtypes.hxx>
47#include <wrtsh.hxx>
48#include <view.hxx>
49#include <glossary.hxx>
50#include <gloshdl.hxx>
51#include <glosbib.hxx>
52#include <initui.hxx>
53#include <glosdoc.hxx>
54#include <macassgn.hxx>
55#include <docsh.hxx>
56#include <shellio.hxx>
57
58#include <cmdid.h>
60
61#include <memory>
62
63#include <strings.hrc>
64#include <iodetect.hxx>
65
66#include <officecfg/Office/Writer.hxx>
67
68using namespace ::com::sun::star;
69using namespace ::com::sun::star::lang;
70using namespace ::com::sun::star::uno;
71using namespace ::com::sun::star::text;
72using namespace ::com::sun::star::ucb;
73using namespace ::com::sun::star::ui::dialogs;
74using namespace ::ucbhelper;
75using namespace ::sfx2;
76
77static OUString lcl_GetValidShortCut( const OUString& rName )
78{
79 const sal_Int32 nSz = rName.getLength();
80
81 if ( 0 == nSz )
82 return rName;
83
84 sal_Int32 nStart = 1;
85 while( rName[nStart-1]==' ' && nStart < nSz )
86 nStart++;
87
88 OUStringBuffer aBuf(OUString::number(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;
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
121protected:
122 DECL_LINK(Modify, weld::Entry&, void);
123 DECL_LINK(Rename, weld::Button&, void);
124 DECL_LINK(TextFilterHdl, OUString&, bool);
125
126public:
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
135IMPL_LINK(SwNewGlosNameDlg, TextFilterHdl, OUString&, rTest, bool)
136{
137 rTest = m_aNoSpaceFilter.filter(rTest);
138 return true;
139}
140
141SwNewGlosNameDlg::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() )
166}
167
168void SwGlossaryDlg::SetActGroup(const OUString &rGrp)
169{
170 ::SetCurrGlosGroup(rGrp);
171}
172
173IMPL_LINK(SwGlossaryDlg, TextFilterHdl, OUString&, rTest, bool)
174{
175 rTest = m_aNoSpaceFilter.filter(rTest);
176 return true;
177}
178
179class SwGlossaryDropTarget : public DropTargetHelper
180{
181private:
184
185 virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override
186 {
188 if (!pSource || pSource != &m_rTreeView)
189 return DND_ACTION_NONE;
190
191 std::unique_ptr<weld::TreeIter> xSelected(pSource->make_iterator());
192 bool bSelected = pSource->get_selected(xSelected.get());
193 if (!bSelected)
194 return DND_ACTION_NONE;
195
196 while (pSource->get_iter_depth(*xSelected))
197 (void)pSource->iter_parent(*xSelected);
198
199 GroupUserData* pSrcRootData = weld::fromId<GroupUserData*>(pSource->get_id(*xSelected));
200 GroupUserData* pDestRootData = nullptr;
201
202 std::unique_ptr<weld::TreeIter> xDestEntry(m_rTreeView.make_iterator());
203 bool bEntry = m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xDestEntry.get(), true);
204 if (bEntry)
205 {
206 while (m_rTreeView.get_iter_depth(*xDestEntry))
207 (void)m_rTreeView.iter_parent(*xDestEntry);
208 pDestRootData = weld::fromId<GroupUserData*>(m_rTreeView.get_id(*xDestEntry));
209 }
210 if (pDestRootData == pSrcRootData)
211 return DND_ACTION_NONE;
213 const bool bCheckForMove = rEvt.mnAction & DND_ACTION_MOVE;
214 if (bCheckForMove && !pSrcRootData->bReadonly)
215 nRet |= DND_ACTION_MOVE;
216 return nRet;
217 }
218
219 virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override
220 {
222 if (!pSource)
223 return DND_ACTION_NONE;
224
225 std::unique_ptr<weld::TreeIter> xDestEntry(m_rTreeView.make_iterator());
226 bool bEntry = m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xDestEntry.get(), true);
227 if (!bEntry)
228 return DND_ACTION_NONE;
229
230 std::unique_ptr<weld::TreeIter> xSelected(pSource->make_iterator());
231 bool bSelected = pSource->get_selected(xSelected.get());
232 if (!bSelected)
233 return DND_ACTION_NONE;
234
235 std::unique_ptr<weld::TreeIter> xSrcParent(pSource->make_iterator(xSelected.get()));
236 while (pSource->get_iter_depth(*xSrcParent))
237 (void)pSource->iter_parent(*xSrcParent);
238
239 std::unique_ptr<weld::TreeIter> xDestParent(pSource->make_iterator(xDestEntry.get()));
240 while (pSource->get_iter_depth(*xDestParent))
241 (void)pSource->iter_parent(*xDestParent);
242
243 GroupUserData* pSrcParent = weld::fromId<GroupUserData*>(pSource->get_id(*xSrcParent));
244 GroupUserData* pDestParent = weld::fromId<GroupUserData*>(m_rTreeView.get_id(*xDestParent));
245
246 if (pDestParent != pSrcParent)
247 {
249
250 OUString sSourceGroup = pSrcParent->sGroupName
251 + OUStringChar(GLOS_DELIM)
252 + OUString::number(pSrcParent->nPathIdx);
253
254 m_pGlosHdl->SetCurGroup(sSourceGroup);
255 OUString sTitle(pSource->get_text(*xSelected));
256 OUString sShortName(pSource->get_id(*xSelected));
257
258 OUString sDestName = pDestParent->sGroupName
259 + OUStringChar(GLOS_DELIM)
260 + OUString::number(pDestParent->nPathIdx);
261
262 bool bIsMove = rEvt.mnAction & DND_ACTION_MOVE;
263
264 const bool bRet = m_pGlosHdl->CopyOrMove(sSourceGroup, sShortName,
265 sDestName, sTitle, bIsMove);
266
267 if(bRet)
268 {
269 m_rTreeView.insert(xDestParent.get(), -1, &sTitle, &sShortName,
270 nullptr, nullptr, false, nullptr);
271 if (bIsMove)
272 {
273 pSource->remove(*xSelected);
274 }
275 }
276 }
277
278 return DND_ACTION_NONE;
279 }
280
281public:
283 : DropTargetHelper(rTreeView.get_drop_target())
284 , m_rTreeView(rTreeView)
285 , m_pGlosHdl(pGlosHdl)
286 {
287 }
288};
289
291 SwGlossaryHdl * pGlosHdl, SwWrtShell *pWrtShell)
292 : SfxDialogController(rViewFrame.GetFrameWeld(), "modules/swriter/ui/autotext.ui", "AutoTextDialog")
293 , m_sReadonlyPath(SwResId(STR_READONLY_PATH))
294 , m_pGlossaryHdl(pGlosHdl)
295 , m_bResume(false)
296 , m_bSelection(pWrtShell->IsSelection())
297 , m_bReadOnly(false)
298 , m_bIsOld(false)
299 , m_bIsDocReadOnly(false)
300 , m_pShell(pWrtShell)
301 , m_xInsertTipCB(m_xBuilder->weld_check_button("inserttip"))
302 , m_xNameED(m_xBuilder->weld_entry("name"))
303 , m_xShortNameLbl(m_xBuilder->weld_label("shortnameft"))
304 , m_xShortNameEdit(m_xBuilder->weld_entry("shortname"))
305 , m_xCategoryBox(m_xBuilder->weld_tree_view("category"))
306 , m_xFileRelCB(m_xBuilder->weld_check_button("relfile"))
307 , m_xNetRelCB(m_xBuilder->weld_check_button("relnet"))
308 , m_xInsertBtn(m_xBuilder->weld_button("ok"))
309 , m_xEditBtn(m_xBuilder->weld_menu_button("autotext"))
310 , m_xBibBtn(m_xBuilder->weld_button("categories"))
311 , m_xPathBtn(m_xBuilder->weld_button("path"))
312{
313 m_xCategoryBox->set_size_request(m_xCategoryBox->get_approximate_digit_width() * 52,
314 m_xCategoryBox->get_height_rows(12));
315
316 Link<SwOneExampleFrame&,void> aLink(LINK(this, SwGlossaryDlg, PreviewLoadedHdl));
318 m_xExampleFrameWin.reset(new weld::CustomWeld(*m_xBuilder, "example", *m_xExampleFrame));
319 Size aSize = m_xExampleFrame->GetDrawingArea()->get_ref_device().LogicToPixel(
320 Size(82, 124), MapMode(MapUnit::MapAppFont));
321 m_xExampleFrame->set_size_request(aSize.Width(), aSize.Height());
322
323 m_xShortNameEdit->connect_insert_text(LINK(this, SwGlossaryDlg, TextFilterHdl));
324
325 m_xEditBtn->connect_toggled(LINK(this, SwGlossaryDlg, EnableHdl));
326 m_xEditBtn->connect_selected(LINK(this, SwGlossaryDlg, MenuHdl));
327 m_xPathBtn->connect_clicked(LINK(this, SwGlossaryDlg, PathHdl));
328
329 m_xNameED->connect_changed(LINK(this,SwGlossaryDlg,NameModify));
330 m_xShortNameEdit->connect_changed(LINK(this,SwGlossaryDlg,NameModify));
331
332 m_xCategoryBox->connect_row_activated(LINK(this, SwGlossaryDlg, NameDoubleClick));
333 m_xCategoryBox->connect_changed(LINK(this, SwGlossaryDlg, GrpSelect));
334 m_xCategoryBox->connect_key_press(LINK(this, SwGlossaryDlg, KeyInputHdl));
335
338 m_xCategoryBox->enable_drag_source(xHelper, DND_ACTION_COPYMOVE);
339
340 m_xBibBtn->connect_clicked(LINK(this,SwGlossaryDlg,BibHdl));
341
342 m_xInsertBtn->connect_clicked(LINK(this,SwGlossaryDlg,InsertHdl));
343
344 ShowPreview();
345
348 if( m_bIsDocReadOnly )
349 m_xInsertBtn->set_sensitive(false);
350 m_xNameED->grab_focus();
351 m_xCategoryBox->make_sorted();
352 m_xCategoryBox->set_sort_order(true);
353
354 Init();
355}
356
358{
359}
360
361namespace
362{
363
364OUString getCurrentGlossary()
365{
366 const OUString sTemp{ ::GetCurrGlosGroup() };
367
368 // the zeroth path is not being recorded!
369 if (o3tl::starts_with(o3tl::getToken(sTemp, 1, GLOS_DELIM), u"0"))
370 return sTemp.getToken(0, GLOS_DELIM);
371
372 return sTemp;
373}
374
375}
376
377// select new group
378IMPL_LINK(SwGlossaryDlg, GrpSelect, weld::TreeView&, rBox, void)
379{
380 std::unique_ptr<weld::TreeIter> xEntry = rBox.make_iterator();
381 if (!rBox.get_selected(xEntry.get()))
382 return;
383
384 std::unique_ptr<weld::TreeIter> xParent = rBox.make_iterator(xEntry.get());
385 weld::TreeIter* pParent;
386 if (rBox.get_iter_depth(*xParent))
387 {
388 rBox.iter_parent(*xParent);
389 pParent = xParent.get();
390 }
391 else
392 pParent = xEntry.get();
393 GroupUserData* pGroupData = weld::fromId<GroupUserData*>(rBox.get_id(*pParent));
395 + OUStringChar(GLOS_DELIM)
396 + OUString::number(pGroupData->nPathIdx));
397 m_pGlossaryHdl->SetCurGroup(::GetCurrGlosGroup());
398 // set current text block
399 m_bReadOnly = m_pGlossaryHdl->IsReadOnly();
400 EnableShortName( !m_bReadOnly );
401 m_xEditBtn->set_sensitive(!m_bReadOnly);
402 m_bIsOld = m_pGlossaryHdl->IsOld();
403 if( pParent != xEntry.get())
404 {
405 OUString aName(rBox.get_text(*xEntry));
406 m_xNameED->set_text(aName);
407 m_xShortNameEdit->set_text(rBox.get_id(*xEntry));
408 m_xInsertBtn->set_sensitive( !m_bIsDocReadOnly);
409 ShowAutoText(::GetCurrGlosGroup(), m_xShortNameEdit->get_text());
410 }
411 else
412 ShowAutoText("", "");
413 // update controls
414 NameModify(*m_xShortNameEdit);
415 if (SfxRequest::HasMacroRecorder(m_pShell->GetView().GetViewFrame()))
416 {
417 SfxRequest aReq(m_pShell->GetView().GetViewFrame(), FN_SET_ACT_GLOSSARY);
418 aReq.AppendItem(SfxStringItem(FN_SET_ACT_GLOSSARY, getCurrentGlossary()));
419 aReq.Done();
420 }
421}
422
424{
425 short nRet = SfxDialogController::run();
426 if (nRet == RET_OK)
427 Apply();
428 return nRet;
429}
430
432{
433 const OUString aGlosName(m_xShortNameEdit->get_text());
434 if (!aGlosName.isEmpty())
435 {
436 m_pGlossaryHdl->InsertGlossary(aGlosName);
437 }
439 {
441 aReq.AppendItem(SfxStringItem(FN_INSERT_GLOSSARY, getCurrentGlossary()));
442 aReq.AppendItem(SfxStringItem(FN_PARAM_1, aGlosName));
443 aReq.Done();
444 }
445}
446
448{
449 m_xShortNameLbl->set_sensitive(bOn);
450 m_xShortNameEdit->set_sensitive(bOn);
451}
452
453// does the title exist in the selected group?
454std::unique_ptr<weld::TreeIter> SwGlossaryDlg::DoesBlockExist(std::u16string_view rBlock,
455 std::u16string_view rShort)
456{
457 // look for possible entry in TreeListBox
458 std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
459 if (m_xCategoryBox->get_selected(xEntry.get()))
460 {
461 if (m_xCategoryBox->get_iter_depth(*xEntry))
462 m_xCategoryBox->iter_parent(*xEntry);
463 if (!m_xCategoryBox->iter_children(*xEntry))
464 return nullptr;
465 do
466 {
467 if (rBlock == m_xCategoryBox->get_text(*xEntry) &&
468 (rShort.empty() ||
469 rShort == m_xCategoryBox->get_id(*xEntry))
470 )
471 {
472 return xEntry;
473 }
474 }
475 while (m_xCategoryBox->iter_next_sibling(*xEntry));
476 }
477 return nullptr;
478}
479
480IMPL_LINK(SwGlossaryDlg, NameModify, weld::Entry&, rEdit, void)
481{
482 const OUString aName(m_xNameED->get_text());
483 bool bNameED = &rEdit == m_xNameED.get();
484 if( aName.isEmpty() )
485 {
486 if(bNameED)
487 m_xShortNameEdit->set_text(aName);
488 m_xInsertBtn->set_sensitive(false);
489 return;
490 }
491 const bool bNotFound = !DoesBlockExist(aName, bNameED ? OUString() : rEdit.get_text());
492 if(bNameED)
493 {
494 // did the text get in to the Listbox in the Edit with a click?
495 if(bNotFound)
496 {
497 m_xShortNameEdit->set_text( lcl_GetValidShortCut( aName ) );
498 EnableShortName();
499 }
500 else
501 {
502 m_xShortNameEdit->set_text(m_pGlossaryHdl->GetGlossaryShortName(aName));
503 EnableShortName(!m_bReadOnly);
504 }
505 m_xInsertBtn->set_sensitive(!bNotFound && !m_bIsDocReadOnly);
506 }
507 else
508 {
509 //ShortNameEdit
510 if(!bNotFound)
511 {
512 m_xInsertBtn->set_sensitive(!m_bIsDocReadOnly);
513 }
514 }
515}
516
517IMPL_LINK( SwGlossaryDlg, NameDoubleClick, weld::TreeView&, rBox, bool )
518{
519 std::unique_ptr<weld::TreeIter> xEntry = rBox.make_iterator();
520 if (rBox.get_selected(xEntry.get()) && rBox.get_iter_depth(*xEntry) && !m_bIsDocReadOnly)
521 m_xDialog->response(RET_OK);
522 return true;
523}
524
526{
527 std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
528 bool bEntry = m_xCategoryBox->get_selected(xEntry.get());
529
530 const OUString aEditText(m_xNameED->get_text());
531 const bool bHasEntry = !aEditText.isEmpty() && !m_xShortNameEdit->get_text().isEmpty();
532 const bool bExists = nullptr != DoesBlockExist(aEditText, m_xShortNameEdit->get_text());
533 const bool bIsGroup = bEntry && !m_xCategoryBox->get_iter_depth(*xEntry);
534 m_xEditBtn->set_item_visible("new", m_bSelection && bHasEntry && !bExists);
535 m_xEditBtn->set_item_visible("newtext", m_bSelection && bHasEntry && !bExists);
536 m_xEditBtn->set_item_visible("copy", bExists && !bIsGroup);
537 m_xEditBtn->set_item_visible("replace", m_bSelection && bExists && !bIsGroup && !m_bIsOld );
538 m_xEditBtn->set_item_visible("replacetext", m_bSelection && bExists && !bIsGroup && !m_bIsOld );
539 m_xEditBtn->set_item_visible("edit", bExists && !bIsGroup );
540 m_xEditBtn->set_item_visible("rename", bExists && !bIsGroup );
541 m_xEditBtn->set_item_visible("delete", bExists && !bIsGroup );
542 m_xEditBtn->set_item_visible("macro", bExists && !bIsGroup && !m_bIsOld &&
543 !m_pGlossaryHdl->IsReadOnly() );
544 m_xEditBtn->set_item_visible("import", bIsGroup && !m_bIsOld && !m_pGlossaryHdl->IsReadOnly() );
545}
546
547IMPL_LINK(SwGlossaryDlg, MenuHdl, const OUString&, rItemIdent, void)
548{
549 if (rItemIdent == "edit")
550 {
551 std::unique_ptr<SwTextBlocks> pGroup = ::GetGlossaries()->GetGroupDoc ( GetCurrGrpName () );
552 pGroup.reset();
553 m_xDialog->response(RET_EDIT);
554 }
555 else if (rItemIdent == "replace")
556 {
557 m_pGlossaryHdl->NewGlossary(m_xNameED->get_text(),
558 m_xShortNameEdit->get_text());
559 }
560 else if (rItemIdent == "replacetext")
561 {
562 m_pGlossaryHdl->NewGlossary(m_xNameED->get_text(),
563 m_xShortNameEdit->get_text(),
564 false, true);
565 }
566 else if (rItemIdent == "new" || rItemIdent == "newtext")
567 {
568 bool bNoAttr = rItemIdent == "newtext";
569
570 const OUString aStr(m_xNameED->get_text());
571 const OUString aShortName(m_xShortNameEdit->get_text());
572 if(m_pGlossaryHdl->HasShortName(aShortName))
573 {
574 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
575 VclMessageType::Info, VclButtonsType::Ok,
576 SwResId(STR_DOUBLE_SHORTNAME)));
577 xInfoBox->run();
578 m_xShortNameEdit->select_region(0, -1);
579 m_xShortNameEdit->grab_focus();
580 }
581 if(m_pGlossaryHdl->NewGlossary(aStr, aShortName, false, bNoAttr ))
582 {
583 std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
584 if (!m_xCategoryBox->get_selected(xEntry.get()))
585 xEntry.reset();
586 else if (m_xCategoryBox->get_iter_depth(*xEntry))
587 m_xCategoryBox->iter_parent(*xEntry);
588 m_xCategoryBox->insert(xEntry.get(), -1, &aStr, &aShortName,
589 nullptr, nullptr, false, nullptr);
590
591 m_xNameED->set_text(aStr);
592 m_xShortNameEdit->set_text(aShortName);
593 NameModify(*m_xNameED); // for toggling the buttons
594
595 if (SfxRequest::HasMacroRecorder(m_pShell->GetView().GetViewFrame()))
596 {
597 SfxRequest aReq(m_pShell->GetView().GetViewFrame(), FN_NEW_GLOSSARY);
598 aReq.AppendItem(SfxStringItem(FN_NEW_GLOSSARY, getCurrentGlossary()));
599 aReq.AppendItem(SfxStringItem(FN_PARAM_1, aShortName));
600 aReq.AppendItem(SfxStringItem(FN_PARAM_2, aStr));
601 aReq.Done();
602 }
603 }
604 }
605 else if (rItemIdent == "copy")
606 {
607 m_pGlossaryHdl->CopyToClipboard(*m_pShell, m_xShortNameEdit->get_text());
608 }
609 else if (rItemIdent == "rename")
610 {
611 m_xShortNameEdit->set_text(m_pGlossaryHdl->GetGlossaryShortName(m_xNameED->get_text()));
612 SwNewGlosNameDlg aNewNameDlg(this, m_xNameED->get_text(), m_xShortNameEdit->get_text());
613 if (aNewNameDlg.run() == RET_OK && m_pGlossaryHdl->Rename(m_xShortNameEdit->get_text(),
614 aNewNameDlg.GetNewShort(),
615 aNewNameDlg.GetNewName()))
616 {
617 std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
618 if (m_xCategoryBox->get_selected(xEntry.get()))
619 {
620 std::unique_ptr<weld::TreeIter> xOldEntry = m_xCategoryBox->make_iterator(xEntry.get());
621 if (m_xCategoryBox->get_iter_depth(*xEntry))
622 m_xCategoryBox->iter_parent(*xEntry);
623
624 std::unique_ptr<weld::TreeIter> xNewEntry = m_xCategoryBox->make_iterator();
625 OUString sId(aNewNameDlg.GetNewShort());
626 OUString sName(aNewNameDlg.GetNewName());
627
628 m_xCategoryBox->insert(xEntry.get(), -1, &sName, &sId,
629 nullptr, nullptr, false, xNewEntry.get());
630
631 m_xCategoryBox->remove(*xOldEntry);
632 m_xCategoryBox->select(*xNewEntry);
633 m_xCategoryBox->scroll_to_row(*xNewEntry);
634 }
635 }
636 GrpSelect(*m_xCategoryBox);
637 }
638 else if (rItemIdent == "delete")
639 {
640 DeleteEntry();
641 }
642 else if (rItemIdent == "macro")
643 {
645
646 SvxMacro aStart(OUString(), OUString(), STARBASIC);
647 SvxMacro aEnd(OUString(), OUString(), STARBASIC);
648 m_pGlossaryHdl->GetMacros(m_xShortNameEdit->get_text(), aStart, aEnd );
649
651 if( aStart.HasMacro() )
652 aItem.SetMacro( SvMacroItemId::SwStartInsGlossary, aStart );
653 if( aEnd.HasMacro() )
654 aItem.SetMacro( SvMacroItemId::SwEndInsGlossary, aEnd );
655
656 aSet.Put( aItem );
658
659 const SvxMacroItem* pMacroItem;
662 m_pShell->GetView().GetViewFrame().GetFrame().GetFrameInterface() ));
663 if ( pMacroDlg && pMacroDlg->Execute() == RET_OK &&
664 (pMacroItem = pMacroDlg->GetOutputItemSet()->GetItemIfSet( RES_FRMMACRO, false )) )
665 {
666 const SvxMacroTableDtor& rTable = pMacroItem->GetMacroTable();
667 m_pGlossaryHdl->SetMacros( m_xShortNameEdit->get_text(),
668 rTable.Get( SvMacroItemId::SwStartInsGlossary ),
669 rTable.Get( SvMacroItemId::SwEndInsGlossary ) );
670 }
671 }
672 else if (rItemIdent == "import")
673 {
674 // call the FileOpenDialog do find WinWord - Files with templates
675 FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE,
676 FileDialogFlags::NONE, m_xDialog.get());
677 aDlgHelper.SetContext(FileDialogHelper::WriterImportAutotext);
678 uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
679
680 SfxFilterMatcher aMatcher( SwDocShell::Factory().GetFactoryName() );
681 SfxFilterMatcherIter aIter( aMatcher );
682 std::shared_ptr<const SfxFilter> pFilter = aIter.First();
683 while ( pFilter )
684 {
685 if( pFilter->GetUserData() == FILTER_WW8 )
686 {
687 xFP->appendFilter( pFilter->GetUIName(),
688 pFilter->GetWildcard().getGlob() );
689 xFP->setCurrentFilter( pFilter->GetUIName() ) ;
690 }
691 else if( pFilter->GetUserData() == FILTER_DOCX )
692 {
693 xFP->appendFilter( pFilter->GetUIName(),
694 pFilter->GetWildcard().getGlob() );
695 xFP->setCurrentFilter( pFilter->GetUIName() ) ;
696 }
697
698 pFilter = aIter.Next();
699 }
700
701 if( aDlgHelper.Execute() == ERRCODE_NONE )
702 {
703 if( m_pGlossaryHdl->ImportGlossaries( xFP->getSelectedFiles().getConstArray()[0] ))
704 Init();
705 else
706 {
707 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
708 VclMessageType::Info, VclButtonsType::Ok,
709 SwResId(STR_NO_GLOSSARIES)));
710 xInfoBox->run();
711 }
712 }
713 }
714}
715
716// dialog manage regions
718{
719 SwGlossaries* pGloss = ::GetGlossaries();
720 if( pGloss->IsGlosPathErr() )
721 pGloss->ShowError();
722 else
723 {
724 //check if at least one glossary path is write enabled
725 SvtPathOptions aPathOpt;
726 const OUString& sGlosPath( aPathOpt.GetAutoTextPath() );
727 bool bIsWritable = false;
728 sal_Int32 nIdx {sGlosPath.isEmpty() ? -1 : 0};
729 while (nIdx>=0)
730 {
731 const OUString sPath = URIHelper::SmartRel2Abs(
732 INetURLObject(), sGlosPath.getToken(0, ';', nIdx),
734 try
735 {
736 Content aTestContent( sPath,
737 uno::Reference< XCommandEnvironment >(),
739 Any aAny = aTestContent.getPropertyValue( "IsReadOnly" );
740 if(aAny.hasValue())
741 {
742 bIsWritable = !*o3tl::doAccess<bool>(aAny);
743 }
744 }
745 catch (const Exception&)
746 {
747 }
748 if(bIsWritable)
749 break;
750 }
751 if(bIsWritable)
752 {
753
754 SwGlossaryGroupDlg aDlg(m_xDialog.get(), pGloss->GetPathArray(), m_pGlossaryHdl);
755 if (aDlg.run() == RET_OK)
756 {
757 Init();
758 //if new groups were created - select one of them
759 const OUString sNewGroup = aDlg.GetCreatedGroupName();
760
761 std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
762 bool bEntry = m_xCategoryBox->get_iter_first(*xEntry);
763
764 while (!sNewGroup.isEmpty() && bEntry)
765 {
766 if (!m_xCategoryBox->get_iter_depth(*xEntry))
767 {
768 GroupUserData* pGroupData = weld::fromId<GroupUserData*>(m_xCategoryBox->get_id(*xEntry));
769 const OUString sGroup = pGroupData->sGroupName
770 + OUStringChar(GLOS_DELIM)
771 + OUString::number(pGroupData->nPathIdx);
772 if(sGroup == sNewGroup)
773 {
774 m_xCategoryBox->select(*xEntry);
775 m_xCategoryBox->scroll_to_row(*xEntry);
776 GrpSelect(*m_xCategoryBox);
777 break;
778 }
779 }
780 bEntry = m_xCategoryBox->iter_next(*xEntry);
781 }
782
783 }
784 }
785 else
786 {
787 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
788 VclMessageType::Question, VclButtonsType::YesNo,
789 m_sReadonlyPath));
790 if (RET_YES == xBox->run())
791 PathHdl(*m_xPathBtn);
792 }
793 }
794}
795
796// initialisation; from Ctor and after editing regions
798{
799 m_xCategoryBox->freeze();
800 m_xCategoryBox->clear();
801 m_xGroupData.clear();
802 m_xCategoryBox->make_unsorted();
803
804 // display text block regions
805 const size_t nCnt = m_pGlossaryHdl->GetGroupCnt();
806 std::unique_ptr<weld::TreeIter> xSelEntry;
807 const OUString sSelStr(::GetCurrGlosGroup().getToken(0, GLOS_DELIM));
808 const sal_Int32 nSelPath = o3tl::toInt32(o3tl::getToken(::GetCurrGlosGroup(), 1, GLOS_DELIM));
809 // #i66304# - "My AutoText" comes from mytexts.bau, but should be translated
810 static constexpr OUStringLiteral sMyAutoTextEnglish(u"My AutoText");
811 const OUString sMyAutoTextTranslated(SwResId(STR_MY_AUTOTEXT));
812 for(size_t nId = 0; nId < nCnt; ++nId )
813 {
814 OUString sTitle;
815 OUString sGroupName(m_pGlossaryHdl->GetGroupName(nId, &sTitle));
816 if(sGroupName.isEmpty())
817 continue;
818 sal_Int32 nIdx{ 0 };
819 const OUString sName{ sGroupName.getToken( 0, GLOS_DELIM, nIdx ) };
820 if(sTitle.isEmpty())
821 sTitle = sName;
822 if(sTitle == sMyAutoTextEnglish)
823 sTitle = sMyAutoTextTranslated;
824
825 std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
826 m_xCategoryBox->append(xEntry.get());
827 m_xCategoryBox->set_text(*xEntry, sTitle, 0);
828 const sal_Int32 nPath = o3tl::toInt32(o3tl::getToken(sGroupName, 0, GLOS_DELIM, nIdx ));
829
831 pData->sGroupName = sName;
832 pData->nPathIdx = static_cast< sal_uInt16 >(nPath);
833 pData->bReadonly = m_pGlossaryHdl->IsReadOnly(&sGroupName);
834 m_xGroupData.emplace_back(pData);
835
836 m_xCategoryBox->set_id(*xEntry, weld::toId(pData));
837 if (sSelStr == pData->sGroupName && nSelPath == nPath)
838 xSelEntry = m_xCategoryBox->make_iterator(xEntry.get());
839
840 // fill entries for the groups
841 {
842 m_pGlossaryHdl->SetCurGroup(sGroupName, false, true);
843 const sal_uInt16 nCount = m_pGlossaryHdl->GetGlossaryCnt();
844 for(sal_uInt16 i = 0; i < nCount; ++i)
845 {
846 OUString sEntryName = m_pGlossaryHdl->GetGlossaryName(i);
848 m_xCategoryBox->insert(xEntry.get(), -1, &sEntryName, &sId,
849 nullptr, nullptr, false, nullptr);
850 }
851 }
852 }
853 // set current group and display text blocks
854 if (!xSelEntry)
855 {
856 //find a non-readonly group
857 std::unique_ptr<weld::TreeIter> xSearch = m_xCategoryBox->make_iterator();
858 if (m_xCategoryBox->get_iter_first(*xSearch))
859 {
860 do
861 {
862 if (!m_xCategoryBox->get_iter_depth(*xSearch))
863 {
864 GroupUserData* pData = weld::fromId<GroupUserData*>(m_xCategoryBox->get_id(*xSearch));
865 if (!pData->bReadonly)
866 {
867 xSelEntry = std::move(xSearch);
868 break;
869 }
870 }
871 }
872 while (m_xCategoryBox->iter_next(*xSearch));
873 }
874 if (!xSelEntry)
875 {
876 xSelEntry = std::move(xSearch);
877 if (!xSelEntry || !m_xCategoryBox->get_iter_first(*xSelEntry))
878 xSelEntry.reset();
879 }
880 }
881
882 m_xCategoryBox->thaw();
883 m_xCategoryBox->make_sorted();
884
885 if (xSelEntry)
886 {
887 m_xCategoryBox->expand_row(*xSelEntry);
888 m_xCategoryBox->select(*xSelEntry);
889 m_xCategoryBox->scroll_to_row(*xSelEntry);
890 GrpSelect(*m_xCategoryBox);
891 }
892
893 const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get();
894 m_xFileRelCB->set_active( rCfg.IsSaveRelFile() );
895 m_xFileRelCB->connect_toggled(LINK(this, SwGlossaryDlg, CheckBoxHdl));
896 m_xNetRelCB->set_active( rCfg.IsSaveRelNet() );
897 m_xNetRelCB->connect_toggled(LINK(this, SwGlossaryDlg, CheckBoxHdl));
898 m_xInsertTipCB->set_active( rCfg.IsAutoTextTip() );
899 m_xInsertTipCB->set_sensitive(!officecfg::Office::Writer::AutoFunction::Text::ShowToolTip::isReadOnly());
900 m_xInsertTipCB->connect_toggled(LINK(this, SwGlossaryDlg, CheckBoxHdl));
901
902 // tdf#124088 - propose autotext and shortcut name based on selected text
903 if (m_pShell->HasSelection())
904 {
905 OUString aSelText;
907
908 aSelText = aSelText.trim();
909 if (aSelText.getLength() > 25)
910 {
911 aSelText = aSelText.copy(0, 25);
912 if (const sal_Int32 nBlankIndex = aSelText.lastIndexOf(' '); nBlankIndex != -1)
913 aSelText = aSelText.copy(0, nBlankIndex);
914 }
915
916 m_xNameED->set_text(aSelText);
917 m_xNameED->select_region(0, -1);
918 m_xShortNameEdit->set_text(lcl_GetValidShortCut(aSelText));
919 }
920}
921
922// KeyInput for ShortName - Edits without Spaces
923IMPL_LINK( SwNewGlosNameDlg, Modify, weld::Entry&, rBox, void )
924{
925 OUString aName(m_xNewName->get_text());
926 SwGlossaryDlg* pDlg = m_pParent;
927 if (&rBox == m_xNewName.get())
928 m_xNewShort->set_text(lcl_GetValidShortCut(aName));
929
930 bool bEnable = !aName.isEmpty() && !m_xNewShort->get_text().isEmpty() &&
931 (!pDlg->DoesBlockExist(aName, m_xNewShort->get_text())
932 || aName == m_xOldName->get_text());
933 m_xOk->set_sensitive(bEnable);
934}
935
937{
938 SwGlossaryDlg* pDlg = m_pParent;
939 OUString sNew = GetAppCharClass().uppercase(m_xNewShort->get_text());
940 if (pDlg->m_pGlossaryHdl->HasShortName(m_xNewShort->get_text())
941 && sNew != m_xOldShort->get_text())
942 {
943 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
944 VclMessageType::Info, VclButtonsType::Ok,
945 SwResId(STR_DOUBLE_SHORTNAME)));
946 xBox->run();
947 m_xNewShort->grab_focus();
948 }
949 else
950 m_xDialog->response(RET_OK);
951}
952
953IMPL_LINK(SwGlossaryDlg, CheckBoxHdl, weld::Toggleable&, rBox, void)
954{
956 bool bCheck = rBox.get_active();
957 if (&rBox == m_xInsertTipCB.get())
958 rCfg.SetAutoTextTip(bCheck);
959 else if (&rBox == m_xFileRelCB.get())
960 rCfg.SetSaveRelFile(bCheck);
961 else
962 rCfg.SetSaveRelNet(bCheck);
963 rCfg.Commit();
964}
965
966IMPL_LINK(SwGlossaryDlg, KeyInputHdl, const KeyEvent&, rKEvt, bool)
967{
968 if (rKEvt.GetKeyCode().GetCode() == KEY_DELETE)
969 {
970 DeleteEntry();
971 return true;
972 }
973 return false;
974}
975
977{
978 std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
979 if (m_xCategoryBox->get_selected(xEntry.get()))
980 {
981 if (m_xCategoryBox->get_iter_depth(*xEntry))
982 m_xCategoryBox->iter_parent(*xEntry);
983 GroupUserData* pGroupData = weld::fromId<GroupUserData*>(m_xCategoryBox->get_id(*xEntry));
984 return pGroupData->sGroupName + OUStringChar(GLOS_DELIM) + OUString::number(pGroupData->nPathIdx);
985 }
986 return OUString();
987}
988
990{
993 SvtPathOptions aPathOpt;
994 const OUString sGlosPath( aPathOpt.GetAutoTextPath() );
995 pDlg->SetPath(sGlosPath);
996 if(RET_OK == pDlg->Execute())
997 {
998 const OUString sTmp(pDlg->GetPath());
999 if(sTmp != sGlosPath)
1000 {
1001 aPathOpt.SetAutoTextPath( sTmp );
1003 Init();
1004 }
1005 }
1006}
1007
1009{
1010 m_xDialog->response(RET_OK);
1011}
1012
1014{
1016};
1017
1019{
1020 ResumeShowAutoText();
1021}
1022
1023void SwGlossaryDlg::ShowAutoText(const OUString& rGroup, const OUString& rShortName)
1024{
1025 if (m_xExampleFrameWin->get_visible())
1026 {
1027 SetResumeData(rGroup, rShortName);
1028 //try to make an Undo()
1029 m_xExampleFrame->ClearDocument();
1030 }
1031}
1032
1034{
1035 OUString sGroup;
1036 OUString sShortName;
1037 if(GetResumeData(sGroup, sShortName) && m_xExampleFrameWin->get_visible())
1038 {
1039 if(!m_xAutoText.is())
1040 {
1041 //now the AutoText ListBoxes have to be filled
1042 m_xAutoText = text::AutoTextContainer::create( comphelper::getProcessComponentContext() );
1043 }
1044
1045 uno::Reference< XTextCursor > & xCursor = m_xExampleFrame->GetTextCursor();
1046 if(xCursor.is())
1047 {
1048 if (!sShortName.isEmpty())
1049 {
1050 uno::Any aGroup = m_xAutoText->getByName(sGroup);
1051 uno::Reference< XAutoTextGroup > xGroup;
1052 if((aGroup >>= xGroup) && xGroup->hasByName(sShortName))
1053 {
1054 uno::Any aEntry(xGroup->getByName(sShortName));
1055 uno::Reference< XAutoTextEntry > xEntry;
1056 aEntry >>= xEntry;
1057 xEntry->applyTo(xCursor);
1058 }
1059 }
1060 }
1061 }
1062 m_bResume = false;
1063}
1064
1066{
1067 bool bEntry = m_xCategoryBox->get_selected(nullptr);
1068
1069 const OUString aTitle(m_xNameED->get_text());
1070 const OUString aShortName(m_xShortNameEdit->get_text());
1071
1072 std::unique_ptr<weld::TreeIter> xParent;
1073 std::unique_ptr<weld::TreeIter> xChild = DoesBlockExist(aTitle, aShortName);
1074 if (xChild && m_xCategoryBox->get_iter_depth(*xChild))
1075 {
1076 xParent = m_xCategoryBox->make_iterator(xChild.get());
1077 m_xCategoryBox->iter_parent(*xParent);
1078 }
1079
1080 const bool bExists = nullptr != xChild;
1081 const bool bIsGroup = bEntry && !xParent;
1082
1083 std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(m_xDialog.get(),
1084 VclMessageType::Question, VclButtonsType::YesNo,
1085 SwResId(STR_QUERY_DELETE)));
1086 if (bExists && !bIsGroup && RET_YES == xQuery->run())
1087 {
1088 if (!aTitle.isEmpty() && m_pGlossaryHdl->DelGlossary(aShortName))
1089 {
1090 OSL_ENSURE(xChild, "entry not found!");
1091 m_xCategoryBox->select(*xParent);
1092 m_xCategoryBox->remove(*xChild);
1093 m_xNameED->set_text(OUString());
1094 NameModify(*m_xNameED);
1095 }
1096 }
1097}
1098
1099/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
std::shared_ptr< const SfxFilter > First()
std::shared_ptr< const SfxFilter > Next()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool IsReadOnly() const
void AppendItem(const SfxPoolItem &)
static bool HasMacroRecorder(const SfxViewFrame &rFrame)
void Done(bool bRemove=false)
SfxViewFrame & GetViewFrame() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void SetAutoTextPath(const OUString &rPath)
const OUString & GetAutoTextPath() const
virtual VclPtr< AbstractSvxMultiPathDialog > CreateSvxPathSelectDialog(weld::Window *pParent)=0
virtual VclPtr< SfxAbstractDialog > CreateEventConfigDialog(weld::Widget *pParent, const SfxItemSet &rAttr, const css::uno::Reference< css::frame::XFrame > &rFrame)=0
static SvxAbstractDialogFactory * Create()
void SetSaveRelNet(bool bSet)
bool IsSaveRelNet() const
void SetSaveRelFile(bool bSet)
static SvxAutoCorrCfg & Get()
bool IsAutoTextTip() const
bool IsSaveRelFile() const
void SetAutoTextTip(bool bSet)
const SvxMacroTableDtor & GetMacroTable() const
void SetMacro(SvMacroItemId nEvent, const SvxMacro &)
const SvxMacro * Get(SvMacroItemId nEvent) const
bool HasMacro() const
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3662
void GetSelectedText(OUString &rBuf, ParaBreakType nHndlParaBreak=ParaBreakType::ToBlank)
Query text within selection.
Definition: edglss.cxx:249
static OUString GetDefName()
Definition: glosdoc.cxx:91
std::vector< OUString > const & GetPathArray() const
Definition: glosdoc.hxx:124
std::unique_ptr< SwTextBlocks > GetGroupDoc(const OUString &rName, bool bCreate=false)
Definition: glosdoc.cxx:158
bool IsGlosPathErr() const
Definition: glosdoc.hxx:123
void ShowError()
Definition: glosdoc.cxx:412
void UpdateGlosPath(bool bFull)
Definition: glosdoc.cxx:348
SwGlossaryDlg(const SfxViewFrame &rViewFrame, SwGlossaryHdl *pGlosHdl, SwWrtShell *pWrtShell)
Definition: glossary.cxx:290
SwGlossaryHdl * m_pGlossaryHdl
Definition: glossary.hxx:52
std::unique_ptr< weld::CheckButton > m_xFileRelCB
Definition: glossary.hxx:73
std::unique_ptr< weld::MenuButton > m_xEditBtn
Definition: glossary.hxx:76
void ResumeShowAutoText()
Definition: glossary.cxx:1033
std::unique_ptr< SwGlossaryDropTarget > m_xDropTarget
Definition: glossary.hxx:81
bool m_bIsDocReadOnly
Definition: glossary.hxx:61
static void SetActGroup(const OUString &rNewGroup)
Definition: glossary.cxx:168
void Apply()
Definition: glossary.cxx:431
OUString GetCurrGrpName() const
Definition: glossary.cxx:976
std::unique_ptr< weld::CheckButton > m_xInsertTipCB
Definition: glossary.hxx:67
std::unique_ptr< weld::Button > m_xBibBtn
Definition: glossary.hxx:77
void EnableShortName(bool bOn=true)
Definition: glossary.cxx:447
virtual short run() override
Definition: glossary.cxx:423
std::unique_ptr< weld::CheckButton > m_xNetRelCB
Definition: glossary.hxx:74
void DeleteEntry()
Definition: glossary.cxx:1065
std::unique_ptr< weld::Button > m_xPathBtn
Definition: glossary.hxx:78
std::unique_ptr< weld::TreeView > m_xCategoryBox
Definition: glossary.hxx:72
SwWrtShell * m_pShell
Definition: glossary.hxx:63
std::unique_ptr< weld::Entry > m_xShortNameEdit
Definition: glossary.hxx:71
css::uno::Reference< css::text::XAutoTextContainer2 > m_xAutoText
Definition: glossary.hxx:50
void SetResumeData(const OUString &rGroup, const OUString &rShortName)
Definition: glossary.hxx:107
std::unique_ptr< weld::Entry > m_xNameED
Definition: glossary.hxx:68
void ShowAutoText(const OUString &rGroup, const OUString &rShortName)
Definition: glossary.cxx:1023
std::unique_ptr< weld::Button > m_xInsertBtn
Definition: glossary.hxx:75
bool m_bResume
Definition: glossary.hxx:56
std::unique_ptr< SwOneExampleFrame > m_xExampleFrame
Definition: glossary.hxx:79
static OUString GetCurrGroup()
Definition: glossary.cxx:161
std::unique_ptr< weld::TreeIter > DoesBlockExist(std::u16string_view sBlock, std::u16string_view rShort)
Definition: glossary.cxx:454
virtual ~SwGlossaryDlg() override
Definition: glossary.cxx:357
bool GetResumeData(OUString &rGroup, OUString &rShortName)
Definition: glossary.hxx:105
std::unique_ptr< weld::CustomWeld > m_xExampleFrameWin
Definition: glossary.hxx:80
void ShowPreview()
Definition: glossary.cxx:1013
std::unique_ptr< weld::Label > m_xShortNameLbl
Definition: glossary.hxx:69
std::vector< std::unique_ptr< GroupUserData > > m_xGroupData
Definition: glossary.hxx:65
SwGlossaryDropTarget(weld::TreeView &rTreeView, SwGlossaryHdl *pGlosHdl)
Definition: glossary.cxx:282
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: glossary.cxx:185
weld::TreeView & m_rTreeView
Definition: glossary.cxx:182
SwGlossaryHdl * m_pGlosHdl
Definition: glossary.cxx:183
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: glossary.cxx:219
virtual short run() override
Definition: glosbib.cxx:126
const OUString & GetCreatedGroupName() const
Definition: glosbib.hxx:75
bool DelGlossary(const OUString &)
Definition: gloshdl.cxx:323
bool HasShortName(const OUString &rShortName) const
Definition: gloshdl.cxx:275
sal_uInt16 GetGlossaryCnt() const
Definition: gloshdl.cxx:240
bool InsertGlossary(const OUString &rName)
Definition: gloshdl.cxx:512
bool IsReadOnly(const OUString *=nullptr) const
Definition: gloshdl.cxx:648
void SetCurGroup(const OUString &aGrp, bool bApi=false, bool bAlwaysCreateNew=false)
Definition: gloshdl.cxx:95
OUString GetGlossaryShortName(std::u16string_view aName)
Definition: gloshdl.cxx:258
OUString GetGroupName(size_t, OUString *pTitle)
Definition: gloshdl.cxx:144
bool CopyOrMove(const OUString &rSourceGroupName, OUString &rSourceShortName, const OUString &rDestGroupName, const OUString &rLongName, bool bMove)
Definition: gloshdl.cxx:199
size_t GetGroupCnt() const
Definition: gloshdl.cxx:139
OUString GetGlossaryName(sal_uInt16)
Definition: gloshdl.cxx:245
static SfxEventNamesItem AddEvents(DlgEventType eType)
Definition: macassgn.cxx:38
SwGlossaryDlg * m_pParent
Definition: glossary.cxx:113
OUString GetNewShort() const
Definition: glossary.cxx:132
std::unique_ptr< weld::Button > m_xOk
Definition: glossary.cxx:117
TextFilter m_aNoSpaceFilter
Definition: glossary.cxx:112
DECL_LINK(TextFilterHdl, OUString &, bool)
std::unique_ptr< weld::Entry > m_xOldName
Definition: glossary.cxx:118
std::unique_ptr< weld::Entry > m_xNewName
Definition: glossary.cxx:115
std::unique_ptr< weld::Entry > m_xNewShort
Definition: glossary.cxx:116
std::unique_ptr< weld::Entry > m_xOldShort
Definition: glossary.cxx:119
DECL_LINK(Rename, weld::Button &, void)
SwNewGlosNameDlg(SwGlossaryDlg *pParent, const OUString &rOldName, const OUString &rOldShort)
Definition: glossary.cxx:141
DECL_LINK(Modify, weld::Entry &, void)
OUString GetNewName() const
Definition: glossary.cxx:131
SwDocShell * GetDocShell()
Definition: view.cxx:1193
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
bool HasSelection() const
Definition: wrtsh.hxx:147
const SwView & GetView() const
Definition: wrtsh.hxx:443
virtual short run()
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
virtual bool get_selected(TreeIter *pIter) const=0
virtual OUString get_text(int row, int col=-1) const=0
virtual void insert(const TreeIter *pParent, int pos, const OUString *pStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface, bool bChildrenOnDemand, TreeIter *pRet)=0
virtual TreeView * get_drag_source() const=0
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter *pResult, bool bDnDMode, bool bAutoScroll=true)=0
virtual void remove(int pos)=0
virtual bool iter_parent(TreeIter &rIter) const=0
virtual int get_iter_depth(const TreeIter &rIter) const=0
virtual OUString get_id(int pos) const=0
#define FN_NEW_GLOSSARY
Definition: cmdid.h:619
#define FN_SET_ACT_GLOSSARY
Definition: cmdid.h:620
#define FN_INSERT_GLOSSARY
Definition: cmdid.h:618
void Init()
int nCount
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
float u
#define ERRCODE_NONE
OUString sName
#define GLOS_DELIM
Definition: glosdoc.hxx:45
const short RET_EDIT
Definition: gloshdl.cxx:53
IMPL_LINK(SwNewGlosNameDlg, TextFilterHdl, OUString &, rTest, bool)
Definition: glossary.cxx:135
IMPL_LINK_NOARG(SwGlossaryDlg, EnableHdl, weld::Toggleable &, void)
Definition: glossary.cxx:525
static OUString lcl_GetValidShortCut(const OUString &rName)
Definition: glossary.cxx:77
bool m_bReadOnly
constexpr TypedWhichId< SvxMacroItem > RES_FRMMACRO(114)
Shell * m_pShell
CharClass & GetAppCharClass()
Definition: init.cxx:721
SW_DLLPUBLIC SwGlossaries * GetGlossaries()
Definition: initui.cxx:162
SW_DLLPUBLIC void SetCurrGlosGroup(const OUString &sStr)
Definition: initui.cxx:53
SW_DLLPUBLIC const OUString & GetCurrGlosGroup()
Definition: initui.cxx:48
OUString aName
constexpr OUStringLiteral FILTER_WW8
WinWord 97 filter.
Definition: iodetect.hxx:36
constexpr OUStringLiteral FILTER_DOCX
Definition: iodetect.hxx:41
constexpr sal_uInt16 KEY_DELETE
@ MACASSGN_AUTOTEXT
Definition: macassgn.hxx:31
STARBASIC
aStr
aBuf
std::unique_ptr< sal_Int32[]> pData
sal_Int32 getToken(const Context &rContext, const char *pToken)
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
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)
@ Exception
Reference< XComponentContext > getProcessComponentContext()
int i
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OUString toId(const void *pValue)
sal_Int16 nId
sal_Int8 mnAction
OUString sGroupName
Definition: glossary.cxx:100
sal_uInt16 nPathIdx
Definition: glossary.cxx:101
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define DND_ACTION_COPYMOVE
#define DND_ACTION_MOVE
#define DND_ACTION_COPY
#define DND_ACTION_NONE
unsigned char sal_uInt8
signed char sal_Int8
OUString sId
#define EX_SHOW_ONLINE_LAYOUT
Definition: unotools.hxx:33
RET_OK
RET_YES