bump product version to 4.1.6.2
[LibreOffice.git] / sw / inc / SidebarWin.hxx
blobf2078c24c8c6dc49081837862ac2c93e30e4badc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SIDEBARWIN_HXX
21 #define _SIDEBARWIN_HXX
23 #include <postithelper.hxx>
24 #include <SidebarWindowsTypes.hxx>
26 #include <vcl/window.hxx>
27 #include <swrect.hxx>
29 #include <tools/date.hxx>
31 #include <vcl/lineinfo.hxx>
32 #include <basegfx/polygon/b2dpolygon.hxx>
33 #include <editeng/editstat.hxx>
35 class SwPostItMgr;
36 class SwPostItField;
37 class OutlinerView;
38 class Outliner;
39 class ScrollBar;
40 class SwEditWin;
41 class SwView;
42 class Edit;
43 class MenuButton;
44 class SwFrm;
47 namespace sw { namespace sidebarwindows {
49 class SidebarTxtControl;
50 class AnchorOverlayObject;
51 class ShadowOverlayObject;
53 typedef sal_Int64 SwPostItBits;
55 #define PB_Preview ((SwPostItBits)0x00000001)
58 class SwSidebarWin : public Window
60 public:
61 SwSidebarWin( SwEditWin& rEditWin,
62 WinBits nBits,
63 SwPostItMgr& aMgr,
64 SwPostItBits aBits,
65 SwSidebarItem& rSidebarItem );
66 virtual ~SwSidebarWin();
68 void SetSize( const Size& rNewSize );
69 void SetPosSizePixelRect( long nX,
70 long nY,
71 long nWidth,
72 long nHeight,
73 const SwRect &aRect,
74 const long PageBorder);
75 void SetPosAndSize();
76 void TranslateTopPosition(const long aAmount);
77 virtual void CheckMetaText();
79 inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
80 SwEditWin* EditWin();
82 inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
83 bool HasScrollbar() const;
84 bool IsScrollbarVisible() const;
85 inline ScrollBar* Scrollbar() { return mpVScrollbar; }
86 inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
87 inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
89 long GetPostItTextHeight();
91 void SwitchToPostIt(sal_uInt16 aDirection);
92 virtual void SwitchToFieldPos();
94 virtual sal_uInt32 MoveCaret() = 0;
96 virtual void UpdateData() = 0;
97 virtual void SetPostItText() = 0;
98 virtual void Delete();
99 virtual void GotoPos() = 0;
101 virtual String GetAuthor() = 0;
102 virtual Date GetDate() = 0;
103 virtual Time GetTime() = 0;
105 void ExecuteCommand(sal_uInt16 nSlot);
106 void InitControls();
107 void HidePostIt();
108 void DoResize();
109 void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
110 void SetScrollbar();
112 void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
113 const Point VirtualPos() { return mPosSize.TopLeft(); }
114 const Size VirtualSize() { return mPosSize.GetSize(); }
116 void ShowAnchorOnly(const Point &aPoint);
117 void ShowNote();
118 void HideNote();
120 void ResetAttributes();
122 void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
123 void SetReadonly(sal_Bool bSet);
124 sal_Bool IsReadOnly() { return mbReadonly;}
125 bool IsPreview() { return nFlags & PB_Preview;}
127 void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
128 const Color& ColorAnchor() { return mColorAnchor; }
129 const Color& ColorDark() { return mColorDark; }
130 const Color& ColorLight() { return mColorLight; }
131 void Rescale();
133 void SetViewState(::sw::sidebarwindows::ViewState bViewState);
135 bool IsFollow() { return mbIsFollow; }
136 void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
137 virtual bool CalcFollow() = 0;
139 sal_Int32 GetMetaHeight();
140 sal_Int32 GetMinimumSizeWithMeta();
141 sal_Int32 GetMinimumSizeWithoutMeta();
142 sal_Int32 GetMetaButtonAreaWidth();
143 sal_Int32 GetScrollbarWidth();
145 void SetSpellChecking();
147 void ToggleInsMode();
149 virtual void ActivatePostIt();
150 virtual void DeactivatePostIt();
152 void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
153 const Color& aColor);
154 SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
155 Color GetChangeColor() { return mChangeColor; }
157 virtual bool IsProtected() {return mbReadonly;};
159 DECL_LINK( WindowEventListener, VclSimpleEvent* );
160 inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
162 void SetLanguage(const SvxLanguageItem aNewItem);
164 void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
165 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
167 protected:
168 virtual void DataChanged( const DataChangedEvent& aEvent);
169 virtual void LoseFocus();
170 virtual void Paint( const Rectangle& rRect);
171 virtual void GetFocus();
172 virtual MenuButton* CreateMenuButton() = 0;
174 void SetSizePixel( const Size& rNewSize );
175 SfxItemSet DefaultItem();
177 DECL_LINK(ModifyHdl, void*);
178 DECL_LINK(ScrollHdl, ScrollBar*);
179 DECL_LINK(DeleteHdl, void*);
181 inline SwView& DocView() { return mrView;}
182 inline SwPostItMgr& Mgr() { return mrMgr; }
183 inline Outliner* Engine() { return mpOutliner;}
185 private:
186 SwSidebarWin* GetTopReplyNote();
188 virtual SvxLanguageItem GetLanguage(void);
190 SwPostItMgr& mrMgr;
191 SwView& mrView;
192 const SwPostItBits nFlags;
194 sal_uLong mnEventId;
196 OutlinerView* mpOutlinerView;
197 Outliner* mpOutliner;
199 sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
200 ScrollBar* mpVScrollbar;
201 Edit* mpMetadataAuthor;
202 Edit* mpMetadataDate;
203 MenuButton* mpMenuButton;
205 sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
206 sw::sidebarwindows::ShadowOverlayObject* mpShadow;
208 Color mColorAnchor;
209 Color mColorDark;
210 Color mColorLight;
211 Color mChangeColor;
213 sw::sidebarwindows::SidebarPosition meSidebarPosition;
215 Rectangle mPosSize;
216 SwRect mAnchorRect;
217 long mPageBorder;
219 bool mbMouseOver;
220 SwPostItHelper::SwLayoutStatus mLayoutStatus;
222 bool mbReadonly;
223 bool mbIsFollow;
225 SwSidebarItem& mrSidebarItem;
226 const SwFrm* mpAnchorFrm;
229 } } // eof namespace sw::sidebarwindows
231 #endif
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */