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