Files
libreoffice/sw/inc/PostItMgr.hxx

205 lines
6.5 KiB
C++
Raw Normal View History

INTEGRATION: CWS notes2 (1.1.2); FILE ADDED 2008/01/31 10:08:57 mod 1.1.2.56: #i6193# fix for crash, optimization included 2008/01/30 17:26:41 mod 1.1.2.55: #i6193# readonly state send to notes, swicht to next postit 2008/01/29 19:39:58 mod 1.1.2.54: spellchecking and context menu 2008/01/25 17:46:08 mod 1.1.2.53: View - Notes 2008/01/18 09:51:34 mba 1.1.2.52: fixed broken line ends 2008/01/12 09:35:18 mod 1.1.2.51: fix sidebar scrollareas 2008/01/10 17:34:00 mod 1.1.2.50: show notes always right side, do not show popup for read only notes 2008/01/09 19:37:29 mba 1.1.2.49: Complete rescaling of Postits 2008/01/09 16:36:31 mba 1.1.2.48: Complete rescaling of Postits 2008/01/09 15:52:19 mba 1.1.2.47: Complete rescaling of Postits 2008/01/07 16:08:41 mod 1.1.2.46: side of margin for each page individually, end of ankor if note is hidden at correct location 2007/12/21 16:41:52 mba 1.1.2.45: #i6193#: scale notes with zoom factor of edit window 2007/12/17 17:33:35 mba 1.1.2.44: #i6193#: solved reentrance problems in PostItMgr 2007/12/17 09:00:10 mod 1.1.2.43: fixes for web layout and seperater between sidebar 2007/11/30 15:13:35 mod 1.1.2.42: code cleanup and removing of flickering 2007/11/29 00:12:02 mod 1.1.2.41: notes grow automatically till next note or page border 2007/11/22 12:09:39 mod 1.1.2.40: relayout every time note had focus, as the size could have changed 2007/11/22 11:40:22 mod 1.1.2.39: fix for scrolling behaviour in VisPortChg, register text toolbar instead of draw 2007/11/17 22:07:12 mod 1.1.2.38: fix for layout assertions 2007/11/17 12:00:35 mod 1.1.2.37: different colors for scrollbar arrows based on scrolling offset value; fix for last note overlapping border 2007/11/16 16:06:49 mod 1.1.2.36: fixes for keyboard shortcut popup and PreparePageContainer() 2007/11/15 17:03:13 mod 1.1.2.35: improved auto scrolling of document and notes sidebar 2007/11/13 16:43:08 mod 1.1.2.34: no doc context menu on sidebar, new keyboard shortcuts, improved sidebar scrolling, no richtext 2007/11/08 08:15:50 mba 1.1.2.33: #i6193#: improved and more notifications about removed and inserted PostItFields 2007/11/05 16:21:51 mod 1.1.2.32: onyl relayout if field rect changes 2007/11/04 21:42:59 mod 1.1.2.31: completly new layout code by page 2007/10/23 15:58:21 mod 1.1.2.30: paint borders and shadows 2007/10/22 10:04:22 mod 1.1.2.29: fix for centered zoom; new buttons inside meta area 2007/10/17 15:50:57 mod 1.1.2.28: bend anchor either at frame of page 2007/10/16 15:26:21 mod 1.1.2.27: several improvements and fixes for layout algorithm 2007/10/16 10:19:59 mba 1.1.2.26: warning for missing end of file 2007/10/12 22:30:09 mod 1.1.2.25: fix for overlays, layout algorithm fix, patch for ww8 import 2007/10/10 21:32:16 mod 1.1.2.24: paint of sidebar; notes scrollbars fixed 2007/10/06 17:14:47 mod 1.1.2.23: fix for different page widths 2007/10/05 15:36:03 mod 1.1.2.22: fix for RightToLeft, fix for sidebar drawing 2007/10/04 14:23:06 mod 1.1.2.21: change fixed values to defines 2007/09/24 13:49:49 mod 1.1.2.20: notes are now collected inside SwTxtFld::SwTxtFld, IsInVisibleArea added to PostItMg, new colors for change tracking 2007/09/06 21:29:34 mod 1.1.2.19: Gradient for text, no notes for print view 2007/09/01 13:06:02 mod 1.1.2.18: new colors,bugfix for delete note 2007/07/04 15:42:21 mba 1.1.2.17: new shell for editing notes 2007/07/01 16:22:32 mod 1.1.2.16: no relayout in Paint(), but seperately in appropiate places 2007/06/26 16:34:51 mod 1.1.2.15: navigation for notes 2007/06/24 17:39:57 mod 1.1.2.14: new improved layout algorithm, no lower border 2007/06/22 20:59:56 mba 1.1.2.13: fixing some problems with dependencies 2007/06/21 07:43:12 mod 1.1.2.12: first code for layout algorithm, use of IsReadOnly and SetModified 2007/06/17 19:27:18 mod 1.1.2.11: AddPostIts only if there is a new postit, sorting of postits 2007/06/17 10:50:03 mba 1.1.2.10: EventId should be kept for removal in case view is destroyed before event is called 2007/06/16 19:16:30 mba 1.1.2.9: Force Layout after ReCalc; suppress Layout while Rects are invalid 2007/06/16 08:26:01 mod 1.1.2.8: #i6193# seperation of coordinate's rect and layout 2007/06/16 02:14:29 mod 1.1.2.7: #16193# move LayoutPostIts() in application event 2007/06/13 08:56:09 mod 1.1.2.6: #i6193# Navigator improvements, KeyHandling SwPostit 2007/06/10 15:59:28 mod 1.1.2.5: #i6193# Navigator: Hide,Show,Delete / SwPostIt: Author,Date 2007/06/08 16:48:15 mod 1.1.2.4: Hiding and deleting of notes #i6193# 2007/05/29 08:24:30 mod 1.1.2.3: Collecting notes in notify, positioning in paint 2007/05/25 06:52:10 fme 1.1.2.2: #i6193# New notes - forward declarations 2007/05/24 04:36:31 mod 1.1.2.1: Add new files
2008-02-19 12:20:41 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: PostItMgr.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: rt $ $Date: 2008-02-19 13:20:41 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#ifndef _POSTITMGR_HXX
#define _POSTITMGR_HXX
#ifndef _SFXLSTNER_HXX
#include <svtools/lstner.hxx>
#endif
#include <list>
#include <vector>
#include <tools/link.hxx>
#include <swrect.hxx>
class SwWrtShell;
class SwDoc;
class SwView;
class SwPostItField;
class SwFmtFld;
class SfxBroadcaster;
class SfxHint;
class SwPostIt;
class SwEditWin;
class Color;
#define SORT_POS 1
#define SORT_AUTHOR 2
#define SORT_DATE 3
#define COL_NOTES_SIDEPANE_ARROW_ENABLED RGB_COLORDATA(0,0,0)
#define COL_NOTES_SIDEPANE_ARROW_DISABLED RGB_COLORDATA(172,168,153)
struct SwPostItItem
{
bool bShow;
bool bFocus;
SwFmtFld* pFmtFld;
SwPostIt* pPostIt;
SwRect mPos;
SwRect mFramePos;
SwRect mPagePos;
SwPostItItem( SwFmtFld* p, bool aShow, bool aFocus)
: bShow(aShow),
bFocus(aFocus),
pFmtFld(p),
pPostIt(0)
{
}
};
typedef std::list<SwPostItItem*> SwPostItItem_list;
struct SwPostItPageItem
{
bool bScrollbar;
bool bMarginSide;
long lOffset;
SwRect mPageRect;
SwPostItItem_list* mList;
SwPostItPageItem(): bScrollbar(false),lOffset(0)
{
mList = new SwPostItItem_list;
}
~SwPostItPageItem()
{
mList->clear();
delete mList;
}
};
class SwPostItMgr: public SfxListener
{
private:
SwView* mpView;
SwWrtShell* mpWrtShell;
SwEditWin* mpEditWin;
std::list< SwPostItItem*> mvPostItFlds;
std::vector<SwPostItPageItem*> mPages;
ULONG mnEventId;
bool mbWaitingForCalcRects;
SwPostIt* mpActivePostIt;
bool mbLayout;
long mbLayoutHeight;
long mbLayouting;
bool mbDeletingSeveral;
typedef std::list<SwPostItItem*>::iterator SwPostItItem_iterator;
typedef std::list<SwPostIt*>::iterator SwPostIt_iterator;
void AddPostIts(bool bCheckExistance = true,bool bFocus = true);
void RemovePostIts();
void PreparePageContainer();
void Scroll(const long lScroll,const unsigned long aPage );
void AutoScroll(const SwPostIt* pPostIt,const unsigned long aPage );
bool ScrollbarHit(const unsigned long aPage,const Point &aPoint);
bool LayoutByPage(std::list<SwPostIt*> &aVisiblePostItList,const Rectangle aBorder,long lNeededHeight);
void CheckForRemovedPostIts();
bool ArrowEnabled(USHORT aDirection,unsigned long aPage);
bool BorderOverPageBorder(unsigned long aPage);
bool HasScrollbars();
sal_Int32 GetInitialAnchorDistance();
sal_Int32 GetScrollSize();
sal_Int32 GetSpaceBetween();
void SetReadOnlyState();
DECL_LINK( CalcHdl, void*);
protected:
public:
SwPostItMgr(SwView* aDoc);
~SwPostItMgr();
typedef std::list< SwPostItItem* >::const_iterator const_iterator;
const_iterator begin() const { return mvPostItFlds.begin(); }
const_iterator end() const { return mvPostItFlds.end(); }
void InsertFld( SwFmtFld* aField, bool bCheckExistance, bool bFocus);
void RemoveFld( SfxBroadcaster* pFld );
void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
void LayoutPostIts();
bool CalcRects();
void AutoScroll(const SwPostIt* pPostIt);
bool ShowScrollbar(const unsigned long aPage);
bool HasNotes();
bool ShowNotes();
unsigned long GetSidebarWidth(bool bPx = false);
unsigned long GetSidebarBorderWidth(bool bPx = false);
unsigned long GetNoteWidth();
void PrepareView(bool bIgnoreCount = false);
void CorrectPositions();
void SetColors(SwPostIt* pPostIt, SwPostItField* pFld);
void Sort(const short aType);
void SetLayout() { mbLayout = true; };
void Delete(String aAuthor);
void Delete();
void Hide(SwPostItField* aPostItField, bool All = false);
void Hide();
void Show();
void Rescale();
Rectangle GetBottomScrollRect(const unsigned long aPage);
Rectangle GetTopScrollRect(const unsigned long aPage);
bool IsHit(const Point &aPointPixel);
Color GetArrowColor(USHORT aDirection,unsigned long aPage);
SwPostIt* GetNextPostIt(USHORT aDirection, SwPostIt* aPostIt);
long GetNextBorder();
SwFmtFld* GetFmtFld(SwPostIt* mpPostIt);
SwPostIt* GetActivePostIt() { return mpActivePostIt; }
void SetActivePostIt( SwPostIt* p);
sal_Int32 GetMinimumSizeWithMeta();
sal_Int32 GetSidebarScrollerHeight();
void SetSpellChecking(bool bEnable);
};
#endif