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