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