support setting writer comment contents from simple-html
Change-Id: I42002c1b1ade940603ca6d2ca0f6072f1672cce8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174471 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
parent
71293e4c19
commit
6d94b7988f
6 changed files with 40 additions and 12 deletions
|
@ -1070,8 +1070,10 @@ class XFillGradientItem;
|
|||
#define SID_ATTR_BULLET_FONT TypedWhichId<SfxStringItem>(SID_SVX_START + 1213)
|
||||
#define SID_ATTR_BULLET_INDEX TypedWhichId<SfxUInt16Item>(SID_SVX_START + 1214)
|
||||
|
||||
#define SID_ATTR_POSTIT_HTML TypedWhichId<SvxPostItTextItem>( SID_SVX_START + 1215 )
|
||||
|
||||
// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
|
||||
#define SID_SVX_FIRSTFREE ( SID_SVX_START + 1214 + 1 )
|
||||
#define SID_SVX_FIRSTFREE ( SID_SVX_START + 1215 + 1 )
|
||||
|
||||
|
||||
// Overflow check for slot IDs
|
||||
|
|
|
@ -4684,7 +4684,10 @@ SfxVoidItem InPlaceObjectResize SID_OBJECTRESIZE
|
|||
|
||||
|
||||
SfxVoidItem InsertAnnotation SID_INSERT_POSTIT
|
||||
(SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,SvxPostItDateItem Date SID_ATTR_POSTIT_DATE,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
|
||||
(SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,
|
||||
SvxPostItDateItem Date SID_ATTR_POSTIT_DATE,
|
||||
SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT,
|
||||
SvxPostItTextItem Html SID_ATTR_POSTIT_HTML)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
|
@ -4705,6 +4708,7 @@ SfxVoidItem EditAnnotation SID_EDIT_POSTIT
|
|||
SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,
|
||||
SvxPostItDateItem Date SID_ATTR_POSTIT_DATE,
|
||||
SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT,
|
||||
SvxPostItTextItem Html SID_ATTR_POSTIT_HTML,
|
||||
SfxInt32Item PositionX SID_ATTR_POSTIT_POSITION_X
|
||||
SfxInt32Item PositionY SID_ATTR_POSTIT_POSITION_Y)
|
||||
[
|
||||
|
@ -4758,7 +4762,9 @@ SfxVoidItem ShowResolvedAnnotations SID_TOGGLE_RESOLVED_NOTES
|
|||
|
||||
|
||||
SfxVoidItem ReplyToAnnotation SID_REPLYTO_POSTIT
|
||||
(SvxPostItIdItem Id SID_ATTR_POSTIT_ID,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
|
||||
(SvxPostItIdItem Id SID_ATTR_POSTIT_ID,
|
||||
SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT,
|
||||
SvxPostItTextItem Html SID_ATTR_POSTIT_HTML)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
|
|
|
@ -72,7 +72,8 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow
|
|||
void GotoPos();
|
||||
const SwPostItField* GetPostItField() const { return mpField; }
|
||||
SwFormatField* GetFormatField() const { return mpFormatField; }
|
||||
void UpdateText(const OUString& aText);
|
||||
void UpdateText(const OUString& rText);
|
||||
void UpdateHTML(const OUString& rHtml);
|
||||
|
||||
OUString GetAuthor() const;
|
||||
Date GetDate() const;
|
||||
|
|
|
@ -2519,7 +2519,10 @@ SfxVoidItem IndexMarkToIndex FN_IDX_MARK_TO_IDX
|
|||
]
|
||||
|
||||
SfxVoidItem InsertAnnotation FN_POSTIT
|
||||
(SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT,SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,SvxPostItDateItem Date SID_ATTR_POSTIT_DATE)
|
||||
(SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT,
|
||||
SvxPostItTextItem Html SID_ATTR_POSTIT_HTML,
|
||||
SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,
|
||||
SvxPostItDateItem Date SID_ATTR_POSTIT_DATE)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
|
@ -7684,7 +7687,9 @@ SfxBoolItem SelectionModeDefault FN_SELECTION_MODE_DEFAULT
|
|||
]
|
||||
|
||||
SfxVoidItem ReplyComment FN_REPLY
|
||||
(SvxPostItIdItem Id SID_ATTR_POSTIT_ID,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
|
||||
(SvxPostItIdItem Id SID_ATTR_POSTIT_ID,
|
||||
SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT,
|
||||
SvxPostItTextItem Html SID_ATTR_POSTIT_HTML)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
|
|
|
@ -484,6 +484,16 @@ void SwAnnotationWin::UpdateText(const OUString& aText)
|
|||
UpdateData();
|
||||
}
|
||||
|
||||
void SwAnnotationWin::UpdateHTML(const OUString& rHtml)
|
||||
{
|
||||
mpOutliner->Clear();
|
||||
OString sHtmlContent(rHtml.toUtf8());
|
||||
SvMemoryStream aHTMLStream(const_cast<char*>(sHtmlContent.getStr()),
|
||||
sHtmlContent.getLength(), StreamMode::READ);
|
||||
GetOutlinerView()->Read(aHTMLStream, EETextFormat::Html, nullptr);
|
||||
UpdateData();
|
||||
}
|
||||
|
||||
bool SwAnnotationWin::IsReadOnlyOrProtected() const
|
||||
{
|
||||
return mbReadonly ||
|
||||
|
|
|
@ -533,15 +533,19 @@ void SwTextShell::ExecField(SfxRequest &rReq)
|
|||
const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
|
||||
if (pIdItem && !pIdItem->GetValue().isEmpty())
|
||||
{
|
||||
const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
|
||||
OUString sText;
|
||||
if ( pTextItem )
|
||||
sText = pTextItem->GetValue();
|
||||
|
||||
sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
|
||||
if (pAnnotationWin && lcl_canUserModifyAnnotation(GetView(), pAnnotationWin))
|
||||
{
|
||||
pAnnotationWin->UpdateText(sText);
|
||||
if (const SvxPostItTextItem* pHtmlItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_HTML))
|
||||
pAnnotationWin->UpdateHTML(pHtmlItem->GetValue());
|
||||
else
|
||||
{
|
||||
const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
|
||||
OUString sText;
|
||||
if (pTextItem)
|
||||
sText = pTextItem->GetValue();
|
||||
pAnnotationWin->UpdateText(sText);
|
||||
}
|
||||
|
||||
// explicit state update to get the Undo state right
|
||||
GetView().AttrChangedNotify(nullptr);
|
||||
|
|
Loading…
Reference in a new issue