30 #include <strings.hrc>
39 #include <osl/diagnose.h>
42 #include <string_view>
50 void lcl_FillAuthPattern(
SwFormTokens &rAuthTokens, sal_uInt16 nTypeId)
52 rAuthTokens.reserve(9);
56 rAuthTokens.push_back( aStartToken );
58 aSeparatorToken.
sText =
": ";
59 rAuthTokens.push_back( aSeparatorToken );
64 aTextToken.
sText =
", ";
78 rAuthTokens.push_back( aTextToken );
84 rAuthTokens.push_back(aToken);
94 , m_pTextAttr(nullptr)
96 , m_bAutoGenerated(
false)
104 , m_pTextAttr(nullptr)
106 , m_bAutoGenerated(
false)
107 , m_bMainEntry(
false)
115 , m_pType(rCopy.m_pType)
116 , m_aPrimaryKey(rCopy.m_aPrimaryKey)
117 , m_aSecondaryKey(rCopy.m_aSecondaryKey)
118 , m_aTextReading(rCopy.m_aTextReading)
119 , m_aPrimaryKeyReading(rCopy.m_aPrimaryKeyReading)
120 , m_aSecondaryKeyReading(rCopy.m_aSecondaryKeyReading)
121 , m_pTextAttr(nullptr)
123 , m_bAutoGenerated(rCopy.m_bAutoGenerated)
124 , m_bMainEntry(rCopy.m_bMainEntry)
145 assert(SfxPoolItem::operator==(rAttr));
156 if (rHint.
GetId() == SfxHintId::SwLegacyModify)
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)
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);
415 pPoolId = STR_POOLCOLL_TOX_AUTHORITIES_ARY + 1;
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();
510 SetPattern( nLevel, std::move(aCurrentPattern) );
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; )
675 if(
sText.isEmpty() )
709 + OUString::number( static_cast< sal_Int32 >(
eTabAlign) ) +
","
711 + OUString::number(
bWithTab ? 1 : 0 );
738 return sToken.subView(0, sToken.getLength()-1) + sData + sToken.subView(sToken.getLength()-1);
752 sal_Int32 & rTokenLen)
756 OUString sTokenStart;
757 sal_Int16 nTokenLength;
759 }
const aTokenArr[] = {
772 for(
const auto &
i : aTokenArr)
776 rTokenLen =
i.nTokenLength;
781 SAL_WARN(
"sw.core",
"SwFormTokensHelper: invalid token");
796 sal_Int32 nEnd = sPattern.indexOf(
'>', nStt );
802 if ( nTextSeparatorFirst >= 0
803 && nTextSeparatorFirst + 1 < sPattern.getLength()
804 && nTextSeparatorFirst < nEnd)
807 nTextSeparatorFirst + 1 );
809 if( nEnd < nTextSeparatorSecond )
810 nEnd = sPattern.indexOf(
'>', nTextSeparatorSecond );
817 return sPattern.copy( nStt, nEnd - nStt );
831 static std::optional<SwFormToken>
835 nCurPatternPos += sToken.getLength();
836 sal_Int32 nTokenLen = 0;
840 nCurPatternPos = sPattern.getLength();
841 return std::optional<SwFormToken>();
849 const OUString sAuthFieldEnum = sToken.copy( 2, 2 );
850 sToken = sToken.copy( nTokenLen, sToken.getLength() - nTokenLen - 1);
875 if( nStartText>=0 && nStartText+1<sToken.getLength())
881 eRet.
sText = sToken.copy( nStartText + 1,
882 nEndText - nStartText - 1);
907 eRet.
nAuthorityField = o3tl::narrowing<sal_uInt16>(sAuthFieldEnum.toInt32());
916 sal_Int32 nCurPatternPos = 0;
918 while (nCurPatternPos < rPattern.getLength())
920 std::optional<SwFormToken>
const oToken(
931 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
937 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
945 OSL_ENSURE(nLevel <
GetFormMax(),
"Index >= FORM_MAX");
const TranslateId STR_POOLCOLL_TOX_USER_EXTRA_ARY[]
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)
const TranslateId STR_POOLCOLL_TOX_USER_ARY[]
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)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
const SwTOXType * InsertTOXType(const SwTOXType &rTyp)
const TranslateId STR_POOLCOLL_TOX_CNTNT_ARY[]
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
SAL_DLLPRIVATE void SetXTOXMark(css::uno::Reference< css::text::XDocumentIndexMark > const &xMark)
void SetTitle(const OUString &rTitle)
#define TOX_STYLE_DELIMITER
constexpr sal_uInt8 MAXLEVEL
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
union SwTOXBase::@30 m_aData
Dialog to specify the properties of date form field.
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
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
OUString SwResId(TranslateId aId)
const TranslateId STR_POOLCOLL_TOX_ARY[]
const SwTOXType * GetTOXType() const
SwTOXElement m_nCreateType
void RegisterToTOXType(SwTOXType &rMark)
sal_Int32 GetStart() const
OUString maMSTOCExpression
SvxTabAdjust & GetAdjustment()
static FormTokenType lcl_GetTokenType(std::u16string_view sToken, sal_Int32 &rTokenLen)
Returns the type of a token.
#define SAL_N_ELEMENTS(arr)
virtual const sal_Int32 * GetEnd() const override
end position
const TranslateId STR_POOLCOLL_TOX_AUTHORITIES_ARY[]
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
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual ~SwTOXBase() override
const TranslateId STR_POOLCOLL_TOX_CITATION_ARY[]
OUString m_sSortAlgorithm
const sal_Unicode C_END_PAGE_NUM
void CopyTOXBase(SwDoc *, const SwTOXBase &)
const SwTOXTypes & GetTOXTypes() const
const TranslateId STR_POOLCOLL_TOX_OBJECT_ARY[]
SwTOXBase & operator=(const SwTOXBase &rSource)
SvtBroadcaster & GetNotifier()
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
bool IsCopyIsMove() const
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
LanguageType GetAppLanguage()
const SwTOXType * m_pType
const SwModify * GetRegisteredIn() const
OUString m_sMainEntryCharStyle
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)
const TranslateId STR_POOLCOLL_TOX_ILLUS_ARY[]
#define SAL_WARN(area, stream)
const TranslateId STR_POOLCOLL_TOX_CNTNT_EXTRA_ARY[]
const SwTextTOXMark * GetTextTOXMark() const
const EnumerationType m_eType
virtual SwTOXMark * Clone(SfxItemPool *pPool=nullptr) const override
const OUString & GetTOXName() const
const TranslateId STR_POOLCOLL_TOX_TABLES_ARY[]
bool m_bDetectedRangeSegmentation false