LibreOffice Module sw (master) 1
docufld.cxx
Go to the documentation of this file.
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
20#include <config_features.h>
21#include <config_fuzzers.h>
22
23#include <textapi.hxx>
24
25#include <hintids.hxx>
26#include <com/sun/star/frame/XModel.hpp>
27#include <com/sun/star/text/XText.hpp>
28#include <com/sun/star/script/Converter.hpp>
29#include <com/sun/star/text/PlaceholderType.hpp>
30#include <com/sun/star/text/TemplateDisplayFormat.hpp>
31#include <com/sun/star/text/PageNumberType.hpp>
32#include <com/sun/star/text/FilenameDisplayFormat.hpp>
33#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
34#include <com/sun/star/document/XDocumentProperties.hpp>
35#include <com/sun/star/util/Date.hpp>
36#include <com/sun/star/util/Duration.hpp>
37#include <o3tl/any.hxx>
38#include <o3tl/string_view.hxx>
41#include <comphelper/string.hxx>
42#include <tools/urlobj.hxx>
43#include <svl/numformat.hxx>
44#include <svl/urihelper.hxx>
47#include <libxml/xmlstring.h>
48#include <libxml/xmlwriter.h>
49
50#include <tools/time.hxx>
51#include <tools/datetime.hxx>
52
53#include <com/sun/star/util/DateTime.hpp>
54
55#include <swmodule.hxx>
56#include <sfx2/docfile.hxx>
57#include <sfx2/doctempl.hxx>
58#include <fmtfld.hxx>
59#include <txtfld.hxx>
60#include <charfmt.hxx>
61#include <docstat.hxx>
62#include <pagedesc.hxx>
63#include <fmtpdsc.hxx>
64#include <doc.hxx>
69#include <rootfrm.hxx>
70#include <pagefrm.hxx>
71#include <cntfrm.hxx>
72#include <pam.hxx>
73#include <utility>
74#include <viewsh.hxx>
75#include <dbmgr.hxx>
76#include <shellres.hxx>
77#include <docufld.hxx>
78#include <flddat.hxx>
79#include <docfld.hxx>
80#include <ndtxt.hxx>
81#include <expfld.hxx>
82#include <poolfmt.hxx>
83#include <docsh.hxx>
84#include <unofldmid.h>
85#include <swunohelper.hxx>
86#include <strings.hrc>
87
88#include <editeng/outlobj.hxx>
89#include <calbck.hxx>
90#include <hints.hxx>
91
92#define URL_DECODE INetURLObject::DecodeMechanism::Unambiguous
93
94using namespace ::com::sun::star;
95using namespace ::com::sun::star::uno;
96using namespace nsSwDocInfoSubType;
97
100 m_nNumberingType( SVX_NUM_ARABIC ),
101 m_bVirtual( false )
102{
103}
104
105OUString SwPageNumberFieldType::Expand( SvxNumType nFormat, short nOff,
106 sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage,
107 const OUString& rUserStr, LanguageType nLang ) const
108{
109 SvxNumType nTmpFormat = (SVX_NUM_PAGEDESC == nFormat) ? m_nNumberingType : nFormat;
110 int const nTmp = nPageNumber + nOff;
111
112 if (0 > nTmp || SVX_NUM_NUMBER_NONE == nTmpFormat || (!m_bVirtual && nTmp > nMaxPage))
113 return OUString();
114
115 if( SVX_NUM_CHAR_SPECIAL == nTmpFormat )
116 return rUserStr;
117
118 return FormatNumber( nTmp, nTmpFormat, nLang );
119}
120
121std::unique_ptr<SwFieldType> SwPageNumberFieldType::Copy() const
122{
123 std::unique_ptr<SwPageNumberFieldType> pTmp(new SwPageNumberFieldType());
124
125 pTmp->m_nNumberingType = m_nNumberingType;
126 pTmp->m_bVirtual = m_bVirtual;
127
128 return pTmp;
129}
130
132 bool bVirt,
133 const SvxNumType* pNumFormat )
134{
135 if( pNumFormat )
136 m_nNumberingType = *pNumFormat;
137
138 m_bVirtual = false;
139 if (!(bVirt && pDoc))
140 return;
141
142 // check the flag since the layout NEVER sets it back
143 const SfxItemPool &rPool = pDoc->GetAttrPool();
144 for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(RES_PAGEDESC))
145 {
146 auto pDesc = dynamic_cast<const SwFormatPageDesc*>(pItem);
147 if( pDesc && pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
148 {
149 const SwContentNode* pNd = dynamic_cast<const SwContentNode*>( pDesc->GetDefinedIn() );
150 if( pNd )
151 {
153 // sw_redlinehide: not sure if this should happen only if
154 // it's the first node, because that's where RES_PAGEDESC
155 // is effective?
156 m_bVirtual = true;
157 }
158 else if( dynamic_cast< const SwFormat* >(pDesc->GetDefinedIn()) != nullptr)
159 {
160 SwAutoFormatGetDocNode aGetHt( &pDoc->GetNodes() );
161 m_bVirtual = !pDesc->GetDefinedIn()->GetInfo( aGetHt );
162 break;
163 }
164 }
165 }
166}
167
169 sal_uInt16 nSub, sal_uInt32 nFormat, short nOff,
170 sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage)
171 : SwField(pTyp, nFormat), m_nSubType(nSub), m_nOffset(nOff)
172 , m_nPageNumber(nPageNumber)
173 , m_nMaxPage(nMaxPage)
174{
175}
176
177void SwPageNumberField::ChangeExpansion(sal_uInt16 const nPageNumber,
178 sal_uInt16 const nMaxPage)
179{
180 m_nPageNumber = nPageNumber;
181 m_nMaxPage = nMaxPage;
182}
183
185{
186 OUString sRet;
187 SwPageNumberFieldType* pFieldType = static_cast<SwPageNumberFieldType*>(GetTyp());
188
189 if( PG_NEXT == m_nSubType && 1 != m_nOffset )
190 {
191 sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), 1, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
192 if (!sRet.isEmpty())
193 {
194 sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), m_nOffset, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
195 }
196 }
197 else if( PG_PREV == m_nSubType && -1 != m_nOffset )
198 {
199 sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), -1, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
200 if (!sRet.isEmpty())
201 {
202 sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), m_nOffset, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
203 }
204 }
205 else
206 sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), m_nOffset, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
207 return sRet;
208}
209
210std::unique_ptr<SwField> SwPageNumberField::Copy() const
211{
212 std::unique_ptr<SwPageNumberField> pTmp(new SwPageNumberField(
213 static_cast<SwPageNumberFieldType*>(GetTyp()), m_nSubType,
215 pTmp->SetLanguage( GetLanguage() );
216 pTmp->SetUserString( m_sUserStr );
217 return std::unique_ptr<SwField>(pTmp.release());
218}
219
221{
222 return OUString::number(m_nOffset);
223}
224
225void SwPageNumberField::SetPar2(const OUString& rStr)
226{
227 m_nOffset = static_cast<short>(rStr.toInt32());
228}
229
231{
232 return m_nSubType;
233}
234
235bool SwPageNumberField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
236{
237 switch( nWhichId )
238 {
240 rAny <<= static_cast<sal_Int16>(GetFormat());
241 break;
243 rAny <<= m_nOffset;
244 break;
246 {
247 text::PageNumberType eType;
248 eType = text::PageNumberType_CURRENT;
249 if(m_nSubType == PG_PREV)
250 eType = text::PageNumberType_PREV;
251 else if(m_nSubType == PG_NEXT)
252 eType = text::PageNumberType_NEXT;
253 rAny <<= eType;
254 }
255 break;
256 case FIELD_PROP_PAR1:
257 rAny <<= m_sUserStr;
258 break;
259
260 default:
261 assert(false);
262 }
263 return true;
264}
265
266bool SwPageNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
267{
268 bool bRet = true;
269 sal_Int16 nSet = 0;
270 switch( nWhichId )
271 {
273 rAny >>= nSet;
274
275 // TODO: where do the defines come from?
276 if(nSet <= SVX_NUM_PAGEDESC )
277 SetFormat(nSet);
278 break;
280 rAny >>= nSet;
281 m_nOffset = nSet;
282 break;
284 switch( static_cast<text::PageNumberType>(SWUnoHelper::GetEnumAsInt32( rAny )) )
285 {
286 case text::PageNumberType_CURRENT:
288 break;
289 case text::PageNumberType_PREV:
291 break;
292 case text::PageNumberType_NEXT:
294 break;
295 default:
296 bRet = false;
297 }
298 break;
299 case FIELD_PROP_PAR1:
300 rAny >>= m_sUserStr;
301 break;
302
303 default:
304 assert(false);
305 }
306 return bRet;
307}
308
311{
312}
313
315{
316 SvtUserOptions& rOpt = SW_MOD()->GetUserOptions();
317 if((nFormat & 0xff) == AF_NAME)
318 {
319 // Prefer the view's redline author name.
320 // (set in SwXTextDocument::initializeForTiledRendering)
321 std::size_t nAuthor = SW_MOD()->GetRedlineAuthor();
322 OUString sAuthor = SW_MOD()->GetRedlineAuthor(nAuthor);
323 if (sAuthor.isEmpty())
324 return rOpt.GetFullName();
325
326 return sAuthor;
327 }
328
329 return rOpt.GetID();
330}
331
332std::unique_ptr<SwFieldType> SwAuthorFieldType::Copy() const
333{
334 return std::make_unique<SwAuthorFieldType>();
335}
336
338 : SwField(pTyp, nFormat)
339{
341}
342
343OUString SwAuthorField::ExpandImpl(SwRootFrame const*const) const
344{
345 if (!IsFixed())
346 const_cast<SwAuthorField*>(this)->m_aContent =
348
349 return m_aContent;
350}
351
352std::unique_ptr<SwField> SwAuthorField::Copy() const
353{
354 std::unique_ptr<SwAuthorField> pTmp(new SwAuthorField( static_cast<SwAuthorFieldType*>(GetTyp()),
355 GetFormat()));
356 pTmp->SetExpansion(m_aContent);
357 return std::unique_ptr<SwField>(pTmp.release());
358}
359
360bool SwAuthorField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
361{
362 switch( nWhichId )
363 {
364 case FIELD_PROP_BOOL1:
365 rAny <<= (GetFormat() & 0xff) == AF_NAME;
366 break;
367
368 case FIELD_PROP_BOOL2:
369 rAny <<= IsFixed();
370 break;
371
372 case FIELD_PROP_PAR1:
373 rAny <<= m_aContent;
374 break;
375
376 case FIELD_PROP_TITLE:
377 break;
378
379 default:
380 assert(false);
381 }
382 return true;
383}
384
385bool SwAuthorField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
386{
387 switch( nWhichId )
388 {
389 case FIELD_PROP_BOOL1:
390 SetFormat( *o3tl::doAccess<bool>(rAny) ? AF_NAME : AF_SHORTCUT );
391 break;
392
393 case FIELD_PROP_BOOL2:
394 if( *o3tl::doAccess<bool>(rAny) )
396 else
398 break;
399
400 case FIELD_PROP_PAR1:
401 rAny >>= m_aContent;
402 break;
403
404 case FIELD_PROP_TITLE:
405 break;
406
407 default:
408 assert(false);
409 }
410 return true;
411}
412
415 , m_rDoc(rDocument)
416{
417}
418
420{
421 OUString aRet;
422 const SwDocShell* pDShell = m_rDoc.GetDocShell();
423 if( pDShell && pDShell->HasName() )
424 {
425 const INetURLObject& rURLObj = pDShell->GetMedium()->GetURLObject();
426 switch( nFormat & ~FF_FIXED )
427 {
428 case FF_PATH:
429 {
430 if( INetProtocol::File == rURLObj.GetProtocol() )
431 {
432 INetURLObject aTemp(rURLObj);
433 aTemp.removeSegment();
434 // last slash should belong to the pathname
435 aRet = aTemp.PathToFileName();
436 }
437 else
438 {
442 const sal_Int32 nPos = aRet.indexOf(rURLObj.GetLastName( URL_DECODE ));
443 if (nPos>=0)
444 {
445 aRet = aRet.copy(0, nPos);
446 }
447 }
448 }
449 break;
450
451 case FF_NAME:
453 break;
454
455 case FF_NAME_NOEXT:
456 aRet = rURLObj.GetBase();
457 break;
458
459 default:
460 if( INetProtocol::File == rURLObj.GetProtocol() )
461 aRet = rURLObj.GetFull();
462 else
466 }
467 }
468 return aRet;
469}
470
471std::unique_ptr<SwFieldType> SwFileNameFieldType::Copy() const
472{
473 return std::make_unique<SwFileNameFieldType>(m_rDoc);
474}
475
477 : SwField(pTyp, nFormat)
478{
480}
481
482OUString SwFileNameField::ExpandImpl(SwRootFrame const*const) const
483{
484 if (!IsFixed())
485 const_cast<SwFileNameField*>(this)->m_aContent = static_cast<SwFileNameFieldType*>(GetTyp())->Expand(GetFormat());
486
487 return m_aContent;
488}
489
490std::unique_ptr<SwField> SwFileNameField::Copy() const
491{
492 std::unique_ptr<SwFileNameField> pTmp(
493 new SwFileNameField(static_cast<SwFileNameFieldType*>(GetTyp()), GetFormat()));
494 pTmp->SetExpansion(m_aContent);
495
496 return std::unique_ptr<SwField>(pTmp.release());
497}
498
499bool SwFileNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
500{
501 switch( nWhichId )
502 {
504 {
505 sal_Int16 nRet;
506 switch( GetFormat() &(~FF_FIXED) )
507 {
508 case FF_PATH:
509 nRet = text::FilenameDisplayFormat::PATH;
510 break;
511 case FF_NAME_NOEXT:
513 break;
514 case FF_NAME:
515 nRet = text::FilenameDisplayFormat::NAME_AND_EXT;
516 break;
517 default: nRet = text::FilenameDisplayFormat::FULL;
518 }
519 rAny <<= nRet;
520 }
521 break;
522
523 case FIELD_PROP_BOOL2:
524 rAny <<= IsFixed();
525 break;
526
527 case FIELD_PROP_PAR3:
528 rAny <<= m_aContent;
529 break;
530
531 default:
532 assert(false);
533 }
534 return true;
535}
536
537bool SwFileNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
538{
539 switch( nWhichId )
540 {
542 {
543 //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
544 // called with a int32 value! But normally we need
545 // here only a int16
546 sal_Int32 nType = 0;
547 rAny >>= nType;
548 bool bFixed = IsFixed();
549 switch( nType )
550 {
551 case text::FilenameDisplayFormat::PATH:
552 nType = FF_PATH;
553 break;
556 break;
557 case text::FilenameDisplayFormat::NAME_AND_EXT:
558 nType = FF_NAME;
559 break;
560 default: nType = FF_PATHNAME;
561 }
562 if(bFixed)
563 nType |= FF_FIXED;
565 }
566 break;
567
568 case FIELD_PROP_BOOL2:
569 if( *o3tl::doAccess<bool>(rAny) )
571 else
573 break;
574
575 case FIELD_PROP_PAR3:
576 rAny >>= m_aContent;
577 break;
578
579 default:
580 assert(false);
581 }
582 return true;
583}
584
587 , m_rDoc(rDocument)
588{
589}
590
592{
593 OSL_ENSURE( nFormat < FF_END, "Expand: no valid Format!" );
594
595 OUString aRet;
596 SwDocShell *pDocShell(m_rDoc.GetDocShell());
597 OSL_ENSURE(pDocShell, "no SwDocShell");
598 if (pDocShell) {
599 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
600 pDocShell->GetModel(), uno::UNO_QUERY_THROW);
601 uno::Reference<document::XDocumentProperties> xDocProps(
602 xDPS->getDocumentProperties());
603 OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
604
605 if( FF_UI_NAME == nFormat )
606 aRet = xDocProps->getTemplateName();
607 else if( !xDocProps->getTemplateURL().isEmpty() )
608 {
609 if( FF_UI_RANGE == nFormat )
610 {
611 // for getting region names!
613 OUString sTmp;
614 OUString sRegion;
615 aFac.GetLogicNames( xDocProps->getTemplateURL(), sRegion, sTmp );
616 aRet = sRegion;
617 }
618 else
619 {
620 INetURLObject aPathName( xDocProps->getTemplateURL() );
621 if( FF_NAME == nFormat )
622 aRet = aPathName.GetLastName(URL_DECODE);
623 else if( FF_NAME_NOEXT == nFormat )
624 aRet = aPathName.GetBase();
625 else
626 {
627 if( FF_PATH == nFormat )
628 {
629 aPathName.removeSegment();
630 aRet = aPathName.GetFull();
631 }
632 else
633 aRet = aPathName.GetFull();
634 }
635 }
636 }
637 }
638 return aRet;
639}
640
641std::unique_ptr<SwFieldType> SwTemplNameFieldType::Copy() const
642{
643 return std::make_unique<SwTemplNameFieldType>(m_rDoc);
644}
645
647 : SwField(pTyp, nFormat)
648{}
649
650OUString SwTemplNameField::ExpandImpl(SwRootFrame const*const) const
651{
652 return static_cast<SwTemplNameFieldType*>(GetTyp())->Expand(GetFormat());
653}
654
655std::unique_ptr<SwField> SwTemplNameField::Copy() const
656{
657 return std::make_unique<SwTemplNameField>(static_cast<SwTemplNameFieldType*>(GetTyp()), GetFormat());
658}
659
660bool SwTemplNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
661{
662 switch ( nWhichId )
663 {
665 {
666 sal_Int16 nRet;
667 switch( GetFormat() )
668 {
669 case FF_PATH: nRet = text::FilenameDisplayFormat::PATH; break;
671 case FF_NAME: nRet = text::FilenameDisplayFormat::NAME_AND_EXT; break;
672 case FF_UI_RANGE: nRet = text::TemplateDisplayFormat::AREA; break;
673 case FF_UI_NAME: nRet = text::TemplateDisplayFormat::TITLE; break;
674 default: nRet = text::FilenameDisplayFormat::FULL;
675
676 }
677 rAny <<= nRet;
678 }
679 break;
680
681 default:
682 assert(false);
683 }
684 return true;
685}
686
687bool SwTemplNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
688{
689 switch ( nWhichId )
690 {
692 {
693 //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
694 // called with a int32 value! But normally we need
695 // here only a int16
696 sal_Int32 nType = 0;
697 rAny >>= nType;
698 switch( nType )
699 {
700 case text::FilenameDisplayFormat::PATH:
702 break;
705 break;
706 case text::FilenameDisplayFormat::NAME_AND_EXT:
708 break;
709 case text::TemplateDisplayFormat::AREA :
711 break;
712 case text::TemplateDisplayFormat::TITLE :
714 break;
715 default: SetFormat(FF_PATHNAME);
716 }
717 }
718 break;
719
720 default:
721 assert(false);
722 }
723 return true;
724}
725
728 , m_rDoc(rDocument)
729 , m_nNumberingType(SVX_NUM_ARABIC)
730{
731}
732
733OUString SwDocStatFieldType::Expand(sal_uInt16 nSubType, SvxNumType nFormat) const
734{
735 sal_uInt32 nVal = 0;
737 switch( nSubType )
738 {
739 case DS_TBL: nVal = rDStat.nTable; break;
740 case DS_GRF: nVal = rDStat.nGrf; break;
741 case DS_OLE: nVal = rDStat.nOLE; break;
742 case DS_PARA: nVal = rDStat.nPara; break;
743 case DS_WORD: nVal = rDStat.nWord; break;
744 case DS_CHAR: nVal = rDStat.nChar; break;
745 case DS_PAGE:
747 const_cast<SwDocStat &>(rDStat).nPage = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->GetPageNum();
748 nVal = rDStat.nPage;
749 if( SVX_NUM_PAGEDESC == nFormat )
750 nFormat = m_nNumberingType;
751 break;
752 default:
753 OSL_FAIL( "SwDocStatFieldType::Expand: unknown SubType" );
754 }
755
756 if( nVal <= SHRT_MAX )
757 return FormatNumber( nVal, nFormat );
758
759 return OUString::number( nVal );
760}
761
762std::unique_ptr<SwFieldType> SwDocStatFieldType::Copy() const
763{
764 return std::make_unique<SwDocStatFieldType>(m_rDoc);
765}
766
772SwDocStatField::SwDocStatField(SwDocStatFieldType* pTyp, sal_uInt16 nSub, sal_uInt32 nFormat)
773 : SwField(pTyp, nFormat),
774 m_nSubType(nSub)
775{}
776
777OUString SwDocStatField::ExpandImpl(SwRootFrame const*const) const
778{
779 return static_cast<SwDocStatFieldType*>(GetTyp())->Expand(m_nSubType, static_cast<SvxNumType>(GetFormat()));
780}
781
782std::unique_ptr<SwField> SwDocStatField::Copy() const
783{
784 return std::make_unique<SwDocStatField>(
785 static_cast<SwDocStatFieldType*>(GetTyp()), m_nSubType, GetFormat() );
786}
787
789{
790 return m_nSubType;
791}
792
793void SwDocStatField::SetSubType(sal_uInt16 nSub)
794{
795 m_nSubType = nSub;
796}
797
799{
801 static_cast<SwDocStatFieldType*>(GetTyp())->SetNumFormat(
803}
804
805bool SwDocStatField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
806{
807 switch ( nWhichId )
808 {
810 rAny <<= static_cast<sal_Int16>(GetFormat());
811 break;
812
813 default:
814 assert(false);
815 }
816 return true;
817}
818
819bool SwDocStatField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
820{
821 bool bRet = false;
822 switch ( nWhichId )
823 {
825 {
826 sal_Int16 nSet = 0;
827 rAny >>= nSet;
828 if(nSet <= SVX_NUM_CHARS_LOWER_LETTER_N &&
829 nSet != SVX_NUM_CHAR_SPECIAL &&
830 nSet != SVX_NUM_BITMAP)
831 {
832 SetFormat(nSet);
833 bRet = true;
834 }
835 }
836 break;
837
838 default:
839 assert(false);
840 }
841 return bRet;
842}
843
844// Document info field type
845
848{
849}
850
851std::unique_ptr<SwFieldType> SwDocInfoFieldType::Copy() const
852{
853 return std::make_unique<SwDocInfoFieldType>(GetDoc());
854}
855
857 const LocaleDataWrapper **ppAppLocalData,
858 const LocaleDataWrapper **ppLocalData )
859{
860 SvtSysLocale aLocale;
861 *ppAppLocalData = &aLocale.GetLocaleData();
862 *ppLocalData = *ppAppLocalData;
863 if( nLang != (*ppLocalData)->getLanguageTag().getLanguageType() )
864 *ppLocalData = new LocaleDataWrapper(LanguageTag( nLang ));
865}
866
867OUString SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat,
868 LanguageType nLang, const OUString& rName ) const
869{
870 const LocaleDataWrapper *pAppLocalData = nullptr, *pLocalData = nullptr;
871 SwDocShell *pDocShell(GetDoc()->GetDocShell());
872 OSL_ENSURE(pDocShell, "no SwDocShell");
873 if (!pDocShell) { return OUString(); }
874
875 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
876 pDocShell->GetModel(), uno::UNO_QUERY_THROW);
877 uno::Reference<document::XDocumentProperties> xDocProps(
878 xDPS->getDocumentProperties());
879 OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
880
881 sal_uInt16 nExtSub = nSub & 0xff00;
882 nSub &= 0xff; // do not consider extended SubTypes
883
884 OUString aStr;
885 switch(nSub)
886 {
887 case DI_TITLE: aStr = xDocProps->getTitle(); break;
888 case DI_SUBJECT:aStr = xDocProps->getSubject(); break;
889 case DI_KEYS: aStr = ::comphelper::string::convertCommaSeparated(
890 xDocProps->getKeywords());
891 break;
892 case DI_COMMENT:aStr = xDocProps->getDescription(); break;
893 case DI_DOCNO: aStr = OUString::number(
894 xDocProps->getEditingCycles() );
895 break;
896 case DI_EDIT:
897 if ( !nFormat )
898 {
899 lcl_GetLocalDataWrapper( nLang, &pAppLocalData, &pLocalData );
900 sal_Int32 dur = xDocProps->getEditingDuration();
901 // If Seconds > 0 then bSec should be TRUE otherwise Seconds
902 // information will be lost if file has EditTime in Seconds format.
903 aStr = pLocalData->getTime( tools::Time(dur/3600, (dur%3600)/60, dur%60),
904 dur%60 > 0);
905 }
906 else
907 {
908 sal_Int32 dur = xDocProps->getEditingDuration();
909 double fVal = tools::Time(dur/3600, (dur%3600)/60, dur%60).GetTimeInDays();
910 aStr = ExpandValue(fVal, nFormat, nLang);
911 }
912 break;
913 case DI_CUSTOM:
914 {
915 OUString sVal;
916 try
917 {
918 uno::Any aAny;
919 uno::Reference < beans::XPropertySet > xSet(
920 xDocProps->getUserDefinedProperties(),
921 uno::UNO_QUERY_THROW);
922 aAny = xSet->getPropertyValue( rName );
923
924 uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(comphelper::getProcessComponentContext()) );
925 uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
926 aNew >>= sVal;
927 }
928 catch (uno::Exception&) {}
929 return sVal;
930 }
931
932 default:
933 {
934 OUString aName( xDocProps->getAuthor() );
935 util::DateTime uDT( xDocProps->getCreationDate() );
936 DateTime aDate(uDT);
937 if( nSub == DI_CREATE )
938 ; // that's it !!
939 else if( nSub == DI_CHANGE )
940 {
941 aName = xDocProps->getModifiedBy();
942 uDT = xDocProps->getModificationDate();
943 aDate = DateTime(uDT);
944 }
945 else if( nSub == DI_PRINT )
946 {
947 aName = xDocProps->getPrintedBy();
948 if ( !std::getenv("STABLE_FIELDS_HACK") )
949 {
950 uDT = xDocProps->getPrintDate();
951 aDate = DateTime(uDT);
952 }
953 }
954 else
955 break;
956
957 if (aDate.IsValidAndGregorian())
958 {
959 switch (nExtSub & ~DI_SUB_FIXED)
960 {
961 case DI_SUB_AUTHOR:
962 aStr = aName;
963 break;
964
965 case DI_SUB_TIME:
966 if (!nFormat)
967 {
968 lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
969 &pLocalData );
970 aStr = pLocalData->getTime( aDate,
971 false);
972 }
973 else
974 {
975 // start the number formatter
976 double fVal = SwDateTimeField::GetDateTime( *GetDoc(),
977 aDate);
978 aStr = ExpandValue(fVal, nFormat, nLang);
979 }
980 break;
981
982 case DI_SUB_DATE:
983 if (!nFormat)
984 {
985 lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
986 &pLocalData );
987 aStr = pLocalData->getDate( aDate );
988 }
989 else
990 {
991 // start the number formatter
992 double fVal = SwDateTimeField::GetDateTime( *GetDoc(),
993 aDate);
994 aStr = ExpandValue(fVal, nFormat, nLang);
995 }
996 break;
997 }
998 }
999 }
1000 break;
1001 }
1002
1003 if( pAppLocalData != pLocalData )
1004 delete pLocalData;
1005
1006 return aStr;
1007}
1008
1009// document info field
1010
1011SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFormat) :
1012 SwValueField(pTyp, nFormat), m_nSubType(nSub)
1013{
1014 m_aName = rName;
1015 m_aContent = static_cast<SwDocInfoFieldType*>(GetTyp())->Expand(m_nSubType, nFormat, GetLanguage(), m_aName);
1016}
1017
1018SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFormat) :
1019 SwValueField(pTyp, nFormat), m_nSubType(nSub)
1020{
1021 m_aName = rName;
1022 m_aContent = rValue;
1023}
1024
1025template<class T>
1026static double lcl_TimeToDouble( const T& rTime )
1027{
1028 const double fNanoSecondsPerDay = 86400000000000.0;
1029 return ( (rTime.Hours * SAL_CONST_INT64(3600000000000))
1030 + (rTime.Minutes * SAL_CONST_INT64( 60000000000))
1031 + (rTime.Seconds * SAL_CONST_INT64( 1000000000))
1032 + (rTime.NanoSeconds))
1033 / fNanoSecondsPerDay;
1034}
1035
1036template<class D>
1037static double lcl_DateToDouble( const D& rDate, const Date& rNullDate )
1038{
1039 tools::Long nDate = Date::DateToDays( rDate.Day, rDate.Month, rDate.Year );
1040 tools::Long nNullDate = Date::DateToDays( rNullDate.GetDay(), rNullDate.GetMonth(), rNullDate.GetYear() );
1041 return double( nDate - nNullDate );
1042}
1043
1044OUString SwDocInfoField::ExpandImpl(SwRootFrame const*const) const
1045{
1046 if ( ( m_nSubType & 0xFF ) == DI_CUSTOM )
1047 {
1048 // custom properties currently need special treatment
1049 // We don't have a secure way to detect "real" custom properties in Word import of text
1050 // fields, so we treat *every* unknown property as a custom property, even the "built-in"
1051 // section in Word's document summary information stream as these properties have not been
1052 // inserted when the document summary information was imported, we do it here.
1053 // This approach is still a lot better than the old one to import such fields as
1054 // "user fields" and simple text
1055 SwDocShell* pDocShell = GetDoc()->GetDocShell();
1056 if( !pDocShell )
1057 return m_aContent;
1058 try
1059 {
1060 uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW);
1061 uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties());
1062 uno::Reference < beans::XPropertySet > xSet( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
1063 uno::Reference < beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
1064
1065 uno::Any aAny;
1066 if( xSetInfo->hasPropertyByName( m_aName ) )
1067 aAny = xSet->getPropertyValue( m_aName );
1068 if ( aAny.getValueType() != cppu::UnoType<void>::get() )
1069 {
1070 // "void" type means that the property has not been inserted until now
1071 if ( !IsFixed() )
1072 {
1073 // if the field is "fixed" we don't update it from the property
1074 OUString sVal;
1075 uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(comphelper::getProcessComponentContext()) );
1076 util::Date aDate;
1077 util::DateTime aDateTime;
1078 util::Duration aDuration;
1079 if( aAny >>= aDate)
1080 {
1081 SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter();
1082 const Date& rNullDate = pFormatter->GetNullDate();
1083 sVal = ExpandValue( lcl_DateToDouble<util::Date>( aDate, rNullDate ), GetFormat(), GetLanguage());
1084 }
1085 else if( aAny >>= aDateTime )
1086 {
1087 double fDateTime = lcl_TimeToDouble<util::DateTime>( aDateTime );
1088 SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter();
1089 const Date& rNullDate = pFormatter->GetNullDate();
1090 fDateTime += lcl_DateToDouble<util::DateTime>( aDateTime, rNullDate );
1091 sVal = ExpandValue( fDateTime, GetFormat(), GetLanguage());
1092 }
1093 else if( aAny >>= aDuration )
1094 {
1095 sVal = OUStringChar(aDuration.Negative ? '-' : '+')
1097 sVal = sVal.replaceFirst("%1", OUString::number( aDuration.Years ) );
1098 sVal = sVal.replaceFirst("%2", OUString::number( aDuration.Months ) );
1099 sVal = sVal.replaceFirst("%3", OUString::number( aDuration.Days ) );
1100 sVal = sVal.replaceFirst("%4", OUString::number( aDuration.Hours ) );
1101 sVal = sVal.replaceFirst("%5", OUString::number( aDuration.Minutes) );
1102 sVal = sVal.replaceFirst("%6", OUString::number( aDuration.Seconds) );
1103 }
1104 else
1105 {
1106 uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
1107 aNew >>= sVal;
1108 }
1109 const_cast<SwDocInfoField*>(this)->m_aContent = sVal;
1110 }
1111 }
1112 }
1113 catch (uno::Exception&) {}
1114 }
1115 else if ( !IsFixed() )
1116 const_cast<SwDocInfoField*>(this)->m_aContent = static_cast<SwDocInfoFieldType*>(GetTyp())->Expand(m_nSubType, GetFormat(), GetLanguage(), m_aName);
1117
1118 return m_aContent;
1119}
1120
1122{
1123 OUString aStr(SwFieldType::GetTypeStr(GetTypeId()) + ":");
1124
1125 sal_uInt16 const nSub = m_nSubType & 0xff;
1126
1127 switch (nSub)
1128 {
1129 case DI_CUSTOM:
1130 aStr += m_aName;
1131 break;
1132
1133 default:
1135 ->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ];
1136 break;
1137 }
1138 if (IsFixed())
1139 {
1141 }
1142 return aStr;
1143}
1144
1145std::unique_ptr<SwField> SwDocInfoField::Copy() const
1146{
1147 std::unique_ptr<SwDocInfoField> pField(new SwDocInfoField(static_cast<SwDocInfoFieldType*>(GetTyp()), m_nSubType, m_aName, GetFormat()));
1148 pField->SetAutomaticLanguage(IsAutomaticLanguage());
1149 pField->m_aContent = m_aContent;
1150
1151 return std::unique_ptr<SwField>(pField.release());
1152}
1153
1155{
1156 return m_nSubType;
1157}
1158
1159void SwDocInfoField::SetSubType(sal_uInt16 nSub)
1160{
1161 m_nSubType = nSub;
1162}
1163
1165{
1166 if (!GetFormat())
1168 else
1170}
1171
1172bool SwDocInfoField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
1173{
1174 switch( nWhichId )
1175 {
1176 case FIELD_PROP_PAR1:
1177 rAny <<= m_aContent;
1178 break;
1179
1180 case FIELD_PROP_PAR4:
1181 rAny <<= m_aName;
1182 break;
1183
1184 case FIELD_PROP_USHORT1:
1185 rAny <<= static_cast<sal_Int16>(m_aContent.toInt32());
1186 break;
1187
1188 case FIELD_PROP_BOOL1:
1189 rAny <<= 0 != (m_nSubType & DI_SUB_FIXED);
1190 break;
1191
1192 case FIELD_PROP_FORMAT:
1193 rAny <<= static_cast<sal_Int32>(GetFormat());
1194 break;
1195
1196 case FIELD_PROP_DOUBLE:
1197 {
1198 double fVal = GetValue();
1199 rAny <<= fVal;
1200 }
1201 break;
1202 case FIELD_PROP_PAR3:
1203 rAny <<= ExpandImpl(nullptr);
1204 break;
1205 case FIELD_PROP_BOOL2:
1206 {
1207 sal_uInt16 nExtSub = (m_nSubType & 0xff00) & ~DI_SUB_FIXED;
1208 rAny <<= nExtSub == DI_SUB_DATE;
1209 }
1210 break;
1211 default:
1212 return SwField::QueryValue(rAny, nWhichId);
1213 }
1214 return true;
1215}
1216
1217bool SwDocInfoField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
1218{
1219 sal_Int32 nValue = 0;
1220 switch( nWhichId )
1221 {
1222 case FIELD_PROP_PAR1:
1223 if( m_nSubType & DI_SUB_FIXED )
1224 rAny >>= m_aContent;
1225 break;
1226
1227 case FIELD_PROP_USHORT1:
1228 if( m_nSubType & DI_SUB_FIXED )
1229 {
1230 rAny >>= nValue;
1231 m_aContent = OUString::number(nValue);
1232 }
1233 break;
1234
1235 case FIELD_PROP_BOOL1:
1236 if(*o3tl::doAccess<bool>(rAny))
1238 else
1239 m_nSubType &= ~DI_SUB_FIXED;
1240 break;
1241 case FIELD_PROP_FORMAT:
1242 {
1243 rAny >>= nValue;
1244 if( nValue >= 0)
1246 }
1247 break;
1248
1249 case FIELD_PROP_PAR3:
1250 rAny >>= m_aContent;
1251 break;
1252 case FIELD_PROP_BOOL2:
1253 m_nSubType &= 0xf0ff;
1254 if(*o3tl::doAccess<bool>(rAny))
1256 else
1258 break;
1259 default:
1260 return SwField::PutValue(rAny, nWhichId);
1261 }
1262 return true;
1263}
1264
1266 : SwFieldType( SwFieldIds::HiddenText ), m_bHidden( bSetHidden )
1267{
1268}
1269
1270std::unique_ptr<SwFieldType> SwHiddenTextFieldType::Copy() const
1271{
1272 return std::make_unique<SwHiddenTextFieldType>( m_bHidden );
1273}
1274
1276{
1277 if( m_bHidden != bSetHidden )
1278 {
1279 m_bHidden = bSetHidden;
1280 UpdateFields(); // notify all HiddenTexts
1281 }
1282}
1283
1285 bool bConditional,
1286 OUString aCond,
1287 const OUString& rStr,
1288 bool bHidden,
1289 SwFieldTypesEnum nSub) :
1290 SwField( pFieldType ), m_aCond(std::move(aCond)), m_nSubType(nSub),
1291 m_bCanToggle(bConditional), m_bIsHidden(bHidden), m_bValid(false)
1292{
1294 {
1295 sal_Int32 nPos = 0;
1296 m_aTRUEText = rStr.getToken(0, '|', nPos);
1297
1298 if(nPos != -1)
1299 {
1300 m_aFALSEText = rStr.getToken(0, '|', nPos);
1301 if(nPos != -1)
1302 {
1303 m_aContent = rStr.getToken(0, '|', nPos);
1304 m_bValid = true;
1305 }
1306 }
1307 }
1308 else
1309 m_aTRUEText = rStr;
1310}
1311
1313 OUString aCond,
1314 OUString aTrue,
1315 OUString aFalse,
1316 SwFieldTypesEnum nSub)
1317 : SwField( pFieldType ), m_aTRUEText(std::move(aTrue)), m_aFALSEText(std::move(aFalse)), m_aCond(std::move(aCond)), m_nSubType(nSub),
1318 m_bIsHidden(true), m_bValid(false)
1319{
1320 m_bCanToggle = !m_aCond.isEmpty();
1321}
1322
1324{
1325 // Type: !Hidden -> show always
1326 // Hide -> evaluate condition
1327
1329 {
1330 if( m_bValid )
1331 return m_aContent;
1332
1333 if( m_bCanToggle && !m_bIsHidden )
1334 return m_aTRUEText;
1335 }
1336 else if( !static_cast<SwHiddenTextFieldType*>(GetTyp())->GetHiddenFlag() ||
1338 return m_aTRUEText;
1339
1340 return m_aFALSEText;
1341}
1342
1345{
1347 return;
1348
1349#if !HAVE_FEATURE_DBCONNECTIVITY || ENABLE_FUZZERS
1350 (void) rDoc;
1351#else
1352 SwDBManager* pMgr = rDoc.GetDBManager();
1353#endif
1354 m_bValid = false;
1355 OUString sTmpName = (m_bCanToggle && !m_bIsHidden) ? m_aTRUEText : m_aFALSEText;
1356
1357 // Database expressions need to be different from normal text. Therefore, normal text is set
1358 // in quotes. If the latter exist they will be removed. If not, check if potential DB name.
1359 // Only if there are two or more dots and no quotes, we assume a database.
1360 if (sTmpName.getLength()>1 &&
1361 sTmpName.startsWith("\"") &&
1362 sTmpName.endsWith("\""))
1363 {
1364 m_aContent = sTmpName.copy(1, sTmpName.getLength() - 2);
1365 m_bValid = true;
1366 }
1367 else if(sTmpName.indexOf('\"')<0 &&
1368 comphelper::string::getTokenCount(sTmpName, '.') > 2)
1369 {
1370 sTmpName = ::ReplacePoint(sTmpName);
1371 if(sTmpName.startsWith("[") && sTmpName.endsWith("]"))
1372 { // remove brackets
1373 sTmpName = sTmpName.copy(1, sTmpName.getLength() - 2);
1374 }
1375#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1376 if( pMgr)
1377 {
1378 sal_Int32 nIdx{ 0 };
1379 OUString sDBName( GetDBName( sTmpName, rDoc ));
1380 OUString sDataSource(sDBName.getToken(0, DB_DELIM, nIdx));
1381 OUString sDataTableOrQuery(sDBName.getToken(0, DB_DELIM, nIdx));
1382 if( pMgr->IsInMerge() && !sDBName.isEmpty() &&
1383 pMgr->IsDataSourceOpen( sDataSource,
1384 sDataTableOrQuery, false))
1385 {
1386 double fNumber;
1387 pMgr->GetMergeColumnCnt(GetColumnName( sTmpName ),
1388 GetLanguage(), m_aContent, &fNumber );
1389 m_bValid = true;
1390 }
1391 else if( !sDBName.isEmpty() && !sDataSource.isEmpty() &&
1392 !sDataTableOrQuery.isEmpty() )
1393 m_bValid = true;
1394 }
1395#endif
1396 }
1397}
1398
1400{
1402 " " + m_aCond + " " + m_aTRUEText;
1403
1405 {
1406 aStr += " : " + m_aFALSEText;
1407 }
1408 return aStr;
1409}
1410
1411std::unique_ptr<SwField> SwHiddenTextField::Copy() const
1412{
1413 std::unique_ptr<SwHiddenTextField> pField(
1416 pField->m_bIsHidden = m_bIsHidden;
1417 pField->m_bValid = m_bValid;
1418 pField->m_aContent = m_aContent;
1419 pField->SetFormat(GetFormat());
1420 pField->m_nSubType = m_nSubType;
1421 return std::unique_ptr<SwField>(pField.release());
1422}
1423
1425void SwHiddenTextField::SetPar1(const OUString& rStr)
1426{
1427 m_aCond = rStr;
1428 m_bCanToggle = !m_aCond.isEmpty();
1429}
1430
1432{
1433 return m_aCond;
1434}
1435
1437void SwHiddenTextField::SetPar2(const OUString& rStr)
1438{
1440 {
1441 sal_Int32 nPos = rStr.indexOf('|');
1442 if (nPos == -1)
1443 m_aTRUEText = rStr;
1444 else
1445 {
1446 m_aTRUEText = rStr.copy(0, nPos);
1447 m_aFALSEText = rStr.copy(nPos + 1);
1448 }
1449 }
1450 else
1451 m_aTRUEText = rStr;
1452}
1453
1456{
1458 {
1459 return m_aTRUEText;
1460 }
1461 return m_aTRUEText + "|" + m_aFALSEText;
1462}
1463
1465{
1466 return static_cast<sal_uInt16>(m_nSubType);
1467}
1468
1469bool SwHiddenTextField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
1470{
1471 switch( nWhichId )
1472 {
1473 case FIELD_PROP_PAR1:
1474 rAny <<= m_aCond;
1475 break;
1476 case FIELD_PROP_PAR2:
1477 rAny <<= m_aTRUEText;
1478 break;
1479 case FIELD_PROP_PAR3:
1480 rAny <<= m_aFALSEText;
1481 break;
1482 case FIELD_PROP_PAR4 :
1483 rAny <<= m_aContent;
1484 break;
1485 case FIELD_PROP_BOOL1:
1486 rAny <<= m_bIsHidden;
1487 break;
1488 default:
1489 assert(false);
1490 }
1491 return true;
1492}
1493
1494bool SwHiddenTextField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
1495{
1496 switch( nWhichId )
1497 {
1498 case FIELD_PROP_PAR1:
1499 {
1500 OUString sVal;
1501 rAny >>= sVal;
1502 SetPar1(sVal);
1503 }
1504 break;
1505 case FIELD_PROP_PAR2:
1506 rAny >>= m_aTRUEText;
1507 break;
1508 case FIELD_PROP_PAR3:
1509 rAny >>= m_aFALSEText;
1510 break;
1511 case FIELD_PROP_BOOL1:
1512 m_bIsHidden = *o3tl::doAccess<bool>(rAny);
1513 break;
1514 case FIELD_PROP_PAR4:
1515 rAny >>= m_aContent;
1516 m_bValid = true;
1517 break;
1518 default:
1519 assert(false);
1520 }
1521 return true;
1522}
1523
1524OUString SwHiddenTextField::GetColumnName(const OUString& rName)
1525{
1526 sal_Int32 nPos = rName.indexOf(DB_DELIM);
1527 if( nPos>=0 )
1528 {
1529 nPos = rName.indexOf(DB_DELIM, nPos + 1);
1530
1531 if( nPos>=0 )
1532 return rName.copy(nPos + 1);
1533 }
1534 return rName;
1535}
1536
1537OUString SwHiddenTextField::GetDBName(std::u16string_view rName, SwDoc& rDoc)
1538{
1539 size_t nPos = rName.find(DB_DELIM);
1540 if( nPos != std::u16string_view::npos )
1541 {
1542 nPos = rName.find(DB_DELIM, nPos + 1);
1543
1544 if( nPos != std::u16string_view::npos )
1545 return OUString(rName.substr(0, nPos));
1546 }
1547
1548 SwDBData aData = rDoc.GetDBData();
1549 return aData.sDataSource + OUStringChar(DB_DELIM) + aData.sCommand;
1550}
1551
1552// [aFieldDefinition] value sample : " IF A == B \"TrueText\" \"FalseText\""
1553void SwHiddenTextField::ParseIfFieldDefinition(std::u16string_view aFieldDefinition,
1554 OUString& rCondition,
1555 OUString& rTrue,
1556 OUString& rFalse)
1557{
1558 // get all positions inside the input string where words are started
1559 //
1560 // In: " IF A == B \"TrueText\" \"FalseText\""
1561 // 0 1 2 3
1562 // 01234567890 123456789 01 2345678901 2
1563 //
1564 // result:
1565 // [1, 4, 6, 9, 11, 22]
1566 std::vector<sal_Int32> wordPosition;
1567 {
1568 bool quoted = false;
1569 bool insideWord = false;
1570 for (size_t i = 0; i < aFieldDefinition.size(); i++)
1571 {
1572 if (quoted)
1573 {
1574 if (aFieldDefinition[i] == '\"')
1575 {
1576 quoted = false;
1577 insideWord = false;
1578 }
1579 }
1580 else
1581 {
1582 if (aFieldDefinition[i] == ' ')
1583 {
1584 // word delimiter
1585 insideWord = false;
1586 }
1587 else
1588 {
1589 if (insideWord)
1590 {
1591 quoted = (aFieldDefinition[i] == '\"');
1592 }
1593 else
1594 {
1595 insideWord = true;
1596 wordPosition.push_back(i);
1597 quoted = (aFieldDefinition[i] == '\"');
1598 }
1599 }
1600 }
1601 }
1602 }
1603
1604 // first word is always "IF"
1605 // last two words are: true-case and false-case,
1606 // everything before is treated as condition expression
1607 // => we need at least 4 words to be inside the input string
1608 if (wordPosition.size() < 4)
1609 {
1610 return;
1611 }
1612
1613
1614 const sal_Int32 conditionBegin = wordPosition[1];
1615 const sal_Int32 trueBegin = wordPosition[wordPosition.size() - 2];
1616 const sal_Int32 falseBegin = wordPosition[wordPosition.size() - 1];
1617
1618 const sal_Int32 conditionLength = trueBegin - conditionBegin;
1619 const sal_Int32 trueLength = falseBegin - trueBegin;
1620
1621 // Syntax
1622 // OUString::copy( sal_Int32 beginIndex, sal_Int32 count )
1623 rCondition = o3tl::trim(aFieldDefinition.substr(conditionBegin, conditionLength));
1624 rTrue = o3tl::trim(aFieldDefinition.substr(trueBegin, trueLength));
1625 rFalse = o3tl::trim(aFieldDefinition.substr(falseBegin));
1626
1627 // remove quotes
1628 if (rCondition.getLength() >= 2)
1629 {
1630 if (rCondition[0] == '\"' && rCondition[rCondition.getLength() - 1] == '\"')
1631 rCondition = rCondition.copy(1, rCondition.getLength() - 2);
1632 }
1633 if (rTrue.getLength() >= 2)
1634 {
1635 if (rTrue[0] == '\"' && rTrue[rTrue.getLength() - 1] == '\"')
1636 rTrue = rTrue.copy(1, rTrue.getLength() - 2);
1637 }
1638 if (rFalse.getLength() >= 2)
1639 {
1640 if (rFalse[0] == '\"' && rFalse[rFalse.getLength() - 1] == '\"')
1641 rFalse = rFalse.copy(1, rFalse.getLength() - 2);
1642 }
1643
1644 // Note: do not make trim once again, while this is a user defined data
1645}
1646
1647// field type for line height 0
1648
1651{
1652}
1653
1654std::unique_ptr<SwFieldType> SwHiddenParaFieldType::Copy() const
1655{
1656 return std::make_unique<SwHiddenParaFieldType>();
1657}
1658
1659// field for line height 0
1660
1662 : SwField(pTyp), m_aCond(std::move(aStr))
1663{
1664 m_bIsHidden = false;
1665}
1666
1668{
1669 return OUString();
1670}
1671
1672std::unique_ptr<SwField> SwHiddenParaField::Copy() const
1673{
1674 std::unique_ptr<SwHiddenParaField> pField(new SwHiddenParaField(static_cast<SwHiddenParaFieldType*>(GetTyp()), m_aCond));
1675 pField->m_bIsHidden = m_bIsHidden;
1676 return std::unique_ptr<SwField>(pField.release());
1677}
1678
1679bool SwHiddenParaField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
1680{
1681 switch ( nWhichId )
1682 {
1683 case FIELD_PROP_PAR1:
1684 rAny <<= m_aCond;
1685 break;
1686 case FIELD_PROP_BOOL1:
1687 rAny <<= m_bIsHidden;
1688 break;
1689
1690 default:
1691 assert(false);
1692 }
1693 return true;
1694}
1695
1696bool SwHiddenParaField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
1697{
1698 switch ( nWhichId )
1699 {
1700 case FIELD_PROP_PAR1:
1701 rAny >>= m_aCond;
1702 break;
1703 case FIELD_PROP_BOOL1:
1704 m_bIsHidden = *o3tl::doAccess<bool>(rAny);
1705 break;
1706
1707 default:
1708 assert(false);
1709 }
1710 return true;
1711}
1712
1714void SwHiddenParaField::SetPar1(const OUString& rStr)
1715{
1716 m_aCond = rStr;
1717}
1718
1720{
1721 return m_aCond;
1722}
1723
1724// PostIt field type
1725
1728 , mrDoc(rDoc)
1729{}
1730
1731std::unique_ptr<SwFieldType> SwPostItFieldType::Copy() const
1732{
1733 return std::make_unique<SwPostItFieldType>(mrDoc);
1734}
1735
1736// PostIt field
1737
1738sal_uInt32 SwPostItField::s_nLastPostItId = 1;
1739
1741 OUString aAuthor,
1742 OUString aText,
1743 OUString aInitials,
1744 OUString aName,
1745 const DateTime& rDateTime,
1746 const bool bResolved,
1747 const sal_uInt32 nPostItId,
1748 const sal_uInt32 nParentId,
1749 const sal_uInt32 nParaId
1750)
1751 : SwField( pT )
1752 , m_sText( std::move(aText) )
1753 , m_sAuthor( std::move(aAuthor) )
1754 , m_sInitials( std::move(aInitials) )
1755 , m_sName( std::move(aName) )
1756 , m_aDateTime( rDateTime )
1757 , m_bResolved( bResolved )
1758 , m_nParentId( nParentId )
1759 , m_nParaId( nParaId )
1760{
1761 m_nPostItId = nPostItId == 0 ? s_nLastPostItId++ : nPostItId;
1762}
1763
1765{
1766 if ( m_xTextObject.is() )
1767 {
1768 m_xTextObject->DisposeEditSource();
1769 }
1770
1771 mpText.reset();
1772}
1773
1774OUString SwPostItField::ExpandImpl(SwRootFrame const*const) const
1775{
1776 return OUString();
1777}
1778
1780{
1781 return SwResId(STR_NOTE);
1782}
1783
1784void SwPostItField::SetResolved(bool bNewState)
1785{
1786 m_bResolved = bNewState;
1787}
1788
1790{
1792}
1793
1795{
1796 return m_bResolved;
1797}
1798
1799std::unique_ptr<SwField> SwPostItField::Copy() const
1800{
1801 std::unique_ptr<SwPostItField> pRet(new SwPostItField( static_cast<SwPostItFieldType*>(GetTyp()), m_sAuthor, m_sText, m_sInitials, m_sName,
1803 if (mpText)
1804 pRet->SetTextObject( *mpText );
1805
1806 // Note: member <m_xTextObject> not copied.
1807
1808 return std::unique_ptr<SwField>(pRet.release());
1809}
1810
1812void SwPostItField::SetPar1(const OUString& rStr)
1813{
1814 m_sAuthor = rStr;
1815}
1816
1819{
1820 return m_sAuthor;
1821}
1822
1824void SwPostItField::SetPar2(const OUString& rStr)
1825{
1826 m_sText = rStr;
1827}
1828
1831{
1832 return m_sText;
1833}
1834
1835
1836void SwPostItField::SetName(const OUString& rName)
1837{
1838 m_sName = rName;
1839}
1840
1841
1843{
1844 mpText = std::move(pText);
1845}
1846
1848{
1849 return mpText ? mpText->Count() : 1;
1850}
1851
1852void SwPostItField::ChangeStyleSheetName(std::u16string_view rOldName, const SfxStyleSheetBase* pStyleSheet)
1853{
1854 if (mpText && pStyleSheet)
1855 mpText->ChangeStyleSheetName(pStyleSheet->GetFamily(), rOldName, pStyleSheet->GetName());
1856}
1857
1858void SwPostItField::SetPostItId(const sal_uInt32 nPostItId)
1859{
1860 m_nPostItId = nPostItId == 0 ? s_nLastPostItId++ : nPostItId;
1861}
1862
1863void SwPostItField::SetParentId(const sal_uInt32 nParentId)
1864{
1865 m_nParentId = nParentId;
1866}
1867
1868void SwPostItField::SetParaId(const sal_uInt32 nParaId)
1869{
1870 m_nParaId = nParaId;
1871}
1872
1873bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
1874{
1875 switch( nWhichId )
1876 {
1877 case FIELD_PROP_PAR1:
1878 rAny <<= m_sAuthor;
1879 break;
1880 case FIELD_PROP_PAR2:
1881 {
1882 rAny <<= m_sText;
1883 break;
1884 }
1885 case FIELD_PROP_PAR3:
1886 rAny <<= m_sInitials;
1887 break;
1888 case FIELD_PROP_PAR4:
1889 rAny <<= m_sName;
1890 break;
1891 case FIELD_PROP_BOOL1:
1892 rAny <<= m_bResolved;
1893 break;
1894 case FIELD_PROP_TEXT:
1895 {
1896 if ( !m_xTextObject.is() )
1897 {
1898 SwPostItFieldType* pGetType = static_cast<SwPostItFieldType*>(GetTyp());
1899 SwDoc& rDoc = pGetType->GetDoc();
1900 auto pObj = std::make_unique<SwTextAPIEditSource>( &rDoc );
1901 const_cast <SwPostItField*> (this)->m_xTextObject = new SwTextAPIObject( std::move(pObj) );
1902 }
1903
1904 if ( mpText )
1905 m_xTextObject->SetText( *mpText );
1906 else
1907 m_xTextObject->SetString( m_sText );
1908
1909 uno::Reference < text::XText > xText( m_xTextObject );
1910 rAny <<= xText;
1911 break;
1912 }
1913 case FIELD_PROP_DATE:
1914 {
1915 rAny <<= m_aDateTime.GetUNODate();
1916 }
1917 break;
1919 {
1920 rAny <<= m_aDateTime.GetUNODateTime();
1921 }
1922 break;
1923 case FIELD_PROP_PAR5:
1924 {
1925 rAny <<= OUString(OUString::number(m_nParentId, 16).toAsciiUpperCase());
1926 }
1927 break;
1928 case FIELD_PROP_PAR6:
1929 {
1930 rAny <<= OUString(OUString::number(m_nPostItId, 16).toAsciiUpperCase());
1931 }
1932 break;
1933 default:
1934 assert(false);
1935 }
1936 return true;
1937}
1938
1939bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
1940{
1941 switch( nWhichId )
1942 {
1943 case FIELD_PROP_PAR1:
1944 rAny >>= m_sAuthor;
1945 break;
1946 case FIELD_PROP_PAR2:
1947 rAny >>= m_sText;
1948 //#i100374# new string via api, delete complex text object so SwPostItNote picks up the new string
1949 mpText.reset();
1950 break;
1951 case FIELD_PROP_PAR3:
1952 rAny >>= m_sInitials;
1953 break;
1954 case FIELD_PROP_PAR4:
1955 rAny >>= m_sName;
1956 break;
1957 case FIELD_PROP_BOOL1:
1958 rAny >>= m_bResolved;
1959 break;
1960 case FIELD_PROP_TEXT:
1961 OSL_FAIL("Not implemented!");
1962 break;
1963 case FIELD_PROP_DATE:
1964 if( auto aSetDate = o3tl::tryAccess<util::Date>(rAny) )
1965 {
1966 m_aDateTime = Date(aSetDate->Day, aSetDate->Month, aSetDate->Year);
1967 }
1968 break;
1970 {
1971 util::DateTime aDateTimeValue;
1972 if(!(rAny >>= aDateTimeValue))
1973 return false;
1974 m_aDateTime = DateTime(aDateTimeValue);
1975 }
1976 break;
1977 case FIELD_PROP_PAR5:
1978 {
1979 OUString sTemp;
1980 rAny >>= sTemp;
1981 m_nParentId = sTemp.toInt32(16);
1982 }
1983 break;
1984 case FIELD_PROP_PAR6:
1985 {
1986 OUString sTemp;
1987 rAny >>= sTemp;
1988 m_nPostItId = sTemp.toInt32(16);
1989 }
1990 break;
1991 default:
1992 assert(false);
1993 }
1994 return true;
1995}
1996
1998{
1999 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwPostItField"));
2000 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
2001
2002 SwField::dumpAsXml(pWriter);
2003
2004 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mpText"));
2005 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", mpText ? &*mpText : nullptr);
2006 if (mpText)
2007 mpText->dumpAsXml(pWriter);
2008 (void)xmlTextWriterEndElement(pWriter);
2009
2010 (void)xmlTextWriterEndElement(pWriter);
2011}
2012
2013// extended user information field type
2014
2017{
2018}
2019
2020std::unique_ptr<SwFieldType> SwExtUserFieldType::Copy() const
2021{
2022 return std::make_unique<SwExtUserFieldType>();
2023}
2024
2025OUString SwExtUserFieldType::Expand(sal_uInt16 nSub )
2026{
2027 UserOptToken nRet = static_cast<UserOptToken>(USHRT_MAX);
2028 switch(nSub)
2029 {
2030 case EU_FIRSTNAME: nRet = UserOptToken::FirstName; break;
2031 case EU_NAME: nRet = UserOptToken::LastName; break;
2032 case EU_SHORTCUT: nRet = UserOptToken::ID; break;
2033
2034 case EU_COMPANY: nRet = UserOptToken::Company; break;
2035 case EU_STREET: nRet = UserOptToken::Street; break;
2036 case EU_TITLE: nRet = UserOptToken::Title; break;
2037 case EU_POSITION: nRet = UserOptToken::Position; break;
2038 case EU_PHONE_PRIVATE: nRet = UserOptToken::TelephoneHome; break;
2039 case EU_PHONE_COMPANY: nRet = UserOptToken::TelephoneWork; break;
2040 case EU_FAX: nRet = UserOptToken::Fax; break;
2041 case EU_EMAIL: nRet = UserOptToken::Email; break;
2042 case EU_COUNTRY: nRet = UserOptToken::Country; break;
2043 case EU_ZIP: nRet = UserOptToken::Zip; break;
2044 case EU_CITY: nRet = UserOptToken::City; break;
2045 case EU_STATE: nRet = UserOptToken::State; break;
2046 case EU_FATHERSNAME: nRet = UserOptToken::FathersName; break;
2047 case EU_APARTMENT: nRet = UserOptToken::Apartment; break;
2048 default: OSL_ENSURE( false, "Field unknown");
2049 }
2050 if( static_cast<UserOptToken>(USHRT_MAX) != nRet )
2051 {
2052 SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
2053 return rUserOpt.GetToken( nRet );
2054 }
2055 return OUString();
2056}
2057
2058// extended user information field
2059
2060SwExtUserField::SwExtUserField(SwExtUserFieldType* pTyp, sal_uInt16 nSubTyp, sal_uInt32 nFormat) :
2061 SwField(pTyp, nFormat), m_nType(nSubTyp)
2062{
2064}
2065
2066OUString SwExtUserField::ExpandImpl(SwRootFrame const*const) const
2067{
2068 if (!IsFixed())
2070
2071 return m_aContent;
2072}
2073
2074std::unique_ptr<SwField> SwExtUserField::Copy() const
2075{
2076 std::unique_ptr<SwExtUserField> pField(new SwExtUserField(static_cast<SwExtUserFieldType*>(GetTyp()), m_nType, GetFormat()));
2077 pField->SetExpansion(m_aContent);
2078
2079 return std::unique_ptr<SwField>(pField.release());
2080}
2081
2083{
2084 return m_nType;
2085}
2086
2087void SwExtUserField::SetSubType(sal_uInt16 nSub)
2088{
2089 m_nType = nSub;
2090}
2091
2092bool SwExtUserField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
2093{
2094 switch( nWhichId )
2095 {
2096 case FIELD_PROP_PAR1:
2097 rAny <<= m_aContent;
2098 break;
2099
2100 case FIELD_PROP_USHORT1:
2101 {
2102 sal_Int16 nTmp = m_nType;
2103 rAny <<= nTmp;
2104 }
2105 break;
2106 case FIELD_PROP_BOOL1:
2107 rAny <<= IsFixed();
2108 break;
2109 default:
2110 assert(false);
2111 }
2112 return true;
2113}
2114
2115bool SwExtUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
2116{
2117 switch( nWhichId )
2118 {
2119 case FIELD_PROP_PAR1:
2120 rAny >>= m_aContent;
2121 break;
2122
2123 case FIELD_PROP_USHORT1:
2124 {
2125 sal_Int16 nTmp = 0;
2126 rAny >>= nTmp;
2127 m_nType = nTmp;
2128 }
2129 break;
2130 case FIELD_PROP_BOOL1:
2131 if( *o3tl::doAccess<bool>(rAny) )
2133 else
2135 break;
2136 default:
2137 assert(false);
2138 }
2139 return true;
2140}
2141
2142// field type for relative page numbers
2143
2146{
2147}
2148
2149std::unique_ptr<SwFieldType> SwRefPageSetFieldType::Copy() const
2150{
2151 return std::make_unique<SwRefPageSetFieldType>();
2152}
2153
2154// overridden since there is nothing to update
2156{
2157}
2158
2159// field for relative page numbers
2160
2162 short nOff, bool bFlag )
2163 : SwField( pTyp ), m_nOffset( nOff ), m_bOn( bFlag )
2164{
2165}
2166
2168{
2169 return OUString();
2170}
2171
2172std::unique_ptr<SwField> SwRefPageSetField::Copy() const
2173{
2174 return std::make_unique<SwRefPageSetField>( static_cast<SwRefPageSetFieldType*>(GetTyp()), m_nOffset, m_bOn );
2175}
2176
2178{
2179 return OUString::number(GetOffset());
2180}
2181
2182void SwRefPageSetField::SetPar2(const OUString& rStr)
2183{
2184 SetOffset( static_cast<short>(rStr.toInt32()) );
2185}
2186
2187bool SwRefPageSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
2188{
2189 switch( nWhichId )
2190 {
2191 case FIELD_PROP_BOOL1:
2192 rAny <<= m_bOn;
2193 break;
2194 case FIELD_PROP_USHORT1:
2195 rAny <<= static_cast<sal_Int16>(m_nOffset);
2196 break;
2197 default:
2198 assert(false);
2199 }
2200 return true;
2201}
2202
2203bool SwRefPageSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
2204{
2205 switch( nWhichId )
2206 {
2207 case FIELD_PROP_BOOL1:
2208 m_bOn = *o3tl::doAccess<bool>(rAny);
2209 break;
2210 case FIELD_PROP_USHORT1:
2211 rAny >>=m_nOffset;
2212 break;
2213 default:
2214 assert(false);
2215 }
2216 return true;
2217}
2218
2219// relative page numbers - query field
2220
2222 : SwFieldType( SwFieldIds::RefPageGet ), m_rDoc( rDc ), m_nNumberingType( SVX_NUM_ARABIC )
2223{
2224}
2225
2226std::unique_ptr<SwFieldType> SwRefPageGetFieldType::Copy() const
2227{
2228 std::unique_ptr<SwRefPageGetFieldType> pNew(new SwRefPageGetFieldType( m_rDoc ));
2229 pNew->m_nNumberingType = m_nNumberingType;
2230 return pNew;
2231}
2232
2234{
2235 if (rHint.GetId() != SfxHintId::SwLegacyModify)
2236 return;
2237 auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
2238 auto const ModifyImpl = [this](SwRootFrame const*const pLayout)
2239 {
2240 // first collect all SetPageRefFields
2241 SetGetExpFields aTmpLst;
2242 if (MakeSetList(aTmpLst, pLayout))
2243 {
2244 std::vector<SwFormatField*> vFields;
2245 GatherFields(vFields);
2246 for(auto pFormatField: vFields)
2247 UpdateField(pFormatField->GetTextField(), aTmpLst, pLayout);
2248 }
2249 };
2250
2251 // update all GetReference fields
2252 if( !pLegacy->m_pNew && !pLegacy->m_pOld && HasWriterListeners() )
2253 {
2254 SwRootFrame const* pLayout(nullptr);
2255 SwRootFrame const* pLayoutRLHidden(nullptr);
2256 for (SwRootFrame const*const pLay : m_rDoc.GetAllLayouts())
2257 {
2258 if (pLay->IsHideRedlines())
2259 {
2260 pLayoutRLHidden = pLay;
2261 }
2262 else
2263 {
2264 pLayout = pLay;
2265 }
2266 }
2267 ModifyImpl(pLayout);
2268 if (pLayoutRLHidden)
2269 {
2270 ModifyImpl(pLayoutRLHidden);
2271 }
2272 }
2273
2274 // forward to text fields, they "expand" the text
2275 CallSwClientNotify(rHint);
2276}
2277
2279 SwRootFrame const*const pLayout)
2280{
2282 std::vector<SwFormatField*> vFields;
2284 for(auto pFormatField: vFields)
2285 {
2286 // update only the GetRef fields
2287 const SwTextField* pTField = pFormatField->GetTextField();
2288 if (!pLayout || !pLayout->IsHideRedlines() || !sw::IsFieldDeletedInModel(rIDRA, *pTField))
2289 {
2290 const SwTextNode& rTextNd = pTField->GetTextNode();
2291
2292 // Always the first! (in Tab-Headline, header/footer )
2293 Point aPt;
2294 std::pair<Point, bool> const tmp(aPt, false);
2295 const SwContentFrame *const pFrame = rTextNd.getLayoutFrame(
2296 pLayout, nullptr, &tmp);
2297
2298 std::unique_ptr<SetGetExpField> pNew;
2299
2300 if( !pFrame ||
2301 pFrame->IsInDocBody() ||
2302 // #i31868#
2303 // Check if pFrame is not yet connected to the layout.
2304 !pFrame->FindPageFrame() )
2305 {
2306 pNew.reset( new SetGetExpField( rTextNd, pTField ) );
2307 }
2308 else
2309 {
2310 // create index for determination of the TextNode
2312 bool const bResult = GetBodyTextNode( m_rDoc, aPos, *pFrame );
2313 OSL_ENSURE(bResult, "where is the Field?");
2314 pNew.reset( new SetGetExpField( aPos.GetNode(), pTField,
2315 aPos.GetContentIndex() ) );
2316 }
2317
2318 rTmpLst.insert( std::move(pNew) );
2319 }
2320 }
2321 return !rTmpLst.empty();
2322}
2323
2325 SetGetExpFields const & rSetList,
2326 SwRootFrame const*const pLayout)
2327{
2328 SwRefPageGetField* pGetField = const_cast<SwRefPageGetField*>(static_cast<const SwRefPageGetField*>(pTextField->GetFormatField().GetField()));
2329 pGetField->SetText( OUString(), pLayout );
2330
2331 // then search the correct RefPageSet field
2332 SwTextNode* pTextNode = &pTextField->GetTextNode();
2333 if( pTextNode->StartOfSectionIndex() >
2335 {
2336 SetGetExpField aEndField( *pTextNode, pTextField );
2337
2338 SetGetExpFields::const_iterator itLast = rSetList.lower_bound( &aEndField );
2339
2340 if( itLast != rSetList.begin() )
2341 {
2342 --itLast;
2343 const SwTextField* pRefTextField = (*itLast)->GetTextField();
2344 const SwRefPageSetField* pSetField =
2345 static_cast<const SwRefPageSetField*>(pRefTextField->GetFormatField().GetField());
2346 if( pSetField->IsOn() )
2347 {
2348 // determine the correct offset
2349 Point aPt;
2350 std::pair<Point, bool> const tmp(aPt, false);
2351 const SwContentFrame *const pFrame = pTextNode->getLayoutFrame(
2352 pLayout, nullptr, &tmp);
2353 const SwContentFrame *const pRefFrame = pRefTextField->GetTextNode().getLayoutFrame(
2354 pLayout, nullptr, &tmp);
2355 const SwPageFrame* pPgFrame = nullptr;
2356 short nDiff = 1;
2357 if ( pFrame && pRefFrame )
2358 {
2359 pPgFrame = pFrame->FindPageFrame();
2360 nDiff = pPgFrame->GetPhyPageNum() -
2361 pRefFrame->FindPageFrame()->GetPhyPageNum() + 1;
2362 }
2363
2364 SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == static_cast<SvxNumType>(pGetField->GetFormat())
2365 ? ( !pPgFrame
2367 : pPgFrame->GetPageDesc()->GetNumType().GetNumberingType() )
2368 : static_cast<SvxNumType>(pGetField->GetFormat());
2369 const short nPageNum = std::max<short>(0, pSetField->GetOffset() + nDiff);
2370 pGetField->SetText(FormatNumber(nPageNum, nTmpFormat), pLayout);
2371 }
2372 }
2373 }
2374 // start formatting
2375 const_cast<SwFormatField&>(pTextField->GetFormatField()).ForceUpdateTextNode();
2376}
2377
2378// queries for relative page numbering
2379
2381 sal_uInt32 nFormat )
2382 : SwField( pTyp, nFormat )
2383{
2384}
2385
2386void SwRefPageGetField::SetText(const OUString& rText,
2387 SwRootFrame const*const pLayout)
2388{
2389 if (!pLayout || !pLayout->IsHideRedlines())
2390 {
2391 m_sText = rText;
2392 }
2393 if (!pLayout || pLayout->IsHideRedlines())
2394 {
2395 m_sTextRLHidden = rText;
2396 }
2397}
2398
2399OUString SwRefPageGetField::ExpandImpl(SwRootFrame const*const pLayout) const
2400{
2401 return pLayout && pLayout->IsHideRedlines() ? m_sTextRLHidden : m_sText;
2402}
2403
2404std::unique_ptr<SwField> SwRefPageGetField::Copy() const
2405{
2406 std::unique_ptr<SwRefPageGetField> pCpy(new SwRefPageGetField(
2407 static_cast<SwRefPageGetFieldType*>(GetTyp()), GetFormat() ));
2408 pCpy->m_sText = m_sText;
2409 pCpy->m_sTextRLHidden = m_sTextRLHidden;
2410 return std::unique_ptr<SwField>(pCpy.release());
2411}
2412
2414 const SwTextField* pField )
2415{
2416 // only fields in Footer, Header, FootNote, Flys
2417 SwRefPageGetFieldType* pGetType = static_cast<SwRefPageGetFieldType*>(GetTyp());
2418 SwDoc& rDoc = pGetType->GetDoc();
2419 if( pField->GetTextNode().StartOfSectionIndex() >
2420 rDoc.GetNodes().GetEndOfExtras().GetIndex() )
2421 return;
2422
2423 SwRootFrame const& rLayout(*rFrame.getRootFrame());
2424 OUString & rText(rLayout.IsHideRedlines() ? m_sTextRLHidden : m_sText);
2425 rText.clear();
2426
2427 OSL_ENSURE(!rFrame.IsInDocBody(), "Flag incorrect, frame is in DocBody");
2428
2429 // collect all SetPageRefFields
2430 SetGetExpFields aTmpLst;
2431 if (!pGetType->MakeSetList(aTmpLst, &rLayout))
2432 return ;
2433
2434 // create index for determination of the TextNode
2435 SwPosition aPos( rDoc.GetNodes() );
2436 SwTextNode* pTextNode = const_cast<SwTextNode*>(GetBodyTextNode(rDoc, aPos, rFrame));
2437
2438 // If no layout exists, ChangeExpansion is called for header and
2439 // footer lines via layout formatting without existing TextNode.
2440 if(!pTextNode)
2441 return;
2442
2443 SetGetExpField aEndField( aPos.GetNode(), pField, aPos.GetContentIndex() );
2444
2445 SetGetExpFields::const_iterator itLast = aTmpLst.lower_bound( &aEndField );
2446
2447 if( itLast == aTmpLst.begin() )
2448 return; // there is no corresponding set-field in front
2449 --itLast;
2450
2451 const SwTextField* pRefTextField = (*itLast)->GetTextField();
2452 const SwRefPageSetField* pSetField =
2453 static_cast<const SwRefPageSetField*>(pRefTextField->GetFormatField().GetField());
2454 Point aPt;
2455 std::pair<Point, bool> const tmp(aPt, false);
2456 const SwContentFrame *const pRefFrame = pRefTextField->GetTextNode().getLayoutFrame(
2457 &rLayout, nullptr, &tmp);
2458 if( !(pSetField->IsOn() && pRefFrame) )
2459 return;
2460
2461 // determine the correct offset
2462 const SwPageFrame* pPgFrame = rFrame.FindPageFrame();
2463 const short nDiff = pPgFrame->GetPhyPageNum() -
2464 pRefFrame->FindPageFrame()->GetPhyPageNum() + 1;
2465
2466 SwRefPageGetField* pGetField = const_cast<SwRefPageGetField*>(static_cast<const SwRefPageGetField*>(pField->GetFormatField().GetField()));
2467 SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == pGetField->GetFormat()
2468 ? pPgFrame->GetPageDesc()->GetNumType().GetNumberingType()
2469 : static_cast<SvxNumType>(pGetField->GetFormat());
2470 const short nPageNum = std::max<short>(0, pSetField->GetOffset() + nDiff);
2471 pGetField->SetText(FormatNumber(nPageNum, nTmpFormat), &rLayout);
2472}
2473
2474bool SwRefPageGetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
2475{
2476 switch( nWhichId )
2477 {
2478 case FIELD_PROP_USHORT1:
2479 rAny <<= static_cast<sal_Int16>(GetFormat());
2480 break;
2481 case FIELD_PROP_PAR1:
2482 rAny <<= m_sText;
2483 break;
2484 default:
2485 assert(false);
2486 }
2487 return true;
2488}
2489
2490bool SwRefPageGetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
2491{
2492 switch( nWhichId )
2493 {
2494 case FIELD_PROP_USHORT1:
2495 {
2496 sal_Int16 nSet = 0;
2497 rAny >>= nSet;
2498 if(nSet <= SVX_NUM_PAGEDESC )
2499 SetFormat(nSet);
2500 }
2501 break;
2502 case FIELD_PROP_PAR1:
2503 rAny >>= m_sText;
2505 break;
2506 default:
2507 assert(false);
2508 }
2509 return true;
2510}
2511
2512// field type to jump to and edit
2513
2515 : SwFieldType( SwFieldIds::JumpEdit ), m_rDoc( rD ), m_aDep( *this )
2516{
2517}
2518
2519std::unique_ptr<SwFieldType> SwJumpEditFieldType::Copy() const
2520{
2521 return std::make_unique<SwJumpEditFieldType>( m_rDoc );
2522}
2523
2525{
2527 m_aDep.StartListening(pFormat);
2528 return pFormat;
2529}
2530
2532 OUString aText, OUString aHelp )
2533 : SwField( pTyp, nForm ), m_sText( std::move(aText) ), m_sHelp( std::move(aHelp) )
2534{
2535}
2536
2537OUString SwJumpEditField::ExpandImpl(SwRootFrame const*const) const
2538{
2539 return "<" + m_sText + ">";
2540}
2541
2542std::unique_ptr<SwField> SwJumpEditField::Copy() const
2543{
2544 return std::make_unique<SwJumpEditField>( static_cast<SwJumpEditFieldType*>(GetTyp()), GetFormat(),
2545 m_sText, m_sHelp );
2546}
2547
2550{
2551 return m_sText;
2552}
2553
2555void SwJumpEditField::SetPar1(const OUString& rStr)
2556{
2557 m_sText = rStr;
2558}
2559
2562{
2563 return m_sHelp;
2564}
2565
2567void SwJumpEditField::SetPar2(const OUString& rStr)
2568{
2569 m_sHelp = rStr;
2570}
2571
2572bool SwJumpEditField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
2573{
2574 switch( nWhichId )
2575 {
2576 case FIELD_PROP_USHORT1:
2577 {
2578 sal_Int16 nRet;
2579 switch( GetFormat() )
2580 {
2581 case JE_FMT_TABLE: nRet = text::PlaceholderType::TABLE; break;
2582 case JE_FMT_FRAME: nRet = text::PlaceholderType::TEXTFRAME; break;
2583 case JE_FMT_GRAPHIC:nRet = text::PlaceholderType::GRAPHIC; break;
2584 case JE_FMT_OLE: nRet = text::PlaceholderType::OBJECT; break;
2585 default:
2586 nRet = text::PlaceholderType::TEXT; break;
2587 }
2588 rAny <<= nRet;
2589 }
2590 break;
2591 case FIELD_PROP_PAR1 :
2592 rAny <<= m_sHelp;
2593 break;
2594 case FIELD_PROP_PAR2 :
2595 rAny <<= m_sText;
2596 break;
2597 default:
2598 assert(false);
2599 }
2600 return true;
2601}
2602
2603bool SwJumpEditField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
2604{
2605 switch( nWhichId )
2606 {
2607 case FIELD_PROP_USHORT1:
2608 {
2609 //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
2610 // called with a int32 value! But normally we need
2611 // here only a int16
2612 sal_Int32 nSet = 0;
2613 rAny >>= nSet;
2614 switch( nSet )
2615 {
2616 case text::PlaceholderType::TEXT : SetFormat(JE_FMT_TEXT); break;
2617 case text::PlaceholderType::TABLE : SetFormat(JE_FMT_TABLE); break;
2618 case text::PlaceholderType::TEXTFRAME: SetFormat(JE_FMT_FRAME); break;
2619 case text::PlaceholderType::GRAPHIC : SetFormat(JE_FMT_GRAPHIC); break;
2620 case text::PlaceholderType::OBJECT : SetFormat(JE_FMT_OLE); break;
2621 }
2622 }
2623 break;
2624 case FIELD_PROP_PAR1 :
2625 rAny >>= m_sHelp;
2626 break;
2627 case FIELD_PROP_PAR2 :
2628 rAny >>= m_sText;
2629 break;
2630 default:
2631 assert(false);
2632 }
2633 return true;
2634}
2635
2636// combined character field type
2637
2640{
2641}
2642
2643std::unique_ptr<SwFieldType> SwCombinedCharFieldType::Copy() const
2644{
2645 return std::make_unique<SwCombinedCharFieldType>();
2646}
2647
2648// combined character field
2649
2651 const OUString& rChars )
2652 : SwField( pFTyp, 0 ),
2653 m_sCharacters( rChars.copy( 0, std::min<sal_Int32>(rChars.getLength(), MAX_COMBINED_CHARACTERS) ))
2654{
2655}
2656
2658{
2659 return m_sCharacters;
2660}
2661
2662std::unique_ptr<SwField> SwCombinedCharField::Copy() const
2663{
2664 return std::make_unique<SwCombinedCharField>( static_cast<SwCombinedCharFieldType*>(GetTyp()),
2665 m_sCharacters );
2666}
2667
2669{
2670 return m_sCharacters;
2671}
2672
2673void SwCombinedCharField::SetPar1(const OUString& rStr)
2674{
2675 m_sCharacters = rStr.copy(0, std::min<sal_Int32>(rStr.getLength(), MAX_COMBINED_CHARACTERS));
2676}
2677
2679 sal_uInt16 nWhichId ) const
2680{
2681 switch( nWhichId )
2682 {
2683 case FIELD_PROP_PAR1:
2684 rAny <<= m_sCharacters;
2685 break;
2686 default:
2687 assert(false);
2688 }
2689 return true;
2690}
2691
2693 sal_uInt16 nWhichId )
2694{
2695 switch( nWhichId )
2696 {
2697 case FIELD_PROP_PAR1:
2698 {
2699 OUString sTmp;
2700 rAny >>= sTmp;
2701 SetPar1(sTmp);
2702 }
2703 break;
2704 default:
2705 assert(false);
2706 }
2707 return true;
2708}
2709
2710/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::util::DateTime GetUNODateTime() const
css::util::Date GetUNODate() const
bool IsValidAndGregorian() const
sal_Int16 GetYear() const
sal_uInt16 GetDay() const
static sal_Int32 DateToDays(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear)
sal_uInt16 GetMonth() const
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwDocStat & GetDocStat() const =0
Document - Statistics.
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetBase() const
OUString PathToFileName() const
INetProtocol GetProtocol() const
OUString GetFull() const
sal_Int32 Count() const
void dumpAsXml(xmlTextWriterPtr pWriter) const
void ChangeStyleSheetName(SfxStyleFamily eFamily, std::u16string_view rOldName, const OUString &rNewName)
bool GetLogicNames(std::u16string_view rPath, OUString &rRegion, OUString &rName) const
SfxHintId GetId() const
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const INetURLObject & GetURLObject() const
bool HasName() const
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
const OUString & GetName() const
SfxStyleFamily GetFamily() const
const Date & GetNullDate() const
const LocaleDataWrapper & GetLocaleData() const
OUString GetFullName() const
OUString GetID() const
OUString GetToken(UserOptToken nToken) const
SvxNumType GetNumberingType() const
static OUString Expand(sal_uLong)
Definition: docufld.cxx:314
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:332
OUString m_aContent
Definition: docufld.hxx:190
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:343
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:352
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:360
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:385
SwAuthorField(SwAuthorFieldType *, sal_uInt32 nFormat)
Definition: docufld.cxx:337
Represents the style of a text portion.
Definition: charfmt.hxx:27
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2643
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2692
virtual void SetPar1(const OUString &rStr) override
Definition: docufld.cxx:2673
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2662
OUString m_sCharacters
combine these characters
Definition: docufld.hxx:751
virtual OUString GetPar1() const override
Characters.
Definition: docufld.cxx:2668
SwCombinedCharField(SwCombinedCharFieldType *, const OUString &rChars)
Definition: docufld.cxx:2650
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2678
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2657
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
bool IsInMerge() const
Definition: dbmgr.hxx:343
bool IsDataSourceOpen(const OUString &rDataSource, const OUString &rTableOrQuery, bool bMergeShell)
check if a data source is open
Definition: dbmgr.cxx:2023
bool GetMergeColumnCnt(const OUString &rColumnName, LanguageType nLanguage, OUString &rResult, double *pNumber)
Definition: dbmgr.cxx:2107
static double GetDateTime(SwDoc &rDoc, const DateTime &rDT)
Definition: flddat.cxx:127
SwDocInfoFieldType(SwDoc *pDc)
Definition: docufld.cxx:846
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:851
OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString &rName) const
Definition: docufld.cxx:867
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:1145
virtual OUString GetFieldName() const override
get name or content
Definition: docufld.cxx:1121
virtual void SetLanguage(LanguageType nLng) override
set language of the format
Definition: docufld.cxx:1164
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:1217
virtual void SetSubType(sal_uInt16) override
Definition: docufld.cxx:1159
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:1044
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:1172
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:1154
OUString m_aName
Definition: docufld.hxx:535
OUString m_aContent
Definition: docufld.hxx:534
sal_uInt16 m_nSubType
Definition: docufld.hxx:533
SwDocInfoField(SwDocInfoFieldType *, sal_uInt16 nSub, const OUString &rName, sal_uInt32 nFormat=0)
Definition: docufld.cxx:1011
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:762
SwDocStatFieldType(SwDoc &)
Definition: docufld.cxx:726
SvxNumType m_nNumberingType
Definition: docufld.hxx:255
OUString Expand(sal_uInt16 nSubType, SvxNumType nFormat) const
Definition: docufld.cxx:733
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:819
sal_uInt16 m_nSubType
Definition: docufld.hxx:267
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:788
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:805
void ChangeExpansion(const SwFrame *pFrame)
Definition: docufld.cxx:798
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:777
SwDocStatField(SwDocStatFieldType *, sal_uInt16 nSubType, sal_uInt32 nFormat)
Definition: docufld.cxx:772
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:782
virtual void SetSubType(sal_uInt16 nSub) override
Definition: docufld.cxx:793
Definition: doc.hxx:197
SwDBData const & GetDBData()
Definition: docfld.cxx:386
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1699
SwDBManager * GetDBManager() const
Definition: doc.hxx:685
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:440
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1429
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
IDocumentStatistics const & getIDocumentStatistics() const
Definition: doc.cxx:387
static OUString Expand(sal_uInt16 nSubType)
Definition: docufld.cxx:2025
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2020
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:2082
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2066
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2074
SwExtUserField(SwExtUserFieldType *, sal_uInt16 nSub, sal_uInt32 nFormat)
Definition: docufld.cxx:2060
OUString m_aContent
Definition: docufld.hxx:567
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2115
sal_uInt16 m_nType
Definition: docufld.hxx:568
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2092
virtual void SetSubType(sal_uInt16 nSub) override
Definition: docufld.cxx:2087
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:247
static const OUString & GetTypeStr(SwFieldTypesEnum nTypeId)
Definition: fldbas.cxx:124
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:205
Base class of all fields.
Definition: fldbas.hxx:296
virtual void SetLanguage(LanguageType nLng)
Definition: fldbas.cxx:449
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:270
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: fldbas.cxx:931
bool IsAutomaticLanguage() const
Definition: fldbas.hxx:387
void SetFormat(sal_uInt32 const nSet)
Definition: fldbas.hxx:311
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:407
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:364
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
Definition: fldbas.cxx:382
SwFieldType * GetTyp() const
Definition: fldbas.hxx:402
LanguageType GetLanguage() const
Language at field position.
Definition: fldbas.hxx:412
bool IsFixed() const
Definition: fldbas.cxx:459
OUString Expand(sal_uLong) const
Definition: docufld.cxx:419
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:471
SwFileNameFieldType(SwDoc &)
Definition: docufld.cxx:413
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:499
SwFileNameField(SwFileNameFieldType *, sal_uInt32 nFormat)
Definition: docufld.cxx:476
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:482
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:537
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:490
OUString m_aContent
Definition: docufld.hxx:216
const SwField * GetField() const
Definition: fmtfld.hxx:131
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
Base class for various Writer styles.
Definition: format.hxx:47
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsInDocBody() const
Definition: frame.hxx:949
SwRootFrame * getRootFrame()
Definition: frame.hxx:685
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:1654
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:1672
SwHiddenParaField(SwHiddenParaFieldType *, OUString aCond)
Direct input, delete old value.
Definition: docufld.cxx:1661
virtual void SetPar1(const OUString &rStr) override
set condition
Definition: docufld.cxx:1714
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:1679
OUString m_aCond
Definition: docufld.hxx:366
virtual OUString GetPar1() const override
Query, set condition.
Definition: docufld.cxx:1719
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:1667
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:1696
virtual void UpdateFields() override
Definition: docufld.hxx:291
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:1270
SwHiddenTextFieldType(bool bSetHidden=true)
Definition: docufld.cxx:1265
void SetHiddenFlag(bool bSetHidden)
Definition: docufld.cxx:1275
void Evaluate(SwDoc &rDoc)
get current field value and cache it
Definition: docufld.cxx:1344
static OUString GetDBName(std::u16string_view rName, SwDoc &rDoc)
Definition: docufld.cxx:1537
OUString m_aContent
Evaluated DB-text.
Definition: docufld.hxx:301
bool m_bValid
Is DB-field evaluated?
Definition: docufld.hxx:308
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:1464
OUString m_aTRUEText
Text if condition true.
Definition: docufld.hxx:299
OUString m_aFALSEText
If condition false.
Definition: docufld.hxx:300
static OUString GetColumnName(const OUString &rName)
Definition: docufld.cxx:1524
SwFieldTypesEnum m_nSubType
Definition: docufld.hxx:304
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:1411
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:1494
bool m_bIsHidden
Is it not visible?
Definition: docufld.hxx:307
bool m_bCanToggle
Can field be toggled alone?
Definition: docufld.hxx:306
virtual OUString GetFieldName() const override
get name or content
Definition: docufld.cxx:1399
OUString m_aCond
Condition.
Definition: docufld.hxx:303
static void ParseIfFieldDefinition(std::u16string_view aFieldDefinition, OUString &rCondition, OUString &rTrue, OUString &rFalse)
Definition: docufld.cxx:1553
virtual void SetPar1(const OUString &rStr) override
Condition.
Definition: docufld.cxx:1425
virtual void SetPar2(const OUString &rStr) override
True/False - String.
Definition: docufld.cxx:1437
virtual OUString GetPar1() const override
Definition: docufld.cxx:1431
virtual OUString GetPar2() const override
get True/False text
Definition: docufld.cxx:1455
SwHiddenTextField(SwHiddenTextFieldType *, bool bConditional, OUString aCond, const OUString &rText, bool bHidden, SwFieldTypesEnum nSubType=SwFieldTypesEnum::HiddenText)
Definition: docufld.cxx:1284
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:1469
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:1323
TElementType * First()
Definition: calbck.hxx:372
SwCharFormat * GetCharFormat()
Definition: docufld.cxx:2524
sw::WriterMultiListener m_aDep
Definition: docufld.hxx:663
SwJumpEditFieldType(SwDoc &rDoc)
Definition: docufld.cxx:2514
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2519
OUString m_sText
Definition: docufld.hxx:675
virtual void SetPar2(const OUString &rStr) override
set hint text
Definition: docufld.cxx:2567
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2542
virtual OUString GetPar1() const override
Placeholder-Text.
Definition: docufld.cxx:2549
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2537
SwJumpEditField(SwJumpEditFieldType *, sal_uInt32 nFormat, OUString sText, OUString sHelp)
Definition: docufld.cxx:2531
virtual void SetPar1(const OUString &rStr) override
set place holder text
Definition: docufld.cxx:2555
OUString m_sHelp
Definition: docufld.hxx:676
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2603
virtual OUString GetPar2() const override
Hint-Text.
Definition: docufld.cxx:2561
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2572
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:687
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:163
SwNode & GetEndOfPostIts() const
A still empty section.
Definition: ndarr.hxx:154
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:202
A page of the document layout.
Definition: pagefrm.hxx:60
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:209
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:147
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:121
SvxNumType m_nNumberingType
Definition: docufld.hxx:133
OUString Expand(SvxNumType nFormat, short nOff, sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage, const OUString &, LanguageType=LANGUAGE_NONE) const
Definition: docufld.cxx:105
void ChangeExpansion(SwDoc *pDoc, bool bVirtPageNum, const SvxNumType *pNumFormat)
Definition: docufld.cxx:131
sal_uInt16 m_nMaxPage
Definition: docufld.hxx:154
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:210
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:266
OUString m_sUserStr
Definition: docufld.hxx:149
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:184
void ChangeExpansion(sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage)
Definition: docufld.cxx:177
virtual OUString GetPar2() const override
Definition: docufld.cxx:220
SwPageNumberField(SwPageNumberFieldType *, sal_uInt16 nSub, sal_uInt32 nFormat, short nOff=0, sal_uInt16 const nPageNumber=0, sal_uInt16 const nMaxPage=0)
Definition: docufld.cxx:168
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:230
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:235
sal_uInt16 m_nSubType
Definition: docufld.hxx:150
sal_uInt16 m_nPageNumber
Definition: docufld.hxx:153
virtual void SetPar2(const OUString &rStr) override
Definition: docufld.cxx:225
SwDoc & GetDoc() const
Definition: docufld.hxx:442
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:1731
SwPostItFieldType(SwDoc &rDoc)
Definition: docufld.cxx:1726
virtual ~SwPostItField() override
Definition: docufld.cxx:1764
sal_uInt32 m_nParaId
Definition: docufld.hxx:460
void ChangeStyleSheetName(std::u16string_view rOldName, const SfxStyleSheetBase *pStyleSheet)
Definition: docufld.cxx:1852
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:1873
bool GetResolved() const
Definition: docufld.cxx:1794
virtual OUString GetPar1() const override
Author.
Definition: docufld.cxx:1818
virtual OUString GetDescription() const override
Definition: docufld.cxx:1779
void SetName(const OUString &rStr)
Definition: docufld.cxx:1836
void SetParaId(const sal_uInt32 nParaId)
Definition: docufld.cxx:1868
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:1799
const OUString & GetName() const
Definition: docufld.hxx:504
OUString m_sAuthor
Definition: docufld.hxx:451
rtl::Reference< SwTextAPIObject > m_xTextObject
Definition: docufld.hxx:457
OUString m_sInitials
Initials of the author.
Definition: docufld.hxx:452
void SetPostItId(const sal_uInt32 nPostItId=0)
Definition: docufld.cxx:1858
OUString m_sText
Definition: docufld.hxx:450
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: docufld.cxx:1997
virtual void SetPar1(const OUString &rStr) override
set author
Definition: docufld.cxx:1812
sal_uInt32 m_nParentId
Definition: docufld.hxx:459
bool m_bResolved
Definition: docufld.hxx:455
static sal_uInt32 s_nLastPostItId
Definition: docufld.hxx:463
SwPostItField(SwPostItFieldType *, OUString aAuthor, OUString aText, OUString aInitials, OUString aName, const DateTime &rDate, const bool bResolved=false, const sal_uInt32 nPostItId=0, const sal_uInt32 nParentId=0, const sal_uInt32 nParaId=0)
Definition: docufld.cxx:1740
sal_uInt32 m_nPostItId
Definition: docufld.hxx:458
DateTime m_aDateTime
Definition: docufld.hxx:454
sal_Int32 GetNumberOfParagraphs() const
Definition: docufld.cxx:1847
void SetParentId(const sal_uInt32 nParentId)
Definition: docufld.cxx:1863
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:1939
void SetTextObject(std::optional< OutlinerParaObject > pText)
Definition: docufld.cxx:1842
virtual void SetPar2(const OUString &rStr) override
set the PostIt's text
Definition: docufld.cxx:1824
void ToggleResolved()
Definition: docufld.cxx:1789
void SetResolved(bool bNewState)
Definition: docufld.cxx:1784
virtual OUString GetPar2() const override
Text.
Definition: docufld.cxx:1830
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:1774
std::optional< OutlinerParaObject > mpText
Definition: docufld.hxx:456
OUString m_sName
Name of the comment.
Definition: docufld.hxx:453
SwDoc & GetDoc() const
Definition: docufld.hxx:637
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2226
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
overwritten to update all RefPageGet fields
Definition: docufld.cxx:2233
sal_Int16 m_nNumberingType
Definition: docufld.hxx:626
SwRefPageGetFieldType(SwDoc &rDoc)
Definition: docufld.cxx:2221
bool MakeSetList(SetGetExpFields &rTmpLst, SwRootFrame const *pLayout)
Definition: docufld.cxx:2278
void UpdateField(SwTextField const *pTextField, SetGetExpFields const &rSetList, SwRootFrame const *pLayout)
Definition: docufld.cxx:2324
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2474
void ChangeExpansion(const SwFrame &rFrame, const SwTextField *pField)
Definition: docufld.cxx:2413
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2490
OUString m_sText
Definition: docufld.hxx:643
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2404
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2399
void SetText(const OUString &rText, SwRootFrame const *pLayout)
Definition: docufld.cxx:2386
OUString m_sTextRLHidden
hidden redlines
Definition: docufld.hxx:644
SwRefPageGetField(SwRefPageGetFieldType *, sal_uInt32 nFormat)
Definition: docufld.cxx:2380
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
noop, there is nothing to update!
Definition: docufld.cxx:2155
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2149
void SetOffset(short nOff)
Definition: docufld.hxx:617
SwRefPageSetField(SwRefPageSetFieldType *, short nOff, bool bOn)
Definition: docufld.cxx:2161
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2167
bool IsOn() const
Definition: docufld.hxx:614
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2203
virtual OUString GetPar2() const override
Definition: docufld.cxx:2177
virtual void SetPar2(const OUString &rStr) override
Definition: docufld.cxx:2182
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2187
short GetOffset() const
Definition: docufld.hxx:616
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2172
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
sal_uInt16 GetPageNum() const
Definition: rootfrm.hxx:321
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:434
OUString Expand(sal_uLong) const
Definition: docufld.cxx:591
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:641
SwTemplNameFieldType(SwDoc &)
Definition: docufld.cxx:585
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:650
SwTemplNameField(SwTemplNameFieldType *, sal_uInt32 nFormat)
Definition: docufld.cxx:646
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:687
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:655
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:660
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:199
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
Fields containing values that have to be formatted via number formatter.
Definition: fldbas.hxx:419
OUString ExpandValue(const double &rVal, sal_uInt32 nFormat, LanguageType nLng) const
return value formatted as string
Definition: fldbas.cxx:585
SwDoc * GetDoc() const
Definition: fldbas.hxx:429
virtual void SetLanguage(LanguageType nLng) override
set language of the format
Definition: fldbas.cxx:757
OUString ExpandValue(const double &rVal, sal_uInt32 nFormat, LanguageType nLng) const
Definition: fldbas.hxx:472
virtual double GetValue() const
Definition: fldbas.cxx:799
SwDoc * GetDoc() const
Definition: fldbas.hxx:465
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2664
const_iterator begin() const
bool empty() const
std::pair< const_iterator, bool > insert(Value &&x)
const_iterator lower_bound(const Value &x) const
void StartListening(SwModify *pDepend)
Definition: calbck.cxx:269
double GetTimeInDays() const
struct _xmlTextWriter * xmlTextWriterPtr
SwDoc & m_rDoc
Definition: docbm.cxx:1228
static void lcl_GetLocalDataWrapper(LanguageType nLang, const LocaleDataWrapper **ppAppLocalData, const LocaleDataWrapper **ppLocalData)
Definition: docufld.cxx:856
static double lcl_TimeToDouble(const T &rTime)
Definition: docufld.cxx:1026
#define URL_DECODE
Definition: docufld.cxx:92
static double lcl_DateToDouble(const D &rDate, const Date &rNullDate)
Definition: docufld.cxx:1037
#define MAX_COMBINED_CHARACTERS
Definition: docufld.hxx:747
@ EU_APARTMENT
Definition: docufld.hxx:119
@ EU_PHONE_PRIVATE
Definition: docufld.hxx:113
@ EU_TITLE
Definition: docufld.hxx:111
@ EU_PHONE_COMPANY
Definition: docufld.hxx:114
@ EU_FIRSTNAME
Definition: docufld.hxx:104
@ EU_FAX
Definition: docufld.hxx:115
@ EU_NAME
Definition: docufld.hxx:105
@ EU_EMAIL
Definition: docufld.hxx:116
@ EU_STREET
Definition: docufld.hxx:107
@ EU_COMPANY
Definition: docufld.hxx:103
@ EU_FATHERSNAME
Definition: docufld.hxx:118
@ EU_POSITION
Definition: docufld.hxx:112
@ EU_ZIP
Definition: docufld.hxx:109
@ EU_SHORTCUT
Definition: docufld.hxx:106
@ EU_CITY
Definition: docufld.hxx:110
@ EU_COUNTRY
Definition: docufld.hxx:108
@ EU_STATE
Definition: docufld.hxx:117
@ JE_FMT_TEXT
Definition: docufld.hxx:124
@ JE_FMT_GRAPHIC
Definition: docufld.hxx:127
@ JE_FMT_TABLE
Definition: docufld.hxx:125
@ JE_FMT_OLE
Definition: docufld.hxx:128
@ JE_FMT_FRAME
Definition: docufld.hxx:126
@ PG_NEXT
Definition: docufld.hxx:93
@ PG_RANDOM
Definition: docufld.hxx:92
@ PG_PREV
Definition: docufld.hxx:94
@ DS_CHAR
Definition: docufld.hxx:57
@ DS_GRF
Definition: docufld.hxx:59
@ DS_TBL
Definition: docufld.hxx:58
@ DS_OLE
Definition: docufld.hxx:60
@ DS_PAGE
Definition: docufld.hxx:54
@ DS_WORD
Definition: docufld.hxx:56
@ DS_PARA
Definition: docufld.hxx:55
@ AF_SHORTCUT
Definition: docufld.hxx:46
@ AF_NAME
Definition: docufld.hxx:45
@ AF_FIXED
Definition: docufld.hxx:47
OUString m_sName
Reference< XTypeConverter > xConverter
const SwTextNode * GetBodyTextNode(const SwDoc &rDoc, SwPosition &rPos, const SwFrame &rFrame)
Forward declaration: get "BodyTextNode" for exp.fld in Fly's headers/footers/footnotes.
Definition: expfld.cxx:163
OUString ReplacePoint(const OUString &rTmpName, bool bWithCommandType)
Definition: expfld.cxx:105
OUString FormatNumber(sal_uInt32 nNum, SvxNumType nFormat, LanguageType nLang)
expand numbering
Definition: fldbas.cxx:523
SwFieldTypesEnum
List of FieldTypes at UI.
Definition: fldbas.hxx:98
@ FF_UI_RANGE
Definition: fldbas.hxx:164
@ FF_UI_NAME
Definition: fldbas.hxx:163
@ FF_FIXED
Definition: fldbas.hxx:166
@ FF_NAME_NOEXT
Definition: fldbas.hxx:162
@ FF_PATH
Definition: fldbas.hxx:161
@ FF_END
Definition: fldbas.hxx:165
@ FF_NAME
Definition: fldbas.hxx:159
@ FF_PATHNAME
Definition: fldbas.hxx:160
SwFieldIds
Definition: fldbas.hxx:49
DocumentType eType
sal_Int16 nValue
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
OUString aName
sal_uInt16 nPos
aStr
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
sal_Int32 GetEnumAsInt32(const css::uno::Any &rVal)
Definition: swunohelper.cxx:50
SVL_DLLPUBLIC OUString removePassword(OUString const &rURI, INetURLObject::EncodeMechanism eEncodeMechanism, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
double getLength(const B2DPolygon &rCandidate)
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
Reference< XComponentContext > getProcessComponentContext()
void copy(const fs::path &src, const fs::path &dest)
int i
const SwDocInfoSubType DI_DOCNO
Definition: docufld.hxx:78
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:83
const SwDocInfoSubType DI_CUSTOM
Definition: docufld.hxx:80
const SwDocInfoSubType DI_CHANGE
Definition: docufld.hxx:76
const SwDocInfoSubType DI_COMMENT
Definition: docufld.hxx:74
const SwDocInfoSubType DI_SUBTYPE_BEGIN
NB: these must denote consecutive integers! NB2: these are extended by 4 DI_INFO values for backward ...
Definition: docufld.hxx:70
const SwDocInfoSubType DI_SUB_FIXED
Definition: docufld.hxx:86
const SwDocInfoSubType DI_PRINT
Definition: docufld.hxx:77
const SwDocInfoSubType DI_SUB_DATE
Definition: docufld.hxx:85
const SwDocInfoSubType DI_KEYS
Definition: docufld.hxx:73
const SwDocInfoSubType DI_EDIT
Definition: docufld.hxx:79
const SwDocInfoSubType DI_SUBJECT
Definition: docufld.hxx:72
const SwDocInfoSubType DI_TITLE
Definition: docufld.hxx:71
const SwDocInfoSubType DI_SUB_TIME
Definition: docufld.hxx:84
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:75
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
bool IsFieldDeletedInModel(IDocumentRedlineAccess const &rIDRA, SwTextField const &rTextField)
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
@ RES_POOLCHR_JUMPEDIT
Placeholder.
Definition: poolfmt.hxx:122
QPRO_FUNC_TYPE nType
sal_uIntPtr sal_uLong
static LanguageType nLang
Definition: srtdlg.cxx:51
OUString sDurationFormat
Definition: shellres.hxx:50
OUString aFixedStr
Definition: shellres.hxx:48
std::vector< OUString > aDocInfoLst
Definition: shellres.hxx:62
sal_uLong nWord
Definition: docstat.hxx:35
sal_uInt16 nOLE
Definition: docstat.hxx:29
sal_uInt16 nTable
Definition: docstat.hxx:27
sal_uInt16 nGrf
Definition: docstat.hxx:28
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
Definition: docstat.hxx:32
sal_uLong nPage
Definition: docstat.hxx:30
sal_uLong nChar
Definition: docstat.hxx:37
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
SvxNumType
SVX_NUM_NUMBER_NONE
SVX_NUM_CHARS_LOWER_LETTER_N
SVX_NUM_ARABIC
SVX_NUM_BITMAP
SVX_NUM_CHAR_SPECIAL
SVX_NUM_PAGEDESC
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:254
#define DB_DELIM
Definition: swtypes.hxx:130
#define FIELD_PROP_BOOL1
Definition: unofldmid.h:28
#define FIELD_PROP_DATE_TIME
Definition: unofldmid.h:38
#define FIELD_PROP_DATE
Definition: unofldmid.h:30
#define FIELD_PROP_PAR3
Definition: unofldmid.h:25
#define FIELD_PROP_PAR5
Definition: unofldmid.h:43
#define FIELD_PROP_BOOL2
Definition: unofldmid.h:29
#define FIELD_PROP_SUBTYPE
Definition: unofldmid.h:27
#define FIELD_PROP_USHORT1
Definition: unofldmid.h:31
#define FIELD_PROP_USHORT2
Definition: unofldmid.h:32
#define FIELD_PROP_FORMAT
Definition: unofldmid.h:26
#define FIELD_PROP_PAR6
Definition: unofldmid.h:51
#define FIELD_PROP_DOUBLE
Definition: unofldmid.h:34
#define FIELD_PROP_TEXT
Definition: unofldmid.h:49
#define FIELD_PROP_TITLE
Definition: unofldmid.h:50
#define FIELD_PROP_PAR1
Definition: unofldmid.h:23
#define FIELD_PROP_PAR4
Definition: unofldmid.h:36
#define FIELD_PROP_PAR2
Definition: unofldmid.h:24
UserOptToken