LibreOffice Module sw (master) 1
swuiidxmrk.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 <swuiidxmrk.hxx>
21#include <hintids.hxx>
22#include <helpids.h>
23#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
25#include <com/sun/star/beans/PropertyValue.hpp>
26#include <com/sun/star/beans/XPropertySet.hpp>
27#include <com/sun/star/frame/Bibliography.hpp>
28#include <com/sun/star/i18n/IndexEntrySupplier.hpp>
29#include <com/sun/star/util/SearchAlgorithms2.hpp>
30#include <com/sun/star/util/SearchFlags.hpp>
31#include <com/sun/star/uri/UriReferenceFactory.hpp>
32#include <rtl/ustrbuf.hxx>
34#include <utility>
35#include <vcl/svapp.hxx>
36#include <vcl/weld.hxx>
37#include <sfx2/dispatch.hxx>
38#include <sfx2/viewfrm.hxx>
39#include <svl/itemset.hxx>
40#include <editeng/langitem.hxx>
41#include <osl/diagnose.h>
42#include <o3tl/string_view.hxx>
43#include <swtypes.hxx>
44#include <toxmgr.hxx>
45#include <txttxmrk.hxx>
46#include <wrtsh.hxx>
47#include <view.hxx>
48#include <swundo.hxx>
49#include <cmdid.h>
50#include <swmodule.hxx>
51#include <fldmgr.hxx>
52#include <fldbas.hxx>
53#include <strings.hrc>
54#include <svl/cjkoptions.hxx>
56#include <ndtxt.hxx>
57#include <SwRewriter.hxx>
58#include <doc.hxx>
59#include <docsh.hxx>
60
61#define POS_CONTENT 0
62#define POS_INDEX 1
63
64static sal_Int32 nTypePos = 1; // TOX_INDEX as standard
65static sal_uInt16 nKey1Pos = USHRT_MAX;
66
67static sal_uInt16 nKey2Pos = USHRT_MAX;
68
69using namespace com::sun::star;
70using namespace com::sun::star::i18n;
71using namespace com::sun::star::lang;
72using namespace com::sun::star::util;
73using namespace ::comphelper;
74
75namespace
76{
77bool SplitUrlAndPage(const OUString& rText, OUString& rUrl, int& nPageNumber)
78{
79 uno::Reference<uri::XUriReferenceFactory> xUriReferenceFactory
80 = uri::UriReferenceFactory::create(comphelper::getProcessComponentContext());
81 uno::Reference<uri::XUriReference> xUriRef;
82 try
83 {
84 xUriRef = xUriReferenceFactory->parse(rText);
85 }
86 catch (const uno::Exception& rException)
87 {
88 SAL_WARN("sw.ui", "SplitUrlAndPage: failed to parse url: " << rException.Message);
89 return false;
90 }
91
92 OUString aPagePrefix("page=");
93 if (!xUriRef->getFragment().startsWith(aPagePrefix))
94 {
95 return false;
96 }
97
98 nPageNumber = o3tl::toInt32(xUriRef->getFragment().subView(aPagePrefix.getLength()));
99 xUriRef->clearFragment();
100 rUrl = xUriRef->getUriReference();
101 return true;
102}
103
104OUString MergeUrlAndPage(const OUString& rUrl, const std::unique_ptr<weld::SpinButton>& xPageSB)
105{
106 if (!xPageSB->get_sensitive())
107 {
108 return rUrl;
109 }
110
111 uno::Reference<uri::XUriReferenceFactory> xUriReferenceFactory
112 = uri::UriReferenceFactory::create(comphelper::getProcessComponentContext());
113 uno::Reference<uri::XUriReference> xUriRef;
114 try
115 {
116 xUriRef = xUriReferenceFactory->parse(rUrl);
117 }
118 catch (const uno::Exception& rException)
119 {
120 SAL_WARN("sw.ui", "MergeUrlAndPage: failed to parse url: " << rException.Message);
121 return rUrl;
122 }
123
124 OUString aFragment("page=" + OUString::number(xPageSB->get_value()));
125 xUriRef->setFragment(aFragment);
126 return xUriRef->getUriReference();
127}
128}
129
130// dialog to insert a directory selection
131SwIndexMarkPane::SwIndexMarkPane(std::shared_ptr<weld::Dialog> xDialog, weld::Builder& rBuilder, bool bNewDlg,
132 SwWrtShell* pWrtShell)
133 : m_xDialog(std::move(xDialog))
134 , m_bDel(false)
135 , m_bNewMark(bNewDlg)
136 , m_bSelected(false)
137 , m_bPhoneticED0_ChangedByUser(false)
138 , m_bPhoneticED1_ChangedByUser(false)
139 , m_bPhoneticED2_ChangedByUser(false)
140 , m_nLangForPhoneticReading(LANGUAGE_CHINESE_SIMPLIFIED)
141 , m_bIsPhoneticReadingEnabled(false)
142 , m_pSh(pWrtShell)
143 , m_xTypeFT(rBuilder.weld_label("typeft"))
144 , m_xTypeDCB(rBuilder.weld_combo_box("typecb"))
145 , m_xNewBT(rBuilder.weld_button("new"))
146 , m_xEntryED(rBuilder.weld_entry("entryed"))
147 , m_xSyncED(rBuilder.weld_button("sync"))
148 , m_xPhoneticFT0(rBuilder.weld_label("phonetic0ft"))
149 , m_xPhoneticED0(rBuilder.weld_entry("phonetic0ed"))
150 , m_xKey1FT(rBuilder.weld_label("key1ft"))
151 , m_xKey1DCB(rBuilder.weld_combo_box("key1cb"))
152 , m_xPhoneticFT1(rBuilder.weld_label("phonetic1ft"))
153 , m_xPhoneticED1(rBuilder.weld_entry("phonetic1ed"))
154 , m_xKey2FT(rBuilder.weld_label("key2ft"))
155 , m_xKey2DCB(rBuilder.weld_combo_box("key2cb"))
156 , m_xPhoneticFT2(rBuilder.weld_label("phonetic2ft"))
157 , m_xPhoneticED2(rBuilder.weld_entry("phonetic2ed"))
158 , m_xLevelFT(rBuilder.weld_label("levelft"))
159 , m_xLevelNF(rBuilder.weld_spin_button("levelnf"))
160 , m_xMainEntryCB(rBuilder.weld_check_button("mainentrycb"))
161 , m_xApplyToAllCB(rBuilder.weld_check_button("applytoallcb"))
162 , m_xSearchCaseSensitiveCB(rBuilder.weld_check_button("searchcasesensitivecb"))
163 , m_xSearchCaseWordOnlyCB(rBuilder.weld_check_button("searchcasewordonlycb"))
164 , m_xOKBT(bNewDlg ? rBuilder.weld_button("insert") : rBuilder.weld_button("ok"))
165 , m_xCloseBT(rBuilder.weld_button("close"))
166 , m_xDelBT(rBuilder.weld_button("delete"))
167 , m_xPrevSameBT(rBuilder.weld_button("first"))
168 , m_xNextSameBT(rBuilder.weld_button("last"))
169 , m_xPrevBT(rBuilder.weld_button("previous"))
170 , m_xNextBT(rBuilder.weld_button("next"))
171{
172 m_xSyncED->show();
173
175 {
176 uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
177
178 m_xExtendedIndexEntrySupplier = i18n::IndexEntrySupplier::create(xContext);
179
180 m_xPhoneticFT0->show();
181 m_xPhoneticED0->show();
182 m_xPhoneticFT1->show();
183 m_xPhoneticED1->show();
184 m_xPhoneticFT2->show();
185 m_xPhoneticED2->show();
186 }
187
188 // tdf#129726 there are two help pages for this dialog, one for each mode,
189 // where a widget/dialog appears in both, use -insert/-edit to disambiguate
190 if (m_bNewMark)
191 {
192 m_xDialog->set_title(SwResId(STR_IDXMRK_INSERT));
193 m_xDialog->set_help_id(m_xDialog->get_help_id() + "-insert");
194 m_xTypeDCB->set_help_id(m_xTypeDCB->get_help_id() + "-insert");
195 }
196 else
197 {
198 m_xDialog->set_title(SwResId(STR_IDXMRK_EDIT));
199 m_xDialog->set_help_id(m_xDialog->get_help_id() + "-edit");
200 m_xTypeDCB->set_help_id(m_xTypeDCB->get_help_id() + "-edit");
201 }
202
203 m_xDelBT->connect_clicked(LINK(this,SwIndexMarkPane, DelHdl));
204 m_xPrevBT->connect_clicked(LINK(this,SwIndexMarkPane, PrevHdl));
205 m_xPrevSameBT->connect_clicked(LINK(this,SwIndexMarkPane, PrevSameHdl));
206 m_xNextBT->connect_clicked(LINK(this,SwIndexMarkPane, NextHdl));
207 m_xNextSameBT->connect_clicked(LINK(this,SwIndexMarkPane, NextSameHdl));
208 m_xTypeDCB->connect_changed(LINK(this,SwIndexMarkPane, ModifyListBoxHdl));
209 m_xKey1DCB->connect_changed(LINK(this,SwIndexMarkPane, KeyDCBModifyHdl));
210 m_xKey2DCB->connect_changed(LINK(this,SwIndexMarkPane, KeyDCBModifyHdl));
211 m_xCloseBT->connect_clicked(LINK(this,SwIndexMarkPane, CloseHdl));
212 m_xEntryED->connect_changed(LINK(this,SwIndexMarkPane, ModifyEditHdl));
213 m_xNewBT->connect_clicked(LINK(this, SwIndexMarkPane, NewUserIdxHdl));
214 m_xApplyToAllCB->connect_toggled(LINK(this, SwIndexMarkPane, SearchTypeHdl));
215 m_xPhoneticED0->connect_changed(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
216 m_xPhoneticED1->connect_changed(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
217 m_xPhoneticED2->connect_changed(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
218 m_xSyncED->connect_clicked(LINK(this, SwIndexMarkPane, SyncSelectionHdl));
219
220 if (m_bNewMark)
221 m_xDelBT->hide();
222 else
223 m_xNewBT->hide();
224 m_xOKBT->show();
225 m_xOKBT->connect_clicked(LINK(this, SwIndexMarkPane, InsertHdl));
226
227 m_xEntryED->grab_focus();
228}
229
230// Newly initialise controls with the new selection
232{
233 assert(m_pSh && m_pTOXMgr && "no shell?");
234 // contents index
235 const SwTOXType* pType = m_pTOXMgr->GetTOXType(TOX_CONTENT);
236 assert(pType && "No directory type !!");
237 OUString sTmpTypeSelection;
238 if (m_xTypeDCB->get_active() != -1)
239 sTmpTypeSelection = m_xTypeDCB->get_active_text();
240 m_xTypeDCB->clear();
241 m_xTypeDCB->append_text(pType->GetTypeName());
242
243 // keyword index
244 pType = m_pTOXMgr->GetTOXType(TOX_INDEX);
245 assert(pType && "No directory type !!");
246 m_xTypeDCB->append_text(pType->GetTypeName());
247
248 // user index
249 sal_uInt16 nCount = m_pSh->GetTOXTypeCount(TOX_USER);
250 for (sal_uInt16 i = 0; i < nCount; ++i)
251 m_xTypeDCB->append_text(m_pSh->GetTOXType(TOX_USER, i)->GetTypeName());
252
253 // read keywords primary
254 {
255 std::vector<OUString> aArr;
257 std::sort(aArr.begin(), aArr.end());
258 auto last = std::unique(aArr.begin(), aArr.end());
259 for (auto it = aArr.begin(); it != last; ++it)
260 m_xKey1DCB->append_text(*it);
261 }
262
263 // read keywords secondary
264 {
265 std::vector<OUString> aArr;
267 std::sort(aArr.begin(), aArr.end());
268 auto last = std::unique(aArr.begin(), aArr.end());
269 for (auto it = aArr.begin(); it != last; ++it)
270 m_xKey2DCB->append_text(*it);
271 }
272
274
275 // current entry
276 const SwTOXMark* pMark = m_pTOXMgr->GetCurTOXMark();
277 if( pMark && !m_bNewMark)
278 {
279 // Controls-Handling
280
281 // only if there are more than one
282 // if equal it lands at the same entry
284
285 const SwTOXMark* pMoveMark;
286 bool bShow = false;
287
288 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_PRV );
289 if( pMoveMark != pMark )
290 {
291 m_pSh->GotoTOXMark( *pMoveMark, TOX_NXT );
292 bShow = true;
293 }
294 m_xPrevBT->set_sensitive(pMoveMark != pMark);
295 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_NXT );
296 if( pMoveMark != pMark )
297 {
298 m_pSh->GotoTOXMark( *pMoveMark, TOX_PRV );
299 bShow = true;
300 }
301 m_xNextBT->set_sensitive(pMoveMark != pMark);
302 if( bShow )
303 {
304 m_xPrevBT->show();
305 m_xNextBT->show();
306 bShow = false;
307 }
308
309 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
310 if( pMoveMark != pMark )
311 {
312 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT );
313 bShow = true;
314 }
315 m_xPrevSameBT->set_sensitive(pMoveMark != pMark);
316 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
317 if( pMoveMark != pMark )
318 {
319 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV );
320 bShow = true;
321 }
322 m_xNextSameBT->set_sensitive(pMoveMark != pMark);
323 if( bShow )
324 {
325 m_xNextSameBT->show();
326 m_xPrevSameBT->show();
327 }
329
330 m_xTypeFT->show();
331
332 m_xTypeDCB->set_sensitive(false);
333 m_xTypeFT->set_sensitive(false);
334
335 UpdateDialog();
336 }
337 else
338 { // display current selection (first element) ????
339 if (m_pSh->GetCursorCnt() < 2)
340 {
343 m_xEntryED->set_text(m_aOrgStr);
344
345 //to include all equal entries may only be allowed in the body and even there
346 //only when a simple selection exists
347 const FrameTypeFlags nFrameType = m_pSh->GetFrameType(nullptr,true);
348 m_xApplyToAllCB->show();
351 m_xApplyToAllCB->set_sensitive(!m_aOrgStr.isEmpty() &&
353 SearchTypeHdl(*m_xApplyToAllCB);
354 }
355
356 // index type is default
357 if (!sTmpTypeSelection.isEmpty() && m_xTypeDCB->find_text(sTmpTypeSelection) != -1)
358 m_xTypeDCB->set_active_text(sTmpTypeSelection);
359 else
360 m_xTypeDCB->set_active_text(m_xTypeDCB->get_text(nTypePos));
362 }
363}
364
366{
367 //no phonetic reading if no global cjk support
369 {
371 return;
372 }
374
375 //get the current language
376 if(!m_bNewMark) //if dialog is opened to iterate existing marks
377 {
378 OSL_ENSURE(m_pTOXMgr, "need TOXMgr");
379 if(!m_pTOXMgr)
380 return;
381 SwTOXMark* pMark = m_pTOXMgr->GetCurTOXMark();
382 OSL_ENSURE(pMark, "need current SwTOXMark");
383 if(!pMark)
384 return;
385 SwTextTOXMark* pTextTOXMark = pMark->GetTextTOXMark();
386 OSL_ENSURE(pTextTOXMark, "need current SwTextTOXMark");
387 if(!pTextTOXMark)
388 return;
389 const SwTextNode* pTextNode = pTextTOXMark->GetpTextNd();
390 OSL_ENSURE(pTextNode, "need current SwTextNode");
391 if(!pTextNode)
392 return;
393 sal_Int32 nTextIndex = pTextTOXMark->GetStart();
394 m_nLangForPhoneticReading = pTextNode->GetLang( nTextIndex );
395 }
396 else //if dialog is opened to create a new mark
397 {
398 sal_uInt16 nWhich;
399 switch(m_pSh->GetScriptType())
400 {
401 case SvtScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break;
402 case SvtScriptType::COMPLEX:nWhich = RES_CHRATR_CTL_LANGUAGE; break;
403 default:nWhich = RES_CHRATR_LANGUAGE; break;
404 }
405 SfxItemSet aLangSet(m_pSh->GetAttrPool(), nWhich, nWhich);
406 m_pSh->GetCurAttr(aLangSet);
407 m_nLangForPhoneticReading = static_cast<const SvxLanguageItem&>(aLangSet.Get(nWhich)).GetLanguage();
408 }
409
410}
411
412OUString SwIndexMarkPane::GetDefaultPhoneticReading( const OUString& rText )
413{
415 return OUString();
416
418}
419
421{
422 // display current selection (first element) ????
423 if (m_bNewMark)
424 {
425 m_xSyncED->set_sensitive(m_pSh->GetCursorCnt() < 2);
426 }
427}
428
430{
431 m_bSelected = !m_pSh->HasSelection();
432 m_aOrgStr = m_pSh->GetView().GetSelectionTextParam(true, false);
433 m_xEntryED->set_text(m_aOrgStr);
434
435 //to include all equal entries may only be allowed in the body and even there
436 //only when a simple selection exists
437 const FrameTypeFlags nFrameType = m_pSh->GetFrameType(nullptr,true);
438 m_xApplyToAllCB->show();
439 m_xSearchCaseSensitiveCB->show();
440 m_xSearchCaseWordOnlyCB->show();
441 m_xApplyToAllCB->set_sensitive(!m_aOrgStr.isEmpty() &&
443 SearchTypeHdl(*m_xApplyToAllCB);
444 ModifyHdl(*m_xEntryED);
445}
446
447// evaluate Ok-Button
449{
450 InsertUpdate();
451 if(m_bSelected)
452 m_pSh->ResetSelect(nullptr, false);
453}
454
455// apply changes
457{
460 SwRewriter aRewriter;
461
462 if( m_bNewMark )
463 {
464 InsertMark();
465
466 if ( m_pTOXMgr->GetCurTOXMark())
467 aRewriter.AddRule(UndoArg1,
468 m_pTOXMgr->GetCurTOXMark()->GetText(m_pSh->GetLayout()));
469 }
470 else if( !m_pSh->HasReadonlySel() )
471 {
472 if ( m_pTOXMgr->GetCurTOXMark())
473 aRewriter.AddRule(UndoArg1,
474 m_pTOXMgr->GetCurTOXMark()->GetText(m_pSh->GetLayout()));
475
476 if( m_bDel )
477 m_pTOXMgr->DeleteTOXMark();
478 else if( m_pTOXMgr->GetCurTOXMark() )
479 UpdateMark();
480 }
481
484
485 nTypePos = m_xTypeDCB->find_text(m_xTypeDCB->get_active_text());
486 if(nTypePos == -1)
487 nTypePos = 0;
488
489 nKey1Pos = m_xKey1DCB->find_text(m_xKey1DCB->get_active_text());
490 nKey2Pos = m_xKey2DCB->find_text(m_xKey2DCB->get_active_text());
491}
492
493// insert mark
494static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSensitive)
495{
496 rSh.Push();
497
498 i18nutil::SearchOptions2 aSearchOpt(
499 SearchAlgorithms_ABSOLUTE,
500 ( bWordOnly ? SearchFlags::NORM_WORD_ONLY : 0 ),
501 rSh.GetSelText(), OUString(),
503 0, 0, 0,
504 (bCaseSensitive
505 ? TransliterationFlags::NONE
506 : TransliterationFlags::IGNORE_CASE),
507 SearchAlgorithms2::ABSOLUTE,
508 '\\' );
509
510 rSh.ClearMark();
511 bool bCancel;
512
513 //todo/mba: assuming that notes should not be searched
514 rSh.Find_Text(aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End, bCancel,
516}
517
519{
520 auto nPos = m_xTypeDCB->find_text(m_xTypeDCB->get_active_text());
523
525
526 const int nLevel = m_xLevelNF->denormalize(m_xLevelNF->get_value());
527 switch( nPos)
528 {
529 case POS_CONTENT : break;
530 case POS_INDEX: // keyword index mark
531 {
533 aDesc.SetPrimKey(m_xKey1DCB->get_active_text());
534 aDesc.SetSecKey(m_xKey2DCB->get_active_text());
535 aDesc.SetMainEntry(m_xMainEntryCB->get_active());
539 }
540 break;
541 default: // Userdefined index mark
542 {
543 aDesc.SetTOUName(m_xTypeDCB->get_active_text());
544 }
545 }
546 if (m_aOrgStr != m_xEntryED->get_text())
547 aDesc.SetAltStr(m_xEntryED->get_text());
548 bool bApplyAll = m_xApplyToAllCB->get_active();
549 bool bWordOnly = m_xSearchCaseWordOnlyCB->get_active();
550 bool bCaseSensitive = m_xSearchCaseSensitiveCB->get_active();
551
553 // all equal strings have to be selected here so that the
554 // entry is applied to all equal strings
555 if(bApplyAll)
556 {
557 lcl_SelectSameStrings(*m_pSh, bWordOnly, bCaseSensitive);
558 }
559 aDesc.SetLevel(nLevel);
560 SwTOXMgr aMgr(m_pSh);
561 aMgr.InsertTOXMark(aDesc);
562 if(bApplyAll)
564
566}
567
568// update mark
570{
571 OUString aAltText(m_xEntryED->get_text());
572 OUString* pAltText = m_aOrgStr != m_xEntryED->get_text() ? &aAltText : nullptr;
573 //empty alternative texts are not allowed
574 if(pAltText && pAltText->isEmpty())
575 return;
576
578
579 auto nPos = m_xTypeDCB->find_text(m_xTypeDCB->get_active_text());
581 if(POS_CONTENT == nPos)
583 else if(POS_INDEX == nPos)
585
587 aDesc.SetLevel(m_xLevelNF->get_value());
588 if(pAltText)
589 aDesc.SetAltStr(*pAltText);
590
591 OUString aPrim(m_xKey1DCB->get_active_text());
592 if(!aPrim.isEmpty())
593 aDesc.SetPrimKey(aPrim);
594 OUString aSec(m_xKey2DCB->get_active_text());
595 if(!aSec.isEmpty())
596 aDesc.SetSecKey(aSec);
597
598 if(eType == TOX_INDEX)
599 {
603 }
604 aDesc.SetMainEntry(m_xMainEntryCB->get_visible() && m_xMainEntryCB->get_active());
605 m_pTOXMgr->UpdateTOXMark(aDesc);
606}
607
608// insert new keys
610{
611 OUString aKey(m_xKey1DCB->get_active_text());
612 auto nPos = m_xKey1DCB->find_text(aKey);
613 if(nPos == -1 && !aKey.isEmpty())
614 { // create new key
615 m_xKey1DCB->append_text(aKey);
616 }
617
618 aKey = m_xKey2DCB->get_active_text();
619 nPos = m_xKey2DCB->find_text(aKey);
620
621 if(nPos == -1 && !aKey.isEmpty())
622 { // create new key
623 m_xKey2DCB->append_text(aKey);
624 }
625}
626
627namespace {
628
629class SwNewUserIdxDlg : public weld::GenericDialogController
630{
631 SwIndexMarkPane* m_pDlg;
632
633 std::unique_ptr<weld::Button> m_xOKPB;
634 std::unique_ptr<weld::Entry> m_xNameED;
635
636 DECL_LINK(ModifyHdl, weld::Entry&, void);
637
638public:
639 explicit SwNewUserIdxDlg(SwIndexMarkPane* pPane, weld::Window* pParent)
640 : GenericDialogController(pParent, "modules/swriter/ui/newuserindexdialog.ui", "NewUserIndexDialog")
641 , m_pDlg(pPane)
642 , m_xOKPB(m_xBuilder->weld_button("ok"))
643 , m_xNameED(m_xBuilder->weld_entry("entry"))
644 {
645 m_xNameED->connect_changed(LINK(this, SwNewUserIdxDlg, ModifyHdl));
646 m_xOKPB->set_sensitive(false);
647 m_xNameED->grab_focus();
648 }
649 OUString GetName() const { return m_xNameED->get_text(); }
650};
651
652}
653
654IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, weld::Entry&, rEdit, void)
655{
656 m_xOKPB->set_sensitive(!rEdit.get_text().isEmpty() && !m_pDlg->IsTOXType(rEdit.get_text()));
657}
658
660{
661 SwNewUserIdxDlg aDlg(this, m_xDialog.get());
662 if (aDlg.run() == RET_OK)
663 {
664 OUString sNewName(aDlg.GetName());
665 m_xTypeDCB->append_text(sNewName);
666 m_xTypeDCB->set_active_text(sNewName);
667 }
668}
669
670IMPL_LINK( SwIndexMarkPane, SearchTypeHdl, weld::Toggleable&, rBox, void)
671{
672 const bool bEnable = rBox.get_active() && rBox.get_sensitive();
673 m_xSearchCaseWordOnlyCB->set_sensitive(bEnable);
674 m_xSearchCaseSensitiveCB->set_sensitive(bEnable);
675}
676
677IMPL_LINK(SwIndexMarkPane, InsertHdl, weld::Button&, rButton, void)
678{
679 Apply();
680 //close the dialog if only one entry is available
681 if(!m_bNewMark && !m_xPrevBT->get_visible() && !m_xNextBT->get_visible())
682 CloseHdl(rButton);
683}
684
686{
687 if (m_bNewMark)
688 {
689 if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
690 {
691 pViewFrm->GetDispatcher()->Execute(FN_INSERT_IDX_ENTRY_DLG,
692 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
693 }
694 }
695 else
696 {
697 m_xDialog->response(RET_CLOSE);
698 }
699}
700
701// select index type only when inserting
702IMPL_LINK(SwIndexMarkPane, ModifyListBoxHdl, weld::ComboBox&, rBox, void)
703{
704 ModifyHdl(rBox);
705}
706
707IMPL_LINK(SwIndexMarkPane, ModifyEditHdl, weld::Entry&, rEdit, void)
708{
709 ModifyHdl(rEdit);
710}
711
713{
714 if (m_xTypeDCB.get() == &rBox)
715 {
716 // set index type
717 auto nPos = m_xTypeDCB->find_text(m_xTypeDCB->get_active_text());
718 bool bLevelEnable = false,
719 bKeyEnable = false,
720 bSetKey2 = false,
721 bKey2Enable = false,
722 bEntryHasText = false,
723 bKey1HasText = false,
724 bKey2HasText = false;
725 if(nPos == POS_INDEX)
726 {
727 if (!m_xEntryED->get_text().isEmpty())
728 bEntryHasText = true;
730
731 bKeyEnable = true;
732 m_xKey1DCB->set_active_text(m_xKey1DCB->get_text(nKey1Pos));
733 m_xPhoneticED1->set_text(GetDefaultPhoneticReading(m_xKey1DCB->get_active_text()));
734 if (!m_xKey1DCB->get_active_text().isEmpty())
735 {
736 bKey1HasText = bSetKey2 = bKey2Enable = true;
737 m_xKey2DCB->set_active_text(m_xKey2DCB->get_text(nKey2Pos));
738 m_xPhoneticED2->set_text(GetDefaultPhoneticReading(m_xKey2DCB->get_active_text()));
739 if(!m_xKey2DCB->get_active_text().isEmpty())
740 bKey2HasText = true;
741 }
742 }
743 else
744 {
745 bLevelEnable = true;
746 m_xLevelNF->set_max(MAXLEVEL);
747 m_xLevelNF->set_value(m_xLevelNF->normalize(0));
748 bSetKey2 = true;
749 }
750 m_xLevelFT->set_visible(bLevelEnable);
751 m_xLevelNF->set_visible(bLevelEnable);
752 m_xMainEntryCB->set_visible(nPos == POS_INDEX);
753
754 m_xKey1FT->set_sensitive(bKeyEnable);
755 m_xKey1DCB->set_sensitive(bKeyEnable);
756 if ( bSetKey2 )
757 {
758 m_xKey2DCB->set_sensitive(bKey2Enable);
759 m_xKey2FT->set_sensitive(bKey2Enable);
760 }
761 m_xPhoneticFT0->set_sensitive(bKeyEnable&&bEntryHasText&&m_bIsPhoneticReadingEnabled);
762 m_xPhoneticED0->set_sensitive(bKeyEnable&&bEntryHasText&&m_bIsPhoneticReadingEnabled);
763 m_xPhoneticFT1->set_sensitive(bKeyEnable&&bKey1HasText&&m_bIsPhoneticReadingEnabled);
764 m_xPhoneticED1->set_sensitive(bKeyEnable&&bKey1HasText&&m_bIsPhoneticReadingEnabled);
765 m_xPhoneticFT2->set_sensitive(bKeyEnable&&bKey2HasText&&m_bIsPhoneticReadingEnabled);
766 m_xPhoneticED2->set_sensitive(bKeyEnable&&bKey2HasText&&m_bIsPhoneticReadingEnabled);
767 }
768 else //m_xEntryED !!m_xEntryED is not a ListBox but an Edit
769 {
770 bool bHasText = !m_xEntryED->get_text().isEmpty();
771 if(!bHasText)
772 {
773 m_xPhoneticED0->set_text(OUString());
775 }
778
779 m_xPhoneticFT0->set_sensitive(bHasText&&m_bIsPhoneticReadingEnabled);
780 m_xPhoneticED0->set_sensitive(bHasText&&m_bIsPhoneticReadingEnabled);
781 }
782 m_xOKBT->set_sensitive(!m_pSh->HasReadonlySel() &&
783 (!m_xEntryED->get_text().isEmpty() || m_pSh->GetCursorCnt(false)));
784}
785
787{
788 InsertUpdate();
789 m_pTOXMgr->NextTOXMark();
790 UpdateDialog();
791}
792
794{
795 InsertUpdate();
796 m_pTOXMgr->NextTOXMark(true);
797 UpdateDialog();
798}
799
801{
802 InsertUpdate();
803 m_pTOXMgr->PrevTOXMark();
804 UpdateDialog();
805}
806
808{
809 InsertUpdate();
810 m_pTOXMgr->PrevTOXMark(true);
811 UpdateDialog();
812}
813
815{
816 m_bDel = true;
817 InsertUpdate();
818 m_bDel = false;
819
820 if(m_pTOXMgr->GetCurTOXMark())
821 UpdateDialog();
822 else
823 {
824 CloseHdl(*m_xCloseBT);
825 if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
826 pViewFrm->GetBindings().Invalidate(FN_EDIT_IDX_ENTRY_DLG);
827 }
828}
829
830// renew dialog view
832{
833 OSL_ENSURE(m_pSh && m_pTOXMgr, "no shell?");
834 SwTOXMark* pMark = m_pTOXMgr->GetCurTOXMark();
835 OSL_ENSURE(pMark, "no current marker");
836 if(!pMark)
837 return;
838
840
841 m_aOrgStr = pMark->GetText(m_pSh->GetLayout());
842 m_xEntryED->set_text(m_aOrgStr);
843
844 // set index type
845 bool bLevelEnable = true,
846 bKeyEnable = false,
847 bKey2Enable = false,
848 bEntryHasText = false,
849 bKey1HasText = false,
850 bKey2HasText = false;
851
852 TOXTypes eCurType = pMark->GetTOXType()->GetType();
853 if(TOX_INDEX == eCurType)
854 {
855 bLevelEnable = false;
856 bKeyEnable = true;
857 bKey1HasText = bKey2Enable = !pMark->GetPrimaryKey().isEmpty();
858 bKey2HasText = !pMark->GetSecondaryKey().isEmpty();
859 bEntryHasText = !pMark->GetText(m_pSh->GetLayout()).isEmpty();
860 m_xKey1DCB->set_entry_text( pMark->GetPrimaryKey() );
861 m_xKey2DCB->set_entry_text( pMark->GetSecondaryKey() );
862 m_xPhoneticED0->set_text( pMark->GetTextReading() );
863 m_xPhoneticED1->set_text( pMark->GetPrimaryKeyReading() );
864 m_xPhoneticED2->set_text( pMark->GetSecondaryKeyReading() );
865 m_xMainEntryCB->set_active(pMark->IsMainEntry());
866 }
867 else if(TOX_CONTENT == eCurType || TOX_USER == eCurType)
868 {
869 m_xLevelNF->set_value(m_xLevelNF->normalize(pMark->GetLevel()));
870 }
871 m_xKey1FT->set_sensitive(bKeyEnable);
872 m_xKey1DCB->set_sensitive(bKeyEnable);
873 m_xLevelNF->set_max(MAXLEVEL);
874 m_xLevelFT->set_visible(bLevelEnable);
875 m_xLevelNF->set_visible(bLevelEnable);
876 m_xMainEntryCB->set_visible(!bLevelEnable);
877 m_xKey2FT->set_sensitive(bKey2Enable);
878 m_xKey2DCB->set_sensitive(bKey2Enable);
879
881 m_xPhoneticFT0->set_sensitive(bKeyEnable&&bEntryHasText&&m_bIsPhoneticReadingEnabled);
882 m_xPhoneticED0->set_sensitive(bKeyEnable&&bEntryHasText&&m_bIsPhoneticReadingEnabled);
883 m_xPhoneticFT1->set_sensitive(bKeyEnable&&bKey1HasText&&m_bIsPhoneticReadingEnabled);
884 m_xPhoneticED1->set_sensitive(bKeyEnable&&bKey1HasText&&m_bIsPhoneticReadingEnabled);
885 m_xPhoneticFT2->set_sensitive(bKeyEnable&&bKey2HasText&&m_bIsPhoneticReadingEnabled);
886 m_xPhoneticED2->set_sensitive(bKeyEnable&&bKey2HasText&&m_bIsPhoneticReadingEnabled);
887
888 // set index type
889 m_xTypeDCB->set_active_text(pMark->GetTOXType()->GetTypeName());
890
891 // set Next - Prev - Buttons
893 if( m_xPrevBT->get_visible() )
894 {
895 const SwTOXMark* pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_PRV );
896 if( pMoveMark != pMark )
897 m_pSh->GotoTOXMark( *pMoveMark, TOX_NXT );
898 m_xPrevBT->set_sensitive( pMoveMark != pMark );
899 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_NXT );
900 if( pMoveMark != pMark )
901 m_pSh->GotoTOXMark( *pMoveMark, TOX_PRV );
902 m_xNextBT->set_sensitive( pMoveMark != pMark );
903 }
904
905 if (m_xPrevSameBT->get_visible())
906 {
907 const SwTOXMark* pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
908 if( pMoveMark != pMark )
909 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT );
910 m_xPrevSameBT->set_sensitive( pMoveMark != pMark );
911 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
912 if( pMoveMark != pMark )
913 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV );
914 m_xNextSameBT->set_sensitive( pMoveMark != pMark );
915 }
916
917 const bool bEnable = !m_pSh->HasReadonlySel();
918 m_xOKBT->set_sensitive(bEnable);
919 m_xDelBT->set_sensitive(bEnable);
920 m_xEntryED->set_sensitive(bEnable);
921 m_xLevelNF->set_sensitive(bEnable);
922 m_xKey1DCB->set_sensitive(bEnable);
923 m_xKey2DCB->set_sensitive(bEnable);
924
926 // we need the point at the start of the attribute
927 m_pSh->SwapPam();
928
930}
931
932// Remind whether the edit boxes for Phonetic reading are changed manually
933IMPL_LINK(SwIndexMarkPane, PhoneticEDModifyHdl, weld::Entry&, rEdit, void)
934{
935 if (m_xPhoneticED0.get() == &rEdit)
936 {
937 m_bPhoneticED0_ChangedByUser = !rEdit.get_text().isEmpty();
938 }
939 else if (m_xPhoneticED1.get() == &rEdit)
940 {
941 m_bPhoneticED1_ChangedByUser = !rEdit.get_text().isEmpty();
942 }
943 else if (m_xPhoneticED2.get() == &rEdit)
944 {
945 m_bPhoneticED2_ChangedByUser = !rEdit.get_text().isEmpty();
946 }
947}
948
949// Enable Disable of the 2nd key
950IMPL_LINK( SwIndexMarkPane, KeyDCBModifyHdl, weld::ComboBox&, rBox, void )
951{
952 if (m_xKey1DCB.get() == &rBox)
953 {
954 bool bEnable = !rBox.get_active_text().isEmpty();
955 if(!bEnable)
956 {
957 m_xKey2DCB->set_entry_text(OUString());
958 m_xPhoneticED1->set_text(OUString());
959 m_xPhoneticED2->set_text(OUString());
960 m_bPhoneticED1_ChangedByUser = false;
961 m_bPhoneticED2_ChangedByUser = false;
962 }
963 else
964 {
965 if (rBox.get_popup_shown())
966 {
967 //reset bPhoneticED1_ChangedByUser if a completely new string is selected
968 m_bPhoneticED1_ChangedByUser = false;
969 }
970 if (!m_bPhoneticED1_ChangedByUser)
971 m_xPhoneticED1->set_text(GetDefaultPhoneticReading(rBox.get_active_text()));
972 }
973 m_xKey2DCB->set_sensitive(bEnable);
974 m_xKey2FT->set_sensitive(bEnable);
975 }
976 else if (m_xKey2DCB.get() == &rBox)
977 {
978 if (rBox.get_active_text().isEmpty())
979 {
980 m_xPhoneticED2->set_text(OUString());
981 m_bPhoneticED2_ChangedByUser = false;
982 }
983 else
984 {
985 if (rBox.get_popup_shown())
986 {
987 //reset bPhoneticED1_ChangedByUser if a completely new string is selected
988 m_bPhoneticED2_ChangedByUser = false;
989 }
990 if(!m_bPhoneticED2_ChangedByUser)
991 m_xPhoneticED2->set_text(GetDefaultPhoneticReading(rBox.get_active_text()));
992 }
993 }
994
995 bool bKey1HasText = !m_xKey1DCB->get_active_text().isEmpty();
996 bool bKey2HasText = !m_xKey2DCB->get_active_text().isEmpty();
997
998 m_xPhoneticFT1->set_sensitive(bKey1HasText && m_bIsPhoneticReadingEnabled);
999 m_xPhoneticED1->set_sensitive(bKey1HasText && m_bIsPhoneticReadingEnabled);
1000 m_xPhoneticFT2->set_sensitive(bKey2HasText && m_bIsPhoneticReadingEnabled);
1001 m_xPhoneticED2->set_sensitive(bKey2HasText && m_bIsPhoneticReadingEnabled);
1002}
1003
1005{
1006}
1007
1008void SwIndexMarkPane::ReInitDlg(SwWrtShell& rWrtShell, SwTOXMark const * pCurTOXMark)
1009{
1010 m_pSh = &rWrtShell;
1011 m_pTOXMgr.reset( new SwTOXMgr(m_pSh) );
1012 if(pCurTOXMark)
1013 {
1014 for(sal_uInt16 i = 0; i < m_pTOXMgr->GetTOXMarkCount(); i++)
1015 if(m_pTOXMgr->GetTOXMark(i) == pCurTOXMark)
1016 {
1017 m_pTOXMgr->SetCurTOXMark(i);
1018 break;
1019 }
1020 }
1021 InitControls();
1022}
1023
1025 SfxChildWindow* pChild, weld::Window *pParent,
1026 SfxChildWinInfo const * pInfo, bool bNew)
1027 : SfxModelessDialogController(_pBindings, pChild, pParent,
1028 "modules/swriter/ui/indexentry.ui", "IndexEntryDialog")
1029 , m_aContent(m_xDialog, *m_xBuilder, bNew, ::GetActiveWrtShell())
1030{
1031 if (SwWrtShell* pWrtShell = ::GetActiveWrtShell())
1032 m_aContent.ReInitDlg(*pWrtShell);
1033 Initialize(pInfo);
1034}
1035
1037{
1040}
1041
1043{
1044 m_aContent.ReInitDlg( rWrtShell );
1045}
1046
1048 : SfxDialogController(pParent, "modules/swriter/ui/indexentry.ui",
1049 "IndexEntryDialog")
1050 , m_aContent(m_xDialog, *m_xBuilder, false, &rSh)
1051{
1052 m_aContent.ReInitDlg(rSh, pCurTOXMark);
1053}
1054
1056{
1058}
1059
1061{
1062 short nRet = SfxDialogController::run();
1063 if (RET_OK == nRet)
1064 m_aContent.Apply();
1065 return nRet;
1066}
1067
1068namespace {
1069
1070class SwCreateAuthEntryDlg_Impl : public weld::GenericDialogController
1071{
1072 std::vector<std::unique_ptr<weld::Builder>> m_aBuilders;
1073
1074 Link<weld::Entry&,bool> m_aShortNameCheckLink;
1075
1076 SwWrtShell& m_rWrtSh;
1077
1078 bool m_bNewEntryMode;
1079 bool m_bNameAllowed;
1080
1081 std::vector<std::unique_ptr<weld::Container>> m_aOrigContainers;
1082 std::vector<std::unique_ptr<weld::Label>> m_aFixedTexts;
1083 std::unique_ptr<weld::Box> m_pBoxes[AUTH_FIELD_END];
1084 std::unique_ptr<weld::Entry> m_pEdits[AUTH_FIELD_END];
1085 std::unique_ptr<weld::Button> m_xOKBT;
1086 std::unique_ptr<weld::Container> m_xBox;
1087 std::unique_ptr<weld::Container> m_xLeft;
1088 std::unique_ptr<weld::Container> m_xRight;
1089 std::unique_ptr<weld::ComboBox> m_xTypeListBox;
1090 std::unique_ptr<weld::ComboBox> m_xIdentifierBox;
1091 std::unique_ptr<weld::Button> m_xLocalBrowseButton;
1092 std::unique_ptr<weld::CheckButton> m_xLocalPageCB;
1093 std::unique_ptr<weld::SpinButton> m_xLocalPageSB;
1094 std::unique_ptr<weld::CheckButton> m_xUseTargetURLCB;
1095
1096 DECL_LINK(IdentifierHdl, weld::ComboBox&, void);
1097 DECL_LINK(ShortNameHdl, weld::Entry&, void);
1098 DECL_LINK(EnableHdl, weld::ComboBox&, void);
1099 DECL_LINK(BrowseHdl, weld::Button&, void);
1100 DECL_LINK(PageNumHdl, weld::Toggleable&, void);
1101
1102public:
1103 SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
1104 const OUString pFields[],
1105 SwWrtShell& rSh,
1106 bool bNewEntry,
1107 bool bCreate);
1108
1109 OUString GetEntryText(ToxAuthorityField eField) const;
1110
1111 void SetCheckNameHdl(const Link<weld::Entry&,bool>& rLink) {m_aShortNameCheckLink = rLink;}
1112
1113};
1114
1115struct TextInfo
1116{
1117 ToxAuthorityField nToxField;
1118 const char* pHelpId;
1119};
1120
1121}
1122
1123const TextInfo aTextInfoArr[] =
1124{
1159};
1160
1161static OUString lcl_FindColumnEntry(const uno::Sequence<beans::PropertyValue>& rFields, std::u16string_view rColumnTitle)
1162{
1163 for(const auto& rField : rFields)
1164 {
1165 OUString sRet;
1166 if(rField.Name == rColumnTitle &&
1167 (rField.Value >>= sRet))
1168 {
1169 return sRet;
1170 }
1171 }
1172 return OUString();
1173}
1174
1176
1178 : m_rDialog(rDialog)
1179 , m_bNewEntry(bNewDlg)
1180 , m_bBibAccessInitialized(false)
1181 , m_pSh(nullptr)
1182 , m_xFromComponentRB(rBuilder.weld_radio_button("frombibliography"))
1183 , m_xFromDocContentRB(rBuilder.weld_radio_button("fromdocument"))
1184 , m_xAuthorFI(rBuilder.weld_label("author"))
1185 , m_xTitleFI(rBuilder.weld_label("title"))
1186 , m_xEntryED(rBuilder.weld_entry("entryed"))
1187 , m_xEntryLB(rBuilder.weld_combo_box("entrylb"))
1188 , m_xActionBT(rBuilder.weld_button(m_bNewEntry ? OString("insert") : OString("modify")))
1189 , m_xCloseBT(rBuilder.weld_button("close"))
1190 , m_xCreateEntryPB(rBuilder.weld_button("new"))
1191 , m_xEditEntryPB(rBuilder.weld_button("edit"))
1192{
1193 m_xActionBT->show();
1194 m_xFromComponentRB->set_visible(m_bNewEntry);
1195 m_xFromDocContentRB->set_visible(m_bNewEntry);
1198
1199 m_xActionBT->connect_clicked(LINK(this,SwAuthorMarkPane, InsertHdl));
1200 m_xCloseBT->connect_clicked(LINK(this,SwAuthorMarkPane, CloseHdl));
1201 m_xCreateEntryPB->connect_clicked(LINK(this,SwAuthorMarkPane, CreateEntryHdl));
1202 m_xEditEntryPB->connect_clicked(LINK(this,SwAuthorMarkPane, CreateEntryHdl));
1203 m_xFromComponentRB->connect_toggled(LINK(this,SwAuthorMarkPane, ChangeSourceHdl));
1204 m_xFromDocContentRB->connect_toggled(LINK(this,SwAuthorMarkPane, ChangeSourceHdl));
1205 m_xEntryED->connect_changed(LINK(this,SwAuthorMarkPane, EditModifyHdl));
1206
1208 m_bNewEntry ? STR_AUTHMRK_INSERT : STR_AUTHMRK_EDIT));
1209
1210 m_xEntryED->set_visible(!m_bNewEntry);
1211 m_xEntryLB->set_visible(m_bNewEntry);
1212 // tdf#90641 - sort bibliography entries by identifier
1213 m_xEntryLB->make_sorted();
1214 if (m_bNewEntry)
1215 {
1216 m_xEntryLB->connect_changed(LINK(this, SwAuthorMarkPane, CompEntryHdl));
1217 }
1218}
1219
1221{
1222 m_pSh = &rWrtShell;
1223 InitControls();
1224}
1225
1227{
1228 if(m_bNewEntry)
1229 {
1230 if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
1231 {
1232 pViewFrm->GetDispatcher()->Execute(FN_INSERT_AUTH_ENTRY_DLG,
1233 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
1234 }
1235 }
1236 else
1237 {
1238 m_rDialog.response(RET_CANCEL);
1239 }
1240}
1241
1242IMPL_LINK( SwAuthorMarkPane, CompEntryHdl, weld::ComboBox&, rBox, void)
1243{
1244 const OUString sEntry(rBox.get_active_text());
1245 if(s_bIsFromComponent)
1246 {
1247 if(m_xBibAccess.is() && !sEntry.isEmpty())
1248 {
1249 if(m_xBibAccess->hasByName(sEntry))
1250 {
1251 uno::Any aEntry(m_xBibAccess->getByName(sEntry));
1252 uno::Sequence<beans::PropertyValue> aFieldProps;
1253 if(aEntry >>= aFieldProps)
1254 {
1255 auto nSize = std::min(static_cast<sal_Int32>(AUTH_FIELD_END), aFieldProps.getLength());
1256 for(sal_Int32 i = 0; i < nSize; i++)
1257 {
1258 m_sFields[i] = lcl_FindColumnEntry(aFieldProps, m_sColumnTitles[i]);
1259 }
1260 }
1261 }
1262 }
1263 }
1264 else
1265 {
1266 if(!sEntry.isEmpty())
1267 {
1268 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1269 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1270 const SwAuthEntry* pEntry = pFType ? pFType->GetEntryByIdentifier(sEntry) : nullptr;
1271 for(int i = 0; i < AUTH_FIELD_END; i++)
1272 m_sFields[i] = pEntry ?
1273 pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)) : OUString();
1274 }
1275 }
1276 if (rBox.get_active_text().isEmpty())
1277 {
1278 for(OUString & s : m_sFields)
1279 s.clear();
1280 }
1281 m_xAuthorFI->set_label(m_sFields[AUTH_FIELD_AUTHOR]);
1282 m_xTitleFI->set_label(m_sFields[AUTH_FIELD_TITLE]);
1283}
1284
1286{
1287 //insert or update the SwAuthorityField...
1288 if(m_pSh)
1289 {
1290 bool bDifferent = false;
1291 OSL_ENSURE(!m_sFields[AUTH_FIELD_IDENTIFIER].isEmpty() , "No Id is set!");
1292 OSL_ENSURE(!m_sFields[AUTH_FIELD_AUTHORITY_TYPE].isEmpty() , "No authority type is set!");
1293 //check if the entry already exists with different content
1294 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1295 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1296 const SwAuthEntry* pEntry = pFType ?
1297 pFType->GetEntryByIdentifier( m_sFields[AUTH_FIELD_IDENTIFIER])
1298 : nullptr;
1299 if(pEntry)
1300 {
1301 for(int i = 0; i < AUTH_FIELD_END && !bDifferent; i++)
1302 bDifferent |= m_sFields[i] != pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
1303 if(bDifferent)
1304 {
1305 std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(m_rDialog.getDialog(),
1306 VclMessageType::Question, VclButtonsType::YesNo,
1307 SwResId(STR_QUERY_CHANGE_AUTH_ENTRY)));
1308 if (RET_YES != xQuery->run())
1309 return;
1310 }
1311 }
1312
1313 SwFieldMgr aMgr(m_pSh);
1314 OUStringBuffer sFields;
1315 for(OUString & s : m_sFields)
1316 {
1317 sFields.append(s).append(TOX_STYLE_DELIMITER);
1318 }
1319 if(m_bNewEntry)
1320 {
1321 if(bDifferent)
1322 {
1324 for(int i = 0; i < AUTH_FIELD_END; i++)
1325 xNewData->SetAuthorField(static_cast<ToxAuthorityField>(i), m_sFields[i]);
1326 m_pSh->ChangeAuthorityData(xNewData.get());
1327 }
1328 SwInsertField_Data aData(SwFieldTypesEnum::Authority, 0, sFields.makeStringAndClear(), OUString(), 0 );
1329 aMgr.InsertField( aData );
1330 }
1331 else if(aMgr.GetCurField())
1332 {
1333 aMgr.UpdateCurField(0, sFields.makeStringAndClear(), OUString());
1334 }
1335 }
1336 if(!m_bNewEntry)
1337 CloseHdl(*m_xCloseBT);
1338}
1339
1340IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, weld::Button&, rButton, void)
1341{
1342 bool bCreate = &rButton == m_xCreateEntryPB.get();
1343 OUString sOldId = m_sCreatedEntry[0];
1344 for(int i = 0; i < AUTH_FIELD_END; i++)
1345 m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i];
1346 SwCreateAuthEntryDlg_Impl aDlg(m_rDialog.getDialog(),
1347 bCreate ? m_sCreatedEntry : m_sFields,
1348 *m_pSh, m_bNewEntry, bCreate);
1349 if(m_bNewEntry)
1350 {
1351 aDlg.SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl));
1352 }
1353 if(RET_OK != aDlg.run())
1354 return;
1355
1356 if(bCreate && !sOldId.isEmpty())
1357 {
1358 m_xEntryLB->remove_text(sOldId);
1359 }
1360 for(int i = 0; i < AUTH_FIELD_END; i++)
1361 {
1362 m_sFields[i] = aDlg.GetEntryText(static_cast<ToxAuthorityField>(i));
1363 m_sCreatedEntry[i] = m_sFields[i];
1364 }
1365 if(m_bNewEntry && !m_xFromDocContentRB->get_active())
1366 {
1367 m_xFromDocContentRB->set_active(true);
1368 ChangeSourceHdl(*m_xFromDocContentRB);
1369 }
1370 if(bCreate)
1371 {
1372 OSL_ENSURE(m_xEntryLB->find_text(m_sFields[AUTH_FIELD_IDENTIFIER]) == -1,
1373 "entry exists!");
1374 m_xEntryLB->append_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
1375 m_xEntryLB->set_active_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
1376 }
1377 m_xEntryED->set_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
1378 m_xAuthorFI->set_label(m_sFields[AUTH_FIELD_AUTHOR]);
1379 m_xTitleFI->set_label(m_sFields[AUTH_FIELD_TITLE]);
1380 m_xActionBT->set_sensitive(true);
1381
1382 if (!m_bNewEntry)
1383 {
1384 // When in edit mode, automatically apply the changed entry to update the field in the doc
1385 // model.
1386 InsertHdl(*m_xActionBT);
1387 }
1388}
1389
1391{
1392 bool bFromComp = m_xFromComponentRB->get_active();
1393 s_bIsFromComponent = bFromComp;
1394 m_xCreateEntryPB->set_sensitive(!s_bIsFromComponent);
1395 m_xEntryLB->clear();
1396 if(s_bIsFromComponent)
1397 {
1398 if(!m_bBibAccessInitialized)
1399 {
1400 uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
1401 m_xBibAccess = frame::Bibliography::create( xContext );
1402 uno::Reference< beans::XPropertySet > xPropSet(m_xBibAccess, uno::UNO_QUERY);
1403 OUString uPropName("BibliographyDataFieldNames");
1404 if(xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName(uPropName))
1405 {
1406 uno::Any aNames = xPropSet->getPropertyValue(uPropName);
1407 uno::Sequence<beans::PropertyValue> aSeq;
1408 if( aNames >>= aSeq)
1409 {
1410 for(const beans::PropertyValue& rProp : std::as_const(aSeq))
1411 {
1412 sal_Int16 nField = 0;
1413 rProp.Value >>= nField;
1414 if(nField >= 0 && nField < AUTH_FIELD_END)
1415 m_sColumnTitles[nField] = rProp.Name;
1416 }
1417 }
1418 }
1419 m_bBibAccessInitialized = true;
1420 }
1421 if(m_xBibAccess.is())
1422 {
1423 const uno::Sequence<OUString> aIdentifiers = m_xBibAccess->getElementNames();
1424 for(const OUString& rName : aIdentifiers)
1425 m_xEntryLB->append_text(rName);
1426 }
1427 }
1428 else
1429 {
1430 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1431 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1432 if(pFType)
1433 {
1434 std::vector<OUString> aIds;
1435 pFType->GetAllEntryIdentifiers( aIds );
1436 for(const OUString & i : aIds)
1437 m_xEntryLB->append_text(i);
1438 }
1439 if(!m_sCreatedEntry[AUTH_FIELD_IDENTIFIER].isEmpty())
1440 m_xEntryLB->append_text(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER]);
1441 }
1442 m_xEntryLB->set_active(0);
1443 CompEntryHdl(*m_xEntryLB);
1444}
1445
1446IMPL_LINK(SwAuthorMarkPane, EditModifyHdl, weld::Entry&, rEdit, void)
1447{
1448 Link<weld::Entry&,bool> aAllowed = LINK(this, SwAuthorMarkPane, IsEditAllowedHdl);
1449 bool bResult = aAllowed.Call(rEdit);
1450 m_xActionBT->set_sensitive(bResult);
1451 if(bResult)
1452 {
1453 OUString sEntry(rEdit.get_text());
1454 m_sFields[AUTH_FIELD_IDENTIFIER] = sEntry;
1455 m_sCreatedEntry[AUTH_FIELD_IDENTIFIER] = sEntry;
1456 }
1457};
1458
1459IMPL_LINK(SwAuthorMarkPane, IsEntryAllowedHdl, weld::Entry&, rEdit, bool)
1460{
1461 OUString sEntry = rEdit.get_text();
1462 bool bAllowed = false;
1463 if(!sEntry.isEmpty())
1464 {
1465 if (m_xEntryLB->find_text(sEntry) != -1)
1466 return false;
1467 else if(s_bIsFromComponent)
1468 {
1469 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1470 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1471 bAllowed = !pFType || !pFType->GetEntryByIdentifier(sEntry);
1472 }
1473 else
1474 {
1475 bAllowed = !m_xBibAccess.is() || !m_xBibAccess->hasByName(sEntry);
1476 }
1477 }
1478 return bAllowed;
1479}
1480
1481IMPL_LINK(SwAuthorMarkPane, IsEditAllowedHdl, weld::Entry&, rEdit, bool)
1482{
1483 OUString sEntry = rEdit.get_text();
1484 bool bAllowed = false;
1485 if(!sEntry.isEmpty())
1486 {
1487 if (m_xEntryLB->find_text(sEntry) != -1)
1488 return false;
1489 else if(s_bIsFromComponent)
1490 {
1491 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1492 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1493 bAllowed = !pFType || !pFType->GetEntryByIdentifier(sEntry);
1494 }
1495 else
1496 {
1497 bAllowed = !m_xBibAccess.is() || !m_xBibAccess->hasByName(sEntry);
1498 }
1499 }
1500 return bAllowed;
1501}
1502
1504{
1505 OSL_ENSURE(m_pSh, "no shell?");
1506 SwField* pField = m_pSh->GetCurField();
1507 OSL_ENSURE(m_bNewEntry || pField, "no current marker");
1508 if(m_bNewEntry)
1509 {
1510 ChangeSourceHdl(m_xFromComponentRB->get_active() ? *m_xFromComponentRB : *m_xFromDocContentRB);
1511 m_xCreateEntryPB->set_sensitive(!m_xFromComponentRB->get_active());
1512 if(!m_xFromComponentRB->get_active() && !m_sCreatedEntry[0].isEmpty())
1513 for(int i = 0; i < AUTH_FIELD_END; i++)
1515 }
1516 if(m_bNewEntry || !pField || pField->GetTyp()->Which() != SwFieldIds::TableOfAuthorities)
1517 return;
1518
1519 const SwAuthEntry* pEntry = static_cast<SwAuthorityField*>(pField)->GetAuthEntry();
1520
1521 OSL_ENSURE(pEntry, "No authority entry found");
1522 if(!pEntry)
1523 return;
1524 for(int i = 0; i < AUTH_FIELD_END; i++)
1525 m_sFields[i] = pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
1526
1528 m_xAuthorFI->set_label(pEntry->GetAuthorField(AUTH_FIELD_AUTHOR));
1529 m_xTitleFI->set_label(pEntry->GetAuthorField(AUTH_FIELD_TITLE));
1530}
1531
1533{
1534 m_xActionBT->set_sensitive(!m_pSh->HasReadonlySel());
1535}
1536
1537namespace
1538{
1539 const TranslateId STR_AUTH_FIELD_ARY[] =
1540 {
1541 STR_AUTH_FIELD_IDENTIFIER,
1542 STR_AUTH_FIELD_AUTHORITY_TYPE,
1543 STR_AUTH_FIELD_ADDRESS,
1544 STR_AUTH_FIELD_ANNOTE,
1545 STR_AUTH_FIELD_AUTHOR,
1546 STR_AUTH_FIELD_BOOKTITLE,
1547 STR_AUTH_FIELD_CHAPTER,
1548 STR_AUTH_FIELD_EDITION,
1549 STR_AUTH_FIELD_EDITOR,
1550 STR_AUTH_FIELD_HOWPUBLISHED,
1551 STR_AUTH_FIELD_INSTITUTION,
1552 STR_AUTH_FIELD_JOURNAL,
1553 STR_AUTH_FIELD_MONTH,
1554 STR_AUTH_FIELD_NOTE,
1555 STR_AUTH_FIELD_NUMBER,
1556 STR_AUTH_FIELD_ORGANIZATIONS,
1557 STR_AUTH_FIELD_PAGES,
1558 STR_AUTH_FIELD_PUBLISHER,
1559 STR_AUTH_FIELD_SCHOOL,
1560 STR_AUTH_FIELD_SERIES,
1561 STR_AUTH_FIELD_TITLE,
1562 STR_AUTH_FIELD_TYPE,
1563 STR_AUTH_FIELD_VOLUME,
1564 STR_AUTH_FIELD_YEAR,
1565 STR_AUTH_FIELD_URL,
1566 STR_AUTH_FIELD_CUSTOM1,
1567 STR_AUTH_FIELD_CUSTOM2,
1568 STR_AUTH_FIELD_CUSTOM3,
1569 STR_AUTH_FIELD_CUSTOM4,
1570 STR_AUTH_FIELD_CUSTOM5,
1571 STR_AUTH_FIELD_ISBN,
1572 STR_AUTH_FIELD_LOCAL_URL,
1573 STR_AUTH_FIELD_TARGET_URL,
1574 STR_AUTH_FIELD_USE_TARGET_URL,
1575 };
1576}
1577
1578SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
1579 const OUString pFields[],
1580 SwWrtShell& rSh,
1581 bool bNewEntry,
1582 bool bCreate)
1583 : GenericDialogController(pParent, "modules/swriter/ui/createauthorentry.ui", "CreateAuthorEntryDialog")
1584 , m_rWrtSh(rSh)
1585 , m_bNewEntryMode(bNewEntry)
1586 , m_bNameAllowed(true)
1587 , m_xOKBT(m_xBuilder->weld_button("ok"))
1588 , m_xBox(m_xBuilder->weld_container("box"))
1589 , m_xLeft(m_xBuilder->weld_container("leftgrid"))
1590 , m_xRight(m_xBuilder->weld_container("rightgrid"))
1591{
1592 bool bLeft = true;
1593 sal_Int32 nLeftRow(0), nRightRow(0);
1594 for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
1595 {
1596 //m_xBox parent just to have some parent during setup, added contents are not directly visible under m_xBox
1597 m_aBuilders.emplace_back(Application::CreateBuilder(m_xBox.get(), "modules/swriter/ui/bibliofragment.ui"));
1598 const TextInfo aCurInfo = aTextInfoArr[nIndex];
1599
1600 m_aOrigContainers.emplace_back(m_aBuilders.back()->weld_container("biblioentry"));
1601 m_aFixedTexts.emplace_back(m_aBuilders.back()->weld_label("label"));
1602 if (bLeft)
1603 m_aOrigContainers.back()->move(m_aFixedTexts.back().get(), m_xLeft.get());
1604 else
1605 m_aOrigContainers.back()->move(m_aFixedTexts.back().get(), m_xRight.get());
1606 m_aFixedTexts.back()->set_grid_left_attach(0);
1607 m_aFixedTexts.back()->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1608 m_aFixedTexts.back()->set_label(SwResId(STR_AUTH_FIELD_ARY[aCurInfo.nToxField]));
1609 m_aFixedTexts.back()->show();
1610 if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField )
1611 {
1612 m_xTypeListBox = m_aBuilders.back()->weld_combo_box("listbox");
1613 if (bLeft)
1614 m_aOrigContainers.back()->move(m_xTypeListBox.get(), m_xLeft.get());
1615 else
1616 m_aOrigContainers.back()->move(m_xTypeListBox.get(), m_xRight.get());
1617
1618 for (int j = 0; j < AUTH_TYPE_END; j++)
1619 {
1620 m_xTypeListBox->append_text(
1622 }
1623 if(!pFields[aCurInfo.nToxField].isEmpty())
1624 {
1625 m_xTypeListBox->set_active(pFields[aCurInfo.nToxField].toInt32());
1626 }
1627 m_xTypeListBox->set_grid_left_attach(1);
1628 m_xTypeListBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1629 m_xTypeListBox->set_hexpand(true);
1630 m_xTypeListBox->show();
1631 m_xTypeListBox->connect_changed(LINK(this, SwCreateAuthEntryDlg_Impl, EnableHdl));
1632 m_xTypeListBox->set_help_id(aCurInfo.pHelpId);
1633 m_aFixedTexts.back()->set_mnemonic_widget(m_xTypeListBox.get());
1634 }
1635 else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode)
1636 {
1637 m_xIdentifierBox = m_aBuilders.back()->weld_combo_box("combobox");
1638 if (bLeft)
1639 m_aOrigContainers.back()->move(m_xIdentifierBox.get(), m_xLeft.get());
1640 else
1641 m_aOrigContainers.back()->move(m_xIdentifierBox.get(), m_xRight.get());
1642
1643 m_xIdentifierBox->connect_changed(LINK(this,
1644 SwCreateAuthEntryDlg_Impl, IdentifierHdl));
1645
1646 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1648 if(pFType)
1649 {
1650 std::vector<OUString> aIds;
1651 pFType->GetAllEntryIdentifiers( aIds );
1652 for (const OUString& a : aIds)
1653 m_xIdentifierBox->append_text(a);
1654 }
1655 m_xIdentifierBox->set_entry_text(pFields[aCurInfo.nToxField]);
1656 m_xIdentifierBox->set_grid_left_attach(1);
1657 m_xIdentifierBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1658 m_xIdentifierBox->set_hexpand(true);
1659 m_xIdentifierBox->show();
1660 m_xIdentifierBox->set_help_id(aCurInfo.pHelpId);
1661 m_aFixedTexts.back()->set_mnemonic_widget(m_xIdentifierBox.get());
1662 }
1663 else if (AUTH_FIELD_USE_TARGET_URL == aCurInfo.nToxField)
1664 {
1665 m_pBoxes[nIndex] = m_aBuilders.back()->weld_box("togglebox");
1666
1667 if (bLeft)
1668 m_aOrigContainers.back()->move(m_pBoxes[nIndex].get(), m_xLeft.get());
1669 else
1670 m_aOrigContainers.back()->move(m_pBoxes[nIndex].get(), m_xRight.get());
1671
1672 m_pBoxes[nIndex]->set_grid_left_attach(1);
1673 m_pBoxes[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1674 m_pBoxes[nIndex]->set_hexpand(true);
1675
1676 m_xUseTargetURLCB = m_aBuilders.back()->weld_check_button("usetargeturlcb");
1677 m_xUseTargetURLCB->set_active(m_bNewEntryMode
1678 || pFields[aCurInfo.nToxField].toAsciiLowerCase() == "true");
1679 m_xUseTargetURLCB->set_grid_left_attach(1);
1680 m_xUseTargetURLCB->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1681 m_xUseTargetURLCB->set_hexpand(true);
1682 m_xUseTargetURLCB->show();
1683 m_xUseTargetURLCB->set_help_id(aCurInfo.pHelpId);
1684 m_aFixedTexts.back()->set_mnemonic_widget(m_xUseTargetURLCB.get());
1685 }
1686 else
1687 {
1688 m_pBoxes[nIndex] = m_aBuilders.back()->weld_box("vbox");
1689 m_pEdits[nIndex] = m_aBuilders.back()->weld_entry("entry");
1690 if (bLeft)
1691 m_aOrigContainers.back()->move(m_pBoxes[nIndex].get(), m_xLeft.get());
1692 else
1693 m_aOrigContainers.back()->move(m_pBoxes[nIndex].get(), m_xRight.get());
1694
1695 m_pBoxes[nIndex]->set_grid_left_attach(1);
1696 m_pBoxes[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1697 m_pBoxes[nIndex]->set_hexpand(true);
1698 if (aCurInfo.nToxField == AUTH_FIELD_LOCAL_URL)
1699 {
1700 m_xLocalBrowseButton = m_aBuilders.back()->weld_button("browse");
1701 m_xLocalBrowseButton->connect_clicked(
1702 LINK(this, SwCreateAuthEntryDlg_Impl, BrowseHdl));
1703 m_xLocalPageCB = m_aBuilders.back()->weld_check_button("pagecb");
1704 // Distinguish different instances of this for ui-testing.
1705 m_xLocalPageCB->set_buildable_name(m_xLocalPageCB->get_buildable_name()
1706 + "-local-visible");
1707 m_xLocalPageSB = m_aBuilders.back()->weld_spin_button("pagesb");
1708 }
1709
1710 // Now that both pEdits[nIndex] and m_xPageSB is initialized, set their values.
1711 OUString aText = pFields[aCurInfo.nToxField];
1712 if (aCurInfo.nToxField == AUTH_FIELD_LOCAL_URL)
1713 {
1714 OUString aUrl;
1715 int nPageNumber;
1716 if (SplitUrlAndPage(aText, aUrl, nPageNumber))
1717 {
1718 m_pEdits[nIndex]->set_text(aUrl);
1719 m_xLocalPageCB->set_active(true);
1720 m_xLocalPageSB->set_sensitive(true);
1721 m_xLocalPageSB->set_value(nPageNumber);
1722 }
1723 else
1724 {
1725 m_pEdits[nIndex]->set_text(aText);
1726 }
1727 }
1728 else
1729 {
1730 m_pEdits[nIndex]->set_text(aText);
1731 }
1732 m_pEdits[nIndex]->show();
1733 m_pEdits[nIndex]->set_help_id(aCurInfo.pHelpId);
1734
1735 if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
1736 {
1737 m_pEdits[nIndex]->connect_changed(LINK(this, SwCreateAuthEntryDlg_Impl, ShortNameHdl));
1738 m_bNameAllowed = !pFields[nIndex].isEmpty();
1739 if(!bCreate)
1740 {
1741 m_aFixedTexts.back()->set_sensitive(false);
1742 m_pEdits[nIndex]->set_sensitive(false);
1743 }
1744 }
1745 else if (aCurInfo.nToxField == AUTH_FIELD_LOCAL_URL)
1746 {
1747 m_xLocalPageCB->show();
1748 m_xLocalPageCB->connect_toggled(LINK(this, SwCreateAuthEntryDlg_Impl, PageNumHdl));
1749 m_xLocalPageSB->show();
1750 }
1751
1752 m_aFixedTexts.back()->set_mnemonic_widget(m_pEdits[nIndex].get());
1753 }
1754 if(bLeft)
1755 ++nLeftRow;
1756 else
1757 ++nRightRow;
1758 bLeft = !bLeft;
1759 }
1760 assert(m_xTypeListBox && "this will exist after the loop");
1761 EnableHdl(*m_xTypeListBox);
1762}
1763
1764OUString SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const
1765{
1767 {
1768 assert(m_xTypeListBox && "No ListBox");
1769 return OUString::number(m_xTypeListBox->get_active());
1770 }
1771
1772 if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
1773 {
1774 assert(m_xIdentifierBox && "No ComboBox");
1775 return m_xIdentifierBox->get_active_text();
1776 }
1777
1779 {
1780 assert(m_xUseTargetURLCB && "No UseTargetURL");
1781 return (m_xUseTargetURLCB->get_active() ? OUString("true") : OUString("false"));
1782 }
1783
1784 for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
1785 {
1786 const TextInfo aCurInfo = aTextInfoArr[nIndex];
1787 if(aCurInfo.nToxField == eField)
1788 {
1789 if (aCurInfo.nToxField == AUTH_FIELD_LOCAL_URL)
1790 {
1791 return MergeUrlAndPage(m_pEdits[nIndex]->get_text(), m_xLocalPageSB);
1792 }
1793 else
1794 {
1795 return m_pEdits[nIndex]->get_text();
1796 }
1797 }
1798 }
1799
1800 return OUString();
1801}
1802
1803IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, weld::ComboBox&, rBox, void)
1804{
1805 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1806 m_rWrtSh.GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1807 if(!pFType)
1808 return;
1809
1810 const SwAuthEntry* pEntry = pFType->GetEntryByIdentifier(
1811 rBox.get_active_text());
1812 if(!pEntry)
1813 return;
1814
1815 for(int i = 0; i < AUTH_FIELD_END; i++)
1816 {
1817 const TextInfo aCurInfo = aTextInfoArr[i];
1818 if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
1819 continue;
1820 if(AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField)
1821 m_xTypeListBox->set_active_text(
1822 pEntry->GetAuthorField(aCurInfo.nToxField));
1823 else
1824 m_pEdits[i]->set_text(
1825 pEntry->GetAuthorField(aCurInfo.nToxField));
1826 }
1827}
1828
1829IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, weld::Entry&, rEdit, void)
1830{
1831 if (m_aShortNameCheckLink.IsSet())
1832 {
1833 bool bEnable = m_aShortNameCheckLink.Call(rEdit);
1834 m_bNameAllowed |= bEnable;
1835 m_xOKBT->set_sensitive(m_xTypeListBox->get_active() != -1 && bEnable);
1836 }
1837}
1838
1839IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, weld::ComboBox&, rBox, void)
1840{
1841 m_xOKBT->set_sensitive(m_bNameAllowed && rBox.get_active() != -1);
1842 m_xLocalBrowseButton->show();
1843};
1844
1845IMPL_LINK(SwCreateAuthEntryDlg_Impl, BrowseHdl, weld::Button&, rButton, void)
1846{
1847 sfx2::FileDialogHelper aFileDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
1848 FileDialogFlags::NONE, getDialog());
1849 OUString aPath;
1850 if (&rButton == m_xLocalBrowseButton.get())
1851 {
1852 aPath = GetEntryText(AUTH_FIELD_LOCAL_URL);
1853 }
1854 if (!aPath.isEmpty())
1855 {
1856 aFileDlg.SetDisplayDirectory(aPath);
1857 }
1858 else
1859 {
1860 OUString aBaseURL = m_rWrtSh.GetDoc()->GetDocShell()->getDocumentBaseURL();
1861 if (!aBaseURL.isEmpty())
1862 {
1863 aFileDlg.SetDisplayDirectory(aBaseURL);
1864 }
1865 }
1866
1867 if (aFileDlg.Execute() != ERRCODE_NONE)
1868 {
1869 return;
1870 }
1871
1872 aPath = aFileDlg.GetPath();
1873
1874 for (int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
1875 {
1876 const TextInfo& rCurInfo = aTextInfoArr[nIndex];
1877 if (rCurInfo.nToxField == AUTH_FIELD_LOCAL_URL && &rButton == m_xLocalBrowseButton.get())
1878 {
1879 m_pEdits[nIndex]->set_text(aPath);
1880 break;
1881 }
1882 }
1883};
1884
1885IMPL_LINK(SwCreateAuthEntryDlg_Impl, PageNumHdl, weld::Toggleable&, rPageCB, void)
1886{
1887 if (rPageCB.get_active())
1888 {
1889 m_xLocalPageSB->set_sensitive(true);
1890 m_xLocalPageSB->set_value(1);
1891 }
1892 else
1893 {
1894 m_xLocalPageSB->set_sensitive(false);
1895 }
1896}
1897
1899 SfxChildWindow* pChild,
1900 weld::Window *pParent,
1901 SfxChildWinInfo const * pInfo,
1902 bool bNew)
1903 : SfxModelessDialogController(_pBindings, pChild, pParent,
1904 "modules/swriter/ui/bibliographyentry.ui", "BibliographyEntryDialog")
1905 , m_aContent(*this, *m_xBuilder, bNew)
1906{
1907 Initialize(pInfo);
1908 if (SwWrtShell* pWrtShell = ::GetActiveWrtShell())
1909 m_aContent.ReInitDlg(*pWrtShell);
1910}
1911
1913{
1916}
1917
1919{
1920 m_aContent.ReInitDlg( rWrtShell );
1921}
1922
1924 : SfxDialogController(pParent, "modules/swriter/ui/bibliographyentry.ui",
1925 "BibliographyEntryDialog")
1926 , m_aContent(*this, *m_xBuilder, false)
1927{
1928 m_aContent.ReInitDlg(rSh);
1929}
1930
1932{
1933 short ret = SfxDialogController::run();
1934 if (ret == RET_OK)
1935 Apply();
1936 return ret;
1937}
1938
1940{
1941 m_aContent.InsertHdl(*m_aContent.m_xActionBT);
1942}
1943
1944/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ UndoArg1
Definition: SwRewriter.hxx:29
Reference< XExecutableDialog > m_xDialog
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void Initialize(SfxChildWinInfo const *pInfo)
virtual void Activate() override
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
OUString const & GetAuthorField(ToxAuthorityField ePos) const
Definition: authfld.hxx:218
SwAuthorMarkPane m_aContent
Definition: swuiidxmrk.hxx:212
virtual void Activate() override
SwAuthMarkFloatDlg(SfxBindings *pBindings, SfxChildWindow *pChild, weld::Window *pParent, SfxChildWinInfo const *pInfo, bool bNew)
void ReInitDlg(SwWrtShell &rWrtShell)
virtual short int run() override
SwAuthorMarkPane m_aContent
Definition: swuiidxmrk.hxx:225
SwAuthMarkModalDlg(weld::Window *pParent, SwWrtShell &rSh)
std::unique_ptr< weld::RadioButton > m_xFromDocContentRB
Definition: swuiidxmrk.hxx:183
std::unique_ptr< weld::Button > m_xCreateEntryPB
Definition: swuiidxmrk.hxx:190
std::unique_ptr< weld::Label > m_xAuthorFI
Definition: swuiidxmrk.hxx:184
std::unique_ptr< weld::Button > m_xActionBT
Definition: swuiidxmrk.hxx:188
static bool s_bIsFromComponent
Definition: swuiidxmrk.hxx:165
std::unique_ptr< weld::ComboBox > m_xEntryLB
Definition: swuiidxmrk.hxx:187
weld::DialogController & m_rDialog
Definition: swuiidxmrk.hxx:163
OUString m_sFields[AUTH_FIELD_END]
Definition: swuiidxmrk.hxx:176
std::unique_ptr< weld::RadioButton > m_xFromComponentRB
Definition: swuiidxmrk.hxx:182
SwWrtShell * m_pSh
Definition: swuiidxmrk.hxx:173
SwAuthorMarkPane(weld::DialogController &rDialog, weld::Builder &rBuilder, bool bNew)
std::unique_ptr< weld::Button > m_xEditEntryPB
Definition: swuiidxmrk.hxx:191
OUString m_sCreatedEntry[AUTH_FIELD_END]
Definition: swuiidxmrk.hxx:178
std::unique_ptr< weld::Label > m_xTitleFI
Definition: swuiidxmrk.hxx:185
std::unique_ptr< weld::Entry > m_xEntryED
Definition: swuiidxmrk.hxx:186
void ReInitDlg(SwWrtShell &rWrtShell)
std::unique_ptr< weld::Button > m_xCloseBT
Definition: swuiidxmrk.hxx:189
static OUString const & GetAuthTypeName(ToxAuthorityType eType)
Definition: initui.cxx:282
void GetAllEntryIdentifiers(std::vector< OUString > &rToFill) const
Definition: authfld.cxx:136
SwAuthEntry * GetEntryByIdentifier(std::u16string_view rIdentifier) const
Definition: authfld.cxx:145
Represents an inserted bibliography entry, created using Insert -> Table of Contents and Index -> Bib...
Definition: authfld.hxx:161
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2265
void SttCursorMove()
Definition: crsrsh.cxx:301
void SwapPam()
Definition: crsrsh.cxx:990
sal_uInt16 GetCursorCnt(bool bAll=true) const
Get the number of elements in the ring of cursors.
Definition: crsrsh.cxx:2767
const SwTOXMark & GotoTOXMark(const SwTOXMark &rStart, SwTOXSearch eDir)
traveling between marks
Definition: crstrvl.cxx:583
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2574
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:1068
sal_Int32 Find_Text(const i18nutil::SearchOptions2 &rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, bool &bCancel, FindRanges eRng, bool bReplace=false)
Definition: crsrsh.cxx:3490
void ClearMark()
Definition: crsrsh.cxx:953
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3374
void EndCursorMove(const bool bIdleEnd=false)
Definition: crsrsh.cxx:310
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const
Manage types of content tables.
Definition: edws.cxx:190
SvtScriptType GetScriptType() const
returns the script type of the selection
Definition: edattr.cxx:662
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Definition: edfld.cxx:64
void GetTOIKeys(SwTOIKeyType eTyp, std::vector< OUString > &rArr) const
Key for managing index.
Definition: edtox.cxx:210
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
const SwTOXType * GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const
Definition: edtox.cxx:203
void EndAllAction()
Definition: edws.cxx:97
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
void UpdateCurField(sal_uInt32 nFormat, const OUString &rPar1, const OUString &rPar2, std::unique_ptr< SwField > _pField=nullptr)
Definition: fldmgr.cxx:1571
bool InsertField(SwInsertField_Data &rData)
Definition: fldmgr.cxx:897
SwField * GetCurField()
Definition: fldmgr.cxx:432
SwFieldIds Which() const
Definition: fldbas.hxx:275
Base class of all fields.
Definition: fldbas.hxx:295
SwFieldType * GetTyp() const
Definition: fldbas.hxx:401
void ReInitDlg(SwWrtShell &rWrtShell)
virtual void Activate() override
SwIndexMarkFloatDlg(SfxBindings *pBindings, SfxChildWindow *pChild, weld::Window *pParent, SfxChildWinInfo const *pInfo, bool bNew)
SwIndexMarkPane m_aContent
Definition: swuiidxmrk.hxx:138
SwIndexMarkPane m_aContent
Definition: swuiidxmrk.hxx:152
virtual short int run() override
SwIndexMarkModalDlg(weld::Window *pParent, SwWrtShell &rSh, SwTOXMark const *pCurTOXMark)
virtual ~SwIndexMarkModalDlg() override
std::unique_ptr< weld::CheckButton > m_xSearchCaseSensitiveCB
Definition: swuiidxmrk.hxx:81
std::unique_ptr< weld::CheckButton > m_xApplyToAllCB
Definition: swuiidxmrk.hxx:80
std::unique_ptr< weld::Entry > m_xPhoneticED0
Definition: swuiidxmrk.hxx:68
SwWrtShell * m_pSh
Definition: swuiidxmrk.hxx:60
void UpdateLanguageDependenciesForPhoneticReading()
Definition: swuiidxmrk.cxx:365
std::shared_ptr< weld::Dialog > m_xDialog
Definition: swuiidxmrk.hxx:40
std::unique_ptr< weld::Label > m_xPhoneticFT0
Definition: swuiidxmrk.hxx:67
std::unique_ptr< weld::Label > m_xPhoneticFT2
Definition: swuiidxmrk.hxx:75
std::unique_ptr< weld::ComboBox > m_xKey2DCB
Definition: swuiidxmrk.hxx:74
std::unique_ptr< weld::Button > m_xNewBT
Definition: swuiidxmrk.hxx:64
LanguageType m_nLangForPhoneticReading
Definition: swuiidxmrk.hxx:53
void ReInitDlg(SwWrtShell &rWrtShell, SwTOXMark const *pCurTOXMark=nullptr)
void ModifyHdl(const weld::Widget &rWidget)
Definition: swuiidxmrk.cxx:712
std::unique_ptr< weld::Label > m_xTypeFT
Definition: swuiidxmrk.hxx:62
std::unique_ptr< weld::Button > m_xNextBT
Definition: swuiidxmrk.hxx:89
std::unique_ptr< weld::SpinButton > m_xLevelNF
Definition: swuiidxmrk.hxx:78
std::unique_ptr< weld::Button > m_xNextSameBT
Definition: swuiidxmrk.hxx:87
std::unique_ptr< weld::CheckButton > m_xSearchCaseWordOnlyCB
Definition: swuiidxmrk.hxx:82
bool m_bIsPhoneticReadingEnabled
Definition: swuiidxmrk.hxx:54
void UpdateKeyBoxes()
Definition: swuiidxmrk.cxx:609
std::unique_ptr< weld::Button > m_xSyncED
Definition: swuiidxmrk.hxx:66
std::unique_ptr< weld::Label > m_xKey2FT
Definition: swuiidxmrk.hxx:73
std::unique_ptr< weld::ComboBox > m_xKey1DCB
Definition: swuiidxmrk.hxx:70
std::unique_ptr< weld::Label > m_xLevelFT
Definition: swuiidxmrk.hxx:77
bool m_bPhoneticED0_ChangedByUser
Definition: swuiidxmrk.hxx:50
std::unique_ptr< weld::Entry > m_xPhoneticED2
Definition: swuiidxmrk.hxx:76
std::unique_ptr< weld::Entry > m_xEntryED
Definition: swuiidxmrk.hxx:65
std::unique_ptr< weld::Button > m_xOKBT
Definition: swuiidxmrk.hxx:83
std::unique_ptr< weld::Label > m_xPhoneticFT1
Definition: swuiidxmrk.hxx:71
OUString GetDefaultPhoneticReading(const OUString &rText)
Definition: swuiidxmrk.cxx:412
std::unique_ptr< weld::Entry > m_xPhoneticED1
Definition: swuiidxmrk.hxx:72
std::unique_ptr< weld::Button > m_xPrevBT
Definition: swuiidxmrk.hxx:88
css::uno::Reference< css::i18n::XExtendedIndexEntrySupplier > m_xExtendedIndexEntrySupplier
Definition: swuiidxmrk.hxx:56
bool const m_bNewMark
Definition: swuiidxmrk.hxx:47
std::unique_ptr< weld::ComboBox > m_xTypeDCB
Definition: swuiidxmrk.hxx:63
SwIndexMarkPane(std::shared_ptr< weld::Dialog > xDialog, weld::Builder &rBuilder, bool bNewDlg, SwWrtShell *pWrtShell)
Definition: swuiidxmrk.cxx:131
std::unique_ptr< weld::Button > m_xCloseBT
Definition: swuiidxmrk.hxx:84
OUString m_aOrgStr
Definition: swuiidxmrk.hxx:45
bool IsTOXType(const OUString &rName)
Definition: swuiidxmrk.hxx:133
std::unique_ptr< weld::Button > m_xPrevSameBT
Definition: swuiidxmrk.hxx:86
std::unique_ptr< weld::Label > m_xKey1FT
Definition: swuiidxmrk.hxx:69
std::unique_ptr< SwTOXMgr > m_pTOXMgr
Definition: swuiidxmrk.hxx:59
std::unique_ptr< weld::CheckButton > m_xMainEntryCB
Definition: swuiidxmrk.hxx:79
std::unique_ptr< weld::Button > m_xDelBT
Definition: swuiidxmrk.hxx:85
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
void SetPhoneticReadingOfAltStr(const OUString &rSet)
Definition: toxmgr.hxx:216
void SetPrimKey(const OUString &rSet)
Definition: toxmgr.hxx:204
void SetSecKey(const OUString &rSet)
Definition: toxmgr.hxx:207
void SetTOUName(const OUString &rSet)
Definition: toxmgr.hxx:213
void SetPhoneticReadingOfPrimKey(const OUString &rSet)
Definition: toxmgr.hxx:219
void SetMainEntry(bool bSet)
Definition: toxmgr.hxx:201
void SetAltStr(const OUString &rSet)
Definition: toxmgr.hxx:210
void SetPhoneticReadingOfSecKey(const OUString &rSet)
Definition: toxmgr.hxx:222
void SetLevel(int nSet)
Definition: toxmgr.hxx:198
const SwTextTOXMark * GetTextTOXMark() const
Definition: tox.hxx:160
const SwTOXType * GetTOXType() const
Definition: tox.hxx:576
sal_uInt16 GetLevel() const
Definition: tox.hxx:628
OUString const & GetSecondaryKeyReading() const
Definition: tox.hxx:658
OUString const & GetSecondaryKey() const
Definition: tox.hxx:640
OUString GetText(SwRootFrame const *pLayout) const
Definition: tox.cxx:201
OUString const & GetPrimaryKey() const
Definition: tox.hxx:634
bool IsMainEntry() const
Definition: tox.hxx:155
OUString const & GetTextReading() const
Definition: tox.hxx:646
OUString const & GetPrimaryKeyReading() const
Definition: tox.hxx:652
Built on top of SwWrtShell, provides functionality to insert, update or perform other actions on vari...
Definition: toxmgr.hxx:231
void InsertTOXMark(const SwTOXMarkDescription &rDesc)
Definition: toxmgr.cxx:60
const OUString & GetTypeName() const
Definition: tox.hxx:690
TOXTypes GetType() const
Definition: tox.hxx:693
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3469
const SwTextNode * GetpTextNd() const
Definition: txttxmrk.hxx:44
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2661
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2159
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:625
OUString GetSelectionTextParam(bool bCompleteWords, bool bEraseTrail)
Definition: view.cxx:1665
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
bool HasSelection() const
Definition: wrtsh.hxx:147
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:334
bool SelectTextAttr(sal_uInt16 nWhich, const SwTextAttr *pAttr=nullptr)
Definition: move.cxx:725
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2041
const SwView & GetView() const
Definition: wrtsh.hxx:443
OUString GetPath() const
void SetDisplayDirectory(const OUString &rPath)
void set_title(const OUString &rTitle)
#define FN_INSERT_IDX_ENTRY_DLG
Definition: cmdid.h:237
#define FN_INSERT_AUTH_ENTRY_DLG
Definition: cmdid.h:301
#define FN_EDIT_IDX_ENTRY_DLG
Definition: cmdid.h:81
@ InBodyOnly
Find only in body - only in combination with FindRanges::InSelAll !!!
@ InSelAll
All (only in non-body and selections).
int nCount
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
virtual OUString GetName() const override
virtual void SetCheckNameHdl(const Link< AbstractSvxNameDialog &, bool > &rLink, bool bCheckImmediately=false) override
#define ERRCODE_NONE
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
@ TableOfAuthorities
DocumentType eType
#define HID_AUTH_FIELD_JOURNAL
Definition: helpids.h:58
#define HID_AUTH_FIELD_BOOKTITLE
Definition: helpids.h:52
#define HID_AUTH_FIELD_SERIES
Definition: helpids.h:66
#define HID_AUTH_FIELD_PUBLISHER
Definition: helpids.h:64
#define HID_AUTH_FIELD_EDITOR
Definition: helpids.h:55
#define HID_AUTH_FIELD_ORGANIZATIONS
Definition: helpids.h:62
#define HID_AUTH_FIELD_REPORT_TYPE
Definition: helpids.h:68
#define HID_AUTH_FIELD_VOLUME
Definition: helpids.h:69
#define HID_AUTH_FIELD_IDENTIFIER
Definition: helpids.h:47
#define HID_AUTH_FIELD_AUTHOR
Definition: helpids.h:51
#define HID_AUTH_FIELD_HOWPUBLISHED
Definition: helpids.h:56
#define HID_AUTH_FIELD_INSTITUTION
Definition: helpids.h:57
#define HID_AUTH_FIELD_SCHOOL
Definition: helpids.h:65
#define HID_AUTH_FIELD_TITLE
Definition: helpids.h:67
#define HID_AUTH_FIELD_CUSTOM1
Definition: helpids.h:72
#define HID_AUTH_FIELD_USE_TARGET_URL
Definition: helpids.h:80
#define HID_AUTH_FIELD_CHAPTER
Definition: helpids.h:53
#define HID_AUTH_FIELD_CUSTOM4
Definition: helpids.h:75
#define HID_AUTH_FIELD_AUTHORITY_TYPE
Definition: helpids.h:48
#define HID_AUTH_FIELD_CUSTOM5
Definition: helpids.h:76
#define HID_AUTH_FIELD_EDITION
Definition: helpids.h:54
#define HID_AUTH_FIELD_MONTH
Definition: helpids.h:59
#define HID_AUTH_FIELD_NOTE
Definition: helpids.h:60
#define HID_AUTH_FIELD_CUSTOM3
Definition: helpids.h:74
#define HID_AUTH_FIELD_YEAR
Definition: helpids.h:70
#define HID_AUTH_FIELD_ISBN
Definition: helpids.h:77
#define HID_AUTH_FIELD_URL
Definition: helpids.h:71
#define HID_AUTH_FIELD_ANNOTE
Definition: helpids.h:50
#define HID_AUTH_FIELD_CUSTOM2
Definition: helpids.h:73
#define HID_AUTH_FIELD_TARGET_URL
Definition: helpids.h:79
#define HID_AUTH_FIELD_ADDRESS
Definition: helpids.h:49
#define HID_AUTH_FIELD_LOCAL_URL
Definition: helpids.h:78
#define HID_AUTH_FIELD_PAGES
Definition: helpids.h:63
#define HID_AUTH_FIELD_NUMBER
Definition: helpids.h:61
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
const LanguageTag & GetAppLanguageTag()
Definition: init.cxx:746
sal_Int32 nIndex
#define LANGUAGE_CHINESE_SIMPLIFIED
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
bool IsCJKFontEnabled()
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:393
const LanguageTag & getLocale()
Reference< XComponentContext > getProcessComponentContext()
int i
constexpr OUStringLiteral last
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
const SvxPageUsage aArr[]
eField
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwWrtShell * GetActiveWrtShell()
Definition: swmodul1.cxx:108
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
IMPL_LINK_NOARG(SwIndexMarkPane, SyncSelectionHdl, weld::Button &, void)
Definition: swuiidxmrk.cxx:429
const TextInfo aTextInfoArr[]
static sal_uInt16 nKey1Pos
Definition: swuiidxmrk.cxx:65
static sal_Int32 nTypePos
Definition: swuiidxmrk.cxx:64
#define POS_CONTENT
Definition: swuiidxmrk.cxx:61
IMPL_LINK(SwNewUserIdxDlg, ModifyHdl, weld::Entry &, rEdit, void)
Definition: swuiidxmrk.cxx:654
#define POS_INDEX
Definition: swuiidxmrk.cxx:62
static void lcl_SelectSameStrings(SwWrtShell &rSh, bool bWordOnly, bool bCaseSensitive)
Definition: swuiidxmrk.cxx:494
static OUString lcl_FindColumnEntry(const uno::Sequence< beans::PropertyValue > &rFields, std::u16string_view rColumnTitle)
static sal_uInt16 nKey2Pos
Definition: swuiidxmrk.cxx:67
@ INDEX_ENTRY_INSERT
@ INDEX_ENTRY_DELETE
#define TOX_STYLE_DELIMITER
Definition: tox.hxx:422
@ TOI_SECONDARY
Definition: toxe.hxx:33
@ TOI_PRIMARY
Definition: toxe.hxx:32
ToxAuthorityField
Definition: toxe.hxx:83
@ AUTH_FIELD_SCHOOL
Definition: toxe.hxx:103
@ AUTH_FIELD_JOURNAL
Definition: toxe.hxx:96
@ AUTH_FIELD_CUSTOM4
Definition: toxe.hxx:114
@ AUTH_FIELD_CHAPTER
Definition: toxe.hxx:91
@ AUTH_FIELD_PAGES
Definition: toxe.hxx:101
@ AUTH_FIELD_SERIES
Definition: toxe.hxx:104
@ AUTH_FIELD_PUBLISHER
Definition: toxe.hxx:102
@ AUTH_FIELD_TITLE
Definition: toxe.hxx:105
@ AUTH_FIELD_CUSTOM5
Definition: toxe.hxx:115
@ AUTH_FIELD_IDENTIFIER
Definition: toxe.hxx:84
@ AUTH_FIELD_EDITOR
Definition: toxe.hxx:93
@ AUTH_FIELD_CUSTOM1
Definition: toxe.hxx:111
@ AUTH_FIELD_AUTHOR
Definition: toxe.hxx:89
@ AUTH_FIELD_HOWPUBLISHED
Definition: toxe.hxx:94
@ AUTH_FIELD_ISBN
Definition: toxe.hxx:116
@ AUTH_FIELD_CUSTOM2
Definition: toxe.hxx:112
@ AUTH_FIELD_LOCAL_URL
Definition: toxe.hxx:117
@ AUTH_FIELD_ADDRESS
Definition: toxe.hxx:87
@ AUTH_FIELD_INSTITUTION
Definition: toxe.hxx:95
@ AUTH_FIELD_NOTE
Definition: toxe.hxx:98
@ AUTH_FIELD_VOLUME
Definition: toxe.hxx:107
@ AUTH_FIELD_AUTHORITY_TYPE
Definition: toxe.hxx:85
@ AUTH_FIELD_ORGANIZATIONS
Definition: toxe.hxx:100
@ AUTH_FIELD_NUMBER
Definition: toxe.hxx:99
@ AUTH_FIELD_URL
Definition: toxe.hxx:110
@ AUTH_FIELD_ANNOTE
Definition: toxe.hxx:88
@ AUTH_FIELD_MONTH
Definition: toxe.hxx:97
@ AUTH_FIELD_BOOKTITLE
Definition: toxe.hxx:90
@ AUTH_FIELD_REPORT_TYPE
Definition: toxe.hxx:106
@ AUTH_FIELD_EDITION
Definition: toxe.hxx:92
@ AUTH_FIELD_TARGET_URL
Definition: toxe.hxx:118
@ AUTH_FIELD_END
Definition: toxe.hxx:120
@ AUTH_FIELD_CUSTOM3
Definition: toxe.hxx:113
@ AUTH_FIELD_USE_TARGET_URL
Definition: toxe.hxx:119
@ AUTH_FIELD_YEAR
Definition: toxe.hxx:108
TOXTypes
Definition: toxe.hxx:40
@ TOX_USER
Definition: toxe.hxx:42
@ TOX_CONTENT
Definition: toxe.hxx:43
@ TOX_INDEX
Definition: toxe.hxx:41
ToxAuthorityType
Definition: toxe.hxx:53
@ AUTH_TYPE_END
Definition: toxe.hxx:78
@ TOX_SAME_PRV
Definition: toxe.hxx:27
@ TOX_PRV
Definition: toxe.hxx:25
@ TOX_SAME_NXT
Definition: toxe.hxx:26
@ TOX_NXT
Definition: toxe.hxx:24
::ucbhelper::Content m_aContent
RET_OK
RET_CLOSE
RET_CANCEL
RET_YES