LibreOffice Module sw (master) 1
unofield.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#include <algorithm>
22#include <memory>
23
24#include <unofield.hxx>
25#include <unofieldcoll.hxx>
26#include <unobookmark.hxx>
27#include <swtypes.hxx>
28#include <cmdid.h>
29#include <doc.hxx>
34#include <IDocumentState.hxx>
35#include <fmtfld.hxx>
36#include <txtfld.hxx>
37#include <ndtxt.hxx>
38#include <unomap.hxx>
39#include <unoprnms.hxx>
40#include <unotextrange.hxx>
41#include <unotextcursor.hxx>
42#include <unocoll.hxx>
43#include <sfx2/linkmgr.hxx>
44#include <editsh.hxx>
45#include <viewsh.hxx>
48#include <comphelper/string.hxx>
50#include <com/sun/star/util/DateTime.hpp>
51#include <com/sun/star/util/Date.hpp>
52#include <com/sun/star/beans/PropertyAttribute.hpp>
53
54//undef to prevent error (from sfx2/docfile.cxx)
55#undef SEQUENCE
56#include <com/sun/star/text/SetVariableType.hpp>
57#include <com/sun/star/text/WrapTextMode.hpp>
58#include <com/sun/star/text/TextContentAnchorType.hpp>
59#include <authfld.hxx>
60#include <flddat.hxx>
61#include <dbfld.hxx>
62#include <usrfld.hxx>
63#include <docufld.hxx>
64#include <expfld.hxx>
65#include <chpfld.hxx>
66#include <flddropdown.hxx>
67#include <poolfmt.hxx>
68#include <strings.hrc>
69#include <pagedesc.hxx>
70#include <docary.hxx>
71#include <reffld.hxx>
72#include <ddefld.hxx>
73#include <SwStyleNameMapper.hxx>
74#include <swunohelper.hxx>
75#include <unofldmid.h>
76#include <scriptinfo.hxx>
77#include <tools/datetime.hxx>
78#include <tools/urlobj.hxx>
79#include <svl/itemprop.hxx>
80#include <svl/listener.hxx>
82#include <o3tl/any.hxx>
83#include <o3tl/safeint.hxx>
84#include <mutex>
85#include <vcl/svapp.hxx>
86#include <textapi.hxx>
87#include <fmtmeta.hxx>
88#include <vector>
89
90using namespace ::com::sun::star;
91using namespace nsSwDocInfoSubType;
92
93// case-corrected version of the first part for the service names (see #i67811)
94constexpr OUStringLiteral COM_TEXT_FLDMASTER_CC = u"com.sun.star.text.fieldmaster.";
95
96// note: this thing is indexed as an array, so do not insert/remove entries!
97const sal_uInt16 aDocInfoSubTypeFromService[] =
98{
99 DI_CHANGE | DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_AUTHOR
100 DI_CHANGE | DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME
101 DI_EDIT | DI_SUB_TIME, //PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME
102 DI_COMMENT, //PROPERTY_MAP_FLDTYP_DOCINFO_DESCRIPTION
103 DI_CREATE | DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_AUTHOR
104 DI_CREATE | DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME
105 0, //DUMMY
106 0, //DUMMY
107 0, //DUMMY
108 0, //DUMMY
109 DI_CUSTOM, //PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM
110 DI_PRINT | DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_PRINT_AUTHOR
111 DI_PRINT | DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_PRINT_DATE_TIME
112 DI_KEYS, //PROPERTY_MAP_FLDTYP_DOCINFO_KEY_WORDS
113 DI_SUBJECT, //PROPERTY_MAP_FLDTYP_DOCINFO_SUBJECT
114 DI_TITLE, //PROPERTY_MAP_FLDTYP_DOCINFO_TITLE
115 DI_DOCNO //PROPERTY_MAP_FLDTYP_DOCINFO_REVISION
116};
117
118namespace {
119
120struct ServiceIdResId
121{
122 SwFieldIds nResId;
123 SwServiceType nServiceId;
124};
125
126}
127
128const ServiceIdResId aServiceToRes[] =
129{
182};
183
185{
186 for (size_t i=0; i<SAL_N_ELEMENTS(aServiceToRes); ++i)
187 if (aServiceToRes[i].nServiceId == nServiceId)
188 return aServiceToRes[i].nResId;
189#if OSL_DEBUG_LEVEL > 0
190 OSL_FAIL("service id not found");
191#endif
192 return SwFieldIds::Unknown;
193}
194
196{
197 const SwFieldIds nWhich = rField.Which();
199 //special handling for some fields
200 switch( nWhich )
201 {
203 if( INP_USR == (rField.GetSubType() & 0x00ff) )
205 break;
206
208 {
209 const sal_uInt16 nSubType = rField.GetSubType();
210 switch( nSubType & 0xff )
211 {
212 case DI_CHANGE:
213 nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
216 break;
217 case DI_CREATE:
218 nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
221 break;
222 case DI_PRINT:
223 nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
226 break;
234 }
235 }
236 break;
237
239 nSrvId = SwFieldTypesEnum::ConditionalText == static_cast<SwFieldTypesEnum>(rField.GetSubType())
242 break;
243
245 {
246 switch( rField.GetSubType() )
247 {
248 case DS_PAGE: nSrvId = SwServiceType::FieldTypePageCount; break;
250 case DS_WORD: nSrvId = SwServiceType::FieldTypeWordCount ; break;
252 case DS_TBL: nSrvId = SwServiceType::FieldTypeTableCount ; break;
255 }
256 }
257 break;
258 default: break;
259 }
260 if( SwServiceType::Invalid == nSrvId )
261 {
262 for( const ServiceIdResId* pMap = aServiceToRes;
263 SwFieldIds::Unknown != pMap->nResId; ++pMap )
264 if( nWhich == pMap->nResId )
265 {
266 nSrvId = pMap->nServiceId;
267 break;
268 }
269 }
270#if OSL_DEBUG_LEVEL > 0
271 if( SwServiceType::Invalid == nSrvId )
272 OSL_FAIL("resid not found");
273#endif
274 return nSrvId;
275}
276
277static sal_uInt16 lcl_GetPropMapIdForFieldType( SwFieldIds nWhich )
278{
279 sal_uInt16 nId;
280 switch( nWhich )
281 {
289 }
290 return nId;
291}
292
293static sal_Int32 lcl_PropName2TokenPos(std::u16string_view rPropertyName)
294{
295 if (rPropertyName == u"" UNO_NAME_DDE_COMMAND_TYPE)
296 return 0;
297
298 if (rPropertyName == u"" UNO_NAME_DDE_COMMAND_FILE)
299 return 1;
300
301 if (rPropertyName == u"" UNO_NAME_DDE_COMMAND_ELEMENT)
302 return 2;
303
304 if (rPropertyName == u"" UNO_NAME_IS_AUTOMATIC_UPDATE)
305 return 3;
306
307 return SAL_MAX_INT32;
308}
309
310static sal_uInt16 GetFieldTypeMId( std::u16string_view rProperty, const SwFieldType& rTyp )
311{
312 sal_uInt16 nId = lcl_GetPropMapIdForFieldType( rTyp.Which() );
314 if( !pSet )
315 nId = USHRT_MAX;
316 else
317 {
318 const SfxItemPropertyMapEntry* pEntry = pSet->getPropertyMap().getByName(rProperty);
319 nId = pEntry ? pEntry->nWID : USHRT_MAX;
320 }
321 return nId;
322}
323
324static sal_uInt16 lcl_GetPropertyMapOfService( SwServiceType nServiceId )
325{
326 sal_uInt16 nRet;
327 switch ( nServiceId)
328 {
386 nRet = PROPERTY_MAP_FLDTYP_DUMMY_0; break;
397 default:
398 nRet = USHRT_MAX;
399 }
400 assert(nRet != USHRT_MAX && "wrong service id");
401 return nRet;
402}
403
405 : public SvtListener
406{
407public:
408 std::mutex m_Mutex; // just for OInterfaceContainerHelper4
409
412
415
417
418 OUString m_sParam1; // Content / Database / NumberingSeparator
419 OUString m_sParam2; // - /DataTablename
420 OUString m_sParam3; // - /DataFieldName
421 OUString m_sParam5; // - /DataBaseURL
422 double m_fParam1; // Value / -
423 sal_Int8 m_nParam1; // ChapterNumberingLevel
424 bool m_bParam1; // IsExpression
425 sal_Int32 m_nParam2;
426
427 Impl(SwPageDesc* const pPageDesc, SwDoc* pDoc, SwFieldIds nResId)
428 : m_pDoc(pDoc)
429 , m_pType(nullptr)
430 , m_nResTypeId(nResId)
431 , m_fParam1(0.0)
432 , m_nParam1(-1)
433 , m_bParam1(false)
434 , m_nParam2(0)
435 {
436 StartListening(pPageDesc->GetNotifier());
437 }
438
439 Impl(SwFieldType* const pType, SwDoc* pDoc, SwFieldIds nResId)
440 : m_pDoc(pDoc)
441 , m_pType(pType)
442 , m_nResTypeId(nResId)
443 , m_fParam1(0.0)
444 , m_nParam1(-1)
445 , m_bParam1(false)
446 , m_nParam2(0)
447 {
449 }
451 {
453 m_pType = pType;
455 }
456protected:
457 virtual void Notify(const SfxHint& rHint) override;
458};
459
460const uno::Sequence< sal_Int8 > & SwXFieldMaster::getUnoTunnelId()
461{
462 static const comphelper::UnoIdInit theSwXFieldMasterUnoTunnelId;
463 return theSwXFieldMasterUnoTunnelId.getSeq();
464}
465
466sal_Int64 SAL_CALL
467SwXFieldMaster::getSomething(const uno::Sequence< sal_Int8 >& rId)
468{
469 return comphelper::getSomethingImpl<SwXFieldMaster>(rId, this);
470}
471
472OUString SAL_CALL
474{
475 return "SwXFieldMaster";
476}
477
478namespace
479{
480
481OUString getServiceName(const SwFieldIds aId)
482{
483 const char* pEntry;
484 switch (aId)
485 {
486 case SwFieldIds::User:
487 pEntry = "User";
488 break;
490 pEntry = "Database";
491 break;
493 pEntry = "SetExpression";
494 break;
495 case SwFieldIds::Dde:
496 pEntry = "DDE";
497 break;
499 pEntry = "Bibliography";
500 break;
501 default:
502 return OUString();
503 }
504
505 return "com.sun.star.text.fieldmaster." + OUString::createFromAscii(pEntry);
506}
507
508}
509
510sal_Bool SAL_CALL SwXFieldMaster::supportsService(const OUString& rServiceName)
511{
512 return cppu::supportsService(this, rServiceName);
513}
514
515uno::Sequence< OUString > SAL_CALL
517{
518 return { "com.sun.star.text.TextFieldMaster", getServiceName(m_pImpl->m_nResTypeId) };
519}
520
522 : m_pImpl(new Impl(pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD), pDoc, nResId))
523{
524}
525
527 : m_pImpl(new Impl(&rType, pDoc, rType.Which()))
528{
529}
530
532{
533}
534
537 SwFieldIds nResId)
538{
539 // re-use existing SwXFieldMaster
541 if (pType)
542 {
543 xFM = dynamic_cast<SwXFieldMaster*>(pType->GetXObject().get().get());
544 }
545 if (!xFM.is())
546 {
547 SwXFieldMaster *const pFM( pType
548 ? new SwXFieldMaster(*pType, pDoc)
549 : new SwXFieldMaster(pDoc, nResId));
550 xFM.set(pFM);
551 if (pType)
552 {
553 pType->SetXObject(xFM);
554 }
555 // need a permanent Reference to initialize m_wThis
556 pFM->m_pImpl->m_wThis = xFM.get();
557 }
558 return xFM;
559}
560
561uno::Reference<beans::XPropertySetInfo> SAL_CALL
563{
564 SolarMutexGuard aGuard;
565 uno::Reference< beans::XPropertySetInfo > aRef =
568 return aRef;
569}
570
572 const OUString& rPropertyName, const uno::Any& rValue)
573{
574 SolarMutexGuard aGuard;
575 SwFieldType* pType = GetFieldType(true);
576 if(pType)
577 {
578 bool bSetValue = true;
579 if( rPropertyName == UNO_NAME_SUB_TYPE )
580 {
581 const std::vector<OUString>& rExtraArr(
583 const OUString sTypeName = pType->GetName();
584 static sal_uInt16 nIds[] =
585 {
591 0
592 };
593 for(const sal_uInt16 * pIds = nIds; *pIds; ++pIds)
594 {
595 if(sTypeName == rExtraArr[ *pIds ] )
596 {
597 bSetValue = false;
598 break;
599 }
600 }
601 }
602 if ( bSetValue )
603 {
604 // nothing special to be done here for the properties
605 // UNO_NAME_DATA_BASE_NAME and UNO_NAME_DATA_BASE_URL.
606 // We just call PutValue (empty string is allowed).
607 // Thus the last property set will be used as Data Source.
608
609 const sal_uInt16 nMemberValueId = GetFieldTypeMId( rPropertyName, *pType );
610 if ( USHRT_MAX == nMemberValueId )
611 {
612 throw beans::UnknownPropertyException(
613 "Unknown property: " + rPropertyName,
614 static_cast< cppu::OWeakObject * >( this ) );
615 }
616
617 pType->PutValue( rValue, nMemberValueId );
618 if ( pType->Which() == SwFieldIds::User )
619 {
620 // trigger update of User field in order to get depending Input Fields updated.
621 pType->UpdateFields();
622 }
623
624 }
625 }
626 else if (m_pImpl->m_pDoc && rPropertyName == UNO_NAME_NAME)
627 {
628 OUString sTypeName;
629 rValue >>= sTypeName;
630 SwFieldType * pType2 = m_pImpl->m_pDoc->getIDocumentFieldsAccess().GetFieldType(
631 m_pImpl->m_nResTypeId, sTypeName, false);
632
633 if(pType2 ||
634 (SwFieldIds::SetExp == m_pImpl->m_nResTypeId &&
635 ( sTypeName == SwResId(STR_POOLCOLL_LABEL_TABLE) ||
636 sTypeName == SwResId(STR_POOLCOLL_LABEL_DRAWING) ||
637 sTypeName == SwResId(STR_POOLCOLL_LABEL_FRAME) ||
638 sTypeName == SwResId(STR_POOLCOLL_LABEL_ABB) ||
639 sTypeName == SwResId(STR_POOLCOLL_LABEL_FIGURE) )))
640 {
641 throw lang::IllegalArgumentException();
642 }
643
644 switch (m_pImpl->m_nResTypeId)
645 {
646 case SwFieldIds::User :
647 {
648 SwUserFieldType aType(m_pImpl->m_pDoc, sTypeName);
649 pType2 = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType);
650 static_cast<SwUserFieldType*>(pType2)->SetContent(m_pImpl->m_sParam1);
651 static_cast<SwUserFieldType*>(pType2)->SetValue(m_pImpl->m_fParam1);
652 static_cast<SwUserFieldType*>(pType2)->SetType(m_pImpl->m_bParam1
654 }
655 break;
656 case SwFieldIds::Dde :
657 {
658 SwDDEFieldType aType(sTypeName, m_pImpl->m_sParam1,
659 m_pImpl->m_bParam1 ? SfxLinkUpdateMode::ALWAYS : SfxLinkUpdateMode::ONCALL);
660 pType2 = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType);
661 }
662 break;
663 case SwFieldIds::SetExp :
664 {
665 SwSetExpFieldType aType(m_pImpl->m_pDoc, sTypeName);
666 if (!m_pImpl->m_sParam1.isEmpty())
667 aType.SetDelimiter(OUString(m_pImpl->m_sParam1[0]));
668 if (m_pImpl->m_nParam1 > -1 && m_pImpl->m_nParam1 < MAXLEVEL)
669 aType.SetOutlineLvl(m_pImpl->m_nParam1);
670 pType2 = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType);
671 }
672 break;
674 {
675 rValue >>= m_pImpl->m_sParam3;
676 pType2 = GetFieldType();
677 }
678 break;
679 default: break;
680 }
681 if (!pType2)
682 {
683 throw uno::RuntimeException("no field type found!", *this);
684 }
685 m_pImpl->SetFieldType(pType2);
686 }
687 else
688 {
689 switch (m_pImpl->m_nResTypeId)
690 {
691 case SwFieldIds::User:
692 if(rPropertyName == UNO_NAME_CONTENT)
693 rValue >>= m_pImpl->m_sParam1;
694 else if(rPropertyName == UNO_NAME_VALUE)
695 {
696 if(rValue.getValueType() != ::cppu::UnoType<double>::get())
697 throw lang::IllegalArgumentException();
698 rValue >>= m_pImpl->m_fParam1;
699 }
700 else if(rPropertyName == UNO_NAME_IS_EXPRESSION)
701 {
702 if(rValue.getValueType() != cppu::UnoType<bool>::get())
703 throw lang::IllegalArgumentException();
704 rValue >>= m_pImpl->m_bParam1;
705 }
706
707 break;
709 if(rPropertyName == UNO_NAME_DATA_BASE_NAME)
710 rValue >>= m_pImpl->m_sParam1;
711 else if(rPropertyName == UNO_NAME_DATA_TABLE_NAME)
712 rValue >>= m_pImpl->m_sParam2;
713 else if(rPropertyName == UNO_NAME_DATA_COLUMN_NAME)
714 rValue >>= m_pImpl->m_sParam3;
715 else if(rPropertyName == UNO_NAME_DATA_COMMAND_TYPE)
716 rValue >>= m_pImpl->m_nParam2;
717 if(rPropertyName == UNO_NAME_DATA_BASE_URL)
718 rValue >>= m_pImpl->m_sParam5;
719
720 if ( ( !m_pImpl->m_sParam1.isEmpty()
721 || !m_pImpl->m_sParam5.isEmpty())
722 && !m_pImpl->m_sParam2.isEmpty()
723 && !m_pImpl->m_sParam3.isEmpty())
724 {
725 GetFieldType();
726 }
727 break;
729 if(rPropertyName == UNO_NAME_NUMBERING_SEPARATOR)
730 rValue >>= m_pImpl->m_sParam1;
731 else if(rPropertyName == UNO_NAME_CHAPTER_NUMBERING_LEVEL)
732 rValue >>= m_pImpl->m_nParam1;
733 break;
734 case SwFieldIds::Dde:
735 {
736 sal_Int32 nPart = lcl_PropName2TokenPos(rPropertyName);
737 if(nPart < 3 )
738 {
739 if (m_pImpl->m_sParam1.isEmpty())
740 {
741 m_pImpl->m_sParam1
742 = OUStringChar(sfx2::cTokenSeparator)
743 + OUStringChar(sfx2::cTokenSeparator);
744 }
745 OUString sTmp;
746 rValue >>= sTmp;
747 sal_Int32 nIndex(0);
748 sal_Int32 nStart(0);
749 while (nIndex < m_pImpl->m_sParam1.getLength())
750 {
751 if (m_pImpl->m_sParam1[nIndex] == sfx2::cTokenSeparator)
752 {
753 if (0 == nPart)
754 break;
755 nStart = nIndex + 1;
756 --nPart;
757 }
758 ++nIndex;
759 }
760 assert(0 == nPart);
761 m_pImpl->m_sParam1 = m_pImpl->m_sParam1.replaceAt(
762 nStart, nIndex - nStart, sTmp);
763 }
764 else if(3 == nPart)
765 {
766 rValue >>= m_pImpl->m_bParam1;
767 }
768 }
769 break;
770 default:
771 throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
772 }
773 }
774}
775
776SwFieldType* SwXFieldMaster::GetFieldType(bool const bDontCreate) const
777{
778 if (!bDontCreate && SwFieldIds::Database == m_pImpl->m_nResTypeId
779 && !m_pImpl->m_pType && m_pImpl->m_pDoc)
780 {
782
783 // set DataSource
785 if (!m_pImpl->m_sParam1.isEmpty())
786 aAcc[svx::DataAccessDescriptorProperty::DataSource] <<= m_pImpl->m_sParam1; // DataBaseName
787 else if (!m_pImpl->m_sParam5.isEmpty())
788 aAcc[svx::DataAccessDescriptorProperty::DatabaseLocation] <<= m_pImpl->m_sParam5; // DataBaseURL
789 aData.sDataSource = aAcc.getDataSource();
790
791 aData.sCommand = m_pImpl->m_sParam2;
792 aData.nCommandType = m_pImpl->m_nParam2;
793
794 SwDBFieldType aType(m_pImpl->m_pDoc, m_pImpl->m_sParam3, std::move(aData));
795 SwFieldType *const pType = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType);
796 m_pImpl->SetFieldType(pType);
797 }
798 return m_pImpl->m_pType;
799}
800
801uno::Any SAL_CALL
802SwXFieldMaster::getPropertyValue(const OUString& rPropertyName)
803{
804 SolarMutexGuard aGuard;
805 uno::Any aRet;
806 SwFieldType* pType = GetFieldType(true);
807 if( rPropertyName == UNO_NAME_INSTANCE_NAME )
808 {
809 OUString sName;
810 if(pType)
812 aRet <<= sName;
813 }
814 else if(pType)
815 {
816 if(rPropertyName == UNO_NAME_NAME)
817 {
818 aRet <<= SwXFieldMaster::GetProgrammaticName(*pType, *m_pImpl->m_pDoc);
819 }
820 else if(rPropertyName == UNO_NAME_DEPENDENT_TEXT_FIELDS)
821 {
822 //fill all text fields into a sequence
823 std::vector<SwFormatField*> vpFields;
824 pType->GatherFields(vpFields);
825 uno::Sequence<uno::Reference <text::XDependentTextField> > aSeq(vpFields.size());
826 std::transform(vpFields.begin(), vpFields.end(), aSeq.getArray(),
827 [this](SwFormatField* pF) { return uno::Reference<text::XDependentTextField>(SwXTextField::CreateXTextField(m_pImpl->m_pDoc, pF)); });
828 aRet <<= aSeq;
829 }
830 else
831 {
832 //TODO: add properties for the other field types
833 const sal_uInt16 nMId = GetFieldTypeMId( rPropertyName, *pType );
834 if (USHRT_MAX == nMId)
835 {
836 throw beans::UnknownPropertyException(
837 "Unknown property: " + rPropertyName,
838 static_cast<cppu::OWeakObject *>(this));
839 }
840 pType->QueryValue( aRet, nMId );
841
842 if (rPropertyName == UNO_NAME_DATA_BASE_NAME ||
843 rPropertyName == UNO_NAME_DATA_BASE_URL)
844 {
845 OUString aDataSource;
846 aRet >>= aDataSource;
847 aRet <<= OUString();
848
849 OUString *pStr = nullptr; // only one of this properties will return
850 // a non-empty string.
851 INetURLObject aObj;
852 aObj.SetURL( aDataSource );
853 bool bIsURL = aObj.GetProtocol() != INetProtocol::NotValid;
854 if (bIsURL && rPropertyName == UNO_NAME_DATA_BASE_URL)
855 pStr = &aDataSource; // DataBaseURL
856 else if (!bIsURL && rPropertyName == UNO_NAME_DATA_BASE_NAME)
857 pStr = &aDataSource; // DataBaseName
858
859 if (pStr)
860 aRet <<= *pStr;
861 }
862 }
863 }
864 else
865 {
866 if(rPropertyName == UNO_NAME_DATA_COMMAND_TYPE)
867 aRet <<= m_pImpl->m_nParam2;
868 else if(rPropertyName == UNO_NAME_DEPENDENT_TEXT_FIELDS )
869 {
870 uno::Sequence<uno::Reference <text::XDependentTextField> > aRetSeq(0);
871 aRet <<= aRetSeq;
872 }
873 else
874 {
875 switch (m_pImpl->m_nResTypeId)
876 {
877 case SwFieldIds::User:
878 if( rPropertyName == UNO_NAME_CONTENT )
879 aRet <<= m_pImpl->m_sParam1;
880 else if(rPropertyName == UNO_NAME_VALUE)
881 aRet <<= m_pImpl->m_fParam1;
882 else if(rPropertyName == UNO_NAME_IS_EXPRESSION)
883 aRet <<= m_pImpl->m_bParam1;
884 break;
886 if(rPropertyName == UNO_NAME_DATA_BASE_NAME ||
887 rPropertyName == UNO_NAME_DATA_BASE_URL)
888 {
889 // only one of these properties returns a non-empty string.
890 INetURLObject aObj;
891 aObj.SetURL(m_pImpl->m_sParam5); // SetSmartURL
892 bool bIsURL = aObj.GetProtocol() != INetProtocol::NotValid;
893 if (bIsURL && rPropertyName == UNO_NAME_DATA_BASE_URL)
894 aRet <<= m_pImpl->m_sParam5; // DataBaseURL
895 else if ( rPropertyName == UNO_NAME_DATA_BASE_NAME)
896 aRet <<= m_pImpl->m_sParam1; // DataBaseName
897 }
898 else if(rPropertyName == UNO_NAME_DATA_TABLE_NAME)
899 aRet <<= m_pImpl->m_sParam2;
900 else if(rPropertyName == UNO_NAME_DATA_COLUMN_NAME)
901 aRet <<= m_pImpl->m_sParam3;
902 break;
904 if(rPropertyName == UNO_NAME_NUMBERING_SEPARATOR)
905 aRet <<= m_pImpl->m_sParam1;
906 else if(rPropertyName == UNO_NAME_CHAPTER_NUMBERING_LEVEL)
907 aRet <<= m_pImpl->m_nParam1;
908 break;
909 case SwFieldIds::Dde:
910 {
911 const sal_Int32 nPart = lcl_PropName2TokenPos(rPropertyName);
912 if(nPart < 3 )
913 aRet <<= m_pImpl->m_sParam1.getToken(nPart, sfx2::cTokenSeparator);
914 else if(3 == nPart)
915 aRet <<= m_pImpl->m_bParam1;
916 }
917 break;
918 default:
919 throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
920 }
921 }
922 }
923 return aRet;
924}
925
926void SwXFieldMaster::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
927{
928 OSL_FAIL("not implemented");
929}
930
931void SwXFieldMaster::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
932{
933 OSL_FAIL("not implemented");
934}
935
936void SwXFieldMaster::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
937{
938 OSL_FAIL("not implemented");
939}
940
941void SwXFieldMaster::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
942{
943 OSL_FAIL("not implemented");
944}
945
947{
948 SolarMutexGuard aGuard;
949 SwFieldType *const pFieldType = GetFieldType(true);
950 if (!pFieldType)
951 throw uno::RuntimeException();
952 size_t nTypeIdx = SIZE_MAX;
953 const SwFieldTypes* pTypes = m_pImpl->m_pDoc->getIDocumentFieldsAccess().GetFieldTypes();
954 for( size_t i = 0; i < pTypes->size(); i++ )
955 {
956 if((*pTypes)[i].get()== pFieldType)
957 nTypeIdx = i;
958 }
959
960 // first delete all fields
961 std::vector<SwFormatField*> vpFields;
962 pFieldType->GatherFields(vpFields);
963 for(auto pField : vpFields)
964 SwTextField::DeleteTextField(*pField->GetTextField());
965 // then delete FieldType
966 m_pImpl->m_pDoc->getIDocumentFieldsAccess().RemoveFieldType(nTypeIdx);
967}
968
970 const uno::Reference<lang::XEventListener> & xListener)
971{
972 std::unique_lock aGuard(m_pImpl->m_Mutex);
973 m_pImpl->m_EventListeners.addInterface(aGuard, xListener);
974}
975
977 const uno::Reference<lang::XEventListener> & xListener)
978{
979 std::unique_lock aGuard(m_pImpl->m_Mutex);
980 m_pImpl->m_EventListeners.removeInterface(aGuard, xListener);
981}
982
984{
985 if(rHint.GetId() == SfxHintId::Dying)
986 {
987 m_pDoc = nullptr;
988 m_pType = nullptr;
989 uno::Reference<uno::XInterface> const xThis(m_wThis);
990 if (!xThis.is())
991 { // fdo#72695: if UNO object is already dead, don't revive it with event
992 return;
993 }
994 lang::EventObject const ev(xThis);
995 std::unique_lock aGuard(m_Mutex);
997 }
998}
999
1001{
1002 const OUString sName(rType.GetName());
1003 if(SwFieldIds::SetExp == rType.Which())
1004 {
1005 const SwFieldTypes* pTypes = rDoc.getIDocumentFieldsAccess().GetFieldTypes();
1006 for( size_t i = 0; i <= o3tl::make_unsigned(INIT_FLDTYPES); i++ )
1007 {
1008 if((*pTypes)[i].get() == &rType)
1009 {
1011 }
1012 }
1013 }
1014 return sName;
1015}
1016
1018 const SwSetExpField& rField,
1019 const OUString& rFormula,
1020 bool bQuery)
1021{
1022 const OUString sTypeName(rField.GetTyp()->GetName());
1023 const OUString sProgName(
1025 if(sProgName != sTypeName)
1026 {
1027 const OUString sSource = bQuery ? sTypeName : sProgName;
1028 const OUString sDest = bQuery ? sProgName : sTypeName;
1029 if(rFormula.startsWith(sSource))
1030 {
1031 return sDest + rFormula.subView(sSource.getLength());
1032 }
1033 }
1034 return rFormula;
1035}
1036
1037namespace {
1038
1039struct SwFieldProperties_Impl
1040{
1041 OUString sPar1;
1042 OUString sPar2;
1043 OUString sPar3;
1044 OUString sPar4;
1045 Date aDate;
1046 double fDouble;
1047 uno::Sequence<beans::PropertyValue> aPropSeq;
1048 uno::Sequence<OUString> aStrings;
1049 std::unique_ptr<util::DateTime> pDateTime;
1050
1051 sal_Int32 nSubType;
1052 sal_Int32 nFormat;
1053 sal_uInt16 nUSHORT1;
1054 sal_uInt16 nUSHORT2;
1055 sal_Int16 nSHORT1;
1056 sal_Int8 nByte1;
1057 bool bFormatIsDefault;
1058 bool bBool1;
1059 bool bBool2;
1060 bool bBool3;
1061 bool bBool4;
1062
1063 SwFieldProperties_Impl():
1064 aDate( Date::EMPTY ),
1065 fDouble(0.),
1066 nSubType(0),
1067 nFormat(0),
1068 nUSHORT1(0),
1069 nUSHORT2(0),
1070 nSHORT1(0),
1071 nByte1(0),
1072 bFormatIsDefault(true),
1073 bBool1(false),
1074 bBool2(false),
1075 bBool3(false),
1076 bBool4(true) //Automatic language
1077 {}
1078};
1079
1080}
1081
1083 : public SvtListener
1084{
1085public:
1086 std::mutex m_Mutex; // just for OInterfaceContainerHelper4
1089
1092
1098 OUString m_sTypeName;
1099 std::unique_ptr<SwFieldProperties_Impl> m_pProps;
1100
1101 Impl(SwDoc *const pDoc, SwFormatField *const pFormat, SwServiceType nServiceId)
1102 : m_pFieldType(nullptr)
1103 , m_pFormatField(pFormat)
1104 , m_pDoc(pDoc)
1105 , m_bIsDescriptor(pFormat == nullptr)
1106 , m_bCallUpdate(false)
1107 , m_nServiceId(pFormat
1108 ? lcl_GetServiceForField(*pFormat->GetField())
1109 : nServiceId)
1110 , m_pProps(pFormat ? nullptr : new SwFieldProperties_Impl)
1111 {
1112 if(m_pFormatField)
1113 StartListening(m_pFormatField->GetNotifier());
1114 }
1115
1116 virtual ~Impl() override
1117 {
1118 if (m_xTextObject.is())
1119 {
1120 m_xTextObject->DisposeEditSource();
1121 }
1122 }
1123
1124 void SetFormatField(SwFormatField* pFormatField, SwDoc* pDoc)
1125 {
1126 m_pFormatField = pFormatField;
1127 m_pDoc = pDoc;
1128 if(m_pFormatField)
1129 {
1130 EndListeningAll();
1131 StartListening(m_pFormatField->GetNotifier());
1132 }
1133 }
1135 {
1136 return m_pFormatField;
1137 }
1138 bool IsDescriptor() const
1139 {
1140 // ideally should be: !m_pFormatField && m_pDoc
1141 // but: SwXServiceProvider::MakeInstance() passes nullptr SwDoc, see comment there
1142 return m_bIsDescriptor;
1143 }
1144 void Invalidate();
1145
1146 const SwField* GetField() const;
1147
1149 {
1150 if(!m_pDoc && !IsDescriptor())
1151 throw uno::RuntimeException();
1152 else if (IsDescriptor())
1153 return m_pFieldType;
1154
1155 return m_pFormatField->GetField()->GetTyp();
1156 }
1158 {
1159 EndListeningAll();
1160 m_pFieldType = &rType;
1161 StartListening(m_pFieldType->GetNotifier());
1162 }
1164 {
1166 m_pFieldType = nullptr;
1167 }
1168 virtual void Notify(const SfxHint&) override;
1169};
1170
1171const uno::Sequence< sal_Int8 > & SwXTextField::getUnoTunnelId()
1172{
1173 static const comphelper::UnoIdInit theSwXTextFieldUnoTunnelId;
1174 return theSwXTextFieldUnoTunnelId.getSeq();
1175}
1176
1177sal_Int64 SAL_CALL
1178SwXTextField::getSomething(const uno::Sequence< sal_Int8 >& rId)
1179{
1180 return comphelper::getSomethingImpl<SwXTextField>(rId, this);
1181}
1182
1184 SwServiceType nServiceId,
1185 SwDoc* pDoc)
1186 : m_pImpl(new Impl(pDoc, nullptr, nServiceId))
1187{
1188 //Set visible as default!
1189 if ( SwServiceType::FieldTypeSetExp == nServiceId
1191 || SwServiceType::FieldTypeDatabase == nServiceId
1192 || SwServiceType::FieldTypeDatabaseName == nServiceId )
1193 {
1194 m_pImpl->m_pProps->bBool2 = true;
1195 }
1196 else if(SwServiceType::FieldTypeTableFormula == nServiceId)
1197 {
1198 m_pImpl->m_pProps->bBool1 = true;
1199 }
1200 if(SwServiceType::FieldTypeSetExp == nServiceId)
1201 {
1202 m_pImpl->m_pProps->nUSHORT2 = USHRT_MAX;
1203 }
1204}
1205
1207 : m_pImpl(new Impl(&rDoc, &rFormat, SwServiceType::Invalid))
1208{
1209}
1210
1212{
1213}
1214
1217 SwServiceType nServiceId)
1218{
1219 assert(!pFormat || pDoc);
1220 assert(pFormat || nServiceId != SwServiceType::Invalid);
1221 // re-use existing SwXTextField
1223 if (pFormat)
1224 {
1225 xField = pFormat->GetXTextField();
1226 }
1227 if (!xField.is())
1228 {
1229 SwXTextField *const pField( pFormat
1230 ? new SwXTextField(const_cast<SwFormatField&>(*pFormat), *pDoc)
1231 : new SwXTextField(nServiceId, pDoc));
1232 xField.set(pField);
1233 if (pFormat)
1234 {
1235 const_cast<SwFormatField *>(pFormat)->SetXTextField(xField);
1236 }
1237 // need a permanent Reference to initialize m_wThis
1238 pField->m_pImpl->m_wThis = xField.get();
1239 }
1240 return xField;
1241}
1242
1244{
1245 return m_pImpl->m_nServiceId;
1246}
1247
1261{
1262 assert(rField.GetFormatField()->Which() == (rField.GetInputFlag() ? RES_TXTATR_INPUTFIELD : RES_TXTATR_FIELD));
1263 rtl::Reference<SwXTextField> const xField(
1264 rField.GetFormatField()->GetXTextField());
1265 SwXTextField *const pXField = xField.is()
1266 ? comphelper::getFromUnoTunnel<SwXTextField>(uno::Reference<lang::XUnoTunnel>(xField))
1267 : nullptr;
1268 if (pXField)
1269 pXField->m_pImpl->SetFormatField(nullptr, nullptr);
1270 SwTextField *const pOldAttr(rField.GetFormatField()->GetTextField());
1271 SwSetExpField tempField(rField);
1272 tempField.SetInputFlag(!rField.GetInputFlag());
1273 SwFormatField tempFormat(tempField);
1274 assert(tempFormat.GetField() != &rField);
1275 assert(tempFormat.GetField() != &tempField); // this copies it again?
1276 assert(tempFormat.Which() == (static_cast<SwSetExpField const*>(tempFormat.GetField())->GetInputFlag() ? RES_TXTATR_INPUTFIELD : RES_TXTATR_FIELD));
1277 SwTextNode & rNode(pOldAttr->GetTextNode());
1278 std::shared_ptr<SwPaM> pPamForTextField;
1280 SwTextField::GetPamForTextField(*pOldAttr, pPamForTextField);
1281 assert(pPamForTextField);
1282 sal_Int32 const nStart(pPamForTextField->Start()->GetContentIndex());
1283 rIDCO.DeleteAndJoin(*pPamForTextField);
1284 // ATTENTION: rField is dead now! hope nobody accesses it...
1285 bool bSuccess = rIDCO.InsertPoolItem(*pPamForTextField, tempFormat);
1286 assert(bSuccess);
1287 (void) bSuccess;
1288 SwTextField const* pNewAttr(rNode.GetFieldTextAttrAt(nStart, true));
1289 assert(pNewAttr);
1290 SwFormatField const& rNewFormat(pNewAttr->GetFormatField());
1291 assert(rNewFormat.Which() == (static_cast<SwSetExpField const*>(rNewFormat.GetField())->GetInputFlag() ? RES_TXTATR_INPUTFIELD : RES_TXTATR_FIELD));
1292 assert(static_cast<SwSetExpField const*>(rNewFormat.GetField())->GetInputFlag() == (dynamic_cast<SwTextInputField const*>(pNewAttr) != nullptr));
1293 if (pXField)
1294 {
1295 pXField->m_pImpl->SetFormatField(const_cast<SwFormatField*>(&rNewFormat), &rNode.GetDoc());
1296 const_cast<SwFormatField&>(rNewFormat).SetXTextField(xField);
1297 }
1298}
1299
1301 const uno::Reference< beans::XPropertySet > & xFieldMaster)
1302{
1303 SolarMutexGuard aGuard;
1304
1305 if (!m_pImpl->IsDescriptor())
1306 throw uno::RuntimeException();
1307 uno::Reference< lang::XUnoTunnel > xMasterTunnel(xFieldMaster, uno::UNO_QUERY);
1308 if (!xMasterTunnel.is())
1309 throw lang::IllegalArgumentException();
1310 SwXFieldMaster* pMaster = comphelper::getFromUnoTunnel<SwXFieldMaster>(xMasterTunnel);
1311
1312 SwFieldType* pFieldType = pMaster ? pMaster->GetFieldType() : nullptr;
1313 if (!pFieldType ||
1314 pFieldType->Which() != lcl_ServiceIdToResId(m_pImpl->m_nServiceId))
1315 {
1316 throw lang::IllegalArgumentException();
1317 }
1318 m_pImpl->m_sTypeName = pFieldType->GetName();
1319 m_pImpl->SetFieldType(*pFieldType);
1320}
1321
1322uno::Reference< beans::XPropertySet > SAL_CALL
1324{
1325 SolarMutexGuard aGuard;
1326
1327 SwFieldType* pType = m_pImpl->GetFieldType();
1328 uno::Reference<beans::XPropertySet> const xRet(
1330 return xRet;
1331}
1332
1333OUString SAL_CALL SwXTextField::getPresentation(sal_Bool bShowCommand)
1334{
1335 SolarMutexGuard aGuard;
1336
1337 SwField const*const pField = m_pImpl->GetField();
1338 if (!pField)
1339 {
1340 throw uno::RuntimeException();
1341 }
1342 return bShowCommand ? pField->GetFieldName() : pField->ExpandField(true, nullptr);
1343}
1344
1346 const uno::Reference< text::XTextRange > & xTextRange)
1347{
1348 SolarMutexGuard aGuard;
1349 if (m_pImpl->IsDescriptor())
1350 {
1351 uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
1352 SwXTextRange* pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
1353 OTextCursorHelper* pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
1354
1355 SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr;
1356 // if a FieldMaster was attached, then the document is already fixed!
1357 // NOTE: sw.SwXAutoTextEntry unoapi test depends on m_pDoc = 0 being valid
1358 if (!pDoc || (m_pImpl->m_pDoc && m_pImpl->m_pDoc != pDoc))
1359 throw lang::IllegalArgumentException();
1360
1361 SwUnoInternalPaM aPam(*pDoc);
1362 // this now needs to return TRUE
1363 ::sw::XTextRangeToSwPaM(aPam, xTextRange);
1364 std::unique_ptr<SwField> xField;
1365 switch (m_pImpl->m_nServiceId)
1366 {
1368 {
1370
1371 DateTime aDateTime( DateTime::EMPTY );
1372 if (m_pImpl->m_pProps->pDateTime)
1373 {
1374 aDateTime = *(m_pImpl->m_pProps->pDateTime);
1375 }
1376 SwPostItField* pPostItField = new SwPostItField(
1377 static_cast<SwPostItFieldType*>(pFieldType),
1378 m_pImpl->m_pProps->sPar1, // author
1379 m_pImpl->m_pProps->sPar2, // content
1380 m_pImpl->m_pProps->sPar3, // author's initials
1381 m_pImpl->m_pProps->sPar4, // name
1382 aDateTime,
1383 m_pImpl->m_pProps->bBool1 // resolvedflag
1384 );
1385 if ( m_pImpl->m_xTextObject.is() )
1386 {
1387 pPostItField->SetTextObject( m_pImpl->m_xTextObject->CreateText() );
1388 pPostItField->SetPar2(m_pImpl->m_xTextObject->GetText());
1389 }
1390 xField.reset(pPostItField);
1391 }
1392 break;
1394 {
1396 xField.reset(new SwScriptField(static_cast<SwScriptFieldType*>(pFieldType),
1397 m_pImpl->m_pProps->sPar1, m_pImpl->m_pProps->sPar2,
1398 m_pImpl->m_pProps->bBool1));
1399 }
1400 break;
1402 {
1403 sal_uInt16 nSub = 0;
1404 if (m_pImpl->m_pProps->bBool1)
1405 nSub |= FIXEDFLD;
1406 if (m_pImpl->m_pProps->bBool2)
1407 nSub |= DATEFLD;
1408 else
1409 nSub |= TIMEFLD;
1411 SwDateTimeField *const pDTField = new SwDateTimeField(
1412 static_cast<SwDateTimeFieldType*>(pFieldType),
1413 nSub, m_pImpl->m_pProps->nFormat);
1414 xField.reset(pDTField);
1415 if (m_pImpl->m_pProps->fDouble > 0.)
1416 {
1417 pDTField->SetValue(m_pImpl->m_pProps->fDouble);
1418 }
1419 if (m_pImpl->m_pProps->pDateTime)
1420 {
1421 uno::Any aVal; aVal <<= *m_pImpl->m_pProps->pDateTime;
1422 xField->PutValue( aVal, FIELD_PROP_DATE_TIME );
1423 }
1424 pDTField->SetOffset(m_pImpl->m_pProps->nSubType);
1425 }
1426 break;
1428 {
1430 sal_Int32 nFormat = m_pImpl->m_pProps->nFormat;
1431 if (m_pImpl->m_pProps->bBool2)
1432 nFormat |= FF_FIXED;
1433 SwFileNameField *const pFNField = new SwFileNameField(
1434 static_cast<SwFileNameFieldType*>(pFieldType), nFormat);
1435 xField.reset(pFNField);
1436 if (!m_pImpl->m_pProps->sPar3.isEmpty())
1437 pFNField->SetExpansion(m_pImpl->m_pProps->sPar3);
1438 uno::Any aFormat;
1439 aFormat <<= m_pImpl->m_pProps->nFormat;
1440 xField->PutValue( aFormat, FIELD_PROP_FORMAT );
1441 }
1442 break;
1444 {
1446 xField.reset(new SwTemplNameField(static_cast<SwTemplNameFieldType*>(pFieldType),
1447 m_pImpl->m_pProps->nFormat));
1448 uno::Any aFormat;
1449 aFormat <<= m_pImpl->m_pProps->nFormat;
1450 xField->PutValue(aFormat, FIELD_PROP_FORMAT);
1451 }
1452 break;
1454 {
1456 SwChapterField *const pChapterField = new SwChapterField(
1457 static_cast<SwChapterFieldType*>(pFieldType),
1458 m_pImpl->m_pProps->nUSHORT1);
1459 xField.reset(pChapterField);
1460 pChapterField->SetLevel(m_pImpl->m_pProps->nByte1);
1461 uno::Any aVal;
1462 aVal <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT1);
1463 xField->PutValue(aVal, FIELD_PROP_USHORT1 );
1464 }
1465 break;
1467 {
1468 tools::Long nFormat = m_pImpl->m_pProps->bBool1 ? AF_NAME : AF_SHORTCUT;
1469 if (m_pImpl->m_pProps->bBool2)
1470 nFormat |= AF_FIXED;
1471
1473 SwAuthorField *const pAuthorField = new SwAuthorField(
1474 static_cast<SwAuthorFieldType*>(pFieldType), nFormat);
1475 xField.reset(pAuthorField);
1476 pAuthorField->SetExpansion(m_pImpl->m_pProps->sPar1);
1477 }
1478 break;
1481 {
1483 SwHiddenTextField *const pHTField = new SwHiddenTextField(
1484 static_cast<SwHiddenTextFieldType*>(pFieldType),
1485 m_pImpl->m_pProps->sPar1,
1486 m_pImpl->m_pProps->sPar2, m_pImpl->m_pProps->sPar3,
1489 xField.reset(pHTField);
1490 pHTField->SetValue(m_pImpl->m_pProps->bBool1);
1491 uno::Any aVal;
1492 aVal <<= m_pImpl->m_pProps->sPar4;
1493 xField->PutValue(aVal, FIELD_PROP_PAR4 );
1494 }
1495 break;
1497 {
1499 SwHiddenParaField *const pHPField = new SwHiddenParaField(
1500 static_cast<SwHiddenParaFieldType*>(pFieldType),
1501 m_pImpl->m_pProps->sPar1);
1502 xField.reset(pHPField);
1503 pHPField->SetHidden(m_pImpl->m_pProps->bBool1);
1504 }
1505 break;
1507 {
1509 xField.reset(new SwGetRefField(static_cast<SwGetRefFieldType*>(pFieldType),
1510 m_pImpl->m_pProps->sPar1,
1511 m_pImpl->m_pProps->sPar4,
1512 0,
1513 0,
1514 0));
1515 if (!m_pImpl->m_pProps->sPar3.isEmpty())
1516 static_cast<SwGetRefField*>(xField.get())->SetExpand(m_pImpl->m_pProps->sPar3);
1517 uno::Any aVal;
1518 aVal <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT1);
1519 xField->PutValue(aVal, FIELD_PROP_USHORT1 );
1520 aVal <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT2);
1521 xField->PutValue(aVal, FIELD_PROP_USHORT2 );
1522 aVal <<= m_pImpl->m_pProps->nSHORT1;
1523 xField->PutValue(aVal, FIELD_PROP_SHORT1 );
1524 }
1525 break;
1527 {
1529 xField.reset(new SwJumpEditField(static_cast<SwJumpEditFieldType*>(pFieldType),
1530 m_pImpl->m_pProps->nUSHORT1, m_pImpl->m_pProps->sPar2,
1531 m_pImpl->m_pProps->sPar1));
1532 }
1533 break;
1548 {
1550 sal_uInt16 nSubType = aDocInfoSubTypeFromService[
1551 static_cast<sal_uInt16>(m_pImpl->m_nServiceId) - sal_uInt16(SwServiceType::FieldTypeDocInfoChangeAuthor)];
1556 {
1557 if (m_pImpl->m_pProps->bBool2) //IsDate
1558 {
1559 nSubType &= 0xf0ff;
1560 nSubType |= DI_SUB_DATE;
1561 }
1562 else
1563 {
1564 nSubType &= 0xf0ff;
1565 nSubType |= DI_SUB_TIME;
1566 }
1567 }
1568 if (m_pImpl->m_pProps->bBool1)
1569 nSubType |= DI_SUB_FIXED;
1570 xField.reset(new SwDocInfoField(
1571 static_cast<SwDocInfoFieldType*>(pFieldType), nSubType,
1572 m_pImpl->m_pProps->sPar4, m_pImpl->m_pProps->nFormat));
1573 if (!m_pImpl->m_pProps->sPar3.isEmpty())
1574 static_cast<SwDocInfoField*>(xField.get())->SetExpansion(m_pImpl->m_pProps->sPar3);
1575 }
1576 break;
1578 {
1579 sal_Int32 nFormat = 0;
1580 if (m_pImpl->m_pProps->bBool1)
1581 nFormat = AF_FIXED;
1582
1584 SwExtUserField *const pEUField = new SwExtUserField(
1585 static_cast<SwExtUserFieldType*>(pFieldType),
1586 m_pImpl->m_pProps->nUSHORT1, nFormat);
1587 xField.reset(pEUField);
1588 pEUField->SetExpansion(m_pImpl->m_pProps->sPar1);
1589 }
1590 break;
1592 {
1593 SwFieldType* pFieldType =
1595 if (!pFieldType)
1596 throw uno::RuntimeException();
1597 sal_uInt16 nUserSubType = (m_pImpl->m_pProps->bBool1)
1599 if (m_pImpl->m_pProps->bBool2)
1600 nUserSubType |= nsSwExtendedSubType::SUB_CMD;
1601 if (m_pImpl->m_pProps->bFormatIsDefault &&
1602 nsSwGetSetExpType::GSE_STRING == static_cast<SwUserFieldType*>(pFieldType)->GetType())
1603 {
1604 m_pImpl->m_pProps->nFormat = -1;
1605 }
1606 xField.reset(new SwUserField(static_cast<SwUserFieldType*>(pFieldType),
1607 nUserSubType,
1608 m_pImpl->m_pProps->nFormat));
1609 }
1610 break;
1612 {
1614 xField.reset(new SwRefPageSetField( static_cast<SwRefPageSetFieldType*>(pFieldType),
1615 m_pImpl->m_pProps->nUSHORT1,
1616 m_pImpl->m_pProps->bBool1 ));
1617 }
1618 break;
1620 {
1622 SwRefPageGetField *const pRGField = new SwRefPageGetField(
1623 static_cast<SwRefPageGetFieldType*>(pFieldType),
1624 m_pImpl->m_pProps->nUSHORT1 );
1625 xField.reset(pRGField);
1626 pRGField->SetText(m_pImpl->m_pProps->sPar1, nullptr);
1627 }
1628 break;
1630 {
1632 SwPageNumberField *const pPNField = new SwPageNumberField(
1633 static_cast<SwPageNumberFieldType*>(pFieldType), PG_RANDOM,
1634 m_pImpl->m_pProps->nFormat,
1635 m_pImpl->m_pProps->nUSHORT1);
1636 xField.reset(pPNField);
1637 pPNField->SetUserString(m_pImpl->m_pProps->sPar1);
1638 uno::Any aVal;
1639 aVal <<= m_pImpl->m_pProps->nSubType;
1640 xField->PutValue( aVal, FIELD_PROP_SUBTYPE );
1641 }
1642 break;
1644 {
1645 SwFieldType* pFieldType =
1646 pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Dde, m_pImpl->m_sTypeName, true);
1647 if (!pFieldType)
1648 throw uno::RuntimeException();
1649 xField.reset(new SwDDEField( static_cast<SwDDEFieldType*>(pFieldType) ));
1650 }
1651 break;
1653 {
1656 aData.sDataSource = m_pImpl->m_pProps->sPar1;
1657 aData.sCommand = m_pImpl->m_pProps->sPar2;
1658 aData.nCommandType = m_pImpl->m_pProps->nSHORT1;
1659 xField.reset(new SwDBNameField(static_cast<SwDBNameFieldType*>(pFieldType), aData));
1660 sal_uInt16 nSubType = xField->GetSubType();
1661 if (m_pImpl->m_pProps->bBool2)
1663 else
1665 xField->SetSubType(nSubType);
1666 }
1667 break;
1669 {
1671 aData.sDataSource = m_pImpl->m_pProps->sPar1;
1672 aData.sCommand = m_pImpl->m_pProps->sPar2;
1673 aData.nCommandType = m_pImpl->m_pProps->nSHORT1;
1675 xField.reset(new SwDBNextSetField(static_cast<SwDBNextSetFieldType*>(pFieldType),
1676 m_pImpl->m_pProps->sPar3, aData));
1677 }
1678 break;
1680 {
1682 aData.sDataSource = m_pImpl->m_pProps->sPar1;
1683 aData.sCommand = m_pImpl->m_pProps->sPar2;
1684 aData.nCommandType = m_pImpl->m_pProps->nSHORT1;
1685 xField.reset(new SwDBNumSetField( static_cast<SwDBNumSetFieldType*>(
1687 m_pImpl->m_pProps->sPar3,
1688 OUString::number(m_pImpl->m_pProps->nFormat),
1689 aData ));
1690 }
1691 break;
1693 {
1695 aData.sDataSource = m_pImpl->m_pProps->sPar1;
1696 aData.sCommand = m_pImpl->m_pProps->sPar2;
1697 aData.nCommandType = m_pImpl->m_pProps->nSHORT1;
1698 SwDBSetNumberField *const pDBSNField =
1701 m_pImpl->m_pProps->nUSHORT1);
1702 xField.reset(pDBSNField);
1703 pDBSNField->SetSetNumber(m_pImpl->m_pProps->nFormat);
1704 sal_uInt16 nSubType = xField->GetSubType();
1705 if (m_pImpl->m_pProps->bBool2)
1707 else
1709 xField->SetSubType(nSubType);
1710 }
1711 break;
1713 {
1714 SwFieldType* pFieldType =
1716 if (!pFieldType)
1717 throw uno::RuntimeException();
1718 xField.reset(new SwDBField(static_cast<SwDBFieldType*>(pFieldType),
1719 m_pImpl->m_pProps->nFormat));
1720 static_cast<SwDBField*>(xField.get())->InitContent(m_pImpl->m_pProps->sPar1);
1721 sal_uInt16 nSubType = xField->GetSubType();
1722 if (m_pImpl->m_pProps->bBool2)
1724 else
1726 xField->SetSubType(nSubType);
1727 }
1728 break;
1730 {
1731 SwFieldType* pFieldType =
1733 if (!pFieldType)
1734 throw uno::RuntimeException();
1735 // detect the field type's sub type and set an appropriate number format
1736 if (m_pImpl->m_pProps->bFormatIsDefault &&
1737 nsSwGetSetExpType::GSE_STRING == static_cast<SwSetExpFieldType*>(pFieldType)->GetType())
1738 {
1739 m_pImpl->m_pProps->nFormat = -1;
1740 }
1741 SwSetExpField *const pSEField = new SwSetExpField(
1742 static_cast<SwSetExpFieldType*>(pFieldType),
1743 m_pImpl->m_pProps->sPar2,
1744 m_pImpl->m_pProps->nUSHORT2 != USHRT_MAX ? //#i79471# the field can have a number format or a number_ing_ format
1745 m_pImpl->m_pProps->nUSHORT2 : m_pImpl->m_pProps->nFormat);
1746 xField.reset(pSEField);
1747
1748 sal_uInt16 nSubType = xField->GetSubType();
1749 if (m_pImpl->m_pProps->bBool2)
1751 else
1753 if (m_pImpl->m_pProps->bBool3)
1754 nSubType |= nsSwExtendedSubType::SUB_CMD;
1755 else
1757 xField->SetSubType(nSubType);
1758 pSEField->SetSeqNumber(m_pImpl->m_pProps->nUSHORT1);
1759 pSEField->SetInputFlag(m_pImpl->m_pProps->bBool1);
1760 pSEField->SetPromptText(m_pImpl->m_pProps->sPar3);
1761 if (!m_pImpl->m_pProps->sPar4.isEmpty())
1762 pSEField->ChgExpStr(m_pImpl->m_pProps->sPar4, nullptr);
1763
1764 }
1765 break;
1767 {
1768 sal_uInt16 nSubType;
1769 switch (m_pImpl->m_pProps->nSubType)
1770 {
1771 case text::SetVariableType::STRING: nSubType = nsSwGetSetExpType::GSE_STRING; break;
1772 case text::SetVariableType::VAR: nSubType = nsSwGetSetExpType::GSE_EXPR; break;
1773 //case text::SetVariableType::SEQUENCE: nSubType = nsSwGetSetExpType::GSE_SEQ; break;
1774 case text::SetVariableType::FORMULA: nSubType = nsSwGetSetExpType::GSE_FORMULA; break;
1775 default:
1776 OSL_FAIL("wrong value");
1777 nSubType = nsSwGetSetExpType::GSE_EXPR;
1778 }
1779 //make sure the SubType matches the field type
1780 SwFieldType* pSetExpField = pDoc->getIDocumentFieldsAccess().GetFieldType(
1781 SwFieldIds::SetExp, m_pImpl->m_pProps->sPar1, false);
1782 bool bSetGetExpFieldUninitialized = false;
1783 if (pSetExpField)
1784 {
1785 if (nSubType != nsSwGetSetExpType::GSE_STRING &&
1786 static_cast< SwSetExpFieldType* >(pSetExpField)->GetType() == nsSwGetSetExpType::GSE_STRING)
1788 }
1789 else
1790 bSetGetExpFieldUninitialized = true; // #i82544#
1791
1792 if (m_pImpl->m_pProps->bBool2)
1793 nSubType |= nsSwExtendedSubType::SUB_CMD;
1794 else
1796 SwGetExpField *const pGEField = new SwGetExpField(
1797 static_cast<SwGetExpFieldType*>(
1799 m_pImpl->m_pProps->sPar1, nSubType,
1800 m_pImpl->m_pProps->nFormat);
1801 xField.reset(pGEField);
1802 //TODO: evaluate SubType!
1803 if (!m_pImpl->m_pProps->sPar4.isEmpty())
1804 pGEField->ChgExpStr(m_pImpl->m_pProps->sPar4, nullptr);
1805 // #i82544#
1806 if (bSetGetExpFieldUninitialized)
1807 pGEField->SetLateInitialization();
1808 }
1809 break;
1812 {
1813 SwFieldType* pFieldType =
1815 if (!pFieldType)
1816 throw uno::RuntimeException();
1817 sal_uInt16 nInpSubType =
1818 sal::static_int_cast<sal_uInt16>(
1820 ? INP_USR : INP_TXT);
1821 SwInputField * pTextField =
1822 new SwInputField(static_cast<SwInputFieldType*>(pFieldType),
1823 m_pImpl->m_pProps->sPar1,
1824 m_pImpl->m_pProps->sPar2,
1825 nInpSubType);
1826 pTextField->SetHelp(m_pImpl->m_pProps->sPar3);
1827 pTextField->SetToolTip(m_pImpl->m_pProps->sPar4);
1828
1829 xField.reset(pTextField);
1830 }
1831 break;
1833 {
1835 OUString aName;
1836
1837 // support for Scripting Framework macros
1838 if (!m_pImpl->m_pProps->sPar4.isEmpty())
1839 {
1840 aName = m_pImpl->m_pProps->sPar4;
1841 }
1842 else
1843 {
1845 m_pImpl->m_pProps->sPar1, m_pImpl->m_pProps->sPar3);
1846 }
1847 xField.reset(new SwMacroField(static_cast<SwMacroFieldType*>(pFieldType), aName,
1848 m_pImpl->m_pProps->sPar2));
1849 }
1850 break;
1858 {
1859 sal_uInt16 nSubType = DS_PAGE;
1860 switch (m_pImpl->m_nServiceId)
1861 {
1862 case SwServiceType::FieldTypeParagraphCount : nSubType = DS_PARA; break;
1863 case SwServiceType::FieldTypeWordCount : nSubType = DS_WORD; break;
1864 case SwServiceType::FieldTypeCharacterCount : nSubType = DS_CHAR; break;
1865 case SwServiceType::FieldTypeTableCount : nSubType = DS_TBL; break;
1866 case SwServiceType::FieldTypeGraphicObjectCount : nSubType = DS_GRF; break;
1867 case SwServiceType::FieldTypeEmbeddedObjectCount : nSubType = DS_OLE; break;
1868 default: break;
1869 }
1871 xField.reset(new SwDocStatField(
1872 static_cast<SwDocStatFieldType*>(pFieldType),
1873 nSubType, m_pImpl->m_pProps->nUSHORT2));
1874 }
1875 break;
1877 {
1878 SwAuthorityFieldType const type(pDoc);
1879 xField.reset(new SwAuthorityField(static_cast<SwAuthorityFieldType*>(
1881 u""));
1882 if (m_pImpl->m_pProps->aPropSeq.hasElements())
1883 {
1884 uno::Any aVal;
1885 aVal <<= m_pImpl->m_pProps->aPropSeq;
1886 xField->PutValue( aVal, FIELD_PROP_PROP_SEQ );
1887 }
1888 }
1889 break;
1891 // create field
1892 xField.reset(new SwCombinedCharField( static_cast<SwCombinedCharFieldType*>(
1894 m_pImpl->m_pProps->sPar1));
1895 break;
1897 {
1898 SwDropDownField *const pDDField = new SwDropDownField(
1899 static_cast<SwDropDownFieldType *>(
1901 xField.reset(pDDField);
1902
1903 pDDField->SetItems(m_pImpl->m_pProps->aStrings);
1904 pDDField->SetSelectedItem(m_pImpl->m_pProps->sPar1);
1905 pDDField->SetName(m_pImpl->m_pProps->sPar2);
1906 pDDField->SetHelp(m_pImpl->m_pProps->sPar3);
1907 pDDField->SetToolTip(m_pImpl->m_pProps->sPar4);
1908 }
1909 break;
1910
1912 {
1913 // create field
1915 if (m_pImpl->m_pProps->bBool1)
1916 {
1918 if (m_pImpl->m_pProps->bFormatIsDefault)
1919 m_pImpl->m_pProps->nFormat = -1;
1920 }
1921 xField.reset(new SwTableField( static_cast<SwTableFieldType*>(
1923 m_pImpl->m_pProps->sPar2,
1924 nType,
1925 m_pImpl->m_pProps->nFormat));
1926 static_cast<SwTableField*>(xField.get())->ChgExpStr(m_pImpl->m_pProps->sPar1);
1927 }
1928 break;
1929 default: OSL_FAIL("What kind of type is that?");
1930 }
1931
1932 if (!xField)
1933 throw uno::RuntimeException("no SwField created?");
1934
1935 xField->SetAutomaticLanguage(!m_pImpl->m_pProps->bBool4);
1936 SwFormatField aFormat(*xField);
1937
1938 UnoActionContext aCont(pDoc);
1939 if (aPam.HasMark() &&
1941 {
1943 }
1944
1945 SwXTextCursor const*const pTextCursor(dynamic_cast<SwXTextCursor*>(pCursor));
1946 const bool bForceExpandHints(
1947 pTextCursor
1948 && pTextCursor->IsAtEndOfMeta() );
1949 const SetAttrMode nInsertFlags =
1950 bForceExpandHints
1953
1954 if (*aPam.GetPoint() != *aPam.GetMark() &&
1956 {
1957 // Make sure we always insert the field at the end
1958 SwPaM aEnd(*aPam.End(), *aPam.End());
1959 pDoc->getIDocumentContentOperations().InsertPoolItem(aEnd, aFormat, nInsertFlags);
1960 }
1961 else
1962 pDoc->getIDocumentContentOperations().InsertPoolItem(aPam, aFormat, nInsertFlags);
1963
1964 SwTextAttr* pTextAttr = aPam.GetPointNode().GetTextNode()->GetFieldTextAttrAt( aPam.GetPoint()->GetContentIndex()-1, true );
1965
1966 // What about updating the fields? (see fldmgr.cxx)
1967 if (!pTextAttr)
1968 throw uno::RuntimeException("no SwTextAttr inserted?"); // could theoretically happen, if paragraph is full
1969
1970 const SwFormatField& rField = pTextAttr->GetFormatField();
1971 m_pImpl->SetFormatField(const_cast<SwFormatField*>(&rField), pDoc);
1972
1973 if ( pTextAttr->Which() == RES_TXTATR_ANNOTATION
1974 && *aPam.GetPoint() != *aPam.GetMark() )
1975 {
1976 // create annotation mark
1977 const SwPostItField* pPostItField = dynamic_cast< const SwPostItField* >(pTextAttr->GetFormatField().GetField());
1978 OSL_ENSURE( pPostItField != nullptr, "<SwXTextField::attachToRange(..)> - annotation field missing!" );
1979 if ( pPostItField != nullptr )
1980 {
1981 IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess();
1982 pMarksAccess->makeAnnotationMark( aPam, pPostItField->GetName() );
1983 }
1984 }
1985
1986 xField.reset();
1987
1988 assert(m_pImpl->GetFormatField());
1989 m_pImpl->m_pDoc = pDoc;
1990 m_pImpl->GetFormatField()->SetXTextField(this);
1991 m_pImpl->m_wThis = this;
1992 m_pImpl->m_bIsDescriptor = false;
1993 m_pImpl->ClearFieldType();
1994 m_pImpl->m_pProps.reset();
1995 if (m_pImpl->m_bCallUpdate)
1996 update();
1997 }
1998 else if ( !m_pImpl->IsDescriptor()
1999 && m_pImpl->m_pDoc != nullptr
2000 && m_pImpl->m_nServiceId == SwServiceType::FieldTypeAnnotation )
2001 {
2002 SwUnoInternalPaM aIntPam( *m_pImpl->m_pDoc );
2003 if ( !::sw::XTextRangeToSwPaM( aIntPam, xTextRange ) )
2004 throw lang::IllegalArgumentException();
2005
2006 // Nothing to do, if the text range has a separate start and end, but they have the same
2007 // value.
2008 if (!aIntPam.HasMark() || *aIntPam.Start() != *aIntPam.End())
2009 {
2010 UnoActionContext aCont( m_pImpl->m_pDoc );
2011 // insert copy of annotation at new text range
2012 std::unique_ptr<SwPostItField> pPostItField(static_cast< SwPostItField* >(m_pImpl->GetFormatField()->GetField()->CopyField().release()));
2013 SwFormatField aFormatField( *pPostItField );
2014 pPostItField.reset();
2015 SwPaM aEnd( *aIntPam.End(), *aIntPam.End() );
2016 m_pImpl->m_pDoc->getIDocumentContentOperations().InsertPoolItem( aEnd, aFormatField );
2017 // delete former annotation
2018 {
2019 const SwTextField* pTextField = m_pImpl->GetFormatField()->GetTextField();
2020 SwTextNode& rTextNode = *pTextField->GetpTextNode();
2021 SwPaM aPam( rTextNode, pTextField->GetStart() );
2022 aPam.SetMark();
2023 aPam.Move();
2024 m_pImpl->m_pDoc->getIDocumentContentOperations().DeleteAndJoin(aPam);
2025 }
2026 // keep inserted annotation
2027 {
2028 SwTextField* pTextAttr = aEnd.GetPointNode().GetTextNode()->GetFieldTextAttrAt( aEnd.End()->GetContentIndex()-1, true );
2029 if ( pTextAttr != nullptr )
2030 {
2031 m_pImpl->SetFormatField(const_cast<SwFormatField*>(&pTextAttr->GetFormatField()), m_pImpl->m_pDoc);
2032
2033 if ( *aIntPam.GetPoint() != *aIntPam.GetMark() )
2034 {
2035 // create annotation mark
2036 const SwPostItField* pField = dynamic_cast< const SwPostItField* >(pTextAttr->GetFormatField().GetField());
2037 OSL_ENSURE( pField != nullptr, "<SwXTextField::attach(..)> - annotation field missing!" );
2038 if ( pField != nullptr )
2039 {
2040 IDocumentMarkAccess* pMarksAccess = aIntPam.GetDoc().getIDocumentMarkAccess();
2041 pMarksAccess->makeAnnotationMark( aIntPam, pField->GetName() );
2042 }
2043 }
2044 }
2045 }
2046 }
2047
2048 }
2049 else
2050 throw lang::IllegalArgumentException();
2051}
2052
2053uno::Reference< text::XTextRange > SAL_CALL
2055{
2056 SolarMutexGuard aGuard;
2057
2058 SwField const*const pField = m_pImpl->GetField();
2059 if (!pField)
2060 return nullptr;
2061
2062 const SwTextField* pTextField = m_pImpl->GetFormatField()->GetTextField();
2063 if (!pTextField)
2064 throw uno::RuntimeException();
2065
2066 std::shared_ptr< SwPaM > pPamForTextField;
2067 SwTextField::GetPamForTextField(*pTextField, pPamForTextField);
2068 if (pPamForTextField == nullptr)
2069 return nullptr;
2070
2071 // If this is a postit field, then return the range of its annotation mark if it has one.
2072 if (pField->Which() == SwFieldIds::Postit)
2073 {
2074 const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField);
2075 IDocumentMarkAccess* pMarkAccess = m_pImpl->m_pDoc->getIDocumentMarkAccess();
2076 for (IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAnnotationMarksBegin(); ppMark != pMarkAccess->getAnnotationMarksEnd(); ++ppMark)
2077 {
2078 if ((*ppMark)->GetName() == pPostItField->GetName())
2079 {
2080 pPamForTextField = std::make_shared<SwPaM>((*ppMark)->GetMarkStart(), (*ppMark)->GetMarkEnd());
2081 break;
2082 }
2083 }
2084 }
2085
2086 uno::Reference<text::XTextRange> xRange = SwXTextRange::CreateXTextRange(
2087 *m_pImpl->m_pDoc, *(pPamForTextField->GetPoint()), pPamForTextField->GetMark());
2088 return xRange;
2089}
2090
2092{
2093 SolarMutexGuard aGuard;
2094 SwField const*const pField = m_pImpl->GetField();
2095 if(pField && m_pImpl->m_pDoc)
2096 {
2097 UnoActionContext aContext(m_pImpl->m_pDoc);
2098 assert(m_pImpl->GetFormatField()->GetTextField() && "<SwXTextField::dispose()> - missing <SwTextField> --> crash");
2099 SwTextField::DeleteTextField(*(m_pImpl->GetFormatField()->GetTextField()));
2100 }
2101
2102 if (m_pImpl->m_xTextObject.is())
2103 {
2104 m_pImpl->m_xTextObject->DisposeEditSource();
2105 m_pImpl->m_xTextObject.clear();
2106 }
2107 m_pImpl->Invalidate();
2108}
2109
2111 const uno::Reference<lang::XEventListener> & xListener)
2112{
2113 std::unique_lock aGuard(m_pImpl->m_Mutex);
2114 m_pImpl->m_EventListeners.addInterface(aGuard, xListener);
2115}
2116
2118 const uno::Reference<lang::XEventListener> & xListener)
2119{
2120 std::unique_lock aGuard(m_pImpl->m_Mutex);
2121 m_pImpl->m_EventListeners.removeInterface(aGuard, xListener);
2122}
2123
2124uno::Reference< beans::XPropertySetInfo > SAL_CALL
2126{
2127 SolarMutexGuard aGuard;
2128 // no static
2129 uno::Reference< beans::XPropertySetInfo > aRef;
2130 if (m_pImpl->m_nServiceId == SwServiceType::Invalid)
2131 {
2132 throw uno::RuntimeException();
2133 }
2135 lcl_GetPropertyMapOfService(m_pImpl->m_nServiceId));
2136 const uno::Reference<beans::XPropertySetInfo>& xInfo = pPropSet->getPropertySetInfo();
2137 // extend PropertySetInfo!
2138 const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
2139 aRef = new SfxExtItemPropertySetInfo(
2141 aPropSeq );
2142 return aRef;
2143}
2144
2145void SAL_CALL
2147 const OUString& rPropertyName, const uno::Any& rValue)
2148{
2149 SolarMutexGuard aGuard;
2150 SwField const*const pField = m_pImpl->GetField();
2152 lcl_GetPropertyMapOfService(m_pImpl->m_nServiceId));
2153 const SfxItemPropertyMapEntry* pEntry = _pPropSet->getPropertyMap().getByName(rPropertyName);
2154
2155 if (!pEntry)
2156 throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2157 if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
2158 throw beans::PropertyVetoException( "Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2159
2160 if(pField)
2161 {
2162 // special treatment for mail merge fields
2163 const SwFieldIds nWhich = pField->Which();
2164 if( SwFieldIds::Database == nWhich &&
2165 (rPropertyName == UNO_NAME_DATA_BASE_NAME ||
2166 rPropertyName == UNO_NAME_DATA_BASE_URL||
2167 rPropertyName == UNO_NAME_DATA_TABLE_NAME||
2168 rPropertyName == UNO_NAME_DATA_COLUMN_NAME))
2169 {
2170 // here a new field type must be created and the field must
2171 // be registered at the new type
2172 OSL_FAIL("not implemented");
2173 }
2174 else
2175 {
2176 SwDoc * pDoc = m_pImpl->m_pDoc;
2177 assert(pDoc);
2178 const SwTextField* pTextField = m_pImpl->GetFormatField()->GetTextField();
2179 if(!pTextField)
2180 throw uno::RuntimeException();
2181 SwPosition aPosition( pTextField->GetTextNode(), pTextField->GetStart() );
2182 pDoc->getIDocumentFieldsAccess().PutValueToField( aPosition, rValue, pEntry->nWID);
2183 }
2184
2185 //#i100374# notify SwPostIt about new field content
2186 assert(m_pImpl->GetFormatField());
2187 if (SwFieldIds::Postit == nWhich)
2188 {
2189 m_pImpl->GetFormatField()->Broadcast(
2191 }
2192
2193 // fdo#42073 notify SwTextField about changes of the expanded string
2194 if (m_pImpl->GetFormatField()->GetTextField())
2195 {
2196 m_pImpl->GetFormatField()->GetTextField()->ExpandTextField();
2197 }
2198
2199 //#i100374# changing a document field should set the modify flag
2200 SwDoc* pDoc = m_pImpl->m_pDoc;
2201 if (pDoc)
2203
2204 }
2205 else if (m_pImpl->m_pProps)
2206 {
2207 bool* pBool = nullptr;
2208 switch(pEntry->nWID)
2209 {
2210 case FIELD_PROP_PAR1:
2211 rValue >>= m_pImpl->m_pProps->sPar1;
2212 break;
2213 case FIELD_PROP_PAR2:
2214 rValue >>= m_pImpl->m_pProps->sPar2;
2215 break;
2216 case FIELD_PROP_PAR3:
2217 rValue >>= m_pImpl->m_pProps->sPar3;
2218 break;
2219 case FIELD_PROP_PAR4:
2220 rValue >>= m_pImpl->m_pProps->sPar4;
2221 break;
2222 case FIELD_PROP_FORMAT:
2223 rValue >>= m_pImpl->m_pProps->nFormat;
2224 m_pImpl->m_pProps->bFormatIsDefault = false;
2225 break;
2226 case FIELD_PROP_SUBTYPE:
2227 m_pImpl->m_pProps->nSubType = SWUnoHelper::GetEnumAsInt32(rValue);
2228 break;
2229 case FIELD_PROP_BYTE1 :
2230 rValue >>= m_pImpl->m_pProps->nByte1;
2231 break;
2232 case FIELD_PROP_BOOL1 :
2233 pBool = &m_pImpl->m_pProps->bBool1;
2234 break;
2235 case FIELD_PROP_BOOL2 :
2236 pBool = &m_pImpl->m_pProps->bBool2;
2237 break;
2238 case FIELD_PROP_BOOL3 :
2239 pBool = &m_pImpl->m_pProps->bBool3;
2240 break;
2241 case FIELD_PROP_BOOL4:
2242 pBool = &m_pImpl->m_pProps->bBool4;
2243 break;
2244 case FIELD_PROP_DATE :
2245 {
2246 auto aTemp = o3tl::tryAccess<util::Date>(rValue);
2247 if(!aTemp)
2248 throw lang::IllegalArgumentException();
2249
2250 m_pImpl->m_pProps->aDate = Date(aTemp->Day, aTemp->Month, aTemp->Year);
2251 }
2252 break;
2253 case FIELD_PROP_USHORT1:
2254 case FIELD_PROP_USHORT2:
2255 {
2256 sal_Int16 nVal = 0;
2257 rValue >>= nVal;
2258 if( FIELD_PROP_USHORT1 == pEntry->nWID)
2259 m_pImpl->m_pProps->nUSHORT1 = nVal;
2260 else
2261 m_pImpl->m_pProps->nUSHORT2 = nVal;
2262 }
2263 break;
2264 case FIELD_PROP_SHORT1:
2265 rValue >>= m_pImpl->m_pProps->nSHORT1;
2266 break;
2267 case FIELD_PROP_DOUBLE:
2268 if(rValue.getValueType() != ::cppu::UnoType<double>::get())
2269 throw lang::IllegalArgumentException();
2270 rValue >>= m_pImpl->m_pProps->fDouble;
2271 break;
2272
2274 if (!m_pImpl->m_pProps->pDateTime)
2275 m_pImpl->m_pProps->pDateTime.reset( new util::DateTime );
2276 rValue >>= *m_pImpl->m_pProps->pDateTime;
2277 break;
2279 rValue >>= m_pImpl->m_pProps->aPropSeq;
2280 break;
2281 case FIELD_PROP_STRINGS:
2282 rValue >>= m_pImpl->m_pProps->aStrings;
2283 break;
2284 }
2285 if (pBool)
2286 {
2287 auto b = o3tl::tryAccess<bool>(rValue);
2288 if( !b )
2289 throw lang::IllegalArgumentException();
2290 *pBool = *b;
2291
2292 }
2293 }
2294 else
2295 throw uno::RuntimeException();
2296}
2297
2298uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName)
2299{
2300 SolarMutexGuard aGuard;
2301 uno::Any aRet;
2302 SwField const*const pField = m_pImpl->GetField();
2304 lcl_GetPropertyMapOfService(m_pImpl->m_nServiceId));
2305 const SfxItemPropertyMapEntry* pEntry = _pPropSet->getPropertyMap().getByName(rPropertyName);
2306 if(!pEntry )
2307 {
2309 pEntry = _pParaPropSet->getPropertyMap().getByName(rPropertyName);
2310 }
2311 if (!pEntry)
2312 throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2313
2314 switch( pEntry->nWID )
2315 {
2316 case FN_UNO_TEXT_WRAP:
2317 aRet <<= text::WrapTextMode_NONE;
2318 break;
2319 case FN_UNO_ANCHOR_TYPE:
2320 aRet <<= text::TextContentAnchorType_AS_CHARACTER;
2321 break;
2323 {
2324 uno::Sequence<text::TextContentAnchorType> aTypes { text::TextContentAnchorType_AS_CHARACTER };
2325 aRet <<= aTypes;
2326 }
2327 break;
2328
2329 default:
2330 if( pField )
2331 {
2332 if (FIELD_PROP_IS_FIELD_USED == pEntry->nWID ||
2334 {
2335 bool bIsFieldUsed = false;
2336 bool bIsFieldDisplayed = false;
2337
2338 // in order to have the information about fields
2339 // correctly evaluated the document needs a layout
2340 // (has to be already formatted)
2341 SwDoc *pDoc = m_pImpl->m_pDoc;
2342 SwViewShell *pViewShell = nullptr;
2343 SwEditShell *pEditShell = nullptr;
2344 if( pDoc )
2345 {
2346 pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
2347 pEditShell = pDoc->GetEditShell();
2348 }
2349
2350 if (pEditShell)
2351 pEditShell->CalcLayout();
2352 else if (pViewShell) // a page preview has no SwEditShell it should only have a view shell
2353 pViewShell->CalcLayout();
2354 else
2355 throw uno::RuntimeException();
2356
2357 // get text node for the text field
2358 const SwFormatField *pFieldFormat =
2359 (m_pImpl->GetField()) ? m_pImpl->GetFormatField() : nullptr;
2360 const SwTextField* pTextField = pFieldFormat
2361 ? m_pImpl->GetFormatField()->GetTextField() : nullptr;
2362 if(!pTextField)
2363 throw uno::RuntimeException();
2364 const SwTextNode& rTextNode = pTextField->GetTextNode();
2365
2366 // skip fields that are currently not in the document
2367 // e.g. fields in undo or redo array
2368 if (rTextNode.GetNodes().IsDocNodes())
2369 {
2370 bool bFrame = 0 != rTextNode.FindLayoutRect().Width(); // or so
2371 bool bHidden = rTextNode.IsHidden();
2372 if ( !bHidden )
2373 {
2374 sal_Int32 nHiddenStart;
2375 sal_Int32 nHiddenEnd;
2376 bHidden = SwScriptInfo::GetBoundsOfHiddenRange( pTextField->GetTextNode(),
2377 pTextField->GetStart(),
2378 nHiddenStart, nHiddenEnd );
2379 }
2380
2381 // !bFrame && !bHidden: most probably a field in an unused page style
2382
2383 // FME: Problem: hidden field in unused page template =>
2384 // bIsFieldUsed = true
2385 // bIsFieldDisplayed = false
2386 bIsFieldUsed = bFrame || bHidden;
2387 bIsFieldDisplayed = bIsFieldUsed && !bHidden;
2388 }
2389 aRet <<= (FIELD_PROP_IS_FIELD_USED == pEntry->nWID) ? bIsFieldUsed : bIsFieldDisplayed;
2390 }
2391 else
2392 pField->QueryValue( aRet, pEntry->nWID );
2393 }
2394 else if (m_pImpl->m_pProps) // currently just a descriptor...
2395 {
2396 switch(pEntry->nWID)
2397 {
2398 case FIELD_PROP_TEXT:
2399 {
2400 if (!m_pImpl->m_xTextObject.is())
2401 {
2402 m_pImpl->m_xTextObject
2403 = new SwTextAPIObject( std::make_unique<SwTextAPIEditSource>(m_pImpl->m_pDoc) );
2404 }
2405
2406 uno::Reference<text::XText> xText(m_pImpl->m_xTextObject);
2407 aRet <<= xText;
2408 break;
2409 }
2410 case FIELD_PROP_PAR1:
2411 aRet <<= m_pImpl->m_pProps->sPar1;
2412 break;
2413 case FIELD_PROP_PAR2:
2414 aRet <<= m_pImpl->m_pProps->sPar2;
2415 break;
2416 case FIELD_PROP_PAR3:
2417 aRet <<= m_pImpl->m_pProps->sPar3;
2418 break;
2419 case FIELD_PROP_PAR4:
2420 aRet <<= m_pImpl->m_pProps->sPar4;
2421 break;
2422 case FIELD_PROP_FORMAT:
2423 aRet <<= m_pImpl->m_pProps->nFormat;
2424 break;
2425 case FIELD_PROP_SUBTYPE:
2426 aRet <<= m_pImpl->m_pProps->nSubType;
2427 break;
2428 case FIELD_PROP_BYTE1 :
2429 aRet <<= m_pImpl->m_pProps->nByte1;
2430 break;
2431 case FIELD_PROP_BOOL1 :
2432 aRet <<= m_pImpl->m_pProps->bBool1;
2433 break;
2434 case FIELD_PROP_BOOL2 :
2435 aRet <<= m_pImpl->m_pProps->bBool2;
2436 break;
2437 case FIELD_PROP_BOOL3 :
2438 aRet <<= m_pImpl->m_pProps->bBool3;
2439 break;
2440 case FIELD_PROP_BOOL4 :
2441 aRet <<= m_pImpl->m_pProps->bBool4;
2442 break;
2443 case FIELD_PROP_DATE :
2444 aRet <<= m_pImpl->m_pProps->aDate.GetUNODate();
2445 break;
2446 case FIELD_PROP_USHORT1:
2447 aRet <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT1);
2448 break;
2449 case FIELD_PROP_USHORT2:
2450 aRet <<= static_cast<sal_Int16>(m_pImpl->m_pProps->nUSHORT2);
2451 break;
2452 case FIELD_PROP_SHORT1:
2453 aRet <<= m_pImpl->m_pProps->nSHORT1;
2454 break;
2455 case FIELD_PROP_DOUBLE:
2456 aRet <<= m_pImpl->m_pProps->fDouble;
2457 break;
2459 if (m_pImpl->m_pProps->pDateTime)
2460 aRet <<= *m_pImpl->m_pProps->pDateTime;
2461 break;
2463 aRet <<= m_pImpl->m_pProps->aPropSeq;
2464 break;
2465 case FIELD_PROP_STRINGS:
2466 aRet <<= m_pImpl->m_pProps->aStrings;
2467 break;
2470 aRet <<= false;
2471 break;
2472 }
2473 }
2474 else
2475 throw uno::RuntimeException();
2476 }
2477 return aRet;
2478}
2479
2480void SwXTextField::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
2481{
2482 OSL_FAIL("not implemented");
2483}
2484
2485void SwXTextField::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
2486{
2487 OSL_FAIL("not implemented");
2488}
2489
2490void SwXTextField::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2491{
2492 OSL_FAIL("not implemented");
2493}
2494
2495void SwXTextField::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2496{
2497 OSL_FAIL("not implemented");
2498}
2499
2501{
2502 SolarMutexGuard aGuard;
2503 SwField * pField = const_cast<SwField*>(m_pImpl->GetField());
2504 if (pField)
2505 {
2506 switch(pField->Which())
2507 {
2509 static_cast<SwDateTimeField*>(pField)->SetDateTime( ::DateTime( ::DateTime::SYSTEM ) );
2510 break;
2511
2513 {
2514 SwExtUserField* pExtUserField = static_cast<SwExtUserField*>(pField);
2516 pExtUserField->GetSubType() ) );
2517 }
2518 break;
2519
2520 case SwFieldIds::Author:
2521 {
2522 SwAuthorField* pAuthorField = static_cast<SwAuthorField*>(pField);
2524 pAuthorField->GetFormat() ) );
2525 }
2526 break;
2527
2529 {
2530 SwFileNameField* pFileNameField = static_cast<SwFileNameField*>(pField);
2531 pFileNameField->SetExpansion( static_cast<SwFileNameFieldType*>(pField->GetTyp())->Expand(
2532 pFileNameField->GetFormat() ) );
2533 }
2534 break;
2535
2537 {
2538 SwDocInfoField* pDocInfField = static_cast<SwDocInfoField*>(pField);
2539 pDocInfField->SetExpansion( static_cast<SwDocInfoFieldType*>(pField->GetTyp())->Expand(
2540 pDocInfField->GetSubType(),
2541 pDocInfField->GetFormat(),
2542 pDocInfField->GetLanguage(),
2543 pDocInfField->GetName() ) );
2544 }
2545 break;
2546 default: break;
2547 }
2548 // Text formatting has to be triggered.
2549 m_pImpl->GetFormatField()->UpdateTextNode(nullptr, nullptr);
2550 }
2551 else
2552 m_pImpl->m_bCallUpdate = true;
2553}
2554
2556{
2557 return "SwXTextField";
2558}
2559
2560static OUString OldNameToNewName_Impl( const OUString &rOld )
2561{
2562 static const char aOldNamePart1[] = ".TextField.DocInfo.";
2563 static const char aOldNamePart2[] = ".TextField.";
2564 OUString sServiceNameCC( rOld );
2565 sal_Int32 nIdx = sServiceNameCC.indexOf( aOldNamePart1 );
2566 if (nIdx >= 0)
2567 sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart1), u".textfield.docinfo." );
2568 nIdx = sServiceNameCC.indexOf( aOldNamePart2 );
2569 if (nIdx >= 0)
2570 sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart2), u".textfield." );
2571 return sServiceNameCC;
2572}
2573
2574sal_Bool SAL_CALL SwXTextField::supportsService(const OUString& rServiceName)
2575{
2576 return cppu::supportsService(this, rServiceName);
2577}
2578
2579uno::Sequence< OUString > SAL_CALL SwXTextField::getSupportedServiceNames()
2580{
2581 const OUString sServiceName =
2583
2584 // case-corrected version of service-name (see #i67811)
2585 // (need to supply both because of compatibility to older versions)
2586 const OUString sServiceNameCC( OldNameToNewName_Impl( sServiceName ) );
2587 sal_Int32 nLen = sServiceName == sServiceNameCC ? 2 : 3;
2588
2589 uno::Sequence< OUString > aRet( nLen );
2590 OUString* pArray = aRet.getArray();
2591 *pArray++ = sServiceName;
2592 if (nLen == 3)
2593 *pArray++ = sServiceNameCC;
2594 *pArray++ = "com.sun.star.text.TextContent";
2595 return aRet;
2596}
2597
2599{
2601 m_pFormatField = nullptr;
2602 m_pDoc = nullptr;
2603 uno::Reference<uno::XInterface> const xThis(m_wThis);
2604 if (!xThis.is())
2605 { // fdo#72695: if UNO object is already dead, don't revive it with event
2606 return;
2607 }
2608 lang::EventObject const ev(xThis);
2609 std::unique_lock aGuard(m_Mutex);
2611}
2612
2614{
2615
2616 if(rHint.GetId() == SfxHintId::Dying)
2617 Invalidate();
2618 else if (rHint.GetId() == SfxHintId::SwLegacyModify)
2619 {
2620 auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
2621 switch(pLegacyHint->m_pOld ? pLegacyHint->m_pOld->Which() : 0)
2622 {
2624 case RES_OBJECTDYING:
2625 Invalidate();
2626 break;
2627 }
2628 }
2629}
2630
2632{
2633 return m_pFormatField ? m_pFormatField->GetField() : nullptr;
2634}
2635
2637{
2638 return "SwXTextFieldMasters";
2639}
2640
2642{
2643 return cppu::supportsService(this, rServiceName);
2644}
2645
2647{
2648 uno::Sequence<OUString> aRet { "com.sun.star.text.TextFieldMasters" };
2649 return aRet;
2650}
2651
2653 SwUnoCollection(_pDoc)
2654{
2655}
2656
2658{
2659
2660}
2661
2662/*
2663 Iteration over non-standard field types
2664 USER/SETEXP/DDE/DATABASE
2665 Thus the names are:
2666 "com.sun.star.text.fieldmaster.User" + <field type name>
2667 "com.sun.star.text.fieldmaster.DDE" + <field type name>
2668 "com.sun.star.text.fieldmaster.SetExpression" + <field type name>
2669 "com.sun.star.text.fieldmaster.DataBase" + <field type name>
2670
2671 If too much, maybe one could leave out the "com.sun.star.text".
2672 */
2673static SwFieldIds lcl_GetIdByName( OUString& rName, OUString& rTypeName )
2674{
2675 if (rName.startsWithIgnoreAsciiCase(COM_TEXT_FLDMASTER_CC))
2676 rName = rName.copy(COM_TEXT_FLDMASTER_CC.getLength());
2677
2679 sal_Int32 nIdx = 0;
2680 rTypeName = rName.getToken( 0, '.', nIdx );
2681 if (rTypeName == "User")
2682 nResId = SwFieldIds::User;
2683 else if (rTypeName == "DDE")
2684 nResId = SwFieldIds::Dde;
2685 else if (rTypeName == "SetExpression")
2686 {
2687 nResId = SwFieldIds::SetExp;
2688
2689 const OUString sFieldTypName( rName.getToken( 0, '.', nIdx ));
2690 const OUString sUIName( SwStyleNameMapper::GetSpecialExtraUIName( sFieldTypName ) );
2691
2692 if( sUIName != sFieldTypName )
2693 rName = comphelper::string::setToken(rName, 1, '.', sUIName);
2694 }
2695 else if (rTypeName.equalsIgnoreAsciiCase("DataBase"))
2696 {
2697 rName = rName.copy(RTL_CONSTASCII_LENGTH("DataBase."));
2698 if (!rName.isEmpty())
2699 {
2700 // #i51815#
2701 rName = "DataBase." + rName;
2702 nResId = SwFieldIds::Database;
2703 }
2704 }
2705 else if (rTypeName == "Bibliography")
2707 return nResId;
2708}
2709
2711{
2712 SolarMutexGuard aGuard;
2713 if(!GetDoc())
2714 throw uno::RuntimeException();
2715
2716 OUString sName(rName), sTypeName;
2717 const SwFieldIds nResId = lcl_GetIdByName( sName, sTypeName );
2718 if( SwFieldIds::Unknown == nResId )
2719 throw container::NoSuchElementException(
2720 "SwXTextFieldMasters::getByName(" + rName + ")",
2721 css::uno::Reference<css::uno::XInterface>());
2722
2723 sName = sName.copy(std::min(sTypeName.getLength()+1, sName.getLength()));
2724 SwFieldType* pType = GetDoc()->getIDocumentFieldsAccess().GetFieldType(nResId, sName, true);
2725 if(!pType)
2726 throw container::NoSuchElementException(
2727 "SwXTextFieldMasters::getByName(" + rName + ")",
2728 css::uno::Reference<css::uno::XInterface>());
2729
2730 uno::Reference<beans::XPropertySet> const xRet(
2732 return uno::Any(xRet);
2733}
2734
2736 const SwFieldType& rFieldType, OUString& rName)
2737{
2738 OUString sField;
2739
2740 switch( rFieldType.Which() )
2741 {
2742 case SwFieldIds::User:
2743 sField = "User." + rFieldType.GetName();
2744 break;
2745 case SwFieldIds::Dde:
2746 sField = "DDE." + rFieldType.GetName();
2747 break;
2748
2749 case SwFieldIds::SetExp:
2750 sField = "SetExpression." + SwStyleNameMapper::GetSpecialExtraProgName( rFieldType.GetName() );
2751 break;
2752
2754 sField = "DataBase." + rFieldType.GetName().replaceAll(OUStringChar(DB_DELIM), ".");
2755 break;
2756
2758 sField = "Bibliography";
2759 break;
2760
2761 default:
2762 return false;
2763 }
2764
2765 rName += COM_TEXT_FLDMASTER_CC + sField;
2766 return true;
2767}
2768
2769uno::Sequence< OUString > SwXTextFieldMasters::getElementNames()
2770{
2771 SolarMutexGuard aGuard;
2772 if(!GetDoc())
2773 throw uno::RuntimeException();
2774
2775 const SwFieldTypes* pFieldTypes = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes();
2776 const size_t nCount = pFieldTypes->size();
2777
2778 std::vector<OUString> aFieldNames;
2779 for( size_t i = 0; i < nCount; ++i )
2780 {
2781 SwFieldType& rFieldType = *((*pFieldTypes)[i]);
2782
2783 OUString sFieldName;
2784 if (SwXTextFieldMasters::getInstanceName(rFieldType, sFieldName))
2785 {
2786 aFieldNames.push_back(sFieldName);
2787 }
2788 }
2789
2791}
2792
2794{
2795 SolarMutexGuard aGuard;
2796 if(!GetDoc())
2797 throw uno::RuntimeException();
2798
2799 OUString sName(rName), sTypeName;
2800 const SwFieldIds nResId = lcl_GetIdByName( sName, sTypeName );
2801 bool bRet = false;
2802 if( SwFieldIds::Unknown != nResId )
2803 {
2804 sName = sName.copy(std::min(sTypeName.getLength()+1, sName.getLength()));
2805 bRet = nullptr != GetDoc()->getIDocumentFieldsAccess().GetFieldType(nResId, sName, true);
2806 }
2807 return bRet;
2808}
2809
2811{
2813
2814}
2815
2817{
2818 SolarMutexGuard aGuard;
2819 if(!IsValid())
2820 throw uno::RuntimeException();
2821 return true;
2822}
2823
2825{
2826public:
2827 std::mutex m_Mutex; // just for OInterfaceContainerHelper3
2829};
2830
2832{
2833 return "SwXTextFieldTypes";
2834}
2835
2837{
2838 return cppu::supportsService(this, rServiceName);
2839}
2840
2842{
2843 uno::Sequence<OUString> aRet { "com.sun.star.text.TextFields" };
2844 return aRet;
2845}
2846
2848 : SwUnoCollection (_pDoc)
2849 , m_pImpl(new Impl)
2850{
2851}
2852
2854{
2855}
2856
2858{
2860 lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
2861 std::unique_lock aGuard(m_pImpl->m_Mutex);
2862 m_pImpl->m_RefreshListeners.disposeAndClear(aGuard, ev);
2863}
2864
2865uno::Reference< container::XEnumeration > SwXTextFieldTypes::createEnumeration()
2866{
2867 SolarMutexGuard aGuard;
2868 if(!IsValid())
2869 throw uno::RuntimeException();
2870 return new SwXFieldEnumeration(*GetDoc());
2871}
2872
2874{
2876}
2877
2879{
2880 SolarMutexGuard aGuard;
2881 if(!IsValid())
2882 throw uno::RuntimeException();
2883 return true; // they always exist
2884}
2885
2887{
2888 {
2889 SolarMutexGuard aGuard;
2890 if (!IsValid())
2891 throw uno::RuntimeException();
2892 UnoActionContext aContext(GetDoc());
2893 GetDoc()->getIDocumentStatistics().UpdateDocStat( false, true );
2895 }
2896 // call refresh listeners (without SolarMutex locked)
2897 lang::EventObject const event(static_cast< ::cppu::OWeakObject*>(this));
2898 std::unique_lock aGuard(m_pImpl->m_Mutex);
2899 m_pImpl->m_RefreshListeners.notifyEach(aGuard,
2900 & util::XRefreshListener::refreshed, event);
2901}
2902
2904 const uno::Reference<util::XRefreshListener> & xListener)
2905{
2906 std::unique_lock aGuard(m_pImpl->m_Mutex);
2907 m_pImpl->m_RefreshListeners.addInterface(aGuard, xListener);
2908}
2909
2911 const uno::Reference<util::XRefreshListener> & xListener)
2912{
2913 std::unique_lock aGuard(m_pImpl->m_Mutex);
2914 m_pImpl->m_RefreshListeners.removeInterface(aGuard, xListener);
2915}
2916
2918 : public SvtListener
2919{
2920public:
2922 std::vector<uno::Reference<text::XTextField>> m_Items;
2923 sal_Int32 m_nNextIndex;
2924
2925 explicit Impl(SwDoc& rDoc)
2926 : m_pDoc(&rDoc)
2927 , m_nNextIndex(0)
2928 {
2930 }
2931
2932 virtual void Notify(const SfxHint& rHint) override
2933 {
2934 if(rHint.GetId() == SfxHintId::Dying)
2935 m_pDoc = nullptr;
2936 }
2937};
2938
2939OUString SAL_CALL
2941{
2942 return "SwXFieldEnumeration";
2943}
2944
2945sal_Bool SAL_CALL SwXFieldEnumeration::supportsService(const OUString& rServiceName)
2946{
2947 return cppu::supportsService(this, rServiceName);
2948}
2949
2950uno::Sequence<OUString> SAL_CALL
2952{
2953 return { "com.sun.star.text.FieldEnumeration" };
2954}
2955
2957 : m_pImpl(new Impl(rDoc))
2958{
2959 // build sequence
2960 m_pImpl->m_Items.clear();
2961
2962 const SwFieldTypes* pFieldTypes = m_pImpl->m_pDoc->getIDocumentFieldsAccess().GetFieldTypes();
2963 const size_t nCount = pFieldTypes->size();
2964 for(size_t nType = 0; nType < nCount; ++nType)
2965 {
2966 const SwFieldType* pCurType = (*pFieldTypes)[nType].get();
2967 std::vector<SwFormatField*> vFormatFields;
2968 pCurType->GatherFields(vFormatFields);
2969 std::for_each(vFormatFields.begin(), vFormatFields.end(),
2970 [this](SwFormatField* pF) { m_pImpl->m_Items.push_back(SwXTextField::CreateXTextField(m_pImpl->m_pDoc, pF)); });
2971 }
2972 // now handle meta-fields, which are not SwFields
2973 const std::vector< uno::Reference<text::XTextField> > MetaFields(
2974 m_pImpl->m_pDoc->GetMetaFieldManager().getMetaFields() );
2975 for (const auto & rMetaField : MetaFields)
2976 {
2977 m_pImpl->m_Items.push_back( rMetaField );
2978 }
2979 // also add fieldmarks
2980 IDocumentMarkAccess& rMarksAccess(*rDoc.getIDocumentMarkAccess());
2981 for (auto iter = rMarksAccess.getFieldmarksBegin(); iter != rMarksAccess.getFieldmarksEnd(); ++iter)
2982 {
2983 m_pImpl->m_Items.emplace_back(static_cast<cppu::OWeakObject*>(SwXFieldmark::CreateXFieldmark(rDoc, *iter).get()), uno::UNO_QUERY);
2984 }
2985}
2986
2988{
2989}
2990
2992{
2993 SolarMutexGuard aGuard;
2994
2995 return m_pImpl->m_nNextIndex < static_cast<sal_Int32>(m_pImpl->m_Items.size());
2996}
2997
2999{
3000 SolarMutexGuard aGuard;
3001
3002 if (m_pImpl->m_nNextIndex >= static_cast<sal_Int32>(m_pImpl->m_Items.size()))
3003 throw container::NoSuchElementException(
3004 "SwXFieldEnumeration::nextElement",
3005 css::uno::Reference<css::uno::XInterface>());
3006
3007 uno::Reference< text::XTextField > &rxField =
3008 m_pImpl->m_Items[ m_pImpl->m_nNextIndex++ ];
3009 uno::Any aRet;
3010 aRet <<= rxField;
3011 rxField = nullptr; // free memory for item that is no longer used
3012 return aRet;
3013}
3014
3015/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
constexpr OUStringLiteral sServiceName
Definition: accdoc.cxx:54
const char *const aFieldNames[]
Definition: authfld.cxx:650
Text operation/manipulation interface.
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
virtual const SwFieldTypes * GetFieldTypes() const =0
virtual void UpdateFields(bool bCloseDB)=0
virtual void PutValueToField(const SwPosition &rPos, const css::uno::Any &rVal, sal_uInt16 nWhich)=0
Puts a value into a field at a certain position.
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getAnnotationMarksEnd() const =0
virtual const_iterator_t getFieldmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of fieldmarks.
virtual const_iterator_t getAnnotationMarksBegin() const =0
virtual const_iterator_t getFieldmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of fieldmarks.
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
virtual void SetModified()=0
Must be called manually at changes of format.
virtual void UpdateDocStat(bool bCompleteAsync, bool bFields)=0
Updates the internal document's statistics.
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
INetProtocol GetProtocol() const
bool SetURL(std::u16string_view rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
virtual const SwDoc * GetDoc() const =0
SfxHintId GetId() const
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
const SfxItemPropertyMap & getPropertyMap() const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
sal_uInt16 Which() const
void EndListeningAll()
bool StartListening(SvtBroadcaster &rBroadcaster)
static OUString Expand(sal_uLong)
Definition: docufld.cxx:313
void SetExpansion(const OUString &rStr)
Definition: docufld.hxx:198
invariant for SwAuthorityField is that it is always registered at its SwAuthorityFieldType via AddFie...
Definition: authfld.hxx:155
void SetLevel(sal_uInt8)
Definition: chpfld.cxx:86
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: node.cxx:1232
virtual sal_uInt16 GetSubType() const override
Definition: dbfld.cxx:348
void SetSetNumber(tools::Long nNum)
Definition: dbfld.hxx:286
void SetOffset(tools::Long nMinutes)
Definition: flddat.hxx:65
void SetExpansion(const OUString &rStr)
Definition: docufld.hxx:541
const OUString & GetName() const
Definition: docufld.hxx:539
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:1141
Definition: doc.hxx:192
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:395
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:316
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:358
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:330
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:406
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1793
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:427
IDocumentStatistics const & getIDocumentStatistics() const
Definition: doc.cxx:374
Field type for dropdown boxes.
Definition: flddropdown.hxx:32
Dropdown field.
Definition: flddropdown.hxx:59
void SetSelectedItem(const OUString &rItem)
Sets the selected item.
void SetToolTip(const OUString &rToolTip)
Sets the tool tip of the field.
void SetItems(std::vector< OUString > &&rItems)
Sets the items of the dropdown box.
void SetHelp(const OUString &rHelp)
Sets the help text of the field.
void SetName(const OUString &rName)
Sets the name of the field.
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
static OUString Expand(sal_uInt16 nSubType)
Definition: docufld.cxx:1973
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:2030
void SetExpansion(const OUString &rStr)
Definition: docufld.hxx:570
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:242
virtual void UpdateFields()
Definition: fldbas.cxx:213
SAL_DLLPRIVATE void SetXObject(css::uno::Reference< css::beans::XPropertySet > const &xFieldMaster)
Definition: fldbas.hxx:261
SAL_DLLPRIVATE css::uno::WeakReference< css::beans::XPropertySet > const & GetXObject() const
Definition: fldbas.hxx:258
virtual OUString GetName() const
Only in derived classes.
Definition: fldbas.cxx:137
virtual void QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const
Definition: fldbas.cxx:142
virtual void PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich)
Definition: fldbas.cxx:145
SwFieldIds Which() const
Definition: fldbas.hxx:273
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:203
Base class of all fields.
Definition: fldbas.hxx:292
virtual sal_uInt16 GetSubType() const
Definition: fldbas.cxx:342
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:403
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:351
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
Definition: fldbas.cxx:484
virtual OUString GetFieldName() const
get name or content
Definition: fldbas.cxx:305
SwFieldType * GetTyp() const
Definition: fldbas.hxx:398
SwFieldIds Which() const
ResId.
Definition: fldbas.cxx:250
LanguageType GetLanguage() const
Language at field position.
Definition: fldbas.hxx:408
void SetExpansion(const OUString &rStr)
Definition: docufld.hxx:224
const SwField * GetField() const
Definition: fmtfld.hxx:130
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:148
SAL_DLLPRIVATE unotools::WeakReference< SwXTextField > const & GetXTextField() const
Definition: fmtfld.hxx:163
void ChgExpStr(const OUString &rExpand, SwRootFrame const *pLayout)
Definition: expfld.cxx:295
void SetLateInitialization()
Definition: expfld.hxx:135
Get reference.
Definition: reffld.hxx:66
void SetHidden(bool bHidden)
Definition: docufld.hxx:375
void SetValue(bool bHidden)
Definition: docufld.hxx:331
void SetToolTip(const OUString &rStr)
Definition: expfld.cxx:1423
void SetHelp(const OUString &rStr)
Definition: expfld.cxx:1413
static void CreateMacroString(OUString &rMacro, std::u16string_view rMacroName, const OUString &rLibraryName)
create an internally used macro name from the library and macro name parts
Definition: macrofld.cxx:196
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:876
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:721
SwDoc & GetDoc()
Definition: node.hxx:217
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
Definition: nodes.cxx:2531
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
SwNode & GetPointNode() const
Definition: pam.hxx:283
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:612
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:638
const SwPosition * End() const
Definition: pam.hxx:271
SwDoc & GetDoc() const
Definition: pam.hxx:299
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const SwPosition * Start() const
Definition: pam.hxx:266
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
void SetUserString(const OUString &rS)
Definition: docufld.hxx:176
const OUString & GetName() const
Definition: docufld.hxx:496
void SetTextObject(std::optional< OutlinerParaObject > pText)
Definition: docufld.cxx:1830
virtual void SetPar2(const OUString &rStr) override
set the PostIt's text
Definition: docufld.cxx:1812
void Width(tools::Long nNew)
Definition: swrect.hxx:189
void SetText(const OUString &rText, SwRootFrame const *pLayout)
Definition: docufld.cxx:2334
static bool GetBoundsOfHiddenRange(const SwTextNode &rNode, sal_Int32 nPos, sal_Int32 &rnStartPos, sal_Int32 &rnEndPos, std::vector< sal_Int32 > *pList=nullptr)
Hidden text range information - static and non-version.
Definition: porlay.cxx:2035
sal_uInt16 GetType() const
Definition: expfld.hxx:198
void SetOutlineLvl(sal_uInt8 n)
Definition: expfld.hxx:184
void SetDelimiter(const OUString &s)
Definition: expfld.hxx:182
void ChgExpStr(const OUString &rExpand, SwRootFrame const *pLayout)
Definition: expfld.cxx:540
void SetInputFlag(bool bInp)
Definition: expfld.hxx:266
SwFormatField * GetFormatField()
Definition: expfld.hxx:224
void SetPromptText(const OUString &rStr)
Definition: expfld.hxx:260
void SetSeqNumber(sal_uInt16 n)
Logical number, sequence fields.
Definition: expfld.hxx:247
bool GetInputFlag() const
Definition: expfld.hxx:269
static const std::vector< OUString > & GetExtraUINameArray()
static const OUString & GetProgName(const OUString &rName, SwGetPoolIdFromName)
static SW_DLLPUBLIC const OUString & GetSpecialExtraProgName(const OUString &rExtraUIName)
static const OUString & GetSpecialExtraUIName(const OUString &rExtraProgName)
Implementation in tblcalc.cxx.
Definition: expfld.hxx:374
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
sal_uInt16 Which() const
Definition: txatbase.hxx:116
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:199
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
static void DeleteTextField(const SwTextField &rTextField)
Definition: atrfld.cxx:628
static void GetPamForTextField(const SwTextField &rTextField, std::shared_ptr< SwPaM > &rPamForTextField)
Definition: atrfld.cxx:608
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:86
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1808
bool IsHidden() const
Definition: ndtxt.cxx:4673
SwDoc * GetDoc() const
Definition: unocoll.hxx:59
bool IsValid() const
Definition: unocoll.hxx:57
virtual void Invalidate()
Definition: unocoll.cxx:1941
o3tl::span< const SfxItemPropertyMapEntry > GetPropertyMapEntries(sal_uInt16 PropertyId)
Definition: unomap.cxx:71
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1066
The shared part of a user field.
Definition: usrfld.hxx:35
sal_uInt16 GetType() const
Definition: usrfld.hxx:87
The non-shared part of a user field.
Definition: usrfld.hxx:103
virtual void SetValue(const double &rVal)
Definition: fldbas.cxx:750
virtual void CalcLayout()
Definition: viewsh.cxx:1082
std::vector< uno::Reference< text::XTextField > > m_Items
Definition: unofield.cxx:2922
sal_Int32 m_nNextIndex
index of next element to be returned
Definition: unofield.cxx:2923
virtual void Notify(const SfxHint &rHint) override
Definition: unofield.cxx:2932
virtual ~SwXFieldEnumeration() override
Definition: unofield.cxx:2987
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:2951
virtual sal_Bool SAL_CALL hasMoreElements() override
Definition: unofield.cxx:2991
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:2945
virtual css::uno::Any SAL_CALL nextElement() override
Definition: unofield.cxx:2998
SwXFieldEnumeration(SwDoc &rDoc)
Definition: unofield.cxx:2956
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:2940
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:221
unotools::WeakReference< SwXFieldMaster > m_wThis
Definition: unofield.cxx:410
Impl(SwPageDesc *const pPageDesc, SwDoc *pDoc, SwFieldIds nResId)
Definition: unofield.cxx:427
virtual void Notify(const SfxHint &rHint) override
Definition: unofield.cxx:983
void SetFieldType(SwFieldType *pType)
Definition: unofield.cxx:450
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_EventListeners
Definition: unofield.cxx:411
SwFieldIds m_nResTypeId
Definition: unofield.cxx:416
Impl(SwFieldType *const pType, SwDoc *pDoc, SwFieldIds nResId)
Definition: unofield.cxx:439
std::mutex m_Mutex
Definition: unofield.cxx:408
SwFieldType * m_pType
Definition: unofield.cxx:414
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:931
static OUString LocalizeFormula(const SwSetExpField &rField, const OUString &rFormula, bool bQuery)
Definition: unofield.cxx:1017
virtual ~SwXFieldMaster() override
Definition: unofield.cxx:531
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:969
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:510
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:473
static rtl::Reference< SwXFieldMaster > CreateXFieldMaster(SwDoc *pDoc, SwFieldType *pType, SwFieldIds nResId=SwFieldIds::Unknown)
Definition: unofield.cxx:536
SwXFieldMaster(SwFieldType &rType, SwDoc *pDoc)
Definition: unofield.cxx:526
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:976
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unofield.cxx:460
SwFieldType * GetFieldType(bool bDontCreate=false) const
Definition: unofield.cxx:776
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:51
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unofield.cxx:571
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unofield.cxx:562
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:516
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:926
static OUString GetProgrammaticName(const SwFieldType &rType, SwDoc &rDoc)
Definition: unofield.cxx:1000
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unofield.cxx:467
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unofield.cxx:802
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:936
virtual void SAL_CALL dispose() override
Definition: unofield.cxx:946
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:941
static rtl::Reference< SwXBookmark > CreateXFieldmark(SwDoc &rDoc, ::sw::mark::IMark *pMark, bool isReplacementObject=false)
Definition: unobkm.cxx:689
static OUString GetProviderName(SwServiceType nObjectType)
Definition: unocoll.cxx:476
bool IsAtEndOfMeta() const
Definition: unoobj.cxx:856
SwXTextFieldMasters(SwDoc *pDoc)
Definition: unofield.cxx:2652
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:2636
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:2646
virtual sal_Bool SAL_CALL hasByName(const OUString &rName) override
Definition: unofield.cxx:2793
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unofield.cxx:2810
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:2641
virtual sal_Bool SAL_CALL hasElements() override
Definition: unofield.cxx:2816
virtual ~SwXTextFieldMasters() override
Definition: unofield.cxx:2657
virtual css::uno::Any SAL_CALL getByName(const OUString &rName) override
Definition: unofield.cxx:2710
static bool getInstanceName(const SwFieldType &rFieldType, OUString &rName)
Definition: unofield.cxx:2735
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unofield.cxx:2769
::comphelper::OInterfaceContainerHelper4< util::XRefreshListener > m_RefreshListeners
Definition: unofield.cxx:2828
SwXTextFieldTypes(SwDoc *pDoc)
Definition: unofield.cxx:2847
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &xListener) override
Definition: unofield.cxx:2910
virtual void SAL_CALL refresh() override
Definition: unofield.cxx:2886
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &xListener) override
Definition: unofield.cxx:2903
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:2831
virtual void Invalidate() override
Definition: unofield.cxx:2857
std::unique_ptr< Impl > m_pImpl
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unofield.cxx:2865
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:2841
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:2836
virtual sal_Bool SAL_CALL hasElements() override
Definition: unofield.cxx:2878
virtual ~SwXTextFieldTypes() override
Definition: unofield.cxx:2853
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unofield.cxx:2873
virtual ~Impl() override
Definition: unofield.cxx:1116
OUString m_sTypeName
Definition: unofield.cxx:1098
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_EventListeners
Definition: unofield.cxx:1091
SwFormatField * m_pFormatField
Definition: unofield.cxx:1088
std::unique_ptr< SwFieldProperties_Impl > m_pProps
Definition: unofield.cxx:1099
SwFieldType * m_pFieldType
Definition: unofield.cxx:1087
Impl(SwDoc *const pDoc, SwFormatField *const pFormat, SwServiceType nServiceId)
Definition: unofield.cxx:1101
std::mutex m_Mutex
Definition: unofield.cxx:1086
rtl::Reference< SwTextAPIObject > m_xTextObject
Definition: unofield.cxx:1094
const SwField * GetField() const
Definition: unofield.cxx:2631
SwServiceType m_nServiceId
Definition: unofield.cxx:1097
bool IsDescriptor() const
Definition: unofield.cxx:1138
void SetFieldType(SwFieldType &rType)
Definition: unofield.cxx:1157
unotools::WeakReference< SwXTextField > m_wThis
Definition: unofield.cxx:1090
void SetFormatField(SwFormatField *pFormatField, SwDoc *pDoc)
Definition: unofield.cxx:1124
SwFieldType * GetFieldType() const
Definition: unofield.cxx:1148
virtual void Notify(const SfxHint &) override
Definition: unofield.cxx:2613
SwFormatField * GetFormatField()
Definition: unofield.cxx:1134
UNO wrapper around an SwFormatField, i.e.
Definition: unofield.hxx:129
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:2110
virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override
Definition: unofield.cxx:1333
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unofield.cxx:2125
virtual void SAL_CALL dispose() override
Definition: unofield.cxx:2091
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:2485
SwServiceType GetServiceId() const
Definition: unofield.cxx:1243
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:2495
virtual void SAL_CALL attachTextFieldMaster(const css::uno::Reference< css::beans::XPropertySet > &xFieldMaster) override
Definition: unofield.cxx:1300
SwXTextField(SwFormatField &rFormat, SwDoc &rDoc)
Definition: unofield.cxx:1206
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:2574
virtual void SAL_CALL update() override
Definition: unofield.cxx:2500
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:2480
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unofield.cxx:2298
static rtl::Reference< SwXTextField > CreateXTextField(SwDoc *pDoc, SwFormatField const *pFormat, SwServiceType nServiceId=SwServiceType::Invalid)
Definition: unofield.cxx:1216
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unofield.cxx:1178
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:132
static void TransmuteLeadToInputField(SwSetExpField &rField)
Convert between SwSetExpField with InputFlag false and InputFlag true.
Definition: unofield.cxx:1260
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unofield.cxx:1171
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:2117
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:2579
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getTextFieldMaster() override
Definition: unofield.cxx:1323
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:2490
virtual ~SwXTextField() override
Definition: unofield.cxx:1211
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unofield.cxx:1345
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unofield.cxx:2146
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:2555
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unofield.cxx:2054
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:765
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1210
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
const css::uno::Sequence< sal_Int8 > & getSeq() const
css::uno::Type const & get()
OUString getDataSource() const
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:101
#define FN_UNO_ANCHOR_TYPE
Definition: cmdid.h:579
#define FN_UNO_ANCHOR_TYPES
Definition: cmdid.h:572
#define FN_UNO_TEXT_WRAP
Definition: cmdid.h:578
int nCount
virtual void SetValue(tools::Long nNew) override
@ PG_RANDOM
Definition: docufld.hxx:92
@ DS_CHAR
Definition: docufld.hxx:57
@ DS_GRF
Definition: docufld.hxx:59
@ DS_TBL
Definition: docufld.hxx:58
@ DS_OLE
Definition: docufld.hxx:60
@ DS_PAGE
Definition: docufld.hxx:54
@ DS_WORD
Definition: docufld.hxx:56
@ DS_PARA
Definition: docufld.hxx:55
@ AF_SHORTCUT
Definition: docufld.hxx:46
@ AF_NAME
Definition: docufld.hxx:45
@ AF_FIXED
Definition: docufld.hxx:47
float u
SwFieldTypesEnum
List of FieldTypes at UI.
Definition: fldbas.hxx:94
@ FF_FIXED
Definition: fldbas.hxx:162
@ FIXEDFLD
Definition: fldbas.hxx:229
@ DATEFLD
Definition: fldbas.hxx:230
@ TIMEFLD
Definition: fldbas.hxx:231
@ INP_USR
Definition: fldbas.hxx:219
@ INP_TXT
Definition: fldbas.hxx:218
SwFieldIds
Definition: fldbas.hxx:45
@ Database
For old documents the Field-Which IDs must be preserved !!!
@ TableOfAuthorities
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
Notify the background based on the difference between old and new rectangle.
Definition: frmtool.cxx:3238
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_MSG_BEGIN)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
sal_Int32 nIndex
OUString aName
Sequence< sal_Int8 > aSeq
#define SAL_N_ELEMENTS(arr)
const char * sName
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
sal_Int32 GetEnumAsInt32(const css::uno::Any &rVal)
Definition: swunohelper.cxx:50
OUString setToken(const OUString &rIn, sal_Int32 nToken, sal_Unicode cTok, std::u16string_view rNewToken)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
const SwDocInfoSubType DI_DOCNO
Definition: docufld.hxx:78
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:83
const SwDocInfoSubType DI_CUSTOM
Definition: docufld.hxx:80
const SwDocInfoSubType DI_CHANGE
Definition: docufld.hxx:76
const SwDocInfoSubType DI_COMMENT
Definition: docufld.hxx:74
const SwDocInfoSubType DI_SUB_FIXED
Definition: docufld.hxx:86
const SwDocInfoSubType DI_PRINT
Definition: docufld.hxx:77
const SwDocInfoSubType DI_SUB_DATE
Definition: docufld.hxx:85
const SwDocInfoSubType DI_KEYS
Definition: docufld.hxx:73
const SwDocInfoSubType DI_EDIT
Definition: docufld.hxx:79
const SwDocInfoSubType DI_SUBJECT
Definition: docufld.hxx:72
const SwDocInfoSubType DI_TITLE
Definition: docufld.hxx:71
const SwDocInfoSubType DI_SUB_TIME
Definition: docufld.hxx:84
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:75
const SwExtendedSubType SUB_CMD
Show command.
Definition: fldbas.hxx:212
const SwExtendedSubType SUB_INVISIBLE
Invisible.
Definition: fldbas.hxx:213
const SwGetSetExpType GSE_EXPR
Expression.
Definition: fldbas.hxx:204
const SwGetSetExpType GSE_FORMULA
Formula.
Definition: fldbas.hxx:206
const SwGetSetExpType GSE_STRING
String.
Definition: fldbas.hxx:203
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
constexpr OUStringLiteral EMPTY
const sal_Unicode cTokenSeparator
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange, ::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1103
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
sal_Int16 nId
@ RES_POOLCOLL_LABEL_DRAWING
Label drawing objects.
Definition: poolfmt.hxx:358
@ RES_POOLCOLL_EXTRA_BEGIN
Special ranges.
Definition: poolfmt.hxx:327
@ RES_POOLCOLL_LABEL_FRAME
Label frame.
Definition: poolfmt.hxx:348
@ RES_POOLCOLL_LABEL_FIGURE
Label figure.
Definition: poolfmt.hxx:349
@ RES_POOLCOLL_LABEL_TABLE
Label table.
Definition: poolfmt.hxx:347
@ RES_POOLCOLL_LABEL_ABB
Label illustration.
Definition: poolfmt.hxx:346
@ RES_POOLPAGE_STANDARD
Standard page.
Definition: poolfmt.hxx:170
QPRO_FUNC_TYPE nType
Marks a position in the document model.
Definition: pam.hxx:37
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
SetAttrMode
Definition: swtypes.hxx:133
@ FORCEHINTEXPAND
Force hint expand (only matters for hints with CH_TXTATR).
#define INIT_FLDTYPES
Definition: swtypes.hxx:105
#define DB_DELIM
Definition: swtypes.hxx:130
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
#define SAL_MAX_INT32
unsigned char sal_Bool
signed char sal_Int8
ResultType type
SwServiceType
entries in this enum are mapped in an array in unocoll.cxx
Definition: unocoll.hxx:63
@ FieldTypeConditionedText
@ FieldTypeGraphicObjectCount
@ FieldTypeDocInfoRevision
@ FieldTypeDatabaseNextSet
@ FieldTypeDocInfoPrintAuthor
@ FieldTypeDocInfoCreateDateTime
@ FieldTypeDocInfoKeywords
@ FieldTypeDocInfoDescription
@ FieldTypeDocInfoChangeAuthor
@ FieldTypeEmbeddedObjectCount
@ FieldTypeDocInfoEditTime
@ FieldTypeCombinedCharacters
@ FieldTypeDocInfoCreateAuthor
@ FieldTypeDocInfoPrintDateTime
@ FieldTypeDocInfoChangeDateTime
static sal_uInt16 lcl_GetPropertyMapOfService(SwServiceType nServiceId)
Definition: unofield.cxx:324
static sal_uInt16 GetFieldTypeMId(std::u16string_view rProperty, const SwFieldType &rTyp)
Definition: unofield.cxx:310
static SwFieldIds lcl_GetIdByName(OUString &rName, OUString &rTypeName)
Definition: unofield.cxx:2673
const sal_uInt16 aDocInfoSubTypeFromService[]
Definition: unofield.cxx:97
static OUString OldNameToNewName_Impl(const OUString &rOld)
Definition: unofield.cxx:2560
static SwFieldIds lcl_ServiceIdToResId(SwServiceType nServiceId)
Definition: unofield.cxx:184
static sal_uInt16 lcl_GetPropMapIdForFieldType(SwFieldIds nWhich)
Definition: unofield.cxx:277
const ServiceIdResId aServiceToRes[]
Definition: unofield.cxx:128
constexpr OUStringLiteral COM_TEXT_FLDMASTER_CC
Definition: unofield.cxx:94
static SwServiceType lcl_GetServiceForField(const SwField &rField)
Definition: unofield.cxx:195
static sal_Int32 lcl_PropName2TokenPos(std::u16string_view rPropertyName)
Definition: unofield.cxx:293
#define FIELD_PROP_BOOL1
Definition: unofldmid.h:28
#define FIELD_PROP_DATE_TIME
Definition: unofldmid.h:38
#define FIELD_PROP_DATE
Definition: unofldmid.h:30
#define FIELD_PROP_IS_FIELD_DISPLAYED
Definition: unofldmid.h:47
#define FIELD_PROP_STRINGS
Definition: unofldmid.h:42
#define FIELD_PROP_PAR3
Definition: unofldmid.h:25
#define FIELD_PROP_PROP_SEQ
Definition: unofldmid.h:39
#define FIELD_PROP_BOOL2
Definition: unofldmid.h:29
#define FIELD_PROP_SUBTYPE
Definition: unofldmid.h:27
#define FIELD_PROP_USHORT1
Definition: unofldmid.h:31
#define FIELD_PROP_USHORT2
Definition: unofldmid.h:32
#define FIELD_PROP_FORMAT
Definition: unofldmid.h:26
#define FIELD_PROP_DOUBLE
Definition: unofldmid.h:34
#define FIELD_PROP_BOOL4
Definition: unofldmid.h:41
#define FIELD_PROP_TEXT
Definition: unofldmid.h:49
#define FIELD_PROP_BOOL3
Definition: unofldmid.h:35
#define FIELD_PROP_SHORT1
Definition: unofldmid.h:37
#define FIELD_PROP_PAR1
Definition: unofldmid.h:23
#define FIELD_PROP_PAR4
Definition: unofldmid.h:36
#define FIELD_PROP_IS_FIELD_USED
Definition: unofldmid.h:46
#define FIELD_PROP_BYTE1
Definition: unofldmid.h:33
#define FIELD_PROP_PAR2
Definition: unofldmid.h:24
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
#define PROPERTY_MAP_FLDTYP_GET_EXP
Definition: unomap.hxx:70
#define PROPERTY_MAP_FLDTYP_JUMP_EDIT
Definition: unomap.hxx:88
#define PROPERTY_MAP_FLDTYP_DDE
Definition: unomap.hxx:81
#define PROPERTY_MAP_FLDTYP_DATETIME
Definition: unomap.hxx:67
#define PROPERTY_MAP_FLDTYP_DOC_INFO
Definition: unomap.hxx:83
#define PROPERTY_MAP_FLDMSTR_USER
Definition: unomap.hxx:106
#define PROPERTY_MAP_FLDTYP_TABLE_FORMULA
Definition: unomap.hxx:105
#define PROPERTY_MAP_FLDTYP_SET_EXP
Definition: unomap.hxx:69
#define PROPERTY_MAP_FLDTYP_ANNOTATION
Definition: unomap.hxx:78
#define PROPERTY_MAP_FLDTYP_FILE_NAME
Definition: unomap.hxx:71
#define PROPERTY_MAP_FLDTYP_CHAPTER
Definition: unomap.hxx:74
#define PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME
Definition: unomap.hxx:100
#define PROPERTY_MAP_FLDTYP_DOCINFO_REVISION
Definition: unomap.hxx:102
#define PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET
Definition: unomap.hxx:90
#define PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR
Definition: unomap.hxx:96
#define PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME
Definition: unomap.hxx:97
#define PROPERTY_MAP_FLDTYP_AUTHOR
Definition: unomap.hxx:73
#define PROPERTY_MAP_FLDTYP_MACRO
Definition: unomap.hxx:80
#define PROPERTY_MAP_FLDTYP_GET_REFERENCE
Definition: unomap.hxx:75
#define PROPERTY_MAP_PARAGRAPH_EXTENSIONS
Definition: unomap.hxx:52
#define PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY
Definition: unomap.hxx:112
#define PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS
Definition: unomap.hxx:103
#define PROPERTY_MAP_FLDMSTR_DDE
Definition: unomap.hxx:107
#define PROPERTY_MAP_FLDTYP_DOCSTAT
Definition: unomap.hxx:95
#define PROPERTY_MAP_FLDTYP_USER
Definition: unomap.hxx:68
#define PROPERTY_MAP_FLDTYP_SCRIPT
Definition: unomap.hxx:89
#define PROPERTY_MAP_FLDTYP_DATABASE
Definition: unomap.hxx:93
#define PROPERTY_MAP_FLDTYP_USER_EXT
Definition: unomap.hxx:85
#define PROPERTY_MAP_FLDMSTR_DUMMY0
Definition: unomap.hxx:110
#define PROPERTY_MAP_FLDTYP_REF_PAGE_GET
Definition: unomap.hxx:87
#define PROPERTY_MAP_FLDTYP_INPUT
Definition: unomap.hxx:79
#define PROPERTY_MAP_FLDTYP_HIDDEN_PARA
Definition: unomap.hxx:82
#define PROPERTY_MAP_FLDTYP_REF_PAGE_SET
Definition: unomap.hxx:86
#define PROPERTY_MAP_FLDTYP_DROPDOWN
Definition: unomap.hxx:116
#define PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM
Definition: unomap.hxx:123
#define PROPERTY_MAP_FLDTYP_DATABASE_NAME
Definition: unomap.hxx:94
#define PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM
Definition: unomap.hxx:92
#define PROPERTY_MAP_FLDTYP_PAGE_NUM
Definition: unomap.hxx:72
#define PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET
Definition: unomap.hxx:91
#define PROPERTY_MAP_FLDMSTR_SET_EXP
Definition: unomap.hxx:108
#define PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT
Definition: unomap.hxx:76
#define PROPERTY_MAP_FLDMSTR_DATABASE
Definition: unomap.hxx:109
#define PROPERTY_MAP_FLDTYP_DOCINFO_MISC
Definition: unomap.hxx:101
#define PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY
Definition: unomap.hxx:111
#define PROPERTY_MAP_FLDTYP_HIDDEN_TEXT
Definition: unomap.hxx:77
#define PROPERTY_MAP_FLDTYP_TEMPLATE_NAME
Definition: unomap.hxx:84
#define PROPERTY_MAP_FLDTYP_DUMMY_0
Definition: unomap.hxx:104
#define UNO_NAME_NAME
Definition: unoprnms.hxx:81
#define UNO_NAME_CHAPTER_NUMBERING_LEVEL
Definition: unoprnms.hxx:469
#define UNO_NAME_IS_EXPRESSION
Definition: unoprnms.hxx:317
#define UNO_NAME_DATA_BASE_NAME
Definition: unoprnms.hxx:249
#define UNO_NAME_DDE_COMMAND_TYPE
Definition: unoprnms.hxx:156
#define UNO_NAME_SUB_TYPE
Definition: unoprnms.hxx:315
#define UNO_NAME_NUMBERING_SEPARATOR
Definition: unoprnms.hxx:470
#define UNO_NAME_DATA_TABLE_NAME
Definition: unoprnms.hxx:250
#define UNO_NAME_DDE_COMMAND_ELEMENT
Definition: unoprnms.hxx:158
#define UNO_NAME_VALUE
Definition: unoprnms.hxx:332
#define UNO_NAME_DATA_COMMAND_TYPE
Definition: unoprnms.hxx:251
#define UNO_NAME_DATA_BASE_URL
Definition: unoprnms.hxx:752
#define UNO_NAME_DDE_COMMAND_FILE
Definition: unoprnms.hxx:157
#define UNO_NAME_INSTANCE_NAME
Definition: unoprnms.hxx:478
#define UNO_NAME_CONTENT
Definition: unoprnms.hxx:243
#define UNO_NAME_DATA_COLUMN_NAME
Definition: unoprnms.hxx:252
#define UNO_NAME_IS_AUTOMATIC_UPDATE
Definition: unoprnms.hxx:159
#define UNO_NAME_DEPENDENT_TEXT_FIELDS
Definition: unoprnms.hxx:475
const SvXMLTokenMapEntry aTypes[]