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