Use COMReference to handle COM pointers in CreateShortcut
[LibreOffice.git] / sw / inc / docufld.hxx
blob83986b735ae365ad757c0db60855e43479853b8c
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 #pragma once
21 #include <sal/config.h>
23 #include <string_view>
25 #include <editeng/outlobj.hxx>
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 = 0x0f00;
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;
290 virtual void UpdateFields() override {};
292 void SetHiddenFlag( bool bSetHidden );
293 bool GetHiddenFlag() const { return m_bHidden; }
296 class SW_DLLPUBLIC SwHiddenTextField final : public SwField
298 OUString m_aTRUEText; ///< Text if condition true.
299 OUString m_aFALSEText; ///< If condition false.
300 OUString m_aContent; ///< Evaluated DB-text.
302 OUString m_aCond; ///< Condition.
303 SwFieldTypesEnum m_nSubType;
305 bool m_bCanToggle : 1; ///< Can field be toggled alone?
306 bool m_bIsHidden : 1; ///< Is it not visible?
307 bool m_bValid : 1; ///< Is DB-field evaluated?
309 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
310 virtual std::unique_ptr<SwField> Copy() const override;
312 public:
313 SwHiddenTextField( SwHiddenTextFieldType*,
314 bool bConditional,
315 OUString aCond,
316 const OUString& rText,
317 bool bHidden,
318 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
320 SwHiddenTextField( SwHiddenTextFieldType*,
321 OUString aCond,
322 OUString aTrue,
323 OUString aFalse,
324 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
326 virtual OUString GetFieldName() const override;
328 void Evaluate(SwDoc& rDoc);
330 void SetValue(bool bHidden) { m_bIsHidden = bHidden; }
331 static OUString GetColumnName(const OUString& rName);
332 static OUString GetDBName(std::u16string_view rName, SwDoc& rDoc);
334 /// Condition
335 virtual void SetPar1(const OUString& rStr) override;
336 virtual OUString GetPar1() const override;
338 /// True/False - String
339 virtual void SetPar2(const OUString& rStr) override;
340 virtual OUString GetPar2() const override;
342 virtual sal_uInt16 GetSubType() const override;
344 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
345 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
347 static void ParseIfFieldDefinition(std::u16string_view aFieldDefinition,
348 OUString& rCondition,
349 OUString& rTrue,
350 OUString& rFalse);
353 // Field that expands to an empty line (without height).
354 class SwHiddenParaFieldType final : public SwFieldType
356 public:
357 SwHiddenParaFieldType();
359 virtual std::unique_ptr<SwFieldType> Copy() const override;
360 virtual void UpdateFields() override {};
363 class SwHiddenParaField final : public SwField
365 OUString m_aCond;
366 bool m_bIsHidden;
367 public:
368 /// Direct input, delete old value.
369 SwHiddenParaField(SwHiddenParaFieldType*, OUString aCond);
371 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
372 virtual std::unique_ptr<SwField> Copy() const override;
374 void SetHidden(bool bHidden) { m_bIsHidden = bHidden; }
375 bool IsHidden() const { return m_bIsHidden; }
377 /// Query, set condition.
378 virtual OUString GetPar1() const override;
379 virtual void SetPar1(const OUString& rStr) override;
380 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
381 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
384 class SAL_DLLPUBLIC_RTTI SwMacroFieldType final : public SwFieldType
386 SwDoc& m_rDoc;
388 public:
389 SwMacroFieldType(SwDoc&);
391 virtual std::unique_ptr<SwFieldType> Copy() const override;
394 class SW_DLLPUBLIC SwMacroField final : public SwField
396 OUString m_aMacro;
397 OUString m_aText;
398 bool m_bIsScriptURL;
400 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
401 virtual std::unique_ptr<SwField> Copy() const override;
403 public:
404 /// Direct input, delete old value.
405 SwMacroField( SwMacroFieldType*, OUString aLibAndName,
406 OUString aText);
408 const OUString& GetMacro() const { return m_aMacro; }
409 OUString GetLibName() const;
410 OUString GetMacroName() const;
411 SvxMacro GetSvxMacro() const;
413 virtual OUString GetFieldName() const override;
415 /// Library and FileName
416 virtual OUString GetPar1() const override;
417 virtual void SetPar1(const OUString& rStr) override;
419 /// Macrotext
420 virtual OUString GetPar2() const override;
421 virtual void SetPar2(const OUString& rStr) override;
422 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
423 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
425 static void CreateMacroString( OUString& rMacro,
426 std::u16string_view rMacroName,
427 const OUString& rLibraryName );
429 static bool isScriptURL( const OUString& str );
432 class SAL_DLLPUBLIC_RTTI SwPostItFieldType final : public SwFieldType
434 private:
435 SwDoc& mrDoc;
436 public:
437 SwPostItFieldType(SwDoc& rDoc);
439 virtual std::unique_ptr<SwFieldType> Copy() const override;
441 SwDoc& GetDoc() const
443 return mrDoc;
447 class SW_DLLPUBLIC SwPostItField final : public SwField
449 OUString m_sText;
450 OUString m_sAuthor;
451 OUString m_sInitials; ///< Initials of the author.
452 OUString m_sName; ///< Name of the comment.
453 DateTime m_aDateTime;
454 bool m_bResolved;
455 std::optional<OutlinerParaObject> mpText;
456 rtl::Reference<SwTextAPIObject> m_xTextObject;
457 sal_uInt32 m_nPostItId;
458 sal_uInt32 m_nParentId;
459 sal_uInt32 m_nParaId;
460 sal_uInt32 m_nParentPostItId;
461 OUString m_sParentName; /// Parent comment's name.
463 public:
464 static sal_uInt32 s_nLastPostItId;
466 SwPostItField( SwPostItFieldType*,
467 OUString aAuthor,
468 OUString aText,
469 OUString aInitials,
470 OUString aName,
471 const DateTime& rDate,
472 const bool bResolved = false,
473 const sal_uInt32 nPostItId = 0,
474 const sal_uInt32 nParentId = 0,
475 const sal_uInt32 nParaId = 0,
476 const sal_uInt32 nParentPostItId = 0,
477 const OUString aParentName = OUString());
479 SwPostItField(const SwPostItField&) = delete;
480 SwPostItField* operator=(const SwPostItField&) = delete;
482 virtual ~SwPostItField() override;
484 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
485 virtual std::unique_ptr<SwField> Copy() const override;
487 const DateTime& GetDateTime() const { return m_aDateTime; }
488 Date GetDate() const { return Date(m_aDateTime); }
489 tools::Time GetTime() const { return tools::Time(m_aDateTime); }
490 sal_uInt32 GetPostItId() const { return m_nPostItId; }
491 void SetPostItId(const sal_uInt32 nPostItId = 0);
492 void SetParentPostItId(const sal_uInt32 nParentPostItId = 0);
493 sal_uInt32 GetParentId() const { return m_nParentId; }
494 sal_uInt32 GetParentPostItId() const { return m_nParentPostItId; }
495 void SetParentId(const sal_uInt32 nParentId);
496 sal_uInt32 GetParaId() const { return m_nParaId; }
497 void SetParaId(const sal_uInt32 nParaId);
499 /// Author
500 virtual OUString GetPar1() const override;
501 virtual void SetPar1(const OUString& rStr) override;
503 /// Text
504 virtual OUString GetPar2() const override;
505 virtual void SetPar2(const OUString& rStr) override;
506 const OUString& GetText() const { return m_sText; }
507 const OUString& GetInitials() const { return m_sInitials;}
508 void SetName(const OUString& rStr);
509 const OUString& GetName() const { return m_sName;}
510 const OUString& GetParentName() const { return m_sParentName; }
511 void SetParentName(const OUString& rStr);
513 const OutlinerParaObject* GetTextObject() const { return mpText ? &*mpText : nullptr;}
514 void SetTextObject( std::optional<OutlinerParaObject> pText );
516 void SetResolved(bool bNewState);
517 void ToggleResolved();
518 bool GetResolved() const;
520 sal_Int32 GetNumberOfParagraphs() const;
521 void ChangeStyleSheetName(std::u16string_view rOldName, const SfxStyleSheetBase* pStyleSheet);
523 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
524 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
525 virtual OUString GetDescription() const override;
526 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
529 class SAL_DLLPUBLIC_RTTI SwDocInfoFieldType final : public SwValueFieldType
531 public:
532 SwDocInfoFieldType(SwDoc* pDc);
534 OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString& rName) const;
535 virtual std::unique_ptr<SwFieldType> Copy() const override;
538 class SW_DLLPUBLIC SwDocInfoField final : public SwValueField
540 sal_uInt16 m_nSubType;
541 OUString m_aContent;
542 OUString m_aName;
544 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
545 virtual std::unique_ptr<SwField> Copy() const override;
547 public:
548 SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFormat=0);
549 SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFormat=0);
551 virtual void SetSubType(sal_uInt16) override;
552 virtual sal_uInt16 GetSubType() const override;
553 virtual void SetLanguage(LanguageType nLng) override;
554 virtual OUString GetFieldName() const override;
555 const OUString& GetName() const { return m_aName; }
556 void SetName( const OUString& rName ) { m_aName = rName; }
557 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
558 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
559 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
562 // Extended User settings.
563 class SwExtUserFieldType final : public SwFieldType
565 public:
566 SwExtUserFieldType();
568 static OUString Expand(sal_uInt16 nSubType);
569 virtual std::unique_ptr<SwFieldType> Copy() const override;
572 class SwExtUserField final : public SwField
574 OUString m_aContent;
575 sal_uInt16 m_nType;
577 public:
578 SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat);
580 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
581 virtual std::unique_ptr<SwField> Copy() const override;
583 virtual sal_uInt16 GetSubType() const override;
584 virtual void SetSubType(sal_uInt16 nSub) override;
586 void SetExpansion(const OUString& rStr) { m_aContent = rStr; }
588 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
589 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
592 // Relative page numbers - field.
593 class SwRefPageSetFieldType final : public SwFieldType
595 public:
596 SwRefPageSetFieldType();
598 virtual std::unique_ptr<SwFieldType> Copy() const override;
599 virtual void UpdateFields() override {};
601 private:
602 /// noop, there is nothing to update!
603 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
606 // Relative page numbering.
607 class SAL_DLLPUBLIC_RTTI SwRefPageSetField final : public SwField
609 short m_nOffset;
610 bool m_bOn;
612 public:
613 SwRefPageSetField( SwRefPageSetFieldType*, short nOff, bool bOn );
615 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
616 virtual std::unique_ptr<SwField> Copy() const override;
618 virtual OUString GetPar2() const override;
619 virtual void SetPar2(const OUString& rStr) override;
621 bool IsOn() const { return m_bOn; }
623 short GetOffset() const { return m_nOffset; }
624 void SetOffset( short nOff ) { m_nOffset = nOff; }
625 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
626 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
629 // Relative page numbers - query field.
630 class SwRefPageGetFieldType final : public SwFieldType
632 SwDoc& m_rDoc;
633 sal_Int16 m_nNumberingType;
635 void UpdateField(SwTextField const * pTextField,
636 SetGetExpFields const & rSetList, SwRootFrame const* pLayout);
638 /// overwritten to update all RefPageGet fields
639 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
640 public:
641 SwRefPageGetFieldType( SwDoc& rDoc );
642 virtual std::unique_ptr<SwFieldType> Copy() const override;
643 bool MakeSetList(SetGetExpFields& rTmpLst, SwRootFrame const* pLayout);
644 SwDoc& GetDoc() const { return m_rDoc; }
647 // Query relative page numbering.
648 class SwRefPageGetField final : public SwField
650 OUString m_sText;
651 OUString m_sTextRLHidden; ///< hidden redlines
653 public:
654 SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFormat );
656 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
657 virtual std::unique_ptr<SwField> Copy() const override;
659 void SetText(const OUString& rText, SwRootFrame const* pLayout);
661 void ChangeExpansion(const SwFrame& rFrame, const SwTextField* pField);
662 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
663 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
666 // Field to jump to and edit.
667 class SwJumpEditFieldType final : public SwFieldType
669 SwDoc& m_rDoc;
670 sw::WriterMultiListener m_aDep;
672 public:
673 SwJumpEditFieldType( SwDoc& rDoc );
674 virtual std::unique_ptr<SwFieldType> Copy() const override;
675 virtual void UpdateFields() override {};
677 SwCharFormat* GetCharFormat();
680 class SwJumpEditField final : public SwField
682 OUString m_sText;
683 OUString m_sHelp;
684 public:
685 SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat,
686 OUString sText, OUString sHelp );
688 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
689 virtual std::unique_ptr<SwField> Copy() const override;
691 /// Placeholder-Text
692 virtual OUString GetPar1() const override;
693 virtual void SetPar1(const OUString& rStr) override;
695 /// Hint-Text
696 virtual OUString GetPar2() const override;
697 virtual void SetPar2(const OUString& rStr) override;
699 SwCharFormat* GetCharFormat() const
700 { return static_cast<SwJumpEditFieldType*>(GetTyp())->GetCharFormat(); }
701 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
702 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
705 class SwScriptFieldType final : public SwFieldType
707 SwDoc& m_rDoc;
708 public:
709 SwScriptFieldType( SwDoc& rDoc );
711 virtual std::unique_ptr<SwFieldType> Copy() const override;
714 class SW_DLLPUBLIC SwScriptField final : public SwField
716 OUString m_sType; ///< Type of Code (Java/VBScript/...)
717 OUString m_sCode; /**< Code as text.
718 Code as JavaCode ? */
720 bool m_bCodeURL; ///< Code contains URL of a script.
722 public:
723 SwScriptField( SwScriptFieldType*, OUString aType,
724 OUString aCode, bool bURL );
726 virtual OUString GetDescription() const override;
728 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
729 virtual std::unique_ptr<SwField> Copy() const override;
731 /// Type
732 virtual OUString GetPar1() const override;
733 virtual void SetPar1(const OUString& rStr) override;
734 /// Text
735 virtual OUString GetPar2() const override;
736 virtual void SetPar2(const OUString& rStr) override;
738 bool IsCodeURL() const { return m_bCodeURL; }
739 void SetCodeURL( bool bURL ) { m_bCodeURL = bURL; }
740 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
741 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
744 // Combined Character Fieldtype
745 class SAL_DLLPUBLIC_RTTI SwCombinedCharFieldType final : public SwFieldType
747 public:
748 SwCombinedCharFieldType();
750 virtual std::unique_ptr<SwFieldType> Copy() const override;
753 // ScriptField
754 #define MAX_COMBINED_CHARACTERS 6
756 class SW_DLLPUBLIC SwCombinedCharField final : public SwField
758 OUString m_sCharacters; ///< combine these characters
760 public:
761 SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars );
763 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
764 virtual std::unique_ptr<SwField> Copy() const override;
766 /// Characters
767 virtual OUString GetPar1() const override;
768 virtual void SetPar1(const OUString& rStr) override;
770 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
771 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
774 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */