1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
21 #include <com/sun/star/document/XDocumentProperties.hpp>
22 #include <com/sun/star/frame/XModel.hpp>
23 #include <o3tl/string_view.hxx>
24 #include <osl/diagnose.h>
26 #include <IDocumentFieldsAccess.hxx>
27 #include <svtools/htmltokn.h>
28 #include <svl/numformat.hxx>
29 #include <svl/zforlist.hxx>
30 #include <unotools/useroptions.hxx>
35 #include <docufld.hxx>
37 #include "htmlfld.hxx"
40 using namespace nsSwDocInfoSubType
;
41 using namespace ::com::sun::star
;
45 struct HTMLNumFormatTableEntry
47 std::string_view pName
;
48 NfIndexTableOffset eFormat
;
53 HTMLOptionEnum
<SwFieldIds
> const aHTMLFieldTypeTable
[] =
55 { OOO_STRING_SW_HTML_FT_author
, SwFieldIds::Author
},
56 { OOO_STRING_SW_HTML_FT_sender
, SwFieldIds::ExtUser
},
57 { "DATE", SwFieldIds::Date
},
58 { "TIME", SwFieldIds::Time
},
59 { OOO_STRING_SW_HTML_FT_datetime
, SwFieldIds::DateTime
},
60 { OOO_STRING_SW_HTML_FT_page
, SwFieldIds::PageNumber
},
61 { OOO_STRING_SW_HTML_FT_docinfo
, SwFieldIds::DocInfo
},
62 { OOO_STRING_SW_HTML_FT_docstat
, SwFieldIds::DocStat
},
63 { OOO_STRING_SW_HTML_FT_filename
, SwFieldIds::Filename
},
64 { nullptr, SwFieldIds(0) }
67 HTMLNumFormatTableEntry
const aHTMLDateFieldFormatTable
[] =
69 { "SSYS", NF_DATE_SYSTEM_SHORT
},
70 { "LSYS", NF_DATE_SYSTEM_LONG
},
71 { "DMY", NF_DATE_SYS_DDMMYY
, },
72 { "DMYY", NF_DATE_SYS_DDMMYYYY
, },
73 { "DMMY", NF_DATE_SYS_DMMMYY
, },
74 { "DMMYY", NF_DATE_SYS_DMMMYYYY
, },
75 { "DMMMY", NF_DATE_DIN_DMMMMYYYY
},
76 { "DMMMYY", NF_DATE_DIN_DMMMMYYYY
},
77 { "DDMMY", NF_DATE_SYS_NNDMMMYY
},
78 { "DDMMMY", NF_DATE_SYS_NNDMMMMYYYY
},
79 { "DDMMMYY", NF_DATE_SYS_NNDMMMMYYYY
},
80 { "DDDMMMY", NF_DATE_SYS_NNNNDMMMMYYYY
},
81 { "DDDMMMYY", NF_DATE_SYS_NNNNDMMMMYYYY
},
82 { "MY", NF_DATE_SYS_MMYY
},
83 { "MD", NF_DATE_DIN_MMDD
},
84 { "YMD", NF_DATE_DIN_YYMMDD
},
85 { "YYMD", NF_DATE_DIN_YYYYMMDD
},
86 { {}, NF_NUMERIC_START
}
89 HTMLNumFormatTableEntry
const aHTMLTimeFieldFormatTable
[] =
91 { "SYS", NF_TIME_HHMMSS
},
92 { "SSMM24", NF_TIME_HHMM
},
93 { "SSMM12", NF_TIME_HHMMAMPM
},
94 { {}, NF_NUMERIC_START
}
97 HTMLOptionEnum
<SvxNumType
> const aHTMLPageNumFieldFormatTable
[] =
99 { OOO_STRING_SW_HTML_FF_uletter
, SVX_NUM_CHARS_UPPER_LETTER
},
100 { OOO_STRING_SW_HTML_FF_lletter
, SVX_NUM_CHARS_LOWER_LETTER
},
101 { OOO_STRING_SW_HTML_FF_uroman
, SVX_NUM_ROMAN_UPPER
},
102 { OOO_STRING_SW_HTML_FF_lroman
, SVX_NUM_ROMAN_LOWER
},
103 { OOO_STRING_SW_HTML_FF_arabic
, SVX_NUM_ARABIC
},
104 { OOO_STRING_SW_HTML_FF_none
, SVX_NUM_NUMBER_NONE
},
105 { OOO_STRING_SW_HTML_FF_char
, SVX_NUM_CHAR_SPECIAL
},
106 { OOO_STRING_SW_HTML_FF_page
, SVX_NUM_PAGEDESC
},
107 { OOO_STRING_SW_HTML_FF_ulettern
, SVX_NUM_CHARS_UPPER_LETTER_N
},
108 { OOO_STRING_SW_HTML_FF_llettern
, SVX_NUM_CHARS_LOWER_LETTER_N
},
109 { nullptr, SvxNumType(0) }
112 HTMLOptionEnum
<SwExtUserSubType
> const aHTMLExtUsrFieldSubTable
[] =
114 { OOO_STRING_SW_HTML_FS_company
, EU_COMPANY
},
115 { OOO_STRING_SW_HTML_FS_firstname
, EU_FIRSTNAME
},
116 { OOO_STRING_SW_HTML_FS_name
, EU_NAME
},
117 { OOO_STRING_SW_HTML_FS_shortcut
, EU_SHORTCUT
},
118 { OOO_STRING_SW_HTML_FS_street
, EU_STREET
},
119 { OOO_STRING_SW_HTML_FS_country
, EU_COUNTRY
},
120 { OOO_STRING_SW_HTML_FS_zip
, EU_ZIP
},
121 { OOO_STRING_SW_HTML_FS_city
, EU_CITY
},
122 { OOO_STRING_SW_HTML_FS_title
, EU_TITLE
},
123 { OOO_STRING_SW_HTML_FS_position
, EU_POSITION
},
124 { OOO_STRING_SW_HTML_FS_pphone
, EU_PHONE_PRIVATE
},
125 { OOO_STRING_SW_HTML_FS_cphone
, EU_PHONE_COMPANY
},
126 { OOO_STRING_SW_HTML_FS_fax
, EU_FAX
},
127 { OOO_STRING_SW_HTML_FS_email
, EU_EMAIL
},
128 { OOO_STRING_SW_HTML_FS_state
, EU_STATE
},
129 { nullptr, SwExtUserSubType(0) }
132 HTMLOptionEnum
<SwAuthorFormat
> const aHTMLAuthorFieldFormatTable
[] =
134 { OOO_STRING_SW_HTML_FF_name
, AF_NAME
},
135 { OOO_STRING_SW_HTML_FF_shortcut
, AF_SHORTCUT
},
136 { nullptr, SwAuthorFormat(0) }
139 HTMLOptionEnum
<SwPageNumSubType
> const aHTMLPageNumFieldSubTable
[] =
141 { OOO_STRING_SW_HTML_FS_random
, PG_RANDOM
},
142 { OOO_STRING_SW_HTML_FS_next
, PG_NEXT
},
143 { OOO_STRING_SW_HTML_FS_prev
, PG_PREV
},
144 { nullptr, SwPageNumSubType(0) }
147 // UGLY: these are extensions of nsSwDocInfoSubType (in inc/docufld.hxx)
148 // these are necessary for importing document info fields written by
149 // older versions of OOo (< 3.0) which did not have DI_CUSTOM fields
150 const SwDocInfoSubType DI_INFO1
= DI_SUBTYPE_END
+ 1;
151 const SwDocInfoSubType DI_INFO2
= DI_SUBTYPE_END
+ 2;
152 const SwDocInfoSubType DI_INFO3
= DI_SUBTYPE_END
+ 3;
153 const SwDocInfoSubType DI_INFO4
= DI_SUBTYPE_END
+ 4;
155 HTMLOptionEnum
<sal_uInt16
> const aHTMLDocInfoFieldSubTable
[] =
157 { OOO_STRING_SW_HTML_FS_title
, DI_TITLE
},
158 { OOO_STRING_SW_HTML_FS_theme
, DI_SUBJECT
},
159 { OOO_STRING_SW_HTML_FS_keys
, DI_KEYS
},
160 { OOO_STRING_SW_HTML_FS_comment
, DI_COMMENT
},
161 { "INFO1", DI_INFO1
},
162 { "INFO2", DI_INFO2
},
163 { "INFO3", DI_INFO3
},
164 { "INFO4", DI_INFO4
},
165 { OOO_STRING_SW_HTML_FS_custom
, DI_CUSTOM
},
166 { OOO_STRING_SW_HTML_FS_create
, DI_CREATE
},
167 { OOO_STRING_SW_HTML_FS_change
, DI_CHANGE
},
171 HTMLOptionEnum
<sal_uInt16
> const aHTMLDocInfoFieldFormatTable
[] =
173 { OOO_STRING_SW_HTML_FF_author
, DI_SUB_AUTHOR
},
174 { OOO_STRING_SW_HTML_FF_time
, DI_SUB_TIME
},
175 { OOO_STRING_SW_HTML_FF_date
, DI_SUB_DATE
},
179 HTMLOptionEnum
<SwDocStatSubType
> const aHTMLDocStatFieldSubTable
[] =
181 { OOO_STRING_SW_HTML_FS_page
, DS_PAGE
},
182 { OOO_STRING_SW_HTML_FS_para
, DS_PARA
},
183 { OOO_STRING_SW_HTML_FS_word
, DS_WORD
},
184 { OOO_STRING_SW_HTML_FS_char
, DS_CHAR
},
185 { OOO_STRING_SW_HTML_FS_tbl
, DS_TBL
},
186 { OOO_STRING_SW_HTML_FS_grf
, DS_GRF
},
187 { OOO_STRING_SW_HTML_FS_ole
, DS_OLE
},
188 { nullptr, SwDocStatSubType(0) }
191 HTMLOptionEnum
<SwFileNameFormat
> const aHTMLFileNameFieldFormatTable
[] =
193 { OOO_STRING_SW_HTML_FF_name
, FF_NAME
},
194 { OOO_STRING_SW_HTML_FF_pathname
, FF_PATHNAME
},
195 { OOO_STRING_SW_HTML_FF_path
, FF_PATH
},
196 { OOO_STRING_SW_HTML_FF_name_noext
, FF_NAME_NOEXT
},
197 { nullptr, SwFileNameFormat(0) }
200 SvxNumType
SwHTMLParser::GetNumType( std::u16string_view rStr
, SvxNumType nDfltType
)
202 const HTMLOptionEnum
<SvxNumType
> *pOptEnums
= aHTMLPageNumFieldFormatTable
;
203 while( pOptEnums
->pName
)
205 if( o3tl::equalsIgnoreAsciiCase( rStr
, pOptEnums
->pName
) )
206 return pOptEnums
->nValue
;
212 void SwHTMLParser::NewField()
214 bool bKnownType
= false, bFixed
= false,
215 bHasNumFormat
= false, bHasNumValue
= false;
216 SwFieldIds nType
= SwFieldIds::Database
;
217 OUString aValue
, aNumFormat
, aNumValue
, aName
;
218 const HTMLOption
*pSubOption
=nullptr, *pFormatOption
=nullptr;
220 const HTMLOptions
& rHTMLOptions
= GetOptions();
223 for ( i
= rHTMLOptions
.size(); i
; )
225 const HTMLOption
& rOption
= rHTMLOptions
[--i
];
226 switch( rOption
.GetToken() )
228 case HtmlOptionId::TYPE
:
229 bKnownType
= rOption
.GetEnum( nType
, aHTMLFieldTypeTable
);
231 case HtmlOptionId::SUBTYPE
:
232 pSubOption
= &rOption
;
234 case HtmlOptionId::FORMAT
:
235 pFormatOption
= &rOption
;
237 case HtmlOptionId::NAME
:
238 aName
= rOption
.GetString();
240 case HtmlOptionId::VALUE
:
241 aValue
= rOption
.GetString();
243 case HtmlOptionId::SDNUM
:
244 aNumFormat
= rOption
.GetString();
245 bHasNumFormat
= true;
247 case HtmlOptionId::SDVAL
:
248 aNumValue
= rOption
.GetString();
251 case HtmlOptionId::SDFIXED
:
261 // Author and sender are only inserted as a variable field if the document
262 // was last changed by ourself or nobody changed it and it was created
263 // by ourself. Otherwise it will be a fixed field.
265 (SwFieldIds::ExtUser
== nType
||
266 SwFieldIds::Author
== nType
) )
269 const OUString
& rUser
= aOpt
.GetFullName();
270 SwDocShell
*pDocShell(m_xDoc
->GetDocShell());
271 OSL_ENSURE(pDocShell
, "no SwDocShell");
273 uno::Reference
<document::XDocumentPropertiesSupplier
> xDPS(
274 pDocShell
->GetModel(), uno::UNO_QUERY_THROW
);
275 uno::Reference
<document::XDocumentProperties
> xDocProps(
276 xDPS
->getDocumentProperties());
277 OSL_ENSURE(xDocProps
.is(), "Doc has no DocumentProperties");
278 const OUString
& rChanged
= xDocProps
->getModifiedBy();
279 const OUString
& rCreated
= xDocProps
->getAuthor();
280 if( rUser
.isEmpty() ||
281 (!rChanged
.isEmpty() ? rUser
!= rChanged
: rUser
!= rCreated
) )
286 SwFieldIds nWhich
= nType
;
287 if( SwFieldIds::Date
==nType
|| SwFieldIds::Time
==nType
)
288 nWhich
= SwFieldIds::DateTime
;
290 SwFieldType
* pType
= m_xDoc
->getIDocumentFieldsAccess().GetSysFieldType( nWhich
);
291 std::unique_ptr
<SwField
> xNewField
;
292 bool bInsOnEndTag
= false;
296 case SwFieldIds::ExtUser
:
299 SwExtUserSubType nSub
;
300 sal_uLong nFormat
= 0;
306 if( pSubOption
->GetEnum( nSub
, aHTMLExtUsrFieldSubTable
) )
307 xNewField
.reset(new SwExtUserField(static_cast<SwExtUserFieldType
*>(pType
), nSub
, nFormat
));
311 case SwFieldIds::Author
:
313 SwAuthorFormat nFormat
= AF_NAME
;
315 pFormatOption
->GetEnum( nFormat
, aHTMLAuthorFieldFormatTable
);
318 nFormat
= static_cast<SwAuthorFormat
>(static_cast<int>(nFormat
) | AF_FIXED
);
322 xNewField
.reset(new SwAuthorField(static_cast<SwAuthorFieldType
*>(pType
), nFormat
));
326 case SwFieldIds::Date
:
327 case SwFieldIds::Time
:
329 sal_uInt32 nNumFormat
= 0;
330 DateTime
aDateTime( DateTime::SYSTEM
);
331 sal_Int64 nTime
= aDateTime
.GetTime();
332 sal_Int32 nDate
= aDateTime
.GetDate();
334 bool bValidFormat
= false;
335 HTMLNumFormatTableEntry
const * pFormatTable
;
337 if( SwFieldIds::Date
==nType
)
340 pFormatTable
= aHTMLDateFieldFormatTable
;
341 if( !aValue
.isEmpty() )
342 nDate
= aValue
.toInt32();
347 pFormatTable
= aHTMLTimeFieldFormatTable
;
348 if( !aValue
.isEmpty() )
349 nTime
= static_cast<sal_uLong
>(aValue
.toInt32());
351 if( !aValue
.isEmpty() )
354 SvNumberFormatter
*pFormatter
= m_xDoc
->GetNumberFormatter();
357 const OUString
& rFormat
= pFormatOption
->GetString();
358 for( int k
= 0; !pFormatTable
[k
].pName
.empty(); ++k
)
360 if( rFormat
.equalsIgnoreAsciiCaseAscii( pFormatTable
[k
].pName
) )
362 nNumFormat
= pFormatter
->GetFormatIndex(
363 pFormatTable
[k
].eFormat
, LANGUAGE_SYSTEM
);
370 nNumFormat
= pFormatter
->GetFormatIndex( pFormatTable
[i
].eFormat
,
373 xNewField
.reset(new SwDateTimeField(static_cast<SwDateTimeFieldType
*>(pType
), nSub
, nNumFormat
));
376 static_cast<SwDateTimeField
*>(xNewField
.get())->SetDateTime(DateTime(Date(nDate
), tools::Time(nTime
)));
380 case SwFieldIds::DateTime
:
385 SvNumberFormatter
*pFormatter
= m_xDoc
->GetNumberFormatter();
386 sal_uInt32 nNumFormat
;
388 double dValue
= GetTableDataOptionsValNum(
389 nNumFormat
, eLang
, aNumValue
, aNumFormat
,
390 *m_xDoc
->GetNumberFormatter() );
391 SvNumFormatType nFormatType
= pFormatter
->GetType( nNumFormat
);
392 switch( nFormatType
)
394 case SvNumFormatType::DATE
: nSub
= DATEFLD
; break;
395 case SvNumFormatType::TIME
: nSub
= TIMEFLD
; break;
404 xNewField
.reset(new SwDateTimeField(static_cast<SwDateTimeFieldType
*>(pType
), nSub
, nNumFormat
));
406 static_cast<SwDateTimeField
*>(xNewField
.get())->SetValue(dValue
);
411 case SwFieldIds::PageNumber
:
414 SwPageNumSubType nSub
;
415 if( pSubOption
->GetEnum( nSub
, aHTMLPageNumFieldSubTable
) )
417 SvxNumType nFormat
= SVX_NUM_PAGEDESC
;
419 pFormatOption
->GetEnum( nFormat
, aHTMLPageNumFieldFormatTable
);
423 if( nFormat
!=SVX_NUM_CHAR_SPECIAL
&& !aValue
.isEmpty() )
424 nOff
= static_cast<short>(aValue
.toInt32());
425 else if( nSub
== PG_NEXT
)
427 else if( nSub
== PG_PREV
)
430 if( nFormat
==SVX_NUM_CHAR_SPECIAL
&&
432 nFormat
= SVX_NUM_PAGEDESC
;
434 xNewField
.reset(new SwPageNumberField(static_cast<SwPageNumberFieldType
*>(pType
), nSub
, nFormat
, nOff
));
435 if (nFormat
== SVX_NUM_CHAR_SPECIAL
)
436 static_cast<SwPageNumberField
*>(xNewField
.get())->SetUserString(aValue
);
441 case SwFieldIds::DocInfo
:
445 if( pSubOption
->GetEnum( nSub
, aHTMLDocInfoFieldSubTable
) )
447 sal_uInt16 nExtSub
= 0;
448 if( DI_CREATE
==static_cast<SwDocInfoSubType
>(nSub
) ||
449 DI_CHANGE
==static_cast<SwDocInfoSubType
>(nSub
) )
451 nExtSub
= DI_SUB_AUTHOR
;
453 pFormatOption
->GetEnum( nExtSub
, aHTMLDocInfoFieldFormatTable
);
457 sal_uInt32 nNumFormat
= 0;
459 if( bHasNumFormat
&& (DI_SUB_DATE
==nExtSub
|| DI_SUB_TIME
==nExtSub
) )
462 dValue
= GetTableDataOptionsValNum(
463 nNumFormat
, eLang
, aNumValue
, aNumFormat
,
464 *m_xDoc
->GetNumberFormatter() );
465 bFixed
&= bHasNumValue
;
468 bHasNumValue
= false;
470 if( nSub
>= DI_INFO1
&& nSub
<= DI_INFO4
&& aName
.isEmpty() )
472 // backward compatibility for OOo 2:
473 // map to names stored in AddMetaUserDefined
474 aName
= m_InfoNames
[nSub
- DI_INFO1
];
480 nSub
|= DI_SUB_FIXED
;
484 xNewField
.reset(new SwDocInfoField(static_cast<SwDocInfoFieldType
*>(pType
), nSub
, aName
, nNumFormat
));
486 static_cast<SwDocInfoField
*>(xNewField
.get())->SetValue(dValue
);
491 case SwFieldIds::DocStat
:
494 SwDocStatSubType nSub
;
495 if( pSubOption
->GetEnum( nSub
, aHTMLDocStatFieldSubTable
) )
497 SvxNumType nFormat
= SVX_NUM_ARABIC
;
499 pFormatOption
->GetEnum( nFormat
, aHTMLPageNumFieldFormatTable
);
500 xNewField
.reset(new SwDocStatField(static_cast<SwDocStatFieldType
*>(pType
), nSub
, nFormat
));
501 m_bUpdateDocStat
|= (DS_PAGE
!= nSub
);
506 case SwFieldIds::Filename
:
508 SwFileNameFormat nFormat
= FF_NAME
;
510 pFormatOption
->GetEnum( nFormat
, aHTMLFileNameFieldFormatTable
);
513 nFormat
= static_cast<SwFileNameFormat
>(static_cast<int>(nFormat
) | FF_FIXED
);
517 xNewField
.reset(new SwFileNameField(static_cast<SwFileNameFieldType
*>(pType
), nFormat
));
529 m_xField
= std::move(xNewField
);
533 m_xDoc
->getIDocumentContentOperations().InsertPoolItem(*m_pPam
, SwFormatField(*xNewField
));
539 void SwHTMLParser::EndField()
543 switch (m_xField
->Which())
545 case SwFieldIds::DocInfo
:
546 OSL_ENSURE( static_cast<SwDocInfoField
*>(m_xField
.get())->IsFixed(),
547 "Field DocInfo should not have been saved" );
548 static_cast<SwDocInfoField
*>(m_xField
.get())->SetExpansion( m_aContents
);
551 case SwFieldIds::ExtUser
:
552 OSL_ENSURE( static_cast<SwExtUserField
*>(m_xField
.get())->IsFixed(),
553 "Field ExtUser should not have been saved" );
554 static_cast<SwExtUserField
*>(m_xField
.get())->SetExpansion( m_aContents
);
557 case SwFieldIds::Author
:
558 OSL_ENSURE( static_cast<SwAuthorField
*>(m_xField
.get())->IsFixed(),
559 "Field Author should not have been saved" );
560 static_cast<SwAuthorField
*>(m_xField
.get())->SetExpansion( m_aContents
);
563 case SwFieldIds::Filename
:
564 OSL_ENSURE( static_cast<SwFileNameField
*>(m_xField
.get())->IsFixed(),
565 "Field FileName should not have been saved" );
566 static_cast<SwFileNameField
*>(m_xField
.get())->SetExpansion( m_aContents
);
571 m_xDoc
->getIDocumentContentOperations().InsertPoolItem( *m_pPam
, SwFormatField(*m_xField
) );
579 void SwHTMLParser::InsertFieldText()
583 // append the current text part to the text
584 m_aContents
+= aToken
;
588 void SwHTMLParser::InsertCommentText( std::string_view pTag
)
590 bool bEmpty
= m_aContents
.isEmpty();
594 m_aContents
+= aToken
;
595 if( bEmpty
&& !pTag
.empty() )
597 m_aContents
= OUString::Concat("HTML: <") + OUString::createFromAscii(pTag
) + ">" + m_aContents
;
601 void SwHTMLParser::InsertComment( const OUString
& rComment
, std::string_view pTag
)
603 OUString
aComment( rComment
);
607 OUString::createFromAscii(pTag
) +
611 // MIB 24.06.97: If a PostIt should be insert after a space, we
612 // will insert before the space. Then there are less problems
613 // during formatting. (bug #40483#)
614 const sal_Int32 nPos
= m_pPam
->GetPoint()->GetContentIndex();
615 SwTextNode
*pTextNd
= m_pPam
->GetPointNode().GetTextNode();
616 bool bMoveFwd
= false;
617 if (nPos
>0 && pTextNd
&& (' ' == pTextNd
->GetText()[nPos
-1]))
621 SwNodeOffset nNodeIdx
= m_pPam
->GetPoint()->GetNodeIndex();
622 const sal_Int32 nIdx
= m_pPam
->GetPoint()->GetContentIndex();
623 for( auto i
= m_aSetAttrTab
.size(); i
> 0; )
625 HTMLAttr
*pAttr
= m_aSetAttrTab
[--i
];
626 if( pAttr
->GetStartParagraphIdx() != nNodeIdx
||
627 pAttr
->GetStartContent() != nIdx
)
630 if( RES_TXTATR_FIELD
== pAttr
->m_pItem
->Which() &&
631 SwFieldIds::Script
== static_cast<const SwFormatField
*>(pAttr
->m_pItem
.get())->GetField()->GetTyp()->Which() )
639 m_pPam
->Move( fnMoveBackward
);
642 SwPostItField
aPostItField(
643 static_cast<SwPostItFieldType
*>(m_xDoc
->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Postit
)),
644 OUString(), aComment
, OUString(), OUString(), DateTime(DateTime::SYSTEM
));
645 InsertAttr( SwFormatField( aPostItField
), false );
648 m_pPam
->Move( fnMoveForward
);
651 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */