20#include <osl/file.hxx>
34#include <com/sun/star/beans/XPropertySet.hpp>
35#include <com/sun/star/text/XTextContent.hpp>
36#include <com/sun/star/text/FilenameDisplayFormat.hpp>
37#include <com/sun/star/util/DateTime.hpp>
43 uno::Reference<beans::XPropertySet> xPropSet(xTextContent, uno::UNO_QUERY);
52 if ( !aAny.has<sal_Int32>() )
55 sal_Int32 nFieldType = aAny.get<sal_Int32>();
59 case text::textfield::Type::TIME:
60 case text::textfield::Type::EXTENDED_TIME:
61 case text::textfield::Type::DATE:
69 Date aDate(aDateTime.Day, aDateTime.Month, aDateTime.Year);
70 bool bIsFixed =
false;
74 sal_Int32 nNumFmt = -1;
83 if (nFieldType != text::textfield::Type::TIME)
88 bool bIsFixed =
false;
93 sal_Int32 nNumFmt = -1;
104 case text::textfield::Type::URL:
106 OUString aRep, aTarget,
aURL;
113 pData->SetTargetFrame(aTarget);
120 case text::textfield::Type::PAGE:
122 case text::textfield::Type::PAGES:
124 case text::textfield::Type::PAGE_NAME:
126 case text::textfield::Type::DOCINFO_TITLE:
128 case text::textfield::Type::TABLE:
134 case text::textfield::Type::EXTENDED_FILE:
136 OUString aPresentation;
137 bool bIsFixed =
false;
138 sal_Int16 nFmt = text::FilenameDisplayFormat::FULL;
156 case text::textfield::Type::AUTHOR:
158 bool bIsFixed =
false;
159 bool bFullName =
false;
161 OUString aPresentation, aContent, aFirstName, aLastName;
171 if (!aPresentation.isEmpty())
172 aContent = aPresentation;
174 sal_Int32
nPos = aContent.lastIndexOf(
' ', 0);
177 aFirstName = aContent.copy(0,
nPos);
178 aLastName = aContent.copy(
nPos + 1);
182 aLastName = aContent;
204 case text::textfield::Type::MEASURE:
215 case text::textfield::Type::PRESENTATION_HEADER:
217 case text::textfield::Type::PRESENTATION_FOOTER:
219 case text::textfield::Type::PRESENTATION_DATE_TIME:
221 case text::textfield::Type::DOCINFO_CUSTOM:
226 OUString sCurrentPresentation;
234 }
catch (
const beans::UnknownPropertyException& )
255 return std::make_unique<SvxFieldData>();
261 DBG_ASSERT(
typeid(*
this) ==
typeid(rFld),
"==: Different Types" );
280 , mpField(
std::move(pField) )
286 , mpField( rField.
Clone() )
293 , mpField( rItem.mpField ? rItem.mpField->
Clone() : nullptr )
308 assert(SfxPoolItem::operator==(rItem));
311 if(
mpField.get() == pOtherFld )
313 if(
mpField ==
nullptr || pOtherFld ==
nullptr )
315 return (
typeid(*
mpField) ==
typeid(*pOtherFld) )
341 return std::make_unique<SvxDateField>( *
this );
347 if (
typeid(rOther) !=
typeid(*
this) )
373 OSL_FAIL(
"SvxDateFormat::System not implemented!" );
378 OSL_FAIL(
"SvxDateFormat::AppDefault: take them from where? ");
382 sal_uInt32 nFormatKey;
422 double fDiffDate = aDate - rFormatter.
GetNullDate();
424 const Color* pColor =
nullptr;
441 :
aURL(
std::move( _aURL )), aRepresentation(
std::move( aRepres ))
449 return std::make_unique<SvxURLField>( *
this );
455 if (
typeid(rOther) !=
typeid(*
this) )
472 2*
aURL.getLength() );
483 return std::make_unique<SvxPageTitleField>();
506 return std::make_unique<SvxPageField>();
511 return (
dynamic_cast< const SvxPageField *
>(&rCmp) !=
nullptr );
524 return std::make_unique<SvxPagesField>();
529 return (
dynamic_cast< const SvxPagesField *
>(&rCmp) !=
nullptr);
536 return std::make_unique<SvxTimeField>();
541 return (
dynamic_cast< const SvxTimeField *
>(&rCmp) !=
nullptr);
553 return std::make_unique<SvxFileField>();
558 return (
dynamic_cast< const SvxFileField *
>(&rCmp) !=
nullptr );
573 return std::make_unique<SvxTableField>(
mnTab);
596 : m_nFixTime( rTime.
GetTime() )
605 return std::make_unique<SvxExtTimeField>( *
this );
611 if (
typeid(rOther) !=
typeid(*
this) )
636 OSL_FAIL(
"SvxTimeFormat::System: not implemented" );
640 OSL_FAIL(
"SvxTimeFormat::AppDefault: not implemented" );
646 sal_uInt32 nFormatKey;
656 OUString aFormatCode(
"HH:MM:SS.00 AM/PM" );
661 DBG_ASSERT( nCheckPos == 0,
"SvxTimeFormat::HH12_MM_SS_00: could not insert format code" );
687 const Color* pColor =
nullptr;
718 return std::make_unique<SvxExtFileField>( *
this );
724 if (
typeid(rOther) !=
typeid(*
this) )
740 if( INetProtocol::NotValid == aURLObj.
GetProtocol() )
745 osl::FileBase::getFileURLFromSystemPath(
aFile, aURLStr );
747 aURLObj.
SetURL( aURLStr );
752 if( INetProtocol::NotValid == aURLObj.
GetProtocol() )
757 else if( INetProtocol::File == aURLObj.
GetProtocol() )
814 const OUString& rLastName,
815 const OUString& rShortName,
828 return std::make_unique<SvxAuthorField>( *
this );
834 if (
typeid(rOther) !=
typeid(*
this) )
875 return std::make_unique<SvxHeaderField>();
880 return (
dynamic_cast< const SvxHeaderField *
>(&rCmp) !=
nullptr );
887 return std::make_unique<SvxFooterField>();
892 return (
dynamic_cast< const SvxFooterField *
>(&rCmp) !=
nullptr );
897 return std::make_unique<SvxDateTimeField>();
921 OUStringBuffer
aBuf(aRet);
929 aRet =
aBuf.makeStringAndClear();
sal_Int32 GetDate() const
void SetDate(sal_Int32 nNewDate)
OUString getName(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
OUString getFSysPath(FSysStyle eStyle, sal_Unicode *pDelimiter=nullptr) const
bool SetURL(std::u16string_view rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
OUString GetFormatted() const
virtual bool operator==(const SvxFieldData &) const override
SvxAuthorField(const OUString &rFirstName, const OUString &rLastName, const OUString &rShortName, SvxAuthorType eType=SvxAuthorType::Var, SvxAuthorFormat eFormat=SvxAuthorFormat::FullName)
virtual std::unique_ptr< SvxFieldData > Clone() const override
OUString GetFormatted(SvNumberFormatter &rFormatter, LanguageType eLanguage) const
virtual std::unique_ptr< SvxFieldData > Clone() const override
virtual MetaAction * createBeginComment() const override
virtual bool operator==(const SvxFieldData &) const override
this field is used as a placeholder for a header&footer in impress.
virtual std::unique_ptr< SvxFieldData > Clone() const override
static OUString GetFormatted(Date const &rDate, tools::Time const &rTime, SvxDateFormat eDateFormat, SvxTimeFormat eTimeFormat, SvNumberFormatter &rFormatter, LanguageType eLanguage)
virtual bool operator==(const SvxFieldData &) const override
virtual bool operator==(const SvxFieldData &) const override
OUString GetFormatted() const
virtual std::unique_ptr< SvxFieldData > Clone() const override
virtual std::unique_ptr< SvxFieldData > Clone() const override
OUString GetFormatted(SvNumberFormatter &rFormatter, LanguageType eLanguage) const
virtual bool operator==(const SvxFieldData &) const override
virtual MetaAction * createBeginComment() const override
static SvxFieldData * Create(const css::uno::Reference< css::text::XTextContent > &xContent)
virtual std::unique_ptr< SvxFieldData > Clone() const
virtual bool operator==(const SvxFieldData &) const
static MetaAction * createEndComment()
virtual MetaAction * createBeginComment() const
This item stores a field (SvxFieldData).
virtual ~SvxFieldItem() override
virtual bool operator==(const SfxPoolItem &) const override
SvxFieldItem(std::unique_ptr< SvxFieldData > pField, const sal_uInt16 nId)
std::unique_ptr< SvxFieldData > mpField
virtual SvxFieldItem * Clone(SfxItemPool *pPool=nullptr) const override
const SvxFieldData * GetField() const
virtual bool operator==(const SvxFieldData &) const override
virtual std::unique_ptr< SvxFieldData > Clone() const override
virtual std::unique_ptr< SvxFieldData > Clone() const override
virtual MetaAction * createBeginComment() const override
virtual bool operator==(const SvxFieldData &) const override
virtual std::unique_ptr< SvxFieldData > Clone() const override
virtual bool operator==(const SvxFieldData &) const override
virtual MetaAction * createBeginComment() const override
virtual std::unique_ptr< SvxFieldData > Clone() const override
virtual bool operator==(const SvxFieldData &) const override
virtual std::unique_ptr< SvxFieldData > Clone() const override
virtual bool operator==(const SvxFieldData &) const override
virtual std::unique_ptr< SvxFieldData > Clone() const override
virtual MetaAction * createBeginComment() const override
virtual bool operator==(const SvxFieldData &) const override
virtual bool operator==(const SvxFieldData &) const override
virtual MetaAction * createBeginComment() const override
virtual std::unique_ptr< SvxFieldData > Clone() const override
#define DBG_ASSERT(sCon, aError)
#define LANGUAGE_ENGLISH_US
std::unique_ptr< sal_Int32[]> pData
Any GetTime(const OUString &val)
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
constexpr OUStringLiteral UNO_TC_PROP_NUMFORMAT
constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_CONTENT
constexpr OUStringLiteral UNO_TC_PROP_DATE_TIME
constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_FORMAT
constexpr OUStringLiteral UNO_TC_PROP_URL
constexpr OUStringLiteral UNO_TC_PROP_FILE_FORMAT
constexpr OUStringLiteral UNO_TC_PROP_IS_DATE
constexpr OUStringLiteral UNO_TC_PROP_TABLE_POSITION
constexpr OUStringLiteral UNO_TC_PROP_IS_FIXED
constexpr OUStringLiteral UNO_TC_PROP_URL_REPRESENTATION
constexpr OUStringLiteral UNO_TC_PROP_TEXTFIELD_TYPE
constexpr OUStringLiteral UNO_TC_PROP_URL_FORMAT
constexpr OUStringLiteral UNO_TC_PROP_CURRENT_PRESENTATION
constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_FULLNAME
constexpr OUStringLiteral UNO_TC_PROP_NAME
constexpr OUStringLiteral UNO_TC_PROP_MEASURE_KIND
constexpr OUStringLiteral UNO_TC_PROP_URL_TARGET
NF_DATE_SYS_NNNNDMMMMYYYY