30 #include <strings.hrc>
38 #include <osl/diagnose.h>
51 void lcl_FillAuthPattern(
SwFormTokens &rAuthTokens, sal_uInt16 nTypeId)
53 rAuthTokens.reserve(9);
57 rAuthTokens.push_back( aStartToken );
59 aSeparatorToken.
sText =
": ";
60 rAuthTokens.push_back( aSeparatorToken );
65 aTextToken.
sText =
", ";
79 rAuthTokens.push_back( aTextToken );
85 rAuthTokens.push_back(aToken);
95 , m_pTextAttr(nullptr)
97 , m_bAutoGenerated(false)
105 , m_pTextAttr(nullptr)
107 , m_bAutoGenerated(false)
108 , m_bMainEntry(false)
116 , m_pType(rCopy.m_pType)
117 , m_aPrimaryKey(rCopy.m_aPrimaryKey)
118 , m_aSecondaryKey(rCopy.m_aSecondaryKey)
119 , m_aTextReading(rCopy.m_aTextReading)
120 , m_aPrimaryKeyReading(rCopy.m_aPrimaryKeyReading)
121 , m_aSecondaryKeyReading(rCopy.m_aSecondaryKeyReading)
122 , m_pTextAttr(nullptr)
124 , m_bAutoGenerated(rCopy.m_bAutoGenerated)
125 , m_bMainEntry(rCopy.m_bMainEntry)
146 assert(SfxPoolItem::operator==(rAttr));
157 if (
auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
161 SetXTOXMark(css::uno::Reference<css::text::XDocumentIndexMark>(
nullptr));
162 }
else if (
auto pCollectHint = dynamic_cast<const sw::CollectTextMarksHint*>(&rHint))
165 pCollectHint->m_rMarks.push_back(
this);
166 }
else if (
auto pCollectLayoutHint = dynamic_cast<const sw::CollectTextTOXMarksForLayoutHint*>(&rHint))
171 auto& rNode = rTextMark.GetTextNode();
172 auto pLayout = pCollectLayoutHint->m_pLayout;
174 if(!rNode.GetNodes().IsDocNodes() || !rNode.GetText().getLength() || !rNode.HasWriterListeners() || !rNode.getLayoutFrame(pLayout))
182 pCollectLayoutHint->m_rMarks.push_back(rTextMark);
200 OSL_ENSURE( pEndIdx,
"TOXMark without mark!");
224 if (
auto pRegisteredIn = const_cast<SwTOXType&>(rCopy).
GetRegisteredIn())
225 pRegisteredIn->Add(
this);
231 STR_POOLCOLL_TOX_IDXH,
232 STR_POOLCOLL_TOX_IDX1,
233 STR_POOLCOLL_TOX_IDX2,
234 STR_POOLCOLL_TOX_IDX3,
235 STR_POOLCOLL_TOX_IDXBREAK
241 STR_POOLCOLL_TOX_CNTNTH,
242 STR_POOLCOLL_TOX_CNTNT1,
243 STR_POOLCOLL_TOX_CNTNT2,
244 STR_POOLCOLL_TOX_CNTNT3,
245 STR_POOLCOLL_TOX_CNTNT4,
246 STR_POOLCOLL_TOX_CNTNT5
252 STR_POOLCOLL_TOX_CNTNT6,
253 STR_POOLCOLL_TOX_CNTNT7,
254 STR_POOLCOLL_TOX_CNTNT8,
255 STR_POOLCOLL_TOX_CNTNT9,
256 STR_POOLCOLL_TOX_CNTNT10
262 STR_POOLCOLL_TOX_USERH,
263 STR_POOLCOLL_TOX_USER1,
264 STR_POOLCOLL_TOX_USER2,
265 STR_POOLCOLL_TOX_USER3,
266 STR_POOLCOLL_TOX_USER4,
267 STR_POOLCOLL_TOX_USER5
273 STR_POOLCOLL_TOX_USER6,
274 STR_POOLCOLL_TOX_USER7,
275 STR_POOLCOLL_TOX_USER8,
276 STR_POOLCOLL_TOX_USER9,
277 STR_POOLCOLL_TOX_USER10
283 STR_POOLCOLL_TOX_ILLUSH,
284 STR_POOLCOLL_TOX_ILLUS1
290 STR_POOLCOLL_TOX_OBJECTH,
291 STR_POOLCOLL_TOX_OBJECT1
297 STR_POOLCOLL_TOX_TABLESH,
298 STR_POOLCOLL_TOX_TABLES1
304 STR_POOLCOLL_TOX_AUTHORITIESH,
305 STR_POOLCOLL_TOX_AUTHORITIES1
310 STR_POOLCOLL_TOX_CITATION
315 :
m_eType( eTyp ), m_nFormMaxLevel(
SwForm::GetFormMaxLevel( eTyp )),
317 m_bCommaSeparated(false)
327 const char** pPoolId;
339 OSL_ENSURE(
false,
"invalid TOXTyp");
348 aTokens.push_back(aLinkStt);
368 aTokens.push_back(aToken);
379 for( sal_uInt16
i = 1;
i < 5; ++
i )
385 aTmpTokens.push_back(aTmpToken);
404 lcl_FillAuthPattern(aAuthTokens,
i);
467 for ( sal_uInt16 nLevel = 1; nLevel < nFormMax; ++nLevel )
470 if( pColl ==
nullptr )
478 const sal_uInt16 nTabCount = rTabStops.
Count();
482 SwFormTokens::iterator aIt = aCurrentPattern.begin();
484 bool bChanged =
false;
485 for(sal_uInt16 nTab = 0; nTab < nTabCount; ++nTab)
493 if ( aIt != aCurrentPattern.end() )
496 aIt->nTabStopPosition = rTab.
GetTabPos();
498 ( nTab == nTabCount - 1
502 aIt->cTabFillChar = rTab.
GetFill();
528 :
SwClient(const_cast<
sw::BroadcastingModify*>(static_cast<
sw::BroadcastingModify const *>(pTyp)))
532 , m_nCreateType(nCreaType)
535 , m_bProtected( true )
536 , m_bFromChapter(false)
537 , m_bFromObjectNames(false)
538 , m_bLevelFromChapter(false)
539 , maMSTOCExpression()
540 , mbKeepExpression(true)
546 :
SwClient( rSource.GetRegisteredInNonConst() )
547 , mbKeepExpression(true)
563 [=](
const std::unique_ptr<SwTOXType> &
p) {
return p.get() == pType; })
569 for(
size_t n = rTypes.size();
n; )
682 if(
sText.isEmpty() )
716 + OUString::number( static_cast< sal_Int32 >(
eTabAlign) ) +
","
718 + OUString::number(
bWithTab ? 1 : 0 );
745 return sToken.subView(0, sToken.getLength()-1) + sData + sToken.subView(sToken.getLength()-1);
759 sal_Int32 & rTokenLen)
763 OUString sTokenStart;
764 sal_Int16 nTokenLength;
766 }
const aTokenArr[] = {
779 for(
const auto &
i : aTokenArr)
781 if( sToken.startsWith(
i.sTokenStart ) )
783 rTokenLen =
i.nTokenLength;
788 SAL_WARN(
"sw.core",
"SwFormTokensHelper: invalid token");
803 sal_Int32 nEnd = sPattern.indexOf(
'>', nStt );
809 if ( nTextSeparatorFirst >= 0
810 && nTextSeparatorFirst + 1 < sPattern.getLength()
811 && nTextSeparatorFirst < nEnd)
814 nTextSeparatorFirst + 1 );
816 if( nEnd < nTextSeparatorSecond )
817 nEnd = sPattern.indexOf(
'>', nTextSeparatorSecond );
824 return sPattern.copy( nStt, nEnd - nStt );
838 static std::optional<SwFormToken>
842 nCurPatternPos += sToken.getLength();
843 sal_Int32 nTokenLen = 0;
847 nCurPatternPos = sPattern.getLength();
848 return std::optional<SwFormToken>();
856 const OUString sAuthFieldEnum = sToken.copy( 2, 2 );
857 sToken = sToken.copy( nTokenLen, sToken.getLength() - nTokenLen - 1);
861 OUString sTmp( sToken.getToken( 0,
',', nIdx ));
862 if( !sTmp.isEmpty() )
863 eRet.
nPoolId = static_cast<sal_uInt16>(sTmp.toInt32());
871 sTmp = sToken.getToken( 0,
',', nIdx );
872 if( !sTmp.isEmpty() )
874 sTmp = sToken.getToken( 0,
',', nIdx );
875 if( !sTmp.isEmpty() )
876 eRet.
nOutlineLevel = static_cast<sal_uInt16>(sTmp.toInt32());
882 if( nStartText>=0 && nStartText+1<sToken.getLength())
888 eRet.
sText = sToken.copy( nStartText + 1,
889 nEndText - nStartText - 1);
896 sTmp = sToken.getToken( 0,
',', nIdx );
897 if( !sTmp.isEmpty() )
900 sTmp = sToken.getToken( 0,
',', nIdx );
901 if( !sTmp.isEmpty() )
902 eRet.
eTabAlign = static_cast<SvxTabAdjust>(sTmp.toInt32());
904 sTmp = sToken.getToken( 0,
',', nIdx );
905 if( !sTmp.isEmpty() )
908 sTmp = sToken.getToken( 0,
',', nIdx );
909 if( !sTmp.isEmpty() )
910 eRet.
bWithTab = 0 != sTmp.toInt32();
914 eRet.
nAuthorityField =
static_cast<sal_uInt16
>(sAuthFieldEnum.toInt32());
923 sal_Int32 nCurPatternPos = 0;
925 while (nCurPatternPos < rPattern.getLength())
927 std::optional<SwFormToken>
const oToken(
938 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
944 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
952 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
SwCaptionDisplay m_eCaptionDisplay
OUString m_aStyleNames[MAXLEVEL]
const sal_Unicode C_NUM_REPL
const SfxItemSet * GetAttrSet() const
bool IsMarkHintHidden(SwRootFrame const &rLayout, SwTextNode const &rNode, SwTextAttrEnd const &rHint)
void SetAttrSet(const SfxItemSet &)
void Add(SwClient *pDepend)
SwTOXMark()
pool default constructor
Represents the style of a paragraph.
static OUString lcl_SearchNextToken(const OUString &sPattern, sal_Int32 const nStt)
Returns the string of a token.
SwTextTOXMark * m_pTextAttr
SwTOXType(SwDoc &rDoc, TOXTypes eTyp, const OUString &rName)
static const char * STR_POOLCOLL_TOX_CNTNT_EXTRA_ARY[]
static const char * STR_POOLCOLL_TOX_ARY[]
const SwTOXType * InsertTOXType(const SwTOXType &rTyp)
SAL_DLLPRIVATE void SetXTOXMark(css::uno::Reference< css::text::XDocumentIndexMark > const &xMark)
void SetTitle(const OUString &rTitle)
#define TOX_STYLE_DELIMITER
static const char * STR_POOLCOLL_TOX_ILLUS_ARY[]
static const char * STR_POOLCOLL_TOX_CNTNT_ARY[]
union SwTOXBase::@30 m_aData
Dialog to specify the properties of date form field.
static const char * STR_POOLCOLL_TOX_OBJECT_ARY[]
static std::optional< SwFormToken > lcl_BuildToken(const OUString &sPattern, sal_Int32 &nCurPatternPos)
Builds a token from its string representation.
The root element of a Writer document layout.
virtual ~SwTOXMark() override
static const char * STR_POOLCOLL_TOX_AUTHORITIES_ARY[]
const SwTOXType * GetTOXType() const
SwTOXElement m_nCreateType
void RegisterToTOXType(SwTOXType &rMark)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_Int32 GetStart() const
static const char * STR_POOLCOLL_TOX_USER_EXTRA_ARY[]
OUString maMSTOCExpression
SvxTabAdjust & GetAdjustment()
#define SAL_N_ELEMENTS(arr)
virtual const sal_Int32 * GetEnd() const override
end position
virtual void Notify(const SfxHint &rHint) override
void SetBookmarkName(const OUString &bName)
void RegisterToTOXType(SwTOXType &rMark)
OUString GetText(SwRootFrame const *pLayout) const
SwTOXBase(const SwTOXType *pTyp, const SwForm &rForm, SwTOXElement nCreaType, const OUString &rTitle)
const OUString & GetTypeName() const
const SwTextNode * GetpTextNd() const
SwTOOElements m_nOLEOptions
OUString SwResId(const char *pId)
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual ~SwTOXBase() override
void SetEntryTypeName(const OUString &sName)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(179)
OUString m_sSortAlgorithm
const sal_Unicode C_END_PAGE_NUM
void CopyTOXBase(SwDoc *, const SwTOXBase &)
const SwTOXTypes & GetTOXTypes() const
SwTOXBase & operator=(const SwTOXBase &rSource)
SvtBroadcaster & GetNotifier()
SwTextFormatColl * FindTextFormatCollByName(std::u16string_view rName) const
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) const
add 4th optional parameter indicating, when that a spa...
OUString GetUniqueTOXBaseName(const SwTOXType &rType, const OUString &sChkStr) const
static const char * STR_POOLCOLL_TOX_TABLES_ARY[]
OUString m_aEntryTypeName
bool IsCopyIsMove() const
LanguageType GetAppLanguage()
const SwTOXType * m_pType
const SwModify * GetRegisteredIn() const
OUString m_sMainEntryCharStyle
static const char * STR_POOLCOLL_TOX_USER_ARY[]
static FormTokenType lcl_GetTokenType(const OUString &sToken, sal_Int32 &rTokenLen)
Returns the type of a token.
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
virtual bool operator==(const SfxPoolItem &) const override
virtual void CallSwClientNotify(const SfxHint &rHint) const override
static bool IsInHiddenRange(const SwTextNode &rNode, sal_Int32 nPos)
#define SAL_WARN(area, stream)
static const char * STR_POOLCOLL_TOX_CITATION_ARY[]
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
const SwTextTOXMark * GetTextTOXMark() const
const EnumerationType m_eType
virtual SwTOXMark * Clone(SfxItemPool *pPool=nullptr) const override
const OUString & GetTOXName() const