lok: Hide file linking in section
[LibreOffice.git] / sw / inc / docufld.hxx
blobb8ea4866eff0fcc33e6a1e2437da2b5385c50162
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 <tools/solar.h>
23 #include <tools/date.hxx>
24 #include <tools/datetime.hxx>
25 #include <rtl/ref.hxx>
26 #include <svl/macitem.hxx>
28 #include "fldbas.hxx"
30 class SetGetExpFields;
31 class SwTextField;
32 class SwFrame;
33 class OutlinerParaObject;
34 class SwTextAPIObject;
35 class SwCharFormat;
37 enum SwAuthorFormat
39 AF_BEGIN,
40 AF_NAME = AF_BEGIN,
41 AF_SHORTCUT,
42 AF_FIXED = 0x8000
45 // Subtype of document statistics.
46 enum SwDocStatSubType
48 DS_BEGIN,
49 DS_PAGE = DS_BEGIN,
50 DS_PARA,
51 DS_WORD,
52 DS_CHAR,
53 DS_TBL,
54 DS_GRF,
55 DS_OLE,
58 typedef sal_uInt16 SwDocInfoSubType;
59 namespace nsSwDocInfoSubType
61 /** NB: these must denote consecutive integers!
62 NB2: these are extended by 4 DI_INFO values for backward compatibility
63 in filter/html/htmlfld.cxx, so make sure that DI_SUBTYPE_END
64 really is the end, and is at least 4 less than DI_SUB_*! */
65 const SwDocInfoSubType DI_SUBTYPE_BEGIN = 0;
66 const SwDocInfoSubType DI_TITLE = DI_SUBTYPE_BEGIN;
67 const SwDocInfoSubType DI_THEMA = 1;
68 const SwDocInfoSubType DI_KEYS = 2;
69 const SwDocInfoSubType DI_COMMENT = 3;
70 const SwDocInfoSubType DI_CREATE = 4;
71 const SwDocInfoSubType DI_CHANGE = 5;
72 const SwDocInfoSubType DI_PRINT = 6;
73 const SwDocInfoSubType DI_DOCNO = 7;
74 const SwDocInfoSubType DI_EDIT = 8;
75 const SwDocInfoSubType DI_CUSTOM = 9;
76 const SwDocInfoSubType DI_SUBTYPE_END = 10;
78 const SwDocInfoSubType DI_SUB_AUTHOR = 0x0100;
79 const SwDocInfoSubType DI_SUB_TIME = 0x0200;
80 const SwDocInfoSubType DI_SUB_DATE = 0x0300;
81 const SwDocInfoSubType DI_SUB_FIXED = 0x1000;
82 const SwDocInfoSubType DI_SUB_MASK = 0xff00;
85 enum SwPageNumSubType
87 PG_RANDOM,
88 PG_NEXT,
89 PG_PREV
92 // NOTE: Possibly the first 15 values in the below enum are required
93 // to exactly match the published constants in css::text::UserDataPart
94 // (see offapi/com/sun/star/text/UserDataPart.idl).
96 enum SwExtUserSubType
98 EU_COMPANY,
99 EU_FIRSTNAME,
100 EU_NAME,
101 EU_SHORTCUT,
102 EU_STREET,
103 EU_COUNTRY,
104 EU_ZIP,
105 EU_CITY,
106 EU_TITLE,
107 EU_POSITION,
108 EU_PHONE_PRIVATE,
109 EU_PHONE_COMPANY,
110 EU_FAX,
111 EU_EMAIL,
112 EU_STATE,
113 EU_FATHERSNAME,
114 EU_APARTMENT
117 enum SwJumpEditFormat
119 JE_FMT_TEXT,
120 JE_FMT_TABLE,
121 JE_FMT_FRAME,
122 JE_FMT_GRAPHIC,
123 JE_FMT_OLE
126 class SAL_DLLPUBLIC_RTTI SwPageNumberFieldType final : public SwFieldType
128 SvxNumType m_nNumberingType;
129 bool m_bVirtual;
131 public:
132 SwPageNumberFieldType();
134 OUString Expand( SvxNumType nFormat, short nOff, sal_uInt16 const nPageNumber,
135 sal_uInt16 const nMaxPage, const OUString&, LanguageType = LANGUAGE_NONE ) const;
136 void ChangeExpansion( SwDoc* pDoc,
137 bool bVirtPageNum, const SvxNumType* pNumFormat );
138 virtual std::unique_ptr<SwFieldType> Copy() const override;
141 // Page numbering.
142 class SW_DLLPUBLIC SwPageNumberField final : public SwField
144 OUString m_sUserStr;
145 sal_uInt16 m_nSubType;
146 short m_nOffset;
147 // fdo#58074 store page number in SwField, not SwFieldType
148 sal_uInt16 m_nPageNumber;
149 sal_uInt16 m_nMaxPage;
151 public:
152 SwPageNumberField(SwPageNumberFieldType*, sal_uInt16 nSub,
153 sal_uInt32 nFormat, short nOff = 0,
154 sal_uInt16 const nPageNumber = 0,
155 sal_uInt16 const nMaxPage = 0);
157 void ChangeExpansion(sal_uInt16 const nPageNumber,
158 sal_uInt16 const nMaxPage);
160 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
161 virtual std::unique_ptr<SwField> Copy() const override;
163 virtual OUString GetPar2() const override;
164 virtual void SetPar2(const OUString& rStr) override;
166 virtual sal_uInt16 GetSubType() const override;
167 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
168 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
170 const OUString& GetUserString() const { return m_sUserStr; }
171 void SetUserString( const OUString& rS ) { m_sUserStr = rS; }
174 class SwAuthorFieldType final : public SwFieldType
176 public:
177 SwAuthorFieldType();
179 static OUString Expand(sal_uLong);
180 virtual std::unique_ptr<SwFieldType> Copy() const override;
183 class SwAuthorField final : public SwField
185 OUString m_aContent;
187 public:
188 SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFormat);
190 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
191 virtual std::unique_ptr<SwField> Copy() const override;
193 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
195 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
196 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
199 class SAL_DLLPUBLIC_RTTI SwFileNameFieldType final : public SwFieldType
201 SwDoc *m_pDoc;
202 public:
203 SwFileNameFieldType(SwDoc*);
205 OUString Expand(sal_uLong) const;
206 virtual std::unique_ptr<SwFieldType> Copy() const override;
209 class SW_DLLPUBLIC SwFileNameField final : public SwField
211 OUString m_aContent;
213 public:
214 SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFormat);
216 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
217 virtual std::unique_ptr<SwField> Copy() const override;
219 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
221 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
222 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
225 class SAL_DLLPUBLIC_RTTI SwTemplNameFieldType final : public SwFieldType
227 SwDoc *m_pDoc;
228 public:
229 SwTemplNameFieldType(SwDoc*);
231 OUString Expand(sal_uLong) const;
232 virtual std::unique_ptr<SwFieldType> Copy() const override;
235 class SW_DLLPUBLIC SwTemplNameField final : public SwField
237 public:
238 SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFormat);
240 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
241 virtual std::unique_ptr<SwField> Copy() const override;
242 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
243 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
246 // Document statistics
247 class SAL_DLLPUBLIC_RTTI SwDocStatFieldType final : public SwFieldType
249 SwDoc* m_pDoc;
250 SvxNumType m_nNumberingType;
252 public:
253 SwDocStatFieldType(SwDoc*);
254 OUString Expand(sal_uInt16 nSubType, SvxNumType nFormat) const;
255 virtual std::unique_ptr<SwFieldType> Copy() const override;
257 void SetNumFormat( SvxNumType eFormat ) { m_nNumberingType = eFormat; }
260 class SW_DLLPUBLIC SwDocStatField final : public SwField
262 sal_uInt16 m_nSubType;
264 public:
265 SwDocStatField( SwDocStatFieldType*,
266 sal_uInt16 nSubType, sal_uInt32 nFormat);
268 void ChangeExpansion( const SwFrame* pFrame );
270 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
271 virtual std::unique_ptr<SwField> Copy() const override;
273 virtual sal_uInt16 GetSubType() const override;
274 virtual void SetSubType(sal_uInt16 nSub) override;
275 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
276 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
279 class SAL_DLLPUBLIC_RTTI SwHiddenTextFieldType final : public SwFieldType
281 bool m_bHidden;
282 public:
283 SwHiddenTextFieldType(bool bSetHidden = true);
285 virtual std::unique_ptr<SwFieldType> Copy() const override;
287 void SetHiddenFlag( bool bSetHidden );
288 bool GetHiddenFlag() const { return m_bHidden; }
291 class SW_DLLPUBLIC SwHiddenTextField final : public SwField
293 OUString m_aTRUEText; ///< Text if condition true.
294 OUString m_aFALSEText; ///< If condition false.
295 OUString m_aContent; ///< Evaluated DB-text.
297 OUString m_aCond; ///< Condition.
298 SwFieldTypesEnum m_nSubType;
300 bool m_bCanToggle : 1; ///< Can field be toggled alone?
301 bool m_bIsHidden : 1; ///< Is it not visible?
302 bool m_bValid : 1; ///< Is DB-field evaluated?
304 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
305 virtual std::unique_ptr<SwField> Copy() const override;
307 public:
308 SwHiddenTextField( SwHiddenTextFieldType*,
309 bool bConditional,
310 const OUString& rCond,
311 const OUString& rText,
312 bool bHidden,
313 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
315 SwHiddenTextField( SwHiddenTextFieldType*,
316 const OUString& rCond,
317 const OUString& rTrue,
318 const OUString& rFalse,
319 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
321 virtual OUString GetFieldName() const override;
323 void Evaluate(SwDoc*);
325 void SetValue(bool bHidden) { m_bIsHidden = bHidden; }
326 static OUString GetColumnName(const OUString& rName);
327 static OUString GetDBName(const OUString& rName, SwDoc *pDoc);
329 /// Condition
330 virtual void SetPar1(const OUString& rStr) override;
331 virtual OUString GetPar1() const override;
333 /// True/False - String
334 virtual void SetPar2(const OUString& rStr) override;
335 virtual OUString GetPar2() const override;
337 virtual sal_uInt16 GetSubType() const override;
339 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
340 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
342 static void ParseIfFieldDefinition(const OUString& aFieldDefinition,
343 OUString& rCondition,
344 OUString& rTrue,
345 OUString& rFalse);
348 // Field that expands to an empty line (without height).
349 class SwHiddenParaFieldType final : public SwFieldType
351 public:
352 SwHiddenParaFieldType();
354 virtual std::unique_ptr<SwFieldType> Copy() const override;
357 class SwHiddenParaField final : public SwField
359 OUString m_aCond;
360 bool m_bIsHidden;
361 public:
362 /// Direct input, delete old value.
363 SwHiddenParaField(SwHiddenParaFieldType*, const OUString& rCond);
365 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
366 virtual std::unique_ptr<SwField> Copy() const override;
368 void SetHidden(bool bHidden) { m_bIsHidden = bHidden; }
369 bool IsHidden() const { return m_bIsHidden; }
371 /// Query, set condition.
372 virtual OUString GetPar1() const override;
373 virtual void SetPar1(const OUString& rStr) override;
374 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
375 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
378 class SAL_DLLPUBLIC_RTTI SwMacroFieldType final : public SwFieldType
380 SwDoc* const m_pDoc;
382 public:
383 SwMacroFieldType(SwDoc*);
385 virtual std::unique_ptr<SwFieldType> Copy() const override;
388 class SW_DLLPUBLIC SwMacroField final : public SwField
390 OUString m_aMacro;
391 OUString m_aText;
392 bool m_bIsScriptURL;
394 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
395 virtual std::unique_ptr<SwField> Copy() const override;
397 public:
398 /// Direct input, delete old value.
399 SwMacroField( SwMacroFieldType*, const OUString& rLibAndName,
400 const OUString& rText);
402 const OUString& GetMacro() const { return m_aMacro; }
403 OUString GetLibName() const;
404 OUString GetMacroName() const;
405 SvxMacro GetSvxMacro() const;
407 virtual OUString GetFieldName() const override;
409 /// Library and FileName
410 virtual OUString GetPar1() const override;
411 virtual void SetPar1(const OUString& rStr) override;
413 /// Macrotext
414 virtual OUString GetPar2() const override;
415 virtual void SetPar2(const OUString& rStr) override;
416 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
417 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
419 static void CreateMacroString( OUString& rMacro,
420 const OUString& rMacroName,
421 const OUString& rLibraryName );
423 static bool isScriptURL( const OUString& str );
426 class SAL_DLLPUBLIC_RTTI SwPostItFieldType final : public SwFieldType
428 private:
429 SwDoc* const mpDoc;
430 public:
431 SwPostItFieldType(SwDoc* pDoc);
433 virtual std::unique_ptr<SwFieldType> Copy() const override;
435 SwDoc* GetDoc() const
437 return mpDoc;
441 class SW_DLLPUBLIC SwPostItField final : public SwField
443 OUString m_sText;
444 OUString m_sAuthor;
445 OUString m_sInitials; ///< Initials of the author.
446 OUString m_sName; ///< Name of the comment.
447 DateTime m_aDateTime;
448 bool m_bResolved;
449 std::unique_ptr<OutlinerParaObject> mpText;
450 rtl::Reference<SwTextAPIObject> m_xTextObject;
451 sal_uInt32 m_nPostItId;
453 public:
454 static sal_uInt32 m_nLastPostItId;
456 SwPostItField( SwPostItFieldType*,
457 const OUString& rAuthor,
458 const OUString& rText,
459 const OUString& rInitials,
460 const OUString& rName,
461 const DateTime& rDate,
462 const bool bResolved = false,
463 const sal_uInt32 nPostItId = 0);
465 SwPostItField(const SwPostItField&) = delete;
466 SwPostItField* operator=(const SwPostItField&) = delete;
468 virtual ~SwPostItField() override;
470 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
471 virtual std::unique_ptr<SwField> Copy() const override;
473 const DateTime& GetDateTime() const { return m_aDateTime; }
474 Date GetDate() const { return Date(m_aDateTime.GetDate()); }
475 tools::Time GetTime() const { return tools::Time(m_aDateTime.GetTime()); }
476 sal_uInt32 GetPostItId() const { return m_nPostItId; }
478 /// Author
479 virtual OUString GetPar1() const override;
480 virtual void SetPar1(const OUString& rStr) override;
482 /// Text
483 virtual OUString GetPar2() const override;
484 virtual void SetPar2(const OUString& rStr) override;
485 const OUString& GetText() const { return m_sText; }
486 const OUString& GetInitials() const { return m_sInitials;}
487 void SetName(const OUString& rStr);
488 const OUString& GetName() const { return m_sName;}
490 const OutlinerParaObject* GetTextObject() const { return mpText.get();}
491 void SetTextObject( std::unique_ptr<OutlinerParaObject> pText );
493 void SetResolved(bool bNewState);
494 void ToggleResolved();
495 bool GetResolved() const;
497 sal_Int32 GetNumberOfParagraphs() const;
499 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
500 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
501 virtual OUString GetDescription() const override;
502 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
505 class SAL_DLLPUBLIC_RTTI SwDocInfoFieldType final : public SwValueFieldType
507 public:
508 SwDocInfoFieldType(SwDoc* pDc);
510 OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString& rName) const;
511 virtual std::unique_ptr<SwFieldType> Copy() const override;
514 class SW_DLLPUBLIC SwDocInfoField final : public SwValueField
516 sal_uInt16 m_nSubType;
517 OUString m_aContent;
518 OUString m_aName;
520 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
521 virtual std::unique_ptr<SwField> Copy() const override;
523 public:
524 SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFormat=0);
525 SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFormat=0);
527 virtual void SetSubType(sal_uInt16) override;
528 virtual sal_uInt16 GetSubType() const override;
529 virtual void SetLanguage(LanguageType nLng) override;
530 virtual OUString GetFieldName() const override;
531 const OUString& GetName() const { return m_aName; }
532 void SetName( const OUString& rName ) { m_aName = rName; }
533 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
534 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
535 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
538 // Extended User settings.
539 class SwExtUserFieldType final : public SwFieldType
541 public:
542 SwExtUserFieldType();
544 static OUString Expand(sal_uInt16 nSubType);
545 virtual std::unique_ptr<SwFieldType> Copy() const override;
548 class SwExtUserField final : public SwField
550 OUString m_aContent;
551 sal_uInt16 m_nType;
553 public:
554 SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat);
556 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
557 virtual std::unique_ptr<SwField> Copy() const override;
559 virtual sal_uInt16 GetSubType() const override;
560 virtual void SetSubType(sal_uInt16 nSub) override;
562 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
564 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
565 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
568 // Relative page numbers - field.
569 class SwRefPageSetFieldType final : public SwFieldType
571 public:
572 SwRefPageSetFieldType();
574 virtual std::unique_ptr<SwFieldType> Copy() const override;
576 private:
577 /// Overlay, because there is nothing to update!
578 virtual void Modify( const SfxPoolItem*, const SfxPoolItem * ) override;
581 // Relative page numbering.
582 class SAL_DLLPUBLIC_RTTI SwRefPageSetField final : public SwField
584 short m_nOffset;
585 bool m_bOn;
587 public:
588 SwRefPageSetField( SwRefPageSetFieldType*, short nOff, bool bOn );
590 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
591 virtual std::unique_ptr<SwField> Copy() const override;
593 virtual OUString GetPar2() const override;
594 virtual void SetPar2(const OUString& rStr) override;
596 bool IsOn() const { return m_bOn; }
598 short GetOffset() const { return m_nOffset; }
599 void SetOffset( short nOff ) { m_nOffset = nOff; }
600 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
601 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
604 // Relative page numbers - query field.
605 class SwRefPageGetFieldType final : public SwFieldType
607 SwDoc* m_pDoc;
608 sal_Int16 m_nNumberingType;
610 void UpdateField(SwTextField const * pTextField,
611 SetGetExpFields const & rSetList, SwRootFrame const* pLayout);
613 /// overwritten to update all RefPageGet fields
614 virtual void Modify( const SfxPoolItem*, const SfxPoolItem * ) override;
615 public:
616 SwRefPageGetFieldType( SwDoc* pDoc );
617 virtual std::unique_ptr<SwFieldType> Copy() const override;
618 bool MakeSetList(SetGetExpFields& rTmpLst, SwRootFrame const* pLayout);
619 SwDoc* GetDoc() const { return m_pDoc; }
622 // Query relative page numbering.
623 class SwRefPageGetField final : public SwField
625 OUString m_sText;
626 OUString m_sTextRLHidden; ///< hidden redlines
628 public:
629 SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFormat );
631 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
632 virtual std::unique_ptr<SwField> Copy() const override;
634 void SetText(const OUString& rText, SwRootFrame const* pLayout);
636 void ChangeExpansion(const SwFrame& rFrame, const SwTextField* pField);
637 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
638 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
641 // Field to jump to and edit.
642 class SwJumpEditFieldType final : public SwFieldType
644 SwDoc* m_pDoc;
645 sw::WriterMultiListener m_aDep;
647 public:
648 SwJumpEditFieldType( SwDoc* pDoc );
649 virtual std::unique_ptr<SwFieldType> Copy() const override;
651 SwCharFormat* GetCharFormat();
654 class SwJumpEditField final : public SwField
656 OUString m_sText;
657 OUString m_sHelp;
658 public:
659 SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat,
660 const OUString& sText, const OUString& sHelp );
662 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
663 virtual std::unique_ptr<SwField> Copy() const override;
665 /// Placeholder-Text
666 virtual OUString GetPar1() const override;
667 virtual void SetPar1(const OUString& rStr) override;
669 /// Hint-Text
670 virtual OUString GetPar2() const override;
671 virtual void SetPar2(const OUString& rStr) override;
673 SwCharFormat* GetCharFormat() const
674 { return static_cast<SwJumpEditFieldType*>(GetTyp())->GetCharFormat(); }
675 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
676 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
679 class SwScriptFieldType final : public SwFieldType
681 SwDoc* const m_pDoc;
682 public:
683 SwScriptFieldType( SwDoc* pDoc );
685 virtual std::unique_ptr<SwFieldType> Copy() const override;
688 class SW_DLLPUBLIC SwScriptField final : public SwField
690 OUString m_sType; ///< Type of Code (Java/VBScript/...)
691 OUString m_sCode; /**< Code as text.
692 Code as JavaCode ? */
694 bool m_bCodeURL; ///< Code contains URL of a script.
696 public:
697 SwScriptField( SwScriptFieldType*, const OUString& rType,
698 const OUString& rCode, bool bURL );
700 virtual OUString GetDescription() const override;
702 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
703 virtual std::unique_ptr<SwField> Copy() const override;
705 /// Type
706 virtual OUString GetPar1() const override;
707 virtual void SetPar1(const OUString& rStr) override;
708 /// Text
709 virtual OUString GetPar2() const override;
710 virtual void SetPar2(const OUString& rStr) override;
712 bool IsCodeURL() const { return m_bCodeURL; }
713 void SetCodeURL( bool bURL ) { m_bCodeURL = bURL; }
714 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
715 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
718 // Combined Character Fieldtype
719 class SAL_DLLPUBLIC_RTTI SwCombinedCharFieldType final : public SwFieldType
721 public:
722 SwCombinedCharFieldType();
724 virtual std::unique_ptr<SwFieldType> Copy() const override;
727 // ScriptField
728 #define MAX_COMBINED_CHARACTERS 6
730 class SW_DLLPUBLIC SwCombinedCharField final : public SwField
732 OUString m_sCharacters; ///< combine these characters
734 public:
735 SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars );
737 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
738 virtual std::unique_ptr<SwField> Copy() const override;
740 /// Characters
741 virtual OUString GetPar1() const override;
742 virtual void SetPar1(const OUString& rStr) override;
744 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
745 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
748 #endif // INCLUDED_SW_INC_DOCUFLD_HXX
750 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */