38 #include <osl/diagnose.h>
51 #include <strings.hrc>
64 #include <officecfg/Office/Compatibility.hxx>
72 const OUString sTitle(
SwResId(STR_REDLINE_COMMENT));
77 case RedlineType::Insert:
78 pResId = STR_REDLINE_INSERTED;
80 case RedlineType::Delete:
81 pResId = STR_REDLINE_DELETED;
83 case RedlineType::Format:
84 case RedlineType::ParagraphFormat:
85 pResId = STR_REDLINE_FORMATTED;
87 case RedlineType::Table:
88 pResId = STR_REDLINE_TABLECHG;
90 case RedlineType::FmtColl:
91 pResId = STR_REDLINE_FMTCOLLSET;
97 return sTitle +
SwResId(pResId);
105 sal_uInt16 nSlot = rReq.
GetSlot();
113 sal_uInt16 nInsertSubType = 0;
114 sal_uInt32 nInsertFormat = 0;
153 const OUString& rMacro =
static_cast<SwMacroField*
>(pField)->GetMacro();
154 sal_Int32
nPos = rMacro.indexOf(
'.');
170 if ( pField !=
nullptr
175 bAddSetExpressionFields ) )
213 sal_uInt32 nFormat = 0;
217 sal_Int32 nCommand = 0;
221 nType = static_cast<SwFieldTypesEnum>(pFieldItem->GetValue());
224 FN_PARAM_1,
false, &pItem ))
229 FN_PARAM_3,
false, &pItem ))
230 nCommand = static_cast<const SfxInt32Item*>(pItem)->GetValue();
232 + OUString::number(nCommand)
235 FN_PARAM_2,
false, &pItem ))
240 FN_PARAM_FIELD_CONTENT,
false ))
241 aPar2 = pContentItem->GetValue();
244 nFormat = pFormatItem->GetValue();
245 OSL_FAIL(
"Command is not yet used");
258 sal_uInt32 nFormat = 0;
260 sal_uInt16 nSubType = 0;
267 nType = static_cast<SwFieldTypesEnum>(pTypeItem->GetValue());
270 nSubType = pSubtypeItem->GetValue();
272 FN_PARAM_FIELD_CONTENT,
false ))
273 aPar2 = pContentItem->GetValue();
276 nFormat = pFormatItem->GetValue();
278 FN_PARAM_3,
false, &pItem ))
282 cSeparator = sTmp[0];
290 if(!GetView().GetViewFrame()->IsInModalMode())
311 sal_uInt16
nId = SwFieldDlgWrapper::GetChildWindowId();
321 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
323 GetView().GetPostItMgr()->Delete(pIdItem->GetValue().toUInt32());
325 else if ( GetView().GetPostItMgr() &&
326 GetView().GetPostItMgr()->HasActiveSidebarWin() )
328 GetView().GetPostItMgr()->DeleteActiveSidebarWin();
335 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
337 GetView().GetPostItMgr()->DeleteCommentThread(pIdItem->GetValue().toUInt32());
339 else if ( GetView().GetPostItMgr() &&
340 GetView().GetPostItMgr()->HasActiveSidebarWin() )
342 GetView().GetPostItMgr()->DeleteActiveSidebarWin();
349 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
351 GetView().GetPostItMgr()->ToggleResolved(pIdItem->GetValue().toUInt32());
358 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
360 GetView().GetPostItMgr()->ToggleResolvedForThread(pIdItem->GetValue().toUInt32());
365 if ( GetView().GetPostItMgr() )
366 GetView().GetPostItMgr()->Delete();
370 SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
378 if ( pNoteItem && GetView().GetPostItMgr() )
379 GetView().GetPostItMgr()->Delete( pNoteItem->
GetValue() );
383 if ( GetView().GetPostItMgr() &&
384 GetView().GetPostItMgr()->HasActiveSidebarWin() )
386 GetView().GetPostItMgr()->HideActiveSidebarWin();
390 if ( GetView().GetPostItMgr() )
391 GetView().GetPostItMgr()->Hide();
396 if ( pNoteItem && GetView().GetPostItMgr() )
397 GetView().GetPostItMgr()->Hide( pNoteItem->
GetValue() );
403 if (pIdItem && !pIdItem->GetValue().isEmpty())
408 auto pMgr = GetView().GetPostItMgr();
409 auto pWin = pMgr->GetAnnotationWin(pIdItem->GetValue().toUInt32());
414 sText = pTextItem->GetValue();
415 pMgr->RegisterAnswerText(sText);
416 pWin->ExecuteCommand(nSlot);
427 case SID_EDIT_POSTIT:
430 if (pIdItem && !pIdItem->GetValue().isEmpty())
435 sText = pTextItem->GetValue();
443 GetView().AttrChangedNotify(
nullptr);
467 if (pArgs && pArgs->
GetItemState(nSlot,
false, &pItem) == SfxItemState::SET)
473 if (nChangeId == rRedlineTable[nRedline]->
GetId())
478 OUString sCommentText;
481 sCommentText = pTextItem->
GetValue();
490 GetView().AttrChangedNotify(
nullptr);
497 bool bTravel =
false;
507 SID_ATTR_POSTIT_DATE ));
515 if (pActRed == pRedline)
522 bool bPrev = pActRed !=
nullptr;
529 if (pActRed != pRedline)
535 bool bNext = pActRed !=
nullptr;
543 bTravel |= bNext || bPrev;
553 pDlg->EnableTravel(bNext, bPrev);
561 if ( pDlg->Execute() ==
RET_OK )
563 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
564 OUString sMsg(pOutSet->
Get(SID_ATTR_POSTIT_TEXT).GetValue());
571 pDlg.disposeAndClear();
572 g_bNoInterrupt =
false;
574 GetView().AttrChangedNotify(
nullptr);
581 OUString aType, aText;
584 bool bUpdate =
false;
594 bIsUrl = pIsUrl->GetValue();
598 bUpdate = pField && ( bIsUrl !=
static_cast<bool>(pField->
GetFormat()) || pField->
GetPar2() != aType || pField->
GetPar1() != aText );
604 if ( pDlg->Execute() )
606 aType = pDlg->GetScriptType();
607 aText = pDlg->GetScriptText();
608 bIsUrl = pDlg->IsUrl();
609 bNew = pDlg->IsNew();
610 bUpdate = pDlg->IsUpdate();
681 OUString(), OUString(), nInsertFormat);
695 static constexpr OUStringLiteral vEnSpaces =
u"\u2002\u2002\u2002\u2002\u2002";
762 sal_uInt32 nStandardFormat = pFormatter->
GetStandardFormat(SvNumFormatType::DATE);
775 OSL_FAIL(
"wrong dispatcher");
784 const SwField* pField =
nullptr;
785 bool bGetField =
false;
800 SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
809 if (!pPostItMgr || !pPostItMgr->
HasNotes())
829 !static_cast<SwDDEFieldType*>(pField->
GetTyp())->GetBaseLink().IsVisible())
903 bool bCurField =
false;
954 if ((!pFieldBM || pFieldBM->GetFieldname() !=
ODF_FORMTEXT)
955 && aCursorPos.nContent.GetIndex() > 0)
959 pFieldBM =
GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
961 if (pFieldBM && pFieldBM->GetFieldname() ==
ODF_FORMTEXT &&
962 (aCursorPos > pFieldBM->GetMarkStart() && aCursorPos < pFieldBM->GetMarkEnd() ))
976 const OUString& rName = rHlnkItem.
GetName();
977 const OUString& rURL = rHlnkItem.
GetURL();
1006 const SvxMacro *pMacro = pMacroTable->
Get( SvMacroItemId::OnMouseOver );
1008 aINetFormat.
SetMacro(SvMacroItemId::OnMouseOver, *pMacro);
1009 pMacro = pMacroTable->
Get( SvMacroItemId::OnClick );
1011 aINetFormat.
SetMacro(SvMacroItemId::OnClick, *pMacro);
1012 pMacro = pMacroTable->
Get( SvMacroItemId::OnMouseOut );
1014 aINetFormat.
SetMacro(SvMacroItemId::OnMouseOut, *pMacro);
1017 rSh.
InsertURL( aINetFormat, rName,
true );
1026 InsertURLButton( rURL, rTarget, rName );
1053 bool bEnable =
false;
1060 pSh->
Pop(SwCursorShell::PopMode::DeleteCurrent);
1064 rDlg.EnableTravel(bEnable,
true);
1072 rDlg.SetNote(sComment);
1098 bool bEnable =
false;
1105 pSh->
Pop(SwCursorShell::PopMode::DeleteCurrent);
1109 rDlg.EnableTravel(
true, bEnable);
1114 rDlg.SetNote(sComment);
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define FN_HIDE_ALL_NOTES
bool IsInModalMode() const
SfxViewFrame * GetViewFrame() const
#define LINK(Instance, Class, Member)
Instances of SwFields and those derived from it occur 0 to n times.
#define FN_INSERT_FLD_PGCOUNT
std::map< OUString, css::uno::Any > parameter_map_t
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Marks a position in the document model.
SfxChildWindow * GetChildWindow(sal_uInt16)
OUString const & GetAuthorString(sal_uInt16 nPos=0) const
sfx2::LinkManager & GetLinkManager()
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
const SwRangeRedline * SelNextRedline()
#define FN_REDLINE_COMMENT
bool IsCursorInFootnote() const
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
void SetUndoNoResetModified()
#define FN_INSERT_FLD_TITLE
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
IMPL_LINK(SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog &, rDlg, void)
const OUString & GetTargetFrame() const
static SvxAbstractDialogFactory * Create()
Base class of all fields.
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Provides access to the marks of a document.
void UpdateCurField(sal_uInt32 nFormat, const OUString &rPar1, const OUString &rPar2, std::unique_ptr< SwField > _pField=nullptr)
#define FN_INSERT_FLD_PGNUMBER
void InvalidateItem(sal_uInt16 nWhich)
constexpr OUStringLiteral ODF_FORMDATE
virtual VclPtr< SfxAbstractDialog > CreateSwFieldEditDlg(SwView &rVw)=0
#define FN_PARAM_FIELD_FORMAT
const SwRangeRedline * GotoRedline(SwRedlineTable::size_type nArrPos, bool bSelect)
void Done(bool bRemove=false)
IDocumentMarkAccess * getIDocumentMarkAccess()
IDocumentUndoRedo & GetIDocumentUndoRedo()
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
virtual VclPtr< AbstractSvxPostItDialog > CreateSvxPostItDialog(weld::Widget *pParent, const SfxItemSet &rCoreSet, bool bPrevNext=false)=0
virtual OUString GetPar1() const override
Type.
bool InsertField(const SwInsertField_Data &rData)
IDocumentContentOperations const & getIDocumentContentOperations() const
void InsertHyperlink(const SvxHyperlinkItem &rHlnkItem)
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
#define LANGUAGE_HUNGARIAN
static LanguageType nLang
virtual sal_uInt32 GetId() const override
Used by the UI to modify the document model.
void ToggleChildWindow(sal_uInt16)
OUString SwResId(TranslateId aId)
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
const SwView & GetView() const
#define FN_PARAM_FIELD_SUBTYPE
#define FN_FORMAT_ALL_NOTES
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
LineEnd GetSystemLineEnd()
const SwDocInfoSubType DI_SUBJECT
const SvxMacroTableDtor * GetMacroTable() const
sal_uInt32 GetDefaultFormat(SwFieldTypesEnum nTypeId, bool bIsText, SvNumberFormatter *pFormatter)
#define FN_DELETE_COMMENT
virtual parameter_map_t * GetParameters()=0
#define FN_GOTO_PREV_INPUTFLD
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
const SwRedlineData & GetRedlineData(sal_uInt16 nPos=0) const
#define FN_INSERT_FIELD_DATA_ONLY
constexpr OUStringLiteral aData
#define FN_INSERT_FLD_DATE
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
PaM is Point and Mark: a selection of the document model.
void ExecField(SfxRequest &rReq)
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual VclPtr< AbstractJavaEditDialog > CreateJavaEditDialog(weld::Window *pParent, SwWrtShell *pWrtSh)=0
const OUString & GetURL() const
bool HasSelection() const
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
static OUString lcl_BuildTitleWithRedline(const SwRangeRedline *pRedline)
bool SetRedlineComment(const OUString &rS)
Set comment to Redline at position.
const SwPosition * GetPoint() const
#define FN_INSERT_CHECKBOX_FORMFIELD
#define FN_DELETE_NOTE_AUTHOR
void Push()
store a copy of the current cursor on the cursor stack
const SwRangeRedline * SelPrevRedline()
#define FN_GOTO_NEXT_INPUTFLD
#define FN_INSERT_TEXT_FORMFIELD
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
SfxBindings & GetBindings()
constexpr OUStringLiteral ODF_FORMTEXT
const SwDocInfoSubType DI_CREATE
SwFieldTypesEnum
List of FieldTypes at UI.
vector_type::size_type size_type
const OUString & GetValue() const
const T * GetArg(sal_uInt16 nSlotId) const
#define FN_HIDE_NOTE_AUTHOR
#define FN_INSERT_FLD_TIME
const DateTime & GetTimeStamp() const
virtual OUString GetPar2() const override
Text.
void UpdateText(const OUString &aText)
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
#define FN_DELETE_COMMENT_THREAD
static SwAbstractDialogFactory * Create()
#define FN_EXECUTE_MACROFIELD
virtual sw::mark::IFieldmark * makeFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType, SwPosition const *pSepPos=nullptr)=0
#define FN_INSERT_DBFIELD
bool HasReadonlySel() const
#define ODF_FORMFIELD_DEFAULT_LENGTH
virtual sw::mark::IFieldmark * makeNoTextFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType)=0
constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT_LANGUAGE
static sal_Int32 EndOfInputFieldAtPos(const SwPosition &rPos)
const SwPosition * Start() const
SwFieldType * GetTyp() const
SW_DLLPUBLIC bool HasActiveSidebarWin() const
const SwDocInfoSubType DI_SUB_AUTHOR
virtual DialogGetRanges GetDialogGetRangesFunc()=0
const OUString & GetComment(sal_uInt16 nPos=0) const
void ExecuteFormatAllDialog(SwView &rView)
void SetReturnValue(const SfxPoolItem &)
const SwRangeRedline * GetCurrRedline() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define FN_INSERT_REF_FIELD
SwFieldTypesEnum GetTypeId() const
sal_uInt16 GetSlot() const
bool IsMultiSelection() const
bool HasChildWindow(sal_uInt16)
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
bool IsReadOnlyAvailable() const
SwFormatField * FindFormatForPostItId(sal_uInt32 nPostItId) const
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
const SvxMacro * Get(SvMacroItemId nEvent) const
void DisableItem(sal_uInt16 nWhich)
#define FN_INSERT_DROPDOWN_FORMFIELD
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SwViewOption * GetViewOptions() const
constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT
static sal_Int32 StartOfInputFieldAtPos(const SwPosition &rPos)
bool IsCursorPtAtEnd() const
#define FN_PARAM_FIELD_TYPE
sal_Int32 GetIndex() const
bool KnowsChildWindow(sal_uInt16)
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
RedlineType GetType(sal_uInt16 nPos=0) const
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
bool SelectTextModel(sal_Int32 nStart, sal_Int32 nEnd)
const OUString & GetName() const
SvxLinkInsertMode GetInsertMode() const
void AppendItem(const SfxPoolItem &)
constexpr OUStringLiteral ODF_FORMCHECKBOX
void StateField(SfxItemSet &)
#define FN_INSERT_FLD_AUTHOR
#define FN_INSERT_DATE_FORMFIELD
virtual const SwRedlineTable & GetRedlineTable() const =0
void MaybeNotifyRedlineModification(SwRangeRedline &rRedline, SwDoc &rDoc)
const SwDocInfoSubType DI_TITLE
SelectionType GetSelectionType() const
static SwTextField * GetTextFieldAtCursor(const SwPaM *pCursor, const bool bIncludeInputFieldAtStart)
#define FN_INSERT_FIELD_CTRL
constexpr OUStringLiteral ODF_FORMDROPDOWN
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
#define FN_INSERT_FLD_TOPIC
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
void EndAction(const bool bIdleEnd=false)
#define FN_RESOLVE_NOTE_THREAD
#define FN_DELETE_ALL_NOTES
const OUString & GetIntName() const
bool CursorInsideInputField() const