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