40#include <osl/diagnose.h>
52void lcl_FillAuthPattern(
SwFormTokens &rAuthTokens, sal_uInt16 nTypeId)
54 rAuthTokens.reserve(9);
58 rAuthTokens.push_back( aStartToken );
60 aSeparatorToken.
sText =
": ";
61 rAuthTokens.push_back( aSeparatorToken );
66 aTextToken.
sText =
", ";
80 rAuthTokens.push_back( aTextToken );
86 rAuthTokens.push_back(aToken);
96 , m_pTextAttr(nullptr)
98 , m_bAutoGenerated(false)
106 , m_pTextAttr(nullptr)
108 , m_bAutoGenerated(false)
109 , m_bMainEntry(false)
117 , m_pType(rCopy.m_pType)
118 , m_aPrimaryKey(rCopy.m_aPrimaryKey)
119 , m_aSecondaryKey(rCopy.m_aSecondaryKey)
120 , m_aTextReading(rCopy.m_aTextReading)
121 , m_aPrimaryKeyReading(rCopy.m_aPrimaryKeyReading)
122 , m_aSecondaryKeyReading(rCopy.m_aSecondaryKeyReading)
123 , m_pTextAttr(nullptr)
125 , m_bAutoGenerated(rCopy.m_bAutoGenerated)
126 , m_bMainEntry(rCopy.m_bMainEntry)
150 assert(SfxPoolItem::operator==(rAttr));
161 if (rHint.
GetId() == SfxHintId::SwLegacyModify)
164 CallSwClientNotify(rHint);
168 else if (rHint.
GetId() == SfxHintId::SwCollectTextMarks)
172 pCollectHint->
m_rMarks.push_back(
this);
174 else if (rHint.
GetId() == SfxHintId::SwCollectTextTOXMarksForLayout)
180 auto& rNode = rTextMark.GetTextNode();
181 auto pLayout = pCollectLayoutHint->m_pLayout;
183 if(!rNode.GetNodes().IsDocNodes() || !rNode.GetText().getLength() || !rNode.HasWriterListeners() || !rNode.getLayoutFrame(pLayout))
191 pCollectLayoutHint->m_rMarks.push_back(rTextMark);
209 OSL_ENSURE( pEndIdx,
"TOXMark without mark!");
233 if (
auto pRegisteredIn =
const_cast<SwTOXType&
>(rCopy).GetRegisteredIn())
234 pRegisteredIn->Add(
this);
240 STR_POOLCOLL_TOX_IDXH,
241 STR_POOLCOLL_TOX_IDX1,
242 STR_POOLCOLL_TOX_IDX2,
243 STR_POOLCOLL_TOX_IDX3,
244 STR_POOLCOLL_TOX_IDXBREAK
250 STR_POOLCOLL_TOX_CNTNTH,
251 STR_POOLCOLL_TOX_CNTNT1,
252 STR_POOLCOLL_TOX_CNTNT2,
253 STR_POOLCOLL_TOX_CNTNT3,
254 STR_POOLCOLL_TOX_CNTNT4,
255 STR_POOLCOLL_TOX_CNTNT5
261 STR_POOLCOLL_TOX_CNTNT6,
262 STR_POOLCOLL_TOX_CNTNT7,
263 STR_POOLCOLL_TOX_CNTNT8,
264 STR_POOLCOLL_TOX_CNTNT9,
265 STR_POOLCOLL_TOX_CNTNT10
271 STR_POOLCOLL_TOX_USERH,
272 STR_POOLCOLL_TOX_USER1,
273 STR_POOLCOLL_TOX_USER2,
274 STR_POOLCOLL_TOX_USER3,
275 STR_POOLCOLL_TOX_USER4,
276 STR_POOLCOLL_TOX_USER5
282 STR_POOLCOLL_TOX_USER6,
283 STR_POOLCOLL_TOX_USER7,
284 STR_POOLCOLL_TOX_USER8,
285 STR_POOLCOLL_TOX_USER9,
286 STR_POOLCOLL_TOX_USER10
292 STR_POOLCOLL_TOX_ILLUSH,
293 STR_POOLCOLL_TOX_ILLUS1
299 STR_POOLCOLL_TOX_OBJECTH,
300 STR_POOLCOLL_TOX_OBJECT1
306 STR_POOLCOLL_TOX_TABLESH,
307 STR_POOLCOLL_TOX_TABLES1
313 STR_POOLCOLL_TOX_AUTHORITIESH,
314 STR_POOLCOLL_TOX_AUTHORITIES1
319 STR_POOLCOLL_TOX_CITATION
324 :
m_eType( eTyp ), m_nFormMaxLevel(
SwForm::GetFormMaxLevel( eTyp )),
326 m_bCommaSeparated(false)
348 OSL_ENSURE(
false,
"invalid TOXTyp");
353 const bool bNeedsLink
359 aTokens.push_back(aLinkStt);
379 aTokens.push_back(aToken);
390 for( sal_uInt16
i = 1;
i < 5; ++
i )
396 aTmpTokens.push_back(aTmpToken);
415 lcl_FillAuthPattern(aAuthTokens,
i);
478 for ( sal_uInt16 nLevel = 1; nLevel < nFormMax; ++nLevel )
481 if( pColl ==
nullptr )
489 const sal_uInt16 nTabCount = rTabStops.
Count();
493 SwFormTokens::iterator aIt = aCurrentPattern.begin();
495 bool bChanged =
false;
496 for(sal_uInt16 nTab = 0; nTab < nTabCount; ++nTab)
504 if ( aIt != aCurrentPattern.end() )
507 aIt->nTabStopPosition = rTab.
GetTabPos();
509 ( nTab == nTabCount - 1
513 aIt->cTabFillChar = rTab.
GetFill();
521 SetPattern( nLevel, std::move(aCurrentPattern) );
539 :
SwClient(const_cast<
sw::BroadcastingModify*>(static_cast<
sw::BroadcastingModify const *>(pTyp)))
541 , m_aTitle(
std::move(aTitle))
543 , m_nCreateType(nCreaType)
546 , m_bProtected( true )
547 , m_bFromChapter(false)
548 , m_bFromObjectNames(false)
549 , m_bLevelFromChapter(false)
550 , maMSTOCExpression()
551 , mbKeepExpression(true)
557 :
SwClient( rSource.GetRegisteredInNonConst() )
558 , mbKeepExpression(true)
574 [=](
const std::unique_ptr<SwTOXType> &
p) { return p.get() == pType; })
580 for(
size_t n = rTypes.size();
n; )
686 if(
sText.isEmpty() )
720 + OUString::number(
static_cast< sal_Int32
>(
eTabAlign) ) +
","
722 + OUString::number(
bWithTab ? 1 : 0 );
749 return sToken.subView(0, sToken.getLength()-1) + sData + sToken.subView(sToken.getLength()-1);
763 sal_Int32 & rTokenLen)
767 OUString sTokenStart;
768 sal_Int16 nTokenLength;
770 }
const aTokenArr[] = {
783 for(
const auto &
i : aTokenArr)
787 rTokenLen =
i.nTokenLength;
792 SAL_WARN(
"sw.core",
"SwFormTokensHelper: invalid token");
804static std::u16string_view
807 size_t nEnd = sPattern.find(
u'>', nStt );
808 if (nEnd != std::u16string_view::npos)
813 if ( nTextSeparatorFirst != std::u16string_view::npos
814 && nTextSeparatorFirst + 1 < sPattern.size()
815 && nTextSeparatorFirst < nEnd)
818 nTextSeparatorFirst + 1 );
820 if( nEnd < nTextSeparatorSecond )
821 nEnd = sPattern.find(
'>', nTextSeparatorSecond );
823 assert(nEnd != std::u16string_view::npos);
828 return sPattern.substr( nStt, nEnd - nStt );
831 return std::u16string_view();
842static std::optional<SwFormToken>
846 nCurPatternPos += sToken.size();
847 sal_Int32 nTokenLen = 0;
851 nCurPatternPos = sPattern.size();
852 return std::optional<SwFormToken>();
860 const std::u16string_view sAuthFieldEnum = sToken.substr( 2, 2 );
861 sToken = sToken.substr( nTokenLen, sToken.size() - nTokenLen - 1);
886 if( nStartText != std::u16string_view::npos && nStartText+1<sToken.size())
890 if( nEndText != std::u16string_view::npos )
892 eRet.
sText = sToken.substr( nStartText + 1,
893 nEndText - nStartText - 1);
927 size_t nCurPatternPos = 0;
929 while (nCurPatternPos < aPattern.size())
931 std::optional<SwFormToken>
const oToken(
942 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
948 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
956 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
bool StartListening(SvtBroadcaster &rBroadcaster)
SvxTabAdjust & GetAdjustment()
const SwTOXType * InsertTOXType(const SwTOXType &rTyp)
bool IsCopyIsMove() const
const SwTOXTypes & GetTOXTypes() const
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
OUString GetUniqueTOXBaseName(const SwTOXType &rType, const OUString &sChkStr) const
The root element of a Writer document layout.
static bool IsInHiddenRange(const SwTextNode &rNode, sal_Int32 nPos)
union SwTOXBase::@27 m_aData
OUString m_sSortAlgorithm
SwCaptionDisplay m_eCaptionDisplay
SwTOXElement m_nCreateType
void SetAttrSet(const SfxItemSet &)
void CopyTOXBase(SwDoc *, const SwTOXBase &)
SwTOXBase(const SwTOXType *pTyp, const SwForm &rForm, SwTOXElement nCreaType, OUString aTitle)
const OUString & GetTOXName() const
const SfxItemSet * GetAttrSet() const
const SwTOXType * GetTOXType() const
OUString m_sMainEntryCharStyle
void RegisterToTOXType(SwTOXType &rMark)
void SetBookmarkName(const OUString &bName)
SwTOXBase & operator=(const SwTOXBase &rSource)
OUString m_aStyleNames[MAXLEVEL]
void SetTitle(const OUString &rTitle)
SwTOOElements m_nOLEOptions
virtual ~SwTOXBase() override
OUString maMSTOCExpression
void RegisterToTOXType(SwTOXType &rMark)
const SwTextTOXMark * GetTextTOXMark() const
virtual SwTOXMark * Clone(SfxItemPool *pPool=nullptr) const override
const SwTOXType * m_pType
virtual ~SwTOXMark() override
virtual bool operator==(const SfxPoolItem &) const override
OUString GetText(SwRootFrame const *pLayout) const
SwTextTOXMark * m_pTextAttr
SwTOXMark()
pool default constructor
virtual void Notify(const SfxHint &rHint) override
SAL_DLLPRIVATE void SetXTOXMark(rtl::Reference< SwXDocumentIndexMark > const &xMark)
unotools::WeakReference< SwXDocumentIndexMark > m_wXDocumentIndexMark
const OUString & GetTypeName() const
SwTOXType(SwDoc &rDoc, TOXTypes eTyp, OUString aName)
sal_Int32 GetStart() const
Represents the style of a paragraph.
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote|ExpandMode::HideFieldmarkCommands) const
add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating, when <bWithNum = true> that a spa...
const SwTextNode * GetpTextNd() const
virtual const sal_Int32 * GetEnd() const override
end position
const EnumerationType m_eType
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
LanguageType GetAppLanguage()
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
Dialog to specify the properties of date form field.
bool IsMarkHintHidden(SwRootFrame const &rLayout, SwTextNode const &rNode, SwTextAttrEnd const &rHint)
OUString SwResId(TranslateId aId)
constexpr sal_uInt8 MAXLEVEL
static std::u16string_view lcl_SearchNextToken(std::u16string_view sPattern, sal_Int32 const nStt)
Returns the string of a token.
const TranslateId STR_POOLCOLL_TOX_TABLES_ARY[]
const TranslateId STR_POOLCOLL_TOX_CITATION_ARY[]
const sal_Unicode C_NUM_REPL
const TranslateId STR_POOLCOLL_TOX_ARY[]
const TranslateId STR_POOLCOLL_TOX_ILLUS_ARY[]
static FormTokenType lcl_GetTokenType(std::u16string_view sToken, sal_Int32 &rTokenLen)
Returns the type of a token.
const TranslateId STR_POOLCOLL_TOX_CNTNT_ARY[]
const TranslateId STR_POOLCOLL_TOX_OBJECT_ARY[]
static std::optional< SwFormToken > lcl_BuildToken(std::u16string_view sPattern, size_t &nCurPatternPos)
Builds a token from its string representation.
const TranslateId STR_POOLCOLL_TOX_USER_EXTRA_ARY[]
const TranslateId STR_POOLCOLL_TOX_CNTNT_EXTRA_ARY[]
const TranslateId STR_POOLCOLL_TOX_USER_ARY[]
const sal_Unicode C_END_PAGE_NUM
const TranslateId STR_POOLCOLL_TOX_AUTHORITIES_ARY[]
#define TOX_STYLE_DELIMITER
std::vector< SwFormToken > SwFormTokens
Vector of tokens.