2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2010-01-12 10:43:45 +01:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* 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/.
|
2010-01-12 10:43:45 +01:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* This file incorporates work covered by the following license notice:
|
2010-01-12 10:43:45 +01:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* 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 .
|
|
|
|
*/
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2013-11-05 02:17:53 +01:00
|
|
|
#ifndef INCLUDED_SW_INC_SIDEBARWIN_HXX
|
|
|
|
#define INCLUDED_SW_INC_SIDEBARWIN_HXX
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
#include <postithelper.hxx>
|
|
|
|
#include <SidebarWindowsTypes.hxx>
|
|
|
|
|
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <swrect.hxx>
|
|
|
|
|
|
|
|
#include <tools/date.hxx>
|
|
|
|
|
|
|
|
#include <vcl/lineinfo.hxx>
|
|
|
|
#include <basegfx/polygon/b2dpolygon.hxx>
|
2010-02-25 19:54:08 +01:00
|
|
|
#include <editeng/editstat.hxx>
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
class SwPostItMgr;
|
|
|
|
class SwPostItField;
|
|
|
|
class OutlinerView;
|
|
|
|
class Outliner;
|
|
|
|
class ScrollBar;
|
|
|
|
class SwEditWin;
|
|
|
|
class SwView;
|
|
|
|
class Edit;
|
|
|
|
class MenuButton;
|
2015-11-25 06:03:10 -05:00
|
|
|
class SwFrame;
|
2010-02-02 15:11:26 +01:00
|
|
|
|
2013-12-19 18:50:58 +00:00
|
|
|
namespace sw { namespace overlay {
|
|
|
|
class OverlayRanges;
|
|
|
|
}}
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
namespace sw { namespace sidebarwindows {
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
class SidebarTextControl;
|
2010-01-12 10:43:45 +01:00
|
|
|
class AnchorOverlayObject;
|
|
|
|
class ShadowOverlayObject;
|
|
|
|
|
|
|
|
typedef sal_Int64 SwPostItBits;
|
|
|
|
|
|
|
|
#define PB_Preview ((SwPostItBits)0x00000001)
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
class SwSidebarWin : public vcl::Window
|
2010-01-12 10:43:45 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SwSidebarWin( SwEditWin& rEditWin,
|
|
|
|
WinBits nBits,
|
|
|
|
SwPostItMgr& aMgr,
|
2010-02-02 15:11:26 +01:00
|
|
|
SwPostItBits aBits,
|
|
|
|
SwSidebarItem& rSidebarItem );
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~SwSidebarWin() override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void dispose() override;
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
void SetSize( const Size& rNewSize );
|
|
|
|
void SetPosSizePixelRect( long nX,
|
|
|
|
long nY,
|
|
|
|
long nWidth,
|
|
|
|
long nHeight,
|
2013-12-19 18:50:58 +00:00
|
|
|
const SwRect& aAnchorRect,
|
2010-01-12 10:43:45 +01:00
|
|
|
const long PageBorder);
|
|
|
|
void SetPosAndSize();
|
|
|
|
void TranslateTopPosition(const long aAmount);
|
2015-01-20 12:38:10 +02:00
|
|
|
void CheckMetaText();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
|
2015-07-03 11:31:14 +02:00
|
|
|
SwEditWin& EditWin();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
|
|
|
|
bool HasScrollbar() const;
|
|
|
|
bool IsScrollbarVisible() const;
|
|
|
|
inline ScrollBar* Scrollbar() { return mpVScrollbar; }
|
|
|
|
inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
|
|
|
|
inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
|
2013-12-19 18:50:58 +00:00
|
|
|
inline ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay;}
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
long GetPostItTextHeight();
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void SwitchToPostIt(sal_uInt16 aDirection);
|
2015-01-20 12:38:10 +02:00
|
|
|
void SwitchToFieldPos();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
virtual sal_uInt32 MoveCaret() = 0;
|
|
|
|
|
|
|
|
virtual void UpdateData() = 0;
|
|
|
|
virtual void SetPostItText() = 0;
|
|
|
|
virtual void Delete();
|
|
|
|
virtual void GotoPos() = 0;
|
|
|
|
|
2013-08-18 12:59:11 +02:00
|
|
|
virtual OUString GetAuthor() = 0;
|
2010-01-12 10:43:45 +01:00
|
|
|
virtual Date GetDate() = 0;
|
2014-09-28 15:49:26 +02:00
|
|
|
virtual tools::Time GetTime() = 0;
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void ExecuteCommand(sal_uInt16 nSlot);
|
2010-01-12 10:43:45 +01:00
|
|
|
void InitControls();
|
|
|
|
void DoResize();
|
2013-12-20 11:25:37 +01:00
|
|
|
void ResizeIfNecessary(long aOldHeight, long aNewHeight);
|
2010-01-12 10:43:45 +01:00
|
|
|
void SetScrollbar();
|
|
|
|
|
|
|
|
void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
|
|
|
|
const Point VirtualPos() { return mPosSize.TopLeft(); }
|
|
|
|
const Size VirtualSize() { return mPosSize.GetSize(); }
|
|
|
|
|
|
|
|
void ShowAnchorOnly(const Point &aPoint);
|
|
|
|
void ShowNote();
|
|
|
|
void HideNote();
|
2016-11-22 17:04:19 -05:00
|
|
|
void InvalidateControl();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
void ResetAttributes();
|
|
|
|
|
|
|
|
void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
|
2014-04-25 14:00:35 +02:00
|
|
|
void SetReadonly(bool bSet);
|
2015-07-21 14:20:18 +02:00
|
|
|
bool IsReadOnly()
|
2013-12-19 18:50:58 +00:00
|
|
|
{
|
|
|
|
return mbReadonly;
|
|
|
|
}
|
|
|
|
bool IsPreview()
|
|
|
|
{
|
|
|
|
return nFlags & PB_Preview;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
|
2010-01-12 16:02:50 +01:00
|
|
|
const Color& ColorAnchor() { return mColorAnchor; }
|
|
|
|
const Color& ColorDark() { return mColorDark; }
|
|
|
|
const Color& ColorLight() { return mColorLight; }
|
2013-12-19 18:50:58 +00:00
|
|
|
void Rescale();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
void SetViewState(::sw::sidebarwindows::ViewState bViewState);
|
|
|
|
|
|
|
|
bool IsFollow() { return mbIsFollow; }
|
|
|
|
void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
|
|
|
|
virtual bool CalcFollow() = 0;
|
|
|
|
|
2013-12-19 18:50:58 +00:00
|
|
|
sal_Int32 GetMetaHeight();
|
|
|
|
sal_Int32 GetMinimumSizeWithMeta();
|
|
|
|
sal_Int32 GetMinimumSizeWithoutMeta();
|
|
|
|
sal_Int32 GetMetaButtonAreaWidth();
|
|
|
|
sal_Int32 GetScrollbarWidth();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2013-12-19 18:50:58 +00:00
|
|
|
void SetSpellChecking();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2013-12-19 18:50:58 +00:00
|
|
|
void ToggleInsMode();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2015-01-20 12:38:10 +02:00
|
|
|
void ActivatePostIt();
|
|
|
|
void DeactivatePostIt();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
|
|
|
|
const Color& aColor);
|
|
|
|
SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
|
2016-04-13 15:33:00 +02:00
|
|
|
const Color& GetChangeColor() { return mChangeColor; }
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2013-12-19 18:50:58 +00:00
|
|
|
virtual bool IsProtected()
|
|
|
|
{
|
|
|
|
return mbReadonly;
|
|
|
|
}
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
DECL_LINK( WindowEventListener, VclWindowEvent&, void );
|
2010-05-20 16:10:52 +01:00
|
|
|
inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2015-03-04 20:27:49 +00:00
|
|
|
void SetLanguage(const SvxLanguageItem& rNewItem);
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2010-02-02 15:11:26 +01:00
|
|
|
void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
|
2015-11-05 15:55:58 +02:00
|
|
|
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
|
2010-02-02 15:11:26 +01:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override;
|
2015-11-12 16:56:45 +01:00
|
|
|
virtual void KeyInput(const KeyEvent& rKeyEvt) override;
|
2015-11-13 13:33:32 +01:00
|
|
|
virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
|
2015-11-14 14:42:26 +01:00
|
|
|
virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override;
|
|
|
|
virtual void MouseMove(const MouseEvent& rMouseEvent) override;
|
2015-11-05 15:58:55 +01:00
|
|
|
void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
|
2015-11-13 13:33:32 +01:00
|
|
|
/// Is there a matching sub-widget inside this sidebar widget for rPointLogic?
|
|
|
|
bool IsHitWindow(const Point& rPointLogic);
|
2015-11-14 10:37:45 +01:00
|
|
|
/// Allows adjusting the point or mark of the selection to a document coordinate.
|
|
|
|
void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
|
2014-04-15 09:42:32 +01:00
|
|
|
|
2010-01-12 10:43:45 +01:00
|
|
|
protected:
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void LoseFocus() override;
|
|
|
|
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
|
|
|
|
virtual void GetFocus() override;
|
2015-04-14 11:52:19 +01:00
|
|
|
virtual VclPtr<MenuButton> CreateMenuButton() = 0;
|
2010-01-12 10:43:45 +01:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
void SetSizePixel( const Size& rNewSize ) override;
|
2010-01-12 10:43:45 +01:00
|
|
|
SfxItemSet DefaultItem();
|
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
DECL_LINK(ModifyHdl, LinkParamNone*, void);
|
|
|
|
DECL_LINK(ScrollHdl, ScrollBar*, void);
|
|
|
|
DECL_LINK(DeleteHdl, void*, void);
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
inline SwView& DocView() { return mrView;}
|
|
|
|
inline SwPostItMgr& Mgr() { return mrMgr; }
|
|
|
|
inline Outliner* Engine() { return mpOutliner;}
|
|
|
|
|
|
|
|
private:
|
|
|
|
SwSidebarWin* GetTopReplyNote();
|
|
|
|
|
2015-04-14 12:44:47 +02:00
|
|
|
virtual SvxLanguageItem GetLanguage();
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
SwPostItMgr& mrMgr;
|
|
|
|
SwView& mrView;
|
|
|
|
const SwPostItBits nFlags;
|
|
|
|
|
2014-05-07 11:49:46 +02:00
|
|
|
ImplSVEvent * mnEventId;
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
OutlinerView* mpOutlinerView;
|
|
|
|
Outliner* mpOutliner;
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
VclPtr<sw::sidebarwindows::SidebarTextControl> mpSidebarTextControl;
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<ScrollBar> mpVScrollbar;
|
|
|
|
VclPtr<Edit> mpMetadataAuthor;
|
|
|
|
VclPtr<Edit> mpMetadataDate;
|
|
|
|
VclPtr<MenuButton> mpMenuButton;
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
|
|
|
|
sw::sidebarwindows::ShadowOverlayObject* mpShadow;
|
2013-12-19 18:50:58 +00:00
|
|
|
sw::overlay::OverlayRanges* mpTextRangeOverlay;
|
2010-01-12 10:43:45 +01:00
|
|
|
|
|
|
|
Color mColorAnchor;
|
|
|
|
Color mColorDark;
|
|
|
|
Color mColorLight;
|
|
|
|
Color mChangeColor;
|
|
|
|
|
|
|
|
sw::sidebarwindows::SidebarPosition meSidebarPosition;
|
|
|
|
|
|
|
|
Rectangle mPosSize;
|
|
|
|
SwRect mAnchorRect;
|
|
|
|
long mPageBorder;
|
|
|
|
|
|
|
|
bool mbMouseOver;
|
|
|
|
SwPostItHelper::SwLayoutStatus mLayoutStatus;
|
|
|
|
|
|
|
|
bool mbReadonly;
|
|
|
|
bool mbIsFollow;
|
2010-02-02 15:11:26 +01:00
|
|
|
|
|
|
|
SwSidebarItem& mrSidebarItem;
|
2015-11-25 06:03:10 -05:00
|
|
|
const SwFrame* mpAnchorFrame;
|
2010-01-12 10:43:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} } // eof namespace sw::sidebarwindows
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|