1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 #ifndef INCLUDED_SW_INC_DOCUFLD_HXX 20 #define INCLUDED_SW_INC_DOCUFLD_HXX 21 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> 27 28 #include "fldbas.hxx" 29 30 class SetGetExpFields; 31 class SwTextField; 32 class SwFrame; 33 class OutlinerParaObject; 34 class SwTextAPIObject; 35 class SwCharFormat; 36 37 enum SwAuthorFormat 38 { 39 AF_BEGIN, 40 AF_NAME = AF_BEGIN, 41 AF_SHORTCUT, 42 AF_FIXED = 0x8000 43 }; 44 45 // Subtype of document statistics. 46 enum SwDocStatSubType 47 { 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, 56 }; 57 58 typedef sal_uInt16 SwDocInfoSubType; 59 namespace nsSwDocInfoSubType 60 { 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; 77 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; 83 } 84 85 enum SwPageNumSubType 86 { 87 PG_RANDOM, 88 PG_NEXT, 89 PG_PREV 90 }; 91 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). 95 96 enum SwExtUserSubType 97 { 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 115 }; 116 117 enum SwJumpEditFormat 118 { 119 JE_FMT_TEXT, 120 JE_FMT_TABLE, 121 JE_FMT_FRAME, 122 JE_FMT_GRAPHIC, 123 JE_FMT_OLE 124 }; 125 126 class SAL_DLLPUBLIC_RTTI SwPageNumberFieldType final : public SwFieldType 127 { 128 SvxNumType m_nNumberingType; 129 bool m_bVirtual; 130 131 public: 132 SwPageNumberFieldType(); 133 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; 139 }; 140 141 // Page numbering. 142 class SW_DLLPUBLIC SwPageNumberField final : public SwField 143 { 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; 150 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); 156 157 void ChangeExpansion(sal_uInt16 const nPageNumber, 158 sal_uInt16 const nMaxPage); 159 160 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 161 virtual std::unique_ptr<SwField> Copy() const override; 162 163 virtual OUString GetPar2() const override; 164 virtual void SetPar2(const OUString& rStr) override; 165 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; 169 GetUserString() const170 const OUString& GetUserString() const { return m_sUserStr; } SetUserString(const OUString & rS)171 void SetUserString( const OUString& rS ) { m_sUserStr = rS; } 172 }; 173 174 class SwAuthorFieldType final : public SwFieldType 175 { 176 public: 177 SwAuthorFieldType(); 178 179 static OUString Expand(sal_uLong); 180 virtual std::unique_ptr<SwFieldType> Copy() const override; 181 }; 182 183 class SwAuthorField final : public SwField 184 { 185 OUString m_aContent; 186 187 public: 188 SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFormat); 189 190 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 191 virtual std::unique_ptr<SwField> Copy() const override; 192 SetExpansion(const OUString & rStr)193 void SetExpansion(const OUString& rStr) { m_aContent = rStr; } 194 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; 197 }; 198 199 class SAL_DLLPUBLIC_RTTI SwFileNameFieldType final : public SwFieldType 200 { 201 SwDoc *m_pDoc; 202 public: 203 SwFileNameFieldType(SwDoc*); 204 205 OUString Expand(sal_uLong) const; 206 virtual std::unique_ptr<SwFieldType> Copy() const override; 207 }; 208 209 class SW_DLLPUBLIC SwFileNameField final : public SwField 210 { 211 OUString m_aContent; 212 213 public: 214 SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFormat); 215 216 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 217 virtual std::unique_ptr<SwField> Copy() const override; 218 SetExpansion(const OUString & rStr)219 void SetExpansion(const OUString& rStr) { m_aContent = rStr; } 220 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; 223 }; 224 225 class SAL_DLLPUBLIC_RTTI SwTemplNameFieldType final : public SwFieldType 226 { 227 SwDoc *m_pDoc; 228 public: 229 SwTemplNameFieldType(SwDoc*); 230 231 OUString Expand(sal_uLong) const; 232 virtual std::unique_ptr<SwFieldType> Copy() const override; 233 }; 234 235 class SW_DLLPUBLIC SwTemplNameField final : public SwField 236 { 237 public: 238 SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFormat); 239 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; 244 }; 245 246 // Document statistics 247 class SAL_DLLPUBLIC_RTTI SwDocStatFieldType final : public SwFieldType 248 { 249 SwDoc* m_pDoc; 250 SvxNumType m_nNumberingType; 251 252 public: 253 SwDocStatFieldType(SwDoc*); 254 OUString Expand(sal_uInt16 nSubType, SvxNumType nFormat) const; 255 virtual std::unique_ptr<SwFieldType> Copy() const override; 256 SetNumFormat(SvxNumType eFormat)257 void SetNumFormat( SvxNumType eFormat ) { m_nNumberingType = eFormat; } 258 }; 259 260 class SW_DLLPUBLIC SwDocStatField final : public SwField 261 { 262 sal_uInt16 m_nSubType; 263 264 public: 265 SwDocStatField( SwDocStatFieldType*, 266 sal_uInt16 nSubType, sal_uInt32 nFormat); 267 268 void ChangeExpansion( const SwFrame* pFrame ); 269 270 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 271 virtual std::unique_ptr<SwField> Copy() const override; 272 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; 277 }; 278 279 class SAL_DLLPUBLIC_RTTI SwHiddenTextFieldType final : public SwFieldType 280 { 281 bool m_bHidden; 282 public: 283 SwHiddenTextFieldType(bool bSetHidden = true); 284 285 virtual std::unique_ptr<SwFieldType> Copy() const override; 286 287 void SetHiddenFlag( bool bSetHidden ); GetHiddenFlag() const288 bool GetHiddenFlag() const { return m_bHidden; } 289 }; 290 291 class SW_DLLPUBLIC SwHiddenTextField final : public SwField 292 { 293 OUString m_aTRUEText; ///< Text if condition true. 294 OUString m_aFALSEText; ///< If condition false. 295 OUString m_aContent; ///< Evaluated DB-text. 296 297 OUString m_aCond; ///< Condition. 298 SwFieldTypesEnum m_nSubType; 299 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? 303 304 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 305 virtual std::unique_ptr<SwField> Copy() const override; 306 307 public: 308 SwHiddenTextField( SwHiddenTextFieldType*, 309 bool bConditional, 310 const OUString& rCond, 311 const OUString& rText, 312 bool bHidden, 313 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText); 314 315 SwHiddenTextField( SwHiddenTextFieldType*, 316 const OUString& rCond, 317 const OUString& rTrue, 318 const OUString& rFalse, 319 SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText); 320 321 virtual OUString GetFieldName() const override; 322 323 void Evaluate(SwDoc*); 324 SetValue(bool bHidden)325 void SetValue(bool bHidden) { m_bIsHidden = bHidden; } 326 static OUString GetColumnName(const OUString& rName); 327 static OUString GetDBName(const OUString& rName, SwDoc *pDoc); 328 329 /// Condition 330 virtual void SetPar1(const OUString& rStr) override; 331 virtual OUString GetPar1() const override; 332 333 /// True/False - String 334 virtual void SetPar2(const OUString& rStr) override; 335 virtual OUString GetPar2() const override; 336 337 virtual sal_uInt16 GetSubType() const override; 338 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; 341 342 static void ParseIfFieldDefinition(const OUString& aFieldDefinition, 343 OUString& rCondition, 344 OUString& rTrue, 345 OUString& rFalse); 346 }; 347 348 // Field that expands to an empty line (without height). 349 class SwHiddenParaFieldType final : public SwFieldType 350 { 351 public: 352 SwHiddenParaFieldType(); 353 354 virtual std::unique_ptr<SwFieldType> Copy() const override; 355 }; 356 357 class SwHiddenParaField final : public SwField 358 { 359 OUString m_aCond; 360 bool m_bIsHidden; 361 public: 362 /// Direct input, delete old value. 363 SwHiddenParaField(SwHiddenParaFieldType*, const OUString& rCond); 364 365 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 366 virtual std::unique_ptr<SwField> Copy() const override; 367 SetHidden(bool bHidden)368 void SetHidden(bool bHidden) { m_bIsHidden = bHidden; } IsHidden() const369 bool IsHidden() const { return m_bIsHidden; } 370 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; 376 }; 377 378 class SAL_DLLPUBLIC_RTTI SwMacroFieldType final : public SwFieldType 379 { 380 SwDoc* const m_pDoc; 381 382 public: 383 SwMacroFieldType(SwDoc*); 384 385 virtual std::unique_ptr<SwFieldType> Copy() const override; 386 }; 387 388 class SW_DLLPUBLIC SwMacroField final : public SwField 389 { 390 OUString m_aMacro; 391 OUString m_aText; 392 bool m_bIsScriptURL; 393 394 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 395 virtual std::unique_ptr<SwField> Copy() const override; 396 397 public: 398 /// Direct input, delete old value. 399 SwMacroField( SwMacroFieldType*, const OUString& rLibAndName, 400 const OUString& rText); 401 GetMacro() const402 const OUString& GetMacro() const { return m_aMacro; } 403 OUString GetLibName() const; 404 OUString GetMacroName() const; 405 SvxMacro GetSvxMacro() const; 406 407 virtual OUString GetFieldName() const override; 408 409 /// Library and FileName 410 virtual OUString GetPar1() const override; 411 virtual void SetPar1(const OUString& rStr) override; 412 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; 418 419 static void CreateMacroString( OUString& rMacro, 420 const OUString& rMacroName, 421 const OUString& rLibraryName ); 422 423 static bool isScriptURL( const OUString& str ); 424 }; 425 426 class SAL_DLLPUBLIC_RTTI SwPostItFieldType final : public SwFieldType 427 { 428 private: 429 SwDoc* const mpDoc; 430 public: 431 SwPostItFieldType(SwDoc* pDoc); 432 433 virtual std::unique_ptr<SwFieldType> Copy() const override; 434 GetDoc() const435 SwDoc* GetDoc() const 436 { 437 return mpDoc; 438 }; 439 }; 440 441 class SW_DLLPUBLIC SwPostItField final : public SwField 442 { 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; 452 453 public: 454 static sal_uInt32 m_nLastPostItId; 455 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); 464 465 SwPostItField(const SwPostItField&) = delete; 466 SwPostItField* operator=(const SwPostItField&) = delete; 467 468 virtual ~SwPostItField() override; 469 470 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 471 virtual std::unique_ptr<SwField> Copy() const override; 472 GetDateTime() const473 const DateTime& GetDateTime() const { return m_aDateTime; } GetDate() const474 Date GetDate() const { return Date(m_aDateTime.GetDate()); } GetTime() const475 tools::Time GetTime() const { return tools::Time(m_aDateTime.GetTime()); } GetPostItId() const476 sal_uInt32 GetPostItId() const { return m_nPostItId; } 477 478 /// Author 479 virtual OUString GetPar1() const override; 480 virtual void SetPar1(const OUString& rStr) override; 481 482 /// Text 483 virtual OUString GetPar2() const override; 484 virtual void SetPar2(const OUString& rStr) override; GetText() const485 const OUString& GetText() const { return m_sText; } GetInitials() const486 const OUString& GetInitials() const { return m_sInitials;} 487 void SetName(const OUString& rStr); GetName() const488 const OUString& GetName() const { return m_sName;} 489 GetTextObject() const490 const OutlinerParaObject* GetTextObject() const { return mpText.get();} 491 void SetTextObject( std::unique_ptr<OutlinerParaObject> pText ); 492 493 void SetResolved(bool bNewState); 494 void ToggleResolved(); 495 bool GetResolved() const; 496 497 sal_Int32 GetNumberOfParagraphs() const; 498 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; 503 }; 504 505 class SAL_DLLPUBLIC_RTTI SwDocInfoFieldType final : public SwValueFieldType 506 { 507 public: 508 SwDocInfoFieldType(SwDoc* pDc); 509 510 OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString& rName) const; 511 virtual std::unique_ptr<SwFieldType> Copy() const override; 512 }; 513 514 class SW_DLLPUBLIC SwDocInfoField final : public SwValueField 515 { 516 sal_uInt16 m_nSubType; 517 OUString m_aContent; 518 OUString m_aName; 519 520 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 521 virtual std::unique_ptr<SwField> Copy() const override; 522 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); 526 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; GetName() const531 const OUString& GetName() const { return m_aName; } SetName(const OUString & rName)532 void SetName( const OUString& rName ) { m_aName = rName; } SetExpansion(const OUString & rStr)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; 536 }; 537 538 // Extended User settings. 539 class SwExtUserFieldType final : public SwFieldType 540 { 541 public: 542 SwExtUserFieldType(); 543 544 static OUString Expand(sal_uInt16 nSubType); 545 virtual std::unique_ptr<SwFieldType> Copy() const override; 546 }; 547 548 class SwExtUserField final : public SwField 549 { 550 OUString m_aContent; 551 sal_uInt16 m_nType; 552 553 public: 554 SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat); 555 556 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 557 virtual std::unique_ptr<SwField> Copy() const override; 558 559 virtual sal_uInt16 GetSubType() const override; 560 virtual void SetSubType(sal_uInt16 nSub) override; 561 SetExpansion(const OUString & rStr)562 void SetExpansion(const OUString& rStr) { m_aContent = rStr; } 563 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; 566 }; 567 568 // Relative page numbers - field. 569 class SwRefPageSetFieldType final : public SwFieldType 570 { 571 public: 572 SwRefPageSetFieldType(); 573 574 virtual std::unique_ptr<SwFieldType> Copy() const override; 575 576 private: 577 /// Overlay, because there is nothing to update! 578 virtual void Modify( const SfxPoolItem*, const SfxPoolItem * ) override; 579 }; 580 581 // Relative page numbering. 582 class SAL_DLLPUBLIC_RTTI SwRefPageSetField final : public SwField 583 { 584 short m_nOffset; 585 bool m_bOn; 586 587 public: 588 SwRefPageSetField( SwRefPageSetFieldType*, short nOff, bool bOn ); 589 590 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 591 virtual std::unique_ptr<SwField> Copy() const override; 592 593 virtual OUString GetPar2() const override; 594 virtual void SetPar2(const OUString& rStr) override; 595 IsOn() const596 bool IsOn() const { return m_bOn; } 597 GetOffset() const598 short GetOffset() const { return m_nOffset; } SetOffset(short nOff)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; 602 }; 603 604 // Relative page numbers - query field. 605 class SwRefPageGetFieldType final : public SwFieldType 606 { 607 SwDoc* m_pDoc; 608 sal_Int16 m_nNumberingType; 609 610 void UpdateField(SwTextField const * pTextField, 611 SetGetExpFields const & rSetList, SwRootFrame const* pLayout); 612 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); GetDoc() const619 SwDoc* GetDoc() const { return m_pDoc; } 620 }; 621 622 // Query relative page numbering. 623 class SwRefPageGetField final : public SwField 624 { 625 OUString m_sText; 626 OUString m_sTextRLHidden; ///< hidden redlines 627 628 public: 629 SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFormat ); 630 631 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 632 virtual std::unique_ptr<SwField> Copy() const override; 633 634 void SetText(const OUString& rText, SwRootFrame const* pLayout); 635 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; 639 }; 640 641 // Field to jump to and edit. 642 class SwJumpEditFieldType final : public SwFieldType 643 { 644 SwDoc* m_pDoc; 645 sw::WriterMultiListener m_aDep; 646 647 public: 648 SwJumpEditFieldType( SwDoc* pDoc ); 649 virtual std::unique_ptr<SwFieldType> Copy() const override; 650 651 SwCharFormat* GetCharFormat(); 652 }; 653 654 class SwJumpEditField final : public SwField 655 { 656 OUString m_sText; 657 OUString m_sHelp; 658 public: 659 SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat, 660 const OUString& sText, const OUString& sHelp ); 661 662 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 663 virtual std::unique_ptr<SwField> Copy() const override; 664 665 /// Placeholder-Text 666 virtual OUString GetPar1() const override; 667 virtual void SetPar1(const OUString& rStr) override; 668 669 /// Hint-Text 670 virtual OUString GetPar2() const override; 671 virtual void SetPar2(const OUString& rStr) override; 672 GetCharFormat() const673 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; 677 }; 678 679 class SwScriptFieldType final : public SwFieldType 680 { 681 SwDoc* const m_pDoc; 682 public: 683 SwScriptFieldType( SwDoc* pDoc ); 684 685 virtual std::unique_ptr<SwFieldType> Copy() const override; 686 }; 687 688 class SW_DLLPUBLIC SwScriptField final : public SwField 689 { 690 OUString m_sType; ///< Type of Code (Java/VBScript/...) 691 OUString m_sCode; /**< Code as text. 692 Code as JavaCode ? */ 693 694 bool m_bCodeURL; ///< Code contains URL of a script. 695 696 public: 697 SwScriptField( SwScriptFieldType*, const OUString& rType, 698 const OUString& rCode, bool bURL ); 699 700 virtual OUString GetDescription() const override; 701 702 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 703 virtual std::unique_ptr<SwField> Copy() const override; 704 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; 711 IsCodeURL() const712 bool IsCodeURL() const { return m_bCodeURL; } SetCodeURL(bool bURL)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; 716 }; 717 718 // Combined Character Fieldtype 719 class SAL_DLLPUBLIC_RTTI SwCombinedCharFieldType final : public SwFieldType 720 { 721 public: 722 SwCombinedCharFieldType(); 723 724 virtual std::unique_ptr<SwFieldType> Copy() const override; 725 }; 726 727 // ScriptField 728 #define MAX_COMBINED_CHARACTERS 6 729 730 class SW_DLLPUBLIC SwCombinedCharField final : public SwField 731 { 732 OUString m_sCharacters; ///< combine these characters 733 734 public: 735 SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars ); 736 737 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; 738 virtual std::unique_ptr<SwField> Copy() const override; 739 740 /// Characters 741 virtual OUString GetPar1() const override; 742 virtual void SetPar1(const OUString& rStr) override; 743 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; 746 }; 747 748 #endif // INCLUDED_SW_INC_DOCUFLD_HXX 749 750 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 751