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 , m_xForSelectedEntry(rBuilder.weld_label("selectedentrytitle"))
172{
173 m_xSyncED->show();
174
176 {
177 uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
178
179 m_xExtendedIndexEntrySupplier = i18n::IndexEntrySupplier::create(xContext);
180
181 m_xPhoneticFT0->show();
182 m_xPhoneticED0->show();
183 m_xPhoneticFT1->show();
184 m_xPhoneticED1->show();
185 m_xPhoneticFT2->show();
186 m_xPhoneticED2->show();
187 }
188
189 // tdf#129726 there are two help pages for this dialog, one for each mode,
190 // where a widget/dialog appears in both, use -insert/-edit to disambiguate
191 if (m_bNewMark)
192 {
193 m_xDialog->set_title(SwResId(STR_IDXMRK_INSERT));
194 m_xDialog->set_help_id(m_xDialog->get_help_id() + "-insert");
195 m_xTypeDCB->set_help_id(m_xTypeDCB->get_help_id() + "-insert");
196 }
197 else
198 {
199 m_xDialog->set_title(SwResId(STR_IDXMRK_EDIT));
200 m_xDialog->set_help_id(m_xDialog->get_help_id() + "-edit");
201 m_xTypeDCB->set_help_id(m_xTypeDCB->get_help_id() + "-edit");
202 }
203
204 m_xDelBT->connect_clicked(LINK(this,SwIndexMarkPane, DelHdl));
205 m_xPrevBT->connect_clicked(LINK(this,SwIndexMarkPane, PrevHdl));
206 m_xPrevSameBT->connect_clicked(LINK(this,SwIndexMarkPane, PrevSameHdl));
207 m_xNextBT->connect_clicked(LINK(this,SwIndexMarkPane, NextHdl));
208 m_xNextSameBT->connect_clicked(LINK(this,SwIndexMarkPane, NextSameHdl));
209 m_xTypeDCB->connect_changed(LINK(this,SwIndexMarkPane, ModifyListBoxHdl));
210 m_xKey1DCB->connect_changed(LINK(this,SwIndexMarkPane, KeyDCBModifyHdl));
211 m_xKey2DCB->connect_changed(LINK(this,SwIndexMarkPane, KeyDCBModifyHdl));
212 m_xCloseBT->connect_clicked(LINK(this,SwIndexMarkPane, CloseHdl));
213 m_xEntryED->connect_changed(LINK(this,SwIndexMarkPane, ModifyEditHdl));
214 m_xNewBT->connect_clicked(LINK(this, SwIndexMarkPane, NewUserIdxHdl));
215 m_xApplyToAllCB->connect_toggled(LINK(this, SwIndexMarkPane, SearchTypeHdl));
216 m_xPhoneticED0->connect_changed(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
217 m_xPhoneticED1->connect_changed(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
218 m_xPhoneticED2->connect_changed(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
219 m_xSyncED->connect_clicked(LINK(this, SwIndexMarkPane, SyncSelectionHdl));
220
221 if (m_bNewMark)
222 m_xDelBT->hide();
223 else
224 m_xNewBT->hide();
225 m_xOKBT->show();
226 m_xOKBT->connect_clicked(LINK(this, SwIndexMarkPane, InsertHdl));
227
228 m_xEntryED->grab_focus();
229}
230
231// Newly initialise controls with the new selection
233{
234 assert(m_pSh && m_pTOXMgr && "no shell?");
235 // contents index
236 const SwTOXType* pType = m_pTOXMgr->GetTOXType(TOX_CONTENT);
237 assert(pType && "No directory type !!");
238 OUString sTmpTypeSelection;
239 if (m_xTypeDCB->get_active() != -1)
240 sTmpTypeSelection = m_xTypeDCB->get_active_text();
241 m_xTypeDCB->clear();
242 m_xTypeDCB->append_text(pType->GetTypeName());
243
244 // keyword index
245 pType = m_pTOXMgr->GetTOXType(TOX_INDEX);
246 assert(pType && "No directory type !!");
247 m_xTypeDCB->append_text(pType->GetTypeName());
248
249 // user index
250 sal_uInt16 nCount = m_pSh->GetTOXTypeCount(TOX_USER);
251 for (sal_uInt16 i = 0; i < nCount; ++i)
252 m_xTypeDCB->append_text(m_pSh->GetTOXType(TOX_USER, i)->GetTypeName());
253
254 // read keywords primary
255 {
256 std::vector<OUString> aArr;
258 std::sort(aArr.begin(), aArr.end());
259 auto last = std::unique(aArr.begin(), aArr.end());
260 for (auto it = aArr.begin(); it != last; ++it)
261 m_xKey1DCB->append_text(*it);
262 }
263
264 // read keywords secondary
265 {
266 std::vector<OUString> aArr;
268 std::sort(aArr.begin(), aArr.end());
269 auto last = std::unique(aArr.begin(), aArr.end());
270 for (auto it = aArr.begin(); it != last; ++it)
271 m_xKey2DCB->append_text(*it);
272 }
273
275
276 // current entry
277 const SwTOXMark* pMark = m_pTOXMgr->GetCurTOXMark();
278 if( pMark && !m_bNewMark)
279 {
280 // Controls-Handling
281
282 // only if there are more than one
283 // if equal it lands at the same entry
285
286 const SwTOXMark* pMoveMark;
287 bool bShow = false;
288
289 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_PRV );
290 if( pMoveMark != pMark )
291 {
292 m_pSh->GotoTOXMark( *pMoveMark, TOX_NXT );
293 bShow = true;
294 }
295 m_xPrevBT->set_sensitive(pMoveMark != pMark);
296 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_NXT );
297 if( pMoveMark != pMark )
298 {
299 m_pSh->GotoTOXMark( *pMoveMark, TOX_PRV );
300 bShow = true;
301 }
302 m_xNextBT->set_sensitive(pMoveMark != pMark);
303 if( bShow )
304 {
305 m_xPrevBT->show();
306 m_xNextBT->show();
307 bShow = false;
308 }
309
310 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
311 if( pMoveMark != pMark )
312 {
313 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT );
314 bShow = true;
315 }
316 m_xPrevSameBT->set_sensitive(pMoveMark != pMark);
317 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
318 if( pMoveMark != pMark )
319 {
320 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV );
321 bShow = true;
322 }
323 m_xNextSameBT->set_sensitive(pMoveMark != pMark);
324 if( bShow )
325 {
326 m_xNextSameBT->show();
327 m_xPrevSameBT->show();
328 }
330
331 m_xTypeFT->show();
332
333 m_xTypeDCB->set_sensitive(false);
334 m_xTypeFT->set_sensitive(false);
335
336 UpdateDialog();
337 }
338 else
339 { // display current selection (first element) ????
340 if (m_pSh->GetCursorCnt() < 2)
341 {
344 m_xEntryED->set_text(m_aOrgStr);
345
346 //to include all equal entries may only be allowed in the body and even there
347 //only when a simple selection exists
348 const FrameTypeFlags nFrameType = m_pSh->GetFrameType(nullptr,true);
349 m_xForSelectedEntry->show();
350 m_xApplyToAllCB->show();
353 m_xApplyToAllCB->set_sensitive(!m_aOrgStr.isEmpty() &&
355 SearchTypeHdl(*m_xApplyToAllCB);
356 }
357
358 // index type is default
359 if (!sTmpTypeSelection.isEmpty() && m_xTypeDCB->find_text(sTmpTypeSelection) != -1)
360 m_xTypeDCB->set_active_text(sTmpTypeSelection);
361 else
362 m_xTypeDCB->set_active_text(m_xTypeDCB->get_text(nTypePos));
364 }
365}
366
368{
369 //no phonetic reading if no global cjk support
371 {
373 return;
374 }
376
377 //get the current language
378 if(!m_bNewMark) //if dialog is opened to iterate existing marks
379 {
380 OSL_ENSURE(m_pTOXMgr, "need TOXMgr");
381 if(!m_pTOXMgr)
382 return;
383 SwTOXMark* pMark = m_pTOXMgr->GetCurTOXMark();
384 OSL_ENSURE(pMark, "need current SwTOXMark");
385 if(!pMark)
386 return;
387 SwTextTOXMark* pTextTOXMark = pMark->GetTextTOXMark();
388 OSL_ENSURE(pTextTOXMark, "need current SwTextTOXMark");
389 if(!pTextTOXMark)
390 return;
391 const SwTextNode* pTextNode = pTextTOXMark->GetpTextNd();
392 OSL_ENSURE(pTextNode, "need current SwTextNode");
393 if(!pTextNode)
394 return;
395 sal_Int32 nTextIndex = pTextTOXMark->GetStart();
396 m_nLangForPhoneticReading = pTextNode->GetLang( nTextIndex );
397 }
398 else //if dialog is opened to create a new mark
399 {
400 sal_uInt16 nWhich;
401 switch(m_pSh->GetScriptType())
402 {
403 case SvtScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break;
404 case SvtScriptType::COMPLEX:nWhich = RES_CHRATR_CTL_LANGUAGE; break;
405 default:nWhich = RES_CHRATR_LANGUAGE; break;
406 }
407 SfxItemSet aLangSet(m_pSh->GetAttrPool(), nWhich, nWhich);
408 m_pSh->GetCurAttr(aLangSet);
409 m_nLangForPhoneticReading = static_cast<const SvxLanguageItem&>(aLangSet.Get(nWhich)).GetLanguage();
410 }
411
412}
413
414OUString SwIndexMarkPane::GetDefaultPhoneticReading( const OUString& rText )
415{
417 return OUString();
418
420}
421
423{
424 // display current selection (first element) ????
425 if (m_bNewMark)
426 {
427 m_xSyncED->set_sensitive(m_pSh->GetCursorCnt() < 2);
428 }
429}
430
432{
433 m_bSelected = !m_pSh->HasSelection();
434 m_aOrgStr = m_pSh->GetView().GetSelectionTextParam(true, false);
435 m_xEntryED->set_text(m_aOrgStr);
436
437 //to include all equal entries may only be allowed in the body and even there
438 //only when a simple selection exists
439 const FrameTypeFlags nFrameType = m_pSh->GetFrameType(nullptr,true);
440 m_xApplyToAllCB->show();
441 m_xSearchCaseSensitiveCB->show();
442 m_xSearchCaseWordOnlyCB->show();
443 m_xApplyToAllCB->set_sensitive(!m_aOrgStr.isEmpty() &&
445 SearchTypeHdl(*m_xApplyToAllCB);
446 ModifyHdl(*m_xEntryED);
447}
448
449// evaluate Ok-Button
451{
452 InsertUpdate();
453 if(m_bSelected)
454 m_pSh->ResetSelect(nullptr, false);
455}
456
457// apply changes
459{
462 SwRewriter aRewriter;
463
464 if( m_bNewMark )
465 {
466 InsertMark();
467
468 if ( m_pTOXMgr->GetCurTOXMark())
469 aRewriter.AddRule(UndoArg1,
470 m_pTOXMgr->GetCurTOXMark()->GetText(m_pSh->GetLayout()));
471 }
472 else if( !m_pSh->HasReadonlySel() )
473 {
474 if ( m_pTOXMgr->GetCurTOXMark())
475 aRewriter.AddRule(UndoArg1,
476 m_pTOXMgr->GetCurTOXMark()->GetText(m_pSh->GetLayout()));
477
478 if( m_bDel )
479 m_pTOXMgr->DeleteTOXMark();
480 else if( m_pTOXMgr->GetCurTOXMark() )
481 UpdateMark();
482 }
483
486
487 nTypePos = m_xTypeDCB->find_text(m_xTypeDCB->get_active_text());
488 if(nTypePos == -1)
489 nTypePos = 0;
490
491 nKey1Pos = m_xKey1DCB->find_text(m_xKey1DCB->get_active_text());
492 nKey2Pos = m_xKey2DCB->find_text(m_xKey2DCB->get_active_text());
493}
494
495// insert mark
496static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSensitive)
497{
498 rSh.Push();
499
500 i18nutil::SearchOptions2 aSearchOpt(
501 ( bWordOnly ? SearchFlags::NORM_WORD_ONLY : 0 ),
502 rSh.GetSelText(), OUString(),
504 0, 0, 0,
505 (bCaseSensitive
506 ? TransliterationFlags::NONE
507 : TransliterationFlags::IGNORE_CASE),
508 SearchAlgorithms2::ABSOLUTE,
509 '\\' );
510
511 rSh.ClearMark();
512 bool bCancel;
513
514 //todo/mba: assuming that notes should not be searched
515 rSh.Find_Text(aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End, bCancel,
517}
518
520{
521 auto nPos = m_xTypeDCB->find_text(m_xTypeDCB->get_active_text());
524
526
527 const int nLevel = m_xLevelNF->denormalize(m_xLevelNF->get_value());
528 switch( nPos)
529 {
530 case POS_CONTENT : break;
531 case POS_INDEX: // keyword index mark
532 {
534 aDesc.SetPrimKey(m_xKey1DCB->get_active_text());
535 aDesc.SetSecKey(m_xKey2DCB->get_active_text());
536 aDesc.SetMainEntry(m_xMainEntryCB->get_active());
540 }
541 break;
542 default: // Userdefined index mark
543 {
544 aDesc.SetTOUName(m_xTypeDCB->get_active_text());
545 }
546 }
547 if (m_aOrgStr != m_xEntryED->get_text())
548 aDesc.SetAltStr(m_xEntryED->get_text());
549 bool bApplyAll = m_xApplyToAllCB->get_active();
550 bool bWordOnly = m_xSearchCaseWordOnlyCB->get_active();
551 bool bCaseSensitive = m_xSearchCaseSensitiveCB->get_active();
552
554 // all equal strings have to be selected here so that the
555 // entry is applied to all equal strings
556 if(bApplyAll)
557 {
558 lcl_SelectSameStrings(*m_pSh, bWordOnly, bCaseSensitive);
559 }
560 aDesc.SetLevel(nLevel);
561 SwTOXMgr aMgr(m_pSh);
562 aMgr.InsertTOXMark(aDesc);
563 if(bApplyAll)
565
567}
568
569// update mark
571{
572 OUString aAltText(m_xEntryED->get_text());
573 OUString* pAltText = m_aOrgStr != m_xEntryED->get_text() ? &aAltText : nullptr;
574 //empty alternative texts are not allowed
575 if(pAltText && pAltText->isEmpty())
576 return;
577
579
580 auto nPos = m_xTypeDCB->find_text(m_xTypeDCB->get_active_text());
582 if(POS_CONTENT == nPos)
584 else if(POS_INDEX == nPos)
586
588 aDesc.SetLevel(m_xLevelNF->get_value());
589 if(pAltText)
590 aDesc.SetAltStr(*pAltText);
591
592 OUString aPrim(m_xKey1DCB->get_active_text());
593 if(!aPrim.isEmpty())
594 aDesc.SetPrimKey(aPrim);
595 OUString aSec(m_xKey2DCB->get_active_text());
596 if(!aSec.isEmpty())
597 aDesc.SetSecKey(aSec);
598
599 if(eType == TOX_INDEX)
600 {
604 }
605 aDesc.SetMainEntry(m_xMainEntryCB->get_visible() && m_xMainEntryCB->get_active());
606 m_pTOXMgr->UpdateTOXMark(aDesc);
607}
608
609// insert new keys
611{
612 OUString aKey(m_xKey1DCB->get_active_text());
613 auto nPos = m_xKey1DCB->find_text(aKey);
614 if(nPos == -1 && !aKey.isEmpty())
615 { // create new key
616 m_xKey1DCB->append_text(aKey);
617 }
618
619 aKey = m_xKey2DCB->get_active_text();
620 nPos = m_xKey2DCB->find_text(aKey);
621
622 if(nPos == -1 && !aKey.isEmpty())
623 { // create new key
624 m_xKey2DCB->append_text(aKey);
625 }
626}
627
628namespace {
629
630class SwNewUserIdxDlg : public weld::GenericDialogController
631{
632 SwIndexMarkPane* m_pDlg;
633
634 std::unique_ptr<weld::Button> m_xOKPB;
635 std::unique_ptr<weld::Entry> m_xNameED;
636
637 DECL_LINK(ModifyHdl, weld::Entry&, void);
638
639public:
640 explicit SwNewUserIdxDlg(SwIndexMarkPane* pPane, weld::Window* pParent)
641 : GenericDialogController(pParent, "modules/swriter/ui/newuserindexdialog.ui", "NewUserIndexDialog")
642 , m_pDlg(pPane)
643 , m_xOKPB(m_xBuilder->weld_button("ok"))
644 , m_xNameED(m_xBuilder->weld_entry("entry"))
645 {
646 m_xNameED->connect_changed(LINK(this, SwNewUserIdxDlg, ModifyHdl));
647 m_xOKPB->set_sensitive(false);
648 m_xNameED->grab_focus();
649 }
650 OUString GetName() const { return m_xNameED->get_text(); }
651};
652
653}
654
655IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, weld::Entry&, rEdit, void)
656{
657 m_xOKPB->set_sensitive(!rEdit.get_text().isEmpty() && !m_pDlg->IsTOXType(rEdit.get_text()));
658}
659
661{
662 SwNewUserIdxDlg aDlg(this, m_xDialog.get());
663 if (aDlg.run() == RET_OK)
664 {
665 OUString sNewName(aDlg.GetName());
666 m_xTypeDCB->append_text(sNewName);
667 m_xTypeDCB->set_active_text(sNewName);
668 }
669}
670
671IMPL_LINK( SwIndexMarkPane, SearchTypeHdl, weld::Toggleable&, rBox, void)
672{
673 const bool bEnable = rBox.get_active() && rBox.get_sensitive();
674 m_xSearchCaseWordOnlyCB->set_sensitive(bEnable);
675 m_xSearchCaseSensitiveCB->set_sensitive(bEnable);
676}
677
678IMPL_LINK(SwIndexMarkPane, InsertHdl, weld::Button&, rButton, void)
679{
680 Apply();
681 //close the dialog if only one entry is available
682 if(!m_bNewMark && !m_xPrevBT->get_visible() && !m_xNextBT->get_visible())
683 CloseHdl(rButton);
684}
685
687{
688 if (m_bNewMark)
689 {
690 if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
691 {
692 pViewFrm->GetDispatcher()->Execute(FN_INSERT_IDX_ENTRY_DLG,
693 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
694 }
695 }
696 else
697 {
698 m_xDialog->response(RET_CLOSE);
699 }
700}
701
702// select index type only when inserting
703IMPL_LINK(SwIndexMarkPane, ModifyListBoxHdl, weld::ComboBox&, rBox, void)
704{
705 ModifyHdl(rBox);
706}
707
708IMPL_LINK(SwIndexMarkPane, ModifyEditHdl, weld::Entry&, rEdit, void)
709{
710 ModifyHdl(rEdit);
711}
712
714{
715 if (m_xTypeDCB.get() == &rBox)
716 {
717 // set index type
718 auto nPos = m_xTypeDCB->find_text(m_xTypeDCB->get_active_text());
719 bool bLevelEnable = false,
720 bKeyEnable = false,
721 bSetKey2 = false,
722 bKey2Enable = false,
723 bEntryHasText = false,
724 bKey1HasText = false,
725 bKey2HasText = false;
726 if(nPos == POS_INDEX)
727 {
728 if (!m_xEntryED->get_text().isEmpty())
729 bEntryHasText = true;
731
732 bKeyEnable = true;
733 m_xKey1DCB->set_active_text(m_xKey1DCB->get_text(nKey1Pos));
734 m_xPhoneticED1->set_text(GetDefaultPhoneticReading(m_xKey1DCB->get_active_text()));
735 if (!m_xKey1DCB->get_active_text().isEmpty())
736 {
737 bKey1HasText = bSetKey2 = bKey2Enable = true;
738 m_xKey2DCB->set_active_text(m_xKey2DCB->get_text(nKey2Pos));
739 m_xPhoneticED2->set_text(GetDefaultPhoneticReading(m_xKey2DCB->get_active_text()));
740 if(!m_xKey2DCB->get_active_text().isEmpty())
741 bKey2HasText = true;
742 }
743 }
744 else
745 {
746 bLevelEnable = true;
747 m_xLevelNF->set_max(MAXLEVEL);
748 m_xLevelNF->set_value(m_xLevelNF->normalize(0));
749 bSetKey2 = true;
750 }
751 m_xLevelFT->set_visible(bLevelEnable);
752 m_xLevelNF->set_visible(bLevelEnable);
753 m_xMainEntryCB->set_visible(nPos == POS_INDEX);
754
755 m_xKey1FT->set_sensitive(bKeyEnable);
756 m_xKey1DCB->set_sensitive(bKeyEnable);
757 if ( bSetKey2 )
758 {
759 m_xKey2DCB->set_sensitive(bKey2Enable);
760 m_xKey2FT->set_sensitive(bKey2Enable);
761 }
762 m_xPhoneticFT0->set_sensitive(bKeyEnable&&bEntryHasText&&m_bIsPhoneticReadingEnabled);
763 m_xPhoneticED0->set_sensitive(bKeyEnable&&bEntryHasText&&m_bIsPhoneticReadingEnabled);
764 m_xPhoneticFT1->set_sensitive(bKeyEnable&&bKey1HasText&&m_bIsPhoneticReadingEnabled);
765 m_xPhoneticED1->set_sensitive(bKeyEnable&&bKey1HasText&&m_bIsPhoneticReadingEnabled);
766 m_xPhoneticFT2->set_sensitive(bKeyEnable&&bKey2HasText&&m_bIsPhoneticReadingEnabled);
767 m_xPhoneticED2->set_sensitive(bKeyEnable&&bKey2HasText&&m_bIsPhoneticReadingEnabled);
768 }
769 else //m_xEntryED !!m_xEntryED is not a ListBox but an Edit
770 {
771 bool bHasText = !m_xEntryED->get_text().isEmpty();
772 if(!bHasText)
773 {
774 m_xPhoneticED0->set_text(OUString());
776 }
779
780 m_xPhoneticFT0->set_sensitive(bHasText&&m_bIsPhoneticReadingEnabled);
781 m_xPhoneticED0->set_sensitive(bHasText&&m_bIsPhoneticReadingEnabled);
782 }
783 m_xOKBT->set_sensitive(!m_pSh->HasReadonlySel() &&
784 (!m_xEntryED->get_text().isEmpty() || m_pSh->GetCursorCnt(false)));
785}
786
788{
789 InsertUpdate();
790 m_pTOXMgr->NextTOXMark();
791 UpdateDialog();
792}
793
795{
796 InsertUpdate();
797 m_pTOXMgr->NextTOXMark(true);
798 UpdateDialog();
799}
800
802{
803 InsertUpdate();
804 m_pTOXMgr->PrevTOXMark();
805 UpdateDialog();
806}
807
809{
810 InsertUpdate();
811 m_pTOXMgr->PrevTOXMark(true);
812 UpdateDialog();
813}
814
816{
817 m_bDel = true;
818 InsertUpdate();
819 m_bDel = false;
820
821 if(m_pTOXMgr->GetCurTOXMark())
822 UpdateDialog();
823 else
824 {
825 CloseHdl(*m_xCloseBT);
826 if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
827 pViewFrm->GetBindings().Invalidate(FN_EDIT_IDX_ENTRY_DLG);
828 }
829}
830
831// renew dialog view
833{
834 OSL_ENSURE(m_pSh && m_pTOXMgr, "no shell?");
835 SwTOXMark* pMark = m_pTOXMgr->GetCurTOXMark();
836 OSL_ENSURE(pMark, "no current marker");
837 if(!pMark)
838 return;
839
841
842 m_aOrgStr = pMark->GetText(m_pSh->GetLayout());
843 m_xEntryED->set_text(m_aOrgStr);
844
845 // set index type
846 bool bLevelEnable = true,
847 bKeyEnable = false,
848 bKey2Enable = false,
849 bEntryHasText = false,
850 bKey1HasText = false,
851 bKey2HasText = false;
852
853 TOXTypes eCurType = pMark->GetTOXType()->GetType();
854 if(TOX_INDEX == eCurType)
855 {
856 bLevelEnable = false;
857 bKeyEnable = true;
858 bKey1HasText = bKey2Enable = !pMark->GetPrimaryKey().isEmpty();
859 bKey2HasText = !pMark->GetSecondaryKey().isEmpty();
860 bEntryHasText = !pMark->GetText(m_pSh->GetLayout()).isEmpty();
861 m_xKey1DCB->set_entry_text( pMark->GetPrimaryKey() );
862 m_xKey2DCB->set_entry_text( pMark->GetSecondaryKey() );
863 m_xPhoneticED0->set_text( pMark->GetTextReading() );
864 m_xPhoneticED1->set_text( pMark->GetPrimaryKeyReading() );
865 m_xPhoneticED2->set_text( pMark->GetSecondaryKeyReading() );
866 m_xMainEntryCB->set_active(pMark->IsMainEntry());
867 }
868 else if(TOX_CONTENT == eCurType || TOX_USER == eCurType)
869 {
870 m_xLevelNF->set_value(m_xLevelNF->normalize(pMark->GetLevel()));
871 }
872 m_xKey1FT->set_sensitive(bKeyEnable);
873 m_xKey1DCB->set_sensitive(bKeyEnable);
874 m_xLevelNF->set_max(MAXLEVEL);
875 m_xLevelFT->set_visible(bLevelEnable);
876 m_xLevelNF->set_visible(bLevelEnable);
877 m_xMainEntryCB->set_visible(!bLevelEnable);
878 m_xKey2FT->set_sensitive(bKey2Enable);
879 m_xKey2DCB->set_sensitive(bKey2Enable);
880
882 m_xPhoneticFT0->set_sensitive(bKeyEnable&&bEntryHasText&&m_bIsPhoneticReadingEnabled);
883 m_xPhoneticED0->set_sensitive(bKeyEnable&&bEntryHasText&&m_bIsPhoneticReadingEnabled);
884 m_xPhoneticFT1->set_sensitive(bKeyEnable&&bKey1HasText&&m_bIsPhoneticReadingEnabled);
885 m_xPhoneticED1->set_sensitive(bKeyEnable&&bKey1HasText&&m_bIsPhoneticReadingEnabled);
886 m_xPhoneticFT2->set_sensitive(bKeyEnable&&bKey2HasText&&m_bIsPhoneticReadingEnabled);
887 m_xPhoneticED2->set_sensitive(bKeyEnable&&bKey2HasText&&m_bIsPhoneticReadingEnabled);
888
889 // set index type
890 m_xTypeDCB->set_active_text(pMark->GetTOXType()->GetTypeName());
891
892 // set Next - Prev - Buttons
894 if( m_xPrevBT->get_visible() )
895 {
896 const SwTOXMark* pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_PRV );
897 if( pMoveMark != pMark )
898 m_pSh->GotoTOXMark( *pMoveMark, TOX_NXT );
899 m_xPrevBT->set_sensitive( pMoveMark != pMark );
900 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_NXT );
901 if( pMoveMark != pMark )
902 m_pSh->GotoTOXMark( *pMoveMark, TOX_PRV );
903 m_xNextBT->set_sensitive( pMoveMark != pMark );
904 }
905
906 if (m_xPrevSameBT->get_visible())
907 {
908 const SwTOXMark* pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
909 if( pMoveMark != pMark )
910 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT );
911 m_xPrevSameBT->set_sensitive( pMoveMark != pMark );
912 pMoveMark = &m_pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
913 if( pMoveMark != pMark )
914 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV );
915 m_xNextSameBT->set_sensitive( pMoveMark != pMark );
916 }
917
918 const bool bEnable = !m_pSh->HasReadonlySel();
919 m_xOKBT->set_sensitive(bEnable);
920 m_xDelBT->set_sensitive(bEnable);
921 m_xEntryED->set_sensitive(bEnable);
922 m_xLevelNF->set_sensitive(bEnable);
923 m_xKey1DCB->set_sensitive(bEnable);
924 m_xKey2DCB->set_sensitive(bEnable);
925
927 // we need the point at the start of the attribute
928 m_pSh->SwapPam();
929
931}
932
933// Remind whether the edit boxes for Phonetic reading are changed manually
934IMPL_LINK(SwIndexMarkPane, PhoneticEDModifyHdl, weld::Entry&, rEdit, void)
935{
936 if (m_xPhoneticED0.get() == &rEdit)
937 {
938 m_bPhoneticED0_ChangedByUser = !rEdit.get_text().isEmpty();
939 }
940 else if (m_xPhoneticED1.get() == &rEdit)
941 {
942 m_bPhoneticED1_ChangedByUser = !rEdit.get_text().isEmpty();
943 }
944 else if (m_xPhoneticED2.get() == &rEdit)
945 {
946 m_bPhoneticED2_ChangedByUser = !rEdit.get_text().isEmpty();
947 }
948}
949
950// Enable Disable of the 2nd key
951IMPL_LINK( SwIndexMarkPane, KeyDCBModifyHdl, weld::ComboBox&, rBox, void )
952{
953 if (m_xKey1DCB.get() == &rBox)
954 {
955 bool bEnable = !rBox.get_active_text().isEmpty();
956 if(!bEnable)
957 {
958 m_xKey2DCB->set_entry_text(OUString());
959 m_xPhoneticED1->set_text(OUString());
960 m_xPhoneticED2->set_text(OUString());
961 m_bPhoneticED1_ChangedByUser = false;
962 m_bPhoneticED2_ChangedByUser = false;
963 }
964 else
965 {
966 if (rBox.get_popup_shown())
967 {
968 //reset bPhoneticED1_ChangedByUser if a completely new string is selected
969 m_bPhoneticED1_ChangedByUser = false;
970 }
971 if (!m_bPhoneticED1_ChangedByUser)
972 m_xPhoneticED1->set_text(GetDefaultPhoneticReading(rBox.get_active_text()));
973 }
974 m_xKey2DCB->set_sensitive(bEnable);
975 m_xKey2FT->set_sensitive(bEnable);
976 }
977 else if (m_xKey2DCB.get() == &rBox)
978 {
979 if (rBox.get_active_text().isEmpty())
980 {
981 m_xPhoneticED2->set_text(OUString());
982 m_bPhoneticED2_ChangedByUser = false;
983 }
984 else
985 {
986 if (rBox.get_popup_shown())
987 {
988 //reset bPhoneticED1_ChangedByUser if a completely new string is selected
989 m_bPhoneticED2_ChangedByUser = false;
990 }
991 if(!m_bPhoneticED2_ChangedByUser)
992 m_xPhoneticED2->set_text(GetDefaultPhoneticReading(rBox.get_active_text()));
993 }
994 }
995
996 bool bKey1HasText = !m_xKey1DCB->get_active_text().isEmpty();
997 bool bKey2HasText = !m_xKey2DCB->get_active_text().isEmpty();
998
999 m_xPhoneticFT1->set_sensitive(bKey1HasText && m_bIsPhoneticReadingEnabled);
1000 m_xPhoneticED1->set_sensitive(bKey1HasText && m_bIsPhoneticReadingEnabled);
1001 m_xPhoneticFT2->set_sensitive(bKey2HasText && m_bIsPhoneticReadingEnabled);
1002 m_xPhoneticED2->set_sensitive(bKey2HasText && m_bIsPhoneticReadingEnabled);
1003}
1004
1006{
1007}
1008
1009void SwIndexMarkPane::ReInitDlg(SwWrtShell& rWrtShell, SwTOXMark const * pCurTOXMark)
1010{
1011 m_pSh = &rWrtShell;
1012 m_pTOXMgr.reset( new SwTOXMgr(m_pSh) );
1013 if(pCurTOXMark)
1014 {
1015 for(sal_uInt16 i = 0; i < m_pTOXMgr->GetTOXMarkCount(); i++)
1016 if(m_pTOXMgr->GetTOXMark(i) == pCurTOXMark)
1017 {
1018 m_pTOXMgr->SetCurTOXMark(i);
1019 break;
1020 }
1021 }
1022 InitControls();
1023}
1024
1026 SfxChildWindow* pChild, weld::Window *pParent,
1027 SfxChildWinInfo const * pInfo, bool bNew)
1028 : SfxModelessDialogController(_pBindings, pChild, pParent,
1029 "modules/swriter/ui/indexentry.ui", "IndexEntryDialog")
1030 , m_aContent(m_xDialog, *m_xBuilder, bNew, ::GetActiveWrtShell())
1031{
1032 if (SwWrtShell* pWrtShell = ::GetActiveWrtShell())
1033 m_aContent.ReInitDlg(*pWrtShell);
1034 Initialize(pInfo);
1035}
1036
1038{
1041}
1042
1044{
1045 m_aContent.ReInitDlg( rWrtShell );
1046}
1047
1049 : SfxDialogController(pParent, "modules/swriter/ui/indexentry.ui",
1050 "IndexEntryDialog")
1051 , m_aContent(m_xDialog, *m_xBuilder, false, &rSh)
1052{
1053 m_aContent.ReInitDlg(rSh, pCurTOXMark);
1054}
1055
1057{
1059}
1060
1062{
1063 short nRet = SfxDialogController::run();
1064 if (RET_OK == nRet)
1065 m_aContent.Apply();
1066 return nRet;
1067}
1068
1069namespace {
1070
1071class SwCreateAuthEntryDlg_Impl : public weld::GenericDialogController
1072{
1073 std::vector<std::unique_ptr<weld::Builder>> m_aBuilders;
1074
1075 Link<weld::Entry&,bool> m_aShortNameCheckLink;
1076
1077 SwWrtShell& m_rWrtSh;
1078
1079 bool m_bNewEntryMode;
1080 bool m_bNameAllowed;
1081
1082 std::vector<std::unique_ptr<weld::Container>> m_aOrigContainers;
1083 std::vector<std::unique_ptr<weld::Label>> m_aFixedTexts;
1084 std::unique_ptr<weld::Box> m_pBoxes[AUTH_FIELD_END];
1085 std::unique_ptr<weld::Entry> m_pEdits[AUTH_FIELD_END];
1086 std::unique_ptr<weld::Button> m_xOKBT;
1087 std::unique_ptr<weld::Container> m_xBox;
1088 std::unique_ptr<weld::Container> m_xLeft;
1089 std::unique_ptr<weld::Container> m_xRight;
1090 std::unique_ptr<weld::ComboBox> m_xTypeListBox;
1091 std::unique_ptr<weld::ComboBox> m_xIdentifierBox;
1092 std::unique_ptr<weld::Button> m_xLocalBrowseButton;
1093 std::unique_ptr<weld::CheckButton> m_xLocalPageCB;
1094 std::unique_ptr<weld::SpinButton> m_xLocalPageSB;
1095 std::unique_ptr<weld::ComboBox> m_xTargetTypeListBox;
1096 weld::Entry* m_pTargetURLField;
1097
1098 DECL_LINK(IdentifierHdl, weld::ComboBox&, void);
1099 DECL_LINK(ShortNameHdl, weld::Entry&, void);
1100 DECL_LINK(EnableHdl, weld::ComboBox&, void);
1101 DECL_LINK(BrowseHdl, weld::Button&, void);
1102 DECL_LINK(PageNumHdl, weld::Toggleable&, void);
1103 DECL_LINK(TargetTypeHdl, weld::ComboBox&, void);
1104
1105public:
1106 SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
1107 const OUString pFields[],
1108 SwWrtShell& rSh,
1109 bool bNewEntry,
1110 bool bCreate);
1111
1112 OUString GetEntryText(ToxAuthorityField eField) const;
1113
1114 void SetCheckNameHdl(const Link<weld::Entry&,bool>& rLink) {m_aShortNameCheckLink = rLink;}
1115
1116};
1117
1118struct TextInfo
1119{
1120 ToxAuthorityField nToxField;
1121 const OUString pHelpId;
1122};
1123
1124}
1125
1126const TextInfo aTextInfoArr[] =
1127{
1162};
1163
1164static OUString lcl_FindColumnEntry(const uno::Sequence<beans::PropertyValue>& rFields, std::u16string_view rColumnTitle)
1165{
1166 for(const auto& rField : rFields)
1167 {
1168 OUString sRet;
1169 if(rField.Name == rColumnTitle &&
1170 (rField.Value >>= sRet))
1171 {
1172 return sRet;
1173 }
1174 }
1175 return OUString();
1176}
1177
1179
1181 : m_rDialog(rDialog)
1182 , m_bNewEntry(bNewDlg)
1183 , m_bBibAccessInitialized(false)
1184 , m_pSh(nullptr)
1185 , m_xFromComponentRB(rBuilder.weld_radio_button("frombibliography"))
1186 , m_xFromDocContentRB(rBuilder.weld_radio_button("fromdocument"))
1187 , m_xAuthorFI(rBuilder.weld_label("author"))
1188 , m_xTitleFI(rBuilder.weld_label("title"))
1189 , m_xEntryED(rBuilder.weld_entry("entryed"))
1190 , m_xEntryLB(rBuilder.weld_combo_box("entrylb"))
1191 , m_xActionBT(rBuilder.weld_button(m_bNewEntry ? OUString("insert") : OUString("modify")))
1192 , m_xCloseBT(rBuilder.weld_button("close"))
1193 , m_xCreateEntryPB(rBuilder.weld_button("new"))
1194 , m_xEditEntryPB(rBuilder.weld_button("edit"))
1195{
1196 m_xActionBT->show();
1197 m_xFromComponentRB->set_visible(m_bNewEntry);
1198 m_xFromDocContentRB->set_visible(m_bNewEntry);
1201
1202 m_xActionBT->connect_clicked(LINK(this,SwAuthorMarkPane, InsertHdl));
1203 m_xCloseBT->connect_clicked(LINK(this,SwAuthorMarkPane, CloseHdl));
1204 m_xCreateEntryPB->connect_clicked(LINK(this,SwAuthorMarkPane, CreateEntryHdl));
1205 m_xEditEntryPB->connect_clicked(LINK(this,SwAuthorMarkPane, CreateEntryHdl));
1206 m_xFromComponentRB->connect_toggled(LINK(this,SwAuthorMarkPane, ChangeSourceHdl));
1207 m_xFromDocContentRB->connect_toggled(LINK(this,SwAuthorMarkPane, ChangeSourceHdl));
1208 m_xEntryED->connect_changed(LINK(this,SwAuthorMarkPane, EditModifyHdl));
1209
1211 m_bNewEntry ? STR_AUTHMRK_INSERT : STR_AUTHMRK_EDIT));
1212
1213 m_xEntryED->set_visible(!m_bNewEntry);
1214 m_xEntryLB->set_visible(m_bNewEntry);
1215 // tdf#90641 - sort bibliography entries by identifier
1216 m_xEntryLB->make_sorted();
1217 if (m_bNewEntry)
1218 {
1219 m_xEntryLB->connect_changed(LINK(this, SwAuthorMarkPane, CompEntryHdl));
1220 }
1221}
1222
1224{
1225 m_pSh = &rWrtShell;
1226 InitControls();
1227}
1228
1230{
1231 if(m_bNewEntry)
1232 {
1233 if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
1234 {
1235 pViewFrm->GetDispatcher()->Execute(FN_INSERT_AUTH_ENTRY_DLG,
1236 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
1237 }
1238 }
1239 else
1240 {
1241 m_rDialog.response(RET_CANCEL);
1242 }
1243}
1244
1245IMPL_LINK( SwAuthorMarkPane, CompEntryHdl, weld::ComboBox&, rBox, void)
1246{
1247 const OUString sEntry(rBox.get_active_text());
1248 if(s_bIsFromComponent)
1249 {
1250 if(m_xBibAccess.is() && !sEntry.isEmpty())
1251 {
1252 if(m_xBibAccess->hasByName(sEntry))
1253 {
1254 uno::Any aEntry(m_xBibAccess->getByName(sEntry));
1255 uno::Sequence<beans::PropertyValue> aFieldProps;
1256 if(aEntry >>= aFieldProps)
1257 {
1258 auto nSize = std::min(static_cast<sal_Int32>(AUTH_FIELD_END), aFieldProps.getLength());
1259 for(sal_Int32 i = 0; i < nSize; i++)
1260 {
1261 m_sFields[i] = lcl_FindColumnEntry(aFieldProps, m_sColumnTitles[i]);
1262 }
1263 }
1264 }
1265 }
1266 }
1267 else
1268 {
1269 if(!sEntry.isEmpty())
1270 {
1271 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1272 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1273 const SwAuthEntry* pEntry = pFType ? pFType->GetEntryByIdentifier(sEntry) : nullptr;
1274 for(int i = 0; i < AUTH_FIELD_END; i++)
1275 m_sFields[i] = pEntry ?
1276 pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)) : OUString();
1277 }
1278 }
1279 if (rBox.get_active_text().isEmpty())
1280 {
1281 for(OUString & s : m_sFields)
1282 s.clear();
1283 }
1284 m_xAuthorFI->set_label(m_sFields[AUTH_FIELD_AUTHOR]);
1285 m_xTitleFI->set_label(m_sFields[AUTH_FIELD_TITLE]);
1286}
1287
1289{
1290 //insert or update the SwAuthorityField...
1291 if(m_pSh)
1292 {
1293 bool bDifferent = false;
1294 OSL_ENSURE(!m_sFields[AUTH_FIELD_IDENTIFIER].isEmpty() , "No Id is set!");
1295 OSL_ENSURE(!m_sFields[AUTH_FIELD_AUTHORITY_TYPE].isEmpty() , "No authority type is set!");
1296 //check if the entry already exists with different content
1297 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1298 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1299 const SwAuthEntry* pEntry = pFType ?
1300 pFType->GetEntryByIdentifier( m_sFields[AUTH_FIELD_IDENTIFIER])
1301 : nullptr;
1302 if(pEntry)
1303 {
1304 for(int i = 0; i < AUTH_FIELD_END && !bDifferent; i++)
1305 bDifferent |= m_sFields[i] != pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
1306 if(bDifferent)
1307 {
1308 std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(m_rDialog.getDialog(),
1309 VclMessageType::Question, VclButtonsType::YesNo,
1310 SwResId(STR_QUERY_CHANGE_AUTH_ENTRY)));
1311 if (RET_YES != xQuery->run())
1312 return;
1313 }
1314 }
1315
1316 SwFieldMgr aMgr(m_pSh);
1317 OUStringBuffer sFields;
1318 for(OUString & s : m_sFields)
1319 {
1320 sFields.append(s + OUStringChar(TOX_STYLE_DELIMITER));
1321 }
1322 if(m_bNewEntry)
1323 {
1324 if(bDifferent)
1325 {
1327 for(int i = 0; i < AUTH_FIELD_END; i++)
1328 xNewData->SetAuthorField(static_cast<ToxAuthorityField>(i), m_sFields[i]);
1329 m_pSh->ChangeAuthorityData(xNewData.get());
1330 }
1331 SwInsertField_Data aData(SwFieldTypesEnum::Authority, 0, sFields.makeStringAndClear(), OUString(), 0 );
1332 aMgr.InsertField( aData );
1333 }
1334 else if(aMgr.GetCurField())
1335 {
1336 aMgr.UpdateCurField(0, sFields.makeStringAndClear(), OUString());
1337 }
1338 }
1339 if(!m_bNewEntry)
1340 CloseHdl(*m_xCloseBT);
1341}
1342
1343IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, weld::Button&, rButton, void)
1344{
1345 bool bCreate = &rButton == m_xCreateEntryPB.get();
1346 OUString sOldId = m_sCreatedEntry[0];
1347 for(int i = 0; i < AUTH_FIELD_END; i++)
1348 m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i];
1349 SwCreateAuthEntryDlg_Impl aDlg(m_rDialog.getDialog(),
1350 bCreate ? m_sCreatedEntry : m_sFields,
1351 *m_pSh, m_bNewEntry, bCreate);
1352 if(m_bNewEntry)
1353 {
1354 aDlg.SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl));
1355 }
1356 if(RET_OK != aDlg.run())
1357 return;
1358
1359 if(bCreate && !sOldId.isEmpty())
1360 {
1361 m_xEntryLB->remove_text(sOldId);
1362 }
1363 for(int i = 0; i < AUTH_FIELD_END; i++)
1364 {
1365 m_sFields[i] = aDlg.GetEntryText(static_cast<ToxAuthorityField>(i));
1366 m_sCreatedEntry[i] = m_sFields[i];
1367 }
1368 if(m_bNewEntry && !m_xFromDocContentRB->get_active())
1369 {
1370 m_xFromDocContentRB->set_active(true);
1371 ChangeSourceHdl(*m_xFromDocContentRB);
1372 }
1373 if(bCreate)
1374 {
1375 OSL_ENSURE(m_xEntryLB->find_text(m_sFields[AUTH_FIELD_IDENTIFIER]) == -1,
1376 "entry exists!");
1377 m_xEntryLB->append_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
1378 m_xEntryLB->set_active_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
1379 }
1380 m_xEntryED->set_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
1381 m_xAuthorFI->set_label(m_sFields[AUTH_FIELD_AUTHOR]);
1382 m_xTitleFI->set_label(m_sFields[AUTH_FIELD_TITLE]);
1383 m_xActionBT->set_sensitive(true);
1384
1385 if (!m_bNewEntry)
1386 {
1387 // When in edit mode, automatically apply the changed entry to update the field in the doc
1388 // model.
1389 InsertHdl(*m_xActionBT);
1390 }
1391}
1392
1394{
1395 bool bFromComp = m_xFromComponentRB->get_active();
1396 s_bIsFromComponent = bFromComp;
1397 m_xCreateEntryPB->set_sensitive(!s_bIsFromComponent);
1398 m_xEntryLB->clear();
1399 if(s_bIsFromComponent)
1400 {
1401 if(!m_bBibAccessInitialized)
1402 {
1403 uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
1404 m_xBibAccess = frame::Bibliography::create( xContext );
1405 uno::Reference< beans::XPropertySet > xPropSet(m_xBibAccess, uno::UNO_QUERY);
1406 OUString uPropName("BibliographyDataFieldNames");
1407 if(xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName(uPropName))
1408 {
1409 uno::Any aNames = xPropSet->getPropertyValue(uPropName);
1410 uno::Sequence<beans::PropertyValue> aSeq;
1411 if( aNames >>= aSeq)
1412 {
1413 for(const beans::PropertyValue& rProp : std::as_const(aSeq))
1414 {
1415 sal_Int16 nField = 0;
1416 rProp.Value >>= nField;
1417 if(nField >= 0 && nField < AUTH_FIELD_END)
1418 m_sColumnTitles[nField] = rProp.Name;
1419 }
1420 }
1421 }
1422 m_bBibAccessInitialized = true;
1423 }
1424 if(m_xBibAccess.is())
1425 {
1426 const uno::Sequence<OUString> aIdentifiers = m_xBibAccess->getElementNames();
1427 for(const OUString& rName : aIdentifiers)
1428 m_xEntryLB->append_text(rName);
1429 }
1430 }
1431 else
1432 {
1433 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1434 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1435 if(pFType)
1436 {
1437 std::vector<OUString> aIds;
1438 pFType->GetAllEntryIdentifiers( aIds );
1439 for(const OUString & i : aIds)
1440 m_xEntryLB->append_text(i);
1441 }
1442 if(!m_sCreatedEntry[AUTH_FIELD_IDENTIFIER].isEmpty())
1443 m_xEntryLB->append_text(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER]);
1444 }
1445 m_xEntryLB->set_active(0);
1446 CompEntryHdl(*m_xEntryLB);
1447}
1448
1449IMPL_LINK(SwAuthorMarkPane, EditModifyHdl, weld::Entry&, rEdit, void)
1450{
1451 Link<weld::Entry&,bool> aAllowed = LINK(this, SwAuthorMarkPane, IsEditAllowedHdl);
1452 bool bResult = aAllowed.Call(rEdit);
1453 m_xActionBT->set_sensitive(bResult);
1454 if(bResult)
1455 {
1456 OUString sEntry(rEdit.get_text());
1457 m_sFields[AUTH_FIELD_IDENTIFIER] = sEntry;
1458 m_sCreatedEntry[AUTH_FIELD_IDENTIFIER] = sEntry;
1459 }
1460};
1461
1462IMPL_LINK(SwAuthorMarkPane, IsEntryAllowedHdl, weld::Entry&, rEdit, bool)
1463{
1464 OUString sEntry = rEdit.get_text();
1465 bool bAllowed = false;
1466 if(!sEntry.isEmpty())
1467 {
1468 if (m_xEntryLB->find_text(sEntry) != -1)
1469 return false;
1470 else if(s_bIsFromComponent)
1471 {
1472 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1473 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1474 bAllowed = !pFType || !pFType->GetEntryByIdentifier(sEntry);
1475 }
1476 else
1477 {
1478 bAllowed = !m_xBibAccess.is() || !m_xBibAccess->hasByName(sEntry);
1479 }
1480 }
1481 return bAllowed;
1482}
1483
1484IMPL_LINK(SwAuthorMarkPane, IsEditAllowedHdl, weld::Entry&, rEdit, bool)
1485{
1486 OUString sEntry = rEdit.get_text();
1487 bool bAllowed = false;
1488 if(!sEntry.isEmpty())
1489 {
1490 if (m_xEntryLB->find_text(sEntry) != -1)
1491 return false;
1492 else if(s_bIsFromComponent)
1493 {
1494 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1495 m_pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1496 bAllowed = !pFType || !pFType->GetEntryByIdentifier(sEntry);
1497 }
1498 else
1499 {
1500 bAllowed = !m_xBibAccess.is() || !m_xBibAccess->hasByName(sEntry);
1501 }
1502 }
1503 return bAllowed;
1504}
1505
1507{
1508 OSL_ENSURE(m_pSh, "no shell?");
1509 SwField* pField = m_pSh->GetCurField();
1510 OSL_ENSURE(m_bNewEntry || pField, "no current marker");
1511 if(m_bNewEntry)
1512 {
1513 ChangeSourceHdl(m_xFromComponentRB->get_active() ? *m_xFromComponentRB : *m_xFromDocContentRB);
1514 m_xCreateEntryPB->set_sensitive(!m_xFromComponentRB->get_active());
1515 if(!m_xFromComponentRB->get_active() && !m_sCreatedEntry[0].isEmpty())
1516 for(int i = 0; i < AUTH_FIELD_END; i++)
1518 }
1519 if(m_bNewEntry || !pField || pField->GetTyp()->Which() != SwFieldIds::TableOfAuthorities)
1520 return;
1521
1522 const SwAuthEntry* pEntry = static_cast<SwAuthorityField*>(pField)->GetAuthEntry();
1523
1524 OSL_ENSURE(pEntry, "No authority entry found");
1525 if(!pEntry)
1526 return;
1527 for(int i = 0; i < AUTH_FIELD_END; i++)
1528 m_sFields[i] = pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
1529
1531 m_xAuthorFI->set_label(pEntry->GetAuthorField(AUTH_FIELD_AUTHOR));
1532 m_xTitleFI->set_label(pEntry->GetAuthorField(AUTH_FIELD_TITLE));
1533}
1534
1536{
1537 m_xActionBT->set_sensitive(!m_pSh->HasReadonlySel());
1538}
1539
1540namespace
1541{
1542 const TranslateId STR_AUTH_FIELD_ARY[] =
1543 {
1544 STR_AUTH_FIELD_IDENTIFIER,
1545 STR_AUTH_FIELD_AUTHORITY_TYPE,
1546 STR_AUTH_FIELD_ADDRESS,
1547 STR_AUTH_FIELD_ANNOTE,
1548 STR_AUTH_FIELD_AUTHOR,
1549 STR_AUTH_FIELD_BOOKTITLE,
1550 STR_AUTH_FIELD_CHAPTER,
1551 STR_AUTH_FIELD_EDITION,
1552 STR_AUTH_FIELD_EDITOR,
1553 STR_AUTH_FIELD_HOWPUBLISHED,
1554 STR_AUTH_FIELD_INSTITUTION,
1555 STR_AUTH_FIELD_JOURNAL,
1556 STR_AUTH_FIELD_MONTH,
1557 STR_AUTH_FIELD_NOTE,
1558 STR_AUTH_FIELD_NUMBER,
1559 STR_AUTH_FIELD_ORGANIZATIONS,
1560 STR_AUTH_FIELD_PAGES,
1561 STR_AUTH_FIELD_PUBLISHER,
1562 STR_AUTH_FIELD_SCHOOL,
1563 STR_AUTH_FIELD_SERIES,
1564 STR_AUTH_FIELD_TITLE,
1565 STR_AUTH_FIELD_TYPE,
1566 STR_AUTH_FIELD_VOLUME,
1567 STR_AUTH_FIELD_YEAR,
1568 STR_AUTH_FIELD_URL,
1569 STR_AUTH_FIELD_CUSTOM1,
1570 STR_AUTH_FIELD_CUSTOM2,
1571 STR_AUTH_FIELD_CUSTOM3,
1572 STR_AUTH_FIELD_CUSTOM4,
1573 STR_AUTH_FIELD_CUSTOM5,
1574 STR_AUTH_FIELD_ISBN,
1575 STR_AUTH_FIELD_LOCAL_URL,
1576 STR_AUTH_FIELD_TARGET_TYPE,
1577 STR_AUTH_FIELD_TARGET_URL,
1578 };
1579}
1580
1581SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
1582 const OUString pFields[],
1583 SwWrtShell& rSh,
1584 bool bNewEntry,
1585 bool bCreate)
1586 : GenericDialogController(pParent, "modules/swriter/ui/createauthorentry.ui", "CreateAuthorEntryDialog")
1587 , m_rWrtSh(rSh)
1588 , m_bNewEntryMode(bNewEntry)
1589 , m_bNameAllowed(true)
1590 , m_xOKBT(m_xBuilder->weld_button("ok"))
1591 , m_xBox(m_xBuilder->weld_container("box"))
1592 , m_xLeft(m_xBuilder->weld_container("leftgrid"))
1593 , m_xRight(m_xBuilder->weld_container("rightgrid"))
1594 , m_pTargetURLField(nullptr)
1595{
1596 bool bLeft = true;
1597 sal_Int32 nLeftRow(0), nRightRow(0);
1598 for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
1599 {
1600 //m_xBox parent just to have some parent during setup, added contents are not directly visible under m_xBox
1601 m_aBuilders.emplace_back(Application::CreateBuilder(m_xBox.get(), "modules/swriter/ui/bibliofragment.ui"));
1602 const TextInfo aCurInfo = aTextInfoArr[nIndex];
1603
1604 m_aOrigContainers.emplace_back(m_aBuilders.back()->weld_container("biblioentry"));
1605 m_aFixedTexts.emplace_back(m_aBuilders.back()->weld_label("label"));
1606 if (bLeft)
1607 m_aOrigContainers.back()->move(m_aFixedTexts.back().get(), m_xLeft.get());
1608 else
1609 m_aOrigContainers.back()->move(m_aFixedTexts.back().get(), m_xRight.get());
1610 m_aFixedTexts.back()->set_grid_left_attach(0);
1611 m_aFixedTexts.back()->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1612 m_aFixedTexts.back()->set_label(SwResId(STR_AUTH_FIELD_ARY[aCurInfo.nToxField]));
1613 m_aFixedTexts.back()->show();
1614 if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField )
1615 {
1616 m_xTypeListBox = m_aBuilders.back()->weld_combo_box("listbox");
1617 if (bLeft)
1618 m_aOrigContainers.back()->move(m_xTypeListBox.get(), m_xLeft.get());
1619 else
1620 m_aOrigContainers.back()->move(m_xTypeListBox.get(), m_xRight.get());
1621
1622 for (int j = 0; j < AUTH_TYPE_END; j++)
1623 {
1624 m_xTypeListBox->append_text(
1626 }
1627 if(!pFields[aCurInfo.nToxField].isEmpty())
1628 {
1629 m_xTypeListBox->set_active(pFields[aCurInfo.nToxField].toInt32());
1630 }
1631 m_xTypeListBox->set_grid_left_attach(1);
1632 m_xTypeListBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1633 m_xTypeListBox->set_hexpand(true);
1634 m_xTypeListBox->show();
1635 m_xTypeListBox->connect_changed(LINK(this, SwCreateAuthEntryDlg_Impl, EnableHdl));
1636 m_xTypeListBox->set_help_id(aCurInfo.pHelpId);
1637 m_aFixedTexts.back()->set_mnemonic_widget(m_xTypeListBox.get());
1638 }
1639 else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode)
1640 {
1641 m_xIdentifierBox = m_aBuilders.back()->weld_combo_box("combobox");
1642 if (bLeft)
1643 m_aOrigContainers.back()->move(m_xIdentifierBox.get(), m_xLeft.get());
1644 else
1645 m_aOrigContainers.back()->move(m_xIdentifierBox.get(), m_xRight.get());
1646
1647 m_xIdentifierBox->connect_changed(LINK(this,
1648 SwCreateAuthEntryDlg_Impl, IdentifierHdl));
1649
1650 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1652 if(pFType)
1653 {
1654 std::vector<OUString> aIds;
1655 pFType->GetAllEntryIdentifiers( aIds );
1656 for (const OUString& a : aIds)
1657 m_xIdentifierBox->append_text(a);
1658 }
1659 m_xIdentifierBox->set_entry_text(pFields[aCurInfo.nToxField]);
1660 m_xIdentifierBox->set_grid_left_attach(1);
1661 m_xIdentifierBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1662 m_xIdentifierBox->set_hexpand(true);
1663 m_xIdentifierBox->show();
1664 m_xIdentifierBox->set_help_id(aCurInfo.pHelpId);
1665 m_aFixedTexts.back()->set_mnemonic_widget(m_xIdentifierBox.get());
1666 }
1667 else if (AUTH_FIELD_TARGET_TYPE == aCurInfo.nToxField)
1668 {
1669 m_xTargetTypeListBox = m_aBuilders.back()->weld_combo_box("listbox-target-type");
1670 if (bLeft)
1671 m_aOrigContainers.back()->move(m_xTargetTypeListBox.get(), m_xLeft.get());
1672 else
1673 m_aOrigContainers.back()->move(m_xTargetTypeListBox.get(), m_xRight.get());
1674
1675 if(!pFields[aCurInfo.nToxField].isEmpty())
1676 {
1677 m_xTargetTypeListBox->set_active(pFields[aCurInfo.nToxField].toInt32());
1678 }
1679 else if(m_bNewEntryMode)
1680 {
1681 // For new documents, set value to "BibliographyTableRow"
1682 m_xTargetTypeListBox->set_active(SwAuthorityField::TargetType::BibliographyTableRow);
1683 }
1684 m_xTargetTypeListBox->set_grid_left_attach(1);
1685 m_xTargetTypeListBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1686 m_xTargetTypeListBox->set_hexpand(true);
1687 m_xTargetTypeListBox->show();
1688 m_xTargetTypeListBox->connect_changed(LINK(this, SwCreateAuthEntryDlg_Impl, TargetTypeHdl));
1689 m_xTargetTypeListBox->set_help_id(aCurInfo.pHelpId);
1690 m_aFixedTexts.back()->set_mnemonic_widget(m_xTargetTypeListBox.get());
1691 }
1692 else
1693 {
1694 m_pBoxes[nIndex] = m_aBuilders.back()->weld_box("vbox");
1695 m_pEdits[nIndex] = m_aBuilders.back()->weld_entry("entry");
1696
1697 if (AUTH_FIELD_TARGET_URL == aCurInfo.nToxField)
1698 {
1699 m_pTargetURLField = m_pEdits[nIndex].get();
1700 assert(m_xTargetTypeListBox);
1701 m_pTargetURLField->set_sensitive(
1702 m_xTargetTypeListBox->get_active() == SwAuthorityField::TargetType::UseTargetURL);
1703 }
1704
1705 if (bLeft)
1706 m_aOrigContainers.back()->move(m_pBoxes[nIndex].get(), m_xLeft.get());
1707 else
1708 m_aOrigContainers.back()->move(m_pBoxes[nIndex].get(), m_xRight.get());
1709
1710 m_pBoxes[nIndex]->set_grid_left_attach(1);
1711 m_pBoxes[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
1712 m_pBoxes[nIndex]->set_hexpand(true);
1713 if (aCurInfo.nToxField == AUTH_FIELD_LOCAL_URL)
1714 {
1715 m_xLocalBrowseButton = m_aBuilders.back()->weld_button("browse");
1716 m_xLocalBrowseButton->connect_clicked(
1717 LINK(this, SwCreateAuthEntryDlg_Impl, BrowseHdl));
1718 m_xLocalPageCB = m_aBuilders.back()->weld_check_button("pagecb");
1719 // Distinguish different instances of this for ui-testing.
1720 m_xLocalPageCB->set_buildable_name(m_xLocalPageCB->get_buildable_name()
1721 + "-local-visible");
1722 m_xLocalPageSB = m_aBuilders.back()->weld_spin_button("pagesb");
1723 }
1724
1725 // Now that both pEdits[nIndex] and m_xPageSB is initialized, set their values.
1726 OUString aText = pFields[aCurInfo.nToxField];
1727 if (aCurInfo.nToxField == AUTH_FIELD_LOCAL_URL)
1728 {
1729 OUString aUrl;
1730 int nPageNumber;
1731 if (SplitUrlAndPage(aText, aUrl, nPageNumber))
1732 {
1733 m_pEdits[nIndex]->set_text(aUrl);
1734 m_xLocalPageCB->set_active(true);
1735 m_xLocalPageSB->set_sensitive(true);
1736 m_xLocalPageSB->set_value(nPageNumber);
1737 }
1738 else
1739 {
1740 m_pEdits[nIndex]->set_text(aText);
1741 }
1742 }
1743 else
1744 {
1745 m_pEdits[nIndex]->set_text(aText);
1746 }
1747 m_pEdits[nIndex]->show();
1748 m_pEdits[nIndex]->set_help_id(aCurInfo.pHelpId);
1749
1750 if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
1751 {
1752 m_pEdits[nIndex]->connect_changed(LINK(this, SwCreateAuthEntryDlg_Impl, ShortNameHdl));
1753 m_bNameAllowed = !pFields[nIndex].isEmpty();
1754 if(!bCreate)
1755 {
1756 m_aFixedTexts.back()->set_sensitive(false);
1757 m_pEdits[nIndex]->set_sensitive(false);
1758 }
1759 }
1760 else if (aCurInfo.nToxField == AUTH_FIELD_LOCAL_URL)
1761 {
1762 m_xLocalPageCB->show();
1763 m_xLocalPageCB->connect_toggled(LINK(this, SwCreateAuthEntryDlg_Impl, PageNumHdl));
1764 m_xLocalPageSB->show();
1765 }
1766
1767 m_aFixedTexts.back()->set_mnemonic_widget(m_pEdits[nIndex].get());
1768 }
1769 if(bLeft)
1770 ++nLeftRow;
1771 else
1772 ++nRightRow;
1773 bLeft = !bLeft;
1774 }
1775 assert(m_xTypeListBox && "this will exist after the loop");
1776 EnableHdl(*m_xTypeListBox);
1777}
1778
1779OUString SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const
1780{
1782 {
1783 assert(m_xTypeListBox && "No ListBox");
1784 return OUString::number(m_xTypeListBox->get_active());
1785 }
1786
1787 if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
1788 {
1789 assert(m_xIdentifierBox && "No ComboBox");
1790 return m_xIdentifierBox->get_active_text();
1791 }
1792
1794 {
1795 assert(m_xTargetTypeListBox && "No TargetType ListBox");
1796 return OUString::number(m_xTargetTypeListBox->get_active());
1797 }
1798
1799 for(int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
1800 {
1801 const TextInfo aCurInfo = aTextInfoArr[nIndex];
1802 if(aCurInfo.nToxField == eField)
1803 {
1804 if (aCurInfo.nToxField == AUTH_FIELD_LOCAL_URL)
1805 {
1806 return MergeUrlAndPage(m_pEdits[nIndex]->get_text(), m_xLocalPageSB);
1807 }
1808 else
1809 {
1810 return m_pEdits[nIndex]->get_text();
1811 }
1812 }
1813 }
1814
1815 return OUString();
1816}
1817
1818IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, weld::ComboBox&, rBox, void)
1819{
1820 const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
1821 m_rWrtSh.GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
1822 if(!pFType)
1823 return;
1824
1825 const SwAuthEntry* pEntry = pFType->GetEntryByIdentifier(
1826 rBox.get_active_text());
1827 if(!pEntry)
1828 return;
1829
1830 for(int i = 0; i < AUTH_FIELD_END; i++)
1831 {
1832 const TextInfo aCurInfo = aTextInfoArr[i];
1833 if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
1834 continue;
1835 if(AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField)
1836 m_xTypeListBox->set_active_text(
1837 pEntry->GetAuthorField(aCurInfo.nToxField));
1838 else
1839 m_pEdits[i]->set_text(
1840 pEntry->GetAuthorField(aCurInfo.nToxField));
1841 }
1842}
1843
1844IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, weld::Entry&, rEdit, void)
1845{
1846 if (m_aShortNameCheckLink.IsSet())
1847 {
1848 bool bEnable = m_aShortNameCheckLink.Call(rEdit);
1849 m_bNameAllowed |= bEnable;
1850 m_xOKBT->set_sensitive(m_xTypeListBox->get_active() != -1 && bEnable);
1851 }
1852}
1853
1854IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, weld::ComboBox&, rBox, void)
1855{
1856 m_xOKBT->set_sensitive(m_bNameAllowed && rBox.get_active() != -1);
1857 m_xLocalBrowseButton->show();
1858};
1859
1860IMPL_LINK(SwCreateAuthEntryDlg_Impl, TargetTypeHdl, weld::ComboBox&, rBox, void)
1861{
1862 assert(m_pTargetURLField);
1863 m_pTargetURLField->set_sensitive(rBox.get_active() == SwAuthorityField::TargetType::UseTargetURL);
1864}
1865
1866IMPL_LINK(SwCreateAuthEntryDlg_Impl, BrowseHdl, weld::Button&, rButton, void)
1867{
1868 sfx2::FileDialogHelper aFileDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
1869 FileDialogFlags::NONE, getDialog());
1870 OUString aPath;
1871 if (&rButton == m_xLocalBrowseButton.get())
1872 {
1873 aPath = GetEntryText(AUTH_FIELD_LOCAL_URL);
1874 }
1875 if (!aPath.isEmpty())
1876 {
1877 aFileDlg.SetDisplayDirectory(aPath);
1878 }
1879 else
1880 {
1881 OUString aBaseURL = m_rWrtSh.GetDoc()->GetDocShell()->getDocumentBaseURL();
1882 if (!aBaseURL.isEmpty())
1883 {
1884 aFileDlg.SetDisplayDirectory(aBaseURL);
1885 }
1886 }
1887
1888 if (aFileDlg.Execute() != ERRCODE_NONE)
1889 {
1890 return;
1891 }
1892
1893 aPath = aFileDlg.GetPath();
1894
1895 for (int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
1896 {
1897 const TextInfo& rCurInfo = aTextInfoArr[nIndex];
1898 if (rCurInfo.nToxField == AUTH_FIELD_LOCAL_URL && &rButton == m_xLocalBrowseButton.get())
1899 {
1900 m_pEdits[nIndex]->set_text(aPath);
1901 break;
1902 }
1903 }
1904};
1905
1906IMPL_LINK(SwCreateAuthEntryDlg_Impl, PageNumHdl, weld::Toggleable&, rPageCB, void)
1907{
1908 if (rPageCB.get_active())
1909 {
1910 m_xLocalPageSB->set_sensitive(true);
1911 m_xLocalPageSB->set_value(1);
1912 }
1913 else
1914 {
1915 m_xLocalPageSB->set_sensitive(false);
1916 }
1917}
1918
1920 SfxChildWindow* pChild,
1921 weld::Window *pParent,
1922 SfxChildWinInfo const * pInfo,
1923 bool bNew)
1924 : SfxModelessDialogController(_pBindings, pChild, pParent,
1925 "modules/swriter/ui/bibliographyentry.ui", "BibliographyEntryDialog")
1926 , m_aContent(*this, *m_xBuilder, bNew)
1927{
1928 Initialize(pInfo);
1929 if (SwWrtShell* pWrtShell = ::GetActiveWrtShell())
1930 m_aContent.ReInitDlg(*pWrtShell);
1931}
1932
1934{
1937}
1938
1940{
1941 m_aContent.ReInitDlg( rWrtShell );
1942}
1943
1945 : SfxDialogController(pParent, "modules/swriter/ui/bibliographyentry.ui",
1946 "BibliographyEntryDialog")
1947 , m_aContent(*this, *m_xBuilder, false)
1948{
1949 m_aContent.ReInitDlg(rSh);
1950}
1951
1953{
1954 short ret = SfxDialogController::run();
1955 if (ret == RET_OK)
1956 Apply();
1957 return ret;
1958}
1959
1961{
1962 m_aContent.InsertHdl(*m_aContent.m_xActionBT);
1963}
1964
1965/* 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:231
SwAuthorMarkPane m_aContent
Definition: swuiidxmrk.hxx:213
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:226
SwAuthMarkModalDlg(weld::Window *pParent, SwWrtShell &rSh)
std::unique_ptr< weld::RadioButton > m_xFromDocContentRB
Definition: swuiidxmrk.hxx:184
std::unique_ptr< weld::Button > m_xCreateEntryPB
Definition: swuiidxmrk.hxx:191
std::unique_ptr< weld::Label > m_xAuthorFI
Definition: swuiidxmrk.hxx:185
std::unique_ptr< weld::Button > m_xActionBT
Definition: swuiidxmrk.hxx:189
static bool s_bIsFromComponent
Definition: swuiidxmrk.hxx:166
std::unique_ptr< weld::ComboBox > m_xEntryLB
Definition: swuiidxmrk.hxx:188
weld::DialogController & m_rDialog
Definition: swuiidxmrk.hxx:164
OUString m_sFields[AUTH_FIELD_END]
Definition: swuiidxmrk.hxx:177
std::unique_ptr< weld::RadioButton > m_xFromComponentRB
Definition: swuiidxmrk.hxx:183
SwWrtShell * m_pSh
Definition: swuiidxmrk.hxx:174
SwAuthorMarkPane(weld::DialogController &rDialog, weld::Builder &rBuilder, bool bNew)
std::unique_ptr< weld::Button > m_xEditEntryPB
Definition: swuiidxmrk.hxx:192
OUString m_sCreatedEntry[AUTH_FIELD_END]
Definition: swuiidxmrk.hxx:179
std::unique_ptr< weld::Label > m_xTitleFI
Definition: swuiidxmrk.hxx:186
std::unique_ptr< weld::Entry > m_xEntryED
Definition: swuiidxmrk.hxx:187
void ReInitDlg(SwWrtShell &rWrtShell)
std::unique_ptr< weld::Button > m_xCloseBT
Definition: swuiidxmrk.hxx:190
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:2550
void SttCursorMove()
Definition: crsrsh.cxx:301
void SwapPam()
Definition: crsrsh.cxx:1262
sal_uInt16 GetCursorCnt(bool bAll=true) const
Get the number of elements in the ring of cursors.
Definition: crsrsh.cxx:3055
const SwTOXMark & GotoTOXMark(const SwTOXMark &rStart, SwTOXSearch eDir)
traveling between marks
Definition: crstrvl.cxx:588
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2862
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:1073
sal_Int32 Find_Text(const i18nutil::SearchOptions2 &rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, bool &bCancel, FindRanges eRng, bool bReplace=false)
Definition: crsrsh.cxx:3811
void ClearMark()
Definition: crsrsh.cxx:1225
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3662
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:1569
bool InsertField(SwInsertField_Data &rData)
Definition: fldmgr.cxx:895
SwField * GetCurField()
Definition: fldmgr.cxx:430
SwFieldIds Which() const
Definition: fldbas.hxx:276
Base class of all fields.
Definition: fldbas.hxx:296
SwFieldType * GetTyp() const
Definition: fldbas.hxx:402
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:139
SwIndexMarkPane m_aContent
Definition: swuiidxmrk.hxx:153
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:367
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:713
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:610
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:414
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:134
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::Label > m_xForSelectedEntry
Definition: swuiidxmrk.hxx:90
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:3474
const SwTextNode * GetpTextNd() const
Definition: txttxmrk.hxx:44
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2669
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
OUString GetSelectionTextParam(bool bCompleteWords, bool bEraseTrail)
Definition: view.cxx:1679
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:342
bool SelectTextAttr(sal_uInt16 nWhich, const SwTextAttr *pAttr=nullptr)
Definition: move.cxx:763
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2047
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:240
#define FN_INSERT_AUTH_ENTRY_DLG
Definition: cmdid.h:304
#define FN_EDIT_IDX_ENTRY_DLG
Definition: cmdid.h:82
@ 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
constexpr OUStringLiteral HID_AUTH_FIELD_SERIES
Definition: helpids.h:66
constexpr OUStringLiteral HID_AUTH_FIELD_EDITOR
Definition: helpids.h:55
constexpr OUStringLiteral HID_AUTH_FIELD_NUMBER
Definition: helpids.h:61
constexpr OUStringLiteral HID_AUTH_FIELD_EDITION
Definition: helpids.h:54
constexpr OUStringLiteral HID_AUTH_FIELD_ADDRESS
Definition: helpids.h:49
constexpr OUStringLiteral HID_AUTH_FIELD_JOURNAL
Definition: helpids.h:58
constexpr OUStringLiteral HID_AUTH_FIELD_CUSTOM5
Definition: helpids.h:76
constexpr OUStringLiteral HID_AUTH_FIELD_ANNOTE
Definition: helpids.h:50
constexpr OUStringLiteral HID_AUTH_FIELD_PAGES
Definition: helpids.h:63
constexpr OUStringLiteral HID_AUTH_FIELD_REPORT_TYPE
Definition: helpids.h:68
constexpr OUStringLiteral HID_AUTH_FIELD_YEAR
Definition: helpids.h:70
constexpr OUStringLiteral HID_AUTH_FIELD_LOCAL_URL
Definition: helpids.h:78
constexpr OUStringLiteral HID_AUTH_FIELD_VOLUME
Definition: helpids.h:69
constexpr OUStringLiteral HID_AUTH_FIELD_BOOKTITLE
Definition: helpids.h:52
constexpr OUStringLiteral HID_AUTH_FIELD_URL
Definition: helpids.h:71
constexpr OUStringLiteral HID_AUTH_FIELD_IDENTIFIER
Definition: helpids.h:47
constexpr OUStringLiteral HID_AUTH_FIELD_ISBN
Definition: helpids.h:77
constexpr OUStringLiteral HID_AUTH_FIELD_NOTE
Definition: helpids.h:60
constexpr OUStringLiteral HID_AUTH_FIELD_TITLE
Definition: helpids.h:67
constexpr OUStringLiteral HID_AUTH_FIELD_PUBLISHER
Definition: helpids.h:64
constexpr OUStringLiteral HID_AUTH_FIELD_TARGET_URL
Definition: helpids.h:80
constexpr OUStringLiteral HID_AUTH_FIELD_HOWPUBLISHED
Definition: helpids.h:56
constexpr OUStringLiteral HID_AUTH_FIELD_AUTHOR
Definition: helpids.h:51
constexpr OUStringLiteral HID_AUTH_FIELD_INSTITUTION
Definition: helpids.h:57
constexpr OUStringLiteral HID_AUTH_FIELD_CUSTOM3
Definition: helpids.h:74
constexpr OUStringLiteral HID_AUTH_FIELD_AUTHORITY_TYPE
Definition: helpids.h:48
constexpr OUStringLiteral HID_AUTH_FIELD_CUSTOM2
Definition: helpids.h:73
constexpr OUStringLiteral HID_AUTH_FIELD_MONTH
Definition: helpids.h:59
constexpr OUStringLiteral HID_AUTH_FIELD_CUSTOM1
Definition: helpids.h:72
constexpr OUStringLiteral HID_AUTH_FIELD_TARGET_TYPE
Definition: helpids.h:79
constexpr OUStringLiteral HID_AUTH_FIELD_SCHOOL
Definition: helpids.h:65
constexpr OUStringLiteral HID_AUTH_FIELD_CUSTOM4
Definition: helpids.h:75
constexpr OUStringLiteral HID_AUTH_FIELD_CHAPTER
Definition: helpids.h:53
constexpr OUStringLiteral HID_AUTH_FIELD_ORGANIZATIONS
Definition: helpids.h:62
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:748
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:365
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:431
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:655
#define POS_INDEX
Definition: swuiidxmrk.cxx:62
static void lcl_SelectSameStrings(SwWrtShell &rSh, bool bWordOnly, bool bCaseSensitive)
Definition: swuiidxmrk.cxx:496
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_TARGET_TYPE
Definition: toxe.hxx:118
@ 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:119
@ AUTH_FIELD_END
Definition: toxe.hxx:121
@ AUTH_FIELD_CUSTOM3
Definition: toxe.hxx:113
@ 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