summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/Library_sw.mk2
-rw-r--r--sw/UIConfig_swriter.mk2
-rw-r--r--sw/inc/AnnotationWin.hxx45
-rw-r--r--sw/qa/uitest/writer_tests/comments.py12
-rw-r--r--sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py5
-rw-r--r--sw/source/uibase/docvw/AnnotationMenuButton.cxx213
-rw-r--r--sw/source/uibase/docvw/AnnotationMenuButton.hxx51
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx83
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx696
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx5
-rw-r--r--sw/source/uibase/docvw/SidebarScrollBar.cxx73
-rw-r--r--sw/source/uibase/docvw/SidebarScrollBar.hxx40
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx328
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.hxx49
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControlAcc.cxx271
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControlAcc.hxx43
-rw-r--r--sw/uiconfig/swriter/ui/annotation.ui240
-rw-r--r--sw/uiconfig/swriter/ui/annotationmenu.ui95
18 files changed, 735 insertions, 1518 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 85fd37e2b150..3ba73c8ae9af 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -619,9 +619,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/uibase/docvw/OverlayRanges \
sw/source/uibase/docvw/PostItMgr \
sw/source/uibase/docvw/ShadowOverlayObject \
- sw/source/uibase/docvw/SidebarScrollBar \
sw/source/uibase/docvw/SidebarTxtControl \
- sw/source/uibase/docvw/SidebarTxtControlAcc \
sw/source/uibase/docvw/SidebarWinAcc \
sw/source/uibase/docvw/HeaderFooterWin \
sw/source/uibase/docvw/OutlineContentVisibilityWin \
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 70790ca5cdc1..655341ff28b1 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -91,7 +91,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/addressblockdialog \
sw/uiconfig/swriter/ui/alreadyexistsdialog \
sw/uiconfig/swriter/ui/addressfragment \
- sw/uiconfig/swriter/ui/annotationmenu \
+ sw/uiconfig/swriter/ui/annotation \
sw/uiconfig/swriter/ui/asciifilterdialog \
sw/uiconfig/swriter/ui/asksearchdialog \
sw/uiconfig/swriter/ui/assignfieldsdialog \
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index d384d200d867..706531ec4137 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -23,13 +23,14 @@
#include <basegfx/range/b2drange.hxx>
#include <tools/date.hxx>
#include <tools/time.hxx>
-#include <vcl/builder.hxx>
-#include <vcl/window.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/customweld.hxx>
#include "postithelper.hxx"
#include "swrect.hxx"
#include "SidebarWindowsTypes.hxx"
+class EditView;
class PopupMenu;
class OutlinerParaObject;
class SwPostItMgr;
@@ -53,7 +54,7 @@ namespace sw::sidebarwindows {
namespace sw::annotation {
-class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
+class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public InterimItemWindow
{
public:
SwAnnotationWin( SwEditWin& rEditWin,
@@ -105,7 +106,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
Outliner* GetOutliner() { return mpOutliner.get();}
bool HasScrollbar() const;
bool IsScrollbarVisible() const;
- ScrollBar* Scrollbar() { return mpVScrollbar; }
+ weld::ScrolledWindow* Scrollbar() { return mxVScrollbar.get(); }
::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor.get();}
::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow.get();}
::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay.get();}
@@ -128,7 +129,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
void ShowAnchorOnly(const Point &aPoint);
void ShowNote();
void HideNote();
- void InvalidateControl();
void ResetAttributes();
@@ -154,7 +154,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
sal_Int32 GetMinimumSizeWithMeta() const;
sal_Int32 GetMinimumSizeWithoutMeta() const;
sal_Int32 GetMetaButtonAreaWidth() const;
- sal_Int32 GetScrollbarWidth() const;
+ int GetPrefScrollbarWidth() const;
sal_Int32 GetNumFields() const;
void SetSpellChecking();
@@ -169,7 +169,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
SwPostItHelper::SwLayoutStatus GetLayoutStatus() const { return mLayoutStatus; }
const Color& GetChangeColor() const { return mChangeColor; }
- DECL_LINK( WindowEventListener, VclWindowEvent&, void );
bool IsMouseOverSidebarWin() const { return mbMouseOver; }
void SetLanguage(const SvxLanguageItem& rNewItem);
@@ -177,11 +176,8 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
void ChangeSidebarItem( SwSidebarItem const & rSidebarItem );
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
- virtual void Draw(OutputDevice* pDev, const Point&, DrawFlags) override;
- virtual void KeyInput(const KeyEvent& rKeyEvt) override;
- virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
- virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override;
- virtual void MouseMove(const MouseEvent& rMouseEvent) override;
+ void DrawForPage(OutputDevice* pDev, const Point& rPos);
+
void PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
/// Is there a matching sub-widget inside this sidebar widget for rPointLogic?
bool IsHitWindow(const Point& rPointLogic);
@@ -209,23 +205,25 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
virtual FactoryFunction GetUITestFactory() const override;
private:
- VclPtr<MenuButton> CreateMenuButton();
+
virtual void LoseFocus() override;
- virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
virtual void GetFocus() override;
void SetSizePixel( const Size& rNewSize ) override;
SfxItemSet DefaultItem();
DECL_LINK(ModifyHdl, LinkParamNone*, void);
- DECL_LINK(ScrollHdl, ScrollBar*, void);
+ DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
DECL_LINK(DeleteHdl, void*, void);
+ DECL_LINK(ToggleHdl, weld::ToggleButton&, void);
+ DECL_LINK(SelectHdl, const OString&, void);
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
sal_uInt32 CountFollowing();
SvxLanguageItem GetLanguage() const;
- VclBuilder maBuilder;
SwPostItMgr& mrMgr;
SwView& mrView;
@@ -234,12 +232,14 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
std::unique_ptr<OutlinerView> mpOutlinerView;
std::unique_ptr<Outliner> mpOutliner;
- VclPtr<sw::sidebarwindows::SidebarTextControl> mpSidebarTextControl;
- VclPtr<ScrollBar> mpVScrollbar;
- VclPtr<FixedText> mpMetadataAuthor;
- VclPtr<FixedText> mpMetadataDate;
- VclPtr<FixedText> mpMetadataResolved;
- VclPtr<MenuButton> mpMenuButton;
+ std::unique_ptr<weld::ScrolledWindow> mxVScrollbar;
+ std::unique_ptr<sw::sidebarwindows::SidebarTextControl> mxSidebarTextControl;
+ std::unique_ptr<weld::CustomWeld> mxSidebarTextControlWin;
+ vcl::Font maLabelFont;
+ std::unique_ptr<weld::Label> mxMetadataAuthor;
+ std::unique_ptr<weld::Label> mxMetadataDate;
+ std::unique_ptr<weld::Label> mxMetadataResolved;
+ std::unique_ptr<weld::MenuButton> mxMenuButton;
std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor;
std::unique_ptr<sw::sidebarwindows::ShadowOverlayObject> mpShadow;
@@ -272,7 +272,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
SwFormatField* mpFormatField;
SwPostItField* mpField;
- VclPtr<PopupMenu> mpButtonPopup;
};
} // end of namespace sw::annotation
diff --git a/sw/qa/uitest/writer_tests/comments.py b/sw/qa/uitest/writer_tests/comments.py
index c85ed256de37..6127f44fcfb3 100644
--- a/sw/qa/uitest/writer_tests/comments.py
+++ b/sw/qa/uitest/writer_tests/comments.py
@@ -33,7 +33,8 @@ class Comments(UITestCase):
self.ui_test.wait_until_child_is_available(xMainWindow, 'Comment1')
xComment1 = xMainWindow.getChild("Comment1")
- xComment1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"}))
+ xEditView1 = xComment1.getChild("editview")
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"}))
self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" )
self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" )
@@ -79,7 +80,8 @@ class Comments(UITestCase):
# wait until the comment is available
self.ui_test.wait_until_child_is_available(xMainWindow, 'Comment1')
xComment1 = xMainWindow.getChild("Comment1")
- xComment1.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"}))
+ xEditView1 = xComment1.getChild("editview")
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"}))
xComment1.executeAction("LEAVE", mkPropertyValues({}))
xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
@@ -88,7 +90,8 @@ class Comments(UITestCase):
# wait until the comment is available
self.ui_test.wait_until_child_is_available(xMainWindow, 'Comment2')
xComment2 = xMainWindow.getChild("Comment2")
- xComment2.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"}))
+ xEditView2 = xComment2.getChild("editview")
+ xEditView2.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"}))
xComment2.executeAction("LEAVE", mkPropertyValues({}))
xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
@@ -97,7 +100,8 @@ class Comments(UITestCase):
# wait until the comment is available
self.ui_test.wait_until_child_is_available(xMainWindow, 'Comment3')
xComment3 = xMainWindow.getChild("Comment3")
- xComment3.executeAction("TYPE", mkPropertyValues({"TEXT": "Third Comment"}))
+ xEditView3 = xComment3.getChild("editview")
+ xEditView3.executeAction("TYPE", mkPropertyValues({"TEXT": "Third Comment"}))
xComment3.executeAction("LEAVE", mkPropertyValues({}))
xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
diff --git a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py
index 1c8c1e54fef0..5b11c9ac5a09 100644
--- a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py
+++ b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py
@@ -27,11 +27,12 @@ class tdf137459(UITestCase):
self.ui_test.wait_until_child_is_available(xMainWindow, 'Comment1')
xComment1 = xMainWindow.getChild("Comment1")
+ xEditView1 = xComment1.getChild("editview")
sText = "Ctrl+Del should not delete BACKWARDS"
- xComment1.executeAction("TYPE", mkPropertyValues({"TEXT": sText}))
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": sText}))
self.assertEqual(get_state_as_dict(xComment1)["Text"], sText )
- xComment1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"}))
+ xEditView1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"}))
self.assertEqual(get_state_as_dict(xComment1)["Text"], sText )
self.ui_test.close_doc()
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
index a38cba50aa04..48f848416ec6 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
@@ -17,117 +17,86 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "AnnotationMenuButton.hxx"
-
+#include <AnnotationWin.hxx>
#include <strings.hrc>
#include <unotools/useroptions.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/decoview.hxx>
-#include <vcl/gradient.hxx>
-#include <vcl/settings.hxx>
#include <vcl/event.hxx>
#include <cmdid.h>
-#include <AnnotationWin.hxx>
+
#include <swtypes.hxx>
namespace sw::annotation {
-static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack)
-{
- return Color(sal_uInt8(aFront.GetRed() * aTransparency / 255.0 + aBack.GetRed() * (1 - aTransparency / 255.0)),
- sal_uInt8(aFront.GetGreen() * aTransparency / 255.0 + aBack.GetGreen() * (1 - aTransparency / 255.0)),
- sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0)));
-}
-
-AnnotationMenuButton::AnnotationMenuButton(sw::annotation::SwAnnotationWin& rSidebarWin)
- : MenuButton(&rSidebarWin)
- , mrSidebarWin(rSidebarWin)
-{
- AddEventListener(LINK(&mrSidebarWin, sw::annotation::SwAnnotationWin, WindowEventListener));
-
- SetAccessibleName(SwResId(STR_ACCESS_ANNOTATION_BUTTON_NAME));
- SetAccessibleDescription(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
- SetQuickHelpText(GetAccessibleDescription());
-}
-
-AnnotationMenuButton::~AnnotationMenuButton()
-{
- disposeOnce();
-}
-
-void AnnotationMenuButton::dispose()
-{
- RemoveEventListener(LINK(&mrSidebarWin, sw::annotation::SwAnnotationWin, WindowEventListener));
- MenuButton::dispose();
-}
-
-void AnnotationMenuButton::Select()
+IMPL_LINK(SwAnnotationWin, SelectHdl, const OString&, rIdent, void)
{
- OString sIdent = GetCurItemIdent();
- if (sIdent.isEmpty())
+ if (rIdent.isEmpty())
return;
// tdf#136682 ensure this is the currently active sidebar win so the command
// operates in an active sidebar context
- bool bSwitchedFocus = mrSidebarWin.SetActiveSidebarWin();
-
- if (sIdent == "reply")
- mrSidebarWin.ExecuteCommand(FN_REPLY);
- if (sIdent == "resolve" || sIdent == "unresolve")
- mrSidebarWin.ExecuteCommand(FN_RESOLVE_NOTE);
- else if (sIdent == "resolvethread" || sIdent == "unresolvethread")
- mrSidebarWin.ExecuteCommand(FN_RESOLVE_NOTE_THREAD);
- else if (sIdent == "delete")
- mrSidebarWin.ExecuteCommand(FN_DELETE_COMMENT);
- else if (sIdent == "deletethread")
- mrSidebarWin.ExecuteCommand(FN_DELETE_COMMENT_THREAD);
- else if (sIdent == "deleteby")
- mrSidebarWin.ExecuteCommand(FN_DELETE_NOTE_AUTHOR);
- else if (sIdent == "deleteall")
- mrSidebarWin.ExecuteCommand(FN_DELETE_ALL_NOTES);
- else if (sIdent == "formatall")
- mrSidebarWin.ExecuteCommand(FN_FORMAT_ALL_NOTES);
+ bool bSwitchedFocus = SetActiveSidebarWin();
+
+ if (rIdent == "reply")
+ ExecuteCommand(FN_REPLY);
+ if (rIdent == "resolve" || rIdent == "unresolve")
+ ExecuteCommand(FN_RESOLVE_NOTE);
+ else if (rIdent == "resolvethread" || rIdent == "unresolvethread")
+ ExecuteCommand(FN_RESOLVE_NOTE_THREAD);
+ else if (rIdent == "delete")
+ ExecuteCommand(FN_DELETE_COMMENT);
+ else if (rIdent == "deletethread")
+ ExecuteCommand(FN_DELETE_COMMENT_THREAD);
+ else if (rIdent == "deleteby")
+ ExecuteCommand(FN_DELETE_NOTE_AUTHOR);
+ else if (rIdent == "deleteall")
+ ExecuteCommand(FN_DELETE_ALL_NOTES);
+ else if (rIdent == "formatall")
+ ExecuteCommand(FN_FORMAT_ALL_NOTES);
if (bSwitchedFocus)
- mrSidebarWin.UnsetActiveSidebarWin();
- mrSidebarWin.GrabFocusToDocument();
+ UnsetActiveSidebarWin();
+ GrabFocusToDocument();
}
-void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt )
+IMPL_LINK_NOARG(SwAnnotationWin, ToggleHdl, weld::ToggleButton&, void)
{
- PopupMenu* pButtonPopup(GetPopupMenu());
- if (mrSidebarWin.IsReadOnly())
+ if (!mxMenuButton->get_active())
+ return;
+
+ bool bReplyVis = true;
+
+ bool bReadOnly = IsReadOnly();
+ if (bReadOnly)
{
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("reply"), false);
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolve"), false);
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolve"), false);
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolvethread"), false);
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolvethread"), false);
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("delete"), false );
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("deletethread"), false );
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteby"), false );
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteall"), false );
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("formatall"), false );
+ mxMenuButton->set_item_visible("reply", false);
+ bReplyVis = false;
+ mxMenuButton->set_item_visible("resolve", false);
+ mxMenuButton->set_item_visible("unresolve", false);
+ mxMenuButton->set_item_visible("resolvethread", false);
+ mxMenuButton->set_item_visible("unresolvethread", false);
+ mxMenuButton->set_item_visible("delete", false );
}
else
{
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolve"), !mrSidebarWin.IsResolved());
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolve"), mrSidebarWin.IsResolved());
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolvethread"), !mrSidebarWin.IsThreadResolved());
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolvethread"), mrSidebarWin.IsThreadResolved());
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("delete"), !mrSidebarWin.IsProtected());
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("deletethread"));
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteby"));
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteall"));
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("formatall"));
+ mxMenuButton->set_item_visible("resolve", !IsResolved());
+ mxMenuButton->set_item_visible("unresolve", IsResolved());
+ mxMenuButton->set_item_visible("resolvethread", !IsThreadResolved());
+ mxMenuButton->set_item_visible("unresolvethread", IsThreadResolved());
+ mxMenuButton->set_item_visible("delete", !IsProtected());
}
- if (mrSidebarWin.IsProtected())
+ mxMenuButton->set_item_visible("deletethread", !bReadOnly);
+ mxMenuButton->set_item_visible("deleteby", !bReadOnly);
+ mxMenuButton->set_item_visible("deleteall", !bReadOnly);
+ mxMenuButton->set_item_visible("formatall", !bReadOnly);
+
+ if (IsProtected())
{
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("reply"), false);
+ mxMenuButton->set_item_visible("reply", false);
+ bReplyVis = false;
}
else
{
@@ -141,84 +110,22 @@ void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt )
}
}
// do not allow to reply to ourself and no answer possible if this note is in a protected section
- if (sAuthor == mrSidebarWin.GetAuthor())
- {
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("reply"), false);
- }
- else
- {
- pButtonPopup->EnableItem(pButtonPopup->GetItemId("reply"));
- }
- }
-
- MenuButton::MouseButtonDown(rMEvt);
-}
-
-void AnnotationMenuButton::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
-{
- bool bHighContrast = rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode();
-
- if (bHighContrast)
- rRenderContext.SetFillColor(COL_BLACK);
- else
- rRenderContext.SetFillColor(mrSidebarWin.ColorDark());
- rRenderContext.SetLineColor();
- const tools::Rectangle aRect(tools::Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel())));
- rRenderContext.DrawRect(aRect);
-
- if (bHighContrast)
- {
- //draw rect around button
- rRenderContext.SetFillColor(COL_BLACK);
- rRenderContext.SetLineColor(COL_WHITE);
- }
- else
- {
- //draw button
- Gradient aGradient;
- if (IsMouseOver())
- aGradient = Gradient(GradientStyle::Linear,
- ColorFromAlphaColor(80, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark()),
- ColorFromAlphaColor(15, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark()));
- else
- aGradient = Gradient(GradientStyle::Linear,
- ColorFromAlphaColor(15, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark()),
- ColorFromAlphaColor(80, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark()));
- rRenderContext.DrawGradient(aRect, aGradient);
-
- //draw rect around button
- rRenderContext.SetFillColor();
- rRenderContext.SetLineColor(ColorFromAlphaColor(90, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark()));
+ bReplyVis = sAuthor != GetAuthor();
+ mxMenuButton->set_item_visible("reply", bReplyVis);
}
- rRenderContext.DrawRect(aRect);
-
- tools::Rectangle aSymbolRect(aRect);
- // 25% distance to the left and right button border
- const tools::Long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth() * 250) + 500) / 1000;
- aSymbolRect.AdjustLeft(nBorderDistanceLeftAndRight );
- aSymbolRect.AdjustRight( -nBorderDistanceLeftAndRight );
- // 40% distance to the top button border
- const tools::Long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 400) + 500) / 1000;
- aSymbolRect.AdjustTop(nBorderDistanceTop );
- // 15% distance to the bottom button border
- const tools::Long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 150) + 500) / 1000;
- aSymbolRect.AdjustBottom( -nBorderDistanceBottom );
- DecorationView aDecoView(&rRenderContext);
- aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, (bHighContrast ? COL_WHITE : COL_BLACK));
+ mxMenuButton->set_item_visible("sep1", bReplyVis);
}
-void AnnotationMenuButton::KeyInput(const KeyEvent& rKeyEvt)
+IMPL_LINK(SwAnnotationWin, KeyInputHdl, const KeyEvent&, rKeyEvt, bool)
{
const vcl::KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
if (rKeyCode.GetCode() == KEY_TAB)
{
- mrSidebarWin.ActivatePostIt();
- mrSidebarWin.GrabFocus();
- }
- else
- {
- MenuButton::KeyInput(rKeyEvt);
+ ActivatePostIt();
+ GrabFocus();
+ return true;
}
+ return false;
}
} // end of namespace sw::annotation
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.hxx b/sw/source/uibase/docvw/AnnotationMenuButton.hxx
deleted file mode 100644
index 8734cd9565b8..000000000000
--- a/sw/source/uibase/docvw/AnnotationMenuButton.hxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include <vcl/menubtn.hxx>
-
-namespace sw::annotation {
- class SwAnnotationWin;
-}
-
-namespace sw::annotation {
-
-class AnnotationMenuButton : public MenuButton
-{
- public:
- AnnotationMenuButton( sw::annotation::SwAnnotationWin& rSidebarWin );
- virtual ~AnnotationMenuButton() override;
- virtual void dispose() override;
-
- // override MenuButton methods
- virtual void Select() override;
-
- // override vcl::Window methods
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
- virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
- virtual void KeyInput( const KeyEvent& rKeyEvt ) override;
-
- private:
- sw::annotation::SwAnnotationWin& mrSidebarWin;
-};
-
-} // end of namespace sw::annotation
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 45afbc5c1f0a..34edc64425f5 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -19,7 +19,6 @@
#include <AnnotationWin.hxx>
-#include "AnnotationMenuButton.hxx"
#include <PostItMgr.hxx>
#include <strings.hrc>
@@ -90,16 +89,10 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
SwPostItMgr& aMgr,
SwSidebarItem& rSidebarItem,
SwFormatField* aField )
- : Window(&rEditWin)
- , maBuilder(nullptr, AllSettings::GetUIRootDir(), "modules/swriter/ui/annotationmenu.ui", "")
+ : InterimItemWindow(&rEditWin, "modules/swriter/ui/annotation.ui", "Annotation")
, mrMgr(aMgr)
, mrView(rEditWin.GetView())
, mnEventId(nullptr)
- , mpSidebarTextControl(nullptr)
- , mpVScrollbar(nullptr)
- , mpMetadataAuthor(nullptr)
- , mpMetadataDate(nullptr)
- , mpMenuButton(nullptr)
, mColorAnchor()
, mColorDark()
, mColorLight()
@@ -118,10 +111,11 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
, mpAnchorFrame(rSidebarItem.maLayoutInfo.mpAnchorFrame)
, mpFormatField(aField)
, mpField( static_cast<SwPostItField*>(aField->GetField()))
- , mpButtonPopup(nullptr)
{
set_id("Comment"+OUString::number(mpField->GetPostItId()));
+ m_xContainer->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
+
mpShadow = sidebarwindows::ShadowOverlayObject::CreateShadowOverlayObject( mrView );
if ( mpShadow )
{
@@ -145,9 +139,6 @@ SwAnnotationWin::~SwAnnotationWin()
void SwAnnotationWin::dispose()
{
- mpButtonPopup.clear();
- maBuilder.disposeBuilder();
-
if (IsDisposed())
return;
@@ -156,55 +147,28 @@ void SwAnnotationWin::dispose()
Disable();
- if ( mpSidebarTextControl )
- {
- if ( mpOutlinerView )
- {
- mpOutlinerView->SetWindow( nullptr );
- }
- }
- mpSidebarTextControl.disposeAndClear();
-
- mpOutlinerView.reset();
- mpOutliner.reset();
-
- if (mpMetadataAuthor)
- {
- mpMetadataAuthor->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
- }
- mpMetadataAuthor.disposeAndClear();
-
- if (mpMetadataResolved)
- {
- mpMetadataResolved->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
- }
- mpMetadataResolved.disposeAndClear();
-
- if (mpMetadataDate)
- {
- mpMetadataDate->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
- }
- mpMetadataDate.disposeAndClear();
-
- if (mpVScrollbar)
- {
- mpVScrollbar->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
- }
- mpVScrollbar.disposeAndClear();
+ mxSidebarTextControlWin.reset();
+ mxSidebarTextControl.reset();
- RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
+ mxMetadataAuthor.reset();
+ mxMetadataResolved.reset();
+ mxMetadataDate.reset();
+ mxVScrollbar.reset();
mpAnchor.reset();
mpShadow.reset();
mpTextRangeOverlay.reset();
- mpMenuButton.disposeAndClear();
+ mxMenuButton.reset();
if (mnEventId)
Application::RemoveUserEvent( mnEventId );
- vcl::Window::dispose();
+ mpOutliner.reset();
+ mpOutlinerView.reset();
+
+ InterimItemWindow::dispose();
}
void SwAnnotationWin::SetPostItText()
@@ -254,9 +218,9 @@ void SwAnnotationWin::SetResolved(bool resolved)
mpTextRangeOverlay.reset();
if(IsResolved())
- mpMetadataResolved->Show();
+ mxMetadataResolved->show();
else
- mpMetadataResolved->Hide();
+ mxMetadataResolved->hide();
if(IsResolved() != oldState)
mbResolvedStateUpdated = true;
@@ -437,21 +401,6 @@ sal_uInt32 SwAnnotationWin::CountFollowing()
return aCount - 1;
}
-VclPtr<MenuButton> SwAnnotationWin::CreateMenuButton()
-{
- mpButtonPopup = maBuilder.get_menu("menu");
- sal_uInt16 nByAuthorId = mpButtonPopup->GetItemId("deleteby");
- OUString aText = mpButtonPopup->GetItemText(nByAuthorId);
- SwRewriter aRewriter;
- aRewriter.AddRule(UndoArg1,GetAuthor());
- aText = aRewriter.Apply(aText);
- mpButtonPopup->SetItemText(nByAuthorId, aText);
- VclPtrInstance<AnnotationMenuButton> pMenuButton( *this );
- pMenuButton->SetPopupMenu( mpButtonPopup );
- pMenuButton->Show();
- return pMenuButton;
-}
-
void SwAnnotationWin::InitAnswer(OutlinerParaObject const * pText)
{
// If tiled annotations is off in lok case, skip adding additional reply text.
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index d093ed61508b..36f179869e45 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -27,7 +27,6 @@
#include <IDocumentUndoRedo.hxx>
#include <basegfx/range/b2drange.hxx>
#include "SidebarTxtControl.hxx"
-#include "SidebarScrollBar.hxx"
#include "AnchorOverlayObject.hxx"
#include "ShadowOverlayObject.hxx"
#include "OverlayRanges.hxx"
@@ -56,7 +55,6 @@
#include <vcl/event.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/menubtn.hxx>
#include <vcl/settings.hxx>
#include <vcl/ptrstyle.hxx>
#include <vcl/uitest/logger.hxx>
@@ -69,12 +67,14 @@
#include <doc.hxx>
#include <swmodule.hxx>
+#include <SwRewriter.hxx>
#include <txtannotationfld.hxx>
#include <ndtxt.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <unotools/syslocale.hxx>
#include <memory>
#include <comphelper/lok.hxx>
@@ -94,62 +94,6 @@ void collectUIInformation( const OUString& aevent , const OUString& aID )
UITestLogger::getInstance().logEvent(aDescription);
}
-/// Translate absolute <-> relative twips: LOK wants absolute coordinates as output and gives absolute coordinates as input.
-void lcl_translateTwips(vcl::Window const & rParent, vcl::Window& rChild, MouseEvent* pMouseEvent)
-{
- // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones.
- Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel());
- if (!rChild.IsMapModeEnabled())
- {
- MapMode aMapMode(rChild.GetMapMode());
- aMapMode.SetMapUnit(MapUnit::MapTwip);
- aMapMode.SetScaleX(rParent.GetMapMode().GetScaleX());
- aMapMode.SetScaleY(rParent.GetMapMode().GetScaleY());
- rChild.SetMapMode(aMapMode);
- rChild.EnableMapMode();
- }
- aOffset = rChild.PixelToLogic(aOffset);
- MapMode aMapMode(rChild.GetMapMode());
- aMapMode.SetOrigin(aOffset);
- aMapMode.SetMapUnit(rParent.GetMapMode().GetMapUnit());
- rChild.SetMapMode(aMapMode);
- rChild.EnableMapMode(false);
-
- if (pMouseEvent)
- {
- // Set event coordinates, so they contain relative coordinates instead of absolute ones.
- Point aPos = pMouseEvent->GetPosPixel();
- aPos.Move(-aOffset.getX(), -aOffset.getY());
- MouseEvent aMouseEvent(aPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(), pMouseEvent->GetButtons(), pMouseEvent->GetModifier());
- *pMouseEvent = aMouseEvent;
- }
-}
-
-/// Decide which one from the children of rParent should get rMouseEvent.
-vcl::Window* lcl_getHitWindow(sw::annotation::SwAnnotationWin& rParent, const MouseEvent& rMouseEvent)
-{
- vcl::Window* pRet = nullptr;
-
- rParent.EditWin().Push(PushFlags::MAPMODE);
- rParent.EditWin().EnableMapMode();
- for (sal_Int16 i = rParent.GetChildCount() - 1; i >= 0; --i)
- {
- vcl::Window* pChild = rParent.GetChild(i);
-
- Point aPosition(rParent.GetPosPixel());
- aPosition.Move(pChild->GetPosPixel().getX(), pChild->GetPosPixel().getY());
- Size aSize(rParent.GetSizePixel());
- tools::Rectangle aRectangleLogic(rParent.EditWin().PixelToLogic(aPosition), rParent.EditWin().PixelToLogic(aSize));
- if (aRectangleLogic.IsInside(rMouseEvent.GetPosPixel()))
- {
- pRet = pChild;
- break;
- }
- }
- rParent.EditWin().Pop();
- return pRet;
-}
-
}
namespace sw::annotation {
@@ -160,80 +104,22 @@ namespace sw::annotation {
#define POSTIT_META_FIELD_HEIGHT sal_Int32(15)
#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
-
-void SwAnnotationWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
+void SwAnnotationWin::PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{
- Window::Paint(rRenderContext, rRect);
+ bool bMenuButtonVisible = mxMenuButton->get_visible();
+ // No point in showing this button till click on it are not handled.
+ if (bMenuButtonVisible)
+ mxMenuButton->hide();
- if (!mpMetadataAuthor->IsVisible())
- return;
-
- //draw left over space
+ // draw left over space
if (Application::GetSettings().GetStyleSettings().GetHighContrastMode())
- {
rRenderContext.SetFillColor(COL_BLACK);
- }
else
- {
rRenderContext.SetFillColor(mColorDark);
- }
-
- sal_uInt32 boxHeight = mpMetadataAuthor->GetSizePixel().Height() + mpMetadataDate->GetSizePixel().Height();
- boxHeight += IsResolved() ? mpMetadataResolved->GetSizePixel().Height() : 0;
-
rRenderContext.SetLineColor();
- tools::Rectangle aRectangle(Point(mpMetadataAuthor->GetPosPixel().X() + mpMetadataAuthor->GetSizePixel().Width(),
- mpMetadataAuthor->GetPosPixel().Y()),
- Size(GetMetaButtonAreaWidth(), boxHeight));
-
- if (comphelper::LibreOfficeKit::isActive())
- aRectangle = rRect;
- else
- aRectangle = PixelToLogic(aRectangle);
- rRenderContext.DrawRect(aRectangle);
-}
-
-void SwAnnotationWin::PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
-{
- Paint(rRenderContext, rRect);
-
- for (sal_uInt16 i = 0; i < GetChildCount(); ++i)
- {
- vcl::Window* pChild = GetChild(i);
-
- // No point in showing this button till click on it are not handled.
- if (pChild == mpMenuButton.get())
- continue;
-
- if (!pChild->IsVisible())
- continue;
-
- rRenderContext.Push(PushFlags::MAPMODE);
- Point aOffset(PixelToLogic(pChild->GetPosPixel()));
- MapMode aMapMode(rRenderContext.GetMapMode());
- aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
- rRenderContext.SetMapMode(aMapMode);
-
- bool bPopChild = false;
- if (pChild->GetMapMode().GetMapUnit() != rRenderContext.GetMapMode().GetMapUnit())
- {
- // This is needed for the scrollbar that has its map unit in pixels.
- pChild->Push(PushFlags::MAPMODE);
- bPopChild = true;
- pChild->EnableMapMode();
- aMapMode = pChild->GetMapMode();
- aMapMode.SetMapUnit(rRenderContext.GetMapMode().GetMapUnit());
- aMapMode.SetScaleX(rRenderContext.GetMapMode().GetScaleX());
- aMapMode.SetScaleY(rRenderContext.GetMapMode().GetScaleY());
- pChild->SetMapMode(aMapMode);
- }
+ rRenderContext.DrawRect(rRect);
- pChild->Paint(rRenderContext, rRect);
-
- if (bPopChild)
- pChild->Pop();
- rRenderContext.Pop();
- }
+ m_xContainer->draw(rRenderContext, rRect.TopLeft(), GetSizePixel());
const drawinglayer::geometry::ViewInformation2D aViewInformation;
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aViewInformation));
@@ -250,6 +136,9 @@ void SwAnnotationWin::PaintTile(vcl::RenderContext& rRenderContext, const tools:
rRenderContext.Push(PushFlags::NONE);
pProcessor.reset();
rRenderContext.Push(PushFlags::NONE);
+
+ if (bMenuButtonVisible)
+ mxMenuButton->show();
}
bool SwAnnotationWin::IsHitWindow(const Point& rPointLogic)
@@ -260,62 +149,66 @@ bool SwAnnotationWin::IsHitWindow(const Point& rPointLogic)
void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
{
- mpSidebarTextControl->Push(PushFlags::MAPMODE);
- MouseEvent aMouseEvent(rPosition);
- lcl_translateTwips(EditWin(), *mpSidebarTextControl, &aMouseEvent);
- Point aPosition(aMouseEvent.GetPosPixel());
-
- EditView& rEditView = GetOutlinerView()->GetEditView();
- rEditView.SetCursorLogicPosition(aPosition, bPoint, bClearMark);
-
- mpSidebarTextControl->Pop();
+ mxSidebarTextControl->SetCursorLogicPosition(rPosition, bPoint, bClearMark);
}
-void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFlags)
+void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt)
{
+ pDev->Push();
+
+ pDev->SetFillColor(mColorDark);
+ pDev->SetLineColor();
+
+ pDev->SetTextColor(mColorAnchor);
+ vcl::Font aFont = maLabelFont;
+ aFont.SetFontHeight(aFont.GetFontHeight() * 20);
+ pDev->SetFont(aFont);
+
Size aSz = PixelToLogic(GetSizePixel());
+ pDev->DrawRect(tools::Rectangle(rPt, aSz));
- if (mpMetadataAuthor->IsVisible() )
+ if (mxMetadataAuthor->get_visible())
{
- pDev->SetFillColor(mColorDark);
- pDev->SetLineColor();
- pDev->DrawRect( tools::Rectangle( rPt, aSz ) );
- }
+ int x, y, width, height;
+ mxMetadataAuthor->get_extents_relative_to(*m_xContainer, x, y, width, height);
+ Point aPos(rPt + PixelToLogic(Point(x, y)));
+ Size aSize(PixelToLogic(Size(width, height)));
- if (mpMetadataAuthor->IsVisible())
- {
- vcl::Font aOrigFont(mpMetadataAuthor->GetControlFont());
- Point aPos(PixelToLogic(mpMetadataAuthor->GetPosPixel()));
- aPos += rPt;
- vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetLabelFont() );
- mpMetadataAuthor->SetControlFont( aFont );
- mpMetadataAuthor->Draw(pDev, aPos, nInFlags);
- mpMetadataAuthor->SetControlFont( aOrigFont );
+ pDev->Push(PushFlags::CLIPREGION);
+ pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
+ pDev->DrawText(aPos, mxMetadataAuthor->get_label());
+ pDev->Pop();
}
- if (mpMetadataDate->IsVisible())
+// m_xContainer->draw(*pDev, rPt, GetSizePixel());
+
+ if (mxMetadataDate->get_visible())
{
- vcl::Font aOrigFont(mpMetadataDate->GetControlFont());
- Point aPos(PixelToLogic(mpMetadataDate->GetPosPixel()));
- aPos += rPt;
- vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() );
- mpMetadataDate->SetControlFont( aFont );
- mpMetadataDate->Draw(pDev, aPos, nInFlags);
- mpMetadataDate->SetControlFont( aOrigFont );
+ int x, y, width, height;
+ mxMetadataDate->get_extents_relative_to(*m_xContainer, x, y, width, height);
+ Point aPos(rPt + PixelToLogic(Point(x, y)));
+ Size aSize(PixelToLogic(Size(width, height)));
+
+ pDev->Push(PushFlags::CLIPREGION);
+ pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
+ pDev->DrawText(aPos, mxMetadataDate->get_label());
+ pDev->Pop();
}
- if (mpMetadataResolved->IsVisible())
+ if (mxMetadataResolved->get_visible())
{
- vcl::Font aOrigFont(mpMetadataResolved->GetControlFont());
- Point aPos(PixelToLogic(mpMetadataResolved->GetPosPixel()));
- aPos += rPt;
- vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetLabelFont() );
- mpMetadataResolved->SetControlFont( aFont );
- mpMetadataResolved->Draw(pDev, aPos, nInFlags);
- mpMetadataResolved->SetControlFont( aOrigFont );
+ int x, y, width, height;
+ mxMetadataResolved->get_extents_relative_to(*m_xContainer, x, y, width, height);
+ Point aPos(rPt + PixelToLogic(Point(x, y)));
+ Size aSize(PixelToLogic(Size(width, height)));
+
+ pDev->Push(PushFlags::CLIPREGION);
+ pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
+ pDev->DrawText(aPos, mxMetadataResolved->get_label());
+ pDev->Pop();
}
- mpSidebarTextControl->Draw(pDev, rPt, nInFlags);
+ mxSidebarTextControl->DrawForPage(pDev, rPt);
const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
@@ -328,85 +221,17 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl
pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
pProcessor.reset();
- if (!mpVScrollbar->IsVisible())
- return;
-
- // if there is a scrollbar shown, draw "..." to indicate the comment isn't
- // completely shown
- vcl::Font aOrigFont(mpMetadataDate->GetControlFont());
- Color aOrigBg( mpMetadataDate->GetControlBackground() );
- OUString sOrigText(mpMetadataDate->GetText());
-
- Point aPos(PixelToLogic(mpMenuButton->GetPosPixel()));
- aPos += rPt;
-
- vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() );
- mpMetadataDate->SetControlFont( aFont );
- mpMetadataDate->SetControlBackground( Color(0xFFFFFF) );
- mpMetadataDate->SetText("...");
- Size aOrigSize = mpMetadataDate->GetSizePixel();
- mpMetadataDate->SetSizePixel(mpMenuButton->GetSizePixel());
- mpMetadataDate->Draw(pDev, aPos, nInFlags);
- mpMetadataDate->SetSizePixel(aOrigSize);
-
- mpMetadataDate->SetText(sOrigText);
- mpMetadataDate->SetControlFont( aOrigFont );
- mpMetadataDate->SetControlBackground( aOrigBg );
-}
-
-void SwAnnotationWin::KeyInput(const KeyEvent& rKeyEvent)
-{
- if (mpSidebarTextControl)
+ if (mxVScrollbar->get_vpolicy() != VclPolicyType::NEVER)
{
- mpSidebarTextControl->Push(PushFlags::MAPMODE);
- lcl_translateTwips(EditWin(), *mpSidebarTextControl, nullptr);
-
- mpSidebarTextControl->KeyInput(rKeyEvent);
-
- mpSidebarTextControl->Pop();
- }
-}
-
-void SwAnnotationWin::MouseMove(const MouseEvent& rMouseEvent)
-{
- if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
- {
- pHit->Push(PushFlags::MAPMODE);
- MouseEvent aMouseEvent(rMouseEvent);
- lcl_translateTwips(EditWin(), *pHit, &aMouseEvent);
-
- pHit->MouseMove(aMouseEvent);
-
- pHit->Pop();
+ // if there is a scrollbar shown, draw "..." to indicate the comment isn't
+ // completely shown
+ int x, y, width, height;
+ mxMenuButton->get_extents_relative_to(*m_xContainer, x, y, width, height);
+ Point aPos(rPt + PixelToLogic(Point(x, y)));
+ pDev->DrawText(aPos, "...");
}
-}
-
-void SwAnnotationWin::MouseButtonDown(const MouseEvent& rMouseEvent)
-{
- if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
- {
- pHit->Push(PushFlags::MAPMODE);
- MouseEvent aMouseEvent(rMouseEvent);
- lcl_translateTwips(EditWin(), *pHit, &aMouseEvent);
-
- pHit->MouseButtonDown(aMouseEvent);
-
- pHit->Pop();
- }
-}
-
-void SwAnnotationWin::MouseButtonUp(const MouseEvent& rMouseEvent)
-{
- if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
- {
- pHit->Push(PushFlags::MAPMODE);
- MouseEvent aMouseEvent(rMouseEvent);
- lcl_translateTwips(EditWin(), *pHit, &aMouseEvent);
-
- pHit->MouseButtonUp(aMouseEvent);
- pHit->Pop();
- }
+ pDev->Pop();
}
void SwAnnotationWin::SetPosSizePixelRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
@@ -458,63 +283,36 @@ SfxItemSet SwAnnotationWin::DefaultItem()
void SwAnnotationWin::InitControls()
{
- AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
+ // window controls for author and date
+ mxMetadataAuthor = m_xBuilder->weld_label("author");
+ mxMetadataAuthor->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
+ mxMetadataAuthor->set_direction(AllSettings::GetLayoutRTL());
- // actual window which holds the user text
- mpSidebarTextControl = VclPtr<SidebarTextControl>::Create( *this,
- WB_NODIALOGCONTROL,
- mrView, mrMgr );
- mpSidebarTextControl->SetPointer(PointerStyle::Text);
+ maLabelFont = Application::GetSettings().GetStyleSettings().GetLabelFont();
+ maLabelFont.SetFontHeight(8);
- // window controls for author and date
- mpMetadataAuthor = VclPtr<FixedText>::Create(this);
- mpMetadataAuthor->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
- mpMetadataAuthor->EnableRTL(AllSettings::GetLayoutRTL());
- mpMetadataAuthor->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
// we should leave this setting alone, but for this we need a better layout algo
// with variable meta size height
- {
- AllSettings aSettings = mpMetadataAuthor->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- vcl::Font aFont = aStyleSettings.GetLabelFont();
- aFont.SetFontHeight(8);
- aStyleSettings.SetLabelFont(aFont);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMetadataAuthor->SetSettings(aSettings);
- }
+ mxMetadataAuthor->set_font(maLabelFont);
+
+ mxMetadataDate = m_xBuilder->weld_label("date");
+ mxMetadataDate->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_DATE_NAME ) );
+ mxMetadataDate->set_direction(AllSettings::GetLayoutRTL());
+ mxMetadataDate->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
- mpMetadataDate = VclPtr<FixedText>::Create(this);
- mpMetadataDate->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_DATE_NAME ) );
- mpMetadataDate->EnableRTL(AllSettings::GetLayoutRTL());
- mpMetadataDate->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
// we should leave this setting alone, but for this we need a better layout algo
// with variable meta size height
- {
- AllSettings aSettings = mpMetadataDate->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- vcl::Font aFont = aStyleSettings.GetLabelFont();
- aFont.SetFontHeight(8);
- aStyleSettings.SetLabelFont(aFont);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMetadataDate->SetSettings(aSettings);
- }
+ mxMetadataDate->set_font(maLabelFont);
+
+ mxMetadataResolved = m_xBuilder->weld_label("resolved");
+ mxMetadataResolved->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
+ mxMetadataResolved->set_direction(AllSettings::GetLayoutRTL());
+ mxMetadataResolved->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
- mpMetadataResolved = VclPtr<FixedText>::Create(this);
- mpMetadataResolved->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
- mpMetadataResolved->EnableRTL(AllSettings::GetLayoutRTL());
- mpMetadataResolved->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
// we should leave this setting alone, but for this we need a better layout algo
// with variable meta size height
- {
- AllSettings aSettings = mpMetadataResolved->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- vcl::Font aFont = aStyleSettings.GetLabelFont();
- aFont.SetFontHeight(8);
- aStyleSettings.SetLabelFont(aFont);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMetadataResolved->SetSettings(aSettings);
- mpMetadataResolved->SetText( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
- }
+ mxMetadataResolved->set_font(maLabelFont);
+ mxMetadataResolved->set_label(SwResId(STR_ACCESS_ANNOTATION_RESOLVED_NAME));
SwDocShell* aShell = mrView.GetDocShell();
mpOutliner.reset(new Outliner(&aShell->GetPool(),OutlinerMode::TextObject));
@@ -522,21 +320,28 @@ void SwAnnotationWin::InitControls()
mpOutliner->SetUpdateMode( true );
Rescale();
- mpSidebarTextControl->EnableRTL( false );
- mpOutlinerView.reset(new OutlinerView ( mpOutliner.get(), mpSidebarTextControl ));
+ mpOutlinerView.reset(new OutlinerView(mpOutliner.get(), nullptr));
+ mpOutliner->InsertView(mpOutlinerView.get());
+
+ //create Scrollbars
+ mxVScrollbar = m_xBuilder->weld_scrolled_window("scrolledwindow", true);
+
+ // actual window which holds the user text
+ mxSidebarTextControl.reset(new SidebarTextControl(*this, mrView, mrMgr));
+ mxSidebarTextControlWin.reset(new weld::CustomWeld(*m_xBuilder, "editview", *mxSidebarTextControl));
+ mxSidebarTextControl->SetPointer(PointerStyle::Text);
+
mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
- mpOutliner->InsertView(mpOutlinerView.get() );
mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );
mpOutlinerView->SetAttribs(DefaultItem());
- //create Scrollbars
- mpVScrollbar = VclPtr<SidebarScrollBar>::Create(*this, WB_3DLOOK |WB_VSCROLL|WB_DRAG, mrView);
- mpVScrollbar->EnableNativeWidget(false);
- mpVScrollbar->EnableRTL( false );
- mpVScrollbar->SetScrollHdl(LINK(this, SwAnnotationWin, ScrollHdl));
- mpVScrollbar->EnableDrag();
- mpVScrollbar->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
+ mxVScrollbar->set_direction(false);
+ mxVScrollbar->connect_vadjustment_changed(LINK(this, SwAnnotationWin, ScrollHdl));
+ mxVScrollbar->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
+
+ mxMenuButton = m_xBuilder->weld_menu_button("menubutton");
+ mxMenuButton->set_size_request(METABUTTON_WIDTH, METABUTTON_HEIGHT);
const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
EEControlBits nCntrl = mpOutliner->GetControlWord();
@@ -559,18 +364,32 @@ void SwAnnotationWin::InitControls()
CheckMetaText();
- mpMenuButton = CreateMenuButton();
+ // expand %1 "Author"
+ OUString aText = mxMenuButton->get_item_label("deleteby");
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UndoArg1, GetAuthor());
+ aText = aRewriter.Apply(aText);
+ mxMenuButton->set_item_label("deleteby", aText);
+
+ mxMenuButton->set_accessible_name(SwResId(STR_ACCESS_ANNOTATION_BUTTON_NAME));
+ mxMenuButton->set_accessible_description(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
+ mxMenuButton->set_tooltip_text(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
+
+ mxMenuButton->connect_toggled(LINK(this, SwAnnotationWin, ToggleHdl));
+ mxMenuButton->connect_selected(LINK(this, SwAnnotationWin, SelectHdl));
+ mxMenuButton->connect_key_press(LINK(this, SwAnnotationWin, KeyInputHdl));
+ mxMenuButton->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
SetLanguage(GetLanguage());
GetOutlinerView()->StartSpeller();
SetPostItText();
mpOutliner->CompleteOnlineSpelling();
- mpSidebarTextControl->Show();
- mpMetadataAuthor->Show();
- mpMetadataDate->Show();
- if(IsResolved()) { mpMetadataResolved->Show(); }
- mpVScrollbar->Show();
+ mxSidebarTextControl->Show();
+ mxMetadataAuthor->show();
+ mxMetadataDate->show();
+ mxMetadataResolved->set_visible(IsResolved());
+ mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
}
void SwAnnotationWin::CheckMetaText()
@@ -586,9 +405,9 @@ void SwAnnotationWin::CheckMetaText()
{
sMeta = OUString::Concat(sMeta.subView(0, 20)) + "...";
}
- if ( mpMetadataAuthor->GetText() != sMeta )
+ if ( mxMetadataAuthor->get_label() != sMeta )
{
- mpMetadataAuthor->SetText(sMeta);
+ mxMetadataAuthor->set_label(sMeta);
}
Date aDate = GetDate();
@@ -604,10 +423,15 @@ void SwAnnotationWin::CheckMetaText()
{
sMeta += " " + rLocalData.getTime( GetTime(),false );
}
- if ( mpMetadataDate->GetText() != sMeta )
+ if ( mxMetadataDate->get_label() != sMeta )
{
- mpMetadataDate->SetText(sMeta);
+ mxMetadataDate->set_label(sMeta);
}
+
+ std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
+ SetColor( SwPostItMgr::GetColorDark(aIndex),
+ SwPostItMgr::GetColorLight(aIndex),
+ SwPostItMgr::GetColorAnchor(aIndex));
}
void SwAnnotationWin::Rescale()
@@ -624,29 +448,18 @@ void SwAnnotationWin::Rescale()
aMode.SetOrigin( Point() );
mpOutliner->SetRefMapMode( aMode );
SetMapMode( aMode );
- mpSidebarTextControl->SetMapMode( aMode );
const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY();
- if ( mpMetadataAuthor )
- {
- vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetLabelFont() );
- sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
- aFont.SetFontHeight( nHeight );
- mpMetadataAuthor->SetControlFont( aFont );
- }
- if ( mpMetadataDate )
- {
- vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() );
- sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
- aFont.SetFontHeight( nHeight );
- mpMetadataDate->SetControlFont( aFont );
- }
- if ( mpMetadataResolved )
- {
- vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetLabelFont() );
- sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
- aFont.SetFontHeight( nHeight );
- mpMetadataResolved->SetControlFont( aFont );
- }
+
+ vcl::Font aFont = maLabelFont;
+ sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
+ aFont.SetFontHeight( nHeight );
+
+ if (mxMetadataAuthor)
+ mxMetadataAuthor->set_font(aFont);
+ if (mxMetadataDate)
+ mxMetadataDate->set_font(aFont);
+ if (mxMetadataResolved)
+ mxMetadataResolved->set_font(aFont);
}
void SwAnnotationWin::SetPosAndSize()
@@ -658,23 +471,7 @@ void SwAnnotationWin::SetPosAndSize()
bChange = true;
SetSizePixel(mPosSize.GetSize());
- if (comphelper::LibreOfficeKit::isActive())
- {
- // Position is not yet set at VCL level, but the map mode should
- // contain the right origin to emit the correct cursor position.
- mpSidebarTextControl->Push(PushFlags::MAPMODE);
- Point aOffset(mPosSize.Left(), mPosSize.Top());
- aOffset = PixelToLogic(aOffset);
- MapMode aMapMode(mpSidebarTextControl->GetMapMode());
- aMapMode.SetOrigin(aOffset);
- mpSidebarTextControl->SetMapMode(aMapMode);
- mpSidebarTextControl->EnableMapMode(false);
- }
-
DoResize();
-
- if (comphelper::LibreOfficeKit::isActive())
- mpSidebarTextControl->Pop();
}
if (GetPosPixel().X() != mPosSize.Left() || (std::abs(GetPosPixel().Y() - mPosSize.Top()) > 5) )
@@ -890,37 +687,19 @@ void SwAnnotationWin::DoResize()
tools::ULong aWidth = GetSizePixel().Width();
aHeight -= GetMetaHeight();
- mpMetadataAuthor->Show();
- if(IsResolved()) { mpMetadataResolved->Show(); }
- mpMetadataDate->Show();
- unsigned int numFields = GetNumFields();
+ mxMetadataAuthor->show();
+ if(IsResolved()) { mxMetadataResolved->show(); }
+ mxMetadataDate->show();
+
if (aTextHeight > aHeight)
- { // we need vertical scrollbars and have to reduce the width
- aWidth -= GetScrollbarWidth();
- mpVScrollbar->Show();
- }
- else
{
- mpVScrollbar->Hide();
+ // we need vertical scrollbars and have to reduce the width
+ aWidth -= mxVScrollbar->get_vscroll_width();
+ mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
}
-
+ else
{
- const Size aSizeOfMetadataControls( GetSizePixel().Width() - GetMetaButtonAreaWidth(),
- GetMetaHeight()/numFields );
- mpMetadataAuthor->setPosSizePixel( 0,
- aHeight,
- aSizeOfMetadataControls.Width(),
- aSizeOfMetadataControls.Height() );
- mpMetadataDate->setPosSizePixel( 0,
- aHeight + aSizeOfMetadataControls.Height(),
- aSizeOfMetadataControls.Width(),
- aSizeOfMetadataControls.Height() );
- if(IsResolved()) {
- mpMetadataResolved->setPosSizePixel( 0,
- aHeight + aSizeOfMetadataControls.Height()*2,
- aSizeOfMetadataControls.Width(),
- aSizeOfMetadataControls.Height() );
- }
+ mxVScrollbar->set_vpolicy(VclPolicyType::NEVER);
}
mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
@@ -930,12 +709,13 @@ void SwAnnotationWin::DoResize()
mpOutlinerView->RegisterViewShell(&mrView);
}
- if (!mpVScrollbar->IsVisible())
+ if (mxVScrollbar->get_vpolicy() == VclPolicyType::NEVER)
{ // if we do not have a scrollbar anymore, we want to see the complete text
mpOutlinerView->SetVisArea( PixelToLogic( tools::Rectangle(0,0,aWidth,aHeight) ) );
}
tools::Rectangle aOutputArea = PixelToLogic(tools::Rectangle(0, 0, aWidth, aHeight));
mpOutlinerView->SetOutputArea(aOutputArea);
+ mpOutlinerView->ShowCursor(true, true);
// Don't leave an empty area at the bottom if we can move the text down.
tools::Long nMaxVisAreaTop = mpOutliner->GetTextHeight() - aOutputArea.GetHeight();
@@ -944,38 +724,29 @@ void SwAnnotationWin::DoResize()
GetOutlinerView()->Scroll(0, mpOutlinerView->GetVisArea().Top() - nMaxVisAreaTop);
}
- if (!AllSettings::GetLayoutRTL())
- {
- mpSidebarTextControl->setPosSizePixel(0, 0, aWidth, aHeight);
- mpVScrollbar->setPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight);
- }
- else
- {
- mpSidebarTextControl->setPosSizePixel( ( aTextHeight > aHeight ? GetScrollbarWidth() : 0 ), 0,
- aWidth, aHeight);
- mpVScrollbar->setPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight);
- }
+ int nUpper = mpOutliner->GetTextHeight();
+ int nCurrentDocPos = mpOutlinerView->GetVisArea().Top();
+ int nStepIncrement = mpOutliner->GetTextHeight() / 10;
+ int nPageIncrement = PixelToLogic(Size(0,aHeight)).Height() * 8 / 10;
+ int nPageSize = PixelToLogic(Size(0,aHeight)).Height();
+
+ /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
+ effectively...
+
+ lower = gtk_adjustment_get_lower
+ upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
+
+ and requires that upper > lower or the deceleration animation never ends
+ */
+ nPageSize = std::min(nPageSize, nUpper);
- mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
- mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
- mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
- SetScrollbar();
- mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
-
- //calculate rects for meta- button
- const Fraction& fx( GetMapMode().GetScaleX() );
- const Fraction& fy( GetMapMode().GetScaleY() );
-
- const Point aPos( mpMetadataAuthor->GetPosPixel());
- mpMenuButton->setPosSizePixel( tools::Long(aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx),
- tools::Long(aPos.Y()+5*fy),
- tools::Long(METABUTTON_WIDTH*fx),
- tools::Long(METABUTTON_HEIGHT*fy) );
+ mxVScrollbar->vadjustment_configure(nCurrentDocPos, 0, nUpper,
+ nStepIncrement, nPageIncrement, nPageSize);
}
void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
{
- Window::SetSizePixel(rNewSize);
+ InterimItemWindow::SetSizePixel(rNewSize);
if (mpShadow)
{
@@ -987,7 +758,7 @@ void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
void SwAnnotationWin::SetScrollbar()
{
- mpVScrollbar->SetThumbPos(mpOutlinerView->GetVisArea().Top());
+ mxVScrollbar->vadjustment_set_value(mpOutlinerView->GetVisArea().Top());
}
void SwAnnotationWin::ResizeIfNecessary(tools::Long aOldHeight, tools::Long aNewHeight)
@@ -1037,41 +808,19 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorA
if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
return;
- {
- mpMetadataAuthor->SetControlBackground(mColorDark);
- AllSettings aSettings = mpMetadataAuthor->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- aStyleSettings.SetLabelTextColor(aColorAnchor);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMetadataAuthor->SetSettings(aSettings);
- }
+ m_xContainer->set_background(mColorDark);
+ mxMenuButton->set_background(mColorDark);
- {
- mpMetadataDate->SetControlBackground(mColorDark);
- AllSettings aSettings = mpMetadataDate->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- aStyleSettings.SetLabelTextColor(aColorAnchor);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMetadataDate->SetSettings(aSettings);
- }
+ mxMetadataAuthor->set_font_color(aColorAnchor);
- {
- mpMetadataResolved->SetControlBackground(mColorDark);
- AllSettings aSettings = mpMetadataResolved->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- aStyleSettings.SetLabelTextColor(aColorAnchor);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMetadataResolved->SetSettings(aSettings);
- }
+ mxMetadataDate->set_font_color(aColorAnchor);
+
+ mxMetadataResolved->set_font_color(aColorAnchor);
- AllSettings aSettings2 = mpVScrollbar->GetSettings();
- StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
- aStyleSettings2.SetButtonTextColor(Color(0,0,0));
- aStyleSettings2.SetCheckedColor(mColorLight); // background
- aStyleSettings2.SetShadowColor(mColorAnchor);
- aStyleSettings2.SetFaceColor(mColorDark);
- aSettings2.SetStyleSettings(aStyleSettings2);
- mpVScrollbar->SetSettings(aSettings2);
+ mxVScrollbar->customize_scrollbars(mColorLight,
+ mColorAnchor,
+ mColorDark,
+ GetPrefScrollbarWidth());
}
void SwAnnotationWin::SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition)
@@ -1145,8 +894,8 @@ void SwAnnotationWin::SetLanguage(const SvxLanguageItem& rNewItem)
void SwAnnotationWin::GetFocus()
{
- if (mpSidebarTextControl)
- mpSidebarTextControl->GrabFocus();
+ if (mxSidebarTextControl)
+ mxSidebarTextControl->GrabFocus();
}
void SwAnnotationWin::LoseFocus()
@@ -1165,8 +914,6 @@ void SwAnnotationWin::ShowNote()
if (mpTextRangeOverlay && !mpTextRangeOverlay->isVisible())
mpTextRangeOverlay->setVisible(true);
- // Invalidate.
- InvalidateControl();
collectUIInformation("SHOW",get_id());
}
@@ -1188,15 +935,6 @@ void SwAnnotationWin::HideNote()
collectUIInformation("HIDE",get_id());
}
-void SwAnnotationWin::InvalidateControl()
-{
- // Invalidate.
- mpSidebarTextControl->Push(PushFlags::MAPMODE);
- lcl_translateTwips(EditWin(), *mpSidebarTextControl, nullptr);
- mpSidebarTextControl->Invalidate();
- mpSidebarTextControl->Pop();
-}
-
void SwAnnotationWin::ActivatePostIt()
{
mrMgr.AssureStdModeAtShell();
@@ -1353,45 +1091,27 @@ void SwAnnotationWin::SwitchToPostIt(sal_uInt16 aDirection)
pPostIt->GrabFocus();
}
-IMPL_LINK( SwAnnotationWin, WindowEventListener, VclWindowEvent&, rEvent, void )
+IMPL_LINK(SwAnnotationWin, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
{
- if ( rEvent.GetId() == VclEventId::WindowMouseMove )
+ if (rMEvt.IsEnterWindow())
{
- MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
- if ( pMouseEvt->IsEnterWindow() )
- {
- mbMouseOver = true;
- if ( !HasFocus() )
- {
- SetViewState(ViewState::VIEW);
- Invalidate();
- }
- }
- else if ( pMouseEvt->IsLeaveWindow())
+ mbMouseOver = true;
+ if ( !HasFocus() )
{
- mbMouseOver = false;
- if ( !HasFocus() )
- {
- SetViewState(ViewState::NORMAL);
- Invalidate();
- }
+ SetViewState(ViewState::VIEW);
+ Invalidate();
}
}
- else if ( rEvent.GetId() == VclEventId::WindowActivate &&
- rEvent.GetWindow() == mpSidebarTextControl )
+ else if (rMEvt.IsLeaveWindow())
{
- SetActiveSidebarWin();
- /* We want this SwAnnotationWin to become visible on activation,
- but if we are activating because the mouse is pressed in the
- annotation and SidebarTextControl::MouseButtonDown is calling
- 'GrabFocus' then leave the MakeVisible to
- SidebarTextControl::MouseButtonUp instead. That way a mouse down
- doesn't scroll the writer window while the mouse is pressed, and so
- doesn't select random text as the editview is scrolled under the
- mouse */
- if (!mpSidebarTextControl->MouseDownGainingFocus())
- mrMgr.MakeVisible( this );
+ mbMouseOver = false;
+ if ( !HasFocus() )
+ {
+ SetViewState(ViewState::NORMAL);
+ Invalidate();
+ }
}
+ return false;
}
bool SwAnnotationWin::SetActiveSidebarWin()
@@ -1415,9 +1135,9 @@ void SwAnnotationWin::UnsetActiveSidebarWin()
mrView.GetWrtShell().LockView( bLockView );
}
-IMPL_LINK(SwAnnotationWin, ScrollHdl, ScrollBar*, pScroll, void)
+IMPL_LINK(SwAnnotationWin, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
{
- tools::Long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
+ tools::Long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - rScrolledWindow.vadjustment_get_value();
GetOutlinerView()->Scroll( 0, nDiff );
}
@@ -1439,7 +1159,7 @@ void SwAnnotationWin::ResetAttributes()
mpOutlinerView->SetAttribs(DefaultItem());
}
-sal_Int32 SwAnnotationWin::GetScrollbarWidth() const
+int SwAnnotationWin::GetPrefScrollbarWidth() const
{
return mrView.GetWrtShell().GetViewOptions()->GetZoom() / 10;
}
@@ -1608,12 +1328,12 @@ void SwAnnotationWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aL
bool SwAnnotationWin::HasScrollbar() const
{
- return mpVScrollbar != nullptr;
+ return static_cast<bool>(mxVScrollbar);
}
bool SwAnnotationWin::IsScrollbarVisible() const
{
- return HasScrollbar() && mpVScrollbar->IsVisible();
+ return HasScrollbar() && mxVScrollbar->get_vpolicy() == VclPolicyType::ALWAYS;
}
void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem const & rSidebarItem )
@@ -1627,14 +1347,8 @@ void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem const & rSidebarItem )
mrSidebarItem = rSidebarItem;
mpAnchorFrame = mrSidebarItem.maLayoutInfo.mpAnchorFrame;
- if ( GetWindowPeer() )
- {
- SidebarWinAccessible* pAcc =
- static_cast<SidebarWinAccessible*>( GetWindowPeer() );
- OSL_ENSURE( dynamic_cast<SidebarWinAccessible*>( GetWindowPeer() ),
- "<SwAnnotationWin::ChangeSidebarItem(..)> - unexpected type of window peer -> crash possible!" );
+ if (SidebarWinAccessible* pAcc = dynamic_cast<SidebarWinAccessible*>(GetWindowPeer()))
pAcc->ChangeSidebarItem( mrSidebarItem );
- }
if ( bAnchorChanged )
{
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 84144c447bbb..d8b79c6e9d7e 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -827,10 +827,7 @@ void SwPostItMgr::LayoutPostIts()
comphelper::LibreOfficeKit::setTiledPainting(!visiblePostIt->HasChildPathFocus());
visiblePostIt->ShowNote();
if (!bTiledPainting)
- {
comphelper::LibreOfficeKit::setTiledPainting(bTiledPainting);
- visiblePostIt->InvalidateControl();
- }
}
else
{
@@ -965,7 +962,7 @@ void SwPostItMgr::DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
if (!pPostIt)
continue;
Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
- pPostIt->Draw(pOutDev, aPoint, DrawFlags::NONE);
+ pPostIt->DrawForPage(pOutDev, aPoint);
}
}
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
deleted file mode 100644
index c7e2978afe4d..000000000000
--- a/sw/source/uibase/docvw/SidebarScrollBar.cxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- 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/.
- */
-
-#include "SidebarScrollBar.hxx"
-
-#include <sfx2/lokhelper.hxx>
-
-#include <view.hxx>
-#include <wrtsh.hxx>
-#include <edtwin.hxx>
-#include <AnnotationWin.hxx>
-
-namespace sw::sidebarwindows
-{
-SidebarScrollBar::SidebarScrollBar(sw::annotation::SwAnnotationWin& rSidebarWin, WinBits nStyle,
- SwView& rView)
- : ScrollBar(&rSidebarWin, nStyle)
- , m_rSidebarWin(rSidebarWin)
- , m_rView(rView)
-{
-}
-
-void SidebarScrollBar::LogicInvalidate(const tools::Rectangle* pRectangle)
-{
- tools::Rectangle aRectangle;
-
- if (!pRectangle)
- {
- Push(PushFlags::MAPMODE);
- EnableMapMode();
- MapMode aMapMode = GetMapMode();
- aMapMode.SetMapUnit(MapUnit::MapTwip);
- SetMapMode(aMapMode);
- aRectangle = tools::Rectangle(Point(0, 0), PixelToLogic(GetSizePixel()));
- Pop();
- }
- else
- aRectangle = *pRectangle;
-
- // Convert from relative twips to absolute ones.
- vcl::Window& rParent = m_rSidebarWin.EditWin();
- Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(),
- GetOutOffYPixel() - rParent.GetOutOffYPixel());
- rParent.Push(PushFlags::MAPMODE);
- rParent.EnableMapMode();
- aOffset = rParent.PixelToLogic(aOffset);
- rParent.Pop();
- aRectangle.Move(aOffset.getX(), aOffset.getY());
-
- OString sRectangle = aRectangle.toString();
- SwWrtShell& rWrtShell = m_rView.GetWrtShell();
- SfxLokHelper::notifyInvalidation(rWrtShell.GetSfxViewShell(), sRectangle);
-}
-
-void SidebarScrollBar::MouseButtonUp(const MouseEvent& /*rMouseEvent*/) { EndTracking(); }
-
-void SidebarScrollBar::MouseMove(const MouseEvent& rMouseEvent)
-{
- TrackingEvent aEvent(rMouseEvent);
- Tracking(aEvent);
-}
-
-SidebarScrollBar::~SidebarScrollBar() { disposeOnce(); }
-
-} // end of namespace sw::sidebarwindows
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx
deleted file mode 100644
index 8d7ddd6c8486..000000000000
--- a/sw/source/uibase/docvw/SidebarScrollBar.hxx
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- 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/.
- */
-
-#pragma once
-
-#include <vcl/scrbar.hxx>
-
-class SwView;
-namespace sw::annotation
-{
-class SwAnnotationWin;
-}
-
-namespace sw::sidebarwindows
-{
-/// Similar to the VCL scrollbar, but instrumented with Writer-specific details for LOK.
-class SidebarScrollBar : public ScrollBar
-{
- sw::annotation::SwAnnotationWin& m_rSidebarWin;
- SwView& m_rView;
-
-protected:
- /// @see Window::LogicInvalidate().
- void LogicInvalidate(const tools::Rectangle* pRectangle) override;
- void MouseMove(const MouseEvent& rMouseEvent) override;
- void MouseButtonUp(const MouseEvent& rMouseEvent) override;
-
-public:
- SidebarScrollBar(sw::annotation::SwAnnotationWin& rSidebarWin, WinBits nStyle, SwView& rView);
- ~SidebarScrollBar() override;
-};
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 390ed80b0712..ee8f83f6b85d 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -19,7 +19,6 @@
#include "SidebarTxtControl.hxx"
-#include "SidebarTxtControlAcc.hxx"
#include <docsh.hxx>
#include <doc.hxx>
@@ -59,42 +58,82 @@
namespace sw::sidebarwindows {
-SidebarTextControl::SidebarTextControl( sw::annotation::SwAnnotationWin& rSidebarWin,
- WinBits nBits,
- SwView& rDocView,
- SwPostItMgr& rPostItMgr )
- : Control( &rSidebarWin, nBits )
- , mrSidebarWin( rSidebarWin )
- , mrDocView( rDocView )
- , mrPostItMgr( rPostItMgr )
+SidebarTextControl::SidebarTextControl(sw::annotation::SwAnnotationWin& rSidebarWin,
+ SwView& rDocView,
+ SwPostItMgr& rPostItMgr)
+ : mrSidebarWin(rSidebarWin)
+ , mrDocView(rDocView)
+ , mrPostItMgr(rPostItMgr)
, mbMouseDownGainingFocus(false)
{
- AddEventListener( LINK( &mrSidebarWin, sw::annotation::SwAnnotationWin, WindowEventListener ) );
}
-SidebarTextControl::~SidebarTextControl()
+EditView* SidebarTextControl::GetEditView() const
{
- disposeOnce();
+ OutlinerView* pOutlinerView = mrSidebarWin.GetOutlinerView();
+ if (!pOutlinerView)
+ return nullptr;
+ return &pOutlinerView->GetEditView();
}
-void SidebarTextControl::dispose()
+EditEngine* SidebarTextControl::GetEditEngine() const
{
- RemoveEventListener( LINK( &mrSidebarWin, sw::annotation::SwAnnotationWin, WindowEventListener ) );
- Control::dispose();
+ OutlinerView* pOutlinerView = mrSidebarWin.GetOutlinerView();
+ if (!pOutlinerView)
+ return nullptr;
+ return pOutlinerView->GetEditView().GetEditEngine();
}
-OutlinerView* SidebarTextControl::GetTextView() const
+void SidebarTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
- return mrSidebarWin.GetOutlinerView();
+ Size aSize(0, 0);
+ pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
+
+ SetOutputSizePixel(aSize);
+
+ weld::CustomWidgetController::SetDrawingArea(pDrawingArea);
+
+ EnableRTL(false);
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ Color aBgColor = rStyleSettings.GetWindowColor();
+
+ OutputDevice& rDevice = pDrawingArea->get_ref_device();
+
+ rDevice.SetMapMode(MapMode(MapUnit::MapTwip));
+ rDevice.SetBackground(aBgColor);
+
+ Size aOutputSize(rDevice.PixelToLogic(aSize));
+ aSize = aOutputSize;
+ aSize.setHeight(aSize.Height());
+
+ EditView* pEditView = GetEditView();
+ pEditView->setEditViewCallbacks(this);
+
+ EditEngine* pEditEngine = GetEditEngine();
+ pEditEngine->SetPaperSize(aSize);
+ pEditEngine->SetRefDevice(&rDevice);
+
+ pEditView->SetOutputArea(tools::Rectangle(Point(0, 0), aOutputSize));
+ pEditView->SetBackgroundColor(aBgColor);
+
+ pDrawingArea->set_cursor(PointerStyle::Text);
+
+ InitAccessible();
+}
+
+void SidebarTextControl::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
+{
+ Point aMousePos = EditViewOutputDevice().PixelToLogic(rPosition);
+ m_xEditView->SetCursorLogicPosition(aMousePos, bPoint, bClearMark);
}
void SidebarTextControl::GetFocus()
{
- Window::GetFocus();
+ WeldEditView::GetFocus();
if ( !mrSidebarWin.IsMouseOver() )
- {
Invalidate();
- }
+ mrSidebarWin.SetActiveSidebarWin();
}
void SidebarTextControl::LoseFocus()
@@ -102,15 +141,34 @@ void SidebarTextControl::LoseFocus()
// write the visible text back into the SwField
mrSidebarWin.UpdateData();
- Window::LoseFocus();
+ WeldEditView::LoseFocus();
if ( !mrSidebarWin.IsMouseOver() )
{
Invalidate();
}
}
-void SidebarTextControl::RequestHelp(const HelpEvent &rEvt)
+OUString SidebarTextControl::RequestHelp(tools::Rectangle& rHelpRect)
{
+ if (EditView* pEditView = GetEditView())
+ {
+ Point aPos = rHelpRect.TopLeft();
+
+ const OutputDevice& rOutDev = pEditView->GetOutputDevice();
+ Point aLogicClick = rOutDev.PixelToLogic(aPos);
+ const SvxFieldItem* pItem = pEditView->GetField(aLogicClick);
+ if (pItem)
+ {
+ const SvxFieldData* pField = pItem->GetField();
+ const SvxURLField* pURL = dynamic_cast<const SvxURLField*>( pField );
+ if (pURL)
+ {
+ rHelpRect = tools::Rectangle(aPos, Size(50, 10));
+ return SfxHelp::GetURLHelpText(pURL->GetURL());
+ }
+ }
+ }
+
const char* pResId = nullptr;
switch( mrSidebarWin.GetLayoutStatus() )
{
@@ -126,18 +184,26 @@ void SidebarTextControl::RequestHelp(const HelpEvent &rEvt)
OUString sText = SwResId(pResId) + ": " +
aContentAtPos.aFnd.pRedl->GetAuthorString() + " - " +
GetAppLangDateTimeString( aContentAtPos.aFnd.pRedl->GetTimeStamp() );
- Help::ShowQuickHelp( this,PixelToLogic(tools::Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sText);
+ return sText;
}
+
+ return OUString();
}
-void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags)
+void SidebarTextControl::EditViewScrollStateChange()
+{
+ mrSidebarWin.SetScrollbar();
+}
+
+void SidebarTextControl::DrawForPage(OutputDevice* pDev, const Point& rPt)
{
//Take the control's height, but overwrite the scrollbar area if there was one
- Size aSize(PixelToLogic(GetSizePixel()));
+ OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
+ Size aSize(rDevice.PixelToLogic(GetOutputSizePixel()));
- if ( GetTextView() )
+ if (OutlinerView* pOutlinerView = mrSidebarWin.GetOutlinerView())
{
- GetTextView()->GetOutliner()->Draw(pDev, tools::Rectangle(rPt, aSize));
+ pOutlinerView->GetOutliner()->Draw(pDev, tools::Rectangle(rPt, aSize));
}
if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED )
@@ -163,93 +229,64 @@ void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags)
void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{
+ Size aSize = GetOutputSizePixel();
+ Point aPos;
+
if (!rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode())
{
if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus())
{
- rRenderContext.DrawGradient(tools::Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
+ rRenderContext.DrawGradient(tools::Rectangle(aPos, rRenderContext.PixelToLogic(aSize)),
Gradient(GradientStyle::Linear, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark()));
}
else
{
- rRenderContext.DrawGradient(tools::Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
+ rRenderContext.DrawGradient(tools::Rectangle(aPos, rRenderContext.PixelToLogic(aSize)),
Gradient(GradientStyle::Linear, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark()));
}
}
- if (GetTextView())
- {
- GetTextView()->Paint(rRect, &rRenderContext);
- }
+ DoPaint(rRenderContext, rRect);
if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED)
{
rRenderContext.SetLineColor(mrSidebarWin.GetChangeColor());
- rRenderContext.DrawLine(rRenderContext.PixelToLogic(GetPosPixel()),
- rRenderContext.PixelToLogic(GetPosPixel() + Point(GetSizePixel().Width(),
- GetSizePixel().Height())));
- rRenderContext.DrawLine(rRenderContext.PixelToLogic(GetPosPixel() + Point(GetSizePixel().Width(),
- 0)),
- rRenderContext.PixelToLogic(GetPosPixel() + Point(0,
- GetSizePixel().Height())));
- }
-}
-
-void SidebarTextControl::LogicInvalidate(const tools::Rectangle* pRectangle)
-{
- tools::Rectangle aRectangle;
-
- if (!pRectangle)
- {
- Push(PushFlags::MAPMODE);
- EnableMapMode();
- aRectangle = tools::Rectangle(Point(0, 0), PixelToLogic(GetSizePixel()));
- Pop();
+ rRenderContext.DrawLine(rRenderContext.PixelToLogic(aPos),
+ rRenderContext.PixelToLogic(aPos + Point(aSize.Width(),
+ aSize.Height())));
+ rRenderContext.DrawLine(rRenderContext.PixelToLogic(aPos + Point(aSize.Width(),
+ 0)),
+ rRenderContext.PixelToLogic(aPos + Point(0,
+ aSize.Height())));
}
- else
- aRectangle = *pRectangle;
-
- // Convert from relative twips to absolute ones.
- vcl::Window& rParent = mrSidebarWin.EditWin();
- Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
- rParent.Push(PushFlags::MAPMODE);
- rParent.EnableMapMode();
- aOffset = rParent.PixelToLogic(aOffset);
- rParent.Pop();
- aRectangle.Move(aOffset.getX(), aOffset.getY());
-
- OString sRectangle = aRectangle.toString();
- SwWrtShell& rWrtShell = mrDocView.GetWrtShell();
- SfxLokHelper::notifyInvalidation(rWrtShell.GetSfxViewShell(), sRectangle);
}
void SidebarTextControl::MakeVisible()
{
- // PostItMgr::MakeVisible can lose our MapMode, save it.
- auto oldMapMode = GetMapMode();
//let's make sure we see our note
mrPostItMgr.MakeVisible(&mrSidebarWin);
- if (comphelper::LibreOfficeKit::isActive())
- SetMapMode(oldMapMode);
}
-void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
+bool SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
{
if (getenv("SW_DEBUG") && rKeyEvt.GetKeyCode().GetCode() == KEY_F12)
{
if (rKeyEvt.GetKeyCode().IsShift())
{
mrDocView.GetDocShell()->GetDoc()->dumpAsXml();
- return;
+ return true;
}
}
+ bool bDone = false;
+
const vcl::KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
sal_uInt16 nKey = rKeyCode.GetCode();
if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) &&
( (nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN) ) )
{
mrSidebarWin.SwitchToPostIt(nKey);
+ bDone = true;
}
else if ( nKey == KEY_ESCAPE ||
( rKeyCode.IsMod1() &&
@@ -257,17 +294,18 @@ void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
nKey == KEY_PAGEDOWN ) ) )
{
mrSidebarWin.SwitchToFieldPos();
+ bDone = true;
}
else if ( rKeyCode.GetFullCode() == KEY_INSERT )
{
mrSidebarWin.ToggleInsMode();
+ bDone = true;
}
else
{
MakeVisible();
tools::Long aOldHeight = mrSidebarWin.GetPostItTextHeight();
- bool bDone = false;
/// HACK: need to switch off processing of Undo/Redo in Outliner
if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
@@ -275,11 +313,12 @@ void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
bool bIsProtected = mrSidebarWin.IsProtected();
if ( !bIsProtected || !EditEngine::DoesKeyChangeText(rKeyEvt) )
{
- bDone = GetTextView() && GetTextView()->PostKeyEvent( rKeyEvt );
+ EditView* pEditView = GetEditView();
+ bDone = pEditView && pEditView->PostKeyEvent(rKeyEvt);
}
else
{
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui"));
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), "modules/swriter/ui/inforeadonlydialog.ui"));
std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("InfoReadonlyDialog"));
xQuery->run();
}
@@ -291,63 +330,38 @@ void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
// write back data first when showing navigator
if ( nKey==KEY_F5 )
mrSidebarWin.UpdateData();
- if (!mrDocView.KeyInput(rKeyEvt))
- Window::KeyInput(rKeyEvt);
+ bDone = mrDocView.KeyInput(rKeyEvt);
}
}
mrDocView.GetViewFrame()->GetBindings().InvalidateAll(false);
-}
-void SidebarTextControl::MouseMove( const MouseEvent& rMEvt )
-{
- if ( !GetTextView() )
- return;
-
- OutlinerView* pOutlinerView( GetTextView() );
- pOutlinerView->MouseMove( rMEvt );
- // mba: why does OutlinerView not handle the modifier setting?!
- // this forces the postit to handle *all* pointer types
- SetPointer( pOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
-
- const EditView& aEV = pOutlinerView->GetEditView();
- const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
- if ( pItem )
- {
- const SvxFieldData* pField = pItem->GetField();
- const SvxURLField* pURL = dynamic_cast<const SvxURLField*>( pField );
- if ( pURL )
- {
- OUString sText(SfxHelp::GetURLHelpText(pURL->GetURL()));
- Help::ShowQuickHelp(
- this, PixelToLogic(tools::Rectangle(GetPosPixel(), Size(50, 10))), sText);
- }
- }
+ return bDone;
}
-void SidebarTextControl::MouseButtonDown( const MouseEvent& rMEvt )
+bool SidebarTextControl::MouseButtonDown(const MouseEvent& rMEvt)
{
- if ( GetTextView() )
+ if (EditView* pEditView = GetEditView())
{
SvtSecurityOptions aSecOpts;
bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink);
if ( !bExecuteMod || (rMEvt.GetModifier() == KEY_MOD1))
{
- const EditView& aEV = GetTextView()->GetEditView();
- const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
- if ( pItem )
+ const OutputDevice& rOutDev = pEditView->GetOutputDevice();
+ Point aLogicClick = rOutDev.PixelToLogic(rMEvt.GetPosPixel());
+ if (const SvxFieldItem* pItem = pEditView->GetField(aLogicClick))
{
const SvxFieldData* pField = pItem->GetField();
const SvxURLField* pURL = dynamic_cast<const SvxURLField*>( pField );
if ( pURL )
{
- GetTextView()->MouseButtonDown( rMEvt );
+ pEditView->MouseButtonDown( rMEvt );
SwWrtShell &rSh = mrDocView.GetWrtShell();
const OUString& sURL( pURL->GetURL() );
const OUString& sTarget( pURL->GetTargetFrame() );
::LoadURL(rSh, sURL, LoadUrlFlags::NONE, sTarget);
- return;
+ return true;
}
}
}
@@ -356,22 +370,24 @@ void SidebarTextControl::MouseButtonDown( const MouseEvent& rMEvt )
mbMouseDownGainingFocus = !HasFocus();
GrabFocus();
- if ( GetTextView() )
- {
- GetTextView()->MouseButtonDown( rMEvt );
- }
+ bool bRet = WeldEditView::MouseButtonDown(rMEvt);
+
mrDocView.GetViewFrame()->GetBindings().InvalidateAll(false);
+
+ return bRet;
}
-void SidebarTextControl::MouseButtonUp( const MouseEvent& rMEvt )
+bool SidebarTextControl::MouseButtonUp(const MouseEvent& rMEvt)
{
- if ( GetTextView() )
- GetTextView()->MouseButtonUp( rMEvt );
+ bool bRet = WeldEditView::MouseButtonUp(rMEvt);
+
if (mbMouseDownGainingFocus)
{
MakeVisible();
mbMouseDownGainingFocus = false;
}
+
+ return bRet;
}
IMPL_LINK( SidebarTextControl, OnlineSpellCallback, SpellCallbackInfo&, rInfo, void )
@@ -382,16 +398,18 @@ IMPL_LINK( SidebarTextControl, OnlineSpellCallback, SpellCallbackInfo&, rInfo, v
}
}
-void SidebarTextControl::Command( const CommandEvent& rCEvt )
+bool SidebarTextControl::Command( const CommandEvent& rCEvt )
{
+ EditView* pEditView = GetEditView();
+
if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
{
if ( !mrSidebarWin.IsProtected() &&
- GetTextView() &&
- GetTextView()->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(), true ))
+ pEditView &&
+ pEditView->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(), true ))
{
Link<SpellCallbackInfo&,void> aLink = LINK(this, SidebarTextControl, OnlineSpellCallback);
- GetTextView()->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
+ pEditView->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
}
else
{
@@ -400,71 +418,35 @@ void SidebarTextControl::Command( const CommandEvent& rCEvt )
aPos = rCEvt.GetMousePosPixel();
else
{
- const Size aSize = GetSizePixel();
+ const Size aSize = GetOutputSizePixel();
aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
}
- SfxDispatcher::ExecutePopup(this, &aPos);
+ SfxDispatcher::ExecutePopup(&mrSidebarWin, &aPos);
}
+ return true;
}
- else
- if (rCEvt.GetCommand() == CommandEventId::Wheel)
+ else if (rCEvt.GetCommand() == CommandEventId::Wheel)
{
- if (mrSidebarWin.IsScrollbarVisible())
+ // if no scrollbar, or extra keys held scroll the document and consume
+ // this event, otherwise don't consume and let the event get to the
+ // surrounding scrolled window
+ if (!mrSidebarWin.IsScrollbarVisible())
+ {
+ mrDocView.HandleWheelCommands(rCEvt);
+ return true;
+ }
+ else
{
const CommandWheelData* pData = rCEvt.GetWheelData();
if (pData->IsShift() || pData->IsMod1() || pData->IsMod2())
{
mrDocView.HandleWheelCommands(rCEvt);
+ return true;
}
- else
- {
- HandleScrollCommand( rCEvt, nullptr , mrSidebarWin.Scrollbar());
- }
- }
- else
- {
- mrDocView.HandleWheelCommands(rCEvt);
}
}
- else
- {
- if ( GetTextView() )
- GetTextView()->Command( rCEvt );
- else
- Window::Command(rCEvt);
- }
-}
-
-OUString SidebarTextControl::GetSurroundingText() const
-{
- if (OutlinerView* pTextView = GetTextView())
- return pTextView->GetSurroundingText();
- return OUString();
-}
-
-Selection SidebarTextControl::GetSurroundingTextSelection() const
-{
- if (OutlinerView* pTextView = GetTextView())
- return pTextView->GetSurroundingTextSelection();
- return Selection( 0, 0 );
-}
-
-bool SidebarTextControl::DeleteSurroundingText(const Selection& rSelection)
-{
- if (OutlinerView* pTextView = GetTextView())
- return pTextView->DeleteSurroundingText(rSelection);
- return false;
-}
-
-css::uno::Reference< css::accessibility::XAccessible > SidebarTextControl::CreateAccessible()
-{
-
- SidebarTextControlAccessible* pAcc( new SidebarTextControlAccessible( *this ) );
- css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
- SetWindowPeer( xWinPeer, pAcc );
- css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
- return xAcc;
+ return WeldEditView::Command(rCEvt);
}
} // end of namespace sw::sidebarwindows
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
index 3460ba660ecd..596be78244a2 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
@@ -19,7 +19,7 @@
#pragma once
-#include <vcl/ctrl.hxx>
+#include <svx/weldeditview.hxx>
class OutlinerView;
class SwView;
@@ -29,7 +29,7 @@ namespace sw::annotation { class SwAnnotationWin; }
namespace sw::sidebarwindows {
-class SidebarTextControl : public Control
+class SidebarTextControl : public WeldEditView
{
private:
sw::annotation::SwAnnotationWin& mrSidebarWin;
@@ -40,39 +40,38 @@ class SidebarTextControl : public Control
void MakeVisible();
protected:
- virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
- /// @see Window::LogicInvalidate().
- void LogicInvalidate(const tools::Rectangle* pRectangle) override;
- virtual void Command( const CommandEvent& rCEvt ) override;
- virtual void LoseFocus() override;
- virtual void RequestHelp(const HelpEvent &rEvt) override;
- virtual OUString GetSurroundingText() const override;
- virtual Selection GetSurroundingTextSelection() const override;
- virtual bool DeleteSurroundingText(const Selection& rSelection) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+
+ virtual bool Command(const CommandEvent& rCEvt) override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
+
+ virtual OUString RequestHelp(tools::Rectangle& rRect) override;
public:
- SidebarTextControl( sw::annotation::SwAnnotationWin& rSidebarWin,
- WinBits nBits,
+ SidebarTextControl(sw::annotation::SwAnnotationWin& rSidebarWin,
SwView& rDocView,
- SwPostItMgr& rPostItMgr );
- virtual ~SidebarTextControl() override;
- virtual void dispose() override;
+ SwPostItMgr& rPostItMgr);
- virtual void GetFocus() override;
- virtual void KeyInput( const KeyEvent& rKeyEvt ) override;
- virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
- virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
- virtual void MouseMove(const MouseEvent& rMEvt) override;
+ virtual EditView* GetEditView() const override;
+
+ virtual EditEngine* GetEditEngine() const override;
- bool MouseDownGainingFocus() const { return mbMouseDownGainingFocus; }
+ virtual void EditViewScrollStateChange() override;
+
+ void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+ void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
+
+ virtual bool KeyInput(const KeyEvent& rKeyEvt) override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
OutlinerView* GetTextView() const;
DECL_LINK( OnlineSpellCallback, SpellCallbackInfo&, void );
- virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
-
- virtual void Draw(OutputDevice* pDev, const Point&, DrawFlags) override;
+ void DrawForPage(OutputDevice* pDev, const Point& rPos);
};
} // end of namespace sw::sidebarwindows
diff --git a/sw/source/uibase/docvw/SidebarTxtControlAcc.cxx b/sw/source/uibase/docvw/SidebarTxtControlAcc.cxx
deleted file mode 100644
index d3bec6ecae5b..000000000000
--- a/sw/source/uibase/docvw/SidebarTxtControlAcc.cxx
+++ /dev/null
@@ -1,271 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/config.h>
-
-#include <memory>
-
-#include "SidebarTxtControlAcc.hxx"
-
-#include "SidebarTxtControl.hxx"
-
-#include <svl/SfxBroadcaster.hxx>
-#include <toolkit/awt/vclxaccessiblecomponent.hxx>
-#include <editeng/unoedsrc.hxx>
-#include <editeng/unoforou.hxx>
-#include <editeng/unoviwou.hxx>
-#include <editeng/unoedhlp.hxx>
-#include <svx/AccessibleTextHelper.hxx>
-#include <editeng/outliner.hxx>
-#include <vcl/vclevent.hxx>
-
-namespace sw::sidebarwindows {
-
-namespace {
-
-// declaration and implementation of <SvxEditSource>
-// for <::accessibility::AccessibleTextHelper> instance
-class SidebarTextEditSource : public SvxEditSource,
- public SfxBroadcaster
-{
- public:
- explicit SidebarTextEditSource(SidebarTextControl& rSidebarTextControl);
- virtual ~SidebarTextEditSource() override;
-
- virtual std::unique_ptr<SvxEditSource> Clone() const override;
-
- virtual SvxTextForwarder* GetTextForwarder() override;
- virtual SvxViewForwarder* GetViewForwarder() override;
- virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false ) override;
-
- virtual void UpdateData() override;
-
- virtual SfxBroadcaster& GetBroadcaster() const override;
- DECL_LINK( NotifyHdl, EENotify&, void );
-
- private:
- SidebarTextControl& mrSidebarTextControl;
- SvxOutlinerForwarder mTextForwarder;
- SvxDrawOutlinerViewForwarder mViewForwarder;
-};
-
-}
-
-SidebarTextEditSource::SidebarTextEditSource( SidebarTextControl& rSidebarTextControl )
- : SvxEditSource()
- , mrSidebarTextControl( rSidebarTextControl )
- , mTextForwarder( *(rSidebarTextControl.GetTextView()->GetOutliner()), false )
- , mViewForwarder( *(rSidebarTextControl.GetTextView()) )
-{
- if ( mrSidebarTextControl.GetTextView() )
- {
- mrSidebarTextControl.GetTextView()->GetOutliner()->SetNotifyHdl( LINK(this, SidebarTextEditSource, NotifyHdl) );
- }
-}
-
-SidebarTextEditSource::~SidebarTextEditSource()
-{
- if ( mrSidebarTextControl.GetTextView() )
- {
- mrSidebarTextControl.GetTextView()->GetOutliner()->SetNotifyHdl( Link<EENotify&,void>() );
- }
-}
-
-std::unique_ptr<SvxEditSource> SidebarTextEditSource::Clone() const
-{
- return std::unique_ptr<SvxEditSource>(new SidebarTextEditSource( mrSidebarTextControl ));
-}
-
-SvxTextForwarder* SidebarTextEditSource::GetTextForwarder()
-{
- return &mTextForwarder;
-}
-
-SvxViewForwarder* SidebarTextEditSource::GetViewForwarder()
-{
- return &mViewForwarder;
-}
-
-SvxEditViewForwarder* SidebarTextEditSource::GetEditViewForwarder( bool /*bCreate*/ )
-{
- return &mViewForwarder;
-}
-
-void SidebarTextEditSource::UpdateData()
-{
- // nothing to do
-}
-
-SfxBroadcaster& SidebarTextEditSource::GetBroadcaster() const
-{
- return * const_cast< SidebarTextEditSource* > (this);
-}
-
-IMPL_LINK(SidebarTextEditSource, NotifyHdl, EENotify&, rNotify, void)
-{
- std::unique_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( &rNotify ) );
-
- if (aHint)
- {
- Broadcast(*aHint);
- }
-}
-
-namespace {
-
-// declaration and implementation of accessible context for <SidebarTextControl> instance
-class SidebarTextControlAccessibleContext : public VCLXAccessibleComponent
-{
- public:
- explicit SidebarTextControlAccessibleContext( SidebarTextControl& rSidebarTextControl );
-
- virtual sal_Int32 SAL_CALL
- getAccessibleChildCount() override;
- virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
- getAccessibleChild( sal_Int32 i ) override;
-
- virtual void SAL_CALL
- addAccessibleEventListener (
- const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener) override;
- virtual void SAL_CALL
- removeAccessibleEventListener (
- const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener) override;
-
- protected:
- virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
-
- private:
- std::unique_ptr<::accessibility::AccessibleTextHelper> mpAccessibleTextHelper;
-
- ::osl::Mutex maMutex;
-};
-
-}
-
-SidebarTextControlAccessibleContext::SidebarTextControlAccessibleContext( SidebarTextControl& rSidebarTextControl )
- : VCLXAccessibleComponent( rSidebarTextControl.GetWindowPeer() )
- , maMutex()
-{
- mpAccessibleTextHelper.reset(new ::accessibility::AccessibleTextHelper( std::make_unique<SidebarTextEditSource>(rSidebarTextControl) ));
- mpAccessibleTextHelper->SetEventSource( rSidebarTextControl.GetWindowPeer() );
-}
-
-sal_Int32 SAL_CALL SidebarTextControlAccessibleContext::getAccessibleChildCount()
-{
- osl::MutexGuard aGuard( maMutex );
-
- sal_Int32 nChildCount( 0 );
-
- if ( mpAccessibleTextHelper )
- {
- nChildCount = mpAccessibleTextHelper->GetChildCount();
- }
-
- return nChildCount;
-}
-
-css::uno::Reference< css::accessibility::XAccessible > SAL_CALL SidebarTextControlAccessibleContext::getAccessibleChild( sal_Int32 i )
-{
- osl::MutexGuard aGuard( maMutex );
-
- css::uno::Reference< css::accessibility::XAccessible > xChild;
-
- if ( mpAccessibleTextHelper )
- {
- xChild = mpAccessibleTextHelper->GetChild( i );
- }
-
- return xChild;
-}
-
-void SAL_CALL SidebarTextControlAccessibleContext::addAccessibleEventListener (
- const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener)
-{
- osl::MutexGuard aGuard( maMutex );
-
- if ( mpAccessibleTextHelper )
- {
- mpAccessibleTextHelper->AddEventListener(xListener);
- }
-}
-
-void SAL_CALL SidebarTextControlAccessibleContext::removeAccessibleEventListener (
- const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener)
-{
- osl::MutexGuard aGuard( maMutex );
-
- if ( mpAccessibleTextHelper )
- {
- mpAccessibleTextHelper->RemoveEventListener(xListener);
- }
-}
-
-void SidebarTextControlAccessibleContext::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
-{
- if ( mpAccessibleTextHelper )
- {
- switch ( rVclWindowEvent.GetId() )
- {
- case VclEventId::ObjectDying:
- {
- mpAccessibleTextHelper.reset();
- }
- break;
- case VclEventId::WindowGetFocus:
- case VclEventId::ControlGetFocus:
- {
- mpAccessibleTextHelper->SetFocus();
- }
- break;
- case VclEventId::WindowLoseFocus:
- case VclEventId::ControlLoseFocus:
- {
- mpAccessibleTextHelper->SetFocus( false );
- }
- break;
- default: break;
- }
- }
-
- VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
-}
-
-// implementation of accessible for <SidebarTextControl> instance
-SidebarTextControlAccessible::SidebarTextControlAccessible( SidebarTextControl& rSidebarTextControl )
- : VCLXWindow()
- , mrSidebarTextControl( rSidebarTextControl )
-{
- SetWindow( &mrSidebarTextControl );
-}
-
-SidebarTextControlAccessible::~SidebarTextControlAccessible()
-{
-}
-
-css::uno::Reference< css::accessibility::XAccessibleContext > SidebarTextControlAccessible::CreateAccessibleContext()
-{
- SidebarTextControlAccessibleContext* pAccContext(
- new SidebarTextControlAccessibleContext( mrSidebarTextControl ) );
- css::uno::Reference< css::accessibility::XAccessibleContext > xAcc( pAccContext );
- return xAcc;
-}
-
-} // end of namespace sw::sidebarwindows
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/SidebarTxtControlAcc.hxx b/sw/source/uibase/docvw/SidebarTxtControlAcc.hxx
deleted file mode 100644
index db60972501c6..000000000000
--- a/sw/source/uibase/docvw/SidebarTxtControlAcc.hxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include <toolkit/awt/vclxwindow.hxx>
-
-namespace sw::sidebarwindows {
-
-class SidebarTextControl;
-
-class SidebarTextControlAccessible : public VCLXWindow
-{
- public:
- explicit SidebarTextControlAccessible( SidebarTextControl& rSidebarTextControl );
- virtual ~SidebarTextControlAccessible() override;
-
- virtual css::uno::Reference< css::accessibility::XAccessibleContext >
- CreateAccessibleContext() override;
-
- private:
- SidebarTextControl& mrSidebarTextControl;
-};
-
-} // end of namespace sw::sidebarwindows
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/uiconfig/swriter/ui/annotation.ui b/sw/uiconfig/swriter/ui/annotation.ui
new file mode 100644
index 000000000000..753f373136af
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/annotation.ui
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface domain="sw">
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkMenu" id="menu">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="reply">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|reply">Reply</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="sep1">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="resolve">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|resolve">Resolve</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="unresolve">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|unresolve">Unresolve</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="resolvethread">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|resolvethread">Resolve Thread</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="unresolvethread">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|unresolvethread">Unresolve Thread</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="delete">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|delete">Delete _Comment</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="deletethread">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|deletethread">Delete _Comment Thread</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="deleteby">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|deleteby">Delete _All Comments by $1</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="deleteall">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|deleteall">_Delete All Comments</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="formatall">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="annotationmenu|formatall">Format All Comments...</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
+ </object>
+ <object class="GtkBox" id="Annotation">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="events">GDK_BUTTON_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="hscrollbar-policy">never</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkDrawingArea" id="editview">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="author">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label">label</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="date">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label">label</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="resolved">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label">label</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="menubutton">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="label" translatable="no"></property>
+ <property name="receives-default">True</property>
+ <property name="valign">start</property>
+ <property name="margin-end">10</property>
+ <property name="margin-top">5</property>
+ <property name="relief">none</property>
+ <property name="draw-indicator">True</property>
+ <property name="popup">menu</property>
+ <child>
+ <placeholder/>
+ </child>
+ <style>
+ <class name="small-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/sw/uiconfig/swriter/ui/annotationmenu.ui b/sw/uiconfig/swriter/ui/annotationmenu.ui
deleted file mode 100644
index 859ec493737f..000000000000
--- a/sw/uiconfig/swriter/ui/annotationmenu.ui
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
-<interface domain="sw">
- <requires lib="gtk+" version="3.20"/>
- <object class="GtkMenu" id="menu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="reply">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|reply">Reply</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="sep1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="resolve">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|resolve">Resolve</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="unresolve">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|unresolve">Unresolve</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="resolvethread">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|resolvethread">Resolve Thread</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="unresolvethread">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|unresolvethread">Unresolve Thread</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="delete">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|delete">Delete _Comment</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="deletethread">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|deletethread">Delete _Comment Thread</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="deleteby">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|deleteby">Delete _All Comments by $1</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="deleteall">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|deleteall">_Delete All Comments</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="formatall">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="annotationmenu|formatall">Format All Comments...</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
-</interface>