24#include <libxml/xmlwriter.h>
26#include <rtl/math.hxx>
32#include <osl/diagnose.h>
46#include <unofield.hxx>
134 :
sw::BroadcastingModify()
159 std::vector<SwFormatField*> vFields;
163 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwFieldType"));
164 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
165 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"symbol"),
"%s", BAD_CAST(
typeid(*this).name()));
166 for(
const auto pFormatField: vFields)
167 pFormatField->dumpAsXml(pWriter);
168 (void)xmlTextWriterEndElement(pWriter);
190 bool bHasHiddenInformationNotes =
false;
192 return bHasHiddenInformationNotes;
231 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwFieldTypes"));
234 (*
this)[
nType]->dumpAsXml(pWriter);
235 (void)xmlTextWriterEndElement(pWriter);
246 bool bUseFieldValueCache)
250 , m_bUseFieldValueCache( bUseFieldValueCache )
251 , m_bIsAutomaticLanguage( true )
441 bRet =
static_cast<const SwSetExpField*
>(
this)->GetInputFlag();
513 std::unique_ptr<SwField> pNew =
Copy();
526 return OUString::number( nNum );
541 if (rString ==
u"Date")
543 if (rString ==
u"Time")
545 if (rString ==
u"Filename")
547 if (rString ==
u"DatabaseName")
549 if (rString ==
u"Chapter")
551 if (rString ==
u"PageNumber")
553 if (rString ==
u"DocumentStatistics")
555 if (rString ==
u"Author")
557 if (rString ==
u"Set")
559 if (rString ==
u"Get")
561 if (rString ==
u"Formel")
563 if (rString ==
u"HiddenText")
565 if (rString ==
u"SetRef")
579 , m_pDoc(rTyp.GetDoc())
580 , m_bUseFormat(rTyp.UseFormat())
593 const Color* pCol =
nullptr;
606 if (nNewFormat == nFormat)
617 nFormat = nNewFormat;
619 OSL_ENSURE(pEntry,
"unknown number format!");
635 sal_uInt32 nFormat)
const
656 return ::rtl::math::doubleToUString( rVal, rtl_math_StringFormat_F, 12,
666 if (pEntry && (pEntry->
GetType() & SvNumFormatType::DATETIME))
678 :
SwField(pFieldType, nFormat, nLng)
705 if( pNewDoc && pDoc && pDoc != pNewDoc)
728 if (nNewFormat == nFormat)
736 sal_uInt32 nTempFormat = nFormat;
739 nFormat = nTempFormat;
742 nFormat = nNewFormat;
750 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwValueField"));
751 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_fValue"), BAD_CAST(OString::number(
m_fValue).getStr()));
753 (void)xmlTextWriterEndElement(pWriter);
774 if( pEntry && nFormatLng != pEntry->
GetLanguage() )
792 OSL_ENSURE(pEntry,
"unknown number format!");
849 if (
GetDoc()->IsNumberFormat(rStr, nFormat, fTmpValue))
869 OUString sFormattedValue;
870 const Color* pCol =
nullptr;
883 return sFormattedValue;
933 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwField"));
934 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"symbol"),
"%s", BAD_CAST(
typeid(*this).name()));
935 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
936 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nFormat"), BAD_CAST(OString::number(
m_nFormat).getStr()));
937 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nLang"), BAD_CAST(OString::number(
m_nLang.
get()).getStr()));
938 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_aTitle"), BAD_CAST(
m_aTitle.toUtf8().getStr()));
940 (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
Represents an inserted bibliography entry, created using Insert -> Table of Contents and Index -> Bib...
OUString ConditionalExpandAuthIdentifier(SwRootFrame const *pLayout) const
For internal use only, in general continue using ExpandField() instead.
static LanguageType GetDocAppScriptLang(SwDoc const &rDoc)
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.
void SetXObject(rtl::Reference< SwXFieldMaster > const &xFieldMaster)
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
void UpdateDocPos(const SwTwips nDocPos)
SwFormatField * FindFormatForPostItId(sal_uInt32 nPostItId) const
unotools::WeakReference< SwXFieldMaster > m_wXFieldMaster
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
OUString GetInputOrDateTime(const OUString &rInput, const double &rVal, sal_uInt32 nFormat) const
Query input or formatted value for dialog.
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()
DocPosUpdate is sent to signal that only the frames from or to a specified document-global position h...
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)
sal_Int32 indexOfAny(std::u16string_view rIn, sal_Unicode const *const pChars, sal_Int32 const nPos)
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