Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SIDEBARWIN_HXX
30 : : #define _SIDEBARWIN_HXX
31 : :
32 : : #include <postithelper.hxx>
33 : : #include <SidebarWindowsTypes.hxx>
34 : :
35 : : #include <vcl/window.hxx>
36 : : #include <swrect.hxx>
37 : :
38 : : #include <tools/date.hxx>
39 : :
40 : : #include <vcl/lineinfo.hxx>
41 : : #include <basegfx/polygon/b2dpolygon.hxx>
42 : : #include <editeng/editstat.hxx>
43 : :
44 : : class SwPostItMgr;
45 : : class SwPostItField;
46 : : class OutlinerView;
47 : : class Outliner;
48 : : class ScrollBar;
49 : : class SwEditWin;
50 : : class SwView;
51 : : class Edit;
52 : : class MenuButton;
53 : : class SwFrm;
54 : :
55 : :
56 : : namespace sw { namespace sidebarwindows {
57 : :
58 : : class SidebarTxtControl;
59 : : class AnchorOverlayObject;
60 : : class ShadowOverlayObject;
61 : :
62 : : typedef sal_Int64 SwPostItBits;
63 : :
64 : : #define PB_Preview ((SwPostItBits)0x00000001)
65 : :
66 : :
67 : : class SwSidebarWin : public Window
68 : : {
69 : : public:
70 : : SwSidebarWin( SwEditWin& rEditWin,
71 : : WinBits nBits,
72 : : SwPostItMgr& aMgr,
73 : : SwPostItBits aBits,
74 : : SwSidebarItem& rSidebarItem );
75 : : virtual ~SwSidebarWin();
76 : :
77 : : void SetSize( const Size& rNewSize );
78 : : void SetPosSizePixelRect( long nX,
79 : : long nY,
80 : : long nWidth,
81 : : long nHeight,
82 : : const SwRect &aRect,
83 : : const long PageBorder);
84 : : void SetPosAndSize();
85 : : void TranslateTopPosition(const long aAmount);
86 : : virtual void CheckMetaText();
87 : :
88 : 0 : inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
89 : : SwEditWin* EditWin();
90 : :
91 : 192 : inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
92 : : bool HasScrollbar() const;
93 : : bool IsScrollbarVisible() const;
94 : 0 : inline ScrollBar* Scrollbar() { return mpVScrollbar; }
95 : 96 : inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
96 : 0 : inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
97 : :
98 : : long GetPostItTextHeight();
99 : :
100 : : void SwitchToPostIt(sal_uInt16 aDirection);
101 : : virtual void SwitchToFieldPos();
102 : :
103 : : virtual sal_uInt32 MoveCaret() = 0;
104 : :
105 : : virtual void UpdateData() = 0;
106 : : virtual void SetPostItText() = 0;
107 : : virtual void Delete();
108 : : virtual void GotoPos() = 0;
109 : :
110 : : virtual String GetAuthor() = 0;
111 : : virtual Date GetDate() = 0;
112 : : virtual Time GetTime() = 0;
113 : :
114 : : void ExecuteCommand(sal_uInt16 nSlot);
115 : : void InitControls();
116 : : void HidePostIt();
117 : : void DoResize();
118 : : void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
119 : : void SetScrollbar();
120 : :
121 : : void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
122 : 312 : const Point VirtualPos() { return mPosSize.TopLeft(); }
123 : 156 : const Size VirtualSize() { return mPosSize.GetSize(); }
124 : :
125 : : void ShowAnchorOnly(const Point &aPoint);
126 : : void ShowNote();
127 : : void HideNote();
128 : :
129 : : void ResetAttributes();
130 : :
131 : : void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
132 : : void SetReadonly(sal_Bool bSet);
133 : 0 : sal_Bool IsReadOnly() { return mbReadonly;}
134 : 54 : bool IsPreview() { return nFlags & PB_Preview;}
135 : :
136 : : void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
137 : 0 : const Color& ColorAnchor() { return mColorAnchor; }
138 : 0 : const Color& ColorDark() { return mColorDark; }
139 : 0 : const Color& ColorLight() { return mColorLight; }
140 : : void Rescale();
141 : :
142 : : void SetViewState(::sw::sidebarwindows::ViewState bViewState);
143 : :
144 : 234 : bool IsFollow() { return mbIsFollow; }
145 : 78 : void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
146 : : virtual bool CalcFollow() = 0;
147 : :
148 : : sal_Int32 GetMetaHeight();
149 : : sal_Int32 GetMinimumSizeWithMeta();
150 : : sal_Int32 GetMinimumSizeWithoutMeta();
151 : : sal_Int32 GetMetaButtonAreaWidth();
152 : : sal_Int32 GetScrollbarWidth();
153 : :
154 : : void SetSpellChecking();
155 : :
156 : : void ToggleInsMode();
157 : :
158 : : virtual void ActivatePostIt();
159 : : virtual void DeactivatePostIt();
160 : :
161 : : void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
162 : : const Color& aColor);
163 : 0 : SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
164 : 0 : Color GetChangeColor() { return mChangeColor; }
165 : :
166 : 0 : virtual bool IsProtected() {return mbReadonly;};
167 : :
168 : : DECL_LINK( WindowEventListener, VclSimpleEvent* );
169 : 0 : inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
170 : :
171 : : void SetLanguage(const SvxLanguageItem aNewItem);
172 : :
173 : : void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
174 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
175 : :
176 : : protected:
177 : : virtual void DataChanged( const DataChangedEvent& aEvent);
178 : : virtual void LoseFocus();
179 : : virtual void Paint( const Rectangle& rRect);
180 : : virtual void GetFocus();
181 : : virtual MenuButton* CreateMenuButton() = 0;
182 : :
183 : : void SetSizePixel( const Size& rNewSize );
184 : : SfxItemSet DefaultItem();
185 : :
186 : : DECL_LINK(ModifyHdl, void*);
187 : : DECL_LINK(ScrollHdl, ScrollBar*);
188 : : DECL_LINK(DeleteHdl, void*);
189 : :
190 : 0 : inline SwView& DocView() { return mrView;}
191 : 0 : inline SwPostItMgr& Mgr() { return mrMgr; }
192 : 306 : inline Outliner* Engine() { return mpOutliner;}
193 : :
194 : : private:
195 : : SwSidebarWin* GetTopReplyNote();
196 : :
197 : : virtual SvxLanguageItem GetLanguage(void);
198 : :
199 : : SwPostItMgr& mrMgr;
200 : : SwView& mrView;
201 : : const SwPostItBits nFlags;
202 : :
203 : : sal_uLong mnEventId;
204 : :
205 : : OutlinerView* mpOutlinerView;
206 : : Outliner* mpOutliner;
207 : :
208 : : sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
209 : : ScrollBar* mpVScrollbar;
210 : : Edit* mpMetadataAuthor;
211 : : Edit* mpMetadataDate;
212 : : MenuButton* mpMenuButton;
213 : :
214 : : sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
215 : : sw::sidebarwindows::ShadowOverlayObject* mpShadow;
216 : :
217 : : Color mColorAnchor;
218 : : Color mColorDark;
219 : : Color mColorLight;
220 : : Color mChangeColor;
221 : :
222 : : sw::sidebarwindows::SidebarPosition meSidebarPosition;
223 : :
224 : : Rectangle mPosSize;
225 : : SwRect mAnchorRect;
226 : : long mPageBorder;
227 : :
228 : : bool mbMouseOver;
229 : : SwPostItHelper::SwLayoutStatus mLayoutStatus;
230 : :
231 : : bool mbReadonly;
232 : : bool mbIsFollow;
233 : :
234 : : SwSidebarItem& mrSidebarItem;
235 : : const SwFrm* mpAnchorFrm;
236 : : };
237 : :
238 : : } } // eof namespace sw::sidebarwindows
239 : :
240 : : #endif
241 : :
242 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|