1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
29 #include <tools/date.hxx>
31 #include <vcl/lineinfo.hxx>
32 #include <basegfx/polygon/b2dpolygon.hxx>
33 #include <editeng/editstat.hxx>
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
61 SwSidebarWin( SwEditWin
& rEditWin
,
65 SwSidebarItem
& rSidebarItem
);
66 virtual ~SwSidebarWin();
68 void SetSize( const Size
& rNewSize
);
69 void SetPosSizePixelRect( long nX
,
74 const long PageBorder
);
76 void TranslateTopPosition(const long aAmount
);
77 virtual void CheckMetaText();
79 inline Point
GetAnchorPos() { return mAnchorRect
.Pos(); }
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
);
109 void ResizeIfNeccessary(long aOldHeight
, long aNewHeight
);
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
);
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
; }
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();
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
;}
186 SwSidebarWin
* GetTopReplyNote();
188 virtual SvxLanguageItem
GetLanguage(void);
192 const SwPostItBits nFlags
;
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
;
213 sw::sidebarwindows::SidebarPosition meSidebarPosition
;
220 SwPostItHelper::SwLayoutStatus mLayoutStatus
;
225 SwSidebarItem
& mrSidebarItem
;
226 const SwFrm
* mpAnchorFrm
;
229 } } // eof namespace sw::sidebarwindows
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */