xref: /aoo42x/main/sw/inc/SidebarWin.hxx (revision dec99bbd)
11d2dbeb0SAndrew Rist /**************************************************************
21d2dbeb0SAndrew Rist  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
101d2dbeb0SAndrew Rist  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
121d2dbeb0SAndrew Rist  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
191d2dbeb0SAndrew Rist  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SIDEBARWIN_HXX
25cdf0e10cSrcweir #define _SIDEBARWIN_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <postithelper.hxx>
28cdf0e10cSrcweir #include <SidebarWindowsTypes.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <vcl/window.hxx>
31cdf0e10cSrcweir #include <swrect.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <tools/datetime.hxx>
34cdf0e10cSrcweir #include <tools/date.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <vcl/lineinfo.hxx>
37cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
38cdf0e10cSrcweir #include <editeng/editstat.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class SwPostItMgr;
41cdf0e10cSrcweir class SwPostItField;
42cdf0e10cSrcweir class OutlinerView;
43cdf0e10cSrcweir class Outliner;
44cdf0e10cSrcweir class ScrollBar;
45cdf0e10cSrcweir class SwEditWin;
46cdf0e10cSrcweir class SwView;
47cdf0e10cSrcweir class Edit;
48cdf0e10cSrcweir class MenuButton;
49cdf0e10cSrcweir class SwFrm;
50cdf0e10cSrcweir 
51*dec99bbdSOliver-Rainer Wittmann namespace sw { namespace overlay {
52*dec99bbdSOliver-Rainer Wittmann     class OverlayRanges;
53*dec99bbdSOliver-Rainer Wittmann }}
54cdf0e10cSrcweir 
55cdf0e10cSrcweir namespace sw { namespace sidebarwindows {
56cdf0e10cSrcweir 
57cdf0e10cSrcweir class SidebarTxtControl;
58cdf0e10cSrcweir class AnchorOverlayObject;
59cdf0e10cSrcweir class ShadowOverlayObject;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir typedef sal_Int64 SwPostItBits;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #define PB_Preview ((SwPostItBits)0x00000001)
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir class SwSidebarWin : public Window
67cdf0e10cSrcweir {
68*dec99bbdSOliver-Rainer Wittmann     public:
69cdf0e10cSrcweir         SwSidebarWin( SwEditWin& rEditWin,
70cdf0e10cSrcweir                       WinBits nBits,
71cdf0e10cSrcweir                       SwPostItMgr& aMgr,
72cdf0e10cSrcweir                       SwPostItBits aBits,
73cdf0e10cSrcweir                       SwSidebarItem& rSidebarItem );
74cdf0e10cSrcweir         virtual ~SwSidebarWin();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         void SetSize( const Size& rNewSize );
77cdf0e10cSrcweir         void SetPosSizePixelRect( long nX,
78cdf0e10cSrcweir                                   long nY,
79cdf0e10cSrcweir                                   long nWidth,
80cdf0e10cSrcweir                                   long nHeight,
81*dec99bbdSOliver-Rainer Wittmann                                   const SwRect& aAnchorRect,
82cdf0e10cSrcweir                                   const long PageBorder);
83cdf0e10cSrcweir         void SetPosAndSize();
84cdf0e10cSrcweir         void TranslateTopPosition(const long aAmount);
85cdf0e10cSrcweir         virtual void CheckMetaText();
86cdf0e10cSrcweir 
GetAnchorPos()87cdf0e10cSrcweir         inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
88cdf0e10cSrcweir         SwEditWin* EditWin();
89cdf0e10cSrcweir 
GetOutlinerView()90cdf0e10cSrcweir         inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
91cdf0e10cSrcweir         bool HasScrollbar() const;
92cdf0e10cSrcweir         bool IsScrollbarVisible() const;
Scrollbar()93cdf0e10cSrcweir         inline ScrollBar* Scrollbar() { return mpVScrollbar; }
Anchor()94cdf0e10cSrcweir         inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
Shadow()95cdf0e10cSrcweir         inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
TextRange()96*dec99bbdSOliver-Rainer Wittmann         inline ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay;}
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         long            GetPostItTextHeight();
99cdf0e10cSrcweir 
100*dec99bbdSOliver-Rainer Wittmann         void            SwitchToPostIt(sal_uInt16 aDirection);
101*dec99bbdSOliver-Rainer Wittmann         virtual void    SwitchToFieldPos();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         virtual sal_uInt32 MoveCaret() = 0;
104cdf0e10cSrcweir 
105*dec99bbdSOliver-Rainer Wittmann         virtual void    UpdateData() = 0;
106*dec99bbdSOliver-Rainer Wittmann         virtual void    SetPostItText() = 0;
107*dec99bbdSOliver-Rainer Wittmann         virtual void    Delete();
108*dec99bbdSOliver-Rainer Wittmann         virtual void    GotoPos() = 0;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir         virtual String  GetAuthor() = 0;
111cdf0e10cSrcweir         virtual Date    GetDate() = 0;
112cdf0e10cSrcweir         virtual Time    GetTime() = 0;
113cdf0e10cSrcweir 
114*dec99bbdSOliver-Rainer Wittmann         void            ExecuteCommand(sal_uInt16 nSlot);
115*dec99bbdSOliver-Rainer Wittmann         void            InitControls();
116cdf0e10cSrcweir         void            HidePostIt();
117cdf0e10cSrcweir         void            DoResize();
118*dec99bbdSOliver-Rainer Wittmann         void            ResizeIfNeccessary(long aOldHeight, long aNewHeight);
119*dec99bbdSOliver-Rainer Wittmann         void            SetScrollbar();
120cdf0e10cSrcweir 
121*dec99bbdSOliver-Rainer Wittmann         void            SetVirtualPosSize( const Point& aPoint, const Size& aSize);
VirtualPos()122*dec99bbdSOliver-Rainer Wittmann         const Point     VirtualPos()	{ return mPosSize.TopLeft(); }
VirtualSize()123*dec99bbdSOliver-Rainer Wittmann         const Size      VirtualSize()	{ return mPosSize.GetSize(); }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir         void            ShowAnchorOnly(const Point &aPoint);
126cdf0e10cSrcweir         void            ShowNote();
127cdf0e10cSrcweir         void            HideNote();
128cdf0e10cSrcweir 
129*dec99bbdSOliver-Rainer Wittmann         void            ResetAttributes();
130cdf0e10cSrcweir 
131cdf0e10cSrcweir         void            SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
132*dec99bbdSOliver-Rainer Wittmann         void            SetReadonly(sal_Bool bSet);
IsReadOnly()133*dec99bbdSOliver-Rainer Wittmann         sal_Bool        IsReadOnly()
134*dec99bbdSOliver-Rainer Wittmann         {
135*dec99bbdSOliver-Rainer Wittmann             return mbReadonly;
136*dec99bbdSOliver-Rainer Wittmann         }
IsPreview()137*dec99bbdSOliver-Rainer Wittmann         bool            IsPreview()
138*dec99bbdSOliver-Rainer Wittmann         {
139*dec99bbdSOliver-Rainer Wittmann             return nFlags & PB_Preview;
140*dec99bbdSOliver-Rainer Wittmann         }
141*dec99bbdSOliver-Rainer Wittmann 
142*dec99bbdSOliver-Rainer Wittmann         void         SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
ColorAnchor()143cdf0e10cSrcweir         const Color& ColorAnchor() { return mColorAnchor; }
ColorDark()144cdf0e10cSrcweir         const Color& ColorDark() { return mColorDark; }
ColorLight()145cdf0e10cSrcweir         const Color& ColorLight() { return mColorLight; }
146*dec99bbdSOliver-Rainer Wittmann         void         Rescale();
147cdf0e10cSrcweir 
148cdf0e10cSrcweir         void            SetViewState(::sw::sidebarwindows::ViewState bViewState);
149cdf0e10cSrcweir 
IsFollow()150cdf0e10cSrcweir         bool            IsFollow() { return mbIsFollow; }
SetFollow(bool bIsFollow)151cdf0e10cSrcweir         void            SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
152cdf0e10cSrcweir         virtual bool    CalcFollow() = 0;
153cdf0e10cSrcweir 
154*dec99bbdSOliver-Rainer Wittmann         sal_Int32   GetMetaHeight();
155*dec99bbdSOliver-Rainer Wittmann         sal_Int32   GetMinimumSizeWithMeta();
156*dec99bbdSOliver-Rainer Wittmann         sal_Int32   GetMinimumSizeWithoutMeta();
157*dec99bbdSOliver-Rainer Wittmann         sal_Int32   GetMetaButtonAreaWidth();
158*dec99bbdSOliver-Rainer Wittmann         sal_Int32   GetScrollbarWidth();
159cdf0e10cSrcweir 
160*dec99bbdSOliver-Rainer Wittmann         void    SetSpellChecking();
161cdf0e10cSrcweir 
162*dec99bbdSOliver-Rainer Wittmann         void    ToggleInsMode();
163cdf0e10cSrcweir 
164*dec99bbdSOliver-Rainer Wittmann         virtual void    ActivatePostIt();
165*dec99bbdSOliver-Rainer Wittmann         virtual void    DeactivatePostIt();
166cdf0e10cSrcweir 
167cdf0e10cSrcweir         void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
168cdf0e10cSrcweir                                 const Color& aColor);
GetLayoutStatus()169cdf0e10cSrcweir         SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
GetChangeColor()170cdf0e10cSrcweir         Color GetChangeColor() { return mChangeColor; }
171cdf0e10cSrcweir 
IsProtected()172*dec99bbdSOliver-Rainer Wittmann         virtual bool IsProtected()
173*dec99bbdSOliver-Rainer Wittmann         {
174*dec99bbdSOliver-Rainer Wittmann             return mbReadonly;
175*dec99bbdSOliver-Rainer Wittmann         }
176cdf0e10cSrcweir 
177cdf0e10cSrcweir         DECL_LINK( WindowEventListener, VclSimpleEvent* );
IsMouseOverSidebarWin() const178cdf0e10cSrcweir         inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
179cdf0e10cSrcweir 
180cdf0e10cSrcweir         void SetLanguage(const SvxLanguageItem aNewItem);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir         void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
183cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     protected:
186cdf0e10cSrcweir         virtual void    DataChanged( const DataChangedEvent& aEvent);
187cdf0e10cSrcweir         virtual void    LoseFocus();
188cdf0e10cSrcweir         virtual void    Paint( const Rectangle& rRect);
189cdf0e10cSrcweir         virtual void    GetFocus();
190cdf0e10cSrcweir         virtual MenuButton* CreateMenuButton() = 0;
191cdf0e10cSrcweir 
192cdf0e10cSrcweir         void        SetSizePixel( const Size& rNewSize );
193cdf0e10cSrcweir         SfxItemSet  DefaultItem();
194cdf0e10cSrcweir 
195cdf0e10cSrcweir         DECL_LINK(ModifyHdl, void*);
196cdf0e10cSrcweir         DECL_LINK(ScrollHdl, ScrollBar*);
197cdf0e10cSrcweir         DECL_LINK(DeleteHdl, void*);
198cdf0e10cSrcweir 
DocView()199cdf0e10cSrcweir         inline SwView& DocView() { return mrView;}
Mgr()200cdf0e10cSrcweir         inline SwPostItMgr& Mgr() { return mrMgr; }
Engine()201cdf0e10cSrcweir         inline Outliner* Engine() { return mpOutliner;}
202cdf0e10cSrcweir 
203cdf0e10cSrcweir     private:
204cdf0e10cSrcweir         SwSidebarWin*   GetTopReplyNote();
205cdf0e10cSrcweir 
206cdf0e10cSrcweir         virtual SvxLanguageItem GetLanguage(void);
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         SwPostItMgr&    mrMgr;
209cdf0e10cSrcweir         SwView&         mrView;
210cdf0e10cSrcweir         const SwPostItBits nFlags;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir         sal_uLong           mnEventId;
213cdf0e10cSrcweir 
214cdf0e10cSrcweir         OutlinerView*   mpOutlinerView;
215cdf0e10cSrcweir         Outliner*       mpOutliner;
216cdf0e10cSrcweir 
217cdf0e10cSrcweir         sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
218cdf0e10cSrcweir         ScrollBar*      mpVScrollbar;
219cdf0e10cSrcweir         Edit*           mpMetadataAuthor;
220cdf0e10cSrcweir         Edit*           mpMetadataDate;
221cdf0e10cSrcweir         MenuButton*     mpMenuButton;
222cdf0e10cSrcweir 
223cdf0e10cSrcweir         sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
224cdf0e10cSrcweir         sw::sidebarwindows::ShadowOverlayObject* mpShadow;
225*dec99bbdSOliver-Rainer Wittmann         sw::overlay::OverlayRanges* mpTextRangeOverlay;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir         Color           mColorAnchor;
228cdf0e10cSrcweir         Color           mColorDark;
229cdf0e10cSrcweir         Color           mColorLight;
230cdf0e10cSrcweir         Color           mChangeColor;
231cdf0e10cSrcweir 
232cdf0e10cSrcweir         sw::sidebarwindows::SidebarPosition meSidebarPosition;
233cdf0e10cSrcweir 
234cdf0e10cSrcweir         Rectangle       mPosSize;
235cdf0e10cSrcweir         SwRect          mAnchorRect;
236cdf0e10cSrcweir         long            mPageBorder;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir         bool            mbMouseOver;
239cdf0e10cSrcweir         SwPostItHelper::SwLayoutStatus mLayoutStatus;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir         bool            mbReadonly;
242cdf0e10cSrcweir         bool            mbIsFollow;
243cdf0e10cSrcweir 
244cdf0e10cSrcweir         SwSidebarItem& mrSidebarItem;
245cdf0e10cSrcweir         const SwFrm* mpAnchorFrm;
246cdf0e10cSrcweir };
247cdf0e10cSrcweir 
248cdf0e10cSrcweir } } // eof namespace sw::sidebarwindows
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 
251cdf0e10cSrcweir // implementation for change tracking comments, fully functional, but not yet used
252cdf0e10cSrcweir /*
253cdf0e10cSrcweir class SwRedComment : public SwSidebarWin
254cdf0e10cSrcweir {
255cdf0e10cSrcweir 	private:
256cdf0e10cSrcweir 		SwRedline*		pRedline;
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 	protected:
259cdf0e10cSrcweir 		virtual void	MouseButtonDown( const MouseEvent& rMEvt );
260cdf0e10cSrcweir 	public:
261cdf0e10cSrcweir 		SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed);
262cdf0e10cSrcweir 		virtual ~SwRedComment() {};
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 		virtual void	UpdateData();
265cdf0e10cSrcweir 		virtual void	SetPostItText();
266cdf0e10cSrcweir 		virtual void	Delete();
267cdf0e10cSrcweir 		virtual void	GotoPos();
268cdf0e10cSrcweir 		virtual void	SetPopup();
269cdf0e10cSrcweir 		virtual void	ActivatePostIt();
270cdf0e10cSrcweir 		virtual void	DeactivatePostIt();
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 		virtual String	GetAuthor();
273cdf0e10cSrcweir 		virtual Date	GetDate();
274cdf0e10cSrcweir 		virtual Time	GetTime();
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 		virtual bool	IsProtected();
277cdf0e10cSrcweir };
278cdf0e10cSrcweir */
279cdf0e10cSrcweir 
280cdf0e10cSrcweir #endif
281