20#include <config_features.h>
21#include <config_fuzzers.h>
26#include <com/sun/star/frame/XModel.hpp>
27#include <com/sun/star/text/XText.hpp>
28#include <com/sun/star/script/Converter.hpp>
29#include <com/sun/star/text/PlaceholderType.hpp>
30#include <com/sun/star/text/TemplateDisplayFormat.hpp>
31#include <com/sun/star/text/PageNumberType.hpp>
32#include <com/sun/star/text/FilenameDisplayFormat.hpp>
33#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
34#include <com/sun/star/document/XDocumentProperties.hpp>
35#include <com/sun/star/util/Date.hpp>
36#include <com/sun/star/util/Duration.hpp>
47#include <libxml/xmlstring.h>
48#include <libxml/xmlwriter.h>
51#include <tools/datetime.hxx>
53#include <com/sun/star/util/DateTime.hpp>
92#define URL_DECODE INetURLObject::DecodeMechanism::Unambiguous
106 sal_uInt16
const nPageNumber, sal_uInt16
const nMaxPage,
110 int const nTmp = nPageNumber + nOff;
139 if (!(bVirt && pDoc))
147 if( pDesc && pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
158 else if(
dynamic_cast< const SwFormat*
>(pDesc->GetDefinedIn()) !=
nullptr)
161 m_bVirtual = !pDesc->GetDefinedIn()->GetInfo( aGetHt );
169 sal_uInt16 nSub, sal_uInt32 nFormat,
short nOff,
170 sal_uInt16
const nPageNumber, sal_uInt16
const nMaxPage)
171 :
SwField(pTyp, nFormat), m_nSubType(nSub), m_nOffset(nOff)
172 , m_nPageNumber(nPageNumber)
173 , m_nMaxPage(nMaxPage)
178 sal_uInt16
const nMaxPage)
217 return std::unique_ptr<SwField>(pTmp.release());
227 m_nOffset =
static_cast<short>(rStr.toInt32());
240 rAny <<= static_cast<sal_Int16>(
GetFormat());
247 text::PageNumberType
eType;
248 eType = text::PageNumberType_CURRENT;
250 eType = text::PageNumberType_PREV;
252 eType = text::PageNumberType_NEXT;
286 case text::PageNumberType_CURRENT:
289 case text::PageNumberType_PREV:
292 case text::PageNumberType_NEXT:
317 if((nFormat & 0xff) ==
AF_NAME)
321 std::size_t nAuthor =
SW_MOD()->GetRedlineAuthor();
322 OUString sAuthor =
SW_MOD()->GetRedlineAuthor(nAuthor);
323 if (sAuthor.isEmpty())
334 return std::make_unique<SwAuthorFieldType>();
357 return std::unique_ptr<SwField>(pTmp.release());
394 if( *o3tl::doAccess<bool>(rAny) )
423 if( pDShell && pDShell->
HasName() )
445 aRet = aRet.copy(0,
nPos);
473 return std::make_unique<SwFileNameFieldType>(
m_rDoc);
492 std::unique_ptr<SwFileNameField> pTmp(
496 return std::unique_ptr<SwField>(pTmp.release());
509 nRet = text::FilenameDisplayFormat::PATH;
515 nRet = text::FilenameDisplayFormat::NAME_AND_EXT;
517 default: nRet = text::FilenameDisplayFormat::FULL;
551 case text::FilenameDisplayFormat::PATH:
557 case text::FilenameDisplayFormat::NAME_AND_EXT:
569 if( *o3tl::doAccess<bool>(rAny) )
593 OSL_ENSURE( nFormat <
FF_END,
"Expand: no valid Format!" );
597 OSL_ENSURE(pDocShell,
"no SwDocShell");
599 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
600 pDocShell->
GetModel(), uno::UNO_QUERY_THROW);
601 uno::Reference<document::XDocumentProperties> xDocProps(
602 xDPS->getDocumentProperties());
603 OSL_ENSURE(xDocProps.is(),
"Doc has no DocumentProperties");
606 aRet = xDocProps->getTemplateName();
607 else if( !xDocProps->getTemplateURL().isEmpty() )
615 aFac.
GetLogicNames( xDocProps->getTemplateURL(), sRegion, sTmp );
643 return std::make_unique<SwTemplNameFieldType>(
m_rDoc);
669 case FF_PATH: nRet = text::FilenameDisplayFormat::PATH;
break;
671 case FF_NAME: nRet = text::FilenameDisplayFormat::NAME_AND_EXT;
break;
672 case FF_UI_RANGE: nRet = text::TemplateDisplayFormat::AREA;
break;
673 case FF_UI_NAME: nRet = text::TemplateDisplayFormat::TITLE;
break;
674 default: nRet = text::FilenameDisplayFormat::FULL;
700 case text::FilenameDisplayFormat::PATH:
706 case text::FilenameDisplayFormat::NAME_AND_EXT:
709 case text::TemplateDisplayFormat::AREA :
712 case text::TemplateDisplayFormat::TITLE :
753 OSL_FAIL(
"SwDocStatFieldType::Expand: unknown SubType" );
756 if( nVal <= SHRT_MAX )
759 return OUString::number( nVal );
764 return std::make_unique<SwDocStatFieldType>(
m_rDoc);
784 return std::make_unique<SwDocStatField>(
810 rAny <<= static_cast<sal_Int16>(
GetFormat());
853 return std::make_unique<SwDocInfoFieldType>(
GetDoc());
862 *ppLocalData = *ppAppLocalData;
863 if(
nLang != (*ppLocalData)->getLanguageTag().getLanguageType() )
872 OSL_ENSURE(pDocShell,
"no SwDocShell");
873 if (!pDocShell) {
return OUString(); }
875 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
876 pDocShell->
GetModel(), uno::UNO_QUERY_THROW);
877 uno::Reference<document::XDocumentProperties> xDocProps(
878 xDPS->getDocumentProperties());
879 OSL_ENSURE(xDocProps.is(),
"Doc has no DocumentProperties");
881 sal_uInt16 nExtSub = nSub & 0xff00;
889 case DI_KEYS:
aStr = ::comphelper::string::convertCommaSeparated(
890 xDocProps->getKeywords());
894 xDocProps->getEditingCycles() );
900 sal_Int32 dur = xDocProps->getEditingDuration();
903 aStr = pLocalData->getTime(
tools::Time(dur/3600, (dur%3600)/60, dur%60),
908 sal_Int32 dur = xDocProps->getEditingDuration();
919 uno::Reference < beans::XPropertySet > xSet(
920 xDocProps->getUserDefinedProperties(),
921 uno::UNO_QUERY_THROW);
922 aAny = xSet->getPropertyValue( rName );
928 catch (uno::Exception&) {}
934 OUString
aName( xDocProps->getAuthor() );
935 util::DateTime uDT( xDocProps->getCreationDate() );
941 aName = xDocProps->getModifiedBy();
942 uDT = xDocProps->getModificationDate();
947 aName = xDocProps->getPrintedBy();
948 if ( !std::getenv(
"STABLE_FIELDS_HACK") )
950 uDT = xDocProps->getPrintDate();
970 aStr = pLocalData->getTime( aDate,
987 aStr = pLocalData->getDate( aDate );
1003 if( pAppLocalData != pLocalData )
1028 const double fNanoSecondsPerDay = 86400000000000.0;
1029 return ( (rTime.Hours * SAL_CONST_INT64(3600000000000))
1030 + (rTime.Minutes * SAL_CONST_INT64( 60000000000))
1031 + (rTime.Seconds * SAL_CONST_INT64( 1000000000))
1032 + (rTime.NanoSeconds))
1033 / fNanoSecondsPerDay;
1041 return double( nDate - nNullDate );
1060 uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->
GetModel(), uno::UNO_QUERY_THROW);
1061 uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties());
1062 uno::Reference < beans::XPropertySet > xSet( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
1063 uno::Reference < beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
1066 if( xSetInfo->hasPropertyByName(
m_aName ) )
1067 aAny = xSet->getPropertyValue(
m_aName );
1077 util::DateTime aDateTime;
1078 util::Duration aDuration;
1085 else if( aAny >>= aDateTime )
1087 double fDateTime = lcl_TimeToDouble<util::DateTime>( aDateTime );
1090 fDateTime += lcl_DateToDouble<util::DateTime>( aDateTime, rNullDate );
1093 else if( aAny >>= aDuration )
1095 sVal = OUStringChar(aDuration.Negative ?
'-' :
'+')
1097 sVal = sVal.replaceFirst(
"%1", OUString::number( aDuration.Years ) );
1098 sVal = sVal.replaceFirst(
"%2", OUString::number( aDuration.Months ) );
1099 sVal = sVal.replaceFirst(
"%3", OUString::number( aDuration.Days ) );
1100 sVal = sVal.replaceFirst(
"%4", OUString::number( aDuration.Hours ) );
1101 sVal = sVal.replaceFirst(
"%5", OUString::number( aDuration.Minutes) );
1102 sVal = sVal.replaceFirst(
"%6", OUString::number( aDuration.Seconds) );
1113 catch (uno::Exception&) {}
1151 return std::unique_ptr<SwField>(pField.release());
1185 rAny <<= static_cast<sal_Int16>(
m_aContent.toInt32());
1193 rAny <<= static_cast<sal_Int32>(
GetFormat());
1236 if(*o3tl::doAccess<bool>(rAny))
1254 if(*o3tl::doAccess<bool>(rAny))
1272 return std::make_unique<SwHiddenTextFieldType>(
m_bHidden );
1287 const OUString& rStr,
1290 SwField( pFieldType ), m_aCond(
std::move(aCond)), m_nSubType(nSub),
1291 m_bCanToggle(bConditional), m_bIsHidden(bHidden), m_bValid(false)
1317 :
SwField( pFieldType ), m_aTRUEText(
std::move(aTrue)), m_aFALSEText(
std::move(aFalse)), m_aCond(
std::move(aCond)), m_nSubType(nSub),
1318 m_bIsHidden(true), m_bValid(false)
1349#if !HAVE_FEATURE_DBCONNECTIVITY || ENABLE_FUZZERS
1360 if (sTmpName.getLength()>1 &&
1361 sTmpName.startsWith(
"\"") &&
1362 sTmpName.endsWith(
"\""))
1364 m_aContent = sTmpName.copy(1, sTmpName.getLength() - 2);
1367 else if(sTmpName.indexOf(
'\"')<0 &&
1371 if(sTmpName.startsWith(
"[") && sTmpName.endsWith(
"]"))
1373 sTmpName = sTmpName.copy(1, sTmpName.getLength() - 2);
1375#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1378 sal_Int32 nIdx{ 0 };
1379 OUString sDBName(
GetDBName( sTmpName, rDoc ));
1380 OUString sDataSource(sDBName.getToken(0,
DB_DELIM, nIdx));
1381 OUString sDataTableOrQuery(sDBName.getToken(0,
DB_DELIM, nIdx));
1382 if( pMgr->
IsInMerge() && !sDBName.isEmpty() &&
1384 sDataTableOrQuery,
false))
1391 else if( !sDBName.isEmpty() && !sDataSource.isEmpty() &&
1392 !sDataTableOrQuery.isEmpty() )
1413 std::unique_ptr<SwHiddenTextField> pField(
1421 return std::unique_ptr<SwField>(pField.release());
1441 sal_Int32
nPos = rStr.indexOf(
'|');
1532 return rName.copy(
nPos + 1);
1540 if(
nPos != std::u16string_view::npos )
1544 if(
nPos != std::u16string_view::npos )
1545 return OUString(rName.substr(0,
nPos));
1554 OUString& rCondition,
1566 std::vector<sal_Int32> wordPosition;
1568 bool quoted =
false;
1569 bool insideWord =
false;
1570 for (
size_t i = 0;
i < aFieldDefinition.size();
i++)
1574 if (aFieldDefinition[
i] ==
'\"')
1582 if (aFieldDefinition[
i] ==
' ')
1591 quoted = (aFieldDefinition[
i] ==
'\"');
1596 wordPosition.push_back(
i);
1597 quoted = (aFieldDefinition[
i] ==
'\"');
1608 if (wordPosition.size() < 4)
1614 const sal_Int32 conditionBegin = wordPosition[1];
1615 const sal_Int32 trueBegin = wordPosition[wordPosition.size() - 2];
1616 const sal_Int32 falseBegin = wordPosition[wordPosition.size() - 1];
1618 const sal_Int32 conditionLength = trueBegin - conditionBegin;
1619 const sal_Int32 trueLength = falseBegin - trueBegin;
1623 rCondition =
o3tl::trim(aFieldDefinition.substr(conditionBegin, conditionLength));
1624 rTrue =
o3tl::trim(aFieldDefinition.substr(trueBegin, trueLength));
1625 rFalse =
o3tl::trim(aFieldDefinition.substr(falseBegin));
1628 if (rCondition.getLength() >= 2)
1630 if (rCondition[0] ==
'\"' && rCondition[rCondition.getLength() - 1] ==
'\"')
1631 rCondition = rCondition.copy(1, rCondition.getLength() - 2);
1633 if (rTrue.getLength() >= 2)
1635 if (rTrue[0] ==
'\"' && rTrue[rTrue.getLength() - 1] ==
'\"')
1636 rTrue = rTrue.copy(1, rTrue.getLength() - 2);
1638 if (rFalse.getLength() >= 2)
1640 if (rFalse[0] ==
'\"' && rFalse[rFalse.getLength() - 1] ==
'\"')
1641 rFalse = rFalse.copy(1, rFalse.getLength() - 2);
1656 return std::make_unique<SwHiddenParaFieldType>();
1676 return std::unique_ptr<SwField>(pField.release());
1733 return std::make_unique<SwPostItFieldType>(
mrDoc);
1746 const bool bResolved,
1747 const sal_uInt32 nPostItId,
1748 const sal_uInt32 nParentId,
1749 const sal_uInt32 nParaId
1752 , m_sText(
std::move(aText) )
1753 , m_sAuthor(
std::move(aAuthor) )
1754 , m_sInitials(
std::move(aInitials) )
1756 , m_aDateTime( rDateTime )
1757 , m_bResolved( bResolved )
1758 , m_nParentId( nParentId )
1759 , m_nParaId( nParaId )
1804 pRet->SetTextObject( *
mpText );
1808 return std::unique_ptr<SwField>(pRet.release());
1844 mpText = std::move(pText);
1854 if (
mpText && pStyleSheet)
1900 auto pObj = std::make_unique<SwTextAPIEditSource>( &rDoc );
1925 rAny <<= OUString(OUString::number(
m_nParentId, 16).toAsciiUpperCase());
1930 rAny <<= OUString(OUString::number(
m_nPostItId, 16).toAsciiUpperCase());
1961 OSL_FAIL(
"Not implemented!");
1964 if(
auto aSetDate = o3tl::tryAccess<util::Date>(rAny) )
1971 util::DateTime aDateTimeValue;
1972 if(!(rAny >>= aDateTimeValue))
1999 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwPostItField"));
2000 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"name"), BAD_CAST(
GetName().toUtf8().getStr()));
2004 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"mpText"));
2005 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
mpText ? &*
mpText :
nullptr);
2008 (void)xmlTextWriterEndElement(pWriter);
2010 (void)xmlTextWriterEndElement(pWriter);
2022 return std::make_unique<SwExtUserFieldType>();
2030 case EU_FIRSTNAME: nRet = UserOptToken::FirstName;
break;
2031 case EU_NAME: nRet = UserOptToken::LastName;
break;
2034 case EU_COMPANY: nRet = UserOptToken::Company;
break;
2035 case EU_STREET: nRet = UserOptToken::Street;
break;
2036 case EU_TITLE: nRet = UserOptToken::Title;
break;
2037 case EU_POSITION: nRet = UserOptToken::Position;
break;
2040 case EU_FAX: nRet = UserOptToken::Fax;
break;
2041 case EU_EMAIL: nRet = UserOptToken::Email;
break;
2042 case EU_COUNTRY: nRet = UserOptToken::Country;
break;
2043 case EU_ZIP: nRet = UserOptToken::Zip;
break;
2044 case EU_CITY: nRet = UserOptToken::City;
break;
2045 case EU_STATE: nRet = UserOptToken::State;
break;
2047 case EU_APARTMENT: nRet = UserOptToken::Apartment;
break;
2048 default: OSL_ENSURE(
false,
"Field unknown");
2061 SwField(pTyp, nFormat), m_nType(nSubTyp)
2079 return std::unique_ptr<SwField>(pField.release());
2131 if( *o3tl::doAccess<bool>(rAny) )
2151 return std::make_unique<SwRefPageSetFieldType>();
2162 short nOff,
bool bFlag )
2163 :
SwField( pTyp ), m_nOffset( nOff ), m_bOn( bFlag )
2184 SetOffset(
static_cast<short>(rStr.toInt32()) );
2195 rAny <<= static_cast<sal_Int16>(
m_nOffset);
2208 m_bOn = *o3tl::doAccess<bool>(rAny);
2235 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
2238 auto const ModifyImpl = [
this](
SwRootFrame const*
const pLayout)
2244 std::vector<SwFormatField*> vFields;
2246 for(
auto pFormatField: vFields)
2247 UpdateField(pFormatField->GetTextField(), aTmpLst, pLayout);
2252 if( !pLegacy->m_pNew && !pLegacy->m_pOld && HasWriterListeners() )
2258 if (pLay->IsHideRedlines())
2260 pLayoutRLHidden = pLay;
2267 ModifyImpl(pLayout);
2268 if (pLayoutRLHidden)
2270 ModifyImpl(pLayoutRLHidden);
2275 CallSwClientNotify(rHint);
2282 std::vector<SwFormatField*> vFields;
2284 for(
auto pFormatField: vFields)
2287 const SwTextField* pTField = pFormatField->GetTextField();
2294 std::pair<Point, bool>
const tmp(aPt,
false);
2296 pLayout,
nullptr, &tmp);
2298 std::unique_ptr<SetGetExpField> pNew;
2313 OSL_ENSURE(bResult,
"where is the Field?");
2318 rTmpLst.
insert( std::move(pNew) );
2321 return !rTmpLst.
empty();
2329 pGetField->
SetText( OUString(), pLayout );
2340 if( itLast != rSetList.
begin() )
2343 const SwTextField* pRefTextField = (*itLast)->GetTextField();
2346 if( pSetField->
IsOn() )
2350 std::pair<Point, bool>
const tmp(aPt,
false);
2352 pLayout,
nullptr, &tmp);
2354 pLayout,
nullptr, &tmp);
2357 if ( pFrame && pRefFrame )
2369 const short nPageNum = std::max<short>(0, pSetField->
GetOffset() + nDiff);
2381 sal_uInt32 nFormat )
2410 return std::unique_ptr<SwField>(pCpy.release());
2427 OSL_ENSURE(!rFrame.
IsInDocBody(),
"Flag incorrect, frame is in DocBody");
2447 if( itLast == aTmpLst.
begin() )
2451 const SwTextField* pRefTextField = (*itLast)->GetTextField();
2455 std::pair<Point, bool>
const tmp(aPt,
false);
2457 &rLayout,
nullptr, &tmp);
2458 if( !(pSetField->
IsOn() && pRefFrame) )
2470 const short nPageNum = std::max<short>(0, pSetField->
GetOffset() + nDiff);
2479 rAny <<= static_cast<sal_Int16>(
GetFormat());
2521 return std::make_unique<SwJumpEditFieldType>(
m_rDoc );
2532 OUString aText, OUString aHelp )
2533 :
SwField( pTyp, nForm ), m_sText(
std::move(aText) ), m_sHelp(
std::move(aHelp) )
2581 case JE_FMT_TABLE: nRet = text::PlaceholderType::TABLE;
break;
2582 case JE_FMT_FRAME: nRet = text::PlaceholderType::TEXTFRAME;
break;
2583 case JE_FMT_GRAPHIC:nRet = text::PlaceholderType::GRAPHIC;
break;
2584 case JE_FMT_OLE: nRet = text::PlaceholderType::OBJECT;
break;
2586 nRet = text::PlaceholderType::TEXT;
break;
2645 return std::make_unique<SwCombinedCharFieldType>();
2651 const OUString& rChars )
2679 sal_uInt16 nWhichId )
const
2693 sal_uInt16 nWhichId )
css::util::DateTime GetUNODateTime() const
css::util::Date GetUNODate() const
bool IsValidAndGregorian() const
sal_Int16 GetYear() const
sal_uInt16 GetDay() const
static sal_Int32 DateToDays(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear)
sal_uInt16 GetMonth() const
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwDocStat & GetDocStat() const =0
Document - Statistics.
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString PathToFileName() const
INetProtocol GetProtocol() const
void dumpAsXml(xmlTextWriterPtr pWriter) const
void ChangeStyleSheetName(SfxStyleFamily eFamily, std::u16string_view rOldName, const OUString &rNewName)
bool GetLogicNames(std::u16string_view rPath, OUString &rRegion, OUString &rName) const
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const INetURLObject & GetURLObject() const
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
const OUString & GetName() const
SfxStyleFamily GetFamily() const
const LocaleDataWrapper & GetLocaleData() const
OUString GetFullName() const
OUString GetToken(UserOptToken nToken) const
SvxNumType GetNumberingType() const
static OUString Expand(sal_uLong)
virtual std::unique_ptr< SwFieldType > Copy() const override
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
virtual std::unique_ptr< SwField > Copy() const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
SwAuthorField(SwAuthorFieldType *, sal_uInt32 nFormat)
virtual std::unique_ptr< SwFieldType > Copy() const override
SwCombinedCharFieldType()
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual void SetPar1(const OUString &rStr) override
virtual std::unique_ptr< SwField > Copy() const override
OUString m_sCharacters
combine these characters
virtual OUString GetPar1() const override
Characters.
SwCombinedCharField(SwCombinedCharFieldType *, const OUString &rChars)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
bool IsDataSourceOpen(const OUString &rDataSource, const OUString &rTableOrQuery, bool bMergeShell)
check if a data source is open
bool GetMergeColumnCnt(const OUString &rColumnName, LanguageType nLanguage, OUString &rResult, double *pNumber)
static double GetDateTime(SwDoc &rDoc, const DateTime &rDT)
SwDocInfoFieldType(SwDoc *pDc)
virtual std::unique_ptr< SwFieldType > Copy() const override
OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString &rName) const
virtual std::unique_ptr< SwField > Copy() const override
virtual OUString GetFieldName() const override
get name or content
virtual void SetLanguage(LanguageType nLng) override
set language of the format
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual void SetSubType(sal_uInt16) override
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual sal_uInt16 GetSubType() const override
SwDocInfoField(SwDocInfoFieldType *, sal_uInt16 nSub, const OUString &rName, sal_uInt32 nFormat=0)
SwDoc * GetDoc()
returns Doc. But be careful!
virtual std::unique_ptr< SwFieldType > Copy() const override
SwDocStatFieldType(SwDoc &)
SvxNumType m_nNumberingType
OUString Expand(sal_uInt16 nSubType, SvxNumType nFormat) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual sal_uInt16 GetSubType() const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
void ChangeExpansion(const SwFrame *pFrame)
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
SwDocStatField(SwDocStatFieldType *, sal_uInt16 nSubType, sal_uInt32 nFormat)
virtual std::unique_ptr< SwField > Copy() const override
virtual void SetSubType(sal_uInt16 nSub) override
SwDBData const & GetDBData()
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
SwDBManager * GetDBManager() const
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
const SwAttrPool & GetAttrPool() const
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
SwDocShell * GetDocShell()
IDocumentStatistics const & getIDocumentStatistics() const
static OUString Expand(sal_uInt16 nSubType)
virtual std::unique_ptr< SwFieldType > Copy() const override
virtual sal_uInt16 GetSubType() const override
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
virtual std::unique_ptr< SwField > Copy() const override
SwExtUserField(SwExtUserFieldType *, sal_uInt16 nSub, sal_uInt32 nFormat)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual void SetSubType(sal_uInt16 nSub) override
Instances of SwFields and those derived from it occur 0 to n times.
static const OUString & GetTypeStr(SwFieldTypesEnum nTypeId)
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Base class of all fields.
virtual void SetLanguage(LanguageType nLng)
SwFieldTypesEnum GetTypeId() const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
bool IsAutomaticLanguage() const
void SetFormat(sal_uInt32 const nSet)
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
SwFieldType * GetTyp() const
LanguageType GetLanguage() const
Language at field position.
OUString Expand(sal_uLong) const
virtual std::unique_ptr< SwFieldType > Copy() const override
SwFileNameFieldType(SwDoc &)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
SwFileNameField(SwFileNameFieldType *, sal_uInt32 nFormat)
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual std::unique_ptr< SwField > Copy() const override
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Base class of the Writer layout elements.
SwRootFrame * getRootFrame()
SwPageFrame * FindPageFrame()
virtual std::unique_ptr< SwFieldType > Copy() const override
virtual std::unique_ptr< SwField > Copy() const override
SwHiddenParaField(SwHiddenParaFieldType *, OUString aCond)
Direct input, delete old value.
virtual void SetPar1(const OUString &rStr) override
set condition
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual OUString GetPar1() const override
Query, set condition.
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual void UpdateFields() override
virtual std::unique_ptr< SwFieldType > Copy() const override
SwHiddenTextFieldType(bool bSetHidden=true)
void SetHiddenFlag(bool bSetHidden)
void Evaluate(SwDoc &rDoc)
get current field value and cache it
static OUString GetDBName(std::u16string_view rName, SwDoc &rDoc)
OUString m_aContent
Evaluated DB-text.
bool m_bValid
Is DB-field evaluated?
virtual sal_uInt16 GetSubType() const override
OUString m_aTRUEText
Text if condition true.
OUString m_aFALSEText
If condition false.
static OUString GetColumnName(const OUString &rName)
SwFieldTypesEnum m_nSubType
virtual std::unique_ptr< SwField > Copy() const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
bool m_bIsHidden
Is it not visible?
bool m_bCanToggle
Can field be toggled alone?
virtual OUString GetFieldName() const override
get name or content
OUString m_aCond
Condition.
static void ParseIfFieldDefinition(std::u16string_view aFieldDefinition, OUString &rCondition, OUString &rTrue, OUString &rFalse)
virtual void SetPar1(const OUString &rStr) override
Condition.
virtual void SetPar2(const OUString &rStr) override
True/False - String.
virtual OUString GetPar1() const override
virtual OUString GetPar2() const override
get True/False text
SwHiddenTextField(SwHiddenTextFieldType *, bool bConditional, OUString aCond, const OUString &rText, bool bHidden, SwFieldTypesEnum nSubType=SwFieldTypesEnum::HiddenText)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
SwCharFormat * GetCharFormat()
sw::WriterMultiListener m_aDep
SwJumpEditFieldType(SwDoc &rDoc)
virtual std::unique_ptr< SwFieldType > Copy() const override
virtual void SetPar2(const OUString &rStr) override
set hint text
virtual std::unique_ptr< SwField > Copy() const override
virtual OUString GetPar1() const override
Placeholder-Text.
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
SwJumpEditField(SwJumpEditFieldType *, sal_uInt32 nFormat, OUString sText, OUString sHelp)
virtual void SetPar1(const OUString &rStr) override
set place holder text
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual OUString GetPar2() const override
Hint-Text.
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
SwNodeOffset GetIndex() const
SwNodeOffset StartOfSectionIndex() const
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
SwNode & GetEndOfPostIts() const
A still empty section.
const SvxNumberType & GetNumType() const
A page of the document layout.
sal_uInt16 GetPhyPageNum() const
SwPageDesc * GetPageDesc()
virtual std::unique_ptr< SwFieldType > Copy() const override
SvxNumType m_nNumberingType
OUString Expand(SvxNumType nFormat, short nOff, sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage, const OUString &, LanguageType=LANGUAGE_NONE) const
void ChangeExpansion(SwDoc *pDoc, bool bVirtPageNum, const SvxNumType *pNumFormat)
virtual std::unique_ptr< SwField > Copy() const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
void ChangeExpansion(sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage)
virtual OUString GetPar2() const override
SwPageNumberField(SwPageNumberFieldType *, sal_uInt16 nSub, sal_uInt32 nFormat, short nOff=0, sal_uInt16 const nPageNumber=0, sal_uInt16 const nMaxPage=0)
virtual sal_uInt16 GetSubType() const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual void SetPar2(const OUString &rStr) override
virtual std::unique_ptr< SwFieldType > Copy() const override
SwPostItFieldType(SwDoc &rDoc)
virtual ~SwPostItField() override
void ChangeStyleSheetName(std::u16string_view rOldName, const SfxStyleSheetBase *pStyleSheet)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual OUString GetPar1() const override
Author.
virtual OUString GetDescription() const override
void SetName(const OUString &rStr)
void SetParaId(const sal_uInt32 nParaId)
virtual std::unique_ptr< SwField > Copy() const override
const OUString & GetName() const
rtl::Reference< SwTextAPIObject > m_xTextObject
OUString m_sInitials
Initials of the author.
void SetPostItId(const sal_uInt32 nPostItId=0)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
virtual void SetPar1(const OUString &rStr) override
set author
static sal_uInt32 s_nLastPostItId
SwPostItField(SwPostItFieldType *, OUString aAuthor, OUString aText, OUString aInitials, OUString aName, const DateTime &rDate, const bool bResolved=false, const sal_uInt32 nPostItId=0, const sal_uInt32 nParentId=0, const sal_uInt32 nParaId=0)
sal_Int32 GetNumberOfParagraphs() const
void SetParentId(const sal_uInt32 nParentId)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
void SetTextObject(std::optional< OutlinerParaObject > pText)
virtual void SetPar2(const OUString &rStr) override
set the PostIt's text
void SetResolved(bool bNewState)
virtual OUString GetPar2() const override
Text.
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
std::optional< OutlinerParaObject > mpText
OUString m_sName
Name of the comment.
virtual std::unique_ptr< SwFieldType > Copy() const override
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
overwritten to update all RefPageGet fields
sal_Int16 m_nNumberingType
SwRefPageGetFieldType(SwDoc &rDoc)
bool MakeSetList(SetGetExpFields &rTmpLst, SwRootFrame const *pLayout)
void UpdateField(SwTextField const *pTextField, SetGetExpFields const &rSetList, SwRootFrame const *pLayout)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
void ChangeExpansion(const SwFrame &rFrame, const SwTextField *pField)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual std::unique_ptr< SwField > Copy() const override
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
void SetText(const OUString &rText, SwRootFrame const *pLayout)
OUString m_sTextRLHidden
hidden redlines
SwRefPageGetField(SwRefPageGetFieldType *, sal_uInt32 nFormat)
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
noop, there is nothing to update!
virtual std::unique_ptr< SwFieldType > Copy() const override
void SetOffset(short nOff)
SwRefPageSetField(SwRefPageSetFieldType *, short nOff, bool bOn)
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual OUString GetPar2() const override
virtual void SetPar2(const OUString &rStr) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual std::unique_ptr< SwField > Copy() const override
The root element of a Writer document layout.
sal_uInt16 GetPageNum() const
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
OUString Expand(sal_uLong) const
virtual std::unique_ptr< SwFieldType > Copy() const override
SwTemplNameFieldType(SwDoc &)
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
SwTemplNameField(SwTemplNameFieldType *, sal_uInt32 nFormat)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual std::unique_ptr< SwField > Copy() const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
const SwFormatField & GetFormatField() const
SwTextNode & GetTextNode() const
SwTextNode is a paragraph in the document model.
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
virtual void SetLanguage(LanguageType nLng) override
set language of the format
OUString ExpandValue(const double &rVal, sal_uInt32 nFormat, LanguageType nLng) const
virtual double GetValue() const
static ShellResource * GetShellRes()
const_iterator begin() const
std::vector< Value >::const_iterator const_iterator
std::pair< const_iterator, bool > insert(Value &&x)
const_iterator lower_bound(const Value &x) const
void StartListening(SwModify *pDepend)
struct _xmlTextWriter * xmlTextWriterPtr
static void lcl_GetLocalDataWrapper(LanguageType nLang, const LocaleDataWrapper **ppAppLocalData, const LocaleDataWrapper **ppLocalData)
static double lcl_TimeToDouble(const T &rTime)
static double lcl_DateToDouble(const D &rDate, const Date &rNullDate)
#define MAX_COMBINED_CHARACTERS
Reference< XTypeConverter > xConverter
const SwTextNode * GetBodyTextNode(const SwDoc &rDoc, SwPosition &rPos, const SwFrame &rFrame)
Forward declaration: get "BodyTextNode" for exp.fld in Fly's headers/footers/footnotes.
OUString ReplacePoint(const OUString &rTmpName, bool bWithCommandType)
OUString FormatNumber(sal_uInt32 nNum, SvxNumType nFormat, LanguageType nLang)
expand numbering
SwFieldTypesEnum
List of FieldTypes at UI.
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr OUStringLiteral aData
sal_Int32 GetEnumAsInt32(const css::uno::Any &rVal)
SVL_DLLPUBLIC OUString removePassword(OUString const &rURI, INetURLObject::EncodeMechanism eEncodeMechanism, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
double getLength(const B2DPolygon &rCandidate)
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
Reference< XComponentContext > getProcessComponentContext()
void copy(const fs::path &src, const fs::path &dest)
const SwDocInfoSubType DI_DOCNO
const SwDocInfoSubType DI_SUB_AUTHOR
const SwDocInfoSubType DI_CUSTOM
const SwDocInfoSubType DI_CHANGE
const SwDocInfoSubType DI_COMMENT
const SwDocInfoSubType DI_SUBTYPE_BEGIN
NB: these must denote consecutive integers! NB2: these are extended by 4 DI_INFO values for backward ...
const SwDocInfoSubType DI_SUB_FIXED
const SwDocInfoSubType DI_PRINT
const SwDocInfoSubType DI_SUB_DATE
const SwDocInfoSubType DI_KEYS
const SwDocInfoSubType DI_EDIT
const SwDocInfoSubType DI_SUBJECT
const SwDocInfoSubType DI_TITLE
const SwDocInfoSubType DI_SUB_TIME
const SwDocInfoSubType DI_CREATE
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
bool IsFieldDeletedInModel(IDocumentRedlineAccess const &rIDRA, SwTextField const &rTextField)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
@ RES_POOLCHR_JUMPEDIT
Placeholder.
static LanguageType nLang
std::vector< OUString > aDocInfoLst
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
Marks a position in the document model.
sal_Int32 GetContentIndex() const
SVX_NUM_CHARS_LOWER_LETTER_N
OUString SwResId(TranslateId aId)
#define FIELD_PROP_DATE_TIME
#define FIELD_PROP_SUBTYPE
#define FIELD_PROP_USHORT1
#define FIELD_PROP_USHORT2
#define FIELD_PROP_FORMAT
#define FIELD_PROP_DOUBLE