39 #include <com/sun/star/frame/XModel.hpp>
40 #include <com/sun/star/util/DateTime.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/text/UserDataPart.hpp>
43 #include <com/sun/star/text/PageNumberType.hpp>
44 #include <com/sun/star/style/NumberingType.hpp>
45 #include <com/sun/star/text/ReferenceFieldPart.hpp>
46 #include <com/sun/star/text/ReferenceFieldSource.hpp>
47 #include <com/sun/star/beans/XPropertySet.hpp>
48 #include <com/sun/star/beans/XPropertyState.hpp>
49 #include <com/sun/star/text/XTextField.hpp>
50 #include <com/sun/star/text/XDependentTextField.hpp>
51 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
53 #include <com/sun/star/text/SetVariableType.hpp>
54 #include <com/sun/star/text/PlaceholderType.hpp>
55 #include <com/sun/star/text/FilenameDisplayFormat.hpp>
56 #include <com/sun/star/text/ChapterFormat.hpp>
57 #include <com/sun/star/text/TemplateDisplayFormat.hpp>
58 #include <com/sun/star/container/XNameReplace.hpp>
59 #include <com/sun/star/uno/Sequence.h>
60 #include <com/sun/star/text/BibliographyDataType.hpp>
61 #include <com/sun/star/sdb/CommandType.hpp>
62 #include <com/sun/star/rdf/XMetadatable.hpp>
66 #include <rtl/ustrbuf.hxx>
68 #include <rtl/math.hxx>
74 using namespace ::
std;
161 uno::Reference<text::XText> GetToplevelText(
const uno::Reference<text::XText>& xText)
163 uno::Reference<text::XText> xRet = xText;
166 uno::Reference<beans::XPropertySet> xPropertySet(xRet, uno::UNO_QUERY);
167 if (!xPropertySet.is())
170 if (!xPropertySet->getPropertySetInfo()->hasPropertyByName(
"ParentText"))
173 uno::Reference<text::XText> xParent;
174 if (xPropertySet->getPropertyValue(
"ParentText") >>= xParent)
280 const Reference<XPropertySetInfo> &,
295 const OUString& sPropName,
300 constexpr OUStringLiteral
gsServicePrefix(u
"com.sun.star.text.textfield.");
374 std::unique_ptr<XMLPropertyState> pCombinedCharState)
376 pCombinedCharactersPropertyState(
std::move(pCombinedCharState))
387 const Reference<XTextField> & rTextField,
391 Reference<XServiceInfo> xService(rTextField, UNO_QUERY);
397 const OUString* pNames = std::find_if(aServices.begin(), aServices.end(),
398 [](
const OUString& rName) {
return rName.matchIgnoreAsciiCase(
gsServicePrefix); });
399 if (pNames != aServices.end())
406 if( sFieldName.isEmpty() )
409 pNames = std::find_if(aServices.begin(), aServices.end(),
411 if (pNames != aServices.end())
417 if( !sFieldName.isEmpty() )
419 if( sFieldName ==
"Header" )
423 else if( sFieldName ==
"Footer" )
427 else if( sFieldName ==
"DateTime" )
435 DBG_ASSERT(!sFieldName.isEmpty(),
"no TextField service found!");
440 std::u16string_view sFieldName,
452 DBG_ASSERT(!sFieldName.empty(),
"no valid service name!");
454 if (!sFieldName.empty())
458 nToken, sFieldName, aFieldServiceNameMapping);
461 DBG_ASSERT(bRet,
"Unknown field service name encountered!");
475 case SetVariableType::STRING:
476 case SetVariableType::VAR:
479 case SetVariableType::SEQUENCE:
482 case SetVariableType::FORMULA:
493 case SetVariableType::STRING:
494 case SetVariableType::VAR:
497 case SetVariableType::FORMULA:
500 case SetVariableType::SEQUENCE:
516 if (xPropSet->getPropertySetInfo()->
551 case ReferenceFieldSource::REFERENCE_MARK:
554 case ReferenceFieldSource::SEQUENCE_FIELD:
557 case ReferenceFieldSource::BOOKMARK:
560 case ReferenceFieldSource::FOOTNOTE:
563 case ReferenceFieldSource::ENDNOTE:
637 switch (nFieldType) {
645 SetVariableType::STRING );
651 Reference<XTextField> xTextField(xPropSet, UNO_QUERY);
652 DBG_ASSERT(xTextField.is(),
"field is no XTextField!");
743 OSL_FAIL(
"unknown field type/field has no content");
751 const Reference<XTextField> & rTextField,
const bool bProgress,
752 const bool bRecursive )
760 Reference<XDependentTextField> xDepField(rTextField, UNO_QUERY);
765 Reference<XText> xOurText = GetToplevelText(rTextField->getAnchor()->getText());
767 map<Reference<XText>, set<OUString> >::iterator aMapIter =
774 (*pUsedMasters)[xOurText] = aSet;
781 if (!sFieldMasterName.isEmpty())
782 aMapIter->second.insert( sFieldMasterName );
807 if ( (5100 != nFormat) &&
821 Reference<XPropertySetInfo> xPropSetInfo(
822 xPropSet->getPropertySetInfo() );
834 xPropSet, xPropSetInfo,
false ) )
851 bool dummy_for_autostyles(
true);
884 xPropSet, xPropSet->getPropertySetInfo(),
900 "need proper PropertyState for combined characters");
966 OSL_FAIL(
"unknown field type!");
974 const Reference<XTextField> & rTextField,
bool bProgress,
975 bool & rPrevCharIsSpace)
999 FindTextStyleAndHyperlink( xRangePropSet, bHasHyperlink, bIsUICharStyle,
1000 bHasAutoStyle, pStates );
1001 bool bHasStyle = !sStyle.isEmpty();
1004 Reference < XPropertySetInfo > xRangePropSetInfo;
1007 Reference<XPropertyState> xRangePropState( xRangePropSet, UNO_QUERY );
1008 xRangePropSetInfo = xRangePropSet->getPropertySetInfo();
1011 xRangePropSet, xRangePropState,
1012 xRangePropSetInfo );
1021 OUString sHyperLinkEvents(
"HyperLinkEvents");
1022 if (xRangePropSetInfo->hasPropertyByName(sHyperLinkEvents))
1024 Any aAny = xRangePropSet->getPropertyValue(sHyperLinkEvents);
1025 Reference<XNameReplace> xName;
1036 xRangePropSet, xRangePropSetInfo ), bHasAutoStyle,
1045 GetExport().EncodeStyleName( sStyle ) );
1053 bProgress, rPrevCharIsSpace);
1059 const Reference<XTextField> & rTextField,
1064 bool & rPrevCharIsSpace)
1068 Reference<XPropertySetInfo> xPropSetInfo(rPropSet->getPropertySetInfo());
1070 OUString sPresentation = rTextField->getPresentation(
false);
1119 rPropSet, xPropSetInfo,
false ) );
1139 rPropSet, xPropSetInfo,
false ) );
1162 rPropSet, xPropSetInfo,
false ) );
1175 false,
false, !bCmd,
1178 rPropSet, xPropSetInfo,
false ) );
1232 !bCmd, !bCmd, !bCmd,
1235 rPropSet, xPropSetInfo,
false ) );
1261 rPropSet, xPropSetInfo,
false ),
1303 rPropSet, xPropSetInfo,
false ) );
1361 sal_Int32 nDummy = 0;
1374 rPropSet, xPropSetInfo);
1388 rPropSet, xPropSetInfo);
1398 "Unexpected presentation for database next field");
1400 rPropSet, xPropSetInfo);
1412 "Unexpected presentation for database select field");
1414 rPropSet, xPropSetInfo);
1432 false,
false,
true,
false);
1437 xMaster, xMaster->getPropertySetInfo());
1460 rPropSet, xPropSetInfo,
false ) );
1491 rPropSet, xPropSetInfo,
false ));
1549 "Unexpected presentation for hidden paragraph field");
1593 "Unexpected presentation page variable field");
1730 "Unexpected presentation for script field");
1749 "Unexpected presentation for annotation field");
1757 if (!aName.isEmpty())
1765 OUString aResolvedText;
1766 OUStringBuffer aResolvedTextBuffer;
1768 aResolvedText = aResolvedTextBuffer.makeStringAndClear();
1777 if( !aAuthor.isEmpty() )
1789 if ( !bRemovePersonalInfo )
1803 if( !aInitials.isEmpty() )
1821 css::uno::Reference < css::text::XText > xText;
1827 catch ( css::uno::Exception& )
1916 OSL_FAIL(
"unknown field type encountered!");
1926 Reference<XText> xEmptyText;
1932 const Reference<XText> & rText )
1935 vector<OUString> aVarName;
1936 vector<OUString> aUserName;
1937 vector<OUString> aSeqName;
1938 vector<OUString> aDdeName;
1941 Reference<XTextFieldsSupplier> xTextFieldsSupp(
GetExport().GetModel(),
1943 if( !xTextFieldsSupp.is() )
1947 xTextFieldsSupp->getTextFieldMasters();
1957 "field masters must be recorded in order to be "
1958 "written out separately" );
1961 map<Reference<XText>, set<OUString> > ::iterator aMapIter =
1976 aFieldMasters = xFieldMasterNameAccess->getElementNames();
1979 for(
const OUString& sFieldMaster : std::as_const(aFieldMasters)) {
1982 if ( sFieldMaster.startsWithIgnoreAsciiCase(
1983 "com.sun.star.text.FieldMaster.DataBase.") )
1989 OUString sFieldMasterType;
1995 Any aAny = xFieldMasterNameAccess->getByName(sFieldMaster);
2004 if ( SetVariableType::SEQUENCE == nType )
2006 aSeqName.push_back( sFieldMaster );
2010 aVarName.push_back( sFieldMaster );
2015 aUserName.push_back( sFieldMaster );
2019 aDdeName.push_back( sFieldMaster );
2030 if ( !aVarName.empty() )
2037 for (
const auto& sName : aVarName)
2041 Any aAny = xFieldMasterNameAccess->getByName(sName);
2045 OUString sFieldMasterType;
2051 == SetVariableType::STRING );
2062 false,
true,
false,
false);
2075 false,
true,
false,
false);
2085 if ( !aSeqName.empty() )
2092 for (
const auto& sName : aSeqName)
2096 Any aAny = xFieldMasterNameAccess->getByName(sName);
2100 OUString sFieldMasterType;
2107 DBG_ASSERT(nLevel >= 0,
"illegal outline level");
2108 DBG_ASSERT(nLevel < 127,
"possible illegal outline level");
2123 if ( !aUserName.empty() )
2130 for (
const auto& sName : aUserName)
2134 Any aAny = xFieldMasterNameAccess->getByName(sName);
2138 OUString sFieldMasterType;
2170 if ( aDdeName.empty() )
2178 for (
const auto& sName : aDdeName)
2182 Any aAny = xFieldMasterNameAccess->getByName(sName);
2210 if (bIsAutomaticUpdate)
2225 bool bExportOnlyUsed)
2230 if (bExportOnlyUsed)
2246 eElementName, bAddSpace, bAddSpace );
2251 const OUString& sContent)
2258 eElementName,
false,
false );
2269 const OUString& rContent )
2287 Sequence<PropertyValue>
aSeq;
2289 rPropSet->getPropertyValue(
"ScriptURL") >>= sName;
2293 if (!sName.isEmpty())
2296 aSeq = Sequence<PropertyValue>
2304 aSeq = Sequence<PropertyValue>
2321 bool i_bAutoStyles,
bool i_bProgress,
2322 bool & rPrevCharIsSpace)
2324 bool doExport(!i_bAutoStyles);
2326 switch (
GetExport().getSaneDefaultVersion()) {
2332 const Reference < XEnumerationAccess > xEA( i_xMeta, UNO_QUERY_THROW );
2333 const Reference < XEnumeration > xTextEnum( xEA->createEnumeration() );
2337 const Reference<rdf::XMetadatable> xMeta( i_xMeta, UNO_QUERY_THROW );
2342 "",
u"", 0.0,
false,
false,
true,
2346 xMeta->ensureMetadataReference();
2357 exportTextRangeEnumeration(xTextEnum, i_bAutoStyles, i_bProgress, rPrevCharIsSpace);
2363 sal_Int32 nFormatKey,
2364 const OUString& sContent,
2365 std::u16string_view sDefault,
2368 bool bExportValueType,
2370 bool bForceSystemLanguage,
2379 if (bExportValue || bExportValueType)
2382 GetExport(), sContent, sDefault, bExportValue);
2391 DBG_ASSERT(bExportValueType || !bExportValue,
"value w/o value type not supported!");
2395 if (-1 != nFormatKey)
2397 if (bExportValue || bExportValueType)
2401 GetExport(), nFormatKey, fValue, bExportValue);
2407 if( bForceSystemLanguage )
2411 OUString sDataStyleName =
2413 if( !sDataStyleName.isEmpty() )
2450 bool bBool,
bool bDefault)
2458 if ((!bBool) != (!bDefault)) {
2467 const OUString& sValue,
2476 if ( bOmitEmpty && sValue.isEmpty() )
2484 sal_uInt16 nValuePrefix,
2485 const OUString& sValue)
2494 const OUString& sValue,
2495 std::u16string_view sDefault)
2497 if (sValue != sDefault)
2505 sal_uInt16 nValuePrefix,
2506 const OUString& sValue,
2507 std::u16string_view sDefault)
2509 if (sValue != sDefault)
2536 if ( eValue != eDefault )
2543 std::u16string_view sParagraphSequence)
2548 std::u16string_view aSubString;
2566 OUString::number(nNum));
2571 sal_Int32 nNum, sal_Int32 nDefault)
2573 if (nNum != nDefault)
2582 if (NumberingType::PAGE_DESCRIPTOR == nNumberingType)
2585 OUStringBuffer sTmp( 10 );
2590 sTmp.makeStringAndClear() );
2594 if (!sTmp.isEmpty())
2597 sTmp.makeStringAndClear() );
2608 bool bOmitDurationIfZero,
2614 dValue = ::rtl::math::approxFloor(dValue);
2621 if (!bOmitDurationIfZero || dValue != 0.0)
2633 ProcessString(eName, aBuffer.makeStringAndClear(),
true, nPrefix);
2638 const util::DateTime& rTime)
2640 OUStringBuffer aBuffer;
2642 util::DateTime aDateTime(rTime);
2658 if (!(bIsDuration && (nMinutes==0)))
2661 bIsDate, bIsDuration);
2667 const util::DateTime& rTime)
2669 OUStringBuffer aBuffer;
2682 {
XML_BOOK, BibliographyDataType::BOOK },
2690 {
XML_EMAIL, BibliographyDataType::EMAIL },
2691 {
XML_INBOOK, BibliographyDataType::INBOOK },
2695 {
XML_MANUAL, BibliographyDataType::MANUAL },
2697 {
XML_MISC, BibliographyDataType::MISC },
2702 {
XML_WWW, BibliographyDataType::WWW },
2712 Sequence<PropertyValue> aValues;
2716 for (
const auto& rProp : std::as_const(aValues))
2718 if( rProp.Name ==
"BibiliographicType" )
2720 sal_Int16 nTypeId = 0;
2721 rProp.Value >>= nTypeId;
2722 OUStringBuffer sBuf;
2725 aBibliographyDataTypeMap))
2729 sBuf.makeStringAndClear());
2736 rProp.Value >>= sStr;
2738 if (!sStr.isEmpty())
2758 sal_Int32 nCommandType)
2761 switch( nCommandType )
2763 case sdb::CommandType::TABLE: eToken =
XML_TABLE;
break;
2764 case sdb::CommandType::QUERY: eToken =
XML_QUERY;
break;
2765 case sdb::CommandType::COMMAND: eToken =
XML_COMMAND;
break;
2775 const OUString& sSelected )
2786 sal_Int32 nSelected )
2788 sal_Int32
nLength = rSequence.getLength();
2789 const OUString* pSequence = rSequence.getConstArray();
2790 for( sal_Int32 i = 0;
i <
nLength;
i++ )
2792 if( i == nSelected )
2803 const OUString& sPresentation,
2805 const Reference<XPropertySetInfo>& rPropertySetInfo )
2808 SAL_WARN_IF( !rPropertySet.is(),
"xmloff.text",
"need property set" );
2809 SAL_WARN_IF( !rPropertySetInfo.is(),
"xmloff.text",
"need property set info" );
2812 OUString sDataBaseName;
2813 OUString sDataBaseURL;
2816 && !sStr.isEmpty() )
2818 sDataBaseName = sStr;
2824 sDataBaseURL = sStr;
2828 if( !sDataBaseName.isEmpty() )
2836 if( !sDataBaseURL.isEmpty() )
2851 std::u16string_view sMasterName, OUString& sFieldType, OUString& sVarName)
2854 size_t nSeparator = sMasterName.find(
'.', nLength);
2857 if (nSeparator ==
o3tl::make_unsigned(nLength) || nSeparator == std::u16string_view::npos) {
2858 SAL_WARN(
"xmloff.text",
"no field var name!");
2862 sFieldType = sMasterName.substr(nLength, nSeparator-nLength);
2863 sVarName = sMasterName.substr(nSeparator+1);
2870 const Reference<XTextField> & rTextField)
2873 Reference<XDependentTextField> xDep(rTextField, UNO_QUERY);
2874 return xDep->getTextFieldMaster();
2883 Sequence<Reference<XDependentTextField> > aFields;
2888 if (aFields.hasElements())
2891 Reference<XDependentTextField> xTField = aFields[0];
2892 xField.set(xTField, UNO_QUERY);
2894 "Surprisingly, this TextField refuses to be a PropertySet!");
2911 case PlaceholderType::TEXT:
2915 case PlaceholderType::TABLE:
2919 case PlaceholderType::TEXTFRAME:
2923 case PlaceholderType::GRAPHIC:
2927 case PlaceholderType::OBJECT:
2933 OSL_FAIL(
"unknown placeholder type");
2954 PageNumberType ePage;
2956 ePage = *o3tl::doAccess<PageNumberType>(aAny);
2960 case PageNumberType_PREV:
2964 case PageNumberType_CURRENT:
2967 case PageNumberType_NEXT:
2972 OSL_FAIL(
"unknown page number type");
2987 case TemplateDisplayFormat::FULL:
2990 case TemplateDisplayFormat::PATH:
2993 case TemplateDisplayFormat::NAME:
2996 case TemplateDisplayFormat::NAME_AND_EXT:
2999 case TemplateDisplayFormat::AREA:
3002 case TemplateDisplayFormat::TITLE:
3006 OSL_FAIL(
"unknown template display format");
3043 OSL_FAIL(
"no count field token");
3058 case ChapterFormat::NAME:
3061 case ChapterFormat::NUMBER:
3064 case ChapterFormat::NAME_NUMBER:
3067 case ChapterFormat::NO_PREFIX_SUFFIX:
3070 case ChapterFormat::DIGIT:
3074 OSL_FAIL(
"unknown chapter display format");
3090 case FilenameDisplayFormat::FULL:
3093 case FilenameDisplayFormat::PATH:
3096 case FilenameDisplayFormat::NAME:
3099 case FilenameDisplayFormat::NAME_AND_EXT:
3103 OSL_FAIL(
"unknown filename display format");
3117 case ReferenceFieldPart::PAGE:
3120 case ReferenceFieldPart::CHAPTER:
3123 case ReferenceFieldPart::TEXT:
3126 case ReferenceFieldPart::UP_DOWN:
3129 case ReferenceFieldPart::CATEGORY_AND_NUMBER:
3132 case ReferenceFieldPart::ONLY_CAPTION:
3135 case ReferenceFieldPart::ONLY_SEQUENCE_NUMBER:
3138 case ReferenceFieldPart::PAGE_DESC:
3144 case ReferenceFieldPart::NUMBER:
3147 case ReferenceFieldPart::NUMBER_NO_CONTEXT:
3150 case ReferenceFieldPart::NUMBER_FULL_CONTEXT:
3154 OSL_FAIL(
"unknown reference type");
3169 case ReferenceFieldSource::REFERENCE_MARK:
3172 case ReferenceFieldSource::SEQUENCE_FIELD:
3175 case ReferenceFieldSource::BOOKMARK:
3178 case ReferenceFieldSource::FOOTNOTE:
3179 case ReferenceFieldSource::ENDNOTE:
3183 OSL_FAIL(
"unknown reference source");
3200 case UserDataPart::COMPANY :
3203 case UserDataPart::FIRSTNAME :
3206 case UserDataPart::NAME :
3209 case UserDataPart::SHORTCUT :
3212 case UserDataPart::STREET :
3215 case UserDataPart::COUNTRY :
3218 case UserDataPart::ZIP :
3221 case UserDataPart::CITY :
3224 case UserDataPart::TITLE :
3227 case UserDataPart::POSITION :
3230 case UserDataPart::PHONE_PRIVATE :
3233 case UserDataPart::PHONE_COMPANY :
3236 case UserDataPart::FAX :
3239 case UserDataPart::EMAIL :
3242 case UserDataPart::STATE :
3246 SAL_WARN(
"xmloff.text",
"unknown sender type");
3307 SAL_WARN(
"xmloff.text",
"unknown docinfo field type!");
3319 if( sName ==
u"Identifier" )
3323 else if( sName ==
u"BibiliographicType" )
3327 else if( sName ==
u"Address" )
3331 else if( sName ==
u"Annote" )
3335 else if( sName ==
u"Author" )
3339 else if( sName ==
u"Booktitle" )
3343 else if( sName ==
u"Chapter" )
3347 else if( sName ==
u"Edition" )
3351 else if( sName ==
u"Editor" )
3355 else if( sName ==
u"Howpublished" )
3359 else if( sName ==
u"Institution" )
3363 else if( sName ==
u"Journal" )
3367 else if( sName ==
u"Month" )
3371 else if( sName ==
u"Note" )
3375 else if( sName ==
u"Number" )
3379 else if( sName ==
u"Organizations" )
3383 else if( sName ==
u"Pages" )
3387 else if( sName ==
u"Publisher" )
3391 else if( sName ==
u"School" )
3395 else if( sName ==
u"Series" )
3399 else if( sName ==
u"Title" )
3403 else if( sName ==
u"Report_Type" )
3407 else if( sName ==
u"Volume" )
3411 else if( sName ==
u"Year" )
3415 else if( sName ==
u"URL" )
3419 else if( sName ==
u"Custom1" )
3423 else if( sName ==
u"Custom2" )
3427 else if( sName ==
u"Custom3" )
3431 else if( sName ==
u"Custom4" )
3435 else if( sName ==
u"Custom5" )
3439 else if( sName ==
u"ISBN" )
3443 else if (sName ==
u"LocalURL")
3449 SAL_WARN(
"xmloff.text",
"Unknown bibliography info data");
3472 return "ftn" + OUString::number(static_cast<sal_Int32>(nSeqNo));
3477 std::u16string_view rSeqName)
3480 return OUString::Concat(
"ref") +rSeqName + OUString::number(static_cast<sal_Int32>(nSeqNo));
3491 const OUString& sPropName,
3494 Any aAny = xPropSet->getPropertyValue(sPropName);
3495 bool bBool = *o3tl::doAccess<bool>(aAny);
3500 const OUString& sPropName,
3502 const Reference<XPropertySetInfo> & xPropSetInfo,
3505 return xPropSetInfo->hasPropertyByName( sPropName )
3510 const OUString& sPropName,
3513 Any aAny = xPropSet->getPropertyValue(sPropName);
3514 double fDouble = 0.0;
3520 const OUString& sPropName,
3523 Any aAny = xPropSet->getPropertyValue(sPropName);
3530 const OUString& sPropName,
3533 Any aAny = xPropSet->getPropertyValue(sPropName);
3540 const OUString& sPropName,
3543 Any aAny = xPropSet->getPropertyValue(sPropName);
3550 const OUString& sPropName,
3553 Any aAny = xPropSet->getPropertyValue(sPropName);
3560 const OUString& sPropName,
3563 Any aAny = xPropSet->getPropertyValue(sPropName);
3564 util::DateTime aTime;
3570 const OUString& sPropName,
3573 Any aAny = xPropSet->getPropertyValue(sPropName);
char const FIELD_SERVICE_HIDDEN_TEXT[]
constexpr OUStringLiteral gsPropertyVariableName(u"VariableName")
static bool IsStringField(FieldIdEnum nFieldType, const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
determine, whether field has string or numeric content
char const FIELD_SERVICE_REFERENCE_PAGE_GET[]
bool IsOptionSet(EOption eOption)
void ProcessStringSequence(const css::uno::Sequence< OUString > &rSequence, const OUString &sSelected)
css::sdb::CommandType
constexpr OUStringLiteral gsPropertyIsDate(u"IsDate")
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
static enum::xmloff::token::XMLTokenEnum MapFilenameDisplayFormat(sal_Int16 nType)
map FilenameDisplayFormat to XML attribute names
constexpr OUStringLiteral gsPropertyReferenceFieldPart(u"ReferenceFieldPart")
char const FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2[]
void ExportElement(enum::xmloff::token::XMLTokenEnum eElement, bool bAddSpace=false)
export an empty element
constexpr OUStringLiteral gsPropertyLevel(u"Level")
constexpr OUStringLiteral gsPropertyNumberingType(u"NumberingType")
static bool GetBoolProperty(const OUString &, const Reference< XPropertySet > &)
void ExportMetaField(const css::uno::Reference< css::beans::XPropertySet > &i_xMeta, bool i_bAutoStyles, bool i_bProgress, bool &rPrevCharIsSpace)
export text:meta-field (RDF metadata)
constexpr OUStringLiteral gsPropertyInstanceName(u"InstanceName")
constexpr OUStringLiteral gsPropertyNumberFormat(u"NumberFormat")
constexpr OUStringLiteral gsPropertyName(u"Name")
char const FIELD_SERVICE_DB_NEXT[]
char const FIELD_SERVICE_DOC_INFO_EDIT_TIME2[]
void ExportFieldAutoStyle(const css::uno::Reference< css::text::XTextField > &rTextField, const bool bProgress, const bool bRecursive)
collect styles (character styles, data styles, ...) for this field (if appropriate).
constexpr sal_uInt16 XML_NAMESPACE_SCRIPT
char const FIELD_SERVICE_DROP_DOWN[]
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
char const FIELD_SERVICE_PARAGRAPH_COUNT[]
static Sequence< OUString > GetStringSequenceProperty(const OUString &sPropName, const Reference< XPropertySet > &xPropSet)
size_t GetInfoID(const OUString sPersonalInfo) const
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
static OUString MakeSequenceRefName(sal_Int16 nSeqNo, std::u16string_view rSeqName)
make reference name for a sequence field
char const FIELD_SERVICE_DOC_INFO_KEY_WORDS2[]
const SvXMLUnitConverter & GetMM100UnitConverter() const
char const FIELD_SERVICE_DATETIME[]
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr OUStringLiteral gsPropertyTooltip(u"Tooltip")
void ProcessInteger(enum::xmloff::token::XMLTokenEnum eXmlName, sal_Int32 nNum)
attribute default; omit, if attribute differs
constexpr OUStringLiteral gsPropertyValue(u"Value")
static enum::xmloff::token::XMLTokenEnum MapCountFieldName(FieldIdEnum nToken)
map count/statistics field token to XML name
char const FIELD_SERVICE_PAGE_COUNT[]
static enum::xmloff::token::XMLTokenEnum MapReferenceType(sal_Int16 nType)
map ReferenceFieldPart to XML string
void ExportFieldDeclarations()
export field declarations.
static double GetDoubleProperty(const OUString &, const Reference< XPropertySet > &)
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr OUStringLiteral gsPropertyContent(u"Content")
constexpr OUStringLiteral gsPropertyChapterNumberingLevel(u"ChapterNumberingLevel")
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
std::unique_ptr< ::std::map< css::uno::Reference< css::text::XText >,::std::set< OUString > > > pUsedMasters
store used text field master names (NULL means: don't collect)
void ExportField(const css::uno::Reference< css::text::XTextField > &rTextField, bool bProgress, bool &rPrevCharIsSpace)
Export this field and the surrounding span element with the formatting.
char const FIELD_SERVICE_MEASURE[]
void ProcessParagraphSequence(std::u16string_view sParagraphSequence)
default value token
void ProcessDisplay(bool bIsVisible, bool bIsCommand)
numbering type key
constexpr OUStringLiteral gsPropertyDataCommandType(u"DataCommandType")
constexpr OUStringLiteral gsPropertyDDECommandElement(u"DDECommandElement")
SvXMLExport & GetExport()
constexpr OUStringLiteral gsPropertySequenceValue(u"SequenceValue")
SvXMLEnumMapEntry< sal_Int16 > const aBibliographyDataTypeMap[]
static enum FieldIdEnum GetFieldID(const css::uno::Reference< css::text::XTextField > &rTextField, const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
get field ID from XTextField (and it's Property-Set)
constexpr OUStringLiteral gsPropertyInitials(u"Initials")
constexpr OUStringLiteral gsPropertyIsHidden(u"IsHidden")
char const FIELD_SERVICE_TEMPLATE_NAME[]
constexpr OUStringLiteral gsPropertyHelp(u"Help")
constexpr OUStringLiteral gsPropertyDependentTextFields(u"DependentTextFields")
constexpr OUStringLiteral gsPropertyDDECommandType(u"DDECommandType")
char const FIELD_SERVICE_HIDDEN_PARAGRAPH[]
constexpr OUStringLiteral gsPropertySelectedItem(u"SelectedItem")
char const FIELD_SERVICE_DOC_INFO_KEY_WORDS[]
char const FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR[]
char const FIELD_SERVICE_CHAPTER[]
void ExportSingleEvent(const css::uno::Sequence< css::beans::PropertyValue > &rEventValues, const OUString &rApiEventName, bool bUseWhitespace=true)
export a single event (writes element)
static enum::xmloff::token::XMLTokenEnum MapChapterDisplayFormat(sal_Int16 nType)
map ChapterDisplayFormat to XML string
constexpr OUStringLiteral gsPropertyIsExpression(u"IsExpression")
static sal_Int16 GetInt16Property(const OUString &, const Reference< XPropertySet > &)
char const FIELD_SERVICE_DB_NAME[]
char const FIELD_SERVICE_DDE[]
char const FIELD_SERVICE_DOC_INFO_SUBJECT2[]
char const FIELD_SERVICE_REFERENCE_PAGE_SET[]
char const FIELD_SERVICE_TABLE_FORMULA[]
XMLTextFieldExport(SvXMLExport &rExp, std::unique_ptr< XMLPropertyState > pCombinedCharState)
constexpr OUStringLiteral gsPropertyDateTime(u"DateTime")
constexpr OUStringLiteral gsPropertyFalseContent(u"FalseContent")
constexpr OUStringLiteral gsPropertyIsConditionTrue(u"IsConditionTrue")
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
SvXMLEnumStringMapEntry< FieldIdEnum > const aFieldServiceNameMapping[]
constexpr sal_uInt16 XML_NAMESPACE_FORM
void ProcessString(enum::xmloff::token::XMLTokenEnum eXmlName, const OUString &sValue, bool bOmitEmpty=false, sal_uInt16 nPrefix=XML_NAMESPACE_TEXT)
default value
constexpr OUStringLiteral gsPropertyURLContent(u"URLContent")
char const FIELD_SERVICE_COMBINED_CHARACTERS[]
constexpr OUStringLiteral gsPropertyAdjust(u"Adjust")
char const FIELD_SERVICE_DOC_INFO_SUBJECT[]
char const FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR[]
static bool GetOptionalBoolProperty(const OUString &, const Reference< XPropertySet > &, const Reference< XPropertySetInfo > &, bool bDefault)
char const FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR[]
OUString GetRelativeReference(const OUString &rValue)
char const FIELD_SERVICE_TABLE_COUNT[]
virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat=false) const
constexpr OUStringLiteral gsPropertyOffset(u"Offset")
constexpr OUStringLiteral sEventType
void ProcessTimeOrDateTime(enum::xmloff::token::XMLTokenEnum eXMLName, const css::util::DateTime &rTime)
date/time value
constexpr OUStringLiteral gsPropertyNumberingSeparator(u"NumberingSeparator")
bool convertNumFormat(sal_Int16 &rType, const OUString &rNumFormat, std::u16string_view rNumLetterSync, bool bNumberNone=false) const
convert num-format and num-letter-sync values to NumberingType
constexpr OUStringLiteral gsPropertyPlaceholderType(u"PlaceHolderType")
SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const
returns the deterministic version for odf export
char const FIELD_SERVICE_CHARACTER_COUNT[]
static util::DateTime GetDateTimeProperty(const OUString &sPropName, const Reference< XPropertySet > &xPropSet)
constexpr OUStringLiteral gsFieldMasterPrefix(u"com.sun.star.text.FieldMaster.")
constexpr OUStringLiteral gsPropertySetNumber(u"SetNumber")
constexpr OUStringLiteral gsPropertyTextRange(u"TextRange")
static enum::xmloff::token::XMLTokenEnum MapMeasureKind(sal_Int16 nKind)
Map a const char* (with length) to a sal_uInt16 value.
char const FIELD_SERVICE_META[]
char const FIELD_SERVICE_SCRIPT[]
void ProcessValueAndType(bool bIsString, sal_Int32 nFormatKey, const OUString &sContent, std::u16string_view sDefault, double fValue, bool bExportValue, bool bExportValueType, bool bExportStyle, bool bForceSystemLanguage, bool bTimeStyle=false)
is show command/show name?
void ProcessBoolean(enum::xmloff::token::XMLTokenEnum eXmlName, bool bBool, bool bDefault)
export a boolean attribute
char const FIELD_SERVICE_SETEXP[]
void ExportDataBaseElement(enum::xmloff::token::XMLTokenEnum eElement, const OUString &sContent, const css::uno::Reference< css::beans::XPropertySet > &rPropertySet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropertySetInfo)
export attributes that describe a data source
char const FIELD_SERVICE_AUTHOR[]
#define DBG_ASSERT(sCon, aError)
char const FIELD_SERVICE_GET_REFERENCE[]
char const FIELD_SERVICE_OBJECT_COUNT[]
char const FIELD_SERVICE_DOC_INFO_REVISION2[]
XMLEventExport & GetEventExport()
get Event export, with handlers for script types "None" and "StarBasic" already registered; other han...
bool getNextToken(std::u16string_view &rToken)
constexpr sal_uInt16 XML_NAMESPACE_TEXT
char const FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME[]
char const FIELD_SERVICE_USER[]
char const FIELD_SERVICE_DOC_INFO_TITLE2[]
void ProcessDateTime(enum::xmloff::token::XMLTokenEnum eXMLName, double dValue, bool bIsDate, bool bIsDuration, bool bOmitDurationIfZero=true, sal_uInt16 nPrefix=XML_NAMESPACE_TEXT)
exporting a time style?
char const FIELD_SERVICE_USERINPUT[]
constexpr OUStringLiteral gsPropertyDateTimeValue(u"DateTimeValue")
static enum::xmloff::token::XMLTokenEnum MapReferenceSource(sal_Int16 nType)
map ReferenceFieldPart to XML string
char const FIELD_SERVICE_PAGE_NAME[]
char const FIELD_SERVICE_MACRO[]
void convertDateTime(OUStringBuffer &rBuffer, const double &fDateTime, bool const bAddTimeIf0AM=false)
convert double to ISO Date Time String
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
constexpr OUStringLiteral gsPropertySubType(u"SubType")
char const FIELD_SERVICE_DOC_INFO_CUSTOM[]
char const FIELD_SERVICE_WORD_COUNT[]
static void convertDateTime(OUStringBuffer &rBuffer, const css::util::DateTime &rDateTime, sal_Int16 const *pTimeZoneOffset, bool bAddTimeIf0AM=false)
static OUString MakeFootnoteRefName(sal_Int16 nSeqNo)
out: variable name
constexpr OUStringLiteral gsPresentationServicePrefix(u"com.sun.star.presentation.TextField.")
void ProcessCommandType(sal_Int32 nCommandType)
export CommandTypeAttribute
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
void ExportFieldHelper(const css::uno::Reference< css::text::XTextField > &rTextField, const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySet > &rRangePropSet, enum FieldIdEnum nToken, bool bProgress, bool &rPrevCharIsSpace)
export a field after is already written
constexpr OUStringLiteral gsPropertyIsVisible(u"IsVisible")
constexpr OUStringLiteral gsPropertyCondition(u"Condition")
char const FIELD_SERVICE_FILE_NAME[]
constexpr OUStringLiteral gsPropertySourceName(u"SourceName")
constexpr OUStringLiteral gsPropertyReferenceFieldLanguage(u"ReferenceFieldLanguage")
static void convertTimeOrDateTime(OUStringBuffer &rBuffer, const css::util::DateTime &rDateTime)
char const FIELD_SERVICE_DOC_INFO_CUSTOM2[]
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
constexpr OUStringLiteral gsPropertyTrueContent(u"TrueContent")
constexpr sal_uInt16 XML_NAMESPACE_DC
char const FIELD_SERVICE_DB_NUMBER[]
char const FIELD_SERVICE_GETEXP[]
static enum::xmloff::token::XMLTokenEnum MapSenderFieldName(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
element name for sender fields
void SetExportOnlyUsedFieldDeclarations(bool bExportOnlyUsed=true)
export all field declarations, or only those that have been used? Calling this method will reset the ...
const SvXMLNamespaceMap & GetNamespaceMap() const
static css::uno::Reference< css::beans::XPropertySet > GetMasterPropertySet(const css::uno::Reference< css::text::XTextField > &rTextField)
for XDependentTextFields, get PropertySet of FieldMaster
static bool convertBool(bool &rBool, std::u16string_view rString)
static OUString GetStringProperty(const OUString &, const Reference< XPropertySet > &)
constexpr OUStringLiteral gsPropertyFields(u"Fields")
char const FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2[]
constexpr OUStringLiteral gsPropertyFullName(u"FullName")
constexpr OUStringLiteral gsPropertyFieldSubType(u"UserDataType")
constexpr OUStringLiteral gsPropertyHint(u"Hint")
static enum::xmloff::token::XMLTokenEnum MapTemplateDisplayFormat(sal_Int16 nType)
map TemplateDisplayFormat to XML
void ProcessBibliographyData(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
date/time value
static bool GetDependentFieldPropertySet(const css::uno::Reference< css::beans::XPropertySet > &xmaster, css::uno::Reference< css::beans::XPropertySet > &xField)
get PropertySet of (any) DependentTextField for this FieldMaster
std::unique_ptr< XMLPropertyState > pCombinedCharactersPropertyState
constexpr OUStringLiteral gsPropertyDataBaseName(u"DataBaseName")
Map an XMLTokenEnum to an enum value.
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION
static void convertNumLetterSync(OUStringBuffer &rBuffer, sal_Int16 nType)
std::unique_ptr< char[]> aBuffer
char const FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2[]
constexpr OUStringLiteral gsPropertyURL(u"URL")
char const FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME[]
char const FIELD_SERVICE_DOC_INFO_REVISION[]
constexpr OUStringLiteral gsPropertyDataColumnName(u"DataColumnName")
char const FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME[]
char const FIELD_SERVICE_ANNOTATION[]
char const FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2[]
#define SAL_WARN_IF(condition, area, stream)
char const FIELD_SERVICE_DOC_INFO_TITLE[]
static sal_Int32 GetIntProperty(const OUString &, const Reference< XPropertySet > &)
constexpr OUStringLiteral sScript
char const FIELD_SERVICE_DOC_INFO_DESCRIPTION[]
constexpr OUStringLiteral gsPropertyReferenceFieldSource(u"ReferenceFieldSource")
constexpr OUStringLiteral gsPropertyChapterFormat(u"ChapterFormat")
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
char const FIELD_SERVICE_CONDITIONAL_TEXT[]
Handling of tokens in XML:
void Characters(const OUString &rChars)
char const FIELD_SERVICE_BIBLIOGRAPHY[]
std::map< OUString, rtl::Reference< Entity > > map
constexpr OUStringLiteral gsPropertyIsInput(u"Input")
void ProcessNumberingType(sal_Int16 nNumberingType)
export a numbering format (numeric, roman, alphabetic, etc.)
Smart struct to transport an Any with an index to the appropriate property-name.
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
char const FIELD_SERVICE_JUMPEDIT[]
XMLTokenEnum
The enumeration of all XML tokens.
constexpr OUStringLiteral gsPropertyTargetFrame(u"TargetFrame")
Sequence< sal_Int8 > aSeq
static enum::xmloff::token::XMLTokenEnum MapBibliographyFieldName(std::u16string_view sName)
char const FIELD_SERVICE_SHEET_NAME[]
char const FIELD_SERVICE_DB_DISPLAY[]
static enum::xmloff::token::XMLTokenEnum MapDocInfoFieldName(enum FieldIdEnum nToken)
sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const
constexpr OUStringLiteral gsPropertyFileFormat(u"FileFormat")
static enum::xmloff::token::XMLTokenEnum MapPageNumberName(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, sal_Int32 &nOffset)
static sal_Int8 GetInt8Property(const OUString &, const Reference< XPropertySet > &)
constexpr OUStringLiteral gsPropertyMeasureKind(u"Kind")
char const FIELD_SERVICE_DOC_INFO_EDIT_TIME[]
char const FIELD_SERVICE_GRAPHIC_COUNT[]
bool hasProperty(const OUString &_rName, const Reference< XPropertySet > &_rxSet)
char const FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2[]
#define SAL_WARN(area, stream)
char const FIELD_SERVICE_DOC_INFO_DESCRIPTION2[]
void(* f)(TrueTypeTable *)
constexpr OUStringLiteral gsPropertyScriptType(u"ScriptType")
constexpr OUStringLiteral gsPropertyOn(u"On")
char const FIELD_SERVICE_PAGENUMBER[]
char const FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2[]
void AddAttributeXmlId(css::uno::Reference< css::uno::XInterface > const &i_xIfc)
add xml:id attribute (for RDF metadata)
constexpr sal_uInt16 XML_NAMESPACE_META
constexpr OUStringLiteral gsPropertyItems(u"Items")
void ExportMacro(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const OUString &rContent)
element content
constexpr OUStringLiteral gsPropertyDataTableName(u"DataTableName")
char const FIELD_SERVICE_SENDER[]
virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat=false)
constexpr OUStringLiteral gsPropertyDataBaseURL(u"DataBaseURL")
constexpr OUStringLiteral gsPropertyUserText(u"UserText")
constexpr sal_uInt16 XML_NAMESPACE_OOOW
char const FIELD_SERVICE_INPUT[]
char const FIELD_SERVICE_URL[]
static enum FieldIdEnum MapFieldName(std::u16string_view sFieldName, const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
get field ID from XTextField service name (and it's PropertySet)
void ProcessIntegerDef(enum::xmloff::token::XMLTokenEnum eXmlName, sal_Int32 nNum, sal_Int32 nDefault)
attribute value
constexpr OUStringLiteral gsPropertyIsShowFormula(u"IsShowFormula")
constexpr OUStringLiteral gsServicePrefix(u"com.sun.star.text.textfield.")
constexpr OUStringLiteral gsPropertyIsAutomaticUpdate(u"IsAutomaticUpdate")
constexpr OUStringLiteral gsPropertyAuthor(u"Author")
static void ExplodeFieldMasterName(std::u16string_view sMasterName, OUString &sFieldType, OUString &sVarName)
explode a field master name into field type and field name
constexpr OUStringLiteral gsPropertyIsFixedLanguage(u"IsFixedLanguage")
constexpr sal_uInt16 XML_NAMESPACE_STYLE
constexpr OUStringLiteral gsPropertySequenceNumber(u"SequenceNumber")
constexpr OUStringLiteral gsPropertyDDECommandFile(u"DDECommandFile")
constexpr OUStringLiteral gsPropertyIsDataBaseFormat(u"DataBaseFormat")
constexpr OUStringLiteral gsPropertyCharStyleNames(u"CharStyleNames")
constexpr OUStringLiteral gsPropertyIsFixed(u"IsFixed")
bool m_bDetectedRangeSegmentation false
void Export(css::uno::Reference< css::document::XEventsSupplier > const &xAccess, bool bUseWhitespace=true)
export the events (calls EventExport::Export(Reference) )
static enum::xmloff::token::XMLTokenEnum MapAuthorFieldName(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
also adjust page offset
char const FIELD_SERVICE_DB_SELECT[]
static enum::xmloff::token::XMLTokenEnum MapPlaceholderType(sal_uInt16 nType)
map placeholder type
#define ENUM_STRING_MAP_ENTRY(name, tok)