summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-04-22 17:06:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-04-23 11:22:48 +0100
commitebb728c9c01b5e86926381fa816cf69cb3eb1e37 (patch)
treed45366bdd6bb2507b445a4e79834b70de97a218c
parent43d68d4ea9075abf2984c32fd81cb40d1df84c6a (diff)
add a 'format all comments' feature
Change-Id: Ie9530f0f58b38d014beda60b9efba3ce93fe5c0e
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu5
-rw-r--r--sw/inc/PostItMgr.hxx5
-rw-r--r--sw/inc/cmdid.h2
-rw-r--r--sw/inc/swcommands.h1
-rw-r--r--sw/sdi/_annotsh.sdi6
-rw-r--r--sw/sdi/_textsh.sdi5
-rw-r--r--sw/sdi/swriter.sdi24
-rw-r--r--sw/source/core/uibase/docvw/AnnotationMenuButton.cxx2
-rw-r--r--sw/source/core/uibase/docvw/PostItMgr.cxx77
-rw-r--r--sw/source/core/uibase/docvw/SidebarWin.cxx1
-rw-r--r--sw/source/core/uibase/docvw/annotation.hrc1
-rw-r--r--sw/source/core/uibase/inc/annotsh.hxx2
-rw-r--r--sw/source/core/uibase/shells/annotsh.cxx17
-rw-r--r--sw/source/core/uibase/shells/textfld.cxx14
-rw-r--r--sw/source/ui/app/mn.src6
-rw-r--r--sw/source/ui/docvw/annotation.src5
16 files changed, 166 insertions, 7 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 548f9aad2fe1..ad9275b01db2 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -5308,6 +5308,11 @@
<value xml:lang="en-US">Delete All Comments</value>
</prop>
</node>
+ <node oor:name=".uno:FormatAllNotes" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Format All Comments</value>
+ </prop>
+ </node>
<node oor:name=".uno:DeleteAuthor" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Delete All Comments by This Author</value>
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 4f994199dd2e..438cffa310d3 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -44,6 +44,8 @@ class SfxBroadcaster;
class SfxHint;
class SwEditWin;
class Color;
+class SfxItemPool;
+class SfxItemSet;
class SvxSearchItem;
class SvxLanguageItem;
namespace sw { namespace annotation {
@@ -218,6 +220,9 @@ class SwPostItMgr: public SfxListener
void Delete(const OUString& aAuthor);
void Delete();
+ void ExecuteFormatAllDialog(SwView& rView);
+ void FormatAll(const SfxItemSet &rNewAttr);
+
void Hide( const OUString& rAuthor );
void Hide();
void Show();
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 2e78df9b5b12..d8fdc2ef5e72 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -783,7 +783,7 @@ included in c-context files, so c++ style stuff will cause problems.
#define FN_DELETE_COMMENT (FN_NOTES+6)
#define FN_REPLY (FN_NOTES+7)
-
+#define FN_FORMAT_ALL_NOTES (FN_NOTES+8)
#define FN_HEADERFOOTER_EDIT (FN_HEADERFOOTER+1)
#define FN_HEADERFOOTER_DELETE (FN_HEADERFOOTER+2)
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
index 0f5cd54193e8..cc9bc07d0f42 100644
--- a/sw/inc/swcommands.h
+++ b/sw/inc/swcommands.h
@@ -116,6 +116,7 @@
#define CMD_FN_DELETE_COMMENT ".uno:DeleteComment"
#define CMD_FN_DELETE_NOTE_AUTHOR ".uno:DeleteAuthor"
#define CMD_FN_DELETE_ALL_NOTES ".uno:DeleteAllNotes"
+#define CMD_FN_FORMAT_ALL_NOTES ".uno:FormatAllNotes"
#define CMD_FN_HIDE_NOTE ".uno:HideNote"
#define CMD_FN_HIDE_NOTE_AUTHOR ".uno:HideAuthor"
#define CMD_FN_HIDE_ALL_NOTES ".uno:HideAllNotes"
diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi
index 142d5e788cec..15f03adf89d0 100644
--- a/sw/sdi/_annotsh.sdi
+++ b/sw/sdi/_annotsh.sdi
@@ -37,6 +37,12 @@ interface _Annotation
StateMethod = GetNoteState ;
]
+ FN_FORMAT_ALL_NOTES
+ [
+ ExecMethod = NoteExec ;
+ StateMethod = GetNoteState ;
+ ]
+
FN_HIDE_NOTE
[
ExecMethod = NoteExec ;
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 6855a9ff0628..9e3189f8653a 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -940,6 +940,11 @@ interface BaseText
ExecMethod = ExecField ;
StateMethod = StateField;
]
+ FN_FORMAT_ALL_NOTES
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField;
+ ]
FN_HIDE_NOTE
[
ExecMethod = ExecField ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index e5dcce0dfa37..9bde88a4149a 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -9604,6 +9604,30 @@ SfxVoidItem DeleteAllNotes FN_DELETE_ALL_NOTES
GroupId = GID_EDIT;
]
+SfxVoidItem FormatAllNotes FN_FORMAT_ALL_NOTES
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
SfxVoidItem HideNote FN_HIDE_NOTE
()
[
diff --git a/sw/source/core/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/core/uibase/docvw/AnnotationMenuButton.cxx
index f54378d6d17a..051d7eebcd7c 100644
--- a/sw/source/core/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/core/uibase/docvw/AnnotationMenuButton.cxx
@@ -75,12 +75,14 @@ void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt )
pButtonPopup->EnableItem( FN_DELETE_COMMENT, false );
pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, false );
pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, false );
+ pButtonPopup->EnableItem( FN_FORMAT_ALL_NOTES, false );
}
else
{
pButtonPopup->EnableItem( FN_DELETE_COMMENT, !mrSidebarWin.IsProtected() );
pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, true );
pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, true );
+ pButtonPopup->EnableItem( FN_FORMAT_ALL_NOTES, true );
}
if ( mrSidebarWin.IsProtected() )
diff --git a/sw/source/core/uibase/docvw/PostItMgr.cxx b/sw/source/core/uibase/docvw/PostItMgr.cxx
index e63ce8b7b2cf..2bf148407c34 100644
--- a/sw/source/core/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/core/uibase/docvw/PostItMgr.cxx
@@ -34,8 +34,8 @@
#include <vcl/outdev.hxx>
#include <vcl/settings.hxx>
+#include <chrdlgmodes.hxx>
#include <viewopt.hxx>
-
#include <view.hxx>
#include <docsh.hxx>
#include <wrtsh.hxx>
@@ -67,11 +67,14 @@
#include <svx/svdview.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/langitem.hxx>
+#include <editeng/kernitem.hxx>
#include <editeng/outliner.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/lang.h>
+#include "annotsh.hxx"
+#include "swabstdlg.hxx"
#include "swevent.hxx"
#include "switerator.hxx"
@@ -1242,6 +1245,78 @@ void SwPostItMgr::Delete()
CalcRects();
LayoutPostIts();
}
+
+void SwPostItMgr::ExecuteFormatAllDialog(SwView& rView)
+{
+ if (mvPostItFlds.empty())
+ return;
+ sw::sidebarwindows::SwSidebarWin *pOrigActiveWin = GetActiveSidebarWin();
+ sw::sidebarwindows::SwSidebarWin *pWin = pOrigActiveWin;
+ if (!pWin)
+ {
+ for (SwSidebarItem_iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end(); ++i)
+ {
+ pWin = (*i)->pPostIt;
+ if (pWin)
+ break;
+ }
+ }
+ if (!pWin)
+ return;
+ SetActiveSidebarWin(pWin);
+ OutlinerView* pOLV = pWin->GetOutlinerView();
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+ SfxItemPool* pPool(SwAnnotationShell::GetAnnotationPool(rView));
+ SfxItemSet aDlgAttr(*pPool, EE_ITEMS_START, EE_ITEMS_END);
+ aDlgAttr.Put(aEditAttr);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg(rView.GetWindow(), rView, aDlgAttr, DLG_CHAR_ANN);
+ sal_uInt16 nRet = pDlg->Execute();
+ if (RET_OK == nRet)
+ {
+ aDlgAttr.Put(*pDlg->GetOutputItemSet());
+ FormatAll(aDlgAttr);
+ }
+ delete pDlg;
+ SetActiveSidebarWin(pOrigActiveWin);
+}
+
+void SwPostItMgr::FormatAll(const SfxItemSet &rNewAttr)
+{
+ mpWrtShell->StartAllAction();
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UndoArg1, SW_RES(STR_FORMAT_ALL_NOTES) );
+ mpWrtShell->StartUndo( UNDO_INSATTR, &aRewriter );
+
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i)
+ {
+ if (!(*i)->pPostIt)
+ continue;
+ OutlinerView* pOLV = (*i)->pPostIt->GetOutlinerView();
+ //save old selection
+ ESelection aOrigSel(pOLV->GetSelection());
+ //select all
+ Outliner *pOutliner = pOLV->GetOutliner();
+ if (pOutliner)
+ {
+ sal_Int32 nParaCount = pOutliner->GetParagraphCount();
+ if (nParaCount > 0)
+ pOLV->SelectRange(0, nParaCount);
+ }
+ //set new char properties
+ pOLV->SetAttribs(rNewAttr);
+ //restore old selection
+ pOLV->SetSelection(aOrigSel);
+ }
+
+ mpWrtShell->EndUndo();
+ PrepareView();
+ mpWrtShell->EndAllAction();
+ mbLayout = true;
+ CalcRects();
+ LayoutPostIts();
+}
+
void SwPostItMgr::Hide( const OUString& rAuthor )
{
for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i)
diff --git a/sw/source/core/uibase/docvw/SidebarWin.cxx b/sw/source/core/uibase/docvw/SidebarWin.cxx
index ac6cf3a04a0d..3539878439b5 100644
--- a/sw/source/core/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/core/uibase/docvw/SidebarWin.cxx
@@ -1054,6 +1054,7 @@ void SwSidebarWin::ExecuteCommand(sal_uInt16 nSlot)
//Delete(); // do not kill the parent of our open popup menu
mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
break;
+ case FN_FORMAT_ALL_NOTES:
case FN_DELETE_ALL_NOTES:
case FN_HIDE_ALL_NOTES:
// not possible as slot as this would require that "this" is the active postit
diff --git a/sw/source/core/uibase/docvw/annotation.hrc b/sw/source/core/uibase/docvw/annotation.hrc
index 7daf55524899..5fe3e497c680 100644
--- a/sw/source/core/uibase/docvw/annotation.hrc
+++ b/sw/source/core/uibase/docvw/annotation.hrc
@@ -32,6 +32,7 @@
#define STR_NOAUTHOR (RC_ANNOTATION_BEGIN + 6)
#define STR_REPLY (RC_ANNOTATION_BEGIN + 7)
+#define STR_FORMAT_ALL_NOTES (RC_ANNOTATION_BEGIN + 8)
#define ANNOTATION_ACT_END STR_REPLY
diff --git a/sw/source/core/uibase/inc/annotsh.hxx b/sw/source/core/uibase/inc/annotsh.hxx
index 40891d0d45a1..abfd7fc2679b 100644
--- a/sw/source/core/uibase/inc/annotsh.hxx
+++ b/sw/source/core/uibase/inc/annotsh.hxx
@@ -72,6 +72,8 @@ public:
virtual ::svl::IUndoManager*
GetUndoManager() SAL_OVERRIDE;
+
+ static SfxItemPool* GetAnnotationPool(SwView& rV);
};
#endif
diff --git a/sw/source/core/uibase/shells/annotsh.cxx b/sw/source/core/uibase/shells/annotsh.cxx
index 96faa5945cf9..f03193098d89 100644
--- a/sw/source/core/uibase/shells/annotsh.cxx
+++ b/sw/source/core/uibase/shells/annotsh.cxx
@@ -147,11 +147,16 @@ void SwAnnotationShell::InitInterface_Impl()
TYPEINIT1(SwAnnotationShell,SfxShell)
+SfxItemPool* SwAnnotationShell::GetAnnotationPool(SwView& rV)
+{
+ SwWrtShell &rSh = rV.GetWrtShell();
+ return rSh.GetAttrPool().GetSecondaryPool();
+}
+
SwAnnotationShell::SwAnnotationShell( SwView& r )
-: rView(r)
+ : rView(r)
{
- SwWrtShell &rSh = rView.GetWrtShell();
- SetPool(rSh.GetAttrPool().GetSecondaryPool());
+ SetPool(SwAnnotationShell::GetAnnotationPool(rView));
SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Annotation));
}
@@ -1080,9 +1085,12 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq)
pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
break;
- case FN_DELETE_ALL_NOTES:
+ case FN_DELETE_ALL_NOTES:
pPostItMgr->Delete();
break;
+ case FN_FORMAT_ALL_NOTES:
+ pPostItMgr->ExecuteFormatAllDialog(rView);
+ break;
case FN_DELETE_NOTE_AUTHOR:
{
SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, false);
@@ -1117,6 +1125,7 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
case FN_POSTIT:
case FN_DELETE_NOTE_AUTHOR:
case FN_DELETE_ALL_NOTES:
+ case FN_FORMAT_ALL_NOTES:
case FN_HIDE_NOTE:
case FN_HIDE_NOTE_AUTHOR:
case FN_HIDE_ALL_NOTES:
diff --git a/sw/source/core/uibase/shells/textfld.cxx b/sw/source/core/uibase/shells/textfld.cxx
index a2ba08153bb1..c71b9e4def2a 100644
--- a/sw/source/core/uibase/shells/textfld.cxx
+++ b/sw/source/core/uibase/shells/textfld.cxx
@@ -17,9 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <chrdlgmodes.hxx>
#include <crsskip.hxx>
#include <hintids.hxx>
-
+#include <SidebarWin.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/outliner.hxx>
#include <sfx2/lnkbase.hxx>
#include <fmtfld.hxx>
#include <vcl/msgbox.hxx>
@@ -320,6 +324,13 @@ void SwTextShell::ExecField(SfxRequest &rReq)
if ( GetView().GetPostItMgr() )
GetView().GetPostItMgr()->Delete();
break;
+ case FN_FORMAT_ALL_NOTES:
+ {
+ SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
+ if (pPostItMgr)
+ pPostItMgr->ExecuteFormatAllDialog(GetView());
+ }
+ break;
case FN_DELETE_NOTE_AUTHOR:
{
SFX_REQUEST_ARG( rReq, pNoteItem, SfxStringItem, nSlot, false);
@@ -623,6 +634,7 @@ void SwTextShell::StateField( SfxItemSet &rSet )
case FN_DELETE_COMMENT:
case FN_DELETE_NOTE_AUTHOR:
case FN_DELETE_ALL_NOTES:
+ case FN_FORMAT_ALL_NOTES:
case FN_HIDE_NOTE:
case FN_HIDE_NOTE_AUTHOR:
case FN_HIDE_ALL_NOTES:
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index 4510d18a7264..1ea9f74f7b8c 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -750,6 +750,12 @@
HelpId = CMD_FN_DELETE_ALL_NOTES ;\
Text [ en-US ] = "~Delete All Comments" ;\
};\
+ MenuItem\
+ {\
+ Identifier = FN_FORMAT_ALL_NOTES ;\
+ HelpId = CMD_FN_FORMAT_ALL_NOTES ;\
+ Text [ en-US ] = "~Format All Comments" ;\
+ };\
/*
MenuItem\
{\
diff --git a/sw/source/ui/docvw/annotation.src b/sw/source/ui/docvw/annotation.src
index 46afad9c883b..a45c3cad05b1 100644
--- a/sw/source/ui/docvw/annotation.src
+++ b/sw/source/ui/docvw/annotation.src
@@ -35,6 +35,11 @@ String STR_DELETE_ALL_NOTES
Text [ en-US ] = "All Comments" ;
};
+String STR_FORMAT_ALL_NOTES
+{
+ Text [ en-US ] = "All Comments" ;
+};
+
String STR_DELETE_AUTHOR_NOTES
{
Text [ en-US ] = "Comments by " ;