lok: Allow to reply to comments using postit id
Change-Id: Ic6aaa3066923d62f197bc2b0e02e8049c9d7cd2c Reviewed-on: https://gerrit.libreoffice.org/33612 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
This commit is contained in:
@@ -1383,6 +1383,7 @@ static void doc_iniUnoCommands ()
|
|||||||
OUString(".uno:Paste"),
|
OUString(".uno:Paste"),
|
||||||
OUString(".uno:SelectAll"),
|
OUString(".uno:SelectAll"),
|
||||||
OUString(".uno:InsertAnnotation"),
|
OUString(".uno:InsertAnnotation"),
|
||||||
|
OUString(".uno:ReplyComment"),
|
||||||
OUString(".uno:InsertRowsBefore"),
|
OUString(".uno:InsertRowsBefore"),
|
||||||
OUString(".uno:InsertRowsAfter"),
|
OUString(".uno:InsertRowsAfter"),
|
||||||
OUString(".uno:InsertColumnsBefore"),
|
OUString(".uno:InsertColumnsBefore"),
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#ifndef INCLUDED_SVX_POSTATTR_HXX
|
#ifndef INCLUDED_SVX_POSTATTR_HXX
|
||||||
#define INCLUDED_SVX_POSTATTR_HXX
|
#define INCLUDED_SVX_POSTATTR_HXX
|
||||||
|
|
||||||
|
#include <svl/intitem.hxx>
|
||||||
#include <svl/stritem.hxx>
|
#include <svl/stritem.hxx>
|
||||||
#include <svx/svxdllapi.h>
|
#include <svx/svxdllapi.h>
|
||||||
|
|
||||||
@@ -112,6 +113,31 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// class SvxPostItIdItem -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
The internal id of a note
|
||||||
|
*/
|
||||||
|
|
||||||
|
class SVX_DLLPUBLIC SvxPostItIdItem: public SfxUInt32Item
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static SfxPoolItem* CreateDefault();
|
||||||
|
|
||||||
|
SvxPostItIdItem( sal_uInt16 nWhich );
|
||||||
|
|
||||||
|
SvxPostItIdItem( sal_uInt32 rId, sal_uInt16 nWhich );
|
||||||
|
|
||||||
|
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
|
||||||
|
|
||||||
|
inline SvxPostItIdItem& operator=( const SvxPostItIdItem& rId )
|
||||||
|
{
|
||||||
|
SetValue( rId.GetValue() );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -235,6 +235,7 @@
|
|||||||
#define SID_ATTR_POSTIT_AUTHOR ( SID_SVX_START + 44 )
|
#define SID_ATTR_POSTIT_AUTHOR ( SID_SVX_START + 44 )
|
||||||
#define SID_ATTR_POSTIT_DATE ( SID_SVX_START + 45 )
|
#define SID_ATTR_POSTIT_DATE ( SID_SVX_START + 45 )
|
||||||
#define SID_ATTR_POSTIT_TEXT ( SID_SVX_START + 46 )
|
#define SID_ATTR_POSTIT_TEXT ( SID_SVX_START + 46 )
|
||||||
|
#define SID_ATTR_POSTIT_ID ( SID_SVX_START + 47 )
|
||||||
// free
|
// free
|
||||||
|
|
||||||
// CAUTION! Range <48 .. 49> used by EditEngine (!)
|
// CAUTION! Range <48 .. 49> used by EditEngine (!)
|
||||||
|
@@ -223,6 +223,7 @@ item BYTE SvxPaperBinItem;
|
|||||||
item String SvxPostItAuthorItem;
|
item String SvxPostItAuthorItem;
|
||||||
item String SvxPostItDateItem;
|
item String SvxPostItDateItem;
|
||||||
item String SvxPostItTextItem;
|
item String SvxPostItTextItem;
|
||||||
|
item INT32 SvxPostItIdItem;
|
||||||
item FontItalic SvxPostureItem; // enum
|
item FontItalic SvxPostureItem; // enum
|
||||||
item BOOL SvxPrintItem;
|
item BOOL SvxPrintItem;
|
||||||
item UINT16 SvxPropSizeItem; // derived from UInt16Item
|
item UINT16 SvxPropSizeItem; // derived from UInt16Item
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
SfxPoolItem* SvxPostItAuthorItem::CreateDefault() { return new SvxPostItAuthorItem(0); }
|
SfxPoolItem* SvxPostItAuthorItem::CreateDefault() { return new SvxPostItAuthorItem(0); }
|
||||||
SfxPoolItem* SvxPostItDateItem::CreateDefault() { return new SvxPostItDateItem(0); }
|
SfxPoolItem* SvxPostItDateItem::CreateDefault() { return new SvxPostItDateItem(0); }
|
||||||
SfxPoolItem* SvxPostItTextItem::CreateDefault() { return new SvxPostItTextItem(0); }
|
SfxPoolItem* SvxPostItTextItem::CreateDefault() { return new SvxPostItTextItem(0); }
|
||||||
|
SfxPoolItem* SvxPostItIdItem::CreateDefault() { return new SvxPostItIdItem(0); }
|
||||||
|
|
||||||
SvxPostItAuthorItem::SvxPostItAuthorItem( sal_uInt16 _nWhich )
|
SvxPostItAuthorItem::SvxPostItAuthorItem( sal_uInt16 _nWhich )
|
||||||
{
|
{
|
||||||
@@ -144,4 +145,20 @@ SfxPoolItem* SvxPostItTextItem::Clone( SfxItemPool * ) const
|
|||||||
return new SvxPostItTextItem( *this );
|
return new SvxPostItTextItem( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SvxPostItIdItem::SvxPostItIdItem( sal_uInt16 _nWhich )
|
||||||
|
{
|
||||||
|
SetWhich( _nWhich );
|
||||||
|
}
|
||||||
|
|
||||||
|
SvxPostItIdItem::SvxPostItIdItem( sal_uInt32 rId, sal_uInt16 _nWhich ) :
|
||||||
|
SfxUInt32Item( _nWhich, rId )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SfxPoolItem* SvxPostItIdItem::Clone( SfxItemPool * ) const
|
||||||
|
{
|
||||||
|
return new SvxPostItIdItem( *this );
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -156,6 +156,7 @@ class SwPostItMgr: public SfxListener
|
|||||||
bool mbDeleteNote;
|
bool mbDeleteNote;
|
||||||
FieldShadowState mShadowState;
|
FieldShadowState mShadowState;
|
||||||
OutlinerParaObject* mpAnswer;
|
OutlinerParaObject* mpAnswer;
|
||||||
|
OUString maAnswerText;
|
||||||
bool mbIsShowAnchor;
|
bool mbIsShowAnchor;
|
||||||
|
|
||||||
// data structure to collect the <SwSidebarWin> instances for certain <SwFrame> instances.
|
// data structure to collect the <SwSidebarWin> instances for certain <SwFrame> instances.
|
||||||
@@ -237,6 +238,7 @@ class SwPostItMgr: public SfxListener
|
|||||||
Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const;
|
Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const;
|
||||||
|
|
||||||
sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pField) const;
|
sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pField) const;
|
||||||
|
sw::annotation::SwAnnotationWin* GetAnnotationWin(const sal_uInt32 nPostItId) const;
|
||||||
|
|
||||||
sw::sidebarwindows::SwSidebarWin* GetNextPostIt( sal_uInt16 aDirection,
|
sw::sidebarwindows::SwSidebarWin* GetNextPostIt( sal_uInt16 aDirection,
|
||||||
sw::sidebarwindows::SwSidebarWin* aPostIt);
|
sw::sidebarwindows::SwSidebarWin* aPostIt);
|
||||||
@@ -265,6 +267,8 @@ class SwPostItMgr: public SfxListener
|
|||||||
|
|
||||||
void RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;}
|
void RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;}
|
||||||
OutlinerParaObject* IsAnswer() {return mpAnswer;}
|
OutlinerParaObject* IsAnswer() {return mpAnswer;}
|
||||||
|
void RegisterAnswerText(const OUString& aAnswerText) { maAnswerText = aAnswerText; }
|
||||||
|
const OUString& GetAnswerText() { return maAnswerText; }
|
||||||
void CheckMetaText();
|
void CheckMetaText();
|
||||||
|
|
||||||
sal_uInt16 Replace(SvxSearchItem* pItem);
|
sal_uInt16 Replace(SvxSearchItem* pItem);
|
||||||
|
@@ -919,6 +919,11 @@ interface BaseText
|
|||||||
ExecMethod = ExecField ;
|
ExecMethod = ExecField ;
|
||||||
StateMethod = StateField;
|
StateMethod = StateField;
|
||||||
]
|
]
|
||||||
|
FN_REPLY
|
||||||
|
[
|
||||||
|
ExecMethod = ExecField;
|
||||||
|
StateMethod = StateField;
|
||||||
|
]
|
||||||
FN_DELETE_COMMENT
|
FN_DELETE_COMMENT
|
||||||
[
|
[
|
||||||
ExecMethod = ExecField ;
|
ExecMethod = ExecField ;
|
||||||
|
@@ -7063,7 +7063,7 @@ SfxBoolItem SelectionModeDefault FN_SELECTION_MODE_DEFAULT
|
|||||||
]
|
]
|
||||||
|
|
||||||
SfxVoidItem ReplyComment FN_REPLY
|
SfxVoidItem ReplyComment FN_REPLY
|
||||||
()
|
(SvxPostItIdItem Id SID_ATTR_POSTIT_ID,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
|
||||||
[
|
[
|
||||||
AutoUpdate = FALSE,
|
AutoUpdate = FALSE,
|
||||||
FastCall = FALSE,
|
FastCall = FALSE,
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include <editeng/editeng.hxx>
|
#include <editeng/editeng.hxx>
|
||||||
#include <editeng/editobj.hxx>
|
#include <editeng/editobj.hxx>
|
||||||
|
|
||||||
|
#include <comphelper/lok.hxx>
|
||||||
#include <docufld.hxx>
|
#include <docufld.hxx>
|
||||||
#include <txtfld.hxx>
|
#include <txtfld.hxx>
|
||||||
#include <ndtxt.hxx>
|
#include <ndtxt.hxx>
|
||||||
@@ -240,6 +241,10 @@ VclPtr<MenuButton> SwAnnotationWin::CreateMenuButton()
|
|||||||
|
|
||||||
void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
|
void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
|
||||||
{
|
{
|
||||||
|
// If tiled annotations is off in lok case, skip adding additional reply text.
|
||||||
|
if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isTiledAnnotations())
|
||||||
|
return;
|
||||||
|
|
||||||
//collect our old meta data
|
//collect our old meta data
|
||||||
SwSidebarWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
|
SwSidebarWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
|
||||||
const SvtSysLocale aSysLocale;
|
const SvtSysLocale aSysLocale;
|
||||||
|
@@ -1624,6 +1624,16 @@ sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItFie
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const sal_uInt32 nPostItId) const
|
||||||
|
{
|
||||||
|
for(const_iterator i = mvPostItFields.begin(); i != mvPostItFields.end() ; ++i)
|
||||||
|
{
|
||||||
|
if ( static_cast<const SwPostItField*>((*i)->GetFormatField().GetField())->GetPostItId() == nPostItId )
|
||||||
|
return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt.get());
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
SwSidebarWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
|
SwSidebarWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
|
||||||
SwSidebarWin* aPostIt )
|
SwSidebarWin* aPostIt )
|
||||||
{
|
{
|
||||||
|
@@ -56,6 +56,7 @@
|
|||||||
#include <editeng/contouritem.hxx>
|
#include <editeng/contouritem.hxx>
|
||||||
#include <editeng/postitem.hxx>
|
#include <editeng/postitem.hxx>
|
||||||
#include <editeng/frmdiritem.hxx>
|
#include <editeng/frmdiritem.hxx>
|
||||||
|
#include <svx/postattr.hxx>
|
||||||
#include <svx/svdoutl.hxx>
|
#include <svx/svdoutl.hxx>
|
||||||
#include <svl/whiter.hxx>
|
#include <svl/whiter.hxx>
|
||||||
#include <svl/cjkoptions.hxx>
|
#include <svl/cjkoptions.hxx>
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AnnotationWin.hxx>
|
||||||
#include <comphelper/lok.hxx>
|
#include <comphelper/lok.hxx>
|
||||||
#include <chrdlgmodes.hxx>
|
#include <chrdlgmodes.hxx>
|
||||||
#include <hintids.hxx>
|
#include <hintids.hxx>
|
||||||
@@ -369,6 +370,37 @@ void SwTextShell::ExecField(SfxRequest &rReq)
|
|||||||
GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
|
GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case FN_REPLY:
|
||||||
|
{
|
||||||
|
const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
|
||||||
|
if (pIdItem && pIdItem->GetValue())
|
||||||
|
{
|
||||||
|
SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_POSTITFLD, OUString(), false);
|
||||||
|
SwIterator<SwFormatField,SwFieldType> aIter( *pType );
|
||||||
|
SwFormatField* pSwFormatField = aIter.First();
|
||||||
|
while( pSwFormatField )
|
||||||
|
{
|
||||||
|
if ( static_cast<SwPostItField*>(pSwFormatField->GetField())->GetPostItId() == pIdItem->GetValue())
|
||||||
|
{
|
||||||
|
sw::annotation::SwAnnotationWin* pWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue());
|
||||||
|
if (pWin)
|
||||||
|
{
|
||||||
|
const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
|
||||||
|
OUString sText;
|
||||||
|
if ( pTextItem )
|
||||||
|
sText = pTextItem->GetValue();
|
||||||
|
|
||||||
|
GetView().GetPostItMgr()->RegisterAnswerText(sText);
|
||||||
|
pWin->ExecuteCommand(nSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pSwFormatField = aIter.Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case FN_POSTIT:
|
case FN_POSTIT:
|
||||||
{
|
{
|
||||||
SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(aFieldMgr.GetCurField());
|
SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(aFieldMgr.GetCurField());
|
||||||
@@ -390,6 +422,13 @@ void SwTextShell::ExecField(SfxRequest &rReq)
|
|||||||
if ( pTextItem )
|
if ( pTextItem )
|
||||||
sText = pTextItem->GetValue();
|
sText = pTextItem->GetValue();
|
||||||
|
|
||||||
|
// If we have a text already registered for answer, use that
|
||||||
|
if (GetView().GetPostItMgr()->IsAnswer() && !GetView().GetPostItMgr()->GetAnswerText().isEmpty())
|
||||||
|
{
|
||||||
|
sText = GetView().GetPostItMgr()->GetAnswerText();
|
||||||
|
GetView().GetPostItMgr()->RegisterAnswerText(OUString());
|
||||||
|
}
|
||||||
|
|
||||||
if ( rSh.HasSelection() && !rSh.IsTableMode() )
|
if ( rSh.HasSelection() && !rSh.IsTableMode() )
|
||||||
{
|
{
|
||||||
rSh.KillPams();
|
rSh.KillPams();
|
||||||
@@ -753,12 +792,13 @@ void SwTextShell::StateField( SfxItemSet &rSet )
|
|||||||
rSet.DisableItem(nWhich);
|
rSet.DisableItem(nWhich);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FN_REPLY:
|
||||||
case FN_POSTIT :
|
case FN_POSTIT :
|
||||||
case FN_JAVAEDIT :
|
case FN_JAVAEDIT :
|
||||||
{
|
{
|
||||||
bool bCurField = false;
|
bool bCurField = false;
|
||||||
pField = rSh.GetCurField();
|
pField = rSh.GetCurField();
|
||||||
if(nWhich == FN_POSTIT)
|
if(nWhich == FN_POSTIT || nWhich == FN_REPLY)
|
||||||
bCurField = pField && pField->GetTyp()->Which() == RES_POSTITFLD;
|
bCurField = pField && pField->GetTyp()->Which() == RES_POSTITFLD;
|
||||||
else
|
else
|
||||||
bCurField = pField && pField->GetTyp()->Which() == RES_SCRIPTFLD;
|
bCurField = pField && pField->GetTyp()->Which() == RES_SCRIPTFLD;
|
||||||
|
Reference in New Issue
Block a user