LibreOffice Module sw (master) 1
unoatxt.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 <sal/config.h>
21
22#include <com/sun/star/io/IOException.hpp>
23#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
24#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
25#include <com/sun/star/container/ElementExistException.hpp>
26#include <o3tl/safeint.hxx>
27#include <osl/diagnose.h>
28#include <rtl/character.hxx>
29#include <vcl/svapp.hxx>
30#include <svtools/unoevent.hxx>
31#include <sfx2/event.hxx>
32#include <glosdoc.hxx>
33#include <shellio.hxx>
34#include <initui.hxx>
35#include <gloslst.hxx>
36#include <unoatxt.hxx>
37#include <unomap.hxx>
38#include <unotextbodyhf.hxx>
39#include <unotextrange.hxx>
40#include <TextCursorHelper.hxx>
41#include <doc.hxx>
45#include <IDocumentState.hxx>
46#include <docsh.hxx>
47#include <swdll.hxx>
48#include <svl/hint.hxx>
49#include <tools/urlobj.hxx>
50#include <svl/macitem.hxx>
51#include <editeng/acorrcfg.hxx>
55
56#include <memory>
57
58using namespace ::com::sun::star;
59
61{
63
64}
65
67{
68
69}
70
72{
74 "SwXAutoTextContainer::getCount: too many items");
75 return static_cast<sal_Int32>(m_pGlossaries->GetGroupCnt());
76}
77
79{
80 SolarMutexGuard aGuard;
81 const size_t nCount = m_pGlossaries->GetGroupCnt();
82 if ( nIndex < 0 || o3tl::make_unsigned(nIndex) >= nCount )
83 throw lang::IndexOutOfBoundsException();
84 return getByName(m_pGlossaries->GetGroupName( static_cast<size_t>(nIndex) ));
85}
86
88{
90
91}
92
94{
95 // At least standard should always exists!
96 return true;
97}
98
99uno::Any SwXAutoTextContainer::getByName(const OUString& GroupName)
100{
101 SolarMutexGuard aGuard;
102
103 uno::Reference< text::XAutoTextGroup > xGroup;
104 if ( m_pGlossaries && hasByName( GroupName ) ) // group name already known?
105 // true = create group if not already available
107
108 if ( !xGroup.is() )
109 throw container::NoSuchElementException();
110
111 return css::uno::Any( xGroup );
112}
113
114uno::Sequence< OUString > SwXAutoTextContainer::getElementNames()
115{
116 SolarMutexGuard aGuard;
117 const size_t nCount = m_pGlossaries->GetGroupCnt();
119 "SwXAutoTextContainer::getElementNames: too many groups");
120
121 uno::Sequence< OUString > aGroupNames(static_cast<sal_Int32>(nCount));
122 OUString *pArr = aGroupNames.getArray();
123
124 for ( size_t i = 0; i < nCount; ++i )
125 {
126 // The names will be passed without a path extension.
127 pArr[i] = m_pGlossaries->GetGroupName(i).getToken(0, GLOS_DELIM);
128 }
129 return aGroupNames;
130}
131// Finds group names with or without path index.
133{
134 SolarMutexGuard aGuard;
135 OUString sGroupName( m_pGlossaries->GetCompleteGroupName( Name ) );
136 if(!sGroupName.isEmpty())
137 return true;
138 return false;
139}
140
141uno::Reference< text::XAutoTextGroup > SwXAutoTextContainer::insertNewByName(
142 const OUString& aGroupName)
143{
144 SolarMutexGuard aGuard;
145 if(hasByName(aGroupName))
146 throw container::ElementExistException();
147 //check for non-ASCII characters
148 if(aGroupName.isEmpty())
149 {
150 lang::IllegalArgumentException aIllegal;
151 aIllegal.Message = "group name must not be empty";
152 throw aIllegal;
153 }
154 for(sal_Int32 nPos = 0; nPos < aGroupName.getLength(); nPos++)
155 {
156 sal_Unicode cChar = aGroupName[nPos];
157 if (rtl::isAsciiAlphanumeric(cChar) ||
158 (cChar == '_') ||
159 (cChar == 0x20) ||
160 (cChar == GLOS_DELIM) )
161 {
162 continue;
163 }
164 lang::IllegalArgumentException aIllegal;
165 aIllegal.Message = "group name must contain a-z, A-z, '_', ' ' only";
166 throw aIllegal;
167 }
168 OUString sGroup(aGroupName);
169 if (sGroup.indexOf(GLOS_DELIM)<0)
170 {
171 sGroup += OUStringChar(GLOS_DELIM) + "0";
172 }
173 m_pGlossaries->NewGroupDoc(sGroup, sGroup.getToken(0, GLOS_DELIM));
174
175 uno::Reference< text::XAutoTextGroup > xGroup = m_pGlossaries->GetAutoTextGroup( sGroup );
176 OSL_ENSURE( xGroup.is(), "SwXAutoTextContainer::insertNewByName: no UNO object created? How this?" );
177 // We just inserted the group into the glossaries, so why doesn't it exist?
178
179 return xGroup;
180}
181
182void SwXAutoTextContainer::removeByName(const OUString& aGroupName)
183{
184 SolarMutexGuard aGuard;
185 // At first find the name with path extension
186 OUString sGroupName = m_pGlossaries->GetCompleteGroupName( aGroupName );
187 if(sGroupName.isEmpty())
188 throw container::NoSuchElementException();
189 m_pGlossaries->DelGroupDoc(sGroupName);
190}
191
193{
194 return "SwXAutoTextContainer";
195}
196
198{
199 return cppu::supportsService(this, rServiceName);
200}
201
203{
204 return { "com.sun.star.text.AutoTextContainer" };
205}
206
207const uno::Sequence< sal_Int8 > & SwXAutoTextGroup::getUnoTunnelId()
208{
209 static const comphelper::UnoIdInit theSwXAutoTextGroupUnoTunnelId;
210 return theSwXAutoTextGroupUnoTunnelId.getSeq();
211}
212
213sal_Int64 SAL_CALL SwXAutoTextGroup::getSomething( const uno::Sequence< sal_Int8 >& rId )
214{
215 return comphelper::getSomethingImpl(rId, this);
216}
217
219 SwGlossaries* pGlos) :
220 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_AUTO_TEXT_GROUP)),
221 m_pGlossaries(pGlos),
222 m_sName(rName),
223 m_sGroupName(rName)
224{
225 OSL_ENSURE( -1 != rName.indexOf( GLOS_DELIM ),
226 "SwXAutoTextGroup::SwXAutoTextGroup: to be constructed with a complete name only!" );
227}
228
230{
231}
232
233uno::Sequence< OUString > SwXAutoTextGroup::getTitles()
234{
235 SolarMutexGuard aGuard;
236 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
237 if (!pGlosGroup || pGlosGroup->GetError())
238 throw uno::RuntimeException();
239 const sal_uInt16 nCount = pGlosGroup->GetCount();
240
241 uno::Sequence< OUString > aEntryTitles(nCount);
242 OUString *pArr = aEntryTitles.getArray();
243
244 for ( sal_uInt16 i = 0; i < nCount; i++ )
245 pArr[i] = pGlosGroup->GetLongName(i);
246 return aEntryTitles;
247}
248
249void SwXAutoTextGroup::renameByName(const OUString& aElementName,
250 const OUString& aNewElementName, const OUString& aNewElementTitle)
251{
252 SolarMutexGuard aGuard;
253 // throw exception only if the programmatic name is to be changed into an existing name
254 if(aNewElementName != aElementName && hasByName(aNewElementName))
255 throw container::ElementExistException();
256 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
257 if(!pGlosGroup || pGlosGroup->GetError())
258 throw uno::RuntimeException();
259
260 const sal_uInt16 nIdx = pGlosGroup->GetIndex( aElementName);
261 if(USHRT_MAX == nIdx)
262 throw lang::IllegalArgumentException();
263 OUString aNewShort(aNewElementName);
264 OUString aNewName(aNewElementTitle);
265 sal_uInt16 nOldLongIdx = pGlosGroup->GetLongIndex( aNewShort );
266 sal_uInt16 nOldIdx = pGlosGroup->GetIndex( aNewName );
267
268 if ((nOldLongIdx == USHRT_MAX || nOldLongIdx == nIdx)
269 && (nOldIdx == USHRT_MAX || nOldIdx == nIdx))
270 {
271 pGlosGroup->Rename( nIdx, &aNewShort, &aNewName );
272 if(pGlosGroup->GetError() != ERRCODE_NONE)
273 throw io::IOException();
274 }
275
276}
277
278static bool lcl_CopySelToDoc(SwDoc& rInsDoc, OTextCursorHelper* pxCursor, SwXTextRange* pxRange)
279{
280 SwNodes& rNds = rInsDoc.GetNodes();
281
282 SwNodeIndex aIdx( rNds.GetEndOfContent(), -1 );
283 SwContentNode * pNd = aIdx.GetNode().GetContentNode();
284 SwPosition aPos(aIdx, SwIndex(pNd, pNd ? pNd->Len() : 0));
285
286 bool bRet = false;
288 {
289 SwDoc *const pDoc(pxCursor ? pxCursor->GetDoc() : &pxRange->GetDoc());
290 SwPaM aPam(pDoc->GetNodes());
291 SwPaM * pPam(nullptr);
292 if(pxCursor)
293 {
294 pPam = pxCursor->GetPaM();
295 }
296 else
297 {
298 if (pxRange->GetPositions(aPam))
299 {
300 pPam = & aPam;
301 }
302 }
303 if (!pPam) { return false; }
305 || bRet;
306 }
307
310 rInsDoc.getIDocumentFieldsAccess().UpdateExpFields(nullptr, true);
311
312 return bRet;
313}
314
315uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const OUString& aName,
316 const OUString& aTitle, const uno::Reference< text::XTextRange > & xTextRange)
317{
318 SolarMutexGuard aGuard;
319 if(hasByName(aName))
320 throw container::ElementExistException();
321 if(!xTextRange.is())
322 throw uno::RuntimeException();
323
324 std::unique_ptr<SwTextBlocks> pGlosGroup;
325 if (m_pGlossaries)
327 const OUString& sShortName(aName);
328 const OUString& sLongName(aTitle);
329 if (pGlosGroup && !pGlosGroup->GetError())
330 {
331 uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
332 SwXTextRange* pxRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
333 OTextCursorHelper* pxCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
334
335 OUString sOnlyText;
336 OUString* pOnlyText = nullptr;
337 bool bNoAttr = !pxCursor && !pxRange;
338 if(bNoAttr)
339 {
340 sOnlyText = xTextRange->getString();
341 pOnlyText = &sOnlyText;
342 }
343
344 const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get();
345
346 SwDoc* pGDoc = pGlosGroup->GetDoc();
347
348 // Until there is an option for that, delete base util::URL
349 if(rCfg.IsSaveRelFile())
350 {
351 INetURLObject aTemp(pGlosGroup->GetFileName());
352 pGlosGroup->SetBaseURL( aTemp.GetMainURL(INetURLObject::DecodeMechanism::NONE));
353 }
354 else
355 pGlosGroup->SetBaseURL( OUString() );
356
357 sal_uInt16 nRet = USHRT_MAX;
358 if( pOnlyText )
359 nRet = pGlosGroup->PutText( sShortName, sLongName, *pOnlyText );
360 else
361 {
362 pGlosGroup->ClearDoc();
363 if( pGlosGroup->BeginPutDoc( sShortName, sLongName ) )
364 {
366 lcl_CopySelToDoc(*pGDoc, pxCursor, pxRange);
368 nRet = pGlosGroup->PutDoc();
369 }
370 }
371
372 if (nRet == USHRT_MAX)
373 {
374 throw uno::RuntimeException();
375 }
376 }
377 pGlosGroup.reset();
378
379 uno::Reference< text::XAutoTextEntry > xEntry;
380
381 try
382 {
383 xEntry = m_pGlossaries ?
385 uno::Reference< text::XAutoTextEntry >();
386 OSL_ENSURE( xEntry.is(), "SwXAutoTextGroup::insertNewByName: no UNO object created? How this?" );
387 // we just inserted the entry into the group, so why doesn't it exist?
388 }
389 catch (const container::ElementExistException&)
390 {
391 throw;
392 }
393 catch (const uno::RuntimeException&)
394 {
395 throw;
396 }
397 catch (const uno::Exception&)
398 {
399 css::uno::Any anyEx = cppu::getCaughtException();
400 throw css::lang::WrappedTargetRuntimeException(
401 "Error Getting AutoText!",
402 static_cast < OWeakObject * > ( this ),
403 anyEx );
404 }
405
406 return xEntry;
407}
408
409void SwXAutoTextGroup::removeByName(const OUString& aEntryName)
410{
411 SolarMutexGuard aGuard;
412 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
413 if(!pGlosGroup || pGlosGroup->GetError())
414 throw container::NoSuchElementException();
415
416 sal_uInt16 nIdx = pGlosGroup->GetIndex(aEntryName);
417 if ( nIdx == USHRT_MAX )
418 throw container::NoSuchElementException();
419
420 pGlosGroup->Delete(nIdx);
421}
422
424{
425 SolarMutexGuard aGuard;
426 return m_sName;
427}
428
429void SwXAutoTextGroup::setName(const OUString& rName)
430{
431 SolarMutexGuard aGuard;
432 if( !m_pGlossaries )
433 throw uno::RuntimeException();
434
435 sal_Int32 nNewDelimPos = rName.lastIndexOf( GLOS_DELIM );
436 sal_Int32 nOldDelimPos = m_sName.lastIndexOf( GLOS_DELIM );
437
438 OUString aNewSuffix;
439 if (nNewDelimPos > -1)
440 aNewSuffix = rName.copy( nNewDelimPos + 1 );
441 OUString aOldSuffix;
442 if (nOldDelimPos > -1)
443 aOldSuffix = m_sName.copy( nOldDelimPos + 1 );
444
445 sal_Int32 nNewNumeric = aNewSuffix.toInt32();
446 sal_Int32 nOldNumeric = aOldSuffix.toInt32();
447
448 OUString aNewPrefix( (nNewDelimPos > 1) ? rName.copy( 0, nNewDelimPos ) : rName );
449 OUString aOldPrefix( (nOldDelimPos > 1) ? m_sName.copy( 0, nOldDelimPos ) : m_sName );
450
451 if ( m_sName == rName ||
452 ( nNewNumeric == nOldNumeric && aNewPrefix == aOldPrefix ) )
453 return;
454 OUString sNewGroup(rName);
455 if (sNewGroup.indexOf(GLOS_DELIM)<0)
456 {
457 sNewGroup += OUStringChar(GLOS_DELIM) + "0";
458 }
459
460 //the name must be saved, the group may be invalidated while in RenameGroupDoc()
461 SwGlossaries* pTempGlossaries = m_pGlossaries;
462
463 OUString sPreserveTitle( m_pGlossaries->GetGroupTitle( m_sName ) );
464 if ( !m_pGlossaries->RenameGroupDoc( m_sName, sNewGroup, sPreserveTitle ) )
465 throw uno::RuntimeException();
466 m_sName = rName;
467 m_sGroupName = sNewGroup;
468 m_pGlossaries = pTempGlossaries;
469}
470
472{
473 SolarMutexGuard aGuard;
474 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
475 if (!pGlosGroup || pGlosGroup->GetError())
476 throw uno::RuntimeException();
477 return static_cast<sal_Int32>(pGlosGroup->GetCount());
478}
479
481{
482 SolarMutexGuard aGuard;
483 if (!m_pGlossaries)
484 throw uno::RuntimeException();
485 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries->GetGroupDoc(m_sGroupName));
486 if (!pGlosGroup || pGlosGroup->GetError())
487 throw uno::RuntimeException();
488 const sal_uInt16 nCount = pGlosGroup->GetCount();
490 throw lang::IndexOutOfBoundsException();
491 return getByName(pGlosGroup->GetShortName(o3tl::narrowing<sal_uInt16>(nIndex)));
492}
493
495{
497
498}
499
501{
502 SolarMutexGuard aGuard;
503 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
504 if (!pGlosGroup || pGlosGroup->GetError())
505 throw uno::RuntimeException();
506 return pGlosGroup->GetCount() > 0;
507
508}
509
511{
512 SolarMutexGuard aGuard;
513 uno::Reference< text::XAutoTextEntry > xEntry = m_pGlossaries->GetAutoTextEntry( m_sGroupName, m_sName, _rName );
514 OSL_ENSURE( xEntry.is(), "SwXAutoTextGroup::getByName: GetAutoTextEntry is fractious!" );
515 // we told it to create the object, so why didn't it?
516 return css::uno::Any( xEntry );
517}
518
519uno::Sequence< OUString > SwXAutoTextGroup::getElementNames()
520{
521 SolarMutexGuard aGuard;
522 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
523 if (!pGlosGroup || pGlosGroup->GetError())
524 throw uno::RuntimeException();
525
526 const sal_uInt16 nCount = pGlosGroup->GetCount();
527 uno::Sequence< OUString > aEntryNames(nCount);
528 OUString *pArr = aEntryNames.getArray();
529
530 for ( sal_uInt16 i = 0; i < nCount; i++ )
531 pArr[i] = pGlosGroup->GetShortName(i);
532 return aEntryNames;
533}
534
536{
537 SolarMutexGuard aGuard;
538 bool bRet = false;
539 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
540 if (!pGlosGroup || pGlosGroup->GetError())
541 throw uno::RuntimeException();
542
543 const sal_uInt16 nCount = pGlosGroup->GetCount();
544 for( sal_uInt16 i = 0; i < nCount; ++i )
545 {
546 OUString sCompare(pGlosGroup->GetShortName(i));
547 if(sCompare.equalsIgnoreAsciiCase(rName))
548 {
549 bRet = true;
550 break;
551 }
552 }
553 return bRet;
554}
555
556uno::Reference< beans::XPropertySetInfo > SwXAutoTextGroup::getPropertySetInfo()
557{
558 static uno::Reference< beans::XPropertySetInfo > xRet = m_pPropSet->getPropertySetInfo();
559 return xRet;
560}
561
563 const OUString& rPropertyName, const uno::Any& aValue)
564{
565 SolarMutexGuard aGuard;
566 const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
567
568 if(!pEntry)
569 throw beans::UnknownPropertyException(rPropertyName);
570
571 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
572 if(!pGlosGroup || pGlosGroup->GetError())
573 throw uno::RuntimeException();
574 switch(pEntry->nWID)
575 {
576 case WID_GROUP_TITLE:
577 {
578 OUString sNewTitle;
579 aValue >>= sNewTitle;
580 if(sNewTitle.isEmpty())
581 throw lang::IllegalArgumentException();
582 bool bChanged = sNewTitle != pGlosGroup->GetName();
583 pGlosGroup->SetName(sNewTitle);
584 if(bChanged && HasGlossaryList())
586 }
587 break;
588 }
589}
590
591uno::Any SwXAutoTextGroup::getPropertyValue(const OUString& rPropertyName)
592{
593 SolarMutexGuard aGuard;
594 const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName);
595
596 if(!pEntry)
597 throw beans::UnknownPropertyException(rPropertyName);
598 std::unique_ptr<SwTextBlocks> pGlosGroup(m_pGlossaries ? m_pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
599 if(!pGlosGroup || pGlosGroup->GetError())
600 throw uno::RuntimeException();
601
602 uno::Any aAny;
603 switch(pEntry->nWID)
604 {
605 case WID_GROUP_PATH:
606 aAny <<= pGlosGroup->GetFileName();
607 break;
608 case WID_GROUP_TITLE:
609 aAny <<= pGlosGroup->GetName();
610 break;
611 }
612 return aAny;
613}
614
616 const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
617{
618}
619
621 const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
622{
623}
624
626 const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
627{
628}
629
631 const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
632{
633}
634
636{
637 m_pGlossaries = nullptr;
638 m_sName.clear();
639 m_sGroupName.clear();
640}
641
643{
644 return "SwXAutoTextGroup";
645}
646
647sal_Bool SwXAutoTextGroup::supportsService(const OUString& rServiceName)
648{
649 return cppu::supportsService(this, rServiceName);
650}
651
653{
654 uno::Sequence<OUString> aRet { "com.sun.star.text.AutoTextGroup" };
655 return aRet;
656}
657
658const uno::Sequence< sal_Int8 > & SwXAutoTextEntry::getUnoTunnelId()
659{
660 static const comphelper::UnoIdInit theSwXAutoTextEntryUnoTunnelId;
661 return theSwXAutoTextEntryUnoTunnelId.getSeq();
662}
663
664sal_Int64 SAL_CALL SwXAutoTextEntry::getSomething( const uno::Sequence< sal_Int8 >& rId )
665{
666 return comphelper::getSomethingImpl(rId, this);
667}
668
669SwXAutoTextEntry::SwXAutoTextEntry(SwGlossaries* pGlss, const OUString& rGroupName,
670 const OUString& rEntryName) :
671 m_pGlossaries(pGlss),
672 m_sGroupName(rGroupName),
673 m_sEntryName(rEntryName)
674{
675}
676
678{
679 SolarMutexGuard aGuard;
680
681 // ensure that any pending modifications are written
682 implFlushDocument( true );
683}
684
686{
687 if ( !m_xDocSh.is() )
688 return;
689
690 if ( m_xDocSh->GetDoc()->getIDocumentState().IsModified () )
691 m_xDocSh->Save();
692
693 if ( _bCloseDoc )
694 {
695 // stop listening at the document
697
698 m_xDocSh->DoClose();
699 m_xDocSh.clear();
700 }
701}
702
704{
705 if ( &_rBC != m_xDocSh.get() )
706 return;
707
708// it's our document
709 if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&_rHint))
710 {
711 if (SfxEventHintId::PrepareCloseDoc == pEventHint->GetEventId())
712 {
714 mxBodyText.clear();
716 m_xDocSh.clear();
717 }
718 }
719 else
720 {
721 if ( SfxHintId::Deinitializing == _rHint.GetId() )
722 {
723 // our document is dying (possibly because we're shutting down, and the document was notified
724 // earlier than we are?)
725 // stop listening at the docu
727 // and release our reference
728 m_xDocSh.clear();
729 }
730 }
731}
732
734{
735 SolarMutexGuard aGuard;
736
738 OSL_ENSURE( m_xDocSh.is(), "SwXAutoTextEntry::GetBodyText: unexpected: no doc returned by EditGroupDoc!" );
739
740 // start listening at the document
742
743 mxBodyText = new SwXBodyText ( m_xDocSh->GetDoc() );
744}
745
746void SwXAutoTextEntry::disposing(std::unique_lock<std::mutex>&)
747{
749 implFlushDocument(true);
750}
751
752uno::Reference< text::XTextCursor > SwXAutoTextEntry::createTextCursor()
753{
754 SolarMutexGuard aGuard;
756 return mxBodyText->createTextCursor();
757}
758
759uno::Reference< text::XTextCursor > SwXAutoTextEntry::createTextCursorByRange(
760 const uno::Reference< text::XTextRange > & aTextPosition)
761{
762 SolarMutexGuard aGuard;
764 return mxBodyText->createTextCursorByRange ( aTextPosition );
765}
766
767void SwXAutoTextEntry::insertString(const uno::Reference< text::XTextRange > & xRange, const OUString& aString, sal_Bool bAbsorb)
768{
769 SolarMutexGuard aGuard;
771 mxBodyText->insertString ( xRange, aString, bAbsorb );
772}
773
774void SwXAutoTextEntry::insertControlCharacter(const uno::Reference< text::XTextRange > & xRange,
775 sal_Int16 nControlCharacter, sal_Bool bAbsorb)
776{
777 SolarMutexGuard aGuard;
779 mxBodyText->insertControlCharacter ( xRange, nControlCharacter, bAbsorb );
780}
781
783 const uno::Reference< text::XTextRange > & xRange,
784 const uno::Reference< text::XTextContent > & xContent, sal_Bool bAbsorb)
785{
786 SolarMutexGuard aGuard;
788 mxBodyText->insertTextContent ( xRange, xContent, bAbsorb );
789}
790
792 const uno::Reference< text::XTextContent > & xContent)
793{
794 SolarMutexGuard aGuard;
796 mxBodyText->removeTextContent ( xContent );
797}
798
799uno::Reference< text::XText > SwXAutoTextEntry::getText()
800{
801 SolarMutexGuard aGuard;
802 uno::Reference< text::XText > xRet = static_cast<text::XText*>(this);
803 return xRet;
804}
805
806uno::Reference< text::XTextRange > SwXAutoTextEntry::getStart()
807{
808 SolarMutexGuard aGuard;
810 return mxBodyText->getStart();
811}
812
813uno::Reference< text::XTextRange > SwXAutoTextEntry::getEnd()
814{
815 SolarMutexGuard aGuard;
817 return mxBodyText->getEnd();
818}
819
821{
822 SolarMutexGuard aGuard;
824 return mxBodyText->getString();
825}
826
827void SwXAutoTextEntry::setString(const OUString& aString)
828{
829 SolarMutexGuard aGuard;
831 mxBodyText->setString( aString );
832}
833
834void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextRange)
835{
836 SolarMutexGuard aGuard;
837
838 // ensure that any pending modifications are written
839 // reason is that we're holding the _copy_ of the auto text, while the real auto text
840 // is stored somewhere. And below, we're not working with our copy, but only tell the target
841 // TextRange to work with the stored version.
842 // #96380# - 2003-03-03 - fs@openoffice.org
844 // TODO: think about if we should pass "true" here
845 // The difference would be that when the next modification is made to this instance here, then
846 // we would be forced to open the document again, instead of working on our current copy.
847 // This means that we would reflect any changes which were done to the AutoText by foreign instances
848 // in the meantime
849
850 // The reference to the tunnel is needed during the whole call, likely because it could be a
851 // different object, not xTextRange itself, and the reference guards it from preliminary death
852 uno::Reference<lang::XUnoTunnel> xTunnel( xTextRange, uno::UNO_QUERY);
853 SwXTextRange* pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xTunnel);
854 OTextCursorHelper* pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xTunnel);
855 SwXText *pText = comphelper::getFromUnoTunnel<SwXText>(xTunnel);
856
857 SwDoc* pDoc = nullptr;
858 if (pRange)
859 pDoc = &pRange->GetDoc();
860 else if ( pCursor )
861 pDoc = pCursor->GetDoc();
862 else if ( pText && pText->GetDoc() )
863 {
864 xTunnel.set(pText->getStart(), uno::UNO_QUERY);
865 pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xTunnel);
866 if (pCursor)
867 pDoc = pText->GetDoc();
868 }
869
870 if(!pDoc)
871 throw uno::RuntimeException();
872
873 SwPaM InsertPaM(pDoc->GetNodes());
874 if (pRange)
875 {
876 if (!pRange->GetPositions(InsertPaM))
877 {
878 throw uno::RuntimeException();
879 }
880 }
881 else
882 {
883 InsertPaM = *pCursor->GetPaM();
884 }
885
886 std::unique_ptr<SwTextBlocks> pBlock(m_pGlossaries->GetGroupDoc(m_sGroupName));
887 const bool bResult = pBlock && !pBlock->GetError()
888 && pDoc->InsertGlossary( *pBlock, m_sEntryName, InsertPaM);
889
890 if(!bResult)
891 throw uno::RuntimeException();
892}
893
895{
896 return "SwXAutoTextEntry";
897}
898
899sal_Bool SwXAutoTextEntry::supportsService(const OUString& rServiceName)
900{
901 return cppu::supportsService(this, rServiceName);
902}
903
905{
906 uno::Sequence<OUString> aRet { "com.sun.star.text.AutoTextEntry" };
907 return aRet;
908}
909
910uno::Reference< container::XNameReplace > SwXAutoTextEntry::getEvents()
911{
912 return new SwAutoTextEventDescriptor( *this );
913}
914
916{
917 { SvMacroItemId::SwStartInsGlossary, "OnInsertStart" },
918 { SvMacroItemId::SwEndInsGlossary, "OnInsertDone" },
919 { SvMacroItemId::NONE, nullptr }
920};
921
923 SwXAutoTextEntry& rAutoText ) :
925 m_rAutoTextEntry(rAutoText)
926{
927}
928
930{
931}
932
934{
935 return "SwAutoTextEventDescriptor";
936}
937
939 const SvMacroItemId nEvent,
940 const SvxMacro& rMacro)
941{
942 OSL_ENSURE( nullptr != m_rAutoTextEntry.GetGlossaries(),
943 "Strangely enough, the AutoText vanished!" );
944 OSL_ENSURE( (nEvent == SvMacroItemId::SwEndInsGlossary) ||
945 (nEvent == SvMacroItemId::SwStartInsGlossary) ,
946 "Unknown event ID" );
947
950 std::unique_ptr<SwTextBlocks> pBlocks(
951 pGlossaries->GetGroupDoc( m_rAutoTextEntry.GetGroupName() ));
952 OSL_ENSURE( pBlocks,
953 "can't get autotext group; SwAutoTextEntry has illegal name?");
954
955 if( !pBlocks || pBlocks->GetError())
956 return;
957
958 sal_uInt16 nIndex = pBlocks->GetIndex( m_rAutoTextEntry.GetEntryName() );
959 if( nIndex != USHRT_MAX )
960 {
961 SvxMacroTableDtor aMacroTable;
962 if( pBlocks->GetMacroTable( nIndex, aMacroTable ) )
963 {
964 aMacroTable.Insert( nEvent, rMacro );
965 pBlocks->SetMacroTable( nIndex, aMacroTable );
966 }
967 }
968 // else: ignore
969}
970
972 SvxMacro& rMacro,
973 const SvMacroItemId nEvent )
974{
975 OSL_ENSURE( nullptr != m_rAutoTextEntry.GetGlossaries(), "no AutoText" );
976 OSL_ENSURE( (nEvent == SvMacroItemId::SwEndInsGlossary) ||
977 (nEvent == SvMacroItemId::SwStartInsGlossary) ,
978 "Unknown event ID" );
979
982 std::unique_ptr<SwTextBlocks> pBlocks(
983 pGlossaries->GetGroupDoc( m_rAutoTextEntry.GetGroupName() ));
984 OSL_ENSURE( pBlocks,
985 "can't get autotext group; SwAutoTextEntry has illegal name?");
986
987 // return empty macro, unless macro is found
988 OUString sEmptyStr;
989 SvxMacro aEmptyMacro(sEmptyStr, sEmptyStr);
990 rMacro = aEmptyMacro;
991
992 if ( !pBlocks || pBlocks->GetError())
993 return;
994
995 sal_uInt16 nIndex = pBlocks->GetIndex( m_rAutoTextEntry.GetEntryName() );
996 if( nIndex != USHRT_MAX )
997 {
998 SvxMacroTableDtor aMacroTable;
999 if( pBlocks->GetMacroTable( nIndex, aMacroTable ) )
1000 {
1001 SvxMacro *pMacro = aMacroTable.Get( nEvent );
1002 if( pMacro )
1003 rMacro = *pMacro;
1004 }
1005 }
1006}
1007
1008extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1009SwXAutoTextContainer_get_implementation(css::uno::XComponentContext*,
1010 css::uno::Sequence<css::uno::Any> const &)
1011{
1012 //the module may not be loaded
1013 SolarMutexGuard aGuard;
1015 return cppu::acquire(new SwXAutoTextContainer());
1016}
1017
1018/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ CheckPosInFly
check if target position is in fly anchored at source range
@ NONE
no RedlineFlags
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
virtual void LockExpFields()=0
virtual bool IsExpFieldsLocked() const =0
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields)=0
virtual void UnlockExpFields()=0
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
virtual const SwDoc * GetDoc() const =0
virtual const SwPaM * GetPaM() const =0
SfxHintId GetId() const
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
const SfxItemPropertyMap & getPropertyMap() const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
static SvxAutoCorrCfg & Get()
bool IsSaveRelFile() const
SvxMacro & Insert(SvMacroItemId nEvent, const SvxMacro &rMacro)
const SvxMacro * Get(SvMacroItemId nEvent) const
Implement the XNameAccess for the AutoText events.
Definition: unoatxt.hxx:239
SwXAutoTextEntry & m_rAutoTextEntry
Definition: unoatxt.hxx:240
virtual void getByName(SvxMacro &rMacro, const SvMacroItemId nEvent) override
item ID of event
Definition: unoatxt.cxx:971
SwAutoTextEventDescriptor(SwXAutoTextEntry &rAutoText)
Definition: unoatxt.cxx:922
virtual void replaceByName(const SvMacroItemId nEvent, const SvxMacro &rMacro) override
event (will be copied)
Definition: unoatxt.cxx:938
virtual ~SwAutoTextEventDescriptor() override
Definition: unoatxt.cxx:929
virtual OUString SAL_CALL getImplementationName() override
Definition: unoatxt.cxx:933
virtual sal_Int32 Len() const
Definition: node.cxx:1237
Definition: doc.hxx:188
bool InsertGlossary(SwTextBlocks &rBlock, const OUString &rEntry, SwPaM &rPaM, SwCursorShell *pShell=nullptr)
inserts an AutoText block
Definition: docglos.cxx:131
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
SwNodes & GetNodes()
Definition: doc.hxx:408
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
bool NewGroupDoc(OUString &rGroupName, const OUString &rTitle)
Definition: glosdoc.cxx:176
OUString GetCompleteGroupName(std::u16string_view GroupName)
Definition: glosdoc.cxx:477
size_t GetGroupCnt()
Definition: glosdoc.cxx:99
std::unique_ptr< SwTextBlocks > GetGroupDoc(const OUString &rName, bool bCreate=false)
Definition: glosdoc.cxx:159
SwDocShellRef EditGroupDoc(const OUString &rGrpName, const OUString &rShortName, bool bShow=true)
Definition: glshell.cxx:196
OUString GetGroupTitle(const OUString &rGroupName)
Definition: glosdoc.cxx:144
css::uno::Reference< css::text::XAutoTextEntry > GetAutoTextEntry(const OUString &_rCompleteGroupName, const OUString &_rGroupName, const OUString &_rEntryName)
returns the cached AutoTextEntry (if any) for the given group/with the given name The entry is create...
Definition: glosdoc.cxx:572
OUString const & GetGroupName(size_t)
Definition: glosdoc.cxx:137
css::uno::Reference< css::text::XAutoTextGroup > GetAutoTextGroup(std::u16string_view _rGroupName)
returns the cached AutoTextGroup (if any) for the given group name The group is created if it does no...
Definition: glosdoc.cxx:522
bool DelGroupDoc(std::u16string_view)
Definition: glosdoc.cxx:248
bool RenameGroupDoc(const OUString &sOldGroup, OUString &sNewGroup, const OUString &rNewTitle)
Definition: glosdoc.cxx:196
void ClearGroups()
Definition: gloslst.cxx:437
Marks a character position inside a document model node.
Definition: index.hxx:34
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:128
SwContentNode * GetContentNode()
Definition: node.hxx:627
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:162
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:138
virtual css::uno::Reference< css::text::XAutoTextGroup > SAL_CALL insertNewByName(const OUString &aGroupName) override
Definition: unoatxt.cxx:141
virtual sal_Bool SAL_CALL hasElements() override
Definition: unoatxt.cxx:93
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unoatxt.cxx:114
virtual OUString SAL_CALL getImplementationName() override
Definition: unoatxt.cxx:192
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unoatxt.cxx:99
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unoatxt.cxx:87
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unoatxt.cxx:78
SwGlossaries * m_pGlossaries
Definition: unoatxt.hxx:56
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoatxt.cxx:197
virtual void SAL_CALL removeByName(const OUString &aGroupName) override
Definition: unoatxt.cxx:182
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unoatxt.cxx:132
virtual sal_Int32 SAL_CALL getCount() override
Definition: unoatxt.cxx:71
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoatxt.cxx:202
virtual ~SwXAutoTextContainer() override
Definition: unoatxt.cxx:66
virtual OUString SAL_CALL getImplementationName() override
Definition: unoatxt.cxx:894
void implFlushDocument(bool _bCloseDoc=false)
ensure that the current content (which may only be in-memory so far) is flushed to the auto text grou...
Definition: unoatxt.cxx:685
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unoatxt.cxx:806
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: unoatxt.cxx:703
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unoatxt.cxx:799
virtual OUString SAL_CALL getString() override
Definition: unoatxt.cxx:820
SwXAutoTextEntry(SwGlossaries *, const OUString &rGroupName, const OUString &rEntryName)
Definition: unoatxt.cxx:669
void EnsureBodyText()
Definition: unoatxt.hxx:170
rtl::Reference< SwXBodyText > mxBodyText
Definition: unoatxt.hxx:168
const OUString & GetGroupName() const
Definition: unoatxt.hxx:233
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unoatxt.cxx:813
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: unoatxt.cxx:774
virtual void SAL_CALL applyTo(const css::uno::Reference< css::text::XTextRange > &xRange) override
Definition: unoatxt.cxx:834
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: unoatxt.cxx:910
SwDocShellRef m_xDocSh
Definition: unoatxt.hxx:166
OUString m_sGroupName
Definition: unoatxt.hxx:164
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoatxt.cxx:899
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: unoatxt.cxx:752
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unoatxt.cxx:664
void disposing(std::unique_lock< std::mutex > &) override
Definition: unoatxt.cxx:746
void GetBodyText()
Definition: unoatxt.cxx:733
const OUString & GetEntryName() const
Definition: unoatxt.hxx:234
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoatxt.cxx:904
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
Definition: unoatxt.cxx:782
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoatxt.cxx:658
const SwGlossaries * GetGlossaries() const
Definition: unoatxt.hxx:232
SwGlossaries * m_pGlossaries
Definition: unoatxt.hxx:163
virtual void SAL_CALL setString(const OUString &aString) override
Definition: unoatxt.cxx:827
OUString m_sEntryName
Definition: unoatxt.hxx:165
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &aTextPosition) override
Definition: unoatxt.cxx:759
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: unoatxt.cxx:791
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: unoatxt.cxx:767
virtual ~SwXAutoTextEntry() override
Definition: unoatxt.cxx:677
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unoatxt.cxx:620
SwXAutoTextGroup(const OUString &rName, SwGlossaries *pGloss)
Definition: unoatxt.cxx:218
virtual void SAL_CALL setName(const OUString &Name_) override
Definition: unoatxt.cxx:429
const SfxItemPropertySet * m_pPropSet
Definition: unoatxt.hxx:97
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoatxt.cxx:625
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoatxt.cxx:630
SwGlossaries * m_pGlossaries
Definition: unoatxt.hxx:98
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoatxt.cxx:207
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unoatxt.cxx:494
virtual OUString SAL_CALL getImplementationName() override
Definition: unoatxt.cxx:642
virtual css::uno::Sequence< OUString > SAL_CALL getTitles() override
Definition: unoatxt.cxx:233
OUString m_sName
Definition: unoatxt.hxx:99
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unoatxt.cxx:535
void Invalidate()
Definition: unoatxt.cxx:635
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unoatxt.cxx:556
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoatxt.cxx:647
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unoatxt.cxx:480
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unoatxt.cxx:615
virtual sal_Int32 SAL_CALL getCount() override
Definition: unoatxt.cxx:471
OUString m_sGroupName
Definition: unoatxt.hxx:100
virtual sal_Bool SAL_CALL hasElements() override
Definition: unoatxt.cxx:500
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoatxt.cxx:652
virtual void SAL_CALL removeByName(const OUString &aEntryName) override
Definition: unoatxt.cxx:409
virtual css::uno::Reference< css::text::XAutoTextEntry > SAL_CALL insertNewByName(const OUString &aName, const OUString &aTitle, const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unoatxt.cxx:315
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unoatxt.cxx:591
virtual ~SwXAutoTextGroup() override
Definition: unoatxt.cxx:229
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unoatxt.cxx:510
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unoatxt.cxx:519
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unoatxt.cxx:562
virtual OUString SAL_CALL getName() override
Definition: unoatxt.cxx:423
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unoatxt.cxx:213
virtual void SAL_CALL renameByName(const OUString &aElementName, const OUString &aNewElementName, const OUString &aNewElementTitle) override
Definition: unoatxt.cxx:249
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:767
virtual OUString SAL_CALL getString() override
Definition: unoobj2.cxx:1044
bool GetPositions(SwPaM &rToFill, ::sw::TextRangeMode eMode=::sw::TextRangeMode::RequireTextNode) const
Definition: unoobj2.cxx:1066
const SwDoc * GetDoc() const
Definition: unotext.cxx:133
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unotext.cxx:863
const css::uno::Sequence< sal_Int8 > & getSeq() const
css::uno::Type const & get()
T * get() const
bool is() const
int nCount
OUString m_sName
#define ERRCODE_NONE
SvMacroItemId
#define GLOS_DELIM
Definition: glosdoc.hxx:41
static std::unique_ptr< SwGlossaries > pGlossaries
Definition: initui.cxx:38
SwGlossaryList * GetGlossaryList()
Definition: initui.cxx:174
bool HasGlossaryList()
Definition: initui.cxx:169
SW_DLLPUBLIC SwGlossaries * GetGlossaries()
Definition: initui.cxx:162
sal_Int32 nIndex
OUString aName
sal_uInt16 nPos
::rtl::Reference< OContentHelper > xContent
void ensure()
Definition: swdll.cxx:67
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Any SAL_CALL getCaughtException()
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
char aEntryName[20]
Marks a position in the document model.
Definition: pam.hxx:37
OUString Name
#define SAL_MAX_INT32
unsigned char sal_Bool
sal_uInt16 sal_Unicode
static bool lcl_CopySelToDoc(SwDoc &rInsDoc, OTextCursorHelper *pxCursor, SwXTextRange *pxRange)
Definition: unoatxt.cxx:278
const struct SvEventDescription aAutotextEvents[]
Definition: unoatxt.cxx:915
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SwXAutoTextContainer_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unoatxt.cxx:1009
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
#define PROPERTY_MAP_AUTO_TEXT_GROUP
Definition: unomap.hxx:58
#define WID_GROUP_TITLE
Definition: unomap.hxx:298
#define WID_GROUP_PATH
Definition: unomap.hxx:297