summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodolfo Ribeiro Gomes <rodolforg@gmail.com>2013-03-09 14:08:21 -0300
committerC├ędric Bosdonnat <cedric.bosdonnat@free.fr>2013-03-11 10:08:30 +0100
commite047a967b0db8c61dc977b52f3876fc4e385ad77 (patch)
treeb84aa3aaaa5d85ce829f9f3e468dde058cf85d3f
parent4ec9f68f25f1d75f63e57570eb24f30ebfcfe2b2 (diff)
fdo#38246 Comment control on Writer ruler feature
It follows the directions from design team available at https://wiki.documentfoundation.org/Design/Whiteboards/Comments_Ruler_Control. It misses some fancy stuff though (like animated/delayed highlight and fading border). Some work should be done with (svtools) Ruler also for a cleaner implementation. Change-Id: Ib065043d05fe56fbfe6d00e0bb654966f046129b Signed-off-by: Rodolfo Ribeiro Gomes <rodolforg@gmail.com>
-rw-r--r--svtools/inc/svtools/ruler.hxx4
-rw-r--r--svtools/source/control/ruler.cxx8
-rw-r--r--svx/inc/svx/ruler.hxx7
-rw-r--r--svx/source/dialog/svxruler.cxx5
-rw-r--r--sw/AllLangResTarget_sw.mk1
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/source/ui/inc/misc.hrc6
-rw-r--r--sw/source/ui/inc/swruler.hxx105
-rw-r--r--sw/source/ui/misc/swruler.cxx263
-rw-r--r--sw/source/ui/misc/swruler.src25
-rw-r--r--sw/source/ui/uiview/view.cxx18
11 files changed, 426 insertions, 17 deletions
diff --git a/svtools/inc/svtools/ruler.hxx b/svtools/inc/svtools/ruler.hxx
index 864ebf9c6ef2..a06109bca6a0 100644
--- a/svtools/inc/svtools/ruler.hxx
+++ b/svtools/inc/svtools/ruler.hxx
@@ -681,6 +681,9 @@ private:
Ruler (const Ruler &);
Ruler & operator= (const Ruler &);
+protected:
+ long GetRulerVirHeight() const;
+
public:
Ruler( Window* pParent, WinBits nWinStyle = WB_STDRULER );
virtual ~Ruler();
@@ -709,6 +712,7 @@ public:
long GetWinWidth() const { return mnWinWidth; }
void SetPagePos( long nOff = 0, long nWidth = 0 );
long GetPageOffset() const;
+ long GetPageWidth() const;
void SetBorderPos( long nOff = 0 );
long GetBorderOffset() const { return mnBorderOff; }
Rectangle GetExtraRect() const { return maExtraRect; }
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index fcc203759157..5e19a661dff1 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -2775,9 +2775,11 @@ void Ruler::SetTextRTL(sal_Bool bRTL)
}
long Ruler::GetPageOffset() const { return mpData->nPageOff; }
-long Ruler::GetNullOffset() const { return mpData->nNullOff; }
-long Ruler::GetMargin1() const { return mpData->nMargin1; }
-long Ruler::GetMargin2() const { return mpData->nMargin2; }
+long Ruler::GetPageWidth() const { return mpData->nPageWidth; }
+long Ruler::GetNullOffset() const { return mpData->nNullOff; }
+long Ruler::GetMargin1() const { return mpData->nMargin1; }
+long Ruler::GetMargin2() const { return mpData->nMargin2; }
+long Ruler::GetRulerVirHeight() const { return mnVirHeight; }
void Ruler::DrawTicks()
{
diff --git a/svx/inc/svx/ruler.hxx b/svx/inc/svx/ruler.hxx
index e39ccde703ec..aa18893ec3cc 100644
--- a/svx/inc/svx/ruler.hxx
+++ b/svx/inc/svx/ruler.hxx
@@ -148,7 +148,6 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
long GetLeftIndent() const;
long GetRightIndent() const;
long GetLogicRightIndent() const;
- long GetPageWidth() const;
inline long GetLeftFrameMargin() const;
long GetRightFrameMargin() const;
@@ -184,14 +183,13 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
sal_uInt16 GetNextVisible(sal_uInt16 nColumn);
sal_uInt16 GetPrevVisible(sal_uInt16 nColumn);
- void Update();
-
enum UpdateType {
MOVE_ALL,
MOVE_LEFT,
MOVE_RIGHT
};
void UpdateParaContents_Impl(long lDiff, UpdateType = MOVE_ALL);
+
protected:
virtual void Command( const CommandEvent& rCEvt );
virtual void Click();
@@ -203,6 +201,8 @@ protected:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual void Update();
+
// calculation of boundary values for object borders
// values refer to the page
virtual sal_Bool CalcLimits(long &nMax1, long &nMax2, sal_Bool bFirst) const;
@@ -215,6 +215,7 @@ protected:
sal_uInt16 GetActRightColumn (
sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX ) const;
long CalcPropMaxRight(sal_uInt16 nCol=USHRT_MAX) const;
+ long GetPageWidth() const;
public:
#define SVXRULER_SUPPORT_TABS 0x0001
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 117642eb3aad..24f856f09de0 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -1340,10 +1340,11 @@ void SvxRuler::Update()
}
-inline long SvxRuler::GetPageWidth() const
+long SvxRuler::GetPageWidth() const
{
+ if ( !pPagePosItem )
+ return 0;
return bHorz ? pPagePosItem->GetWidth() : pPagePosItem->GetHeight();
-
}
diff --git a/sw/AllLangResTarget_sw.mk b/sw/AllLangResTarget_sw.mk
index a388fc1b7614..dd4856e4b618 100644
--- a/sw/AllLangResTarget_sw.mk
+++ b/sw/AllLangResTarget_sw.mk
@@ -144,6 +144,7 @@ $(eval $(call gb_SrsTarget_add_files,sw/res,\
sw/source/ui/misc/pggrid.src \
sw/source/ui/misc/redlndlg.src \
sw/source/ui/misc/srtdlg.src \
+ sw/source/ui/misc/swruler.src \
sw/source/ui/ribbar/inputwin.src \
sw/source/ui/ribbar/tbxanchr.src \
sw/source/ui/ribbar/workctrl.src \
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index f3d0920e7d63..d2ba82c70bb6 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -602,6 +602,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/ui/misc/glshell \
sw/source/ui/misc/numberingtypelistbox \
sw/source/ui/misc/redlndlg \
+ sw/source/ui/misc/swruler \
sw/source/ui/ribbar/conarc \
sw/source/ui/ribbar/concustomshape \
sw/source/ui/ribbar/conform \
diff --git a/sw/source/ui/inc/misc.hrc b/sw/source/ui/inc/misc.hrc
index e5a380fd761f..c8a4f7df7811 100644
--- a/sw/source/ui/inc/misc.hrc
+++ b/sw/source/ui/inc/misc.hrc
@@ -47,7 +47,11 @@
#define STRRES_NUMTYPES (RC_MISC_BEGIN + 63)
#define STR_MY_AUTOTEXT (RC_MISC_BEGIN + 64)
-#define MISC_ACT_END STRRES_NUMTYPES
+#define STR_COMMENTS_LABEL (RC_MISC_BEGIN + 65)
+#define STR_SHOW_COMMENTS (RC_MISC_BEGIN + 66)
+#define STR_HIDE_COMMENTS (RC_MISC_BEGIN + 67)
+
+#define MISC_ACT_END STR_HIDE_COMMENTS
#if MISC_ACT_END > RC_MISC_END
#error Resource-Id Ueberlauf in #file, #line
diff --git a/sw/source/ui/inc/swruler.hxx b/sw/source/ui/inc/swruler.hxx
new file mode 100644
index 000000000000..9e59ae16c02a
--- /dev/null
+++ b/sw/source/ui/inc/swruler.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SW_COMMENT_RULER_HXX
+#define SW_COMMENT_RULER_HXX
+
+#include <svx/ruler.hxx>
+
+class ViewShell;
+class View;
+class Window;
+class SwEditWin;
+
+/**
+ * An horizontal ruler with a control for comment panel visibility fo Writer.
+ *
+ * The comment control only appears when the document has comments already.
+ */
+class SwCommentRuler
+ : public SvxRuler
+{
+public:
+ SwCommentRuler (
+ ViewShell* pViewSh,
+ Window* pParent,
+ SwEditWin* pWin,
+ sal_uInt16 nRulerFlags,
+ SfxBindings& rBindings,
+ WinBits nWinStyle);
+ virtual ~SwCommentRuler ();
+
+ /**
+ * Paint the ruler.
+ * \param rRect ignored
+ */
+ virtual void Paint( const Rectangle& rRect );
+
+protected:
+ ViewShell * mpViewShell; //< Shell to check if there is any comments on doc and their visibility
+ SwEditWin * mpSwWin; //< Used to get SwView to change the SideBar visibility
+ bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it)
+ VirtualDevice maVirDev; //< VirtualDevice of this window. Just for convenience.
+
+ /**
+ * Callback function to handle a mouse button down event.
+ *
+ * When on comment control, it toggles the comment panel visibility.
+ */
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ /**
+ * Callback function to handle a mouse move event.
+ *
+ * When on comment control, it let the control responsive by highlighting.
+ */
+ virtual void MouseMove(const MouseEvent& rMEvt);
+ /**
+ * Callback function to handle a context menu call (mouse right button click).
+ *
+ * When on comment control, it does not do anything.
+ */
+ virtual void Command( const CommandEvent& rCEvt );
+ /**
+ * Update the view.
+ *
+ * Update the ruler appearance according to the document view and
+ * current cursor position.
+ */
+ virtual void Update();
+
+ /**
+ * Get the rectangle area that should be used to draw the comment control.
+ *
+ * It is horizontally aligned to the SideBar panel.
+ * \param Rectangle The area where the comment control is.
+ */
+ Rectangle GetCommentControlRegion();
+
+ /**
+ * Paint the comment control on VirtualDevice.
+ */
+ void DrawCommentControl();
+ /**
+ * Draw a little horizontal arrow tip on VirtualDevice.
+ * \param nX left coordinate of arrow
+ * \param nY top coordinate of arrow
+ * \param Color arrow color
+ * \param bPointRight if arrow should point to right. Otherwise, it will point left.
+ */
+ void ImplDrawArrow(long nX, long nY, const Color& rColor, bool bPointRight);
+
+ /**
+ * Update the tooltip text.
+ */
+ void UpdateCommentHelpText();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/misc/swruler.cxx b/sw/source/ui/misc/swruler.cxx
new file mode 100644
index 000000000000..47508fffb587
--- /dev/null
+++ b/sw/source/ui/misc/swruler.cxx
@@ -0,0 +1,263 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+// FIX fdo#38246 https://bugs.freedesktop.org/show_bug.cgi?id=38246
+// Design proposal: https://wiki.documentfoundation.org/Design/Whiteboards/Comments_Ruler_Control
+// TODO Alpha blend border when it doesn't fit in window
+// TODO Delayed highlight fading when user moves mouse over and out the control
+
+#include "swruler.hxx"
+
+#include "viewsh.hxx"
+#include "edtwin.hxx"
+#include "PostItMgr.hxx"
+#include "viewopt.hxx"
+#include <view.hxx>
+#include "cmdid.h"
+#include <sfx2/request.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include "misc.hrc"
+
+#define CONTROL_BORDER_WIDTH 1
+
+#define CONTROL_LEFT_OFFSET 6
+#define CONTROL_RIGHT_OFFSET 3
+#define CONTROL_TOP_OFFSET 4
+#define CONTROL_BOTTOM_OFFSET 4
+
+#define CONTROL_TRIANGLE_WIDTH 4
+#define CONTROL_TRIANGLE_HEIGHT 7
+#define CONTROL_TRIANGLE_PAD 3
+
+// Constructor
+SwCommentRuler::SwCommentRuler( ViewShell* pViewSh, Window* pParent, SwEditWin* pWin, sal_uInt16 nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle)
+: SvxRuler(pParent, pWin, nRulerFlags, rBindings, nWinStyle | WB_HSCROLL)
+, mpViewShell(pViewSh)
+, mpSwWin(pWin)
+, mbIsHighlighted(false)
+, maVirDev( *this )
+{
+}
+
+// Destructor
+SwCommentRuler::~SwCommentRuler()
+{
+}
+
+void SwCommentRuler::Paint( const Rectangle& rRect )
+{
+ SvxRuler::Paint( rRect );
+ // Don't draw if there is not any note
+ if ( mpViewShell->GetPostItMgr()->HasNotes() )
+ DrawCommentControl();
+}
+
+void SwCommentRuler::DrawCommentControl()
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ bool bIsCollapsed = ! mpViewShell->GetPostItMgr()->ShowNotes();
+
+ Rectangle aControlRect = GetCommentControlRegion();
+ maVirDev.SetOutputSizePixel( aControlRect.GetSize() );
+
+ // Paint comment control background
+ // TODO Check if these are best colors to be used
+ if ( mbIsHighlighted )
+ maVirDev.SetFillColor( rStyleSettings.GetDarkShadowColor() );
+ else
+ maVirDev.SetFillColor( rStyleSettings.GetWorkspaceColor() );
+
+ if ( mbIsHighlighted || !bIsCollapsed )
+ {
+ // Draw borders
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ }
+ else
+ {
+ // No borders
+ maVirDev.SetLineColor();
+ }
+
+ maVirDev.DrawRect( Rectangle( Point(), aControlRect.GetSize() ) );
+
+ String aLabel( SW_RESSTR ( STR_COMMENTS_LABEL ) );
+ // Get label and arrow coordinates
+ Point aLabelPos;
+ Point aArrowPos;
+ bool bArrowToRight;
+ // TODO Discover why it should be 0 instead of CONTROL_BORDER_WIDTH + CONTROL_TOP_OFFSET
+ aLabelPos.Y() = 0;
+ aArrowPos.Y() = CONTROL_BORDER_WIDTH + CONTROL_TOP_OFFSET;
+ if ( !Application::GetSettings().GetLayoutRTL() )
+ {
+ // LTR
+ if ( bIsCollapsed )
+ {
+ // It should draw something like | > Comments |
+ aLabelPos.X() = CONTROL_LEFT_OFFSET + CONTROL_TRIANGLE_WIDTH + CONTROL_TRIANGLE_PAD;
+ aArrowPos.X() = CONTROL_LEFT_OFFSET;
+ }
+ else
+ {
+ // It should draw something like | Comments < |
+ aLabelPos.X() = CONTROL_LEFT_OFFSET;
+ aArrowPos.X() = aControlRect.GetSize().Width() - 1 - CONTROL_RIGHT_OFFSET - CONTROL_BORDER_WIDTH - CONTROL_TRIANGLE_WIDTH;
+ }
+ bArrowToRight = bIsCollapsed;
+ }
+ else
+ {
+ // RTL
+ long nLabelWidth = GetTextWidth( aLabel );
+ if ( bIsCollapsed )
+ {
+ // It should draw something like | Comments < |
+ aArrowPos.X() = aControlRect.GetSize().Width() - 1 - CONTROL_RIGHT_OFFSET - CONTROL_BORDER_WIDTH - CONTROL_TRIANGLE_WIDTH;
+ aLabelPos.X() = aArrowPos.X() - CONTROL_TRIANGLE_PAD - nLabelWidth;
+ }
+ else
+ {
+ // It should draw something like | > Comments |
+ aLabelPos.X() = aControlRect.GetSize().Width() - 1 - CONTROL_RIGHT_OFFSET - CONTROL_BORDER_WIDTH - nLabelWidth;
+ aArrowPos.X() = CONTROL_LEFT_OFFSET;
+ }
+ bArrowToRight = !bIsCollapsed;
+ }
+
+ // Draw label
+ const Color &rTextColor = mbIsHighlighted ? rStyleSettings.GetButtonTextColor() : rStyleSettings.GetDeactiveTextColor();
+ maVirDev.SetTextColor( rTextColor );
+ // FIXME Expected font size?
+ maVirDev.DrawText( aLabelPos, aLabel );
+
+ // Draw arrow
+ // FIXME consistence of button colors. http://opengrok.libreoffice.org/xref/core/vcl/source/control/button.cxx#785
+ const Color &rArrowColor = mbIsHighlighted ? Color( COL_BLACK ) : rStyleSettings.GetShadowColor();
+ ImplDrawArrow ( aArrowPos.X(), aArrowPos.Y(), rArrowColor, bArrowToRight );
+
+ // Blit comment control
+ DrawOutDev( aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), maVirDev );
+}
+
+void SwCommentRuler::ImplDrawArrow(long nX, long nY, const Color& rColor, bool bPointRight)
+{
+ maVirDev.SetLineColor();
+ maVirDev.SetFillColor( rColor );
+ if ( bPointRight )
+ {
+ maVirDev.DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) );
+ maVirDev.DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) );
+ maVirDev.DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) );
+ maVirDev.DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) );
+ }
+ else
+ {
+ maVirDev.DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) );
+ maVirDev.DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) );
+ maVirDev.DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) );
+ maVirDev.DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) );
+ }
+}
+
+// Just accept double-click outside comment control
+void SwCommentRuler::Command( const CommandEvent& rCEvt )
+{
+ Point aMousePos = rCEvt.GetMousePosPixel();
+ // Ignore command request if it is inside Comment Control
+ if ( !mpViewShell->GetPostItMgr()
+ || !mpViewShell->GetPostItMgr()->HasNotes()
+ || !GetCommentControlRegion().IsInside( aMousePos ) )
+ SvxRuler::Command( rCEvt );
+}
+
+void SwCommentRuler::MouseMove(const MouseEvent& rMEvt)
+{
+ SvxRuler::MouseMove(rMEvt);
+ if ( ! mpViewShell->GetPostItMgr() || ! mpViewShell->GetPostItMgr()->HasNotes() )
+ return;
+ // TODO Delay 0.1s to highlight and 0.2s to "lowlight"
+ Point aMousePos = rMEvt.GetPosPixel();
+ bool bWasHighlighted = mbIsHighlighted;
+ mbIsHighlighted = GetCommentControlRegion().IsInside( aMousePos );
+ if ( mbIsHighlighted != bWasHighlighted )
+ {
+ // Repaint for highlight changes make effect
+ Invalidate();
+ // Set proper help text
+ if ( mbIsHighlighted )
+ {
+ // Mouse over comment control
+ UpdateCommentHelpText();
+ }
+ else
+ {
+ // Mouse out of comment control
+ // FIXME Should remember previous tooltip text?
+ SetQuickHelpText( String() );
+ }
+ }
+}
+
+void SwCommentRuler::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Point aMousePos = rMEvt.GetPosPixel();
+ if ( !rMEvt.IsLeft() || IsTracking() || !GetCommentControlRegion().IsInside( aMousePos ) )
+ {
+ SvxRuler::MouseButtonDown(rMEvt);
+ return;
+ }
+
+ // Toggle notes visibility
+ SwView &rView = mpSwWin->GetView();
+ SfxRequest aRequest( rView.GetViewFrame(), FN_VIEW_NOTES );
+ rView.ExecViewOptions( aRequest );
+
+ // It is inside comment control, so update help text
+ UpdateCommentHelpText();
+
+ Invalidate();
+}
+
+void SwCommentRuler::Update()
+{
+ Rectangle aPreviousControlRect = GetCommentControlRegion();
+ SvxRuler::Update();
+ if (aPreviousControlRect != GetCommentControlRegion())
+ Invalidate();
+}
+
+void SwCommentRuler::UpdateCommentHelpText()
+{
+ int nTooltipResId;
+ if ( mpViewShell->GetPostItMgr()->ShowNotes() )
+ nTooltipResId = STR_HIDE_COMMENTS;
+ else
+ nTooltipResId = STR_SHOW_COMMENTS;
+ SetQuickHelpText( OUString( SW_RESSTR( nTooltipResId ) ) );
+}
+
+// NOTE: If sometime ahead SwSidebar moves from page right side due RTL layout,
+// change how this rectangle is used by callers
+// TODO Make Ruler return its central rectangle instead of margins.
+Rectangle SwCommentRuler::GetCommentControlRegion()
+{
+ SwPostItMgr *pPostItMgr = mpViewShell->GetPostItMgr();
+ //FIXME When the page width is larger then screen, the ruler is misplaced by one pixel
+ long nLeft = GetWinOffset() + GetPageOffset() + mpSwWin->LogicToPixel(Size(GetPageWidth(), 0)).Width();
+ long nTop = 0 + 4; // Ruler::ImplDraw uses RULER_OFF (value: 3px) as offset, and Ruler::ImplFormat adds one extra pixel
+ // Somehow pPostItMgr->GetSidebarBorderWidth() returns border width already doubled
+ long nRight = nLeft+ pPostItMgr->GetSidebarWidth(true) + pPostItMgr->GetSidebarBorderWidth(true);
+ long nBottom = nTop + GetRulerVirHeight() - 3;
+
+ Rectangle aRect(nLeft, nTop, nRight, nBottom);
+ return aRect;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/misc/swruler.src b/sw/source/ui/misc/swruler.src
new file mode 100644
index 000000000000..092173fe0a6a
--- /dev/null
+++ b/sw/source/ui/misc/swruler.src
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "misc.hrc"
+
+String STR_COMMENTS_LABEL
+{
+ Text [ en-US ] = "Comments" ;
+};
+
+String STR_SHOW_COMMENTS
+{
+ Text [ en-US ] = "Show comments" ;
+};
+
+String STR_HIDE_COMMENTS
+{
+ Text [ en-US ] = "Hide comments" ;
+};
+
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index f8b7b3e343e6..431278b31e05 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -96,6 +96,7 @@
#include "formatclipboard.hxx"
#include <PostItMgr.hxx>
#include <annotsh.hxx>
+#include <swruler.hxx>
#include <fldbas.hxx>
@@ -715,14 +716,6 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
pHScrollbar(0),
pVScrollbar(0),
pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
- pHRuler( new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin,
- SVXRULER_SUPPORT_TABS |
- SVXRULER_SUPPORT_PARAGRAPH_MARGINS |
- SVXRULER_SUPPORT_BORDERS |
- SVXRULER_SUPPORT_NEGATIVE_MARGINS|
- SVXRULER_SUPPORT_REDUCED_METRIC,
- GetViewFrame()->GetBindings(),
- WB_STDRULER | WB_EXTRAFIELD | WB_BORDER)),
pVRuler(new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin,
SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL|
SVXRULER_SUPPORT_BORDERS | SVXRULER_SUPPORT_REDUCED_METRIC,
@@ -876,6 +869,15 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
}
RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create WrtShell" );
+ pHRuler = new SwCommentRuler(pWrtShell, &GetViewFrame()->GetWindow(), pEditWin,
+ SVXRULER_SUPPORT_TABS |
+ SVXRULER_SUPPORT_PARAGRAPH_MARGINS |
+ SVXRULER_SUPPORT_BORDERS |
+ SVXRULER_SUPPORT_NEGATIVE_MARGINS|
+ SVXRULER_SUPPORT_REDUCED_METRIC,
+ GetViewFrame()->GetBindings(),
+ WB_STDRULER | WB_EXTRAFIELD | WB_BORDER);
+
// assure that modified state of document
// isn't reset, if document is already modified.
const bool bIsDocModified = pWrtShell->GetDoc()->IsModified();