23 #include <osl/diagnose.h>
24 #include <osl/thread.h>
25 #include <rtl/ustrbuf.hxx>
54 virtual void Closed()
override;
55 virtual ::sfx2::SvBaseLink::UpdateResult
DataChanged(
56 const OUString& rMimeType,
const css::uno::Any & rValue )
override;
58 virtual const SwNode* GetAnchor()
const override;
69 case SotClipboardFormatId::STRING:
72 uno::Sequence< sal_Int8 >
aSeq;
74 OUString sStr( reinterpret_cast<char const *>(aSeq.getConstArray()), aSeq.getLength(), osl_getThreadTextEncoding() );
77 sal_Int32
n = sStr.getLength();
78 while( n && 0 == sStr[ n-1 ] )
80 if( n && 0x0a == sStr[ n-1 ] )
82 if( n && 0x0d == sStr[ n-1 ] )
85 bool bDel = n != sStr.getLength();
87 sStr = sStr.copy( 0, n );
89 m_rFieldType.SetExpansion(sStr);
91 m_rFieldType.SetCRLFDelFlag(bDel);
101 m_rFieldType.UpdateDDE();
106 void SwIntrnlRefLink::Closed()
108 if (m_rFieldType.GetDoc() && !m_rFieldType.GetDoc()->IsInDtor())
126 SvBaseLink::Closed();
131 const SwNode* SwIntrnlRefLink::GetAnchor()
const
134 const SwNode* pNd =
nullptr;
135 m_rFieldType.CallSwClientNotify(
142 bool bInRange =
false;
150 m_aName( rName ), m_pDoc( nullptr ), m_nRefCount( 0 )
153 m_RefLink =
new SwIntrnlRefLink( *
this, nUpdateType );
181 OUString
aStr = _aStr;
185 aStr = aStr.replaceFirst(
" ",
" ", &nIndex);
202 OSL_ENSURE( !
m_nRefCount,
"How do we get the references?" );
232 sal_Int32 nPart = -1;
239 rVal <<=
GetType() == SfxLinkUpdateMode::ALWAYS;
253 sal_Int32 nPart = -1;
260 SetType( *o3tl::doAccess<bool>(rVal) ?
261 SfxLinkUpdateMode::ALWAYS :
262 SfxLinkUpdateMode::ONCALL );
273 const OUString sOldCmd(
GetCmd() );
274 OUStringBuffer sNewCmd;
276 for (sal_Int32
i=0;
i<3; ++
i)
283 sNewCmd.append((
i < 2)
286 SetCmd( sNewCmd.makeStringAndClear() );
296 SwEditShell* pESh = bNotifyShells ? pDoc->GetEditShell() :
nullptr;
301 std::vector<SwFormatField*> vFields;
302 std::vector<SwDDETable*> vTables;
305 const bool bDoAction = vFields.size() || vTables.size();
316 for(
auto pFormatField: vFields)
318 if(pFormatField->GetTextField())
319 pFormatField->UpdateTextNode(
nullptr, &aUpdateDDE );
322 for(
auto pTable: vTables)
323 pTable->ChangeContent();
346 if(
GetTyp()->HasOnlyOneListener() )
353 aStr = aStr.replaceAll(
"\r",
"");
354 aStr = aStr.replaceAll(
"\t",
" ");
355 aStr = aStr.replaceAll(
"\n",
"|");
356 if (aStr.endsWith(
"|"))
358 return aStr.copy(0, aStr.getLength()-1);
Instances of SwFields and those derived from it occur 0 to n times.
virtual void SetPar2(const OUString &rStr) override
set field type command
void SetCmd(const OUString &aStr)
SwDDEFieldType(const OUString &rName, const OUString &rCmd, SfxLinkUpdateMode)
bool IsInRange(const WhichRangesContainer &pRange, const sal_uInt16 nId)
check if ID is in range of attribute set IDs
virtual ~SwDDEField() override
constexpr TypedWhichId< SwMsgPoolItem > RES_UPDATEDDETBL(171)
virtual void SetModified()=0
Must be called manually at changes of format.
const sal_Unicode cTokenSeparator
void SetType(SfxLinkUpdateMode nType)
Base class of all fields.
SfxLinkUpdateMode GetType() const
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
void SetLinkSourceName(const OUString &rName)
virtual ~LinkAnchorSearchHint() override
The root element of a Writer document layout.
#define FIELD_PROP_SUBTYPE
void GatherDdeTables(std::vector< SwDDETable * > &rvTables) const
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
OUString const & GetCmd() const
const SwDoc * GetDoc() const
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
SAL_DLLPRIVATE void RefCntChgd()
const OUString & GetLinkSourceName() const
virtual void PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual OUString GetName() const override
virtual std::unique_ptr< SwFieldType > Copy() const override
tools::SvRef< sfx2::SvBaseLink > m_RefLink
void Remove(SvBaseLink const *pLink)
SwEditShell const * GetEditShell() const
virtual OUString GetPar1() const override
Get parameter via types.
virtual OUString GetPar2() const override
get field type command
IDocumentState const & getIDocumentState() const
SwDDEField(SwDDEFieldType *)
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwFieldType * GetTyp() const
void EndAction(const bool bIdleEnd=false)
bool IsModifyLocked() const
void InsertDDELink(SvBaseLink *, const OUString &rServer, std::u16string_view rTopic, std::u16string_view rItem)
void FieldToText(SwFieldType const *pType)
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
static SotClipboardFormatId GetFormatIdFromMimeType(const OUString &rMimeType)
Sequence< sal_Int8 > aSeq
virtual sfx2::LinkManager & GetLinkManager()=0
virtual std::unique_ptr< SwField > Copy() const override
void UpdateDDE(const bool bNotifyShells=true)
virtual ~SwDDEFieldType() override
void StartAllAction()
For all views of this document.
virtual OUString GetName() const override
Only in derived classes.
virtual void QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual bool IsVisibleLinks() const =0
Insert links in-/visibly into LinkManager (linked ranges).
Base class of the Writer document model elements.
void SetVisible(bool bFlag)