Cleanup restoring last position
[LibreOffice.git] / sw / inc / docufld.hxx
blob511b9c00890edbf0c431996225550028dcd91fa1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_INC_DOCUFLD_HXX
20 #define INCLUDED_SW_INC_DOCUFLD_HXX
22 #include <sal/config.h>
24 #include <string_view>
26 #include <editeng/outlobj.hxx>
27 #include <tools/solar.h>
28 #include <tools/date.hxx>
29 #include <tools/datetime.hxx>
30 #include <rtl/ref.hxx>
31 #include <svl/macitem.hxx>
33 #include "fldbas.hxx"
35 class SetGetExpFields;
36 class SwTextField;
37 class SwFrame;
38 class OutlinerParaObject;
39 class SwTextAPIObject;
40 class SwCharFormat;
42 enum SwAuthorFormat
44 AF_BEGIN,
45 AF_NAME = AF_BEGIN,
46 AF_SHORTCUT,
47 AF_FIXED = 0x8000
50 // Subtype of document statistics.
51 enum SwDocStatSubType
53 DS_BEGIN,
54 DS_PAGE = DS_BEGIN,
55 DS_PARA,
56 DS_WORD,
57 DS_CHAR,
58 DS_TBL,
59 DS_GRF,
60 DS_OLE,
63 typedef sal_uInt16 SwDocInfoSubType;
64 namespace nsSwDocInfoSubType
66 /** NB: these must denote consecutive integers!
67 NB2: these are extended by 4 DI_INFO values for backward compatibility
68 in filter/html/htmlfld.cxx, so make sure that DI_SUBTYPE_END
69 really is the end, and is at least 4 less than DI_SUB_*! */
70 const SwDocInfoSubType DI_SUBTYPE_BEGIN = 0;
71 const SwDocInfoSubType DI_TITLE = DI_SUBTYPE_BEGIN;
72 const SwDocInfoSubType DI_SUBJECT = 1;
73 const SwDocInfoSubType DI_KEYS = 2;
74 const SwDocInfoSubType DI_COMMENT = 3;
75 const SwDocInfoSubType DI_CREATE = 4;
76 const SwDocInfoSubType DI_CHANGE = 5;
77 const SwDocInfoSubType DI_PRINT = 6;
78 const SwDocInfoSubType DI_DOCNO = 7;
79 const SwDocInfoSubType DI_EDIT = 8;
80 const SwDocInfoSubType DI_CUSTOM = 9;
81 const SwDocInfoSubType DI_SUBTYPE_END = 10;
83 const SwDocInfoSubType DI_SUB_AUTHOR = 0x0100;
84 const SwDocInfoSubType DI_SUB_TIME = 0x0200;
85 const SwDocInfoSubType DI_SUB_DATE = 0x0300;
86 const SwDocInfoSubType DI_SUB_FIXED = 0x1000;
87 const SwDocInfoSubType DI_SUB_MASK = 0x0f00;
90 enum SwPageNumSubType
92 PG_RANDOM,
93 PG_NEXT,
94 PG_PREV
97 // NOTE: Possibly the first 15 values in the below enum are required
98 // to exactly match the published constants in css::text::UserDataPart
99 // (see offapi/com/sun/star/text/UserDataPart.idl).
101 enum SwExtUserSubType
103 EU_COMPANY,
104 EU_FIRSTNAME,
105 EU_NAME,
106 EU_SHORTCUT,
107 EU_STREET,
108 EU_COUNTRY,
109 EU_ZIP,
110 EU_CITY,
111 EU_TITLE,
112 EU_POSITION,
113 EU_PHONE_PRIVATE,
114 EU_PHONE_COMPANY,
115 EU_FAX,
116 EU_EMAIL,
117 EU_STATE,
118 EU_FATHERSNAME,
119 EU_APARTMENT
122 enum SwJumpEditFormat
124 JE_FMT_TEXT,
125 JE_FMT_TABLE,
126 JE_FMT_FRAME,
127 JE_FMT_GRAPHIC,
128 JE_FMT_OLE
131 class SAL_DLLPUBLIC_RTTI SwPageNumberFieldType final : public SwFieldType
133 SvxNumType m_nNumberingType;
134 bool m_bVirtual;
136 public:
137 SwPageNumberFieldType();
139 OUString Expand( SvxNumType nFormat, short nOff, sal_uInt16 const nPageNumber,
140 sal_uInt16 const nMaxPage, const OUString&, LanguageType = LANGUAGE_NONE ) const;
141 void ChangeExpansion( SwDoc* pDoc,
142 bool bVirtPageNum, const SvxNumType* pNumFormat );
143 virtual std::unique_ptr<SwFieldType> Copy() const override;
146 // Page numbering.
147 class SW_DLLPUBLIC SwPageNumberField final : public SwField
149 OUString m_sUserStr;
150 sal_uInt16 m_nSubType;
151 short m_nOffset;
152 // fdo#58074 store page number in SwField, not SwFieldType
153 sal_uInt16 m_nPageNumber;
154 sal_uInt16 m_nMaxPage;
156 public:
157 SwPageNumberField(SwPageNumberFieldType*, sal_uInt16 nSub,
158 sal_uInt32 nFormat, short nOff = 0,
159 sal_uInt16 const nPageNumber = 0,
160 sal_uInt16 const nMaxPage = 0);
162 void ChangeExpansion(sal_uInt16 const nPageNumber,
163 sal_uInt16 const nMaxPage);
165 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
166 virtual std::unique_ptr<SwField> Copy() const override;
168 virtual OUString GetPar2() const override;
169 virtual void SetPar2(const OUString& rStr) override;
171 virtual sal_uInt16 GetSubType() const override;
172 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
173 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
175 const OUString& GetUserString() const { return m_sUserStr; }
176 void SetUserString( const OUString& rS ) { m_sUserStr = rS; }
179 class SwAuthorFieldType final : public SwFieldType
181 public:
182 SwAuthorFieldType();
184 static OUString Expand(sal_uLong);
185 virtual std::unique_ptr<SwFieldType> Copy() const override;
188 class SwAuthorField final : public SwField
190 OUString m_aContent;
192 public:
193 SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFormat);
195 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
196 virtual std::unique_ptr<SwField> Copy() const override;
198 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
200 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
201 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
204 class SAL_DLLPUBLIC_RTTI SwFileNameFieldType final : public SwFieldType
206 SwDoc& m_rDoc;
207 public:
208 SwFileNameFieldType(SwDoc&);
210 OUString Expand(sal_uLong) const;
211 virtual std::unique_ptr<SwFieldType> Copy() const override;
214 class SW_DLLPUBLIC SwFileNameField final : public SwField
216 OUString m_aContent;
218 public:
219 SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFormat);
221 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
222 virtual std::unique_ptr<SwField> Copy() const override;
224 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
226 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
227 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
230 class SAL_DLLPUBLIC_RTTI SwTemplNameFieldType final : public SwFieldType
232 SwDoc& m_rDoc;
233 public:
234 SwTemplNameFieldType(SwDoc&);
236 OUString Expand(sal_uLong) const;
237 virtual std::unique_ptr<SwFieldType> Copy() const override;
240 class SW_DLLPUBLIC SwTemplNameField final : public SwField
242 public:
243 SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFormat);
245 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
246 virtual std::unique_ptr<SwField> Copy() const override;
247 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
248 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
251 // Document statistics
252 class SAL_DLLPUBLIC_RTTI SwDocStatFieldType final : public SwFieldType
254 SwDoc& m_rDoc;
255 SvxNumType m_nNumberingType;
257 public:
258 SwDocStatFieldType(SwDoc&);
259 OUString Expand(sal_uInt16 nSubType, SvxNumType nFormat) const;
260 virtual std::unique_ptr<SwFieldType> Copy() const override;
262 void SetNumFormat( SvxNumType eFormat ) { m_nNumberingType = eFormat; }
265 class SW_DLLPUBLIC SwDocStatField final : public SwField
267 sal_uInt16 m_nSubType;
269 public:
270 SwDocStatField( SwDocStatFieldType*,
271 sal_uInt16 nSubType, sal_uInt32 nFormat);
273 void ChangeExpansion( const SwFrame* pFrame );
275 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
276 virtual std::unique_ptr<SwField> Copy() const override;
278 virtual sal_uInt16 GetSubType() const override;
279 virtual void SetSubType(sal_uInt16 nSub) override;
280 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
281 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
284 class SAL_DLLPUBLIC_RTTI SwHiddenTextFieldType final : public SwFieldType
286 bool m_bHidden;
287 public:
288 SwHiddenTextFieldType(bool bSetHidden = true);
290 virtual std::unique_ptr<SwFieldType> Copy() const override;
291 virtual void UpdateFields() override {};
293 void SetHiddenFlag( bool bSetHidden );
294 bool GetHiddenFlag() const { return m_bHidden; }
297 class SW_DLLPUBLIC SwHiddenTextField final : public SwField
299 OUString m_aTRUEText; ///< Text if condition true.
300 OUString m_aFALSEText; ///< If condition false.
301 OUString m_aContent; ///< Evaluated DB-text.
303 OUString m_aCond; ///< Condition.
304 SwFieldTypesEnum m_nSubType;
306 bool m_bCanToggle : 1; ///< Can field be toggled alone?
307 bool m_bIsHidden : 1; ///< Is it not visible?
308 bool m_bValid : 1; ///< Is DB-field evaluated?
310 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
311 virtual std::unique_ptr<SwField> Copy() const override;
313 public:
314 SwHiddenTextField( SwHiddenTextFieldType*,
315 bool bConditional,
316 const OUString& rCond,
317 const OUString& rText,
318 bool bHidden,
319 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
321 SwHiddenTextField( SwHiddenTextFieldType*,
322 const OUString& rCond,
323 const OUString& rTrue,
324 const OUString& rFalse,
325 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
327 virtual OUString GetFieldName() const override;
329 void Evaluate(SwDoc& rDoc);
331 void SetValue(bool bHidden) { m_bIsHidden = bHidden; }
332 static OUString GetColumnName(const OUString& rName);
333 static OUString GetDBName(std::u16string_view rName, SwDoc& rDoc);
335 /// Condition
336 virtual void SetPar1(const OUString& rStr) override;
337 virtual OUString GetPar1() const override;
339 /// True/False - String
340 virtual void SetPar2(const OUString& rStr) override;
341 virtual OUString GetPar2() const override;
343 virtual sal_uInt16 GetSubType() const override;
345 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
346 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
348 static void ParseIfFieldDefinition(const OUString& aFieldDefinition,
349 OUString& rCondition,
350 OUString& rTrue,
351 OUString& rFalse);
354 // Field that expands to an empty line (without height).
355 class SwHiddenParaFieldType final : public SwFieldType
357 public:
358 SwHiddenParaFieldType();
360 virtual std::unique_ptr<SwFieldType> Copy() const override;
361 virtual void UpdateFields() override {};
364 class SwHiddenParaField final : public SwField
366 OUString m_aCond;
367 bool m_bIsHidden;
368 public:
369 /// Direct input, delete old value.
370 SwHiddenParaField(SwHiddenParaFieldType*, const OUString& rCond);
372 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
373 virtual std::unique_ptr<SwField> Copy() const override;
375 void SetHidden(bool bHidden) { m_bIsHidden = bHidden; }
376 bool IsHidden() const { return m_bIsHidden; }
378 /// Query, set condition.
379 virtual OUString GetPar1() const override;
380 virtual void SetPar1(const OUString& rStr) override;
381 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
382 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
385 class SAL_DLLPUBLIC_RTTI SwMacroFieldType final : public SwFieldType
387 SwDoc& m_rDoc;
389 public:
390 SwMacroFieldType(SwDoc&);
392 virtual std::unique_ptr<SwFieldType> Copy() const override;
395 class SW_DLLPUBLIC SwMacroField final : public SwField
397 OUString m_aMacro;
398 OUString m_aText;
399 bool m_bIsScriptURL;
401 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
402 virtual std::unique_ptr<SwField> Copy() const override;
404 public:
405 /// Direct input, delete old value.
406 SwMacroField( SwMacroFieldType*, const OUString& rLibAndName,
407 const OUString& rText);
409 const OUString& GetMacro() const { return m_aMacro; }
410 OUString GetLibName() const;
411 OUString GetMacroName() const;
412 SvxMacro GetSvxMacro() const;
414 virtual OUString GetFieldName() const override;
416 /// Library and FileName
417 virtual OUString GetPar1() const override;
418 virtual void SetPar1(const OUString& rStr) override;
420 /// Macrotext
421 virtual OUString GetPar2() const override;
422 virtual void SetPar2(const OUString& rStr) override;
423 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
424 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
426 static void CreateMacroString( OUString& rMacro,
427 std::u16string_view rMacroName,
428 const OUString& rLibraryName );
430 static bool isScriptURL( const OUString& str );
433 class SAL_DLLPUBLIC_RTTI SwPostItFieldType final : public SwFieldType
435 private:
436 SwDoc& mrDoc;
437 public:
438 SwPostItFieldType(SwDoc& rDoc);
440 virtual std::unique_ptr<SwFieldType> Copy() const override;
442 SwDoc& GetDoc() const
444 return mrDoc;
448 class SW_DLLPUBLIC SwPostItField final : public SwField
450 OUString m_sText;
451 OUString m_sAuthor;
452 OUString m_sInitials; ///< Initials of the author.
453 OUString m_sName; ///< Name of the comment.
454 DateTime m_aDateTime;
455 bool m_bResolved;
456 std::optional<OutlinerParaObject> mpText;
457 rtl::Reference<SwTextAPIObject> m_xTextObject;
458 sal_uInt32 m_nPostItId;
460 public:
461 static sal_uInt32 s_nLastPostItId;
463 SwPostItField( SwPostItFieldType*,
464 const OUString& rAuthor,
465 const OUString& rText,
466 const OUString& rInitials,
467 const OUString& rName,
468 const DateTime& rDate,
469 const bool bResolved = false,
470 const sal_uInt32 nPostItId = 0);
472 SwPostItField(const SwPostItField&) = delete;
473 SwPostItField* operator=(const SwPostItField&) = delete;
475 virtual ~SwPostItField() override;
477 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
478 virtual std::unique_ptr<SwField> Copy() const override;
480 const DateTime& GetDateTime() const { return m_aDateTime; }
481 Date GetDate() const { return Date(m_aDateTime.GetDate()); }
482 tools::Time GetTime() const { return tools::Time(m_aDateTime.GetTime()); }
483 sal_uInt32 GetPostItId() const { return m_nPostItId; }
484 void SetPostItId(const sal_uInt32 nPostItId = 0);
486 /// Author
487 virtual OUString GetPar1() const override;
488 virtual void SetPar1(const OUString& rStr) override;
490 /// Text
491 virtual OUString GetPar2() const override;
492 virtual void SetPar2(const OUString& rStr) override;
493 const OUString& GetText() const { return m_sText; }
494 const OUString& GetInitials() const { return m_sInitials;}
495 void SetName(const OUString& rStr);
496 const OUString& GetName() const { return m_sName;}
498 const OutlinerParaObject* GetTextObject() const { return mpText ? &*mpText : nullptr;}
499 void SetTextObject( std::optional<OutlinerParaObject> pText );
501 void SetResolved(bool bNewState);
502 void ToggleResolved();
503 bool GetResolved() const;
505 sal_Int32 GetNumberOfParagraphs() const;
507 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
508 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
509 virtual OUString GetDescription() const override;
510 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
513 class SAL_DLLPUBLIC_RTTI SwDocInfoFieldType final : public SwValueFieldType
515 public:
516 SwDocInfoFieldType(SwDoc* pDc);
518 OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString& rName) const;
519 virtual std::unique_ptr<SwFieldType> Copy() const override;
522 class SW_DLLPUBLIC SwDocInfoField final : public SwValueField
524 sal_uInt16 m_nSubType;
525 OUString m_aContent;
526 OUString m_aName;
528 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
529 virtual std::unique_ptr<SwField> Copy() const override;
531 public:
532 SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFormat=0);
533 SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFormat=0);
535 virtual void SetSubType(sal_uInt16) override;
536 virtual sal_uInt16 GetSubType() const override;
537 virtual void SetLanguage(LanguageType nLng) override;
538 virtual OUString GetFieldName() const override;
539 const OUString& GetName() const { return m_aName; }
540 void SetName( const OUString& rName ) { m_aName = rName; }
541 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
542 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
543 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
546 // Extended User settings.
547 class SwExtUserFieldType final : public SwFieldType
549 public:
550 SwExtUserFieldType();
552 static OUString Expand(sal_uInt16 nSubType);
553 virtual std::unique_ptr<SwFieldType> Copy() const override;
556 class SwExtUserField final : public SwField
558 OUString m_aContent;
559 sal_uInt16 m_nType;
561 public:
562 SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat);
564 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
565 virtual std::unique_ptr<SwField> Copy() const override;
567 virtual sal_uInt16 GetSubType() const override;
568 virtual void SetSubType(sal_uInt16 nSub) override;
570 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
572 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
573 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
576 // Relative page numbers - field.
577 class SwRefPageSetFieldType final : public SwFieldType
579 public:
580 SwRefPageSetFieldType();
582 virtual std::unique_ptr<SwFieldType> Copy() const override;
583 virtual void UpdateFields() override {};
585 private:
586 /// noop, there is nothing to update!
587 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
590 // Relative page numbering.
591 class SAL_DLLPUBLIC_RTTI SwRefPageSetField final : public SwField
593 short m_nOffset;
594 bool m_bOn;
596 public:
597 SwRefPageSetField( SwRefPageSetFieldType*, short nOff, bool bOn );
599 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
600 virtual std::unique_ptr<SwField> Copy() const override;
602 virtual OUString GetPar2() const override;
603 virtual void SetPar2(const OUString& rStr) override;
605 bool IsOn() const { return m_bOn; }
607 short GetOffset() const { return m_nOffset; }
608 void SetOffset( short nOff ) { m_nOffset = nOff; }
609 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
610 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
613 // Relative page numbers - query field.
614 class SwRefPageGetFieldType final : public SwFieldType
616 SwDoc& m_rDoc;
617 sal_Int16 m_nNumberingType;
619 void UpdateField(SwTextField const * pTextField,
620 SetGetExpFields const & rSetList, SwRootFrame const* pLayout);
622 /// overwritten to update all RefPageGet fields
623 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
624 public:
625 SwRefPageGetFieldType( SwDoc& rDoc );
626 virtual std::unique_ptr<SwFieldType> Copy() const override;
627 bool MakeSetList(SetGetExpFields& rTmpLst, SwRootFrame const* pLayout);
628 SwDoc& GetDoc() const { return m_rDoc; }
631 // Query relative page numbering.
632 class SwRefPageGetField final : public SwField
634 OUString m_sText;
635 OUString m_sTextRLHidden; ///< hidden redlines
637 public:
638 SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFormat );
640 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
641 virtual std::unique_ptr<SwField> Copy() const override;
643 void SetText(const OUString& rText, SwRootFrame const* pLayout);
645 void ChangeExpansion(const SwFrame& rFrame, const SwTextField* pField);
646 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
647 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
650 // Field to jump to and edit.
651 class SwJumpEditFieldType final : public SwFieldType
653 SwDoc& m_rDoc;
654 sw::WriterMultiListener m_aDep;
656 public:
657 SwJumpEditFieldType( SwDoc& rDoc );
658 virtual std::unique_ptr<SwFieldType> Copy() const override;
659 virtual void UpdateFields() override {};
661 SwCharFormat* GetCharFormat();
664 class SwJumpEditField final : public SwField
666 OUString m_sText;
667 OUString m_sHelp;
668 public:
669 SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat,
670 const OUString& sText, const OUString& sHelp );
672 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
673 virtual std::unique_ptr<SwField> Copy() const override;
675 /// Placeholder-Text
676 virtual OUString GetPar1() const override;
677 virtual void SetPar1(const OUString& rStr) override;
679 /// Hint-Text
680 virtual OUString GetPar2() const override;
681 virtual void SetPar2(const OUString& rStr) override;
683 SwCharFormat* GetCharFormat() const
684 { return static_cast<SwJumpEditFieldType*>(GetTyp())->GetCharFormat(); }
685 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
686 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
689 class SwScriptFieldType final : public SwFieldType
691 SwDoc& m_rDoc;
692 public:
693 SwScriptFieldType( SwDoc& rDoc );
695 virtual std::unique_ptr<SwFieldType> Copy() const override;
698 class SW_DLLPUBLIC SwScriptField final : public SwField
700 OUString m_sType; ///< Type of Code (Java/VBScript/...)
701 OUString m_sCode; /**< Code as text.
702 Code as JavaCode ? */
704 bool m_bCodeURL; ///< Code contains URL of a script.
706 public:
707 SwScriptField( SwScriptFieldType*, const OUString& rType,
708 const OUString& rCode, bool bURL );
710 virtual OUString GetDescription() const override;
712 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
713 virtual std::unique_ptr<SwField> Copy() const override;
715 /// Type
716 virtual OUString GetPar1() const override;
717 virtual void SetPar1(const OUString& rStr) override;
718 /// Text
719 virtual OUString GetPar2() const override;
720 virtual void SetPar2(const OUString& rStr) override;
722 bool IsCodeURL() const { return m_bCodeURL; }
723 void SetCodeURL( bool bURL ) { m_bCodeURL = bURL; }
724 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
725 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
728 // Combined Character Fieldtype
729 class SAL_DLLPUBLIC_RTTI SwCombinedCharFieldType final : public SwFieldType
731 public:
732 SwCombinedCharFieldType();
734 virtual std::unique_ptr<SwFieldType> Copy() const override;
737 // ScriptField
738 #define MAX_COMBINED_CHARACTERS 6
740 class SW_DLLPUBLIC SwCombinedCharField final : public SwField
742 OUString m_sCharacters; ///< combine these characters
744 public:
745 SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars );
747 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
748 virtual std::unique_ptr<SwField> Copy() const override;
750 /// Characters
751 virtual OUString GetPar1() const override;
752 virtual void SetPar1(const OUString& rStr) override;
754 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
755 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
758 #endif // INCLUDED_SW_INC_DOCUFLD_HXX
760 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */