24#include <libxml/xmlwriter.h>
26#include <rtl/math.hxx>
31#include <osl/diagnose.h>
132 :
sw::BroadcastingModify()
157 std::vector<SwFormatField*> vFields;
161 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwFieldType"));
162 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
163 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"symbol"),
"%s", BAD_CAST(
typeid(*this).name()));
164 for(
const auto pFormatField: vFields)
165 pFormatField->dumpAsXml(pWriter);
166 (void)xmlTextWriterEndElement(pWriter);
188 bool bHasHiddenInformationNotes =
false;
190 return bHasHiddenInformationNotes;
220 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwFieldTypes"));
223 (*
this)[
nType]->dumpAsXml(pWriter);
224 (void)xmlTextWriterEndElement(pWriter);
233 bool bUseFieldValueCache)
237 , m_bUseFieldValueCache( bUseFieldValueCache )
238 , m_bIsAutomaticLanguage( true )
427 bRet =
static_cast<const SwSetExpField*
>(
this)->GetInputFlag();
433 bRet = pAuthorityField->
HasURL();
506 std::unique_ptr<SwField> pNew =
Copy();
519 return OUString::number( nNum );
534 if (rString ==
u"Date")
536 if (rString ==
u"Time")
538 if (rString ==
u"Filename")
540 if (rString ==
u"DatabaseName")
542 if (rString ==
u"Chapter")
544 if (rString ==
u"PageNumber")
546 if (rString ==
u"DocumentStatistics")
548 if (rString ==
u"Author")
550 if (rString ==
u"Set")
552 if (rString ==
u"Get")
554 if (rString ==
u"Formel")
556 if (rString ==
u"HiddenText")
558 if (rString ==
u"SetRef")
572 , m_pDoc(rTyp.GetDoc())
573 , m_bUseFormat(rTyp.UseFormat())
586 const Color* pCol =
nullptr;
599 if (nNewFormat == nFormat)
610 nFormat = nNewFormat;
612 OSL_ENSURE(pEntry,
"unknown number format!");
628 sal_uInt32 nFormat)
const
649 return ::rtl::math::doubleToUString( rVal, rtl_math_StringFormat_F, 12,
655 :
SwField(pFieldType, nFormat, nLng)
682 if( pNewDoc && pDoc && pDoc != pNewDoc)
705 if (nNewFormat == nFormat)
713 sal_uInt32 nTempFormat = nFormat;
716 nFormat = nTempFormat;
719 nFormat = nNewFormat;
727 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwValueField"));
728 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_fValue"), BAD_CAST(OString::number(
m_fValue).getStr()));
730 (void)xmlTextWriterEndElement(pWriter);
751 if( pEntry && nFormatLng != pEntry->
GetLanguage() )
769 OSL_ENSURE(pEntry,
"unknown number format!");
825 if (
GetDoc()->IsNumberFormat(rStr, nFormat, fTmpValue))
842 OUString sFormattedValue;
843 const Color* pCol =
nullptr;
856 return sFormattedValue;
886 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwField"));
887 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"symbol"),
"%s", BAD_CAST(
typeid(*this).name()));
888 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
889 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nFormat"), BAD_CAST(OString::number(
m_nFormat).getStr()));
890 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nLang"), BAD_CAST(OString::number(
m_nLang.
get()).getStr()));
891 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_aTitle"), BAD_CAST(
m_aTitle.toUtf8().getStr()));
893 (void)xmlTextWriterEndElement(pWriter);
LanguageType getLanguageType(bool bResolveSystem=true) const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
const LanguageTag & GetLanguageTag() const
void SetNumberingType(SvxNumType nSet)
OUString GetNumStr(sal_Int32 nNo) const
invariant for SwAuthorityField is that it is always registered at its SwAuthorityFieldType via AddFie...
OUString ConditionalExpandAuthIdentifier(SwRootFrame const *pLayout) const
For internal use only, in general continue using ExpandField() instead.
static bool Str2Double(const OUString &rStr, sal_Int32 &rPos, double &rVal)
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Instances of SwFields and those derived from it occur 0 to n times.
virtual void UpdateFields()
virtual OUString GetName() const
Only in derived classes.
void GatherRefFields(std::vector< SwGetRefField * > &rvRFields, const sal_uInt16 nTyp)
virtual void QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const
void GatherDdeTables(std::vector< SwDDETable * > &rvTables) const
virtual void PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich)
static void GetFieldName_()
Sets up FieldNames; fldmgr.cxx!
SwFormatField * FindFormatForField(const SwField *) const
void CollectPostIts(std::vector< SwFormatField * > &rvFormatFields, IDocumentRedlineAccess const &rIDRA, bool HideRedlines)
static const OUString & GetTypeStr(SwFieldTypesEnum nTypeId)
void GatherNodeIndex(std::vector< SwNodeOffset > &rvNodeIndex)
SwFieldType(SwFieldIds nWhichId)
Single argument ctors shall be explicit.
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
SwFormatField * FindFormatForPostItId(sal_uInt32 nPostItId) const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
static std::vector< OUString > * s_pFieldNames
field names
bool HasHiddenInformationNotes() const
void dumpAsXml(xmlTextWriterPtr pWriter) const
Base class of all fields.
virtual void SetLanguage(LanguageType nLng)
SwFieldTypesEnum GetTypeId() const
virtual OUString GetFormula() const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
bool HasClickHdl() const
Does the field possess an action on its ClickHandler? (e.g. INetFields, ...).
virtual OUString GetPar1() const
std::unique_ptr< SwField > CopyField() const
virtual void SetPar1(const OUString &rStr)
virtual void SetPar2(const OUString &rStr)
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const =0
bool IsClickable() const
Is this field clickable?
void ChangeFormat(sal_uInt32 n)
bool IsAutomaticLanguage() const
SwField(SwFieldType *pTyp, sal_uInt32 nFormat=0, LanguageType nLang=LANGUAGE_SYSTEM, bool m_bUseFieldValueCache=true)
virtual sal_uInt16 GetSubType() const
OUString m_Cache
Cached expansion (for clipboard).
OUString m_aTitle
Used for tooltip purposes when it's not-empty.
void SetFormat(sal_uInt32 const nSet)
LanguageType m_nLang
this can be either SvxNumType or SwChapterFormat depending on the subtype
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
bool m_bIsAutomaticLanguage
control the usage of the cached field value
virtual OUString GetFieldName() const
get name or content
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
virtual SwFieldType * ChgTyp(SwFieldType *)
Set new type (used for copying among documents).
virtual OUString GetDescription() const
SwFieldType * GetTyp() const
SwFieldIds Which() const
ResId.
virtual std::unique_ptr< SwField > Copy() const =0
virtual OUString GetPar2() const
bool m_bUseFieldValueCache
virtual void SetSubType(sal_uInt16)
The root element of a Writer document layout.
bool GetInputFlag() const
Fields containing values that have to be formatted via number formatter.
OUString ExpandValue(const double &rVal, sal_uInt32 nFormat, LanguageType nLng) const
return value formatted as string
SwValueFieldType(SwDoc *pDocPtr, SwFieldIds nWhichId)
OUString DoubleToString(const double &rVal, LanguageType eLng) const
virtual void SetLanguage(LanguageType nLng) override
set language of the format
virtual SwFieldType * ChgTyp(SwFieldType *) override
Set a new type.
void dumpAsXml(xmlTextWriterPtr pWriter) const override
virtual double GetValue() const
virtual ~SwValueField() override
static sal_uInt32 GetSystemFormat(SvNumberFormatter *pFormatter, sal_uInt32 nFormat)
get format in office language
virtual void SetValue(const double &rVal)
SwValueField(SwValueFieldType *pFieldType, sal_uInt32 nFormat, LanguageType nLang=LANGUAGE_SYSTEM, const double fVal=0.0)
static ShellResource * GetShellRes()
struct _xmlTextWriter * xmlTextWriterPtr
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
OUString FormatNumber(sal_uInt32 nNum, SvxNumType nFormat, LanguageType nLang)
expand numbering
static LanguageType lcl_GetLanguageOfFormat(LanguageType nLng, sal_uLong nFormat, const SvNumberFormatter &rFormatter)
SwFieldTypesEnum SwFieldTypeFromString(std::u16string_view rString)
SwFieldTypesEnum
List of FieldTypes at UI.
constexpr TypedWhichId< SwMsgPoolItem > RES_HIDDENPARA_PRINT(178)
LanguageType GetAppLanguage()
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
const SwDocInfoSubType DI_SUB_FIXED
const SwExtendedSubType SUB_CMD
Show command.
const SwGetSetExpType GSE_SEQ
Sequence.
const SwGetSetExpType GSE_FORMULA
Formula.
Dialog to specify the properties of date form field.
sal_uInt16 const m_nFormat
static LanguageType nLang
UNDERLYING_TYPE get() const
OUString SwResId(TranslateId aId)
#define SV_COUNTRY_LANGUAGE_OFFSET
NF_DATETIME_SYSTEM_SHORT_HHMM