30#include <osl/diagnose.h>
54#include <com/sun/star/document/XDocumentProperties.hpp>
55#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
59#include <LibreOfficeKit/LibreOfficeKitEnums.h>
76 bool bDeleted =
false;
77 std::optional<SwPaM> pAnnotationTextRange;
80 pAnnotationTextRange.emplace(*pAnnotationRange->
Start(), *pAnnotationRange->
End());
100 pAnnotationTextRange.emplace( rStartPos, rEndPos );
106 pAnnotationTextRange.emplace( *rCurrPaM.
GetPoint(), *rCurrPaM.
GetMark() );
118 if ( pAnnotationTextRange )
120 if (
GetDoc() !=
nullptr )
123 if (*rCurrPaM.
Start() == *pAnnotationTextRange->Start()
124 && *rCurrPaM.
End() == *pAnnotationTextRange->End())
129 if (pAnnotationTextRange->Start()->GetContentIndex() > 0)
130 pAnnotationTextRange->Start()->AdjustContent(-1);
135 pAnnotationTextRange.reset();
149 std::unique_ptr<SwInputFieldList> pTmp;
156 const size_t nCnt = pLst->
Count();
162 bool bCancel =
false;
170 for (
size_t i = 0;
i < nCnt;
i++)
183 bool bNext =
nIndex < nCnt - 1;
221 : mpInputFieldDlg(pInputFieldDlg)
222 , mpFormatField(nullptr)
227 if (pInputField && pInputField->GetFormatField())
229 mpFormatField = pInputField->GetFormatField();
231 else if (pSetExpField && pSetExpField->GetFormatField())
233 mpFormatField = pSetExpField->GetFormatField();
241 virtual ~FieldDeletionListener()
override
250 if(rHint.
GetId() == SfxHintId::Dying)
252 mpFormatField =
nullptr;
253 mpInputFieldDlg->EndDialog(RET_CANCEL);
274 FieldDeletionListener aModify(pDlg.
get(), pField);
280 if (pDlg->PrevButtonPressed())
282 else if (pDlg->NextButtonPressed())
296 const short nRet = pDlg->Execute();
300 if (pDlg->PrevButtonPressed())
302 else if (pDlg->NextButtonPressed())
363 sal_uInt16 nSlotId = 0;
375 case JE_FMT_OLE: nSlotId = SID_INSERT_OBJECT;
break;
385 SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
394 const OUString sText( rField.
GetPar2() );
395 OUString sRet( sText );
402 const_cast<SwField&
>(rField).SetPar2( sRet );
411 if (!bExecHyperlinks)
418 targetType == SwAuthorityField::TargetType::UseDisplayURL
419 || targetType == SwAuthorityField::TargetType::UseTargetURL)
423 rURL.getLength() > 0)
426 else if (targetType == SwAuthorityField::TargetType::BibliographyTableRow)
442 while ((pIteratedTOX =
GetCurTOX()) !=
nullptr
445 if (pIteratedTOX != pPreviousTOX)
450 && (
GetCursor()->GetPoint()->
GetNode().FindSectionNode()->GetSection().GetType()
452 &&
static_cast<const SwTextNode*
>(&rCurrentNode)->GetText() == vFieldText)
460 pPreviousTOX = pIteratedTOX;
472 if (!bExecHyperlinks)
485 if ( pInputField ==
nullptr )
493 if(
static_cast<const SwSetExpField&
>(rField).GetInputFlag() )
520 aCallEvent.
Set( &rItem );
540 OUString sTargetFrameName;
542 if( pFnd && !sURL.isEmpty() )
550 ::LoadURL(*
this, sURL, nFilter, sTargetFrameName);
556 const OUString& rTargetFrameName )
558 OSL_ENSURE( !rURL.isEmpty(),
"what should be loaded here?" );
578 OSL_ENSURE( pDShell,
"No DocShell?!");
579 OUString sTargetFrame(rTargetFrameName);
580 if (sTargetFrame.isEmpty() && pDShell)
583 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
584 pDShell->
GetModel(), uno::UNO_QUERY_THROW);
585 uno::Reference<document::XDocumentProperties> xDocProps
586 = xDPS->getDocumentProperties();
587 sTargetFrame = xDocProps->getDefaultTarget();
596 SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame );
604 aTargetFrameName.
SetValue(
"_blank" );
610 &aView, &aTargetFrameName,
616 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD );
620 const sal_uInt16 nAction )
625 OUString sURL = rBkmk.
GetURL();
632 if (sURL.startsWith(rName))
634 if (sURL.getLength()>rName.getLength())
636 sURL = sURL.copy(rName.getLength());
void SetValue(const OUString &rTheValue)
Provides access to the marks of a document.
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
OUString GetURLNoMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
const OUString & GetURL() const
const OUString & GetDescription() const
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SfxBindings * GetBindings() const
const INetURLObject & GetURLObject() const
const OUString & GetName() const
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
SfxDispatcher * GetDispatcher()
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
SfxViewFrame & GetViewFrame() const
virtual void Notify(const SfxHint &rHint)
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual VclPtr< AbstractFieldInputDlg > CreateFieldInputDlg(weld::Widget *pParent, SwWrtShell &rSh, SwField *pField, bool bPrevButton, bool bNextButton)=0
virtual VclPtr< AbstractDropDownFieldDialog > CreateDropDownFieldDialog(weld::Widget *pParent, SwWrtShell &rSh, SwField *pField, bool bPrevButton, bool bNextButton)=0
static SwAbstractDialogFactory * Create()
Represents an inserted bibliography entry, created using Insert -> Table of Contents and Index -> Bib...
TargetType GetTargetType() const
Returns which target should be used when the entry (the standalone field, such as '[ASDF]',...
OUString GetAbsoluteURL() const
Returns absolute target URL in case there is one (GetTargetType() should be checked).
OUString GetAuthority(const SwRootFrame *pLayout, const SwForm *pTOX=nullptr) const
Returns the line matching the source's default row in the ToX.
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
const SwPaM * GetTableCrs() const
SwShellCursor * GetCursor_()
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
sal_uInt16 CallEvent(SvMacroItemId nEvent, const SwCallMouseEvent &rCallEvent, bool bChkPtr=false)
IDocumentMarkAccess * getIDocumentMarkAccess()
bool InsertField(SwField const &, const bool bForceExpandHints)
add a field at the cursor position
const SwTOXBase * GetCurTOX() const
Get current listing before or at the Cursor.
void StartAllAction()
For all views of this document.
SwSection const * InsertSection(SwSectionData &rNewData, SfxItemSet const *const =nullptr)
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Insert content table. Renew if required.
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr)
void UpdateTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
update tables of content
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
size_t GetSectionFormatPos(const SwSectionFormat &) const
void DoUndo(bool bOn=true)
Undo.
const SwFrameFormat * IsURLGrfAtPos(const Point &rPt, OUString *pURL=nullptr, OUString *pTargetFrameName=nullptr, OUString *pURLDescription=nullptr) const
Position is a graphic with URL?
virtual void UpdateFields()
Base class of all fields.
bool IsClickable() const
Is this field clickable?
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
virtual OUString GetDescription() const
SwFieldType * GetTyp() const
virtual OUString GetPar2() const
SvxMacro GetSvxMacro() const
Base class of the Writer document model elements.
SwNodeType GetNodeType() const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
void AddRule(SwUndoArg eWhat, const OUString &rWith)
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
void SetType(SectionType const eNew)
void SetLinkFileName(OUString const &rNew)
SwSectionFormat * GetFormat()
const Point & GetPtPos() const
const SwForm & GetTOXForm() const
SwTextAttr subclass that tracks the location of the wrapped SwFormatURL.
SwTextNode is a paragraph in the document model.
bool IsViewLocked() const
SwRootFrame * GetLayout() const
vcl::Window * GetWin() const
SfxViewShell * GetSfxViewShell() const
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
void ClickToField(const SwField &rField, bool bExecHyperlinks)
bool ClickToINetGrf(const Point &rDocPt, LoadUrlFlags nFilter)
bool Right(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
bool GotoNextTOXBase(const OUString *pName=nullptr)
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
void addCurrentPosition()
bool GotoPage(sal_uInt16 nPage, bool bRecord)
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
SAL_DLLPRIVATE tools::Long SetCursor(const Point *, bool bProp=false)
void UpdateInputFields(SwInputFieldList *pLst=nullptr)
void EndPara(bool bSelect=false)
void UpdateTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
void NavigatorPaste(const NaviContentBookmark &rBkmk, const sal_uInt16 nAction)
bool DelRight(bool isReplaceHeuristic=false)
bool HasSelection() const
bool InsertField2(SwField const &, SwPaM *pAnnotationRange=nullptr)
bool StartDropDownFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
void ClickToINetAttr(const SwFormatINetFormat &rItem, LoadUrlFlags nFilter=LoadUrlFlags::NONE)
const SwView & GetView() const
reference_type * get() const
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define EXCHG_IN_ACTION_COPY
#define EXCHG_IN_ACTION_MOVE
static SwContentNode * GetContentNode(SwDoc &rDoc, SwPosition &rPos, bool bNext)
#define SAL_WARN_IF(condition, area, stream)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
const sal_Unicode cTokenSeparator
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
void Set(SwCallEventObjectType eTyp, const SwFrameFormat *pFormat)
Marks a position in the document model.
void LoadURL(SwViewShell &rVSh, const OUString &rURL, LoadUrlFlags nFilter, const OUString &rTargetFrameName)