Resolves tdf#142513 - Order of ZoomIn and ZoomOut at Print Preview
[LibreOffice.git] / sw / inc / docufld.hxx
blobf3a2cdc14b4cbd96687a4c55ac1d9cfd1d4b4695
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 <tools/solar.h>
27 #include <tools/date.hxx>
28 #include <tools/datetime.hxx>
29 #include <rtl/ref.hxx>
30 #include <svl/macitem.hxx>
32 #include "fldbas.hxx"
34 class SetGetExpFields;
35 class SwTextField;
36 class SwFrame;
37 class OutlinerParaObject;
38 class SwTextAPIObject;
39 class SwCharFormat;
41 enum SwAuthorFormat
43 AF_BEGIN,
44 AF_NAME = AF_BEGIN,
45 AF_SHORTCUT,
46 AF_FIXED = 0x8000
49 // Subtype of document statistics.
50 enum SwDocStatSubType
52 DS_BEGIN,
53 DS_PAGE = DS_BEGIN,
54 DS_PARA,
55 DS_WORD,
56 DS_CHAR,
57 DS_TBL,
58 DS_GRF,
59 DS_OLE,
62 typedef sal_uInt16 SwDocInfoSubType;
63 namespace nsSwDocInfoSubType
65 /** NB: these must denote consecutive integers!
66 NB2: these are extended by 4 DI_INFO values for backward compatibility
67 in filter/html/htmlfld.cxx, so make sure that DI_SUBTYPE_END
68 really is the end, and is at least 4 less than DI_SUB_*! */
69 const SwDocInfoSubType DI_SUBTYPE_BEGIN = 0;
70 const SwDocInfoSubType DI_TITLE = DI_SUBTYPE_BEGIN;
71 const SwDocInfoSubType DI_SUBJECT = 1;
72 const SwDocInfoSubType DI_KEYS = 2;
73 const SwDocInfoSubType DI_COMMENT = 3;
74 const SwDocInfoSubType DI_CREATE = 4;
75 const SwDocInfoSubType DI_CHANGE = 5;
76 const SwDocInfoSubType DI_PRINT = 6;
77 const SwDocInfoSubType DI_DOCNO = 7;
78 const SwDocInfoSubType DI_EDIT = 8;
79 const SwDocInfoSubType DI_CUSTOM = 9;
80 const SwDocInfoSubType DI_SUBTYPE_END = 10;
82 const SwDocInfoSubType DI_SUB_AUTHOR = 0x0100;
83 const SwDocInfoSubType DI_SUB_TIME = 0x0200;
84 const SwDocInfoSubType DI_SUB_DATE = 0x0300;
85 const SwDocInfoSubType DI_SUB_FIXED = 0x1000;
86 const SwDocInfoSubType DI_SUB_MASK = 0xff00;
89 enum SwPageNumSubType
91 PG_RANDOM,
92 PG_NEXT,
93 PG_PREV
96 // NOTE: Possibly the first 15 values in the below enum are required
97 // to exactly match the published constants in css::text::UserDataPart
98 // (see offapi/com/sun/star/text/UserDataPart.idl).
100 enum SwExtUserSubType
102 EU_COMPANY,
103 EU_FIRSTNAME,
104 EU_NAME,
105 EU_SHORTCUT,
106 EU_STREET,
107 EU_COUNTRY,
108 EU_ZIP,
109 EU_CITY,
110 EU_TITLE,
111 EU_POSITION,
112 EU_PHONE_PRIVATE,
113 EU_PHONE_COMPANY,
114 EU_FAX,
115 EU_EMAIL,
116 EU_STATE,
117 EU_FATHERSNAME,
118 EU_APARTMENT
121 enum SwJumpEditFormat
123 JE_FMT_TEXT,
124 JE_FMT_TABLE,
125 JE_FMT_FRAME,
126 JE_FMT_GRAPHIC,
127 JE_FMT_OLE
130 class SAL_DLLPUBLIC_RTTI SwPageNumberFieldType final : public SwFieldType
132 SvxNumType m_nNumberingType;
133 bool m_bVirtual;
135 public:
136 SwPageNumberFieldType();
138 OUString Expand( SvxNumType nFormat, short nOff, sal_uInt16 const nPageNumber,
139 sal_uInt16 const nMaxPage, const OUString&, LanguageType = LANGUAGE_NONE ) const;
140 void ChangeExpansion( SwDoc* pDoc,
141 bool bVirtPageNum, const SvxNumType* pNumFormat );
142 virtual std::unique_ptr<SwFieldType> Copy() const override;
145 // Page numbering.
146 class SW_DLLPUBLIC SwPageNumberField final : public SwField
148 OUString m_sUserStr;
149 sal_uInt16 m_nSubType;
150 short m_nOffset;
151 // fdo#58074 store page number in SwField, not SwFieldType
152 sal_uInt16 m_nPageNumber;
153 sal_uInt16 m_nMaxPage;
155 public:
156 SwPageNumberField(SwPageNumberFieldType*, sal_uInt16 nSub,
157 sal_uInt32 nFormat, short nOff = 0,
158 sal_uInt16 const nPageNumber = 0,
159 sal_uInt16 const nMaxPage = 0);
161 void ChangeExpansion(sal_uInt16 const nPageNumber,
162 sal_uInt16 const nMaxPage);
164 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
165 virtual std::unique_ptr<SwField> Copy() const override;
167 virtual OUString GetPar2() const override;
168 virtual void SetPar2(const OUString& rStr) override;
170 virtual sal_uInt16 GetSubType() const override;
171 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
172 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
174 const OUString& GetUserString() const { return m_sUserStr; }
175 void SetUserString( const OUString& rS ) { m_sUserStr = rS; }
178 class SwAuthorFieldType final : public SwFieldType
180 public:
181 SwAuthorFieldType();
183 static OUString Expand(sal_uLong);
184 virtual std::unique_ptr<SwFieldType> Copy() const override;
187 class SwAuthorField final : public SwField
189 OUString m_aContent;
191 public:
192 SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFormat);
194 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
195 virtual std::unique_ptr<SwField> Copy() const override;
197 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
199 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
200 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
203 class SAL_DLLPUBLIC_RTTI SwFileNameFieldType final : public SwFieldType
205 SwDoc& m_rDoc;
206 public:
207 SwFileNameFieldType(SwDoc&);
209 OUString Expand(sal_uLong) const;
210 virtual std::unique_ptr<SwFieldType> Copy() const override;
213 class SW_DLLPUBLIC SwFileNameField final : public SwField
215 OUString m_aContent;
217 public:
218 SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFormat);
220 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
221 virtual std::unique_ptr<SwField> Copy() const override;
223 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
225 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
226 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
229 class SAL_DLLPUBLIC_RTTI SwTemplNameFieldType final : public SwFieldType
231 SwDoc& m_rDoc;
232 public:
233 SwTemplNameFieldType(SwDoc&);
235 OUString Expand(sal_uLong) const;
236 virtual std::unique_ptr<SwFieldType> Copy() const override;
239 class SW_DLLPUBLIC SwTemplNameField final : public SwField
241 public:
242 SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFormat);
244 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
245 virtual std::unique_ptr<SwField> Copy() const override;
246 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
247 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
250 // Document statistics
251 class SAL_DLLPUBLIC_RTTI SwDocStatFieldType final : public SwFieldType
253 SwDoc& m_rDoc;
254 SvxNumType m_nNumberingType;
256 public:
257 SwDocStatFieldType(SwDoc&);
258 OUString Expand(sal_uInt16 nSubType, SvxNumType nFormat) const;
259 virtual std::unique_ptr<SwFieldType> Copy() const override;
261 void SetNumFormat( SvxNumType eFormat ) { m_nNumberingType = eFormat; }
264 class SW_DLLPUBLIC SwDocStatField final : public SwField
266 sal_uInt16 m_nSubType;
268 public:
269 SwDocStatField( SwDocStatFieldType*,
270 sal_uInt16 nSubType, sal_uInt32 nFormat);
272 void ChangeExpansion( const SwFrame* pFrame );
274 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
275 virtual std::unique_ptr<SwField> Copy() const override;
277 virtual sal_uInt16 GetSubType() const override;
278 virtual void SetSubType(sal_uInt16 nSub) override;
279 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
280 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
283 class SAL_DLLPUBLIC_RTTI SwHiddenTextFieldType final : public SwFieldType
285 bool m_bHidden;
286 public:
287 SwHiddenTextFieldType(bool bSetHidden = true);
289 virtual std::unique_ptr<SwFieldType> Copy() const override;
291 void SetHiddenFlag( bool bSetHidden );
292 bool GetHiddenFlag() const { return m_bHidden; }
295 class SW_DLLPUBLIC SwHiddenTextField final : public SwField
297 OUString m_aTRUEText; ///< Text if condition true.
298 OUString m_aFALSEText; ///< If condition false.
299 OUString m_aContent; ///< Evaluated DB-text.
301 OUString m_aCond; ///< Condition.
302 SwFieldTypesEnum m_nSubType;
304 bool m_bCanToggle : 1; ///< Can field be toggled alone?
305 bool m_bIsHidden : 1; ///< Is it not visible?
306 bool m_bValid : 1; ///< Is DB-field evaluated?
308 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
309 virtual std::unique_ptr<SwField> Copy() const override;
311 public:
312 SwHiddenTextField( SwHiddenTextFieldType*,
313 bool bConditional,
314 const OUString& rCond,
315 const OUString& rText,
316 bool bHidden,
317 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
319 SwHiddenTextField( SwHiddenTextFieldType*,
320 const OUString& rCond,
321 const OUString& rTrue,
322 const OUString& rFalse,
323 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
325 virtual OUString GetFieldName() const override;
327 void Evaluate(SwDoc& rDoc);
329 void SetValue(bool bHidden) { m_bIsHidden = bHidden; }
330 static OUString GetColumnName(const OUString& rName);
331 static OUString GetDBName(const OUString& rName, SwDoc& rDoc);
333 /// Condition
334 virtual void SetPar1(const OUString& rStr) override;
335 virtual OUString GetPar1() const override;
337 /// True/False - String
338 virtual void SetPar2(const OUString& rStr) override;
339 virtual OUString GetPar2() const override;
341 virtual sal_uInt16 GetSubType() const override;
343 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
344 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
346 static void ParseIfFieldDefinition(const OUString& aFieldDefinition,
347 OUString& rCondition,
348 OUString& rTrue,
349 OUString& rFalse);
352 // Field that expands to an empty line (without height).
353 class SwHiddenParaFieldType final : public SwFieldType
355 public:
356 SwHiddenParaFieldType();
358 virtual std::unique_ptr<SwFieldType> Copy() const override;
361 class SwHiddenParaField final : public SwField
363 OUString m_aCond;
364 bool m_bIsHidden;
365 public:
366 /// Direct input, delete old value.
367 SwHiddenParaField(SwHiddenParaFieldType*, const OUString& rCond);
369 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
370 virtual std::unique_ptr<SwField> Copy() const override;
372 void SetHidden(bool bHidden) { m_bIsHidden = bHidden; }
373 bool IsHidden() const { return m_bIsHidden; }
375 /// Query, set condition.
376 virtual OUString GetPar1() const override;
377 virtual void SetPar1(const OUString& rStr) override;
378 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
379 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
382 class SAL_DLLPUBLIC_RTTI SwMacroFieldType final : public SwFieldType
384 SwDoc& m_rDoc;
386 public:
387 SwMacroFieldType(SwDoc&);
389 virtual std::unique_ptr<SwFieldType> Copy() const override;
392 class SW_DLLPUBLIC SwMacroField final : public SwField
394 OUString m_aMacro;
395 OUString m_aText;
396 bool m_bIsScriptURL;
398 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
399 virtual std::unique_ptr<SwField> Copy() const override;
401 public:
402 /// Direct input, delete old value.
403 SwMacroField( SwMacroFieldType*, const OUString& rLibAndName,
404 const OUString& rText);
406 const OUString& GetMacro() const { return m_aMacro; }
407 OUString GetLibName() const;
408 OUString GetMacroName() const;
409 SvxMacro GetSvxMacro() const;
411 virtual OUString GetFieldName() const override;
413 /// Library and FileName
414 virtual OUString GetPar1() const override;
415 virtual void SetPar1(const OUString& rStr) override;
417 /// Macrotext
418 virtual OUString GetPar2() const override;
419 virtual void SetPar2(const OUString& rStr) override;
420 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
421 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
423 static void CreateMacroString( OUString& rMacro,
424 std::u16string_view rMacroName,
425 const OUString& rLibraryName );
427 static bool isScriptURL( const OUString& str );
430 class SAL_DLLPUBLIC_RTTI SwPostItFieldType final : public SwFieldType
432 private:
433 SwDoc& mrDoc;
434 public:
435 SwPostItFieldType(SwDoc& rDoc);
437 virtual std::unique_ptr<SwFieldType> Copy() const override;
439 SwDoc& GetDoc() const
441 return mrDoc;
445 class SW_DLLPUBLIC SwPostItField final : public SwField
447 OUString m_sText;
448 OUString m_sAuthor;
449 OUString m_sInitials; ///< Initials of the author.
450 OUString m_sName; ///< Name of the comment.
451 DateTime m_aDateTime;
452 bool m_bResolved;
453 std::unique_ptr<OutlinerParaObject> mpText;
454 rtl::Reference<SwTextAPIObject> m_xTextObject;
455 sal_uInt32 m_nPostItId;
457 public:
458 static sal_uInt32 s_nLastPostItId;
460 SwPostItField( SwPostItFieldType*,
461 const OUString& rAuthor,
462 const OUString& rText,
463 const OUString& rInitials,
464 const OUString& rName,
465 const DateTime& rDate,
466 const bool bResolved = false,
467 const sal_uInt32 nPostItId = 0);
469 SwPostItField(const SwPostItField&) = delete;
470 SwPostItField* operator=(const SwPostItField&) = delete;
472 virtual ~SwPostItField() override;
474 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
475 virtual std::unique_ptr<SwField> Copy() const override;
477 const DateTime& GetDateTime() const { return m_aDateTime; }
478 Date GetDate() const { return Date(m_aDateTime.GetDate()); }
479 tools::Time GetTime() const { return tools::Time(m_aDateTime.GetTime()); }
480 sal_uInt32 GetPostItId() const { return m_nPostItId; }
482 /// Author
483 virtual OUString GetPar1() const override;
484 virtual void SetPar1(const OUString& rStr) override;
486 /// Text
487 virtual OUString GetPar2() const override;
488 virtual void SetPar2(const OUString& rStr) override;
489 const OUString& GetText() const { return m_sText; }
490 const OUString& GetInitials() const { return m_sInitials;}
491 void SetName(const OUString& rStr);
492 const OUString& GetName() const { return m_sName;}
494 const OutlinerParaObject* GetTextObject() const { return mpText.get();}
495 void SetTextObject( std::unique_ptr<OutlinerParaObject> pText );
497 void SetResolved(bool bNewState);
498 void ToggleResolved();
499 bool GetResolved() const;
501 sal_Int32 GetNumberOfParagraphs() const;
503 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
504 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
505 virtual OUString GetDescription() const override;
506 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
509 class SAL_DLLPUBLIC_RTTI SwDocInfoFieldType final : public SwValueFieldType
511 public:
512 SwDocInfoFieldType(SwDoc* pDc);
514 OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString& rName) const;
515 virtual std::unique_ptr<SwFieldType> Copy() const override;
518 class SW_DLLPUBLIC SwDocInfoField final : public SwValueField
520 sal_uInt16 m_nSubType;
521 OUString m_aContent;
522 OUString m_aName;
524 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
525 virtual std::unique_ptr<SwField> Copy() const override;
527 public:
528 SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFormat=0);
529 SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFormat=0);
531 virtual void SetSubType(sal_uInt16) override;
532 virtual sal_uInt16 GetSubType() const override;
533 virtual void SetLanguage(LanguageType nLng) override;
534 virtual OUString GetFieldName() const override;
535 const OUString& GetName() const { return m_aName; }
536 void SetName( const OUString& rName ) { m_aName = rName; }
537 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
538 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
539 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
542 // Extended User settings.
543 class SwExtUserFieldType final : public SwFieldType
545 public:
546 SwExtUserFieldType();
548 static OUString Expand(sal_uInt16 nSubType);
549 virtual std::unique_ptr<SwFieldType> Copy() const override;
552 class SwExtUserField final : public SwField
554 OUString m_aContent;
555 sal_uInt16 m_nType;
557 public:
558 SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat);
560 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
561 virtual std::unique_ptr<SwField> Copy() const override;
563 virtual sal_uInt16 GetSubType() const override;
564 virtual void SetSubType(sal_uInt16 nSub) override;
566 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
568 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
569 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
572 // Relative page numbers - field.
573 class SwRefPageSetFieldType final : public SwFieldType
575 public:
576 SwRefPageSetFieldType();
578 virtual std::unique_ptr<SwFieldType> Copy() const override;
580 private:
581 /// noop, there is nothing to update!
582 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
585 // Relative page numbering.
586 class SAL_DLLPUBLIC_RTTI SwRefPageSetField final : public SwField
588 short m_nOffset;
589 bool m_bOn;
591 public:
592 SwRefPageSetField( SwRefPageSetFieldType*, short nOff, bool bOn );
594 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
595 virtual std::unique_ptr<SwField> Copy() const override;
597 virtual OUString GetPar2() const override;
598 virtual void SetPar2(const OUString& rStr) override;
600 bool IsOn() const { return m_bOn; }
602 short GetOffset() const { return m_nOffset; }
603 void SetOffset( short nOff ) { m_nOffset = nOff; }
604 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
605 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
608 // Relative page numbers - query field.
609 class SwRefPageGetFieldType final : public SwFieldType
611 SwDoc& m_rDoc;
612 sal_Int16 m_nNumberingType;
614 void UpdateField(SwTextField const * pTextField,
615 SetGetExpFields const & rSetList, SwRootFrame const* pLayout);
617 /// overwritten to update all RefPageGet fields
618 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
619 public:
620 SwRefPageGetFieldType( SwDoc& rDoc );
621 virtual std::unique_ptr<SwFieldType> Copy() const override;
622 bool MakeSetList(SetGetExpFields& rTmpLst, SwRootFrame const* pLayout);
623 SwDoc& GetDoc() const { return m_rDoc; }
626 // Query relative page numbering.
627 class SwRefPageGetField final : public SwField
629 OUString m_sText;
630 OUString m_sTextRLHidden; ///< hidden redlines
632 public:
633 SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFormat );
635 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
636 virtual std::unique_ptr<SwField> Copy() const override;
638 void SetText(const OUString& rText, SwRootFrame const* pLayout);
640 void ChangeExpansion(const SwFrame& rFrame, const SwTextField* pField);
641 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
642 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
645 // Field to jump to and edit.
646 class SwJumpEditFieldType final : public SwFieldType
648 SwDoc& m_rDoc;
649 sw::WriterMultiListener m_aDep;
651 public:
652 SwJumpEditFieldType( SwDoc& rDoc );
653 virtual std::unique_ptr<SwFieldType> Copy() const override;
655 SwCharFormat* GetCharFormat();
658 class SwJumpEditField final : public SwField
660 OUString m_sText;
661 OUString m_sHelp;
662 public:
663 SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat,
664 const OUString& sText, const OUString& sHelp );
666 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
667 virtual std::unique_ptr<SwField> Copy() const override;
669 /// Placeholder-Text
670 virtual OUString GetPar1() const override;
671 virtual void SetPar1(const OUString& rStr) override;
673 /// Hint-Text
674 virtual OUString GetPar2() const override;
675 virtual void SetPar2(const OUString& rStr) override;
677 SwCharFormat* GetCharFormat() const
678 { return static_cast<SwJumpEditFieldType*>(GetTyp())->GetCharFormat(); }
679 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
680 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
683 class SwScriptFieldType final : public SwFieldType
685 SwDoc& m_rDoc;
686 public:
687 SwScriptFieldType( SwDoc& rDoc );
689 virtual std::unique_ptr<SwFieldType> Copy() const override;
692 class SW_DLLPUBLIC SwScriptField final : public SwField
694 OUString m_sType; ///< Type of Code (Java/VBScript/...)
695 OUString m_sCode; /**< Code as text.
696 Code as JavaCode ? */
698 bool m_bCodeURL; ///< Code contains URL of a script.
700 public:
701 SwScriptField( SwScriptFieldType*, const OUString& rType,
702 const OUString& rCode, bool bURL );
704 virtual OUString GetDescription() const override;
706 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
707 virtual std::unique_ptr<SwField> Copy() const override;
709 /// Type
710 virtual OUString GetPar1() const override;
711 virtual void SetPar1(const OUString& rStr) override;
712 /// Text
713 virtual OUString GetPar2() const override;
714 virtual void SetPar2(const OUString& rStr) override;
716 bool IsCodeURL() const { return m_bCodeURL; }
717 void SetCodeURL( bool bURL ) { m_bCodeURL = bURL; }
718 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
719 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
722 // Combined Character Fieldtype
723 class SAL_DLLPUBLIC_RTTI SwCombinedCharFieldType final : public SwFieldType
725 public:
726 SwCombinedCharFieldType();
728 virtual std::unique_ptr<SwFieldType> Copy() const override;
731 // ScriptField
732 #define MAX_COMBINED_CHARACTERS 6
734 class SW_DLLPUBLIC SwCombinedCharField final : public SwField
736 OUString m_sCharacters; ///< combine these characters
738 public:
739 SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars );
741 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
742 virtual std::unique_ptr<SwField> Copy() const override;
744 /// Characters
745 virtual OUString GetPar1() const override;
746 virtual void SetPar1(const OUString& rStr) override;
748 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
749 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
752 #endif // INCLUDED_SW_INC_DOCUFLD_HXX
754 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */