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 const uno::Sequence< sal_Int8 > & SwXAutoTextGroup::getUnoTunnelId()
208 {
209  static const comphelper::UnoIdInit theSwXAutoTextGroupUnoTunnelId;
210  return theSwXAutoTextGroupUnoTunnelId.getSeq();
211 }
212 
213 sal_Int64 SAL_CALL SwXAutoTextGroup::getSomething( const uno::Sequence< sal_Int8 >& rId )
214 {
215  return comphelper::getSomethingImpl(rId, this);
216 }
217 
219  SwGlossaries* pGlos) :
220  pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_AUTO_TEXT_GROUP)),
221  pGlossaries(pGlos),
222  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 
233 uno::Sequence< OUString > SwXAutoTextGroup::getTitles()
234 {
235  SolarMutexGuard aGuard;
236  std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries ? 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 
249 void 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(pGlossaries ? 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 
278 static 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; }
304  bRet = pDoc->getIDocumentContentOperations().CopyRange(*pPam, aPos, SwCopyFlags::CheckPosInFly)
305  || bRet;
306  }
307 
310  rInsDoc.getIDocumentFieldsAccess().UpdateExpFields(nullptr, true);
311 
312  return bRet;
313 }
314 
315 uno::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 (pGlossaries)
326  pGlosGroup = pGlossaries->GetGroupDoc(m_sGroupName);
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 = 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 
409 void SwXAutoTextGroup::removeByName(const OUString& aEntryName)
410 {
411  SolarMutexGuard aGuard;
412  std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries ? 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 sName;
427 }
428 
429 void SwXAutoTextGroup::setName(const OUString& rName)
430 {
431  SolarMutexGuard aGuard;
432  if( !pGlossaries )
433  throw uno::RuntimeException();
434 
435  sal_Int32 nNewDelimPos = rName.lastIndexOf( GLOS_DELIM );
436  sal_Int32 nOldDelimPos = 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 = 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) ? sName.copy( 0, nOldDelimPos ) : sName );
450 
451  if ( 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 = pGlossaries;
462 
463  OUString sPreserveTitle( pGlossaries->GetGroupTitle( sName ) );
464  if ( !pGlossaries->RenameGroupDoc( sName, sNewGroup, sPreserveTitle ) )
465  throw uno::RuntimeException();
466  sName = rName;
467  m_sGroupName = sNewGroup;
468  pGlossaries = pTempGlossaries;
469 }
470 
472 {
473  SolarMutexGuard aGuard;
474  std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries ? 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 (!pGlossaries)
484  throw uno::RuntimeException();
485  std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries->GetGroupDoc(m_sGroupName));
486  if (!pGlosGroup || pGlosGroup->GetError())
487  throw uno::RuntimeException();
488  const sal_uInt16 nCount = pGlosGroup->GetCount();
489  if (nIndex < 0 || nIndex >= static_cast<sal_Int32>(nCount))
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(pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName) : nullptr);
504  if (!pGlosGroup || pGlosGroup->GetError())
505  throw uno::RuntimeException();
506  return pGlosGroup->GetCount() > 0;
507 
508 }
509 
510 uno::Any SwXAutoTextGroup::getByName(const OUString& _rName)
511 {
512  SolarMutexGuard aGuard;
513  uno::Reference< text::XAutoTextEntry > xEntry = pGlossaries->GetAutoTextEntry( m_sGroupName, 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 makeAny( xEntry );
517 }
518 
519 uno::Sequence< OUString > SwXAutoTextGroup::getElementNames()
520 {
521  SolarMutexGuard aGuard;
522  std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries ? 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 
535 sal_Bool SwXAutoTextGroup::hasByName(const OUString& rName)
536 {
537  SolarMutexGuard aGuard;
538  bool bRet = false;
539  std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries ? 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 
556 uno::Reference< beans::XPropertySetInfo > SwXAutoTextGroup::getPropertySetInfo()
557 {
558  static uno::Reference< beans::XPropertySetInfo > xRet = pPropSet->getPropertySetInfo();
559  return xRet;
560 }
561 
563  const OUString& rPropertyName, const uno::Any& aValue)
564 {
565  SolarMutexGuard aGuard;
566  const SfxItemPropertyMapEntry* pEntry = pPropSet->getPropertyMap().getByName( rPropertyName );
567 
568  if(!pEntry)
569  throw beans::UnknownPropertyException(rPropertyName);
570 
571  std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries ? 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 
591 uno::Any SwXAutoTextGroup::getPropertyValue(const OUString& rPropertyName)
592 {
593  SolarMutexGuard aGuard;
594  const SfxItemPropertyMapEntry* pEntry = pPropSet->getPropertyMap().getByName( rPropertyName);
595 
596  if(!pEntry)
597  throw beans::UnknownPropertyException(rPropertyName);
598  std::unique_ptr<SwTextBlocks> pGlosGroup(pGlossaries ? 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  pGlossaries = nullptr;
638  sName.clear();
639  m_sGroupName.clear();
640 }
641 
643 {
644  return "SwXAutoTextGroup";
645 }
646 
647 sal_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 
658 const uno::Sequence< sal_Int8 > & SwXAutoTextEntry::getUnoTunnelId()
659 {
660  static const comphelper::UnoIdInit theSwXAutoTextEntryUnoTunnelId;
661  return theSwXAutoTextEntryUnoTunnelId.getSeq();
662 }
663 
664 sal_Int64 SAL_CALL SwXAutoTextEntry::getSomething( const uno::Sequence< sal_Int8 >& rId )
665 {
666  return comphelper::getSomethingImpl(rId, this);
667 }
668 
669 SwXAutoTextEntry::SwXAutoTextEntry(SwGlossaries* pGlss, const OUString& rGroupName,
670  const OUString& rEntryName) :
671  WeakComponentImplHelper(m_aMutex),
672  pGlossaries(pGlss),
673  sGroupName(rGroupName),
674  sEntryName(rEntryName)
675 {
676 }
677 
679 {
680  SolarMutexGuard aGuard;
681 
682  // ensure that any pending modifications are written
683  implFlushDocument( true );
684 }
685 
686 void SwXAutoTextEntry::implFlushDocument( bool _bCloseDoc )
687 {
688  if ( !xDocSh.is() )
689  return;
690 
691  if ( xDocSh->GetDoc()->getIDocumentState().IsModified () )
692  xDocSh->Save();
693 
694  if ( _bCloseDoc )
695  {
696  // stop listening at the document
697  EndListening( *xDocSh );
698 
699  xDocSh->DoClose();
700  xDocSh.clear();
701  }
702 }
703 
704 void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint )
705 {
706  if ( &_rBC != xDocSh.get() )
707  return;
708 
709 // it's our document
710  if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&_rHint))
711  {
712  if (SfxEventHintId::PrepareCloseDoc == pEventHint->GetEventId())
713  {
715  mxBodyText.clear();
716  EndListening( *xDocSh );
717  xDocSh.clear();
718  }
719  }
720  else
721  {
722  if ( SfxHintId::Deinitializing == _rHint.GetId() )
723  {
724  // our document is dying (possibly because we're shutting down, and the document was notified
725  // earlier than we are?)
726  // stop listening at the docu
727  EndListening( *xDocSh );
728  // and release our reference
729  xDocSh.clear();
730  }
731  }
732 }
733 
735 {
736  SolarMutexGuard aGuard;
737 
739  OSL_ENSURE( xDocSh.is(), "SwXAutoTextEntry::GetBodyText: unexpected: no doc returned by EditGroupDoc!" );
740 
741  // start listening at the document
743 
744  mxBodyText = new SwXBodyText ( xDocSh->GetDoc() );
745 }
746 
748 {
749  SolarMutexGuard g;
750  implFlushDocument(true);
751 }
752 
753 uno::Reference< text::XTextCursor > SwXAutoTextEntry::createTextCursor()
754 {
755  SolarMutexGuard aGuard;
756  EnsureBodyText();
757  return mxBodyText->createTextCursor();
758 }
759 
760 uno::Reference< text::XTextCursor > SwXAutoTextEntry::createTextCursorByRange(
761  const uno::Reference< text::XTextRange > & aTextPosition)
762 {
763  SolarMutexGuard aGuard;
764  EnsureBodyText();
765  return mxBodyText->createTextCursorByRange ( aTextPosition );
766 }
767 
768 void SwXAutoTextEntry::insertString(const uno::Reference< text::XTextRange > & xRange, const OUString& aString, sal_Bool bAbsorb)
769 {
770  SolarMutexGuard aGuard;
771  EnsureBodyText();
772  mxBodyText->insertString ( xRange, aString, bAbsorb );
773 }
774 
775 void SwXAutoTextEntry::insertControlCharacter(const uno::Reference< text::XTextRange > & xRange,
776  sal_Int16 nControlCharacter, sal_Bool bAbsorb)
777 {
778  SolarMutexGuard aGuard;
779  EnsureBodyText();
780  mxBodyText->insertControlCharacter ( xRange, nControlCharacter, bAbsorb );
781 }
782 
784  const uno::Reference< text::XTextRange > & xRange,
785  const uno::Reference< text::XTextContent > & xContent, sal_Bool bAbsorb)
786 {
787  SolarMutexGuard aGuard;
788  EnsureBodyText();
789  mxBodyText->insertTextContent ( xRange, xContent, bAbsorb );
790 }
791 
793  const uno::Reference< text::XTextContent > & xContent)
794 {
795  SolarMutexGuard aGuard;
796  EnsureBodyText();
797  mxBodyText->removeTextContent ( xContent );
798 }
799 
800 uno::Reference< text::XText > SwXAutoTextEntry::getText()
801 {
802  SolarMutexGuard aGuard;
803  uno::Reference< text::XText > xRet = static_cast<text::XText*>(this);
804  return xRet;
805 }
806 
807 uno::Reference< text::XTextRange > SwXAutoTextEntry::getStart()
808 {
809  SolarMutexGuard aGuard;
810  EnsureBodyText();
811  return mxBodyText->getStart();
812 }
813 
814 uno::Reference< text::XTextRange > SwXAutoTextEntry::getEnd()
815 {
816  SolarMutexGuard aGuard;
817  EnsureBodyText();
818  return mxBodyText->getEnd();
819 }
820 
822 {
823  SolarMutexGuard aGuard;
824  EnsureBodyText();
825  return mxBodyText->getString();
826 }
827 
828 void SwXAutoTextEntry::setString(const OUString& aString)
829 {
830  SolarMutexGuard aGuard;
831  EnsureBodyText();
832  mxBodyText->setString( aString );
833 }
834 
835 void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextRange)
836 {
837  SolarMutexGuard aGuard;
838 
839  // ensure that any pending modifications are written
840  // reason is that we're holding the _copy_ of the auto text, while the real auto text
841  // is stored somewhere. And below, we're not working with our copy, but only tell the target
842  // TextRange to work with the stored version.
843  // #96380# - 2003-03-03 - fs@openoffice.org
845  // TODO: think about if we should pass "true" here
846  // The difference would be that when the next modification is made to this instance here, then
847  // we would be forced to open the document again, instead of working on our current copy.
848  // This means that we would reflect any changes which were done to the AutoText by foreign instances
849  // in the meantime
850 
851  // The reference to the tunnel is needed during the whole call, likely because it could be a
852  // different object, not xTextRange itself, and the reference guards it from preliminary death
853  uno::Reference<lang::XUnoTunnel> xTunnel( xTextRange, uno::UNO_QUERY);
854  SwXTextRange* pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xTunnel);
855  OTextCursorHelper* pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xTunnel);
856  SwXText *pText = comphelper::getFromUnoTunnel<SwXText>(xTunnel);
857 
858  SwDoc* pDoc = nullptr;
859  if (pRange)
860  pDoc = &pRange->GetDoc();
861  else if ( pCursor )
862  pDoc = pCursor->GetDoc();
863  else if ( pText && pText->GetDoc() )
864  {
865  xTunnel.set(pText->getStart(), uno::UNO_QUERY);
866  pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xTunnel);
867  if (pCursor)
868  pDoc = pText->GetDoc();
869  }
870 
871  if(!pDoc)
872  throw uno::RuntimeException();
873 
874  SwPaM InsertPaM(pDoc->GetNodes());
875  if (pRange)
876  {
877  if (!pRange->GetPositions(InsertPaM))
878  {
879  throw uno::RuntimeException();
880  }
881  }
882  else
883  {
884  InsertPaM = *pCursor->GetPaM();
885  }
886 
887  std::unique_ptr<SwTextBlocks> pBlock(pGlossaries->GetGroupDoc(sGroupName));
888  const bool bResult = pBlock && !pBlock->GetError()
889  && pDoc->InsertGlossary( *pBlock, sEntryName, InsertPaM);
890 
891  if(!bResult)
892  throw uno::RuntimeException();
893 }
894 
896 {
897  return "SwXAutoTextEntry";
898 }
899 
900 sal_Bool SwXAutoTextEntry::supportsService(const OUString& rServiceName)
901 {
902  return cppu::supportsService(this, rServiceName);
903 }
904 
906 {
907  uno::Sequence<OUString> aRet { "com.sun.star.text.AutoTextEntry" };
908  return aRet;
909 }
910 
911 uno::Reference< container::XNameReplace > SwXAutoTextEntry::getEvents()
912 {
913  return new SwAutoTextEventDescriptor( *this );
914 }
915 
917 {
918  { SvMacroItemId::SwStartInsGlossary, "OnInsertStart" },
919  { SvMacroItemId::SwEndInsGlossary, "OnInsertDone" },
920  { SvMacroItemId::NONE, nullptr }
921 };
922 
924  SwXAutoTextEntry& rAutoText ) :
925  SvBaseEventDescriptor(aAutotextEvents),
926  rAutoTextEntry(rAutoText)
927 {
928 }
929 
931 {
932 }
933 
935 {
936  return "SwAutoTextEventDescriptor";
937 }
938 
940  const SvMacroItemId nEvent,
941  const SvxMacro& rMacro)
942 {
943  OSL_ENSURE( nullptr != rAutoTextEntry.GetGlossaries(),
944  "Strangely enough, the AutoText vanished!" );
945  OSL_ENSURE( (nEvent == SvMacroItemId::SwEndInsGlossary) ||
946  (nEvent == SvMacroItemId::SwStartInsGlossary) ,
947  "Unknown event ID" );
948 
949  SwGlossaries *const pGlossaries =
950  const_cast<SwGlossaries*>(rAutoTextEntry.GetGlossaries());
951  std::unique_ptr<SwTextBlocks> pBlocks(
952  pGlossaries->GetGroupDoc( rAutoTextEntry.GetGroupName() ));
953  OSL_ENSURE( pBlocks,
954  "can't get autotext group; SwAutoTextEntry has illegal name?");
955 
956  if( !pBlocks || pBlocks->GetError())
957  return;
958 
959  sal_uInt16 nIndex = pBlocks->GetIndex( rAutoTextEntry.GetEntryName() );
960  if( nIndex != USHRT_MAX )
961  {
962  SvxMacroTableDtor aMacroTable;
963  if( pBlocks->GetMacroTable( nIndex, aMacroTable ) )
964  {
965  aMacroTable.Insert( nEvent, rMacro );
966  pBlocks->SetMacroTable( nIndex, aMacroTable );
967  }
968  }
969  // else: ignore
970 }
971 
973  SvxMacro& rMacro,
974  const SvMacroItemId nEvent )
975 {
976  OSL_ENSURE( nullptr != rAutoTextEntry.GetGlossaries(), "no AutoText" );
977  OSL_ENSURE( (nEvent == SvMacroItemId::SwEndInsGlossary) ||
978  (nEvent == SvMacroItemId::SwStartInsGlossary) ,
979  "Unknown event ID" );
980 
981  SwGlossaries *const pGlossaries =
982  const_cast<SwGlossaries*>(rAutoTextEntry.GetGlossaries());
983  std::unique_ptr<SwTextBlocks> pBlocks(
984  pGlossaries->GetGroupDoc( rAutoTextEntry.GetGroupName() ));
985  OSL_ENSURE( pBlocks,
986  "can't get autotext group; SwAutoTextEntry has illegal name?");
987 
988  // return empty macro, unless macro is found
989  OUString sEmptyStr;
990  SvxMacro aEmptyMacro(sEmptyStr, sEmptyStr);
991  rMacro = aEmptyMacro;
992 
993  if ( !pBlocks || pBlocks->GetError())
994  return;
995 
996  sal_uInt16 nIndex = pBlocks->GetIndex( rAutoTextEntry.GetEntryName() );
997  if( nIndex != USHRT_MAX )
998  {
999  SvxMacroTableDtor aMacroTable;
1000  if( pBlocks->GetMacroTable( nIndex, aMacroTable ) )
1001  {
1002  SvxMacro *pMacro = aMacroTable.Get( nEvent );
1003  if( pMacro )
1004  rMacro = *pMacro;
1005  }
1006  }
1007 }
1008 
1009 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1010 SwXAutoTextContainer_get_implementation(css::uno::XComponentContext*,
1011  css::uno::Sequence<css::uno::Any> const &)
1012 {
1013  //the module may not be loaded
1014  SolarMutexGuard aGuard;
1016  return cppu::acquire(new SwXAutoTextContainer());
1017 }
1018 
1019 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool is() const
virtual void SAL_CALL setName(const OUString &Name_) override
Definition: unoatxt.cxx:429
SvxMacro & Insert(SvMacroItemId nEvent, const SvxMacro &rMacro)
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoatxt.cxx:658
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:556
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unoatxt.cxx:615
bool HasGlossaryList()
Definition: initui.cxx:169
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: unoatxt.cxx:704
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unoatxt.cxx:494
OUString m_sGroupName
Definition: unoatxt.hxx:101
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:800
Definition: doc.hxx:188
SwDocShellRef EditGroupDoc(const OUString &rGrpName, const OUString &rShortName, bool bShow=true)
Definition: glshell.cxx:196
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SwXAutoTextContainer_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unoatxt.cxx:1010
OUString sGroupName
Definition: unoatxt.hxx:166
SvMacroItemId
const OUString & GetEntryName() const
Definition: unoatxt.hxx:236
size_t GetGroupCnt()
Definition: glosdoc.cxx:98
std::unique_ptr< SwTextBlocks > GetGroupDoc(const OUString &rName, bool bCreate=false)
Definition: glosdoc.cxx:158
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unoatxt.cxx:480
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoatxt.cxx:905
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unoatxt.cxx:519
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
SfxHintId GetId() const
OUString GetCompleteGroupName(const OUString &GroupName)
Definition: glosdoc.cxx:476
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unoatxt.cxx:87
void EnsureBodyText()
Definition: unoatxt.hxx:172
virtual void LockExpFields()=0
void SAL_CALL disposing() override
Definition: unoatxt.cxx:747
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:821
sal_uInt16 sal_Unicode
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:767
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: unoatxt.cxx:768
Any SAL_CALL getCaughtException()
virtual css::uno::Sequence< OUString > SAL_CALL getTitles() override
Definition: unoatxt.cxx:233
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:591
bool GetPositions(SwPaM &rToFill,::sw::TextRangeMode eMode=::sw::TextRangeMode::RequireTextNode) const
Definition: unoobj2.cxx:1066
int nCount
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: unoatxt.cxx:911
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::mutex m_aMutex
virtual bool IsExpFieldsLocked() const =0
virtual void SAL_CALL applyTo(const css::uno::Reference< css::text::XTextRange > &xRange) override
Definition: unoatxt.cxx:835
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: unoatxt.cxx:753
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unoatxt.cxx:664
SW_DLLPUBLIC SwGlossaries * GetGlossaries()
Definition: initui.cxx:162
SwXAutoTextGroup(const OUString &rName, SwGlossaries *pGloss)
Definition: unoatxt.cxx:218
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unoatxt.cxx:114
OUString sName
Definition: unoatxt.hxx:100
bool DelGroupDoc(const OUString &)
Definition: glosdoc.cxx:247
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:409
virtual OUString SAL_CALL getImplementationName() override
Definition: unoatxt.cxx:642
const css::uno::Sequence< sal_Int8 > & getSeq() const
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:792
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
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:807
SwXAutoTextEntry(SwGlossaries *, const OUString &rGroupName, const OUString &rEntryName)
Definition: unoatxt.cxx:669
#define SAL_MAX_INT32
int i
virtual bool IsModified() const =0
Changes of document?
virtual sal_Bool SAL_CALL hasElements() override
Definition: unoatxt.cxx:500
virtual sal_Int32 SAL_CALL getCount() override
Definition: unoatxt.cxx:471
void ensure()
Definition: swdll.cxx:67
virtual OUString SAL_CALL getImplementationName() override
Definition: unoatxt.cxx:934
static std::unique_ptr< SwGlossaries > pGlossaries
Definition: initui.cxx:38
SwContentNode * GetContentNode()
Definition: node.hxx:616
const OUString & GetGroupName() const
Definition: unoatxt.hxx:235
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
SwDocShellRef xDocSh
Definition: unoatxt.hxx:168
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:630
unsigned char sal_Bool
const SfxItemPropertyMap & getPropertyMap() const
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoatxt.cxx:900
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoatxt.cxx:647
Marks a node in the document model.
Definition: ndindex.hxx:31
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoatxt.cxx:652
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:686
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:521
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unoatxt.cxx:620
virtual void replaceByName(const SvMacroItemId nEvent, const SvxMacro &rMacro) override
event (will be copied)
Definition: unoatxt.cxx:939
virtual ~SwXAutoTextContainer() override
Definition: unoatxt.cxx:66
const struct SvEventDescription aAutotextEvents[]
Definition: unoatxt.cxx:916
#define WID_GROUP_PATH
Definition: unomap.hxx:296
virtual ~SwXAutoTextGroup() override
Definition: unoatxt.cxx:229
virtual OUString SAL_CALL getName() override
Definition: unoatxt.cxx:423
const SfxItemPropertySet * pPropSet
Definition: unoatxt.hxx:98
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unoatxt.cxx:814
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unoatxt.cxx:535
virtual const SwPaM * GetPaM() const =0
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoatxt.cxx:625
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:571
Implement the XNameAccess for the AutoText events.
Definition: unoatxt.hxx:240
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:828
const SvxMacro * Get(SvMacroItemId nEvent) const
OUString const & GetGroupName(size_t)
Definition: glosdoc.cxx:136
#define PROPERTY_MAP_AUTO_TEXT_GROUP
Definition: unomap.hxx:58
virtual ~SwXAutoTextEntry() override
Definition: unoatxt.cxx:678
OUString GetGroupTitle(const OUString &rGroupName)
Definition: glosdoc.cxx:143
#define ERRCODE_NONE
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
bool RenameGroupDoc(const OUString &sOldGroup, OUString &sNewGroup, const OUString &rNewTitle)
Definition: glosdoc.cxx:195
void ClearGroups()
Definition: gloslst.cxx:436
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unoatxt.cxx:562
SwNodes & GetNodes()
Definition: doc.hxx:409
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unoatxt.cxx:510
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
rtl::Reference< SwXBodyText > mxBodyText
Definition: unoatxt.hxx:170
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:972
SwGlossaries * pGlossaries
Definition: unoatxt.hxx:99
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 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:783
virtual void SAL_CALL renameByName(const OUString &aElementName, const OUString &aNewElementName, const OUString &aNewElementTitle) override
Definition: unoatxt.cxx:249
virtual OUString SAL_CALL getImplementationName() override
Definition: unoatxt.cxx:192
void Invalidate()
Definition: unoatxt.cxx:635
virtual ~SwAutoTextEventDescriptor() override
Definition: unoatxt.cxx:930
virtual void UnlockExpFields()=0
SwXAutoTextEntry & rAutoTextEntry
Definition: unoatxt.hxx:242
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unoatxt.cxx:213
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: unoatxt.cxx:775
SwAutoTextEventDescriptor(SwXAutoTextEntry &rAutoText)
Definition: unoatxt.cxx:923
SwGlossaries * pGlossaries
Definition: unoatxt.hxx:57
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoatxt.cxx:207
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &aTextPosition) override
Definition: unoatxt.cxx:760
void GetBodyText()
Definition: unoatxt.cxx:734
virtual OUString SAL_CALL getString() override
Definition: unoobj2.cxx:1044
SwGlossaries * pGlossaries
Definition: unoatxt.hxx:165
const SwGlossaries * GetGlossaries() const
Definition: unoatxt.hxx:234
bool NewGroupDoc(OUString &rGroupName, const OUString &rTitle)
Definition: glosdoc.cxx:175
virtual bool Save() override
global IO.
Definition: docsh.cxx:267
no RedlineFlags
sal_uInt16 nPos
virtual OUString SAL_CALL getImplementationName() override
Definition: unoatxt.cxx:895
static bool lcl_CopySelToDoc(SwDoc &rInsDoc, OTextCursorHelper *pxCursor, SwXTextRange *pxRange)
Definition: unoatxt.cxx:278
OUString sEntryName
Definition: unoatxt.hxx:167
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)
SwGlossaryList * GetGlossaryList()
Definition: initui.cxx:174