summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2010-05-11 10:49:42 +0200
committerIvo Hinkelmann <ihi@openoffice.org>2010-05-11 10:49:42 +0200
commitfd0d8d24cb28698f12699239e654649f52592c78 (patch)
tree3c474b3dd707359f0fb1662fbb605d8ab615fb32
parent012dcb14021a96afcfaa4bd223e3d0b7b7bc45f0 (diff)
parente516004863124017a0b01ebde6a246981301930b (diff)
CWS-TOOLING: integrate CWS sw33a11y01
-rw-r--r--sw/inc/AnnotationWin.hxx83
-rw-r--r--sw/inc/PostItMgr.hxx129
-rw-r--r--sw/inc/SidebarWin.hxx272
-rw-r--r--sw/inc/SidebarWindowsTypes.hxx53
-rw-r--r--sw/inc/access.hrc33
-rw-r--r--sw/inc/accmap.hxx107
-rw-r--r--sw/inc/fesh.hxx2
-rw-r--r--sw/inc/postit.hxx413
-rw-r--r--sw/inc/postithelper.hxx95
-rw-r--r--sw/inc/rcid.hrc7
-rw-r--r--sw/inc/sw_primitivetypes2d.hxx6
-rw-r--r--sw/inc/unotextmarkup.hxx1
-rwxr-xr-xsw/inc/viewsh.hxx14
-rw-r--r--sw/source/core/access/acccell.cxx30
-rw-r--r--sw/source/core/access/acccell.hxx4
-rw-r--r--sw/source/core/access/acccontext.cxx304
-rw-r--r--sw/source/core/access/acccontext.hxx33
-rw-r--r--sw/source/core/access/accdoc.cxx4
-rw-r--r--sw/source/core/access/accfootnote.hxx10
-rw-r--r--sw/source/core/access/accframe.cxx266
-rw-r--r--sw/source/core/access/accframe.hxx122
-rw-r--r--sw/source/core/access/accframebase.hxx10
-rw-r--r--sw/source/core/access/accfrmobj.cxx401
-rw-r--r--sw/source/core/access/accfrmobj.hxx214
-rw-r--r--sw/source/core/access/accfrmobjmap.cxx154
-rw-r--r--sw/source/core/access/accfrmobjmap.hxx92
-rw-r--r--sw/source/core/access/accfrmobjslist.cxx129
-rw-r--r--sw/source/core/access/accfrmobjslist.hxx189
-rw-r--r--sw/source/core/access/accmap.cxx526
-rw-r--r--sw/source/core/access/accpara.cxx452
-rw-r--r--sw/source/core/access/accpara.hxx39
-rw-r--r--sw/source/core/access/accselectionhelper.cxx77
-rw-r--r--sw/source/core/access/acctable.cxx195
-rw-r--r--sw/source/core/access/acctable.hxx16
-rw-r--r--sw/source/core/access/makefile.mk6
-rw-r--r--sw/source/core/access/parachangetrackinginfo.cxx231
-rw-r--r--sw/source/core/access/parachangetrackinginfo.hxx59
-rw-r--r--sw/source/core/access/textmarkuphelper.cxx55
-rw-r--r--sw/source/core/access/textmarkuphelper.hxx29
-rw-r--r--sw/source/core/crsr/findtxt.cxx5
-rw-r--r--sw/source/core/doc/doclay.cxx2
-rw-r--r--sw/source/core/draw/dview.cxx5
-rw-r--r--sw/source/core/fields/postithelper.cxx72
-rw-r--r--sw/source/core/frmedt/fefly1.cxx6
-rw-r--r--sw/source/core/frmedt/feshview.cxx7
-rw-r--r--sw/source/core/inc/cellfrm.hxx4
-rw-r--r--sw/source/core/inc/pagefrm.hxx6
-rw-r--r--sw/source/core/inc/viewimp.hxx15
-rw-r--r--sw/source/core/inc/wrong.hxx8
-rw-r--r--sw/source/core/layout/layact.cxx24
-rw-r--r--sw/source/core/layout/pagechg.cxx14
-rw-r--r--sw/source/core/layout/paintfrm.cxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx50
-rw-r--r--sw/source/core/layout/wsfrm.cxx22
-rw-r--r--sw/source/core/text/txtfly.cxx78
-rw-r--r--sw/source/core/text/txtfrm.cxx7
-rw-r--r--sw/source/core/view/viewimp.cxx4
-rwxr-xr-xsw/source/core/view/viewsh.cxx46
-rw-r--r--sw/source/filter/ww1/fltshell.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/ui/app/docsh.cxx17
-rw-r--r--sw/source/ui/docvw/AnchorOverlayObject.cxx467
-rw-r--r--sw/source/ui/docvw/AnchorOverlayObject.hxx143
-rw-r--r--sw/source/ui/docvw/AnnotationMenuButton.cxx222
-rw-r--r--sw/source/ui/docvw/AnnotationMenuButton.hxx63
-rw-r--r--sw/source/ui/docvw/AnnotationWin.cxx292
-rw-r--r--sw/source/ui/docvw/PostItMgr.cxx583
-rw-r--r--sw/source/ui/docvw/ShadowOverlayObject.cxx269
-rw-r--r--sw/source/ui/docvw/ShadowOverlayObject.hxx80
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.cxx422
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.hxx87
-rw-r--r--sw/source/ui/docvw/SidebarTxtControlAcc.cxx317
-rw-r--r--sw/source/ui/docvw/SidebarTxtControlAcc.hxx56
-rw-r--r--sw/source/ui/docvw/SidebarWin.cxx1373
-rw-r--r--sw/source/ui/docvw/SidebarWinAcc.cxx162
-rw-r--r--sw/source/ui/docvw/SidebarWinAcc.hxx67
-rw-r--r--sw/source/ui/docvw/access.src16
-rw-r--r--sw/source/ui/docvw/annotation.hrc54
-rw-r--r--sw/source/ui/docvw/annotation.src68
-rw-r--r--sw/source/ui/docvw/docvw.hrc11
-rw-r--r--sw/source/ui/docvw/docvw.src35
-rw-r--r--sw/source/ui/docvw/edtwin.cxx15
-rw-r--r--sw/source/ui/docvw/edtwin2.cxx1
-rw-r--r--sw/source/ui/docvw/frmsidebarwincontainer.cxx216
-rw-r--r--sw/source/ui/docvw/frmsidebarwincontainer.hxx73
-rw-r--r--sw/source/ui/docvw/makefile.mk15
-rw-r--r--sw/source/ui/docvw/postit.cxx2482
-rw-r--r--sw/source/ui/inc/SidebarWindowsConsts.hxx41
-rw-r--r--sw/source/ui/makefile.mk4
-rwxr-xr-xsw/source/ui/shells/annotsh.cxx112
-rw-r--r--sw/source/ui/shells/textdrw.cxx1
-rw-r--r--sw/source/ui/shells/textfld.cxx19
-rw-r--r--sw/source/ui/uiview/view.cxx2
-rw-r--r--sw/source/ui/uiview/view2.cxx10
-rw-r--r--sw/source/ui/uiview/viewmdi.cxx19
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx2
-rw-r--r--sw/source/ui/utlui/attrdesc.cxx6
-rw-r--r--sw/source/ui/utlui/attrdesc.hrc6
-rw-r--r--sw/source/ui/utlui/attrdesc.src6
-rw-r--r--sw/source/ui/utlui/content.cxx7
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx4
-rw-r--r--sw/util/makefile.mk4
103 files changed, 8135 insertions, 4965 deletions
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
new file mode 100644
index 000000000000..ef39ad6e4c8f
--- /dev/null
+++ b/sw/inc/AnnotationWin.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATIONWIN_HXX
+#define _ANNOTATIONWIN_HXX
+
+#include <SidebarWin.hxx>
+
+class PopupMenu;
+class OutlinerParaObject;
+
+namespace sw { namespace annotation {
+
+class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
+{
+ public:
+ SwAnnotationWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem,
+ SwFmtFld* aField );
+ virtual ~SwAnnotationWin();
+
+ virtual void UpdateData();
+ virtual void SetPostItText();
+ virtual void Delete();
+ virtual void GotoPos();
+
+ virtual String GetAuthor();
+ virtual Date GetDate();
+ virtual Time GetTime();
+
+ virtual sal_uInt32 MoveCaret();
+
+ virtual bool CalcFollow();
+ void InitAnswer(OutlinerParaObject* pText);
+
+ virtual bool IsProtected();
+
+ protected:
+ virtual MenuButton* CreateMenuButton();
+
+ private:
+ virtual SvxLanguageItem GetLanguage(void);
+ sal_uInt32 CountFollowing();
+
+ SwFmtFld* mpFmtFld;
+ SwPostItField* mpFld;
+ PopupMenu* mpButtonPopup;
+
+};
+
+} } // end of namespace sw::annotation
+#endif
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index e3d46238a286..e99c636ccedb 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -39,6 +39,7 @@
#include <unotools/options.hxx>
#include <com/sun/star/util/SearchOptions.hpp>
#include <com/sun/star/uno/Any.hxx>
+#include <SidebarWindowsTypes.hxx>
#include <svl/lstner.hxx>
class SwWrtShell;
@@ -53,9 +54,16 @@ class SwEditWin;
class Color;
class SvxSearchItem;
class SvxLanguageItem;
-class SwPostIt;
-class SwMarginWin;
-class SwMarginItem;
+namespace sw { namespace annotation {
+ class SwAnnotationWin;
+}}
+namespace sw { namespace sidebarwindows {
+ class SwSidebarWin;
+ class SwFrmSidebarWinContainer;
+}}
+class SwSidebarItem;
+class SwFrm;
+class Window;
#define SORT_POS 1
#define SORT_AUTHOR 2
@@ -64,23 +72,20 @@ class SwMarginItem;
#define COL_NOTES_SIDEPANE_ARROW_ENABLED RGB_COLORDATA(0,0,0)
#define COL_NOTES_SIDEPANE_ARROW_DISABLED RGB_COLORDATA(172,168,153)
-typedef std::list<SwMarginItem*> SwMarginItem_list;
-typedef std::list<SwMarginItem*>::iterator SwMarginItem_iterator;
+typedef std::list<SwSidebarItem*> SwSidebarItem_list;
+typedef std::list<SwSidebarItem*>::iterator SwSidebarItem_iterator;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using ::rtl::OUString;
struct SwPostItPageItem
{
bool bScrollbar;
- bool bMarginSide;
+ sw::sidebarwindows::SidebarPosition eSidebarPosition;
long lOffset;
SwRect mPageRect;
- SwMarginItem_list* mList;
+ SwSidebarItem_list* mList;
SwPostItPageItem(): bScrollbar(false),lOffset(0)
{
- mList = new SwMarginItem_list;
+ mList = new SwSidebarItem_list;
}
~SwPostItPageItem()
{
@@ -103,25 +108,27 @@ struct FieldShadowState
class SwNoteProps: public utl::ConfigItem
{
private:
- bool bIsShowAnkor;
+ bool bIsShowAnchor;
public:
- SwNoteProps() : ConfigItem(::rtl::OUString::createFromAscii("Office.Writer/Notes")), bIsShowAnkor(false)
+ SwNoteProps()
+ : ConfigItem(::rtl::OUString::createFromAscii("Office.Writer/Notes"))
+ , bIsShowAnchor(false)
{
- const Sequence<OUString>& rNames = GetPropertyNames();
- Sequence<Any> aValues = GetProperties(rNames);
- const Any* pValues = aValues.getConstArray();
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames = GetPropertyNames();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aValues = GetProperties(rNames);
+ const ::com::sun::star::uno::Any* pValues = aValues.getConstArray();
DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
if (aValues.getLength())
- pValues[0]>>=bIsShowAnkor;
+ pValues[0]>>=bIsShowAnchor;
}
- bool IsShowAnkor()
+ bool IsShowAnchor()
{
- return bIsShowAnkor;
+ return bIsShowAnchor;
}
- Sequence<OUString>& GetPropertyNames()
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetPropertyNames()
{
- static Sequence<OUString> aNames;
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames;
if(!aNames.getLength())
{
static const char* aPropNames[] =
@@ -130,9 +137,9 @@ class SwNoteProps: public utl::ConfigItem
};
const int nCount = sizeof(aPropNames)/sizeof(const char*);
aNames.realloc(nCount);
- OUString* pNames = aNames.getArray();
+ ::rtl::OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
- pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ pNames[i] = ::rtl::OUString::createFromAscii(aPropNames[i]);
}
return aNames;
}
@@ -147,11 +154,11 @@ class SwPostItMgr: public SfxListener
SwView* mpView;
SwWrtShell* mpWrtShell;
SwEditWin* mpEditWin;
- std::list< SwMarginItem*> mvPostItFlds;
+ std::list< SwSidebarItem*> mvPostItFlds;
std::vector<SwPostItPageItem*> mPages;
ULONG mnEventId;
bool mbWaitingForCalcRects;
- SwMarginWin* mpActivePostIt;
+ sw::sidebarwindows::SwSidebarWin* mpActivePostIt;
bool mbLayout;
long mbLayoutHeight;
long mbLayouting;
@@ -159,18 +166,23 @@ class SwPostItMgr: public SfxListener
bool mbDeleteNote;
FieldShadowState mShadowState;
OutlinerParaObject* mpAnswer;
- bool mpIsShowAnkor;
+ bool mbIsShowAnchor;
- typedef std::list<SwMarginWin*>::iterator SwMarginWin_iterator;
+ // data structure to collect the <SwSidebarWin> instances for certain <SwFrm> instances.
+ sw::sidebarwindows::SwFrmSidebarWinContainer* mpFrmSidebarWinContainer;
+
+ typedef std::list<sw::sidebarwindows::SwSidebarWin*>::iterator SwSidebarWin_iterator;
void AddPostIts(bool bCheckExistance = true,bool bFocus = true);
//void AddRedlineComments(bool bCheckExistance, bool bFocus);
- void RemoveMarginWin();
+ void RemoveSidebarWin();
void PreparePageContainer();
void Scroll(const long lScroll,const unsigned long aPage );
- void AutoScroll(const SwMarginWin* pPostIt,const unsigned long aPage );
+ void AutoScroll(const sw::sidebarwindows::SwSidebarWin* pPostIt,const unsigned long aPage );
bool ScrollbarHit(const unsigned long aPage,const Point &aPoint);
- bool LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const Rectangle aBorder,long lNeededHeight);
+ bool LayoutByPage( std::list<sw::sidebarwindows::SwSidebarWin*> &aVisiblePostItList,
+ const Rectangle aBorder,
+ long lNeededHeight);
void CheckForRemovedPostIts();
bool ArrowEnabled(USHORT aDirection,unsigned long aPage) const;
bool BorderOverPageBorder(unsigned long aPage) const;
@@ -182,29 +194,34 @@ class SwPostItMgr: public SfxListener
sal_Int32 GetSpaceBetween() const;
void SetReadOnlyState();
DECL_LINK( CalcHdl, void*);
- protected:
+
+ sw::sidebarwindows::SwSidebarWin* GetSidebarWin(const SfxBroadcaster* pBroadcaster) const;
+
+ void InsertItem( SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus);
+ void RemoveItem( SfxBroadcaster* pBroadcast );
+
+ void Sort(const short aType);
public:
SwPostItMgr(SwView* aDoc);
~SwPostItMgr();
- typedef std::list< SwMarginItem* >::const_iterator const_iterator;
+ typedef std::list< SwSidebarItem* >::const_iterator const_iterator;
const_iterator begin() const { return mvPostItFlds.begin(); }
const_iterator end() const { return mvPostItFlds.end(); }
- void InsertItem( SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus);
- void RemoveItem( SfxBroadcaster* pBroadcast );
void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
void LayoutPostIts();
bool CalcRects();
- void MakeVisible(const SwMarginWin* pPostIt,long aPage = -1);
+ void MakeVisible( const sw::sidebarwindows::SwSidebarWin* pPostIt,
+ long aPage = -1);
bool ShowScrollbar(const unsigned long aPage) const;
bool HasNotes() const ;
bool ShowNotes() const;
- bool IsShowAnkor() { return mpIsShowAnkor;}
+ bool IsShowAnchor() { return mbIsShowAnchor;}
unsigned long GetSidebarWidth(bool bPx = false) const;
unsigned long GetSidebarBorderWidth(bool bPx = false) const;
unsigned long GetNoteWidth();
@@ -213,8 +230,6 @@ class SwPostItMgr: public SfxListener
void CorrectPositions();
- void Sort(const short aType);
-
void SetLayout() { mbLayout = true; };
void Delete(String aAuthor);
void Delete();
@@ -232,25 +247,32 @@ class SwPostItMgr: public SfxListener
bool IsHit(const Point &aPointPixel);
Color GetArrowColor(USHORT aDirection,unsigned long aPage) const;
- SwMarginWin* GetNextPostIt(USHORT aDirection, SwMarginWin* aPostIt);
+ sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pFld) const;
+
+ sw::sidebarwindows::SwSidebarWin* GetNextPostIt( USHORT aDirection,
+ sw::sidebarwindows::SwSidebarWin* aPostIt);
long GetNextBorder();
- SwMarginWin* GetActivePostIt() { return mpActivePostIt; }
- void SetActivePostIt( SwMarginWin* p);
+
+ sw::sidebarwindows::SwSidebarWin* GetActiveSidebarWin() { return mpActivePostIt; }
+ void SetActiveSidebarWin( sw::sidebarwindows::SwSidebarWin* p);
+ bool HasActiveSidebarWin() const;
+ bool HasActiveAnnotationWin() const;
+ void GrabFocusOnActiveSidebarWin();
+ void UpdateDataOnActiveSidebarWin();
+ void DeleteActiveSidebarWin();
+ void HideActiveSidebarWin();
+ void ToggleInsModeOnActiveSidebarWin();
+
sal_Int32 GetMinimumSizeWithMeta() const;
sal_Int32 GetSidebarScrollerHeight() const;
- SwMarginWin* GetPostIt(const SfxBroadcaster* pBroadcaster) const;
- SwMarginWin* GetPostIt(SfxBroadcaster* pBroadcaster) const;
- SwPostIt* GetPostIt(const SwPostItField* pFld) const;
- SwPostIt* GetPostIt(SwPostItField* pFld) const;
-
void SetShadowState(const SwPostItField* pFld,bool bCursor = true);
void SetSpellChecking();
Color GetColorDark(sal_uInt16 aAuthorIndex);
Color GetColorLight(sal_uInt16 aAuthorIndex);
- Color GetColorAnkor(sal_uInt16 aAuthorIndex);
+ Color GetColorAnchor(sal_uInt16 aAuthorIndex);
bool ShowPreview(const SwField* pFld,SwFmtFld*& pFmtFld) const;
@@ -263,7 +285,18 @@ class SwPostItMgr: public SfxListener
sal_uInt16 SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
sal_uInt16 FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
- void AssureStdModeAtShell();
+ void AssureStdModeAtShell();
+
+ void ConnectSidebarWinToFrm( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+ void DisconnectSidebarWinFromFrm( const SwFrm& rFrm,
+ sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+ bool HasFrmConnectedSidebarWins( const SwFrm& rFrm );
+ Window* GetSidebarWinForFrmByIndex( const SwFrm& rFrm,
+ const sal_Int32 nIndex );
+ void GetAllSidebarWinForFrm( const SwFrm& rFrm,
+ std::vector< Window* >* pChildren );
};
#endif
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
new file mode 100644
index 000000000000..e8e918763b7b
--- /dev/null
+++ b/sw/inc/SidebarWin.hxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWIN_HXX
+#define _SIDEBARWIN_HXX
+
+#include <postithelper.hxx>
+#include <SidebarWindowsTypes.hxx>
+
+#include <vcl/window.hxx>
+#include <swrect.hxx>
+
+#include <tools/datetime.hxx>
+#include <tools/date.hxx>
+
+#include <vcl/lineinfo.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <editeng/editstat.hxx>
+
+class SwPostItMgr;
+class SwPostItField;
+class OutlinerView;
+class Outliner;
+class ScrollBar;
+class SwEditWin;
+class SwView;
+class Edit;
+class MenuButton;
+//class SwRedline;
+class SwFrm;
+
+
+namespace sw { namespace sidebarwindows {
+
+class SidebarTxtControl;
+class AnchorOverlayObject;
+class ShadowOverlayObject;
+
+typedef sal_Int64 SwPostItBits;
+
+#define PB_Preview ((SwPostItBits)0x00000001)
+
+
+class SwSidebarWin : public Window
+{
+ public:
+ SwSidebarWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem );
+ virtual ~SwSidebarWin();
+
+ void SetSize( const Size& rNewSize );
+ void SetPosSizePixelRect( long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ const SwRect &aRect,
+ const long PageBorder);
+ void SetPosAndSize();
+ void TranslateTopPosition(const long aAmount);
+ virtual void CheckMetaText();
+
+ inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
+ SwEditWin* EditWin();
+
+ inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
+ bool HasScrollbar() const;
+ bool IsScrollbarVisible() const;
+ inline ScrollBar* Scrollbar() { return mpVScrollbar; }
+ inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
+ inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
+
+ long GetPostItTextHeight();
+
+ void SwitchToPostIt(USHORT aDirection);
+ virtual void SwitchToFieldPos();
+
+ virtual sal_uInt32 MoveCaret() = 0;
+
+ virtual void UpdateData() = 0;
+ virtual void SetPostItText() = 0;
+ virtual void Delete();
+ virtual void GotoPos() = 0;
+
+ virtual String GetAuthor() = 0;
+ virtual Date GetDate() = 0;
+ virtual Time GetTime() = 0;
+
+ void ExecuteCommand(USHORT nSlot);
+ void InitControls();
+ void HidePostIt();
+ void DoResize();
+ void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
+ void SetScrollbar();
+
+ void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
+ const Point VirtualPos() { return mPosSize.TopLeft(); }
+ const Size VirtualSize() { return mPosSize.GetSize(); }
+
+ void ShowAnchorOnly(const Point &aPoint);
+ void ShowNote();
+ void HideNote();
+
+ void ResetAttributes();
+
+ void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
+ void SetReadonly(BOOL bSet);
+ BOOL IsReadOnly() { return mbReadonly;}
+ bool IsPreview() { return nFlags & PB_Preview;}
+
+ void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
+ const Color& ColorAnchor() { return mColorAnchor; }
+ const Color& ColorDark() { return mColorDark; }
+ const Color& ColorLight() { return mColorLight; }
+ void Rescale();
+
+ void SetViewState(::sw::sidebarwindows::ViewState bViewState);
+
+ bool IsFollow() { return mbIsFollow; }
+ void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
+ virtual bool CalcFollow() = 0;
+
+
+ sal_Int32 GetMetaHeight();
+ sal_Int32 GetMinimumSizeWithMeta();
+ sal_Int32 GetMinimumSizeWithoutMeta();
+ sal_Int32 GetMetaButtonAreaWidth();
+ sal_Int32 GetScrollbarWidth();
+
+ void SetSpellChecking();
+
+ void ToggleInsMode();
+
+ virtual void ActivatePostIt();
+ virtual void DeactivatePostIt();
+
+ void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
+ const Color& aColor);
+ SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
+ Color GetChangeColor() { return mChangeColor; }
+
+ virtual bool IsProtected() {return mbReadonly;};
+
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+ inline const bool IsMouseOverSidebarWin() const { return mbMouseOver; }
+
+ void SetLanguage(const SvxLanguageItem aNewItem);
+
+ void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ protected:
+ virtual void DataChanged( const DataChangedEvent& aEvent);
+ virtual void LoseFocus();
+ virtual void Paint( const Rectangle& rRect);
+ virtual void GetFocus();
+ virtual MenuButton* CreateMenuButton() = 0;
+
+ void SetSizePixel( const Size& rNewSize );
+ SfxItemSet DefaultItem();
+
+ DECL_LINK(ModifyHdl, void*);
+ DECL_LINK(ScrollHdl, ScrollBar*);
+ DECL_LINK(DeleteHdl, void*);
+
+ inline SwView& DocView() { return mrView;}
+ inline SwPostItMgr& Mgr() { return mrMgr; }
+ inline Outliner* Engine() { return mpOutliner;}
+
+ private:
+ SwSidebarWin* GetTopReplyNote();
+
+ virtual SvxLanguageItem GetLanguage(void);
+
+ SwPostItMgr& mrMgr;
+ SwView& mrView;
+ const SwPostItBits nFlags;
+
+ ULONG mnEventId;
+
+ OutlinerView* mpOutlinerView;
+ Outliner* mpOutliner;
+
+ sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
+ ScrollBar* mpVScrollbar;
+ Edit* mpMetadataAuthor;
+ Edit* mpMetadataDate;
+ MenuButton* mpMenuButton;
+
+ sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
+ sw::sidebarwindows::ShadowOverlayObject* mpShadow;
+
+ Color mColorAnchor;
+ Color mColorDark;
+ Color mColorLight;
+ Color mChangeColor;
+
+ sw::sidebarwindows::SidebarPosition meSidebarPosition;
+
+ Rectangle mPosSize;
+ SwRect mAnchorRect;
+ long mPageBorder;
+
+ bool mbMouseOver;
+ SwPostItHelper::SwLayoutStatus mLayoutStatus;
+
+ bool mbReadonly;
+ bool mbIsFollow;
+
+ SwSidebarItem& mrSidebarItem;
+ const SwFrm* mpAnchorFrm;
+};
+
+} } // eof namespace sw::sidebarwindows
+
+
+// implementation for change tracking comments, fully functional, but not yet used
+/*
+class SwRedComment : public SwSidebarWin
+{
+ private:
+ SwRedline* pRedline;
+
+ protected:
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ public:
+ SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed);
+ virtual ~SwRedComment() {};
+
+ virtual void UpdateData();
+ virtual void SetPostItText();
+ virtual void Delete();
+ virtual void GotoPos();
+ virtual void SetPopup();
+ virtual void ActivatePostIt();
+ virtual void DeactivatePostIt();
+
+ virtual String GetAuthor();
+ virtual Date GetDate();
+ virtual Time GetTime();
+
+ virtual bool IsProtected();
+};
+*/
+
+#endif
diff --git a/sw/inc/SidebarWindowsTypes.hxx b/sw/inc/SidebarWindowsTypes.hxx
new file mode 100644
index 000000000000..8b86f87edf87
--- /dev/null
+++ b/sw/inc/SidebarWindowsTypes.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWINDOWSTYPES_HXX
+#define _SIDEBARWINDOWSTYPES_HXX
+
+namespace sw { namespace sidebarwindows {
+
+enum ViewState
+{
+ VS_NORMAL,
+ VS_VIEW,
+ VS_EDIT
+};
+
+enum SidebarPosition
+{
+ SIDEBAR_LEFT, // sidebar on left side
+ SIDEBAR_RIGHT, // sidebar on right side
+ SIDEBAR_NONE // sidebar on neither side
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/inc/access.hrc b/sw/inc/access.hrc
index 7ce855267cd6..b6c6bb30086e 100644
--- a/sw/inc/access.hrc
+++ b/sw/inc/access.hrc
@@ -30,28 +30,29 @@
#include "rcid.hrc"
-// --> OD 2004-09-27 #117970# - remove STR_ACCESS_PARAGRAPH_NAME, STR_ACCESS_HEADING_NAME
-// STR_ACCESS_PARAGRAPH_DESC and STR_ACCESS_HEADING_DESC
-#define STR_ACCESS_DOC_NAME (RC_ACCESS_BEGIN + 1)
-#define STR_ACCESS_DOC_DESC (RC_ACCESS_BEGIN + 2)
-#define STR_ACCESS_HEADING_WITH_NUM_DESC (RC_ACCESS_BEGIN + 3)
-#define STR_ACCESS_HEADER_NAME (RC_ACCESS_BEGIN + 4)
-#define STR_ACCESS_HEADER_DESC (RC_ACCESS_BEGIN + 5)
-#define STR_ACCESS_FOOTER_NAME (RC_ACCESS_BEGIN + 6)
-#define STR_ACCESS_FOOTER_DESC (RC_ACCESS_BEGIN + 7)
+#define STR_ACCESS_DOC_NAME (RC_ACCESS_BEGIN + 1)
+#define STR_ACCESS_DOC_DESC (RC_ACCESS_BEGIN + 2)
+#define STR_ACCESS_HEADING_WITH_NUM_DESC (RC_ACCESS_BEGIN + 3)
+#define STR_ACCESS_HEADER_NAME (RC_ACCESS_BEGIN + 4)
+#define STR_ACCESS_HEADER_DESC (RC_ACCESS_BEGIN + 5)
+#define STR_ACCESS_FOOTER_NAME (RC_ACCESS_BEGIN + 6)
+#define STR_ACCESS_FOOTER_DESC (RC_ACCESS_BEGIN + 7)
#define STR_ACCESS_FOOTNOTE_NAME (RC_ACCESS_BEGIN + 8)
#define STR_ACCESS_FOOTNOTE_DESC (RC_ACCESS_BEGIN + 9)
-#define STR_ACCESS_ENDNOTE_NAME (RC_ACCESS_BEGIN + 10)
-#define STR_ACCESS_ENDNOTE_DESC (RC_ACCESS_BEGIN + 11)
-#define STR_ACCESS_REPLACEMENT_POSTIT (RC_ACCESS_BEGIN + 12)
-#define STR_ACCESS_REPLACEMENT_FRAME (RC_ACCESS_BEGIN + 13)
-#define STR_ACCESS_REPLACEMENT_BULLET_GRAPHICS (RC_ACCESS_BEGIN + 14)
+#define STR_ACCESS_ENDNOTE_NAME (RC_ACCESS_BEGIN + 10)
+#define STR_ACCESS_ENDNOTE_DESC (RC_ACCESS_BEGIN + 11)
+#define STR_ACCESS_REPLACEMENT_POSTIT (RC_ACCESS_BEGIN + 12)
+#define STR_ACCESS_REPLACEMENT_FRAME (RC_ACCESS_BEGIN + 13)
+#define STR_ACCESS_REPLACEMENT_BULLET_GRAPHICS (RC_ACCESS_BEGIN + 14)
#define STR_ACCESS_TABLE_DESC (RC_ACCESS_BEGIN + 15)
#define STR_ACCESS_PAGE_NAME (RC_ACCESS_BEGIN + 16)
#define STR_ACCESS_PAGE_DESC (RC_ACCESS_BEGIN + 17)
-// <--
+#define STR_ACCESS_ANNOTATION_AUTHOR_NAME (RC_ACCESS_BEGIN + 18)
+#define STR_ACCESS_ANNOTATION_DATE_NAME (RC_ACCESS_BEGIN + 19)
+#define STR_ACCESS_ANNOTATION_BUTTON_NAME (RC_ACCESS_BEGIN + 20)
+#define STR_ACCESS_ANNOTATION_BUTTON_DESC (RC_ACCESS_BEGIN + 21)
-#define ACCESS_ACT_END STR_ACCESS_PAGE_DESC
+#define ACCESS_ACT_END STR_ACCESS_ANNOTATION_BUTTON_DESC
#if ACCESS_ACT_END > RC_ACCESS_END
#error Resource-Id Ueberlauf in #file, #line
diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 5ee891e3e1f4..01c4593fe636 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -33,14 +33,15 @@
#include <vos/mutex.hxx>
#include <svx/IAccessibleViewForwarder.hxx>
#include <svx/IAccessibleParent.hxx>
-#include "viewsh.hxx"
#include <tools/debug.hxx>
#include <tools/fract.hxx>
#include <vector>
+class ViewShell;
class Rectangle;
class SwFrm;
+class SwTxtFrm;
class SwPageFrm;
class SwAccessibleContext;
class SwAccessibleContextMap_Impl;
@@ -48,85 +49,17 @@ class SwAccessibleEventList_Impl;
class SwAccessibleEventMap_Impl;
class SwShapeList_Impl;
class SdrObject;
-namespace accessibility { class AccessibleShape; }
+namespace accessibility {
+ class AccessibleShape;
+}
class SwAccessibleShapeMap_Impl;
struct SwAccessibleEvent_Impl;
-// --> OD 2005-12-13 #i27301#
class SwAccessibleSelectedParas_Impl;
-// <--
class SwRect;
class MapMode;
class SwAccPreviewData;
-// OD 14.01.2003 #103492#
-#ifndef _PREVWPAGE_HXX
-#include <prevwpage.hxx>
-#endif
-
-// helper class that stores preview data
-class SwAccPreviewData
-{
- typedef std::vector<Rectangle> Rectangles;
- Rectangles maPreviewRects;
- Rectangles maLogicRects;
-
- SwRect maVisArea;
- Fraction maScale;
-
- const SwPageFrm *mpSelPage;
-
- /** adjust logic page retangle to its visible part
-
- OD 17.01.2003 #103492#
-
- @author OD
-
- @param _iorLogicPgSwRect
- input/output parameter - reference to the logic page rectangle, which
- has to be adjusted.
-
- @param _rPrevwPgSwRect
- input parameter - constant reference to the corresponding preview page
- rectangle; needed to determine the visible part of the logic page rectangle.
-
- @param _rPrevwWinSize
- input paramter - constant reference to the preview window size in TWIP;
- needed to determine the visible part of the logic page rectangle
- */
- void AdjustLogicPgRectToVisibleArea( SwRect& _iorLogicPgSwRect,
- const SwRect& _rPrevwPgSwRect,
- const Size& _rPrevwWinSize );
-
-public:
- SwAccPreviewData();
- ~SwAccPreviewData();
-
- // OD 14.01.2003 #103492# - complete re-factoring of method due to new
- // page/print preview functionality.
- void Update( const std::vector<PrevwPage*>& _rPrevwPages,
- const Fraction& _rScale,
- const SwPageFrm* _pSelectedPageFrm,
- const Size& _rPrevwWinSize );
-
- // OD 14.01.2003 #103492# - complete re-factoring of method due to new
- // page/print preview functionality.
- void InvalidateSelection( const SwPageFrm* _pSelectedPageFrm );
-
- const SwRect& GetVisArea() const;
-
- MapMode GetMapModeForPreview( ) const;
-
- /** Adjust the MapMode so that the preview page appears at the
- * proper position. rPoint identifies the page for which the
- * MapMode should be adjusted. If bFromPreview is true, rPoint is
- * a preview coordinate; else it's a document coordinate. */
- // OD 17.01.2003 #103492# - delete unused 3rd parameter.
- void AdjustMapMode( MapMode& rMapMode,
- const Point& rPoint ) const;
-
- inline const SwPageFrm *GetSelPage() const { return mpSelPage; }
-
- void DisposePage(const SwPageFrm *pPageFrm );
-};
+struct PrevwPage;
+class Window;
// real states for events
#define ACC_STATE_EDITABLE 0x01
@@ -154,7 +87,7 @@ typedef sal_uInt16 tAccessibleStates;
class SwAccessibleMap : public accessibility::IAccessibleViewForwarder,
public accessibility::IAccessibleParent
{
- ::vos::OMutex maMutex;
+ mutable ::vos::OMutex maMutex;
::vos::OMutex maEventMutex;
SwAccessibleContextMap_Impl *mpFrmMap;
SwAccessibleShapeMap_Impl *mpShapeMap;
@@ -246,14 +179,7 @@ public:
return mpVSh;
}
- inline const SwRect& GetVisArea() const
- {
- DBG_ASSERT( !GetShell()->IsPreView() || (mpPreview != NULL),
- "preview without preview data?" );
- return GetShell()->IsPreView()
- ? mpPreview->GetVisArea()
- : GetShell()->VisArea();
- }
+ const SwRect& GetVisArea() const;
/** get size of a dedicated preview page
@@ -274,10 +200,14 @@ public:
void RemoveContext( const SdrObject *pObj );
// Dispose frame and its children if bRecursive is set
- void Dispose( const SwFrm *pFrm, const SdrObject *pObj,
- sal_Bool bRecursive=sal_False );
-
- void InvalidatePosOrSize( const SwFrm *pFrm, const SdrObject *pObj,
+ void Dispose( const SwFrm* pFrm,
+ const SdrObject* pObj,
+ Window* pWindow,
+ sal_Bool bRecursive = sal_False );
+
+ void InvalidatePosOrSize( const SwFrm* pFrm,
+ const SdrObject* pObj,
+ Window* pWindow,
const SwRect& rOldFrm );
void InvalidateContent( const SwFrm *pFrm );
@@ -333,6 +263,9 @@ public:
*/
void InvalidateTextSelectionOfAllParas();
+ sal_Int32 GetChildIndex( const SwFrm& rParentFrm,
+ Window& rChild ) const;
+
// update preview data (and fire events if necessary)
// OD 15.01.2003 #103492# - complete re-factoring of method due to new
// page/print preview functionality.
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 7da1c30e6577..b224d0c5ae24 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -476,7 +476,7 @@ public:
void EndTextEdit(); //Loescht ggf. das Objekt.
//Ankertyp des selektierten Objektes, -1 bei Uneindeutigkeit oder
- //Rahmenselektion; FLY_PAGE bzw. FLY_AT_CNTNT aus frmatr.hxx sonst.
+ //Rahmenselektion; FLY_AT_PAGE bzw. FLY_AT_PARA aus frmatr.hxx sonst.
short GetAnchorId() const;
//Erzeugen von DrawObjekten, beim Begin wird der Objekttyp mitgegeben.
diff --git a/sw/inc/postit.hxx b/sw/inc/postit.hxx
deleted file mode 100644
index 6a21f8781d6c..000000000000
--- a/sw/inc/postit.hxx
+++ /dev/null
@@ -1,413 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _POSTIT_HXX
-#define _POSTIT_HXX
-
-#include <postithelper.hxx>
-
-#include <vcl/window.hxx>
-#include <swrect.hxx>
-#include <svx/sdr/overlay/overlayobject.hxx>
-
-#include <tools/datetime.hxx>
-#include <tools/date.hxx>
-
-#include <vcl/lineinfo.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <editeng/editstat.hxx>
-
-class SwPostItMgr;
-class SwPostItField;
-class SwFmtFld;
-class OutlinerView;
-class Outliner;
-class ScrollBar;
-class SwEditWin;
-class SwView;
-class SwPostIt;
-class Edit;
-class MultiLineEdit;
-class PopupMenu;
-class SvxLanguageItem;
-class SwRedline;
-class OutlinerParaObject;
-
-#define ANKORLINE_WIDTH 1
-
-enum AnkorState {AS_ALL, AS_START, AS_END,AS_TRI};
-
-class SwPostItAnkor: public sdr::overlay::OverlayObjectWithBasePosition
-{
- protected:
- /* 6------------7
- 1 /
- /4\ ---------------5
- 2 - 3
- */
-
- basegfx::B2DPoint maSecondPosition;
- basegfx::B2DPoint maThirdPosition;
- basegfx::B2DPoint maFourthPosition;
- basegfx::B2DPoint maFifthPosition;
- basegfx::B2DPoint maSixthPosition;
- basegfx::B2DPoint maSeventhPosition;
-
- // helpers to fill and reset geometry
- void implEnsureGeometry();
- void implResetGeometry();
-
- // geometry creation for OverlayObject
- virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
-
- private:
- // object's geometry
- basegfx::B2DPolygon maTriangle;
- basegfx::B2DPolygon maLine;
- basegfx::B2DPolygon maLineTop;
- unsigned long mHeight;
- AnkorState mAnkorState;
-
- // bitfield
- unsigned mbShadowedEffect : 1;
- unsigned mbLineSolid : 1;
-
- public:
- SwPostItAnkor(const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos,
- const basegfx::B2DPoint& rFourthPos,
- const basegfx::B2DPoint& rFifthPos,
- const basegfx::B2DPoint& rSixthPos,
- const basegfx::B2DPoint& rSeventhPos,
- Color aBaseColor,
- bool bShadowedEffect,
- bool bLineSolid);
- virtual ~SwPostItAnkor();
-
- const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
- const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
- const basegfx::B2DPoint& GetFourthPosition() const { return maFourthPosition; }
- const basegfx::B2DPoint& GetFifthPosition() const { return maFifthPosition; }
- const basegfx::B2DPoint& GetSixthPosition() const { return maSixthPosition; }
- const basegfx::B2DPoint& GetSeventhPosition() const { return maSeventhPosition; }
-
- void SetAllPosition(const basegfx::B2DPoint& rPoint1, const basegfx::B2DPoint& rPoint2, const basegfx::B2DPoint& rPoint3,
- const basegfx::B2DPoint& rPoint4, const basegfx::B2DPoint& rPoint5, const basegfx::B2DPoint& rPoint6, const basegfx::B2DPoint& rPoint7);
- void SetTriPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2,const basegfx::B2DPoint& rPoint3,
- const basegfx::B2DPoint& rPoint4,const basegfx::B2DPoint& rPoint5);
- void SetSixthPosition(const basegfx::B2DPoint& rNew);
- void SetSeventhPosition(const basegfx::B2DPoint& rNew);
-
- bool getLineSolid() const { return mbLineSolid; }
- void setLineSolid(bool bNew);
-
- void SetHeight(const unsigned long aHeight) {mHeight = aHeight;};
-
- bool getShadowedEffect() const { return mbShadowedEffect; }
-
- void SetAnkorState(AnkorState aState);
- AnkorState GetAnkorState() const {return mAnkorState;}
-};
-
-enum ShadowState {SS_NORMAL, SS_VIEW, SS_EDIT};
-
-class SwPostItShadow: public sdr::overlay::OverlayObjectWithBasePosition
-{
- protected:
- // geometry creation for OverlayObject
- virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
-
- private:
- basegfx::B2DPoint maSecondPosition;
- ShadowState mShadowState;
-
- public:
- SwPostItShadow(const basegfx::B2DPoint& rBasePos, const basegfx::B2DPoint& rSecondPosition, Color aBaseColor,ShadowState aState);
- virtual ~SwPostItShadow();
-
- void SetShadowState(ShadowState aState);
- ShadowState GetShadowState() {return mShadowState;}
-
- const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
- void SetSecondPosition(const basegfx::B2DPoint& rNew);
- void SetPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2);
-};
-
-class PostItTxt : public Window
-{
- private:
- OutlinerView* mpOutlinerView;
- SwMarginWin* mpMarginWin;
-
- bool mMouseOver;
- BOOL mbShowPopup;
-
- protected:
- virtual void Paint( const Rectangle& rRect);
- virtual void KeyInput( const KeyEvent& rKeyEvt );
- virtual void MouseMove( const MouseEvent& rMEvt );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void MouseButtonUp( const MouseEvent& rMEvt );
- virtual void Command( const CommandEvent& rCEvt );
- virtual void DataChanged( const DataChangedEvent& aData);
- virtual void LoseFocus();
- virtual void RequestHelp(const HelpEvent &rEvt);
- virtual XubString GetSurroundingText() const;
- virtual Selection GetSurroundingTextSelection() const;
-
- DECL_LINK( Select, Menu* );
-
- public:
- PostItTxt(Window* pParent, WinBits nBits);
- ~PostItTxt();
-
- virtual void GetFocus();
- void SetTextView( OutlinerView* aEditView ) { mpOutlinerView = aEditView; }
-
- DECL_LINK( WindowEventListener, VclSimpleEvent* );
- DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
-};
-
-typedef sal_Int64 SwPostItBits;
-
-#define PB_Preview ((SwPostItBits)0x00000001)
-
-
-class SwMarginWin : public Window
-{
- private:
- ULONG mnEventId;
- SwView* mpView;
- sdr::overlay::OverlayManager* pOverlayManager;
- OutlinerView* mpOutlinerView;
- Outliner* mpOutliner;
- PostItTxt* mpPostItTxt;
- MultiLineEdit* mpMeta;
- ScrollBar* mpVScrollbar;
- SwPostItAnkor* mpAnkor;
- SwPostItShadow* mpShadow;
- SwPostItMgr* mpMgr;
- bool mbMeta;
- Color mColorAnkor;
- Color mColorDark;
- Color mColorLight;
- basegfx::B2DPolygon aPopupTriangle;
- bool mbMarginSide;
- Rectangle mPosSize;
- SwRect mAnkorRect;
- long mPageBorder;
- SwPostItBits nFlags;
- bool mbMouseOverButton;
-
- protected:
- bool mbReadonly;
- PopupMenu* mpButtonPopup;
- bool mbIsFollow;
- Rectangle mRectMetaButton;
- virtual void DataChanged( const DataChangedEvent& aEvent);
- virtual void LoseFocus();
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void MouseMove( const MouseEvent& rMEvt );
- virtual void Paint( const Rectangle& rRect);
- virtual void GetFocus();
-
- void SetSizePixel( const Size& rNewSize );
- SfxItemSet DefaultItem();
-
- DECL_LINK(ModifyHdl, void*);
- DECL_LINK(ScrollHdl, ScrollBar*);
- DECL_LINK(DeleteHdl, void*);
-
- public:
- TYPEINFO();
- SwMarginWin( Window* pParent, WinBits nBits, SwPostItMgr* aMgr,SwPostItBits aBits);
- virtual ~SwMarginWin();
-
- void SetSize( const Size& rNewSize );
- void SetPosSizePixelRect( long nX, long nY,long nWidth, long nHeight,const SwRect &aRect,const long PageBorder);
- void SetPosAndSize();
- void TranslateTopPosition(const long aAmount);
- virtual void CheckMetaText();
-
- PostItTxt* PostItText() { return mpPostItTxt;}
- ScrollBar* Scrollbar() { return mpVScrollbar;}
- SwPostItAnkor* Ankor() { return mpAnkor;}
- SwPostItShadow* Shadow() { return mpShadow;}
- OutlinerView* View() { return mpOutlinerView;}
- SwView* DocView() { return mpView;}
- Outliner* Engine() { return mpOutliner;}
- SwPostItMgr* Mgr() { return mpMgr; }
-
- SwRect GetAnkorRect() { return mAnkorRect; }
- SwEditWin* EditWin();
-
- long GetPostItTextHeight();
-
- void SwitchToPostIt(USHORT aDirection);
- //void SwitchToPostIt(bool aDirection);
- virtual void SwitchToFieldPos();
- virtual sal_uInt32 MoveCaret() { return 0;};
-
- virtual void UpdateData() = 0;
- virtual void SetPostItText() = 0;
- virtual void Delete();
- virtual void GotoPos() = 0;
- virtual void SetPopup() = 0;
-
- virtual String GetAuthor();
- virtual Date GetDate();
- virtual Time GetTime();
-
- void ExecuteCommand(USHORT nSlot);
- void InitControls();
- void HidePostIt();
- void DoResize();
- void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
- void SetScrollbar();
-
- void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
- const Point VirtualPos() { return mPosSize.TopLeft(); }
- const Size VirtualSize() { return mPosSize.GetSize(); }
-
- void ShowAnkorOnly(const Point &aPoint);
- void ShowNote();
- void HideNote();
-
- void ResetAttributes();
-
- void SetMarginSide(bool aMarginSide);
- void SetReadonly(BOOL bSet);
- BOOL IsReadOnly() { return mbReadonly;}
- bool IsPreview() { return nFlags & PB_Preview;}
-
- void SetLanguage(const SvxLanguageItem aNewItem);
- virtual SvxLanguageItem GetLanguage(void);
-
- void SetColor(Color aColorDark,Color aColorLight, Color aColorAnkor);
- Color ColorDark() { return mColorDark; }
- Color ColorLight() { return mColorLight; }
- void Rescale();
-
- void SetViewState(ShadowState bState);
-
- bool IsFollow() { return mbIsFollow; }
- void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow;};
- virtual bool CalcFollow();
-
- SwMarginWin* GetTopReplyNote();
- bool IsAnyStackParentVisible();
-
- sal_Int32 GetMetaHeight();
- sal_Int32 GetMinimumSizeWithMeta();
- sal_Int32 GetMinimumSizeWithoutMeta();
- sal_Int32 GetMetaButtonAreaWidth();
- sal_Int32 GetScrollbarWidth();
-
- void SetSpellChecking();
-
- void ToggleInsMode();
-
- virtual void ActivatePostIt();
- virtual void DeactivatePostIt();
-
- virtual SwPostItHelper::SwLayoutStatus GetStatus() { return SwPostItHelper::NONE; }
-
- virtual bool IsProtected() {return mbReadonly;};
-};
-
-// implementation for change tracking comments, fully functional, but not yet used
-/*
-class SwRedComment : public SwMarginWin
-{
- private:
- SwRedline* pRedline;
-
- protected:
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- public:
- TYPEINFO();
- SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed);
- virtual ~SwRedComment() {};
-
- virtual void UpdateData();
- virtual void SetPostItText();
- virtual void Delete();
- virtual void GotoPos();
- virtual void SetPopup();
- virtual void ActivatePostIt();
- virtual void DeactivatePostIt();
-
- virtual String GetAuthor();
- virtual Date GetDate();
- virtual Time GetTime();
-
- virtual bool IsProtected();
-};
-*/
-class SwPostIt : public SwMarginWin
-{
- private:
- SwFmtFld* mpFmtFld;
- SwPostItField* mpFld;
- SwPostItHelper::SwLayoutStatus mStatus;
- Color mChangeColor;
-
- protected:
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
-
- public:
- TYPEINFO();
- SwPostIt( Window* pParent, WinBits nBits,SwFmtFld* aField,SwPostItMgr* aMgr,SwPostItBits aBits);
- virtual ~SwPostIt() {};
-
- virtual void UpdateData();
- virtual void SetPostItText();
- virtual void Delete();
- virtual void GotoPos();
- virtual void SetPopup();
-
- virtual String GetAuthor();
- virtual Date GetDate();
- virtual Time GetTime();
-
- virtual sal_uInt32 MoveCaret();
-
- void SetChangeTracking(SwPostItHelper::SwLayoutStatus& aStatus,Color aColor);
- virtual SwPostItHelper::SwLayoutStatus GetStatus() { return mStatus; }
- Color GetChangeColor() { return mChangeColor; }
-
- sal_uInt32 CountFollowing();
- virtual bool CalcFollow();
- void InitAnswer(OutlinerParaObject* pText);
-
- virtual SvxLanguageItem GetLanguage(void);
-
- virtual bool IsProtected();
-};
-
-#endif
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index c6d68b8c2c63..560cdd143a56 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -32,14 +32,18 @@
#include <redline.hxx>
#include <vector>
#include <vcl/window.hxx>
+#include <SidebarWindowsTypes.hxx>
#include <svl/brdcst.hxx>
class SwTxtFld;
class SwRootFrm;
class SwPostIt;
class String;
-class SwMarginWin;
class SwPostItMgr;
+class SwEditWin;
+namespace sw { namespace sidebarwindows {
+ class SwSidebarWin;
+} }
struct SwPosition;
@@ -47,12 +51,23 @@ typedef sal_Int64 SwPostItBits;
struct SwLayoutInfo
{
+ const SwFrm* mpAnchorFrm;
SwRect mPosition;
SwRect mPageFrame;
SwRect mPagePrtArea;
unsigned long mnPageNumber;
- bool mbMarginSide;
+ sw::sidebarwindows::SidebarPosition meSidebarPosition;
USHORT mRedlineAuthor;
+
+ SwLayoutInfo()
+ : mpAnchorFrm(0)
+ , mPosition()
+ , mPageFrame()
+ , mPagePrtArea()
+ , mnPageNumber(1)
+ , meSidebarPosition(sw::sidebarwindows::SIDEBAR_NONE)
+ , mRedlineAuthor(0)
+ {}
};
namespace SwPostItHelper
@@ -69,71 +84,77 @@ namespace SwPostItHelper
unsigned long getPageInfo( SwRect& rPageFrm, const SwRootFrm* , const Point& );
}
-class SwMarginItem
+class SwSidebarItem
{
public:
- SwMarginWin* pPostIt;
+ sw::sidebarwindows::SwSidebarWin* pPostIt;
bool bShow;
bool bFocus;
- bool bMarginSide;
- SwRect mPos;
- SwRect mFramePos;
- SwRect mPagePos;
- unsigned long mnPageNumber;
+
SwPostItHelper::SwLayoutStatus mLayoutStatus;
- USHORT mRedlineAuthor;
- SwMarginItem(bool aShow, bool aFocus)
- : pPostIt(0),
- bShow(aShow),
- bFocus(aFocus),
- bMarginSide(false),
- mnPageNumber(1),
- mLayoutStatus( SwPostItHelper::INVISIBLE ),
- mRedlineAuthor(0)
+ SwLayoutInfo maLayoutInfo;
+
+ SwSidebarItem( const bool aShow,
+ const bool aFocus)
+ : pPostIt(0)
+ , bShow(aShow)
+ , bFocus(aFocus)
+ , mLayoutStatus( SwPostItHelper::INVISIBLE )
+ , maLayoutInfo()
{}
- virtual ~SwMarginItem(){}
- virtual SwPosition GetPosition() = 0;
+ virtual ~SwSidebarItem(){}
+ virtual SwPosition GetAnchorPosition() const = 0;
virtual bool UseElement() = 0;
- virtual SwFmtFld* GetFmtFld() = 0;
+ virtual SwFmtFld* GetFmtFld() const = 0;
virtual SfxBroadcaster* GetBroadCaster() const = 0;
- virtual SwMarginWin* GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits) = 0;
+ virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits) = 0;
};
/*
-class SwRedCommentItem: public SwMarginItem
+class SwRedCommentItem: public SwSidebarItem
{
private:
SwRedline* pRedline;
public:
SwRedCommentItem( SwRedline* pRed, bool aShow, bool aFocus)
- : SwMarginItem(aShow,aFocus),
+ : SwSidebarItem(aShow,aFocus),
pRedline(pRed) {}
virtual ~SwRedCommentItem() {}
- virtual SwPosition GetPosition();
+ virtual SwPosition GetAnchorPosition() const;
virtual bool UseElement();
- virtual SwFmtFld* GetFmtFld() {return 0; }
+ virtual SwFmtFld* GetFmtFld() const {return 0; }
virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pRedline); }
- virtual SwMarginWin* GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits);
+ virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits);
};
*/
-class SwPostItItem: public SwMarginItem
+class SwAnnotationItem: public SwSidebarItem
{
private:
SwFmtFld* pFmtFld;
public:
- SwPostItItem( SwFmtFld* p, bool aShow, bool aFocus)
- : SwMarginItem(aShow,aFocus) ,
- pFmtFld(p)
- {
- }
- virtual ~SwPostItItem() {}
- virtual SwPosition GetPosition();
+ SwAnnotationItem( SwFmtFld* p,
+ const bool aShow,
+ const bool aFocus)
+ : SwSidebarItem( aShow, aFocus )
+ , pFmtFld(p)
+ {}
+ virtual ~SwAnnotationItem() {}
+ virtual SwPosition GetAnchorPosition() const;
virtual bool UseElement();
- virtual SwFmtFld* GetFmtFld() {return pFmtFld;}
+ virtual SwFmtFld* GetFmtFld() const {return pFmtFld;}
virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pFmtFld); }
- virtual SwMarginWin* GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits);
+ virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits);
};
#endif // _POSTITHELPER_HXX
diff --git a/sw/inc/rcid.hrc b/sw/inc/rcid.hrc
index 86f47b0b9194..8a788933dc4e 100644
--- a/sw/inc/rcid.hrc
+++ b/sw/inc/rcid.hrc
@@ -78,6 +78,7 @@
#define RC_UNDO (RC_BASE + 3750)
#define RC_SMARTTAG (RC_BASE + 3950) // SMARTTAGS
#define RC_UNOCORE (RC_BASE + 4050)
+#define RC_ANNOTATION (RC_BASE + 4150)
/*--------------------------------------------------------------------
Beschreibung: Bereiche ausspannen
@@ -87,8 +88,6 @@
#define RC_APP_BEGIN RC_APP
#define RC_APP_END (RC_APP_BEGIN + 199)
-
-
// Dialog-Verzeichnis
#define RC_DIALOG_BEGIN RC_DIALOG
#define RC_DIALOG_END (RC_DIALOG_BEGIN + 99)
@@ -97,6 +96,10 @@
#define RC_DOCVW_BEGIN RC_DOCVW
#define RC_DOCVW_END (RC_DOCVW_BEGIN + 99)
+// Annotation
+#define RC_ANNOTATION_BEGIN RC_ANNOTATION
+#define RC_ANNOTATION_END (RC_ANNOTATION_BEGIN + 99)
+
// SW/Web
#define RC_WEB_BEGIN RC_WEB
#define RC_WEB_END (RC_WEB_BEGIN + 199)
diff --git a/sw/inc/sw_primitivetypes2d.hxx b/sw/inc/sw_primitivetypes2d.hxx
index 8102b69872a1..12e245791f4c 100644
--- a/sw/inc/sw_primitivetypes2d.hxx
+++ b/sw/inc/sw_primitivetypes2d.hxx
@@ -34,9 +34,9 @@
//////////////////////////////////////////////////////////////////////////////
-#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SW| 0)
-#define PRIMITIVE2D_ID_SWPOSTITANKORPRIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 1)
-#define PRIMITIVE2D_ID_SWPOSTITSHADOWPRIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 2)
+#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SW| 0)
+#define PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 1)
+#define PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 2)
//////////////////////////////////////////////////////////////////////////////
diff --git a/sw/inc/unotextmarkup.hxx b/sw/inc/unotextmarkup.hxx
index c0b6f3a7e048..98bb3416d385 100644
--- a/sw/inc/unotextmarkup.hxx
+++ b/sw/inc/unotextmarkup.hxx
@@ -42,7 +42,6 @@ namespace com { namespace sun { namespace star { namespace container {
} } } }
class SwTxtNode;
-class SwWrongList;
class SfxPoolItem;
/** Implementation of the css::text::XTextMarkup interface
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 700b50121675..78909e69e7ce 100755
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -77,19 +77,15 @@ struct ShellResource;
class SwRegionRects;
class SwFrm;
class SvtAccessibilityOptions;
-// OD 12.12.2002 #103492#
class SwPagePreviewLayout;
-// --> OD 2005-12-01 #i27138#
class SwTxtFrm;
-// <--
class BitmapEx;
struct SwAccessibilityOptions;
class Region;
class SwPostItMgr;
-
-// #i74769#
class SdrPaintWindow;
+class SwAccessibleMap;
namespace vcl
{
@@ -264,7 +260,7 @@ public:
sal_Bool SmoothScroll( long lXDiff, long lYDiff, const Rectangle* );//Browser
void EnableSmooth( sal_Bool b ) { bEnableSmooth = b; }
- const SwRect &VisArea() const { return aVisArea; }
+ const SwRect& VisArea() const { return aVisArea; }
//Es wird, wenn notwendig, soweit gescrollt, dass das
//uebergebene Rect im sichtbaren Ausschnitt liegt.
void MakeVisible( const SwRect & );
@@ -557,9 +553,11 @@ public:
*/
void InvalidateAccessibleParaTextSelection();
- /** invalidate attributes for paragraphs
+ /** invalidate attributes for paragraphs and paragraph's characters
OD 2009-01-06 #i88069#
+ OD 2010-02-16 #i104008# - usage also for changes of the attributes of
+ paragraph's characters.
@author OD
@@ -568,6 +566,8 @@ public:
*/
void InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm );
+ SwAccessibleMap* GetAccessibleMap();
+
ViewShell( ViewShell&, Window *pWin = 0, OutputDevice *pOut = 0,
long nFlags = 0 );
ViewShell( SwDoc& rDoc, Window *pWin,
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index b44530f40cca..f4cf864b7217 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -41,6 +41,7 @@
#include <swtable.hxx>
#include "crsrsh.hxx"
#include "viscrs.hxx"
+#include <accfrmobj.hxx>
#include <accfrmobjslist.hxx>
#include "frmfmt.hxx"
#include "cellatr.hxx"
@@ -56,6 +57,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
+using namespace sw::access;
const sal_Char sServiceName[] = "com.sun.star.table.AccessibleCellView";
const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleCellView";
@@ -83,8 +85,7 @@ sal_Bool SwAccessibleCell::IsSelected()
return bRet;
}
-void SwAccessibleCell::GetStates(
- ::utl::AccessibleStateSetHelper& rStateSet )
+void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet )
{
SwAccessibleContext::GetStates( rStateSet );
@@ -104,11 +105,10 @@ void SwAccessibleCell::GetStates(
}
}
-SwAccessibleCell::SwAccessibleCell(
- SwAccessibleMap *pInitMap,
- const SwCellFrm *pCellFrm ) :
- SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm ),
- bIsSelected( sal_False )
+SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap,
+ const SwCellFrm *pCellFrm )
+ : SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm )
+ , bIsSelected( sal_False )
{
vos::OGuard aGuard(Application::GetSolarMutex());
OUString sBoxName( pCellFrm->GetTabBox()->GetName() );
@@ -145,11 +145,11 @@ sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
{
sal_Bool bChanged = sal_False;
- const SwFrmOrObjSList aVisList( GetVisArea(), pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pFrm, *GetMap() );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
if( pLower )
{
@@ -184,7 +184,7 @@ sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
void SwAccessibleCell::_InvalidateCursorPos()
{
- const SwFrm *pParent = GetParent( GetFrm(), IsInPagePreview() );
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
ASSERT( pParent->IsTabFrm(), "parent is not a tab frame" );
const SwTabFrm *pTabFrm = static_cast< const SwTabFrm * >( pParent );
if( pTabFrm->IsFollow() )
@@ -253,21 +253,21 @@ uno::Sequence< OUString > SAL_CALL SwAccessibleCell::getSupportedServiceNames()
void SwAccessibleCell::Dispose( sal_Bool bRecursive )
{
- const SwFrm *pParent = GetParent( GetFrm(), IsInPagePreview() );
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
::vos::ORef< SwAccessibleContext > xAccImpl(
GetMap()->GetContextImpl( pParent, sal_False ) );
if( xAccImpl.isValid() )
- xAccImpl->DisposeChild( GetFrm(), bRecursive );
+ xAccImpl->DisposeChild( SwAccessibleChild(GetFrm()), bRecursive );
SwAccessibleContext::Dispose( bRecursive );
}
void SwAccessibleCell::InvalidatePosOrSize( const SwRect& rOldBox )
{
- const SwFrm *pParent = GetParent( GetFrm(), IsInPagePreview() );
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
::vos::ORef< SwAccessibleContext > xAccImpl(
GetMap()->GetContextImpl( pParent, sal_False ) );
if( xAccImpl.isValid() )
- xAccImpl->InvalidateChildPosOrSize( GetFrm(), rOldBox );
+ xAccImpl->InvalidateChildPosOrSize( SwAccessibleChild(GetFrm()), rOldBox );
SwAccessibleContext::InvalidatePosOrSize( rOldBox );
}
diff --git a/sw/source/core/access/acccell.hxx b/sw/source/core/access/acccell.hxx
index 4ac0e461c640..db3d7d5fd5cb 100644
--- a/sw/source/core/access/acccell.hxx
+++ b/sw/source/core/access/acccell.hxx
@@ -26,12 +26,12 @@
************************************************************************/
#ifndef _ACCCELL_HXX
#define _ACCCELL_HXX
-#ifndef _ACCCONTEXT_HXX
+
#include "acccontext.hxx"
-#endif
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
class SwCellFrm;
+class SwFrmFmt;
class SwAccessibleCell : public SwAccessibleContext,
::com::sun::star::accessibility::XAccessibleValue
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 54cf0d61f9e9..1b5e66071b84 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -38,8 +38,8 @@
#endif // #if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
#include <tools/debug.hxx>
#include <vcl/window.hxx>
-#include "errhdl.hxx"
-#include "swtypes.hxx"
+#include <errhdl.hxx>
+#include <swtypes.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
@@ -51,18 +51,22 @@
#include <unotools/accessiblerelationsethelper.hxx>
#include <viewsh.hxx>
#include <crsrsh.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <txtfrm.hxx>
#include <ndtxt.hxx>
+#include <pagefrm.hxx>
+#include <flyfrm.hxx>
+#include <dflyobj.hxx>
#include <pam.hxx>
#include <viewimp.hxx>
#include <accmap.hxx>
#include <accfrmobjslist.hxx>
-#ifndef _ACCCONTEXT_HXX
#include <acccontext.hxx>
-#endif
#include <svx/AccessibleShape.hxx>
#include <comphelper/accessibleeventnotifier.hxx>
+#include <PostItMgr.hxx>
+
+using namespace sw::access;
#if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
#define DBG_MSG( _msg ) \
@@ -91,10 +95,10 @@ using ::rtl::OUString;
void SwAccessibleContext::InitStates()
{
- bIsShowingState = IsShowing();
+ bIsShowingState = GetMap() ? IsShowing( *(GetMap()) ) : sal_False;
ViewShell *pVSh = GetMap()->GetShell();
- bIsEditableState = pVSh && IsEditable( pVSh );
+ bIsEditableState = pVSh && IsEditable( pVSh );
bIsOpaqueState = pVSh && IsOpaque( pVSh );
bIsDefuncState = sal_False;
}
@@ -165,21 +169,17 @@ enum Action { NONE, SCROLLED, SCROLLED_WITHIN,
SCROLLED_IN, SCROLLED_OUT };
void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
- const SwRect& rOldVisArea )
+ const SwRect& rOldVisArea )
{
const SwRect& rNewVisArea = GetVisArea();
- SwFrmOrObj aFrm( pFrm );
- sal_Bool bVisibleOnly = aFrm.IsVisibleChildrenOnly();
-
- uno::Reference < XAccessible > xAcc;
+ const bool bVisibleChildrenOnly = SwAccessibleChild( pFrm ).IsVisibleChildrenOnly();
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
+ const SwAccessibleChildSList aList( *pFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
while( aIter != aList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
- const SwFrm *pLower = rLower.GetSwFrm();
- SwRect aBox( rLower.GetBox() );
+ const SwAccessibleChild& rLower = *aIter;
+ const SwRect aBox( rLower.GetBox( *(GetMap()) ) );
if( rLower.IsAccessible( GetShell()->IsPreView() ) )
{
Action eAction = NONE;
@@ -191,20 +191,31 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
}
else
{
- if( bVisibleOnly )
+ if ( bVisibleChildrenOnly &&
+ !rLower.AlwaysIncludeAsChild() )
+ {
eAction = SCROLLED_IN;
+ }
else
+ {
eAction = SCROLLED;
+ }
}
}
else if( aBox.IsOver( rOldVisArea ) )
{
- if( bVisibleOnly )
+ if ( bVisibleChildrenOnly &&
+ !rLower.AlwaysIncludeAsChild() )
+ {
eAction = SCROLLED_OUT;
+ }
else
+ {
eAction = SCROLLED;
+ }
}
- else if( !bVisibleOnly )
+ else if( !bVisibleChildrenOnly ||
+ rLower.AlwaysIncludeAsChild() )
{
// This wouldn't be required if the SwAccessibleFrame,
// wouldn't know about the vis area.
@@ -212,8 +223,11 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
}
if( NONE != eAction )
{
- if( pLower )
+ if ( rLower.GetSwFrm() )
{
+ ASSERT( !rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
+ const SwFrm* pLower( rLower.GetSwFrm() );
::vos::ORef< SwAccessibleContext > xAccImpl =
GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction ||
SCROLLED_IN == eAction );
@@ -242,10 +256,12 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
ChildrenScrolled( pLower, rOldVisArea );
}
}
- else
+ else if ( rLower.GetDrawObject() )
{
+ ASSERT( !rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
- GetMap()->GetContextImpl( rLower.GetSdrObject(),
+ GetMap()->GetContextImpl( rLower.GetDrawObject(),
this,
SCROLLED_OUT == eAction ||
SCROLLED_IN == eAction );
@@ -260,7 +276,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
GetMap() );
break;
case SCROLLED_IN:
- ScrolledInShape( rLower.GetSdrObject(),
+ ScrolledInShape( rLower.GetDrawObject(),
xAccImpl.getBodyPtr() );
break;
case SCROLLED_OUT:
@@ -268,7 +284,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
xAccImpl->ViewForwarderChanged(
::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
GetMap() );
- DisposeShape( rLower.GetSdrObject(),
+ DisposeShape( rLower.GetDrawObject(),
xAccImpl.getBodyPtr() );
}
break;
@@ -277,14 +293,21 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
}
}
}
+ else if ( rLower.GetWindow() )
+ {
+ // nothing to do - as such children are always included as children.
+ ASSERT( rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - not always included child not considered!" );
+ }
}
}
- else if( pLower && (!bVisibleOnly ||
- aBox.IsOver( rOldVisArea ) ||
- aBox.IsOver( rNewVisArea )) )
+ else if ( rLower.GetSwFrm() &&
+ ( !bVisibleChildrenOnly ||
+ aBox.IsOver( rOldVisArea ) ||
+ aBox.IsOver( rNewVisArea ) ) )
{
// There are no unaccessible SdrObjects that need to be notified
- ChildrenScrolled( pLower, rOldVisArea );
+ ChildrenScrolled( rLower.GetSwFrm(), rOldVisArea );
}
++aIter;
}
@@ -297,7 +320,7 @@ void SwAccessibleContext::Scrolled( const SwRect& rOldVisArea )
ChildrenScrolled( GetFrm(), rOldVisArea );
sal_Bool bIsOldShowingState;
- sal_Bool bIsNewShowingState = IsShowing();
+ sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) );
{
vos::OGuard aGuard( aMutex );
bIsOldShowingState = bIsShowingState;
@@ -327,7 +350,7 @@ void SwAccessibleContext::ScrolledIn()
"Vis area of child is wrong. Did it exist already?" );
// Send child event at parent. That's all we have to do here.
- const SwFrm *pParent = GetParent();
+ const SwFrm* pParent = GetParent();
::vos::ORef< SwAccessibleContext > xParentImpl(
GetMap()->GetContextImpl( pParent, sal_False ) );
uno::Reference < XAccessibleContext > xThis( this );
@@ -379,13 +402,13 @@ void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
tAccessibleStates _nStates )
{
- const SwFrmOrObjSList aVisList( GetVisArea(), _pFrm );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *_pFrm, *(GetMap()) );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
- const SwFrm *pLower = rLower.GetSwFrm();
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm* pLower = rLower.GetSwFrm();
if( pLower )
{
::vos::ORef< SwAccessibleContext > xAccImpl;
@@ -396,10 +419,15 @@ void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
else
InvalidateChildrenStates( pLower, _nStates );
}
- else
+ else if ( rLower.GetDrawObject() )
{
// TODO: SdrObjects
}
+ else if ( rLower.GetWindow() )
+ {
+ // nothing to do ?
+ }
+
++aIter;
}
}
@@ -408,12 +436,12 @@ void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
void SwAccessibleContext::DisposeChildren( const SwFrm *pFrm,
sal_Bool bRecursive )
{
- const SwFrmOrObjSList aVisList( GetVisArea(), pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
- const SwFrm *pLower = rLower.GetSwFrm();
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm* pLower = rLower.GetSwFrm();
if( pLower )
{
::vos::ORef< SwAccessibleContext > xAccImpl;
@@ -424,13 +452,17 @@ void SwAccessibleContext::DisposeChildren( const SwFrm *pFrm,
else if( bRecursive )
DisposeChildren( pLower, bRecursive );
}
- else
+ else if ( rLower.GetDrawObject() )
{
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl(
- GetMap()->GetContextImpl( rLower.GetSdrObject(),
+ GetMap()->GetContextImpl( rLower.GetDrawObject(),
this, sal_False ) );
if( xAccImpl.isValid() )
- DisposeShape( rLower.GetSdrObject(), xAccImpl.getBodyPtr() );
+ DisposeShape( rLower.GetDrawObject(), xAccImpl.getBodyPtr() );
+ }
+ else if ( rLower.GetWindow() )
+ {
+ DisposeChild( rLower, sal_False );
}
++aIter;
}
@@ -528,16 +560,14 @@ sal_Bool SwAccessibleContext::IsEditableState()
SwAccessibleContext::SwAccessibleContext( SwAccessibleMap *pM,
sal_Int16 nR,
- const SwFrm *pF ) :
- SwAccessibleFrame( pM->GetVisArea().SVRect(), pF,
- pM->GetShell()->IsPreView() ),
- pMap( pM ),
- nClientId(0),
- nRole( nR ),
- bDisposing( sal_False ),
- // --> OD 2008-03-10 #i85634#
- bRegisteredAtAccessibleMap( true )
- // <--
+ const SwFrm *pF )
+ : SwAccessibleFrame( pM->GetVisArea().SVRect(), pF,
+ pM->GetShell()->IsPreView() )
+ , pMap( pM )
+ , nClientId(0)
+ , nRole( nR )
+ , bDisposing( sal_False )
+ , bRegisteredAtAccessibleMap( true )
{
InitStates();
DBG_MSG_CD( "constructed" )
@@ -548,11 +578,7 @@ SwAccessibleContext::~SwAccessibleContext()
vos::OGuard aGuard(Application::GetSolarMutex());
DBG_MSG_CD( "destructed" )
- // --> OD 2008-03-10 #i85634#
-// if( GetFrm() && GetMap() )
-// GetMap()->RemoveContext( GetFrm() );
RemoveFrmFromAccessibleMap();
- // <--
}
uno::Reference< XAccessibleContext > SAL_CALL
@@ -570,7 +596,7 @@ sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleChildCount( void )
CHECK_FOR_DEFUNC( XAccessibleContext )
- return bDisposing ? 0 : GetChildCount();
+ return bDisposing ? 0 : GetChildCount( *(GetMap()) );
}
uno::Reference< XAccessible> SAL_CALL
@@ -581,7 +607,7 @@ uno::Reference< XAccessible> SAL_CALL
CHECK_FOR_DEFUNC( XAccessibleContext )
- const SwFrmOrObj aChild( GetChild( nIndex ) );
+ const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) );
if( !aChild.IsValid() )
{
uno::Reference < XAccessibleContext > xThis( this );
@@ -602,14 +628,18 @@ uno::Reference< XAccessible> SAL_CALL
xChild = xChildImpl.getBodyPtr();
}
}
- else
+ else if ( aChild.GetDrawObject() )
{
::vos::ORef < ::accessibility::AccessibleShape > xChildImpl(
- GetMap()->GetContextImpl( aChild.GetSdrObject(),
+ GetMap()->GetContextImpl( aChild.GetDrawObject(),
this, !bDisposing ) );
if( xChildImpl.isValid() )
xChild = xChildImpl.getBodyPtr();
}
+ else if ( aChild.GetWindow() )
+ {
+ xChild = aChild.GetWindow()->GetAccessible();
+ }
return xChild;
}
@@ -656,7 +686,7 @@ sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleIndexInParent (void)
GetMap()->GetContextImpl( pUpper, !bDisposing ) );
ASSERT( xAccImpl.isValid() || bDisposing, "no parent found" );
if( xAccImpl.isValid() )
- nIndex = xAccImpl->GetChildIndex( GetFrm() );
+ nIndex = xAccImpl->GetChildIndex( *(GetMap()), SwAccessibleChild(GetFrm()) );
}
return nIndex;
@@ -792,20 +822,24 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint
Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
if( !GetFrm()->IsRootFrm() )
{
- SwRect aLogBounds( GetBounds( GetFrm() ) ); // twip rel to doc root
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
aPixPoint.X() += aPixPos.X();
aPixPoint.Y() += aPixPos.Y();
}
- const SwFrmOrObj aChild( GetChildAtPixel( aPixPoint, GetMap() ) );
+ const SwAccessibleChild aChild( GetChildAtPixel( aPixPoint, *(GetMap()) ) );
if( aChild.GetSwFrm() )
{
xAcc = GetMap()->GetContext( aChild.GetSwFrm() );
}
- else if( aChild.GetSdrObject() )
+ else if( aChild.GetDrawObject() )
{
- xAcc = GetMap()->GetContext( aChild.GetSdrObject(), this );
+ xAcc = GetMap()->GetContext( aChild.GetDrawObject(), this );
+ }
+ else if ( aChild.GetWindow() )
+ {
+ xAcc = aChild.GetWindow()->GetAccessible();
}
return xAcc;
@@ -843,7 +877,7 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(sal_Bool bRelative)
CHECK_FOR_WINDOW( XAccessibleComponent, pWin && pParent )
- SwRect aLogBounds( GetBounds( GetFrm() ) ); // twip rel to doc root
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
Rectangle aPixBounds( 0, 0, 0, 0 );
if( GetFrm()->IsPageFrm() &&
static_cast < const SwPageFrm * >( GetFrm() )->IsEmptyPage() )
@@ -862,7 +896,7 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(sal_Bool bRelative)
aPixBounds = GetMap()->CoreToPixel( aLogBounds.SVRect() );
if( !pParent->IsRootFrm() && bRelative)
{
- SwRect aParentLogBounds( GetBounds( pParent ) ); // twip rel to doc root
+ SwRect aParentLogBounds( GetBounds( *(GetMap()), pParent ) ); // twip rel to doc root
Point aParentPixPos( GetMap()->CoreToPixel( aParentLogBounds.SVRect() ).TopLeft() );
aPixBounds.Move( -aParentPixPos.X(), -aParentPixPos.Y() );
}
@@ -1087,24 +1121,21 @@ void SwAccessibleContext::Dispose( sal_Bool bRecursive )
DBG_MSG_CD( "dispose" )
}
- // --> OD 2008-03-10 #i85634#
-// if( GetFrm() && GetMap() )
-// GetMap()->RemoveContext( GetFrm() );
RemoveFrmFromAccessibleMap();
- // <--
ClearFrm();
pMap = 0;
bDisposing = sal_False;
}
-void SwAccessibleContext::DisposeChild( const SwFrmOrObj& rChildFrmOrObj,
+void SwAccessibleContext::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
sal_Bool bRecursive )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwFrmOrObj aFrmOrObj( GetFrm() );
- if( IsShowing( rChildFrmOrObj ) || !aFrmOrObj.IsVisibleChildrenOnly() )
+ if ( IsShowing( *(GetMap()), rChildFrmOrObj ) ||
+ rChildFrmOrObj.AlwaysIncludeAsChild() ||
+ !SwAccessibleChild( GetFrm() ).IsVisibleChildrenOnly() )
{
// If the object could have existed before, than there is nothing to do,
// because no wrapper exists now and therefor no one is interested to
@@ -1116,14 +1147,23 @@ void SwAccessibleContext::DisposeChild( const SwFrmOrObj& rChildFrmOrObj,
sal_True );
xAccImpl->Dispose( bRecursive );
}
- else
+ else if ( rChildFrmOrObj.GetDrawObject() )
{
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
- GetMap()->GetContextImpl( rChildFrmOrObj.GetSdrObject(),
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
this, sal_True );
- DisposeShape( rChildFrmOrObj.GetSdrObject(),
+ DisposeShape( rChildFrmOrObj.GetDrawObject(),
xAccImpl.getBodyPtr() );
}
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ uno::Reference< XAccessible > xAcc =
+ rChildFrmOrObj.GetWindow()->GetAccessible();
+ aEvent.OldValue <<= xAcc;
+ FireAccessibleEvent( aEvent );
+ }
}
else if( bRecursive && rChildFrmOrObj.GetSwFrm() )
DisposeChildren( rChildFrmOrObj.GetSwFrm(), bRecursive );
@@ -1136,7 +1176,7 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
ASSERT( GetFrm() && !GetFrm()->Frm().IsEmpty(), "context should have a size" );
sal_Bool bIsOldShowingState;
- sal_Bool bIsNewShowingState = IsShowing();
+ sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) );
{
vos::OGuard aShowingStateGuard( aMutex );
bIsOldShowingState = bIsShowingState;
@@ -1154,8 +1194,8 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
FireVisibleDataEvent();
}
- SwFrmOrObj aParent( GetParent() );
- if( !bIsNewShowingState && aParent.IsVisibleChildrenOnly() )
+ if( !bIsNewShowingState &&
+ SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
{
// The frame is now invisible -> dispose it
Dispose( sal_True );
@@ -1167,7 +1207,7 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
}
void SwAccessibleContext::InvalidateChildPosOrSize(
- const SwFrmOrObj& rChildFrmOrObj,
+ const SwAccessibleChild& rChildFrmOrObj,
const SwRect& rOldFrm )
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1176,15 +1216,21 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
!rChildFrmOrObj.GetSwFrm()->Frm().IsEmpty(),
"child context should have a size" );
- SwFrmOrObj aFrm( GetFrm() );
- sal_Bool bNew = rOldFrm.IsEmpty() ||
- (rOldFrm.Left() == 0 && rOldFrm.Top() == 0);
- if( IsShowing( rChildFrmOrObj ) )
+ if ( rChildFrmOrObj.AlwaysIncludeAsChild() )
+ {
+ // nothing to do;
+ return;
+ }
+
+ const bool bVisibleChildrenOnly = SwAccessibleChild( GetFrm() ).IsVisibleChildrenOnly();
+ const bool bNew = rOldFrm.IsEmpty() ||
+ ( rOldFrm.Left() == 0 && rOldFrm.Top() == 0 );
+ if( IsShowing( *(GetMap()), rChildFrmOrObj ) )
{
// If the object could have existed before, than there is nothing to do,
// because no wrapper exists now and therefor no one is interested to
// get notified of the movement.
- if( bNew || (aFrm.IsVisibleChildrenOnly() && !IsShowing( rOldFrm )) )
+ if( bNew || (bVisibleChildrenOnly && !IsShowing( rOldFrm )) )
{
if( rChildFrmOrObj.GetSwFrm() )
{
@@ -1194,15 +1240,15 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
sal_True );
xAccImpl->ScrolledIn();
}
- else
+ else if ( rChildFrmOrObj.GetDrawObject() )
{
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
- GetMap()->GetContextImpl( rChildFrmOrObj.GetSdrObject(),
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
this, sal_True );
// --> OD 2004-11-29 #i37790#
if ( xAccImpl.isValid() )
{
- ScrolledInShape( rChildFrmOrObj.GetSdrObject(),
+ ScrolledInShape( rChildFrmOrObj.GetDrawObject(),
xAccImpl.getBodyPtr() );
}
else
@@ -1212,6 +1258,13 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
}
// <--
}
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= (rChildFrmOrObj.GetWindow()->GetAccessible());
+ FireAccessibleEvent( aEvent );
+ }
}
}
else
@@ -1220,7 +1273,7 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
// needs to be send. However, there is no wrapper existing, and so
// no notifications for grandchildren are required. If the are
// grandgrandchildren, they would be notified by the layout.
- if( aFrm.IsVisibleChildrenOnly() &&
+ if( bVisibleChildrenOnly &&
!bNew && IsShowing( rOldFrm ) )
{
if( rChildFrmOrObj.GetSwFrm() )
@@ -1231,14 +1284,19 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
xAccImpl->SetParent( this );
xAccImpl->Dispose( sal_True );
}
- else
+ else if ( rChildFrmOrObj.GetDrawObject() )
{
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
- GetMap()->GetContextImpl( rChildFrmOrObj.GetSdrObject(),
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
this, sal_True );
- DisposeShape( rChildFrmOrObj.GetSdrObject(),
+ DisposeShape( rChildFrmOrObj.GetDrawObject(),
xAccImpl.getBodyPtr() );
}
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ ASSERT( false,
+ "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - not expected to handle dispose of child of type <Window>." );
+ }
}
}
}
@@ -1422,13 +1480,67 @@ OUString SwAccessibleContext::GetResource( sal_uInt16 nResId,
return OUString( sStr );
}
-// --> OD 2008-03-10 #i85634#
void SwAccessibleContext::RemoveFrmFromAccessibleMap()
{
if( bRegisteredAtAccessibleMap && GetFrm() && GetMap() )
GetMap()->RemoveContext( GetFrm() );
}
-// <--
+
+bool SwAccessibleContext::HasAdditionalAccessibleChildren()
+{
+ bool bRet( false );
+
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ bRet = pPostItMgr->HasFrmConnectedSidebarWins( *(GetFrm()) );
+ }
+ }
+
+ return bRet;
+}
+/** get additional accessible child by index
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+*/
+Window* SwAccessibleContext::GetAdditionalAccessibleChild( const sal_Int32 nIndex )
+{
+ Window* pAdditionalAccessibleChild( 0 );
+
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ pAdditionalAccessibleChild =
+ pPostItMgr->GetSidebarWinForFrmByIndex( *(GetFrm()), nIndex );
+ }
+ }
+
+ return pAdditionalAccessibleChild;
+}
+
+/** get all additional accessible children
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+*/
+void SwAccessibleContext::GetAdditionalAccessibleChildren( std::vector< Window* >* pChildren )
+{
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ pPostItMgr->GetAllSidebarWinForFrm( *(GetFrm()), pChildren );
+ }
+ }
+}
#if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
void lcl_SwAccessibleContext_DbgMsg( SwAccessibleContext *pThisAcc,
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
index 5461995bc400..8bad4ab9074b 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -40,8 +40,14 @@ class SwAccessibleMap;
class SwCrsrShell;
class SdrObject;
class SwPaM;
-namespace utl { class AccessibleStateSetHelper; }
-namespace accessibility { class AccessibleShape; }
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+namespace accessibility {
+ class AccessibleShape;
+}
+class SwFmtFld;
+class SwAccessibleChildContainer;
const sal_Char sAccessibleServiceName[] = "com.sun.star.accessibility.Accessible";
@@ -339,13 +345,13 @@ public:
virtual void Dispose( sal_Bool bRecursive = sal_False );
// The child object is not visible an longer and should be destroyed
- virtual void DisposeChild( const SwFrmOrObj& rFrmOrObj, sal_Bool bRecursive );
+ virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj, sal_Bool bRecursive );
// The object has been moved by the layout
virtual void InvalidatePosOrSize( const SwRect& rFrm );
// The vhild object has been moved by the layout
- virtual void InvalidateChildPosOrSize( const SwFrmOrObj& rFrmOrObj,
+ virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
const SwRect& rFrm );
// The content may have changed (but it hasn't tohave changed)
@@ -381,6 +387,25 @@ public:
*/
void InvalidateAttr();
+ bool HasAdditionalAccessibleChildren();
+
+ /** get additional child by index
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+ */
+ Window* GetAdditionalAccessibleChild( const sal_Int32 nIndex );
+
+ /** get all additional accessible children
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+ */
+ void GetAdditionalAccessibleChildren( std::vector< Window* >* pChildren );
+
+
const ::rtl::OUString& GetName() const { return sName; }
virtual sal_Bool HasCursor(); // required by map to remember that object
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index 614366226df2..e0d3945e0a51 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -155,8 +155,10 @@ uno::Reference< XAccessible> SAL_CALL
if( mpChildWin )
{
CHECK_FOR_DEFUNC( XAccessibleContext )
- if( nIndex == GetChildCount() )
+ if ( nIndex == GetChildCount( *(GetMap()) ) )
+ {
return mpChildWin->GetAccessible();
+ }
}
return SwAccessibleContext::getAccessibleChild( nIndex );
diff --git a/sw/source/core/access/accfootnote.hxx b/sw/source/core/access/accfootnote.hxx
index 614e85f9f6b6..1c7330bc694d 100644
--- a/sw/source/core/access/accfootnote.hxx
+++ b/sw/source/core/access/accfootnote.hxx
@@ -26,9 +26,13 @@
************************************************************************/
#ifndef _ACCFOOTNOTE_HXX
#define _ACCFOOTNOTE_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <sal/types.h>
+
+#include <acccontext.hxx>
+
+class SwAccessibleMap;
+class SwFtnFrm;
class SwAccessibleFootnote : public SwAccessibleContext
{
diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx
index 533cf358a618..043e40bb943b 100644
--- a/sw/source/core/access/accframe.cxx
+++ b/sw/source/core/access/accframe.cxx
@@ -52,22 +52,24 @@
#include <accfrmobjmap.hxx>
#include <accframe.hxx>
+using namespace sw::access;
// Regarding visibilily (or in terms of accessibility: regarding the showing
// state): A frame is visible and therfor contained in the tree if its frame
// size overlaps with the visible area. The bounding box however is the
// frame's paint area.
-sal_Int32 SwAccessibleFrame::GetChildCount( const SwRect& rVisArea,
- const SwFrm *pFrm,
- sal_Bool bInPagePreview )
+/* static */ sal_Int32 SwAccessibleFrame::GetChildCount( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm *pFrm,
+ sal_Bool bInPagePreview )
{
sal_Int32 nCount = 0;
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( bInPagePreview ) )
{
nCount++;
@@ -75,7 +77,8 @@ sal_Int32 SwAccessibleFrame::GetChildCount( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- nCount += GetChildCount( rVisArea, rLower.GetSwFrm(),
+ nCount += GetChildCount( rAccMap,
+ rVisArea, rLower.GetSwFrm(),
bInPagePreview );
}
++aIter;
@@ -84,23 +87,25 @@ sal_Int32 SwAccessibleFrame::GetChildCount( const SwRect& rVisArea,
return nCount;
}
-SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
- const SwFrm *pFrm,
- sal_Int32& rPos,
- sal_Bool bInPagePreview )
+/* static */ SwAccessibleChild SwAccessibleFrame::GetChild(
+ SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview )
{
- SwFrmOrObj aRet;
+ SwAccessibleChild aRet;
if( rPos >= 0 )
{
- if( SwFrmOrObjMap::IsSortingRequired( pFrm ) )
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
{
// We need a sorted list here
- const SwFrmOrObjMap aVisMap( rVisArea, pFrm );
- SwFrmOrObjMap::const_iterator aIter( aVisMap.begin() );
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
while( aIter != aVisMap.end() && !aRet.IsValid() )
{
- const SwFrmOrObj& rLower = (*aIter).second;
+ const SwAccessibleChild& rLower = (*aIter).second;
if( rLower.IsAccessible( bInPagePreview ) )
{
if( 0 == rPos )
@@ -111,7 +116,8 @@ SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- aRet = GetChild( rVisArea, rLower.GetSwFrm(), rPos,
+ aRet = GetChild( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rPos,
bInPagePreview );
}
++aIter;
@@ -121,11 +127,11 @@ SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
{
// The unsorted list is sorted enough, because it return lower
// frames in the correct order.
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() && !aRet.IsValid() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( bInPagePreview ) )
{
if( 0 == rPos )
@@ -136,7 +142,8 @@ SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- aRet = GetChild( rVisArea, rLower.GetSwFrm(), rPos,
+ aRet = GetChild( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rPos,
bInPagePreview );
}
++aIter;
@@ -147,22 +154,24 @@ SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
return aRet;
}
-sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
- const SwFrm *pFrm,
- const SwFrmOrObj& rChild,
- sal_Int32& rPos,
- sal_Bool bInPagePreview )
+/* static */ sal_Bool SwAccessibleFrame::GetChildIndex(
+ SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const SwAccessibleChild& rChild,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview )
{
sal_Bool bFound = sal_False;
- if( SwFrmOrObjMap::IsSortingRequired( pFrm ) )
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
{
// We need a sorted list here
- const SwFrmOrObjMap aVisMap( rVisArea, pFrm );
- SwFrmOrObjMap::const_iterator aIter( aVisMap.begin() );
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
while( aIter != aVisMap.end() && !bFound )
{
- const SwFrmOrObj& rLower = (*aIter).second;
+ const SwAccessibleChild& rLower = (*aIter).second;
if( rLower.IsAccessible( bInPagePreview ) )
{
if( rChild == rLower )
@@ -173,7 +182,8 @@ sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- bFound = GetChildIndex( rVisArea, rLower.GetSwFrm(), rChild,
+ bFound = GetChildIndex( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rChild,
rPos, bInPagePreview );
}
++aIter;
@@ -183,11 +193,11 @@ sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
{
// The unsorted list is sorted enough, because it return lower
// frames in the correct order.
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() && !bFound )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( bInPagePreview ) )
{
if( rChild == rLower )
@@ -198,7 +208,8 @@ sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- bFound = GetChildIndex( rVisArea, rLower.GetSwFrm(), rChild,
+ bFound = GetChildIndex( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rChild,
rPos, bInPagePreview );
}
++aIter;
@@ -208,31 +219,31 @@ sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
return bFound;
}
-SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
- const SwFrm *pFrm,
+SwAccessibleChild SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
+ const SwFrm& rFrm,
const Point& rPixPos,
sal_Bool bInPagePreview,
- const SwAccessibleMap *pMap )
+ SwAccessibleMap& rAccMap )
{
- SwFrmOrObj aRet;
+ SwAccessibleChild aRet;
- if( SwFrmOrObjMap::IsSortingRequired( pFrm ) )
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
{
// We need a sorted list here, and we have to reverse iterate,
// because objects in front should be returned.
- const SwFrmOrObjMap aVisMap( rVisArea, pFrm );
- SwFrmOrObjMap::const_reverse_iterator aRIter( aVisMap.rbegin() );
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_reverse_iterator aRIter( aVisMap.rbegin() );
while( aRIter != aVisMap.rend() && !aRet.IsValid() )
{
- const SwFrmOrObj& rLower = (*aRIter).second;
+ const SwAccessibleChild& rLower = (*aRIter).second;
// A frame is returned if it's frame size is inside the visarea
// and the positiion is inside the frame's paint area.
if( rLower.IsAccessible( bInPagePreview ) )
{
- SwRect aLogBounds( rLower.GetBounds( ) );
+ SwRect aLogBounds( rLower.GetBounds( rAccMap ) );
if( !aLogBounds.IsEmpty() )
{
- Rectangle aPixBounds( pMap->CoreToPixel( aLogBounds.SVRect() ) );
+ Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds.SVRect() ) );
if( aPixBounds.IsInside( rPixPos ) )
aRet = rLower;
}
@@ -240,8 +251,8 @@ SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- aRet = GetChildAtPixel( rVisArea, rLower.GetSwFrm(), rPixPos,
- bInPagePreview, pMap );
+ aRet = GetChildAtPixel( rVisArea, *(rLower.GetSwFrm()), rPixPos,
+ bInPagePreview, rAccMap );
}
aRIter++;
}
@@ -251,19 +262,19 @@ SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
// The unsorted list is sorted enough, because it returns lower
// frames in the correct order. Morover, we can iterate forward,
// because the lowers don't overlap!
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() && !aRet.IsValid() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
// A frame is returned if it's frame size is inside the visarea
// and the positiion is inside the frame's paint area.
if( rLower.IsAccessible( bInPagePreview ) )
{
- SwRect aLogBounds( rLower.GetBounds( ) );
+ SwRect aLogBounds( rLower.GetBounds( rAccMap ) );
if( !aLogBounds.IsEmpty() )
{
- Rectangle aPixBounds( pMap->CoreToPixel( aLogBounds.SVRect() ) );
+ Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds.SVRect() ) );
if( aPixBounds.IsInside( rPixPos ) )
aRet = rLower;
}
@@ -271,8 +282,8 @@ SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- aRet = GetChildAtPixel( rVisArea, rLower.GetSwFrm(), rPixPos,
- bInPagePreview, pMap );
+ aRet = GetChildAtPixel( rVisArea, *(rLower.GetSwFrm()), rPixPos,
+ bInPagePreview, rAccMap );
}
++aIter;
}
@@ -281,18 +292,20 @@ SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
return aRet;
}
-void SwAccessibleFrame::GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
- ::std::list< SwFrmOrObj >& rChildren,
- sal_Bool bInPagePreview )
+/* static */ void SwAccessibleFrame::GetChildren( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ ::std::list< SwAccessibleChild >& rChildren,
+ sal_Bool bInPagePreview )
{
- if( SwFrmOrObjMap::IsSortingRequired( pFrm ) )
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
{
// We need a sorted list here
- const SwFrmOrObjMap aVisMap( rVisArea, pFrm );
- SwFrmOrObjMap::const_iterator aIter( aVisMap.begin() );
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
while( aIter != aVisMap.end() )
{
- const SwFrmOrObj& rLower = (*aIter).second;
+ const SwAccessibleChild& rLower = (*aIter).second;
if( rLower.IsAccessible( bInPagePreview ) )
{
rChildren.push_back( rLower );
@@ -300,8 +313,8 @@ void SwAccessibleFrame::GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- GetChildren( rVisArea, rLower.GetSwFrm(), rChildren,
- bInPagePreview );
+ GetChildren( rAccMap, rVisArea, *(rLower.GetSwFrm()),
+ rChildren, bInPagePreview );
}
++aIter;
}
@@ -310,11 +323,11 @@ void SwAccessibleFrame::GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
{
// The unsorted list is sorted enough, because it return lower
// frames in the correct order.
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( bInPagePreview ) )
{
rChildren.push_back( rLower );
@@ -322,21 +335,22 @@ void SwAccessibleFrame::GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- GetChildren( rVisArea, rLower.GetSwFrm(), rChildren,
- bInPagePreview );
+ GetChildren( rAccMap, rVisArea, *(rLower.GetSwFrm()),
+ rChildren, bInPagePreview );
}
++aIter;
}
}
}
-SwRect SwAccessibleFrame::GetBounds( const SwFrm *pFrm )
+SwRect SwAccessibleFrame::GetBounds( const SwAccessibleMap& rAccMap,
+ const SwFrm *pFrm )
{
if( !pFrm )
pFrm = GetFrm();
- SwFrmOrObj aFrm( pFrm );
- SwRect aBounds( aFrm.GetBounds().Intersection( maVisArea ) );
+ SwAccessibleChild aFrm( pFrm );
+ SwRect aBounds( aFrm.GetBounds( rAccMap ).Intersection( maVisArea ) );
return aBounds;
}
@@ -359,7 +373,7 @@ sal_Bool SwAccessibleFrame::IsEditable( ViewShell *pVSh ) const
sal_Bool SwAccessibleFrame::IsOpaque( ViewShell *pVSh ) const
{
- SwFrmOrObj aFrm( GetFrm() );
+ SwAccessibleChild aFrm( GetFrm() );
if( !aFrm.GetSwFrm() )
return sal_False;
@@ -423,71 +437,10 @@ SwAccessibleFrame::~SwAccessibleFrame()
{
}
-const SwFrm *SwAccessibleFrame::GetParent( const SwFrmOrObj& rFrmOrObj,
- sal_Bool bInPagePreview )
+/* static */ const SwFrm* SwAccessibleFrame::GetParent( const SwAccessibleChild& rFrmOrObj,
+ sal_Bool bInPagePreview )
{
- SwFrmOrObj aParent;
- const SwFrm *pFrm = rFrmOrObj.GetSwFrm();
- if( pFrm )
- {
- if( pFrm->IsFlyFrm() )
- {
- const SwFlyFrm *pFly = static_cast< const SwFlyFrm *>( pFrm );
- if( pFly->IsFlyInCntFrm() )
- {
- // For FLY_AS_CHAR the parent is the anchor
- aParent = pFly->GetAnchorFrm();
- ASSERT( aParent.IsAccessible( bInPagePreview ),
- "parent is not accessible" );
- }
- else
- {
- // In any other case the parent is the root frm
- // (in page preview, the page frame)
- if( bInPagePreview )
- aParent = pFly->FindPageFrm();
- else
- aParent = pFly->FindRootFrm();
- }
- }
- else
- {
- SwFrmOrObj aUpper( pFrm->GetUpper() );
- while( aUpper.GetSwFrm() && !aUpper.IsAccessible(bInPagePreview) )
- aUpper = aUpper.GetSwFrm()->GetUpper();
- aParent = aUpper;
- }
- }
- else if( rFrmOrObj.GetSdrObject() )
- {
- const SwDrawContact *pContact =
- static_cast< const SwDrawContact* >(
- GetUserCall( rFrmOrObj.GetSdrObject() ) );
- ASSERT( pContact, "sdr contact is missing" );
- if( pContact )
- {
- const SwFrmFmt *pFrmFmt = pContact->GetFmt();
- ASSERT( pFrmFmt, "frame format is missing" );
- if (pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId())
- {
- // For FLY_AS_CHAR the parent is the anchor
- aParent = pContact->GetAnchorFrm();
- ASSERT( aParent.IsAccessible( bInPagePreview ),
- "parent is not accessible" );
-
- }
- else
- {
- // In any other case the parent is the root frm
- if( bInPagePreview )
- aParent = pContact->GetAnchorFrm()->FindPageFrm();
- else
- aParent = pContact->GetAnchorFrm()->FindRootFrm();
- }
- }
- }
-
- return aParent.GetSwFrm();
+ return rFrmOrObj.GetParent( bInPagePreview );
}
String SwAccessibleFrame::GetFormattedPageNumber() const
@@ -501,3 +454,44 @@ String SwAccessibleFrame::GetFormattedPageNumber() const
String sRet( FormatNumber( nPageNum, nFmt ) );
return sRet;
}
+
+sal_Int32 SwAccessibleFrame::GetChildCount( SwAccessibleMap& rAccMap ) const
+{
+ return GetChildCount( rAccMap, maVisArea, mpFrm, IsInPagePreview() );
+}
+
+sw::access::SwAccessibleChild SwAccessibleFrame::GetChild(
+ SwAccessibleMap& rAccMap,
+ sal_Int32 nPos ) const
+{
+ return SwAccessibleFrame::GetChild( rAccMap, maVisArea, *mpFrm, nPos, IsInPagePreview() );
+}
+
+sal_Int32 SwAccessibleFrame::GetChildIndex( SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rChild ) const
+{
+ sal_Int32 nPos = 0;
+ return GetChildIndex( rAccMap, maVisArea, *mpFrm, rChild, nPos, IsInPagePreview() )
+ ? nPos
+ : -1L;
+}
+
+sw::access::SwAccessibleChild SwAccessibleFrame::GetChildAtPixel(
+ const Point& rPos,
+ SwAccessibleMap& rAccMap ) const
+{
+ return GetChildAtPixel( maVisArea, *mpFrm, rPos, IsInPagePreview(), rAccMap );
+}
+
+void SwAccessibleFrame::GetChildren( SwAccessibleMap& rAccMap,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren ) const
+{
+ GetChildren( rAccMap, maVisArea, *mpFrm, rChildren, IsInPagePreview() );
+}
+
+sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rFrmOrObj ) const
+{
+ return IsShowing( rFrmOrObj.GetBox( rAccMap ) );
+}
+
diff --git a/sw/source/core/access/accframe.hxx b/sw/source/core/access/accframe.hxx
index d1b256958fdb..48da1bdbb9cb 100644
--- a/sw/source/core/access/accframe.hxx
+++ b/sw/source/core/access/accframe.hxx
@@ -27,14 +27,22 @@
#ifndef _ACCFRAME_HXX
#define _ACCFRAME_HXX
+#include <swrect.hxx>
+
#include <sal/types.h>
+#include <tools/string.hxx>
#include <list>
#include <accfrmobj.hxx>
-// Any method of this class must be called with an acquired solar mutex!
-
class SwAccessibleMap;
+class SwFrm;
+class ViewShell;
+namespace sw { namespace access {
+ class SwAccessibleChild;
+}}
+
+// Any method of this class must be called with an acquired solar mutex!
class SwAccessibleFrame
{
@@ -45,26 +53,34 @@ class SwAccessibleFrame
protected:
// --> OD 2007-06-29 #i77106#
// method needs to be called by new class <SwAccessibleTableColHeaders>
- static sal_Int32 GetChildCount( const SwRect& rVisArea,
+ static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
const SwFrm *pFrm,
sal_Bool bInPagePreview );
private:
- static SwFrmOrObj GetChild( const SwRect& rVisArea,
- const SwFrm *pFrm,
- sal_Int32& rPos,
- sal_Bool bInPagePreview);
- static sal_Bool GetChildIndex( const SwRect& rVisArea,
- const SwFrm *pFrm,
- const SwFrmOrObj& rChild,
- sal_Int32& rPos,
- sal_Bool bInPagePreview );
- static SwFrmOrObj GetChildAtPixel( const SwRect& rVisArea,
- const SwFrm *pFrm,
- const Point& rPos,
- sal_Bool bInPagePreview,
- const SwAccessibleMap *pMap );
- static void GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
- ::std::list< SwFrmOrObj >& rChildren,
+ static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview);
+
+ static sal_Bool GetChildIndex( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const sw::access::SwAccessibleChild& rChild,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview );
+
+ static sw::access::SwAccessibleChild GetChildAtPixel( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const Point& rPos,
+ sal_Bool bInPagePreview,
+ SwAccessibleMap& rAccMap );
+
+ static void GetChildren( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren,
sal_Bool bInPagePreview );
protected:
@@ -73,9 +89,10 @@ protected:
sal_Bool IsOpaque( ViewShell *pVSh ) const;
+ sal_Bool IsShowing( const SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rFrmOrObj ) const;
inline sal_Bool IsShowing( const SwRect& rFrm ) const;
- inline sal_Bool IsShowing( const SwFrmOrObj& rFrmOrObj ) const;
- inline sal_Bool IsShowing() const;
+ inline sal_Bool IsShowing( const SwAccessibleMap& rAccMap ) const;
inline sal_Bool IsInPagePreview() const
{
@@ -94,17 +111,20 @@ protected:
public:
// Return the SwFrm this context is attached to.
- const SwFrm *GetFrm() const { return mpFrm; };
-
+ const SwFrm* GetFrm() const { return mpFrm; };
- static const SwFrm *GetParent( const SwFrmOrObj& rFrmOrObj,
+ static const SwFrm* GetParent( const sw::access::SwAccessibleChild& rFrmOrObj,
sal_Bool bInPagePreview );
+ sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rChild ) const;
+
protected:
// Return the bounding box of the frame clipped to the vis area. If
// no frame is specified, use this' frame.
- SwRect GetBounds( const SwFrm *pFrm=0 );
+ SwRect GetBounds( const SwAccessibleMap& rAccMap,
+ const SwFrm *pFrm = 0 );
// Return the upper that has a context attached. This might be
// another one than the immediate upper.
@@ -112,12 +132,13 @@ protected:
// Return the lower count or the nth lower, there the lowers have a
// not be same one as the SwFrm's lowers
- inline sal_Int32 GetChildCount() const;
- inline SwFrmOrObj GetChild( sal_Int32 nPos ) const;
- inline sal_Int32 GetChildIndex( const SwFrmOrObj& rChild ) const;
- inline SwFrmOrObj GetChildAtPixel( const Point& rPos,
- const SwAccessibleMap *pMap ) const;
- inline void GetChildren( ::std::list< SwFrmOrObj >& rChildren ) const;
+ sal_Int32 GetChildCount( SwAccessibleMap& rAccMap ) const;
+ sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
+ sal_Int32 nPos ) const;
+ sw::access::SwAccessibleChild GetChildAtPixel( const Point& rPos,
+ SwAccessibleMap& rAccMap ) const;
+ void GetChildren( SwAccessibleMap& rAccMap,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren ) const;
inline void SetVisArea( const SwRect& rNewVisArea )
{
@@ -138,48 +159,17 @@ inline sal_Bool SwAccessibleFrame::IsShowing( const SwRect& rFrm ) const
return rFrm.IsOver( maVisArea );
}
-inline sal_Bool SwAccessibleFrame::IsShowing( const SwFrmOrObj& rFrmOrObj ) const
-{
- return IsShowing( rFrmOrObj.GetBox() );
-}
-
-inline sal_Bool SwAccessibleFrame::IsShowing() const
+inline sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const
{
- SwFrmOrObj aFrmOrObj( GetFrm() );
- return IsShowing( aFrmOrObj );
+ sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
+ return IsShowing( rAccMap, aFrmOrObj );
}
inline const SwFrm *SwAccessibleFrame::GetParent() const
{
- SwFrmOrObj aFrmOrObj( GetFrm() );
+ sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
return GetParent( aFrmOrObj, IsInPagePreview() );
}
-inline sal_Int32 SwAccessibleFrame::GetChildCount() const
-{
- return GetChildCount( maVisArea, mpFrm, IsInPagePreview() );
-}
-
-inline SwFrmOrObj SwAccessibleFrame::GetChild( sal_Int32 nPos ) const
-{
- return GetChild( maVisArea, mpFrm, nPos, IsInPagePreview() );
-}
-
-inline sal_Int32 SwAccessibleFrame::GetChildIndex( const SwFrmOrObj& rChild ) const
-{
- sal_Int32 nPos = 0;
- return GetChildIndex( maVisArea, mpFrm, rChild, nPos, IsInPagePreview() ) ? nPos : -1L;
-}
-
-inline SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const Point& rPos,
- const SwAccessibleMap *pMap ) const
-{
- return GetChildAtPixel( maVisArea, mpFrm, rPos, IsInPagePreview(), pMap );
-}
-
-inline void SwAccessibleFrame::GetChildren( ::std::list< SwFrmOrObj >& rChildren ) const
-{
- GetChildren( maVisArea, mpFrm, rChildren, IsInPagePreview() );
-}
#endif
diff --git a/sw/source/core/access/accframebase.hxx b/sw/source/core/access/accframebase.hxx
index d1623591ad05..faa4bb492697 100644
--- a/sw/source/core/access/accframebase.hxx
+++ b/sw/source/core/access/accframebase.hxx
@@ -26,13 +26,15 @@
************************************************************************/
#ifndef _ACCFRAMEBASE_HXX
#define _ACCFRAMEBASE_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <acccontext.hxx>
+
+#include <calbck.hxx>
class SwFlyFrm;
-class SwAccessibleFrameBase : public SwAccessibleContext, public SwClient
+class SwAccessibleFrameBase : public SwAccessibleContext,
+ public SwClient
{
sal_Bool bIsSelected; // protected by base class mutex
diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx
index 131610c66f56..47b4007c1496 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -28,38 +28,401 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <accfrmobj.hxx>
+
+#include <accmap.hxx>
+#include <acccontext.hxx>
+#include <viewsh.hxx>
+#include <rootfrm.hxx>
+#include <flyfrm.hxx>
+#include <pagefrm.hxx>
+#include <cellfrm.hxx>
+#include <swtable.hxx>
+#include <dflyobj.hxx>
#include <frmfmt.hxx>
#include <fmtanchr.hxx>
-#include <accfrmobj.hxx>
#include <dcontact.hxx>
-#include <cellfrm.hxx>
-sal_Bool SwFrmOrObj::IsAccessible( sal_Bool bPagePreview ) const
+#include <vcl/window.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace access {
+
+SwAccessibleChild::SwAccessibleChild()
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{}
+
+SwAccessibleChild::SwAccessibleChild( const SdrObject* pDrawObj )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pDrawObj );
+}
+
+SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pFrm );
+}
+
+SwAccessibleChild::SwAccessibleChild( Window* pWindow )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pWindow );
+}
+
+
+SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm,
+ const SdrObject* pDrawObj,
+ Window* pWindow )
+{
+ if ( pFrm )
+ {
+ Init( pFrm );
+ }
+ else if ( pDrawObj )
+ {
+ Init( pDrawObj );
+ }
+ else if ( pWindow )
+ {
+ Init( pWindow );
+ }
+ ASSERT( (!pFrm || pFrm == mpFrm) &&
+ (!pDrawObj || pDrawObj == mpDrawObj) &&
+ (!pWindow || pWindow == mpWindow),
+ "invalid frame/object/window combination" );
+
+}
+
+void SwAccessibleChild::Init( const SdrObject* pDrawObj )
+{
+ mpDrawObj = pDrawObj;
+ mpFrm = mpDrawObj && mpDrawObj->ISA(SwVirtFlyDrawObj)
+ ? static_cast < const SwVirtFlyDrawObj * >( mpDrawObj )->GetFlyFrm()
+ : 0;
+ mpWindow = 0;
+}
+
+void SwAccessibleChild::Init( const SwFrm* pFrm )
+{
+ mpFrm = pFrm;
+ mpDrawObj = mpFrm && mpFrm->IsFlyFrm()
+ ? static_cast < const SwFlyFrm * >( mpFrm )->GetVirtDrawObj()
+ : 0;
+ mpWindow = 0;
+}
+
+void SwAccessibleChild::Init( Window* pWindow )
+{
+ mpWindow = pWindow;
+ mpFrm = 0;
+ mpDrawObj = 0;
+}
+
+bool SwAccessibleChild::IsAccessible( sal_Bool bPagePreview ) const
+{
+ bool bRet( false );
+
+ if ( mpFrm )
+ {
+ bRet = mpFrm->IsAccessibleFrm() &&
+ ( !mpFrm->IsCellFrm() ||
+ static_cast<const SwCellFrm *>( mpFrm )->GetTabBox()->GetSttNd() != 0 ) &&
+ !mpFrm->IsInCoveredCell() &&
+ ( bPagePreview ||
+ !mpFrm->IsPageFrm() );
+ }
+ else if ( mpDrawObj )
+ {
+ bRet = true;
+ }
+ else if ( mpWindow )
+ {
+ bRet = true;
+ }
+
+ return bRet;
+}
+
+bool SwAccessibleChild::IsBoundAsChar() const
+{
+ bool bRet( false );
+
+ if ( mpFrm )
+ {
+ bRet = mpFrm->IsFlyFrm() &&
+ static_cast< const SwFlyFrm *>(mpFrm)->IsFlyInCntFrm();
+ }
+ else if ( mpDrawObj )
+ {
+ const SwFrmFmt* mpFrmFmt = ::FindFrmFmt( mpDrawObj );
+ bRet = mpFrmFmt
+ ? (FLY_AS_CHAR == mpFrmFmt->GetAnchor().GetAnchorId())
+ : false;
+ }
+ else if ( mpWindow )
+ {
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+SwAccessibleChild::SwAccessibleChild( const SwAccessibleChild& r )
+ : mpFrm( r.mpFrm )
+ , mpDrawObj( r.mpDrawObj )
+ , mpWindow( r.mpWindow )
+{}
+
+SwAccessibleChild& SwAccessibleChild::operator=( const SwAccessibleChild& r )
+{
+ mpDrawObj = r.mpDrawObj;
+ mpFrm = r.mpFrm;
+ mpWindow = r.mpWindow;
+
+ return *this;
+}
+
+SwAccessibleChild& SwAccessibleChild::operator=( const SdrObject* pDrawObj )
{
- return ( pFrm && pFrm->IsAccessibleFrm() &&
- ( !pFrm->IsCellFrm() ||
- static_cast<const SwCellFrm *>( pFrm )->GetTabBox()->GetSttNd() != 0 ) &&
- !pFrm->IsInCoveredCell() &&
- ( bPagePreview || !pFrm->IsPageFrm() ) ) ||
- pObj;
+ Init( pDrawObj );
+ return *this;
}
-sal_Bool SwFrmOrObj::IsBoundAsChar() const
+SwAccessibleChild& SwAccessibleChild::operator=( const SwFrm* pFrm )
{
- // currently only SwFrms are accessible
- if( pFrm )
+ Init( pFrm );
+ return *this;
+}
+
+SwAccessibleChild& SwAccessibleChild::operator=( Window* pWindow )
+{
+ Init( pWindow );
+ return *this;
+}
+
+bool SwAccessibleChild::operator==( const SwAccessibleChild& r ) const
+{
+ return mpFrm == r.mpFrm &&
+ mpDrawObj == r.mpDrawObj &&
+ mpWindow == r.mpWindow;
+}
+
+bool SwAccessibleChild::IsValid() const
+{
+ return mpFrm != 0 ||
+ mpDrawObj != 0 ||
+ mpWindow != 0;
+}
+
+const SdrObject* SwAccessibleChild::GetDrawObject() const
+{
+ return mpDrawObj;
+}
+
+const SwFrm *SwAccessibleChild::GetSwFrm() const
+{
+ return mpFrm;
+}
+
+Window* SwAccessibleChild::GetWindow() const
+{
+ return mpWindow;
+}
+
+bool SwAccessibleChild::IsVisibleChildrenOnly() const
+{
+ bool bRet( false );
+
+ if ( !mpFrm )
{
- return pFrm->IsFlyFrm() &&
- static_cast< const SwFlyFrm *>(pFrm)->IsFlyInCntFrm();
+ bRet = true;
}
else
{
- const SwFrmFmt *pFrmFmt = pObj ? ::FindFrmFmt( pObj ) : 0;
- return (pFrmFmt)
- ? static_cast<sal_Bool>(FLY_AS_CHAR ==
- pFrmFmt->GetAnchor().GetAnchorId())
- : sal_False;
+ bRet = mpFrm->IsRootFrm() ||
+ !( mpFrm->IsTabFrm() ||
+ mpFrm->IsInTab() ||
+ ( IsBoundAsChar() &&
+ static_cast<const SwFlyFrm*>(mpFrm)->GetAnchorFrm()->IsInTab() ) );
+ }
+
+ return bRet;
+}
+
+SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& rAccMap ) const
+{
+ SwRect aBox;
+
+ if ( mpFrm )
+ {
+ if ( mpFrm->IsPageFrm() &&
+ static_cast< const SwPageFrm * >( mpFrm )->IsEmptyPage() )
+ {
+ aBox = SwRect( mpFrm->Frm().Left(), mpFrm->Frm().Top()-1, 1, 1 );
+ }
+ else if ( mpFrm->IsTabFrm() )
+ {
+ aBox = SwRect( mpFrm->Frm() );
+ aBox.Intersection( mpFrm->GetUpper()->Frm() );
+ }
+ else
+ {
+ aBox = mpFrm->Frm();
+ }
}
+ else if( mpDrawObj )
+ {
+ aBox = SwRect( mpDrawObj->GetCurrentBoundRect() );
+ }
+ else if ( mpWindow )
+ {
+ aBox = SwRect( rAccMap.GetShell()->GetWin()->PixelToLogic(
+ Rectangle( mpWindow->GetPosPixel(),
+ mpWindow->GetSizePixel() ) ) );
}
+ return aBox;
+}
+
+SwRect SwAccessibleChild::GetBounds( const SwAccessibleMap& rAccMap ) const
+{
+ SwRect aBound;
+
+ if( mpFrm )
+ {
+ if( mpFrm->IsPageFrm() &&
+ static_cast< const SwPageFrm * >( mpFrm )->IsEmptyPage() )
+ {
+ aBound = SwRect( mpFrm->Frm().Left(), mpFrm->Frm().Top()-1, 0, 0 );
+ }
+ else
+ aBound = mpFrm->PaintArea();
+ }
+ else if( mpDrawObj )
+ {
+ aBound = GetBox( rAccMap );
+ }
+ else if ( mpWindow )
+ {
+ aBound = GetBox( rAccMap );
+ }
+
+ return aBound;
+}
+
+bool SwAccessibleChild::AlwaysIncludeAsChild() const
+{
+ bool bAlwaysIncludedAsChild( false );
+
+ if ( mpWindow )
+ {
+ bAlwaysIncludedAsChild = true;
+ }
+
+ return bAlwaysIncludedAsChild;
+}
+
+const SwFrm* SwAccessibleChild::GetParent( const sal_Bool bInPagePreview ) const
+{
+ const SwFrm* pParent( 0 );
+
+ if ( mpFrm )
+ {
+ if( mpFrm->IsFlyFrm() )
+ {
+ const SwFlyFrm* pFly = static_cast< const SwFlyFrm *>( mpFrm );
+ if( pFly->IsFlyInCntFrm() )
+ {
+ // For FLY_AS_CHAR the parent is the anchor
+ pParent = pFly->GetAnchorFrm();
+ ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ),
+ "parent is not accessible" );
+ }
+ else
+ {
+ // In any other case the parent is the root frm
+ // (in page preview, the page frame)
+ if( bInPagePreview )
+ pParent = pFly->FindPageFrm();
+ else
+ pParent = pFly->FindRootFrm();
+ }
+ }
+ else
+ {
+ SwAccessibleChild aUpper( mpFrm->GetUpper() );
+ while( aUpper.GetSwFrm() && !aUpper.IsAccessible(bInPagePreview) )
+ {
+ aUpper = aUpper.GetSwFrm()->GetUpper();
+ }
+ pParent = aUpper.GetSwFrm();
+ }
+ }
+ else if( mpDrawObj )
+ {
+ const SwDrawContact *pContact =
+ static_cast< const SwDrawContact* >( GetUserCall( mpDrawObj ) );
+ ASSERT( pContact, "sdr contact is missing" );
+ if( pContact )
+ {
+ const SwFrmFmt *pFrmFmt = pContact->GetFmt();
+ ASSERT( pFrmFmt, "frame format is missing" );
+ if( pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() )
+ {
+ // For FLY_AS_CHAR the parent is the anchor
+ pParent = pContact->GetAnchorFrm();
+ ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ),
+ "parent is not accessible" );
+
+ }
+ else
+ {
+ // In any other case the parent is the root frm
+ if( bInPagePreview )
+ pParent = pContact->GetAnchorFrm()->FindPageFrm();
+ else
+ pParent = pContact->GetAnchorFrm()->FindRootFrm();
+ }
+ }
+ }
+ else if ( mpWindow )
+ {
+ css::uno::Reference < css::accessibility::XAccessible > xAcc =
+ mpWindow->GetAccessible();
+ if ( xAcc.is() )
+ {
+ css::uno::Reference < css::accessibility::XAccessibleContext > xAccContext =
+ xAcc->getAccessibleContext();
+ if ( xAccContext.is() )
+ {
+ css::uno::Reference < css::accessibility::XAccessible > xAccParent =
+ xAccContext->getAccessibleParent();
+ if ( xAccParent.is() )
+ {
+ SwAccessibleContext* pAccParentImpl =
+ dynamic_cast< SwAccessibleContext *>( xAccParent.get() );
+ if ( pAccParentImpl )
+ {
+ pParent = pAccParentImpl->GetFrm();
+ }
+ }
+ }
+ }
+ }
+
+ return pParent;
+}
+
+} } // eof of namespace sw::access
+
diff --git a/sw/source/core/access/accfrmobj.hxx b/sw/source/core/access/accfrmobj.hxx
index 45414f8cc6e0..76113c62eae3 100644
--- a/sw/source/core/access/accfrmobj.hxx
+++ b/sw/source/core/access/accfrmobj.hxx
@@ -26,192 +26,70 @@
************************************************************************/
#ifndef _ACCFRMOBJ_HXX
#define _ACCFRMOBJ_HXX
-#include <flyfrm.hxx>
-#include <pagefrm.hxx>
-#include <dflyobj.hxx>
-#include <swtable.hxx>
-class SwFrmOrObj
-{
- const SdrObject *pObj;
- const SwFrm *pFrm;
-
- inline void Init( const SdrObject *pO );
- inline void Init( const SwFrm *pF );
-
-public:
-
- inline SwFrmOrObj();
- inline SwFrmOrObj( const SdrObject *pO );
- inline SwFrmOrObj( const SwFrm *pF );
- inline SwFrmOrObj( const SwFrm *pF, const SdrObject *pO );
- inline SwFrmOrObj( const SwFrmOrObj& r );
+#include <sal/types.h>
- inline SwFrmOrObj& operator=( const SwFrmOrObj& r );
- inline SwFrmOrObj& operator=( const SdrObject *pO );
- inline SwFrmOrObj& operator=( const SwFrm *pF );
+class SwAccessibleMap;
+class SwFrm;
+class SdrObject;
+class Window;
+class SwRect;
- inline sal_Bool operator==( const SwFrmOrObj& r ) const;
- inline sal_Bool operator==( const SdrObject *pO ) const;
- inline sal_Bool operator==( const SwFrm *pF ) const;
-
- inline sal_Bool IsValid() const;
-
- inline const SdrObject *GetSdrObject() const;
- inline const SwFrm *GetSwFrm() const;
-
- sal_Bool IsAccessible( sal_Bool bPagePreview ) const;
- sal_Bool IsBoundAsChar() const;
- inline sal_Bool IsVisibleChildrenOnly() const;
- inline SwRect GetBox() const;
- inline SwRect GetBounds() const;
-};
+namespace sw { namespace access {
-inline void SwFrmOrObj::Init( const SdrObject *pO )
+class SwAccessibleChild
{
- pObj = pO;
- // #110094#-1
- pFrm = pObj && pObj->ISA(SwVirtFlyDrawObj)
- ? static_cast < const SwVirtFlyDrawObj * >( pObj )->GetFlyFrm()
- : 0;
-}
-
-inline void SwFrmOrObj::Init( const SwFrm *pF )
-{
- pFrm = pF;
- pObj = pFrm && pFrm->IsFlyFrm()
- ? static_cast < const SwFlyFrm * >( pFrm )->GetVirtDrawObj()
- : 0;
-}
+ public:
+ SwAccessibleChild();
+ explicit SwAccessibleChild( const SdrObject* pDrawObj );
+ explicit SwAccessibleChild( const SwFrm* pFrm );
+ explicit SwAccessibleChild( Window* pWindow );
+ SwAccessibleChild( const SwFrm* pFrm,
+ const SdrObject* pDrawObj,
+ Window* pWindow );
-inline SwFrmOrObj::SwFrmOrObj() :
- pObj( 0 ), pFrm( 0 )
-{}
+ SwAccessibleChild( const SwAccessibleChild& r );
+ SwAccessibleChild& operator=( const SwAccessibleChild& r );
-inline SwFrmOrObj::SwFrmOrObj( const SdrObject *pO )
-{
- Init( pO );
-}
+ SwAccessibleChild& operator=( const SdrObject* pDrawObj );
+ SwAccessibleChild& operator=( const SwFrm* pFrm );
+ SwAccessibleChild& operator=( Window* pWindow );
-inline SwFrmOrObj::SwFrmOrObj( const SwFrm *pF )
-{
- Init( pF );
-}
+ bool operator==( const SwAccessibleChild& r ) const;
-inline SwFrmOrObj::SwFrmOrObj( const SwFrm *pF, const SdrObject *pO )
-{
- if( pF )
- Init( pF );
- else
- Init( pO );
- ASSERT( (!pF || pF == pFrm) && (!pO || pO == pObj),
- "invalid frame/object combination" );
+ bool IsValid() const;
-}
+ const SwFrm* GetSwFrm() const;
+ const SdrObject* GetDrawObject() const;
+ Window* GetWindow() const;
-inline SwFrmOrObj::SwFrmOrObj( const SwFrmOrObj& r ) :
- pObj( r.pObj ), pFrm( r.pFrm )
-{}
+ const SwFrm* GetParent( const sal_Bool bInPagePreview ) const;
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SwFrmOrObj& r )
-{
- pObj = r.pObj;
- pFrm = r.pFrm;
- return *this;
-}
+ bool IsAccessible( sal_Bool bPagePreview ) const;
+ bool IsBoundAsChar() const;
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SdrObject *pO )
-{
- Init( pO );
- return *this;
-}
+ bool IsVisibleChildrenOnly() const;
+ SwRect GetBox( const SwAccessibleMap& rAccMap ) const;
+ SwRect GetBounds( const SwAccessibleMap& rAccMap ) const;
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SwFrm *pF )
-{
- Init( pF );
- return *this;
-}
+ /** indicating, if accessible child is included even, if the corresponding
+ object is not visible.
-inline sal_Bool SwFrmOrObj::operator==( const SwFrmOrObj& r ) const
-{
- return pObj == r.pObj && pFrm == r.pFrm;
-}
-
-inline sal_Bool SwFrmOrObj::operator==( const SdrObject *pO ) const
-{
- return pObj == pO;
-}
-
-inline sal_Bool SwFrmOrObj::operator==( const SwFrm *pF ) const
-{
- return pFrm == pF;
-}
-
-inline sal_Bool SwFrmOrObj::IsValid() const
-{
- return pObj != 0 || pFrm != 0;
-}
+ @author OD
+ */
+ bool AlwaysIncludeAsChild() const;
-inline const SdrObject *SwFrmOrObj::GetSdrObject() const
-{
- return pObj;
-}
-
-inline const SwFrm *SwFrmOrObj::GetSwFrm() const
-{
- return pFrm;
-}
+ private:
+ const SwFrm* mpFrm;
+ const SdrObject* mpDrawObj;
+ Window* mpWindow;
-inline sal_Bool SwFrmOrObj::IsVisibleChildrenOnly() const
-{
- return !pFrm || pFrm->IsRootFrm() ||
- !( pFrm->IsTabFrm() || pFrm->IsInTab() ||
- ( IsBoundAsChar() &&
- static_cast<const SwFlyFrm*>(pFrm)->GetAnchorFrm()->IsInTab()) );
-}
+ void Init( const SdrObject* pDrawObj );
+ void Init( const SwFrm* pFrm );
+ void Init( Window* pWindow );
+};
-inline SwRect SwFrmOrObj::GetBox() const
-{
- if( pFrm )
- {
- if( pFrm->IsPageFrm() &&
- static_cast< const SwPageFrm * >( pFrm )->IsEmptyPage() )
- {
- SwRect aBox( pFrm->Frm().Left(), pFrm->Frm().Top()-1, 1, 1 );
- return aBox;
- }
- else if ( pFrm->IsTabFrm() )
- {
- SwRect aBox( pFrm->Frm() );
- aBox.Intersection( pFrm->GetUpper()->Frm() );
- return aBox;
- }
- else
- return pFrm->Frm();
- }
- else if( pObj )
- return SwRect( pObj->GetCurrentBoundRect() );
- else
- return SwRect();
-}
-
-inline SwRect SwFrmOrObj::GetBounds() const
-{
- if( pFrm )
- {
- if( pFrm->IsPageFrm() &&
- static_cast< const SwPageFrm * >( pFrm )->IsEmptyPage() )
- {
- SwRect aBox( pFrm->Frm().Left(), pFrm->Frm().Top()-1, 0, 0 );
- return aBox;
- }
- else
- return pFrm->PaintArea();
- }
- else if( pObj )
- return SwRect( pObj->GetCurrentBoundRect() );
- return SwRect();
-}
+} } // eof of namespace sw::access
#endif
diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx
index 0d1bb40e39fb..11834ee89963 100644
--- a/sw/source/core/access/accfrmobjmap.cxx
+++ b/sw/source/core/access/accfrmobjmap.cxx
@@ -28,95 +28,141 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <accfrmobjmap.hxx>
+#include <accframe.hxx>
+#include <accmap.hxx>
+#include <acccontext.hxx>
+#include <viewsh.hxx>
#include <doc.hxx>
#include <frmfmt.hxx>
#include <pagefrm.hxx>
#include <txtfrm.hxx>
#include <node.hxx>
-// OD 2004-05-24 #i28701#
#include <sortedobjs.hxx>
+#include <anchoredobject.hxx>
-#ifndef _ACCFFRMOBJMAP_HXX
-#include <accfrmobjmap.hxx>
-#endif
-
-::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert(
- sal_uInt32 nPos, const SwFrmOrObj& rLower )
-{
- SwFrmOrObjMapKey aKey( SwFrmOrObjMapKey::TEXT, nPos );
- value_type aEntry( aKey, rLower );
- return _SwFrmOrObjMap::insert( aEntry );
-}
-
-::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert(
- const SdrObject *pObj, const SwFrmOrObj& rLower, const SwDoc *pDoc )
-{
- if( !bLayerIdsValid )
- {
- nHellId = pDoc->GetHellId();
- nControlsId = pDoc->GetControlsId();
- bLayerIdsValid = sal_True;
- }
+#include <svx/svdobj.hxx>
- SdrLayerID nLayer = pObj->GetLayer();
- SwFrmOrObjMapKey::LayerId eLayerId = (nHellId == nLayer)
- ? SwFrmOrObjMapKey::HELL
- : ((nControlsId == nLayer) ? SwFrmOrObjMapKey::CONTROLS
- : SwFrmOrObjMapKey::HEAVEN);
- SwFrmOrObjMapKey aKey( eLayerId, pObj->GetOrdNum() );
- value_type aEntry( aKey, rLower );
- return _SwFrmOrObjMap::insert( aEntry );
-}
+using namespace sw::access;
-SwFrmOrObjMap::SwFrmOrObjMap(
- const SwRect& rVisArea, const SwFrm *pFrm ) :
- bLayerIdsValid( sal_False )
+SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : nHellId( rAccMap.GetShell()->GetDoc()->GetHellId() )
+ , nControlsId( rAccMap.GetShell()->GetDoc()->GetControlsId() )
{
- SwFrmOrObj aFrm( pFrm );
- sal_Bool bVisibleOnly = aFrm.IsVisibleChildrenOnly();
+ const bool bVisibleChildrenOnly = SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly();
sal_uInt32 nPos = 0;
- SwFrmOrObj aLower( pFrm->GetLower() );
+ SwAccessibleChild aLower( rFrm.GetLower() );
while( aLower.GetSwFrm() )
{
- if( !bVisibleOnly || aLower.GetBox().IsOver( rVisArea ) )
- insert( nPos++, aLower );
+ if ( !bVisibleChildrenOnly ||
+ aLower.AlwaysIncludeAsChild() ||
+ aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
+ {
+ insert( nPos++, SwAccessibleChildMapKey::TEXT, aLower );
+ }
aLower = aLower.GetSwFrm()->GetNext();
}
- if( pFrm->IsPageFrm() )
+ if ( rFrm.IsPageFrm() )
{
- ASSERT( bVisibleOnly, "page frame within tab frame???" );
+ ASSERT( bVisibleChildrenOnly, "page frame within tab frame???" );
const SwPageFrm *pPgFrm =
- static_cast< const SwPageFrm * >( pFrm );
+ static_cast< const SwPageFrm * >( &rFrm );
const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
- if( pObjs )
+ if ( pObjs )
{
- const SwDoc *pDoc = pPgFrm->GetFmt()->GetDoc();
for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
{
aLower = (*pObjs)[i]->GetDrawObj();
- if( aLower.GetBox().IsOver( rVisArea ) )
- insert( aLower.GetSdrObject(), aLower, pDoc );
+ if ( aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
+ {
+ insert( aLower.GetDrawObject(), aLower );
+ }
}
}
}
- else if( pFrm->IsTxtFrm() )
+ else if( rFrm.IsTxtFrm() )
{
- const SwDoc *pDoc = static_cast< const SwTxtFrm * >( pFrm )->GetNode()
- ->GetDoc();
- const SwSortedObjs *pObjs = pFrm->GetDrawObjs();
- if( pObjs )
+ const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
+ if ( pObjs )
{
for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
{
aLower = (*pObjs)[i]->GetDrawObj();
- if( aLower.IsBoundAsChar() &&
- (!bVisibleOnly || aLower.GetBox().IsOver( rVisArea )) )
- insert( aLower.GetSdrObject(), aLower, pDoc );
+ if ( aLower.IsBoundAsChar() &&
+ ( !bVisibleChildrenOnly ||
+ aLower.AlwaysIncludeAsChild() ||
+ aLower.GetBox( rAccMap ).IsOver( rVisArea ) ) )
+ {
+ insert( aLower.GetDrawObject(), aLower );
+ }
+ }
+ }
+
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rAccMap.GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ if ( pAccImpl &&
+ pAccImpl->HasAdditionalAccessibleChildren() )
+ {
+ std::vector< Window* >* pAdditionalChildren =
+ new std::vector< Window* >();
+ pAccImpl->GetAdditionalAccessibleChildren( pAdditionalChildren );
+
+ sal_Int32 nCounter( 0 );
+ for ( std::vector< Window* >::iterator aIter = pAdditionalChildren->begin();
+ aIter != pAdditionalChildren->end();
+ ++aIter )
+ {
+ aLower = (*aIter);
+ insert( ++nCounter, SwAccessibleChildMapKey::XWINDOW, aLower );
+ }
+
+ delete pAdditionalChildren;
+ }
}
}
}
}
+
+::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert(
+ const sal_uInt32 nPos,
+ const SwAccessibleChildMapKey::LayerId eLayerId,
+ const SwAccessibleChild& rLower )
+{
+ SwAccessibleChildMapKey aKey( eLayerId, nPos );
+ value_type aEntry( aKey, rLower );
+ return _SwAccessibleChildMap::insert( aEntry );
+}
+
+::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert(
+ const SdrObject *pObj,
+ const SwAccessibleChild& rLower )
+{
+ const SdrLayerID nLayer = pObj->GetLayer();
+ SwAccessibleChildMapKey::LayerId eLayerId =
+ (nHellId == nLayer)
+ ? SwAccessibleChildMapKey::HELL
+ : ( (nControlsId == nLayer)
+ ? SwAccessibleChildMapKey::CONTROLS
+ : SwAccessibleChildMapKey::HEAVEN );
+ SwAccessibleChildMapKey aKey( eLayerId, pObj->GetOrdNum() );
+ value_type aEntry( aKey, rLower );
+ return _SwAccessibleChildMap::insert( aEntry );
+}
+
+/* static */ sal_Bool SwAccessibleChildMap::IsSortingRequired( const SwFrm& rFrm )
+{
+ return ( rFrm.IsPageFrm() &&
+ static_cast< const SwPageFrm& >( rFrm ).GetSortedObjs() ) ||
+ ( rFrm.IsTxtFrm() &&
+ rFrm.GetDrawObjs() );
+}
diff --git a/sw/source/core/access/accfrmobjmap.hxx b/sw/source/core/access/accfrmobjmap.hxx
index ab474037ef62..91365ed9c258 100644
--- a/sw/source/core/access/accfrmobjmap.hxx
+++ b/sw/source/core/access/accfrmobjmap.hxx
@@ -26,79 +26,71 @@
************************************************************************/
#ifndef _ACCFRMOBJMAP_HXX
#define _ACCFRMOBJMAP_HXX
+
#include <accfrmobj.hxx>
+#include <svx/svdtypes.hxx>
+
#include <map>
+class SwAccessibleMap;
class SwDoc;
+class SwRect;
+class SwFrm;
+class SdrObject;
-class SwFrmOrObjMapKey
+class SwAccessibleChildMapKey
{
public:
- enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS };
+ enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW };
+
+ inline SwAccessibleChildMapKey()
+ : eLayerId( INVALID )
+ , nOrdNum( 0 )
+ {}
+
+ inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
+ : eLayerId( eId )
+ , nOrdNum( nOrd )
+ {}
+
+ inline bool operator()( const SwAccessibleChildMapKey& r1,
+ const SwAccessibleChildMapKey& r2 ) const
+ {
+ return (r1.eLayerId == r2.eLayerId)
+ ? (r1.nOrdNum < r2.nOrdNum)
+ : (r1.eLayerId < r2.eLayerId);
+ }
+
private:
LayerId eLayerId;
sal_uInt32 nOrdNum;
-public:
-
- inline SwFrmOrObjMapKey();
- inline SwFrmOrObjMapKey( LayerId eId, sal_uInt32 nOrd );
-
- inline sal_Bool operator()( const SwFrmOrObjMapKey& r1,
- const SwFrmOrObjMapKey& r2 ) const;
};
-typedef ::std::map < SwFrmOrObjMapKey, SwFrmOrObj, SwFrmOrObjMapKey >
- _SwFrmOrObjMap;
+typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey >
+ _SwAccessibleChildMap;
-class SwFrmOrObjMap : public _SwFrmOrObjMap
+class SwAccessibleChildMap : public _SwAccessibleChildMap
{
- SdrLayerID nHellId;
- SdrLayerID nControlsId;
- sal_Bool bLayerIdsValid;
+ const SdrLayerID nHellId;
+ const SdrLayerID nControlsId;
- ::std::pair< iterator, bool > insert( sal_uInt32 nPos,
- const SwFrmOrObj& rLower );
- ::std::pair< iterator, bool > insert( const SdrObject *pObj,
- const SwFrmOrObj& rLower,
- const SwDoc *pDoc );
+ ::std::pair< iterator, bool > insert( const sal_uInt32 nPos,
+ const SwAccessibleChildMapKey::LayerId eLayerId,
+ const sw::access::SwAccessibleChild& rLower );
+ ::std::pair< iterator, bool > insert( const SdrObject* pObj,
+ const sw::access::SwAccessibleChild& rLower );
public:
- SwFrmOrObjMap( const SwRect& rVisArea, const SwFrm *pFrm );
+ SwAccessibleChildMap( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap );
- inline static sal_Bool IsSortingRequired( const SwFrm *pFrm );
+ static sal_Bool IsSortingRequired( const SwFrm& rFrm );
};
-inline SwFrmOrObjMapKey::SwFrmOrObjMapKey() :
- eLayerId( INVALID ),
- nOrdNum( 0 )
-{
-}
-
-inline SwFrmOrObjMapKey::SwFrmOrObjMapKey(
- LayerId eId, sal_uInt32 nOrd ) :
- eLayerId( eId ),
- nOrdNum( nOrd )
-{
-}
-
-inline sal_Bool SwFrmOrObjMapKey::operator()(
- const SwFrmOrObjMapKey& r1,
- const SwFrmOrObjMapKey& r2 ) const
-{
- return (r1.eLayerId == r2.eLayerId) ? (r1.nOrdNum < r2.nOrdNum) :
- (r1.eLayerId < r2.eLayerId);
-}
-
-inline sal_Bool SwFrmOrObjMap::IsSortingRequired( const SwFrm *pFrm )
-{
- return ( pFrm->IsPageFrm() &&
- static_cast< const SwPageFrm * >( pFrm )->GetSortedObjs() ) ||
- (pFrm->IsTxtFrm() && pFrm->GetDrawObjs() );
-}
-
#endif
diff --git a/sw/source/core/access/accfrmobjslist.cxx b/sw/source/core/access/accfrmobjslist.cxx
index e23cb6702a70..2f3e8399187a 100644
--- a/sw/source/core/access/accfrmobjslist.cxx
+++ b/sw/source/core/access/accfrmobjslist.cxx
@@ -28,97 +28,146 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <accfrmobjslist.hxx>
+#include <accmap.hxx>
+#include <acccontext.hxx>
#include <pagefrm.hxx>
-// OD 2004-05-24 #i28701#
#include <sortedobjs.hxx>
-#include <accfrmobjslist.hxx>
+#include <anchoredobject.hxx>
+using namespace ::sw::access;
-SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(
- const SwFrmOrObjSList& rLst, sal_Bool ) :
- rList( rLst ), aCurr( rList.pFrm->GetLower() ), nNextObj( 0 )
+SwAccessibleChildSList_const_iterator::SwAccessibleChildSList_const_iterator(
+ const SwAccessibleChildSList& rLst,
+ SwAccessibleMap& rAccMap )
+ : rList( rLst ),
+ aCurr( rList.GetFrm().GetLower() ),
+ nNextObj( 0 )
{
if( !aCurr.GetSwFrm() )
{
- if( rList.pFrm->IsPageFrm() )
+ const SwFrm& rFrm = rList.GetFrm();
+ if( rFrm.IsPageFrm() )
{
- const SwPageFrm *pPgFrm =
- static_cast< const SwPageFrm * >( rList.pFrm );
- const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
+ const SwPageFrm& rPgFrm = static_cast< const SwPageFrm& >( rFrm );
+ const SwSortedObjs *pObjs = rPgFrm.GetSortedObjs();
if( pObjs && pObjs->Count() )
+ {
aCurr = (*pObjs)[nNextObj++]->GetDrawObj();
+ }
}
- else if( rList.pFrm->IsTxtFrm() )
+ else if( rFrm.IsTxtFrm() )
{
- const SwSortedObjs *pObjs = rList.pFrm->GetDrawObjs();
- if( pObjs && pObjs->Count() )
+ const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
+ if ( pObjs && pObjs->Count() )
{
aCurr = (*pObjs)[nNextObj++]->GetDrawObj();
while( aCurr.IsValid() && !aCurr.IsBoundAsChar() )
+ {
aCurr = (nNextObj < pObjs->Count())
- ? (*pObjs)[nNextObj++]->GetDrawObj()
- : static_cast< const SdrObject *>( 0 );
-
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
+ }
+ }
+ if ( !aCurr.IsValid() )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rAccMap.GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ aCurr = SwAccessibleChild( pAccImpl->GetAdditionalAccessibleChild( 0 ) );
+ ++nNextObj;
+ }
}
}
}
- if( rList.bVisibleOnly )
+
+ if( rList.IsVisibleChildrenOnly() )
{
// Find the first visible
while( aCurr.IsValid() &&
- !aCurr.GetBox().IsOver( rList.aVisArea ) )
+ !aCurr.AlwaysIncludeAsChild() &&
+ !aCurr.GetBox( rAccMap ).IsOver( rList.GetVisArea() ) )
+ {
next();
+ }
}
}
-SwFrmOrObjSList_const_iterator& SwFrmOrObjSList_const_iterator::next()
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::next()
{
- sal_Bool bGetSdrObject = sal_False;
- if( aCurr.GetSdrObject() )
+ bool bNextTaken( true );
+ if( aCurr.GetDrawObject() || aCurr.GetWindow() )
{
- bGetSdrObject = sal_True;
+ bNextTaken = false;
}
else if( aCurr.GetSwFrm() )
{
aCurr = aCurr.GetSwFrm()->GetNext();
if( !aCurr.GetSwFrm() )
- bGetSdrObject = sal_True;
+ {
+ bNextTaken = false;
+ }
}
- if( bGetSdrObject )
+ if( !bNextTaken )
{
- if( rList.pFrm->IsPageFrm() )
+ const SwFrm& rFrm = rList.GetFrm();
+ if( rFrm.IsPageFrm() )
{
- const SwPageFrm *pPgFrm =
- static_cast< const SwPageFrm * >( rList.pFrm );
- const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
- aCurr = (pObjs && nNextObj < pObjs->Count())
- ? (*pObjs)[nNextObj++]->GetDrawObj()
- : static_cast< const SdrObject *>( 0 );
+ const SwPageFrm& rPgFrm = static_cast< const SwPageFrm& >( rFrm );
+ const SwSortedObjs *pObjs = rPgFrm.GetSortedObjs();
+ aCurr = ( pObjs && nNextObj < pObjs->Count() )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
}
- else if( rList.pFrm->IsTxtFrm() )
+ else if( rFrm.IsTxtFrm() )
{
- const SwSortedObjs *pObjs = rList.pFrm->GetDrawObjs();
- aCurr = (pObjs && nNextObj < pObjs->Count())
- ? (*pObjs)[nNextObj++]->GetDrawObj()
- : static_cast< const SdrObject *>( 0 );
+ const SwSortedObjs* pObjs = rFrm.GetDrawObjs();
+ const sal_uInt32 nObjsCount = pObjs ? pObjs->Count() : 0;
+ aCurr = ( pObjs && nNextObj < nObjsCount )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
while( aCurr.IsValid() && !aCurr.IsBoundAsChar() )
- aCurr = (nNextObj < pObjs->Count())
- ? (*pObjs)[nNextObj++]->GetDrawObj()
- : static_cast< const SdrObject *>( 0 );
+ {
+ aCurr = ( nNextObj < nObjsCount )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
+ }
+ if ( !aCurr.IsValid() )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rList.GetAccMap().GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ aCurr = SwAccessibleChild( pAccImpl->GetAdditionalAccessibleChild( nNextObj - nObjsCount ) );
+ ++nNextObj;
+ }
+ }
}
}
return *this;
}
-SwFrmOrObjSList_const_iterator& SwFrmOrObjSList_const_iterator::next_visible()
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::next_visible()
{
next();
while( aCurr.IsValid() &&
- !aCurr.GetBox().IsOver( rList.aVisArea ) )
+ !aCurr.AlwaysIncludeAsChild() &&
+ !aCurr.GetBox( rList.GetAccMap() ).IsOver( rList.GetVisArea() ) )
+ {
next();
+ }
return *this;
}
+
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::operator++()
+{
+ return rList.IsVisibleChildrenOnly() ? next_visible() : next();
+}
+
diff --git a/sw/source/core/access/accfrmobjslist.hxx b/sw/source/core/access/accfrmobjslist.hxx
index 2374dbc361ac..f81cfc85a9d7 100644
--- a/sw/source/core/access/accfrmobjslist.hxx
+++ b/sw/source/core/access/accfrmobjslist.hxx
@@ -28,117 +28,118 @@
#define _ACCFRMOBJSLIST_HXX
#include <accfrmobj.hxx>
+#include <swrect.hxx>
-class SwFrmOrObjSList;
+class SwAccessibleMap;
-class SwFrmOrObjSList_const_iterator
-{
- friend class SwFrmOrObjSList;
- const SwFrmOrObjSList& rList; // The frame we are iterating over
- SwFrmOrObj aCurr; // The current object
- sal_uInt16 nNextObj; // The index of the current sdr object
-
- inline SwFrmOrObjSList_const_iterator( const SwFrmOrObjSList& rLst );
- SwFrmOrObjSList_const_iterator( const SwFrmOrObjSList& rLst, sal_Bool );
-
-// SwFrmOrObjSList_const_iterator& begin();
- SwFrmOrObjSList_const_iterator& next();
- SwFrmOrObjSList_const_iterator& next_visible();
-
-public:
-
- inline SwFrmOrObjSList_const_iterator(
- const SwFrmOrObjSList_const_iterator& rIter );
- inline sal_Bool operator==(
- const SwFrmOrObjSList_const_iterator& r ) const;
- inline sal_Bool operator!=(
- const SwFrmOrObjSList_const_iterator& r ) const;
- inline SwFrmOrObjSList_const_iterator& operator++();
- inline const SwFrmOrObj& operator*() const;
-};
+class SwAccessibleChildSList;
-// An iterator to iterate over a frame's child in any order
-class SwFrmOrObjSList
+class SwAccessibleChildSList_const_iterator
{
- friend class SwFrmOrObjSList_const_iterator;
+private:
+ friend class SwAccessibleChildSList;
- SwRect aVisArea;
- const SwFrm *pFrm; // The frame we are iterating over
- sal_Bool bVisibleOnly;
-
-public:
+ const SwAccessibleChildSList& rList; // The frame we are iterating over
+ sw::access::SwAccessibleChild aCurr; // The current object
+ sal_uInt16 nNextObj; // The index of the current sdr object
- typedef SwFrmOrObjSList_const_iterator const_iterator;
+ inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst )
+ : rList( rLst )
+ , nNextObj( 0 )
+ {}
- inline SwFrmOrObjSList( const SwFrm *pF );
- inline SwFrmOrObjSList( const SwRect& rVisArea, const SwFrm *pF );
+ SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst,
+ SwAccessibleMap& rAccMap );
- inline const_iterator begin() const;
- inline const_iterator end() const;
-};
-
-inline SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(
- const SwFrmOrObjSList& rLst ) :
- rList( rLst ), nNextObj( 0 )
-{
-}
+ SwAccessibleChildSList_const_iterator& next();
+ SwAccessibleChildSList_const_iterator& next_visible();
-inline SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(
- const SwFrmOrObjSList_const_iterator& rIter ) :
- rList( rIter.rList ),
- aCurr( rIter.aCurr ),
- nNextObj( rIter.nNextObj )
-{
-}
+public:
-inline sal_Bool SwFrmOrObjSList_const_iterator::operator==(
- const SwFrmOrObjSList_const_iterator& r ) const
-{
- return aCurr == r.aCurr;
-}
+ inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList_const_iterator& rIter )
+ : rList( rIter.rList )
+ , aCurr( rIter.aCurr )
+ , nNextObj( rIter.nNextObj )
+ {}
-inline sal_Bool SwFrmOrObjSList_const_iterator::operator!=(
- const SwFrmOrObjSList_const_iterator& r ) const
-{
- return !(aCurr == r.aCurr);
-}
+ inline sal_Bool operator==( const SwAccessibleChildSList_const_iterator& r ) const
+ {
+ return aCurr == r.aCurr;
+ }
-inline SwFrmOrObjSList_const_iterator& SwFrmOrObjSList_const_iterator::operator++()
-{
- return rList.bVisibleOnly ? next_visible() : next();
-}
+ inline sal_Bool operator!=(
+ const SwAccessibleChildSList_const_iterator& r ) const
+ {
+ return !(*this == r);
+ }
-inline const SwFrmOrObj& SwFrmOrObjSList_const_iterator::operator*() const
-{
- return aCurr;
-}
+ SwAccessibleChildSList_const_iterator& operator++();
-inline SwFrmOrObjSList::SwFrmOrObjSList( const SwFrm *pF ) :
- pFrm( pF ),
- bVisibleOnly( sal_False )
-{
-}
+ inline const sw::access::SwAccessibleChild& operator*() const
+ {
+ return aCurr;
+ }
+};
-inline SwFrmOrObjSList::SwFrmOrObjSList( const SwRect& rVisArea,
- const SwFrm *pF ) :
- aVisArea( rVisArea ),
- pFrm( pF )
+// An iterator to iterate over a frame's child in any order
+class SwAccessibleChildSList
{
- SwFrmOrObj aFrm( pFrm );
- bVisibleOnly = aFrm.IsVisibleChildrenOnly();
-}
+ const SwRect maVisArea;
+ const SwFrm& mrFrm;
+ const sal_Bool mbVisibleChildrenOnly;
+ SwAccessibleMap& mrAccMap;
-inline SwFrmOrObjSList_const_iterator SwFrmOrObjSList::begin() const
-{
-// SwFrmOrObjSList_const_iterator aIter2( *this );
-// aIter2.begin();
-// return aIter2;
- return SwFrmOrObjSList_const_iterator( *this, sal_True );
-}
+public:
-inline SwFrmOrObjSList_const_iterator SwFrmOrObjSList::end() const
-{
- return SwFrmOrObjSList_const_iterator( *this );
-}
+ typedef SwAccessibleChildSList_const_iterator const_iterator;
+
+ inline SwAccessibleChildSList( const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : maVisArea()
+ , mrFrm( rFrm )
+ , mbVisibleChildrenOnly( sal_False )
+ , mrAccMap( rAccMap )
+ {}
+
+ inline SwAccessibleChildSList( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : maVisArea( rVisArea )
+ , mrFrm( rFrm )
+ , mbVisibleChildrenOnly( sw::access::SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly() )
+ , mrAccMap( rAccMap )
+ {
+ }
+
+ inline const_iterator begin() const
+ {
+ return SwAccessibleChildSList_const_iterator( *this, mrAccMap );
+ }
+
+ inline const_iterator end() const
+ {
+ return SwAccessibleChildSList_const_iterator( *this );
+ }
+
+ inline const SwFrm& GetFrm() const
+ {
+ return mrFrm;
+ }
+
+ inline sal_Bool IsVisibleChildrenOnly() const
+ {
+ return mbVisibleChildrenOnly;
+ }
+
+ inline const SwRect& GetVisArea() const
+ {
+ return maVisArea;
+ }
+
+ inline SwAccessibleMap& GetAccMap() const
+ {
+ return mrAccMap;
+ }
+};
#endif
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 367db154a30a..0d7ab98d3b03 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -39,9 +39,7 @@
#include <map>
#include <list>
#include <accmap.hxx>
-#ifndef _ACCCONTEXT_HXX
#include <acccontext.hxx>
-#endif
#include <accdoc.hxx>
#include <accpreview.hxx>
#include <accpage.hxx>
@@ -53,7 +51,7 @@
#include <accembedded.hxx>
#include <acccell.hxx>
#include <acctable.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <rootfrm.hxx>
#include <txtfrm.hxx>
#include <hffrm.hxx>
@@ -61,10 +59,9 @@
#include <cellfrm.hxx>
#include <tabfrm.hxx>
#include <pagefrm.hxx>
+#include <flyfrm.hxx>
#include <ndtyp.hxx>
-#ifndef IDOCUMENTDRAWMODELACCESS_HXX_INCLUDED
#include <IDocumentDrawModelAccess.hxx>
-#endif
#include <svx/ShapeTypeHandler.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
@@ -77,10 +74,13 @@
#include <pam.hxx>
#include <ndtxt.hxx>
// <--
+#include <dflyobj.hxx>
+#include <prevwpage.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
+using namespace ::sw::access;
struct SwFrmFunc
{
@@ -329,7 +329,7 @@ private:
SwRect maOldBox; // the old bounds for CHILD_POS_CHANGED
// and POS_CHANGED
uno::WeakReference < XAccessible > mxAcc; // The object that fires the event
- SwFrmOrObj maFrmOrObj; // the child for CHILD_POS_CHANGED and
+ SwAccessibleChild maFrmOrObj; // the child for CHILD_POS_CHANGED and
// the same as xAcc for any other
// event type
EventType meType; // The event type
@@ -342,7 +342,7 @@ private:
public:
SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA,
- const SwFrmOrObj& rFrmOrObj )
+ const SwAccessibleChild& rFrmOrObj )
: mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
meType( eT ),
@@ -350,7 +350,7 @@ public:
{}
SwAccessibleEvent_Impl( EventType eT,
- const SwFrmOrObj& rFrmOrObj )
+ const SwAccessibleChild& rFrmOrObj )
: maFrmOrObj( rFrmOrObj ),
meType( eT ),
mnStates( 0 )
@@ -369,7 +369,7 @@ public:
SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA,
- const SwFrmOrObj& rFrmOrObj,
+ const SwAccessibleChild& rFrmOrObj,
const SwRect& rR )
: maOldBox( rR ),
mxAcc( pA ),
@@ -385,7 +385,7 @@ public:
// --> OD 2005-12-12 #i27301# - use new type definition for parameter <_nStates>
SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA,
- const SwFrmOrObj& rFrmOrObj,
+ const SwAccessibleChild& rFrmOrObj,
const tAccessibleStates _nStates )
: mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
@@ -425,7 +425,7 @@ public:
maOldBox = rOldBox;
}
- inline const SwFrmOrObj& GetFrmOrObj() const
+ inline const SwAccessibleChild& GetFrmOrObj() const
{
return maFrmOrObj;
}
@@ -524,22 +524,26 @@ public:
//------------------------------------------------------------------------------
-struct SwFrmOrObjFunc
+struct SwAccessibleChildFunc
{
- sal_Bool operator()( const SwFrmOrObj& r1,
- const SwFrmOrObj& r2 ) const
+ sal_Bool operator()( const SwAccessibleChild& r1,
+ const SwAccessibleChild& r2 ) const
{
const void *p1 = r1.GetSwFrm()
- ? static_cast < const void * >( r1.GetSwFrm())
- : static_cast < const void * >( r1.GetSdrObject() );
+ ? static_cast < const void * >( r1.GetSwFrm())
+ : ( r1.GetDrawObject()
+ ? static_cast < const void * >( r1.GetDrawObject() )
+ : static_cast < const void * >( r1.GetWindow() ) );
const void *p2 = r2.GetSwFrm()
- ? static_cast < const void * >( r2.GetSwFrm())
- : static_cast < const void * >( r2.GetSdrObject() );
+ ? static_cast < const void * >( r2.GetSwFrm())
+ : ( r2.GetDrawObject()
+ ? static_cast < const void * >( r2.GetDrawObject() )
+ : static_cast < const void * >( r2.GetWindow() ) );
return p1 < p2;
}
};
-typedef ::std::map < SwFrmOrObj, SwAccessibleEventList_Impl::iterator,
- SwFrmOrObjFunc > _SwAccessibleEventMap_Impl;
+typedef ::std::map < SwAccessibleChild, SwAccessibleEventList_Impl::iterator,
+ SwAccessibleChildFunc > _SwAccessibleEventMap_Impl;
class SwAccessibleEventMap_Impl: public _SwAccessibleEventMap_Impl
{
@@ -577,6 +581,222 @@ typedef ::std::map< uno::WeakReference < XAccessible >,
class SwAccessibleSelectedParas_Impl: public _SwAccessibleSelectedParas_Impl
{};
// <--
+
+// helper class that stores preview data
+class SwAccPreviewData
+{
+ typedef std::vector<Rectangle> Rectangles;
+ Rectangles maPreviewRects;
+ Rectangles maLogicRects;
+
+ SwRect maVisArea;
+ Fraction maScale;
+
+ const SwPageFrm *mpSelPage;
+
+ /** adjust logic page retangle to its visible part
+
+ OD 17.01.2003 #103492#
+
+ @author OD
+
+ @param _iorLogicPgSwRect
+ input/output parameter - reference to the logic page rectangle, which
+ has to be adjusted.
+
+ @param _rPrevwPgSwRect
+ input parameter - constant reference to the corresponding preview page
+ rectangle; needed to determine the visible part of the logic page rectangle.
+
+ @param _rPrevwWinSize
+ input paramter - constant reference to the preview window size in TWIP;
+ needed to determine the visible part of the logic page rectangle
+ */
+ void AdjustLogicPgRectToVisibleArea( SwRect& _iorLogicPgSwRect,
+ const SwRect& _rPrevwPgSwRect,
+ const Size& _rPrevwWinSize );
+
+public:
+ SwAccPreviewData();
+ ~SwAccPreviewData();
+
+ // OD 14.01.2003 #103492# - complete re-factoring of method due to new
+ // page/print preview functionality.
+ void Update( const SwAccessibleMap& rAccMap,
+ const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize );
+
+ // OD 14.01.2003 #103492# - complete re-factoring of method due to new
+ // page/print preview functionality.
+ void InvalidateSelection( const SwPageFrm* _pSelectedPageFrm );
+
+ const SwRect& GetVisArea() const;
+
+ MapMode GetMapModeForPreview( ) const;
+
+ /** Adjust the MapMode so that the preview page appears at the
+ * proper position. rPoint identifies the page for which the
+ * MapMode should be adjusted. If bFromPreview is true, rPoint is
+ * a preview coordinate; else it's a document coordinate. */
+ // OD 17.01.2003 #103492# - delete unused 3rd parameter.
+ void AdjustMapMode( MapMode& rMapMode,
+ const Point& rPoint ) const;
+
+ inline const SwPageFrm *GetSelPage() const { return mpSelPage; }
+
+ void DisposePage(const SwPageFrm *pPageFrm );
+};
+
+SwAccPreviewData::SwAccPreviewData() :
+ mpSelPage( 0 )
+{
+}
+
+SwAccPreviewData::~SwAccPreviewData()
+{
+}
+
+// OD 13.01.2003 #103492# - complete re-factoring of method due to new page/print
+// preview functionality.
+void SwAccPreviewData::Update( const SwAccessibleMap& rAccMap,
+ const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize )
+{
+ // store preview scaling, maximal preview page size and selected page
+ maScale = _rScale;
+ mpSelPage = _pSelectedPageFrm;
+
+ // prepare loop on preview pages
+ maPreviewRects.clear();
+ maLogicRects.clear();
+ SwAccessibleChild aPage;
+ maVisArea.Clear();
+
+ // loop on preview pages to calculate <maPreviewRects>, <maLogicRects> and
+ // <maVisArea>
+ for ( std::vector<PrevwPage*>::const_iterator aPageIter = _rPrevwPages.begin();
+ aPageIter != _rPrevwPages.end();
+ ++aPageIter )
+ {
+ aPage = (*aPageIter)->pPage;
+
+ // add preview page rectangle to <maPreviewRects>
+ Rectangle aPrevwPgRect( (*aPageIter)->aPrevwWinPos, (*aPageIter)->aPageSize );
+ maPreviewRects.push_back( aPrevwPgRect );
+
+ // add logic page rectangle to <maLogicRects>
+ SwRect aLogicPgSwRect( aPage.GetBox( rAccMap ) );
+ Rectangle aLogicPgRect( aLogicPgSwRect.SVRect() );
+ maLogicRects.push_back( aLogicPgRect );
+ // union visible area with visible part of logic page rectangle
+ if ( (*aPageIter)->bVisible )
+ {
+ if ( !(*aPageIter)->pPage->IsEmptyPage() )
+ {
+ AdjustLogicPgRectToVisibleArea( aLogicPgSwRect,
+ SwRect( aPrevwPgRect ),
+ _rPrevwWinSize );
+ }
+ if ( maVisArea.IsEmpty() )
+ maVisArea = aLogicPgSwRect;
+ else
+ maVisArea.Union( aLogicPgSwRect );
+ }
+ }
+}
+
+// OD 16.01.2003 #103492# - complete re-factoring of method due to new page/print
+// preview functionality.
+void SwAccPreviewData::InvalidateSelection( const SwPageFrm* _pSelectedPageFrm )
+{
+ mpSelPage = _pSelectedPageFrm;
+ ASSERT( mpSelPage, "selected page not found" );
+}
+
+struct ContainsPredicate
+{
+ const Point& mrPoint;
+ ContainsPredicate( const Point& rPoint ) : mrPoint(rPoint) {}
+ bool operator() ( const Rectangle& rRect ) const
+ {
+ return rRect.IsInside( mrPoint ) ? true : false;
+ }
+};
+
+const SwRect& SwAccPreviewData::GetVisArea() const
+{
+ return maVisArea;
+}
+
+void SwAccPreviewData::AdjustMapMode( MapMode& rMapMode,
+ const Point& rPoint ) const
+{
+ // adjust scale
+ rMapMode.SetScaleX( maScale );
+ rMapMode.SetScaleY( maScale );
+
+ // find proper rectangle
+ Rectangles::const_iterator aBegin = maLogicRects.begin();
+ Rectangles::const_iterator aEnd = maLogicRects.end();
+ Rectangles::const_iterator aFound = ::std::find_if( aBegin, aEnd,
+ ContainsPredicate( rPoint ) );
+
+ if( aFound != aEnd )
+ {
+ // found! set new origin
+ Point aPoint = (maPreviewRects.begin() + (aFound - aBegin))->TopLeft();
+ aPoint -= (maLogicRects.begin() + (aFound-aBegin))->TopLeft();
+ rMapMode.SetOrigin( aPoint );
+ }
+ // else: don't adjust MapMode
+}
+
+void SwAccPreviewData::DisposePage(const SwPageFrm *pPageFrm )
+{
+ if( mpSelPage == pPageFrm )
+ mpSelPage = 0;
+}
+
+/** adjust logic page retangle to its visible part
+
+ OD 17.01.2003 #103492#
+
+ @author OD
+*/
+void SwAccPreviewData::AdjustLogicPgRectToVisibleArea(
+ SwRect& _iorLogicPgSwRect,
+ const SwRect& _rPrevwPgSwRect,
+ const Size& _rPrevwWinSize )
+{
+ // determine preview window rectangle
+ const SwRect aPrevwWinSwRect( Point( 0, 0 ), _rPrevwWinSize );
+ // calculate visible preview page rectangle
+ SwRect aVisPrevwPgSwRect( _rPrevwPgSwRect );
+ aVisPrevwPgSwRect.Intersection( aPrevwWinSwRect );
+ // adjust logic page rectangle
+ SwTwips nTmpDiff;
+ // left
+ nTmpDiff = aVisPrevwPgSwRect.Left() - _rPrevwPgSwRect.Left();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Left( _iorLogicPgSwRect.Left() + nTmpDiff );
+ // top
+ nTmpDiff = aVisPrevwPgSwRect.Top() - _rPrevwPgSwRect.Top();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Top( _iorLogicPgSwRect.Top() + nTmpDiff );
+ // right
+ nTmpDiff = _rPrevwPgSwRect.Right() - aVisPrevwPgSwRect.Right();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Right( _iorLogicPgSwRect.Right() - nTmpDiff );
+ // bottom
+ nTmpDiff = _rPrevwPgSwRect.Bottom() - aVisPrevwPgSwRect.Bottom();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Bottom( _iorLogicPgSwRect.Bottom() - nTmpDiff );
+}
+
//------------------------------------------------------------------------------
static sal_Bool AreInSameTable( const uno::Reference< XAccessible >& rAcc,
const SwFrm *pFrm )
@@ -796,9 +1016,10 @@ void SwAccessibleMap::InvalidateCursorPosition(
ASSERT( pAccImpl->GetFrm(), "caret context is disposed" );
if( GetShell()->ActionPend() )
{
- SwAccessibleEvent_Impl aEvent(
- SwAccessibleEvent_Impl::CARET_OR_STATES, pAccImpl,
- pAccImpl->GetFrm(), ACC_STATE_CARET );
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl,
+ SwAccessibleChild(pAccImpl->GetFrm()),
+ ACC_STATE_CARET );
AppendEvent( aEvent );
}
else
@@ -873,11 +1094,10 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
}
if( bChanged )
{
- SwFrmOrObj aFrmOrObj( pShape->first );
- SwFrmOrObj aParent =
- SwAccessibleFrame::GetParent( aFrmOrObj,
- GetShell()->IsPreView() );
- aParents.push_back( aParent.GetSwFrm() );
+ const SwFrm* pParent = SwAccessibleFrame::GetParent(
+ SwAccessibleChild( pShape->first ),
+ GetShell()->IsPreView() );
+ aParents.push_back( pParent );
}
}
@@ -1166,7 +1386,7 @@ uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview(
// create & update preview data object
if( mpPreview == NULL )
mpPreview = new SwAccPreviewData();
- mpPreview->Update( _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
+ mpPreview->Update( *this, _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
uno::Reference<XAccessible> xAcc = _GetDocumentView( sal_True );
return xAcc;
@@ -1197,8 +1417,8 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrm *pFrm,
{
case FRM_TXT:
mnPara++;
- pAcc = new SwAccessibleParagraph( this,
- static_cast< const SwTxtFrm * >( pFrm ) );
+ pAcc = new SwAccessibleParagraph( *this,
+ static_cast< const SwTxtFrm& >( *pFrm ) );
break;
case FRM_HEADER:
pAcc = new SwAccessibleHeaderFooter( this,
@@ -1458,10 +1678,12 @@ void SwAccessibleMap::RemoveContext( const SdrObject *pObj )
}
-void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
+void SwAccessibleMap::Dispose( const SwFrm *pFrm,
+ const SdrObject *pObj,
+ Window* pWindow,
sal_Bool bRecursive )
{
- SwFrmOrObj aFrmOrObj( pFrm, pObj );
+ SwAccessibleChild aFrmOrObj( pFrm, pObj, pWindow );
// Indeed, the following assert checks the frame's accessible flag,
// because that's the one that is evaluated in the layout. The frame
@@ -1470,11 +1692,11 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
ASSERT( !aFrmOrObj.GetSwFrm() || aFrmOrObj.GetSwFrm()->IsAccessibleFrm(),
"non accessible frame should be disposed" );
- ::vos::ORef< SwAccessibleContext > xAccImpl;
- ::vos::ORef< SwAccessibleContext > xParentAccImpl;
- ::vos::ORef< ::accessibility::AccessibleShape > xShapeAccImpl;
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
+ ::vos::ORef< SwAccessibleContext > xAccImpl;
+ ::vos::ORef< SwAccessibleContext > xParentAccImpl;
+ ::vos::ORef< ::accessibility::AccessibleShape > xShapeAccImpl;
// get accessible context for frame
{
vos::OGuard aGuard( maMutex );
@@ -1514,7 +1736,7 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
mpShapeMap )
{
SwAccessibleShapeMap_Impl::iterator aIter =
- mpShapeMap->find( aFrmOrObj.GetSdrObject() );
+ mpShapeMap->find( aFrmOrObj.GetDrawObject() );
if( aIter != mpShapeMap->end() )
{
uno::Reference < XAccessible > xAcc( (*aIter).second );
@@ -1574,7 +1796,7 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
}
else if( xShapeAccImpl.isValid() )
{
- RemoveContext( aFrmOrObj.GetSdrObject() );
+ RemoveContext( aFrmOrObj.GetDrawObject() );
xShapeAccImpl->dispose();
}
@@ -1585,9 +1807,10 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
const SdrObject *pObj,
+ Window* pWindow,
const SwRect& rOldBox )
{
- SwFrmOrObj aFrmOrObj( pFrm, pObj );
+ SwAccessibleChild aFrmOrObj( pFrm, pObj, pWindow );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
::vos::ORef< SwAccessibleContext > xAccImpl;
@@ -1669,7 +1892,7 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
void SwAccessibleMap::InvalidateContent( const SwFrm *pFrm )
{
- SwFrmOrObj aFrmOrObj( pFrm );
+ SwAccessibleChild aFrmOrObj( pFrm );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
uno::Reference < XAccessible > xAcc;
@@ -1708,7 +1931,7 @@ void SwAccessibleMap::InvalidateContent( const SwFrm *pFrm )
// --> OD 2009-01-06 #i88069#
void SwAccessibleMap::InvalidateAttr( const SwTxtFrm& rTxtFrm )
{
- SwFrmOrObj aFrmOrObj( &rTxtFrm );
+ SwAccessibleChild aFrmOrObj( &rTxtFrm );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
uno::Reference < XAccessible > xAcc;
@@ -1747,7 +1970,7 @@ void SwAccessibleMap::InvalidateAttr( const SwTxtFrm& rTxtFrm )
void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm )
{
- SwFrmOrObj aFrmOrObj( pFrm );
+ SwAccessibleChild aFrmOrObj( pFrm );
sal_Bool bShapeSelected = sal_False;
const ViewShell *pVSh = GetShell();
if( pVSh->ISA( SwCrsrShell ) )
@@ -1873,7 +2096,7 @@ void SwAccessibleMap::InvalidateStates( tAccessibleStates _nStates,
const SwFrm* _pFrm )
{
// Start with the frame or the first upper that is accessible
- SwFrmOrObj aFrmOrObj( _pFrm );
+ SwAccessibleChild aFrmOrObj( _pFrm );
while( aFrmOrObj.GetSwFrm() &&
!aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
aFrmOrObj = aFrmOrObj.GetSwFrm()->GetUpper();
@@ -1885,9 +2108,10 @@ void SwAccessibleMap::InvalidateStates( tAccessibleStates _nStates,
static_cast< SwAccessibleContext *>( xAcc.get() );
if( GetShell()->ActionPend() )
{
- SwAccessibleEvent_Impl aEvent(
- SwAccessibleEvent_Impl::CARET_OR_STATES, pAccImpl,
- pAccImpl->GetFrm(), _nStates );
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl,
+ SwAccessibleChild(pAccImpl->GetFrm()),
+ _nStates );
AppendEvent( aEvent );
}
else
@@ -1902,7 +2126,7 @@ void SwAccessibleMap::_InvalidateRelationSet( const SwFrm* pFrm,
sal_Bool bFrom )
{
// first, see if this frame is accessible, and if so, get the respective
- SwFrmOrObj aFrmOrObj( pFrm );
+ SwAccessibleChild aFrmOrObj( pFrm );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
uno::Reference < XAccessible > xAcc;
@@ -1927,9 +2151,11 @@ void SwAccessibleMap::_InvalidateRelationSet( const SwFrm* pFrm,
static_cast< SwAccessibleContext *>( xAcc.get() );
if( GetShell()->ActionPend() )
{
- SwAccessibleEvent_Impl aEvent(
- SwAccessibleEvent_Impl::CARET_OR_STATES, pAccImpl, pFrm,
- bFrom ? ACC_STATE_RELATION_FROM : ACC_STATE_RELATION_TO );
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl, SwAccessibleChild(pFrm),
+ ( bFrom
+ ? ACC_STATE_RELATION_FROM
+ : ACC_STATE_RELATION_TO ) );
AppendEvent( aEvent );
}
else
@@ -1971,7 +2197,7 @@ void SwAccessibleMap::InvalidateParaFlowRelation( const SwTxtFrm& _rTxtFrm,
void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm )
{
// first, see if this frame is accessible, and if so, get the respective
- SwFrmOrObj aFrmOrObj( &_rTxtFrm );
+ SwAccessibleChild aFrmOrObj( &_rTxtFrm );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
uno::Reference < XAccessible > xAcc;
@@ -1998,7 +2224,8 @@ void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm )
{
SwAccessibleEvent_Impl aEvent(
SwAccessibleEvent_Impl::CARET_OR_STATES,
- pAccImpl, &_rTxtFrm,
+ pAccImpl,
+ SwAccessibleChild( &_rTxtFrm ),
ACC_STATE_TEXT_SELECTION_CHANGED );
AppendEvent( aEvent );
}
@@ -2011,6 +2238,43 @@ void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm )
}
}
+sal_Int32 SwAccessibleMap::GetChildIndex( const SwFrm& rParentFrm,
+ Window& rChild ) const
+{
+ sal_Int32 nIndex( -1 );
+
+ SwAccessibleChild aFrmOrObj( &rParentFrm );
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ xAcc = (*aIter).second;
+ }
+ }
+ }
+
+ if( xAcc.is() )
+ {
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+
+ nIndex = pAccImpl->GetChildIndex( const_cast<SwAccessibleMap&>(*this),
+ SwAccessibleChild( &rChild ) );
+ }
+ }
+
+ return nIndex;
+}
+
+
// OD 15.01.2003 #103492# - complete re-factoring of method due to new page/print
// preview functionality.
void SwAccessibleMap::UpdatePreview( const std::vector<PrevwPage*>& _rPrevwPages,
@@ -2022,7 +2286,7 @@ void SwAccessibleMap::UpdatePreview( const std::vector<PrevwPage*>& _rPrevwPages
DBG_ASSERT( mpPreview != NULL, "no preview data?" );
// OD 15.01.2003 #103492# - adjustments for changed method signature
- mpPreview->Update( _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
+ mpPreview->Update( *this, _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
// propagate change of VisArea through the document's
// accessibility tree; this will also send appropriate scroll
@@ -2247,7 +2511,7 @@ sal_Bool SwAccessibleMap::ReplaceChild (
// Also get keep parent.
uno::Reference < XAccessible > xParent( pCurrentChild->getAccessibleParent() );
pCurrentChild = 0; // well be realease by dispose
- Dispose( 0, pObj );
+ Dispose( 0, pObj, 0 );
{
vos::OGuard aGuard( maMutex );
@@ -2284,7 +2548,7 @@ sal_Bool SwAccessibleMap::ReplaceChild (
}
SwRect aEmptyRect;
- InvalidatePosOrSize( 0, pObj, aEmptyRect );
+ InvalidatePosOrSize( 0, pObj, 0, aEmptyRect );
return sal_True;
}
@@ -2612,153 +2876,13 @@ void SwAccessibleMap::InvalidateTextSelectionOfAllParas()
}
}
-//
-// SwAccPreviewData
-//
-
-SwAccPreviewData::SwAccPreviewData() :
- mpSelPage( 0 )
-{
-}
-
-SwAccPreviewData::~SwAccPreviewData()
-{
-}
-
-// OD 13.01.2003 #103492# - complete re-factoring of method due to new page/print
-// preview functionality.
-void SwAccPreviewData::Update( const std::vector<PrevwPage*>& _rPrevwPages,
- const Fraction& _rScale,
- const SwPageFrm* _pSelectedPageFrm,
- const Size& _rPrevwWinSize )
+const SwRect& SwAccessibleMap::GetVisArea() const
{
- // store preview scaling, maximal preview page size and selected page
- maScale = _rScale;
- mpSelPage = _pSelectedPageFrm;
-
- // prepare loop on preview pages
- maPreviewRects.clear();
- maLogicRects.clear();
- SwFrmOrObj aPage;
- maVisArea.Clear();
+ DBG_ASSERT( !GetShell()->IsPreView() || (mpPreview != NULL),
+ "preview without preview data?" );
- // loop on preview pages to calculate <maPreviewRects>, <maLogicRects> and
- // <maVisArea>
- for ( std::vector<PrevwPage*>::const_iterator aPageIter = _rPrevwPages.begin();
- aPageIter != _rPrevwPages.end();
- ++aPageIter )
- {
- aPage = (*aPageIter)->pPage;
-
- // add preview page rectangle to <maPreviewRects>
- Rectangle aPrevwPgRect( (*aPageIter)->aPrevwWinPos, (*aPageIter)->aPageSize );
- maPreviewRects.push_back( aPrevwPgRect );
-
- // add logic page rectangle to <maLogicRects>
- SwRect aLogicPgSwRect( aPage.GetBox() );
- Rectangle aLogicPgRect( aLogicPgSwRect.SVRect() );
- maLogicRects.push_back( aLogicPgRect );
- // union visible area with visible part of logic page rectangle
- if ( (*aPageIter)->bVisible )
- {
- if ( !(*aPageIter)->pPage->IsEmptyPage() )
- {
- AdjustLogicPgRectToVisibleArea( aLogicPgSwRect,
- SwRect( aPrevwPgRect ),
- _rPrevwWinSize );
- }
- if ( maVisArea.IsEmpty() )
- maVisArea = aLogicPgSwRect;
- else
- maVisArea.Union( aLogicPgSwRect );
- }
- }
+ return GetShell()->IsPreView()
+ ? mpPreview->GetVisArea()
+ : GetShell()->VisArea();
}
-// OD 16.01.2003 #103492# - complete re-factoring of method due to new page/print
-// preview functionality.
-void SwAccPreviewData::InvalidateSelection( const SwPageFrm* _pSelectedPageFrm )
-{
- mpSelPage = _pSelectedPageFrm;
- ASSERT( mpSelPage, "selected page not found" );
-}
-
-struct ContainsPredicate
-{
- const Point& mrPoint;
- ContainsPredicate( const Point& rPoint ) : mrPoint(rPoint) {}
- bool operator() ( const Rectangle& rRect ) const
- {
- return rRect.IsInside( mrPoint ) ? true : false;
- }
-};
-
-const SwRect& SwAccPreviewData::GetVisArea() const
-{
- return maVisArea;
-}
-
-void SwAccPreviewData::AdjustMapMode( MapMode& rMapMode,
- const Point& rPoint ) const
-{
- // adjust scale
- rMapMode.SetScaleX( maScale );
- rMapMode.SetScaleY( maScale );
-
- // find proper rectangle
- Rectangles::const_iterator aBegin = maLogicRects.begin();
- Rectangles::const_iterator aEnd = maLogicRects.end();
- Rectangles::const_iterator aFound = ::std::find_if( aBegin, aEnd,
- ContainsPredicate( rPoint ) );
-
- if( aFound != aEnd )
- {
- // found! set new origin
- Point aPoint = (maPreviewRects.begin() + (aFound - aBegin))->TopLeft();
- aPoint -= (maLogicRects.begin() + (aFound-aBegin))->TopLeft();
- rMapMode.SetOrigin( aPoint );
- }
- // else: don't adjust MapMode
-}
-
-void SwAccPreviewData::DisposePage(const SwPageFrm *pPageFrm )
-{
- if( mpSelPage == pPageFrm )
- mpSelPage = 0;
-}
-
-/** adjust logic page retangle to its visible part
-
- OD 17.01.2003 #103492#
-
- @author OD
-*/
-void SwAccPreviewData::AdjustLogicPgRectToVisibleArea(
- SwRect& _iorLogicPgSwRect,
- const SwRect& _rPrevwPgSwRect,
- const Size& _rPrevwWinSize )
-{
- // determine preview window rectangle
- const SwRect aPrevwWinSwRect( Point( 0, 0 ), _rPrevwWinSize );
- // calculate visible preview page rectangle
- SwRect aVisPrevwPgSwRect( _rPrevwPgSwRect );
- aVisPrevwPgSwRect.Intersection( aPrevwWinSwRect );
- // adjust logic page rectangle
- SwTwips nTmpDiff;
- // left
- nTmpDiff = aVisPrevwPgSwRect.Left() - _rPrevwPgSwRect.Left();
- if ( nTmpDiff > 0 )
- _iorLogicPgSwRect.Left( _iorLogicPgSwRect.Left() + nTmpDiff );
- // top
- nTmpDiff = aVisPrevwPgSwRect.Top() - _rPrevwPgSwRect.Top();
- if ( nTmpDiff > 0 )
- _iorLogicPgSwRect.Top( _iorLogicPgSwRect.Top() + nTmpDiff );
- // right
- nTmpDiff = _rPrevwPgSwRect.Right() - aVisPrevwPgSwRect.Right();
- if ( nTmpDiff > 0 )
- _iorLogicPgSwRect.Right( _iorLogicPgSwRect.Right() - nTmpDiff );
- // bottom
- nTmpDiff = _rPrevwPgSwRect.Bottom() - aVisPrevwPgSwRect.Bottom();
- if ( nTmpDiff > 0 )
- _iorLogicPgSwRect.Bottom( _iorLogicPgSwRect.Bottom() - nTmpDiff );
-}
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 3961c8988351..368e076470ab 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -29,13 +29,14 @@
#include "precompiled_sw.hxx"
#include <txtfrm.hxx>
+#include <flyfrm.hxx>
#include <ndtxt.hxx>
#include <pam.hxx>
#include <unotextrange.hxx>
#include <unocrsrhelper.hxx>
#include <crstate.hxx>
#include <accmap.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <viewopt.hxx>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -51,56 +52,44 @@
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/beans/UnknownPropertyException.hpp>
#include <breakit.hxx>
-#include "accpara.hxx"
-#ifndef _ACCESS_HRC
-#include "access.hrc"
-#endif
-#include "accportions.hxx"
+#include <accpara.hxx>
+#include <access.hrc>
+#include <accportions.hxx>
#include <sfx2/viewsh.hxx> // for ExecuteAtViewShell(...)
#include <sfx2/viewfrm.hxx> // for ExecuteAtViewShell(...)
#include <sfx2/dispatch.hxx> // for ExecuteAtViewShell(...)
#include <unotools/charclass.hxx> // for GetWordBoundary
// for get/setCharacterAttribute(...)
-#include "unocrsr.hxx"
-#include "unoport.hxx"
-#include "doc.hxx"
-#include "crsskip.hxx"
+#include <unocrsr.hxx>
+//#include <unoobj.hxx>
+#include <unoport.hxx>
+#include <doc.hxx>
+#include <crsskip.hxx>
#include <txtatr.hxx>
#include <acchyperlink.hxx>
#include <acchypertextdata.hxx>
-// --> OD 2005-12-02 #i27138#
#include <unotools/accessiblerelationsethelper.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
-// <--
#include <comphelper/accessibletexthelper.hxx>
-// --> OD 2006-07-12 #i63870#
#include <unomap.hxx>
-// <--
-// --> OD 2007-01-15 #i72800#
#include <unoprnms.hxx>
-// <--
-// --> OD 2007-01-15 #i73371#
#include <com/sun/star/text/WritingMode2.hpp>
-// <--
-// --> OD 2007-01-17 #i71385#
#include <editeng/brshitem.hxx>
#include <viewimp.hxx>
-// <--
-// --> OD 2007-11-12 #i82637#
#include <boost/scoped_ptr.hpp>
-// <--
-// --> OD 2008-05-26 #i71360#
#include <textmarkuphelper.hxx>
+// --> OD 2010-02-22 #i10825#
+#include <parachangetrackinginfo.hxx>
+#include <com/sun/star/text/TextMarkupType.hpp>
+// <--
+// --> OD 2010-03-08 #i92233#
+#include <comphelper/stlunosequence.hxx>
// <--
#include <algorithm>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::i18n;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::accessibility;
-using ::rtl::OUString;
using beans::PropertyValue;
using beans::XMultiPropertySet;
@@ -132,15 +121,15 @@ const SwTxtNode* SwAccessibleParagraph::GetTxtNode() const
return pNode;
}
-OUString SwAccessibleParagraph::GetString()
+::rtl::OUString SwAccessibleParagraph::GetString()
{
return GetPortionData().GetAccessibleString();
}
-OUString SwAccessibleParagraph::GetDescription()
+::rtl::OUString SwAccessibleParagraph::GetDescription()
{
// --> OD 2004-09-29 #117933# - provide empty description for paragraphs
- return OUString();
+ return ::rtl::OUString();
// <--
}
@@ -389,11 +378,11 @@ void SwAccessibleParagraph::GetStates(
void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
{
- OUString sOldText( GetString() );
+ ::rtl::OUString sOldText( GetString() );
ClearPortionData();
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if( rText != sOldText )
{
@@ -425,8 +414,8 @@ void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
if( bNewIsHeading != bOldIsHeading || rText != sOldText )
{
- OUString sNewDesc( GetDescription() );
- OUString sOldDesc;
+ ::rtl::OUString sNewDesc( GetDescription() );
+ ::rtl::OUString sOldDesc;
{
vos::OGuard aGuard( aMutex );
sOldDesc = sDesc;
@@ -503,19 +492,27 @@ void SwAccessibleParagraph::_InvalidateFocus()
}
SwAccessibleParagraph::SwAccessibleParagraph(
- SwAccessibleMap* pInitMap,
- const SwTxtFrm *pTxtFrm ) :
- SwAccessibleContext( pInitMap, AccessibleRole::PARAGRAPH, pTxtFrm ),
- pPortionData( NULL ),
- pHyperTextData( NULL ),
- nOldCaretPos( -1 ),
- aSelectionHelper( *this )
+ SwAccessibleMap& rInitMap,
+ const SwTxtFrm& rTxtFrm )
+ // --> OD 2010-02-24 #i108125#
+ : SwClient( const_cast<SwTxtNode*>(rTxtFrm.GetTxtNode()) )
+ // <--
+ , SwAccessibleContext( &rInitMap, AccessibleRole::PARAGRAPH, &rTxtFrm )
+ , sDesc()
+ , pPortionData( NULL )
+ , pHyperTextData( NULL )
+ , nOldCaretPos( -1 )
+ , bIsHeading( sal_False )
+ , aSelectionHelper( *this )
+ // --> OD 2010-02-19 #i108125#
+ , mpParaChangeTrackInfo( new SwParaChangeTrackingInfo( rTxtFrm ) )
+ // <--
{
vos::OGuard aGuard(Application::GetSolarMutex());
bIsHeading = IsHeading();
// --> OD 2004-09-27 #117970# - set an empty accessibility name for paragraphs
- SetName( OUString() );
+ SetName( ::rtl::OUString() );
// <--
// If this object has the focus, then it is remembered by the map itself.
@@ -528,6 +525,9 @@ SwAccessibleParagraph::~SwAccessibleParagraph()
delete pPortionData;
delete pHyperTextData;
+ // --> OD 2010-02-22 #i108125#
+ delete mpParaChangeTrackInfo;
+ // <--
}
sal_Bool SwAccessibleParagraph::HasCursor()
@@ -648,8 +648,8 @@ sal_Bool SwAccessibleParagraph::IsValidRange(
sal_Bool SwAccessibleParagraph::GetCharBoundary(
- Boundary& rBound,
- const OUString&,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
sal_Int32 nPos )
{
rBound.startPos = nPos;
@@ -658,8 +658,8 @@ sal_Bool SwAccessibleParagraph::GetCharBoundary(
}
sal_Bool SwAccessibleParagraph::GetWordBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 nPos )
{
sal_Bool bRet = sal_False;
@@ -671,12 +671,12 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
{
// get locale for this position
USHORT nModelPos = GetPortionData().GetModelPosition( nPos );
- Locale aLocale = pBreakIt->GetLocale(
+ lang::Locale aLocale = pBreakIt->GetLocale(
GetTxtNode()->GetLang( nModelPos ) );
// which type of word are we interested in?
// (DICTIONARY_WORD includes punctuation, ANY_WORD doesn't.)
- const USHORT nWordType = WordType::ANY_WORD;
+ const USHORT nWordType = i18n::WordType::ANY_WORD;
// get word boundary, as the Break-Iterator sees fit.
rBound = pBreakIt->GetBreakIter()->getWordBoundary(
@@ -697,8 +697,8 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
}
sal_Bool SwAccessibleParagraph::GetSentenceBoundary(
- Boundary& rBound,
- const OUString&,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
sal_Int32 nPos )
{
GetPortionData().GetSentenceBoundary( rBound, nPos );
@@ -706,8 +706,8 @@ sal_Bool SwAccessibleParagraph::GetSentenceBoundary(
}
sal_Bool SwAccessibleParagraph::GetLineBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 nPos )
{
if( rText.getLength() == nPos )
@@ -718,8 +718,8 @@ sal_Bool SwAccessibleParagraph::GetLineBoundary(
}
sal_Bool SwAccessibleParagraph::GetParagraphBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 )
{
rBound.startPos = 0;
@@ -728,8 +728,8 @@ sal_Bool SwAccessibleParagraph::GetParagraphBoundary(
}
sal_Bool SwAccessibleParagraph::GetAttributeBoundary(
- Boundary& rBound,
- const OUString&,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
sal_Int32 nPos )
{
GetPortionData().GetAttributeBoundary( rBound, nPos );
@@ -737,8 +737,8 @@ sal_Bool SwAccessibleParagraph::GetAttributeBoundary(
}
sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 nPos )
{
sal_Bool bRet = sal_False;
@@ -751,11 +751,11 @@ sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
{
// get locale for this position
USHORT nModelPos = GetPortionData().GetModelPosition( nPos );
- Locale aLocale = pBreakIt->GetLocale(
+ lang::Locale aLocale = pBreakIt->GetLocale(
GetTxtNode()->GetLang( nModelPos ) );
// get word boundary, as the Break-Iterator sees fit.
- const USHORT nIterMode = CharacterIteratorMode::SKIPCELL;
+ const USHORT nIterMode = i18n::CharacterIteratorMode::SKIPCELL;
sal_Int32 nDone = 0;
rBound.endPos = pBreakIt->GetBreakIter()->nextCharacters(
rText, nPos, aLocale, nIterMode, 1, nDone );
@@ -777,20 +777,20 @@ sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
sal_Bool SwAccessibleParagraph::GetTextBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 nPos,
sal_Int16 nTextType )
throw (
- IndexOutOfBoundsException,
- IllegalArgumentException,
+ lang::IndexOutOfBoundsException,
+ lang::IllegalArgumentException,
uno::RuntimeException)
{
// error checking
if( !( AccessibleTextType::LINE == nTextType
? IsValidPosition( nPos, rText.getLength() )
: IsValidChar( nPos, rText.getLength() ) ) )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
sal_Bool bRet;
@@ -825,13 +825,13 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
break;
default:
- throw IllegalArgumentException( );
+ throw lang::IllegalArgumentException( );
}
return bRet;
}
-OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription (void)
+::rtl::OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription (void)
throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -845,7 +845,7 @@ OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription (void)
return sDesc;
}
-Locale SAL_CALL SwAccessibleParagraph::getLocale (void)
+lang::Locale SAL_CALL SwAccessibleParagraph::getLocale (void)
throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -857,7 +857,7 @@ Locale SAL_CALL SwAccessibleParagraph::getLocale (void)
}
const SwTxtNode *pTxtNd = pTxtFrm->GetTxtNode();
- Locale aLoc( pBreakIt->GetLocale( pTxtNd->GetLang( 0 ) ) );
+ lang::Locale aLoc( pBreakIt->GetLocale( pTxtNd->GetLang( 0 ) ) );
return aLoc;
}
@@ -1010,10 +1010,10 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getBackground()
}
// <--
-OUString SAL_CALL SwAccessibleParagraph::getImplementationName()
+::rtl::OUString SAL_CALL SwAccessibleParagraph::getImplementationName()
throw( uno::RuntimeException )
{
- return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
}
sal_Bool SAL_CALL SwAccessibleParagraph::supportsService(
@@ -1026,13 +1026,13 @@ sal_Bool SAL_CALL SwAccessibleParagraph::supportsService(
sizeof(sAccessibleServiceName)-1 );
}
-Sequence< OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNames()
+uno::Sequence< ::rtl::OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNames()
throw( uno::RuntimeException )
{
- Sequence< OUString > aRet(2);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
- pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ uno::Sequence< ::rtl::OUString > aRet(2);
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
return aRet;
}
@@ -1040,10 +1040,10 @@ Sequence< OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNames()
//===== XInterface =======================================================
//
-Any SwAccessibleParagraph::queryInterface( const Type& rType )
- throw (RuntimeException)
+uno::Any SwAccessibleParagraph::queryInterface( const uno::Type& rType )
+ throw (uno::RuntimeException)
{
- Any aRet;
+ uno::Any aRet;
if ( rType == ::getCppuType((uno::Reference<XAccessibleText> *)0) )
{
uno::Reference<XAccessibleText> aAccText = (XAccessibleText *) *this; // resolve ambiguity
@@ -1095,9 +1095,9 @@ Any SwAccessibleParagraph::queryInterface( const Type& rType )
}
//====== XTypeProvider ====================================================
-Sequence< Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(RuntimeException)
+uno::Sequence< uno::Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(uno::RuntimeException)
{
- Sequence< Type > aTypes( SwAccessibleContext::getTypes() );
+ uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() );
sal_Int32 nIndex = aTypes.getLength();
// --> OD 2006-07-13 #i63870#
@@ -1106,7 +1106,7 @@ Sequence< Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(RuntimeExcepti
// add type accessibility::XAccessibleTextMarkup and accessibility::XAccessibleMultiLineText
aTypes.realloc( nIndex + 6 );
- Type* pTypes = aTypes.getArray();
+ uno::Type* pTypes = aTypes.getArray();
pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleEditableText > * >( 0 ) );
pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleTextAttributes > * >( 0 ) );
pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
@@ -1118,11 +1118,11 @@ Sequence< Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(RuntimeExcepti
return aTypes;
}
-Sequence< sal_Int8 > SAL_CALL SwAccessibleParagraph::getImplementationId()
- throw(RuntimeException)
+uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleParagraph::getImplementationId()
+ throw(uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- static Sequence< sal_Int8 > aId( 16 );
+ static uno::Sequence< sal_Int8 > aId( 16 );
static sal_Bool bInit = sal_False;
if(!bInit)
{
@@ -1138,7 +1138,7 @@ Sequence< sal_Int8 > SAL_CALL SwAccessibleParagraph::getImplementationId()
//
sal_Int32 SwAccessibleParagraph::getCaretPosition()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1160,7 +1160,7 @@ sal_Int32 SwAccessibleParagraph::getCaretPosition()
}
sal_Bool SAL_CALL SwAccessibleParagraph::setCaretPosition( sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1170,7 +1170,7 @@ sal_Bool SAL_CALL SwAccessibleParagraph::setCaretPosition( sal_Int32 nIndex )
sal_Int32 nLength = GetString().getLength();
if ( ! IsValidPosition( nIndex, nLength ) )
{
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
sal_Bool bRet = sal_False;
@@ -1193,13 +1193,13 @@ sal_Bool SAL_CALL SwAccessibleParagraph::setCaretPosition( sal_Int32 nIndex )
}
sal_Unicode SwAccessibleParagraph::getCharacter( sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
- OUString sText( GetString() );
+ ::rtl::OUString sText( GetString() );
// return character (if valid)
if( IsValidChar(nIndex, sText.getLength() ) )
@@ -1207,25 +1207,25 @@ sal_Unicode SwAccessibleParagraph::getCharacter( sal_Int32 nIndex )
return sText.getStr()[nIndex];
}
else
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
// --> OD 2006-07-20 #i63870#
// re-implement method on behalf of methods <_getDefaultAttributesImpl(..)> and
// <_getRunAttributesImpl(..)>
-Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
+uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
sal_Int32 nIndex,
const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if( ! IsValidChar( nIndex, rText.getLength() ) )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
// retrieve default character attributes
tAccParaPropValMap aDefAttrSeq;
@@ -1236,7 +1236,7 @@ Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
_getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
// merge default and run attributes
- Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
+ uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
PropertyValue* pValues = aValues.getArray();
sal_Int32 i = 0;
for ( tAccParaPropValMap::const_iterator aDefIter = aDefAttrSeq.begin();
@@ -1354,7 +1354,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
const SfxPoolItem* pItem = pSet->GetItem( aPropIt->nWID );
if ( pItem )
{
- Any aVal;
+ uno::Any aVal;
pItem->QueryValue( aVal, aPropIt->nMemberId );
PropertyValue rPropVal;
@@ -1372,14 +1372,14 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
// add property value entry for the paragraph style
if ( !bOnlyCharAttrs && pTxtNode->GetTxtColl() )
{
- const OUString sParaStyleName =
- OUString::createFromAscii(
+ const ::rtl::OUString sParaStyleName =
+ ::rtl::OUString::createFromAscii(
GetPropName( UNO_NAME_PARA_STYLE_NAME ).pName );
if ( aDefAttrSeq.find( sParaStyleName ) == aDefAttrSeq.end() )
{
PropertyValue rPropVal;
rPropVal.Name = sParaStyleName;
- Any aVal( makeAny( OUString( pTxtNode->GetTxtColl()->GetName() ) ) );
+ uno::Any aVal( uno::makeAny( ::rtl::OUString( pTxtNode->GetTxtColl()->GetName() ) ) );
rPropVal.Value = aVal;
rPropVal.Handle = -1;
rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
@@ -1393,8 +1393,8 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
// resolve value text::WritingMode2::PAGE of property value entry WritingMode
if ( !bOnlyCharAttrs && GetFrm() )
{
- const OUString sWritingMode =
- OUString::createFromAscii(
+ const ::rtl::OUString sWritingMode =
+ ::rtl::OUString::createFromAscii(
GetPropName( UNO_NAME_WRITING_MODE ).pName );
tAccParaPropValMap::iterator aIter = aDefAttrSeq.find( sWritingMode );
if ( aIter != aDefAttrSeq.end() )
@@ -1447,7 +1447,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
}
else
{
- const OUString* pReqAttrs = aRequestedAttributes.getConstArray();
+ const ::rtl::OUString* pReqAttrs = aRequestedAttributes.getConstArray();
const sal_Int32 nLength = aRequestedAttributes.getLength();
for( sal_Int32 i = 0; i < nLength; ++i )
{
@@ -1460,8 +1460,8 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
}
}
-Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
- const Sequence< ::rtl::OUString >& aRequestedAttributes )
+uno::Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
throw ( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1470,7 +1470,30 @@ Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
tAccParaPropValMap aDefAttrSeq;
_getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq );
- Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
+ // --> OD 2010-03-08 #i92233#
+ static rtl::OUString sMMToPixelRatio( rtl::OUString::createFromAscii( "MMToPixelRatio" ) );
+ bool bProvideMMToPixelRatio( false );
+ {
+ if ( aRequestedAttributes.getLength() == 0 )
+ {
+ bProvideMMToPixelRatio = true;
+ }
+ else
+ {
+ const rtl::OUString* aRequestedAttrIter =
+ ::std::find( ::comphelper::stl_begin( aRequestedAttributes ),
+ ::comphelper::stl_end( aRequestedAttributes ),
+ sMMToPixelRatio );
+ if ( aRequestedAttrIter != ::comphelper::stl_end( aRequestedAttributes ) )
+ {
+ bProvideMMToPixelRatio = true;
+ }
+ }
+ }
+ // <--
+
+ uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() +
+ ( bProvideMMToPixelRatio ? 1 : 0 ) );
PropertyValue* pValues = aValues.getArray();
sal_Int32 i = 0;
for ( tAccParaPropValMap::const_iterator aIter = aDefAttrSeq.begin();
@@ -1481,6 +1504,21 @@ Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
++i;
}
+ // --> OD 2010-03-08 #i92233#
+ if ( bProvideMMToPixelRatio )
+ {
+ PropertyValue rPropVal;
+ rPropVal.Name = sMMToPixelRatio;
+ const Size a100thMMSize( 1000, 1000 );
+ const Size aPixelSize = GetMap()->LogicToPixel( a100thMMSize );
+ const float fRatio = ((float)a100thMMSize.Width()/100)/aPixelSize.Width();
+ rPropVal.Value = uno::makeAny( fRatio );
+ rPropVal.Handle = -1;
+ rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+ pValues[ aValues.getLength() - 1 ] = rPropVal;
+ }
+ // <--
+
return aValues;
}
@@ -1557,7 +1595,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
// the corresponding default character attributes, are excluded.
if ( aSet.GetItemState( aPropIt->nWID, TRUE, &pItem ) == SFX_ITEM_SET )
{
- Any aVal;
+ uno::Any aVal;
pItem->QueryValue( aVal, aPropIt->nMemberId );
PropertyValue rPropVal;
@@ -1585,7 +1623,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
}
else
{
- const OUString* pReqAttrs = aRequestedAttributes.getConstArray();
+ const ::rtl::OUString* pReqAttrs = aRequestedAttributes.getConstArray();
const sal_Int32 nLength = aRequestedAttributes.getLength();
for( sal_Int32 i = 0; i < nLength; ++i )
{
@@ -1601,27 +1639,27 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
delete pPaM;
}
-Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
+uno::Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
sal_Int32 nIndex,
- const Sequence< ::rtl::OUString >& aRequestedAttributes )
- throw ( IndexOutOfBoundsException,
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
{
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if ( !IsValidChar( nIndex, rText.getLength() ) )
{
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
}
tAccParaPropValMap aRunAttrSeq;
_getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
- Sequence< PropertyValue > aValues( aRunAttrSeq.size() );
+ uno::Sequence< PropertyValue > aValues( aRunAttrSeq.size() );
PropertyValue* pValues = aValues.getArray();
sal_Int32 i = 0;
for ( tAccParaPropValMap::const_iterator aIter = aRunAttrSeq.begin();
@@ -1638,7 +1676,7 @@ Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1649,7 +1687,7 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
IsValidChar -> IsValidPosition
*/
if( ! (IsValidPosition( nIndex, GetString().getLength() ) ) )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
/* #i12332# */
sal_Bool bBehindText = sal_False;
@@ -1689,7 +1727,7 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
Rectangle aScreenRect( GetMap()->CoreToPixel( aCoreRect.SVRect() ));
- SwRect aFrmLogBounds( GetBounds() ); // twip rel to doc root
+ SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
@@ -1701,7 +1739,7 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
}
sal_Int32 SwAccessibleParagraph::getCharacterCount()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1711,7 +1749,7 @@ sal_Int32 SwAccessibleParagraph::getCharacterCount()
}
sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1727,7 +1765,7 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
Window *pWin = GetWindow();
CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
Point aPoint( rPoint.X, rPoint.Y );
- SwRect aLogBounds( GetBounds( GetFrm() ) ); // twip rel to doc root
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
aPoint.X() += aPixPos.X();
aPoint.Y() += aPixPos.Y();
@@ -1787,8 +1825,8 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
: -1L;
}
-OUString SwAccessibleParagraph::getSelectedText()
- throw (RuntimeException)
+::rtl::OUString SwAccessibleParagraph::getSelectedText()
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1796,11 +1834,13 @@ OUString SwAccessibleParagraph::getSelectedText()
sal_Int32 nStart, nEnd;
sal_Bool bSelected = GetSelection( nStart, nEnd );
- return bSelected ? GetString().copy( nStart, nEnd - nStart ) : OUString();
+ return bSelected
+ ? GetString().copy( nStart, nEnd - nStart )
+ : ::rtl::OUString();
}
sal_Int32 SwAccessibleParagraph::getSelectionStart()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1812,7 +1852,7 @@ sal_Int32 SwAccessibleParagraph::getSelectionStart()
}
sal_Int32 SwAccessibleParagraph::getSelectionEnd()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1824,7 +1864,7 @@ sal_Int32 SwAccessibleParagraph::getSelectionEnd()
}
sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1834,7 +1874,7 @@ sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 n
sal_Int32 nLength = GetString().getLength();
if ( ! IsValidRange( nStartIndex, nEndIndex, nLength ) )
{
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
sal_Bool bRet = sal_False;
@@ -1859,8 +1899,8 @@ sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 n
return bRet;
}
-OUString SwAccessibleParagraph::getText()
- throw (RuntimeException)
+::rtl::OUString SwAccessibleParagraph::getText()
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1869,15 +1909,15 @@ OUString SwAccessibleParagraph::getText()
return GetString();
}
-OUString SwAccessibleParagraph::getTextRange(
+::rtl::OUString SwAccessibleParagraph::getTextRange(
sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
- OUString sText( GetString() );
+ ::rtl::OUString sText( GetString() );
if ( IsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
{
@@ -1885,7 +1925,7 @@ OUString SwAccessibleParagraph::getTextRange(
return sText.copy(nStartIndex, nEndIndex-nStartIndex );
}
else
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
/*accessibility::*/TextSegment SwAccessibleParagraph::getTextAtIndex( sal_Int32 nIndex, sal_Int16 nTextType ) throw (lang::IndexOutOfBoundsException, lang::IllegalArgumentException, uno::RuntimeException)
@@ -1898,7 +1938,7 @@ OUString SwAccessibleParagraph::getTextRange(
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
- const OUString rText = GetString();
+ const ::rtl::OUString rText = GetString();
// implement the silly specification that first position after
// text must return an empty string, rather than throwing an
// IndexOutOfBoundsException, except for LINE, where the last
@@ -1907,7 +1947,7 @@ OUString SwAccessibleParagraph::getTextRange(
return aResult;
// with error checking
- Boundary aBound;
+ i18n::Boundary aBound;
sal_Bool bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
DBG_ASSERT( aBound.startPos >= 0, "illegal boundary" );
@@ -1930,14 +1970,14 @@ OUString SwAccessibleParagraph::getTextRange(
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
- const OUString rText = GetString();
+ const ::rtl::OUString rText = GetString();
/*accessibility::*/TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
// get starting pos
- Boundary aBound;
+ i18n::Boundary aBound;
if (nIndex == rText.getLength())
aBound.startPos = aBound.endPos = nIndex;
else
@@ -1977,7 +2017,7 @@ OUString SwAccessibleParagraph::getTextRange(
/*accessibility::*/TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
- const OUString rText = GetString();
+ const ::rtl::OUString rText = GetString();
// implement the silly specification that first position after
// text must return an empty string, rather than throwing an
@@ -1987,7 +2027,7 @@ OUString SwAccessibleParagraph::getTextRange(
// get first word, then skip to next word
- Boundary aBound;
+ i18n::Boundary aBound;
GetTextBoundary( aBound, rText, nIndex, nTextType );
sal_Bool bWord = sal_False;
while( !bWord )
@@ -2009,7 +2049,7 @@ OUString SwAccessibleParagraph::getTextRange(
}
sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -2026,7 +2066,7 @@ sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
//
sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
CHECK_FOR_DEFUNC( XAccessibleEditableText );
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -2041,7 +2081,7 @@ sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIn
}
sal_Bool SwAccessibleParagraph::pasteText( sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
CHECK_FOR_DEFUNC( XAccessibleEditableText );
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -2056,27 +2096,27 @@ sal_Bool SwAccessibleParagraph::pasteText( sal_Int32 nIndex )
}
sal_Bool SwAccessibleParagraph::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- return replaceText( nStartIndex, nEndIndex, OUString() );
+ return replaceText( nStartIndex, nEndIndex, ::rtl::OUString() );
}
-sal_Bool SwAccessibleParagraph::insertText( const OUString& sText, sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+sal_Bool SwAccessibleParagraph::insertText( const ::rtl::OUString& sText, sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
return replaceText( nIndex, nIndex, sText );
}
sal_Bool SwAccessibleParagraph::replaceText(
sal_Int32 nStartIndex, sal_Int32 nEndIndex,
- const OUString& sReplacement )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ const ::rtl::OUString& sReplacement )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleEditableText );
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if( IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
{
@@ -2114,7 +2154,7 @@ sal_Bool SwAccessibleParagraph::replaceText(
return bSuccess;
}
else
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
struct IndexCompare
@@ -2131,16 +2171,16 @@ struct IndexCompare
sal_Bool SwAccessibleParagraph::setAttributes(
sal_Int32 nStartIndex,
sal_Int32 nEndIndex,
- const Sequence<PropertyValue>& rAttributeSet )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ const uno::Sequence<PropertyValue>& rAttributeSet )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleEditableText );
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if( ! IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
if( !IsEditableState() )
return sal_False;
@@ -2161,10 +2201,10 @@ sal_Bool SwAccessibleParagraph::setAttributes(
sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
// create sorted sequences accoring to index array
- Sequence<OUString> aNames( nLength );
- OUString* pNames = aNames.getArray();
- Sequence<Any> aValues( nLength );
- Any* pValues = aValues.getArray();
+ uno::Sequence< ::rtl::OUString > aNames( nLength );
+ ::rtl::OUString* pNames = aNames.getArray();
+ uno::Sequence< uno::Any > aValues( nLength );
+ uno::Any* pValues = aValues.getArray();
for( i = 0; i < nLength; i++ )
{
const PropertyValue& rVal = pPairs[pIndices[i]];
@@ -2188,8 +2228,8 @@ sal_Bool SwAccessibleParagraph::setAttributes(
return bRet;
}
-sal_Bool SwAccessibleParagraph::setText( const OUString& sText )
- throw (RuntimeException)
+sal_Bool SwAccessibleParagraph::setText( const ::rtl::OUString& sText )
+ throw (uno::RuntimeException)
{
return replaceText(0, GetString().getLength(), sText);
}
@@ -2198,7 +2238,7 @@ sal_Bool SwAccessibleParagraph::setText( const OUString& sText )
void SwAccessibleParagraph::selectAccessibleChild(
sal_Int32 nChildIndex )
- throw ( IndexOutOfBoundsException,
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException )
{
CHECK_FOR_DEFUNC( XAccessibleSelection );
@@ -2208,7 +2248,7 @@ void SwAccessibleParagraph::selectAccessibleChild(
sal_Bool SwAccessibleParagraph::isAccessibleChildSelected(
sal_Int32 nChildIndex )
- throw ( IndexOutOfBoundsException,
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException )
{
CHECK_FOR_DEFUNC( XAccessibleSelection );
@@ -2242,7 +2282,7 @@ sal_Int32 SwAccessibleParagraph::getSelectedAccessibleChildCount( )
uno::Reference<XAccessible> SwAccessibleParagraph::getSelectedAccessibleChild(
sal_Int32 nSelectedChildIndex )
- throw ( IndexOutOfBoundsException,
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException)
{
CHECK_FOR_DEFUNC( XAccessibleSelection );
@@ -2253,7 +2293,7 @@ uno::Reference<XAccessible> SwAccessibleParagraph::getSelectedAccessibleChild(
// --> OD 2004-11-16 #111714# - index has to be treated as global child index.
void SwAccessibleParagraph::deselectAccessibleChild(
sal_Int32 nChildIndex )
- throw ( IndexOutOfBoundsException,
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException )
{
CHECK_FOR_DEFUNC( XAccessibleSelection );
@@ -2315,7 +2355,7 @@ const SwTxtAttr *SwHyperlinkIter_Impl::next()
};
sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkCount()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -2337,7 +2377,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkCount()
uno::Reference< XAccessibleHyperlink > SAL_CALL
SwAccessibleParagraph::getHyperLink( sal_Int32 nLinkIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleHypertext );
@@ -2386,13 +2426,13 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
}
if( !xRet.is() )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
return xRet;
}
sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleHypertext );
@@ -2401,7 +2441,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde
sal_Int32 nLength = GetString().getLength();
if ( ! IsValidPosition( nCharIndex, nLength ) )
{
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
sal_Int32 nRet = -1;
@@ -2430,13 +2470,30 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde
}
// --> OD 2008-05-26 #i71360#
+// --> OD 2010-02-22 #i108125# - adjustments for change tracking text markup
sal_Int32 SAL_CALL SwAccessibleParagraph::getTextMarkupCount( sal_Int32 nTextMarkupType )
throw (lang::IllegalArgumentException,
uno::RuntimeException)
{
- SwTextMarkupHelper aTextMarkupHelper( *GetTxtNode(), GetPortionData() );
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
- return aTextMarkupHelper.getTextMarkupCount( nTextMarkupType );
+ return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
}
/*accessibility::*/TextSegment SAL_CALL
@@ -2446,9 +2503,25 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getTextMarkupCount( sal_Int32 nTextMar
lang::IllegalArgumentException,
uno::RuntimeException)
{
- SwTextMarkupHelper aTextMarkupHelper( *GetTxtNode(), GetPortionData() );
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
- return aTextMarkupHelper.getTextMarkup( nTextMarkupIndex, nTextMarkupType );
+ return pTextMarkupHelper->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
}
uno::Sequence< /*accessibility::*/TextSegment > SAL_CALL
@@ -2465,9 +2538,25 @@ uno::Sequence< /*accessibility::*/TextSegment > SAL_CALL
throw lang::IndexOutOfBoundsException();
}
- SwTextMarkupHelper aTextMarkupHelper( *GetTxtNode(), GetPortionData() );
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
- return aTextMarkupHelper.getTextMarkupAtIndex( nCharIndex, nTextMarkupType );
+ return pTextMarkupHelper->getTextMarkupAtIndex( nCharIndex, nTextMarkupType );
}
// <--
@@ -2499,7 +2588,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getLineNumberAtIndex( sal_Int32 nIndex
throw lang::IndexOutOfBoundsException();
}
- Boundary aLineBound;
+ i18n::Boundary aLineBound;
GetPortionData().GetBoundaryOfLine( nLineNo, aLineBound );
/*accessibility::*/TextSegment aTextAtLine;
@@ -2541,7 +2630,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
// special handling for cursor positioned at end of text line via End key
if ( nCaretPos != 0 )
{
- Boundary aLineBound;
+ i18n::Boundary aLineBound;
GetPortionData().GetBoundaryOfLine( nLineNo, aLineBound );
if ( nCaretPos == aLineBound.startPos )
{
@@ -2557,7 +2646,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
Rectangle aScreenRect( GetMap()->CoreToPixel( aCursorCoreRect.SVRect() ));
- SwRect aFrmLogBounds( GetBounds() ); // twip rel to doc root
+ SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
@@ -2579,4 +2668,11 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
return nLineNo;
}
+// --> OD 2010-02-19 #i108125#
+void SwAccessibleParagraph::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+{
+ mpParaChangeTrackInfo->reset();
+
+ SwClient::Modify( pOld, pNew );
+}
// <--
diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx
index 1a745d8af01e..7e07fa132d05 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -26,24 +26,19 @@
************************************************************************/
#ifndef _ACCPARA_HXX
#define _ACCPARA_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <acccontext.hxx>
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
-// --> OD 2008-05-19 #i71360#
#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp>
-// <--
-// --> OD 2008-05-29 #i89175#
#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
-// <--
-
-// --> OD 2006-07-11 #i63870#
#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
#include <hash_map>
+#include <accselectionhelper.hxx>
+// --> OD 2010-02-19 #i108125#
+#include <calbck.hxx>
// <--
-#include "accselectionhelper.hxx"
class SwTxtFrm;
class SwTxtNode;
@@ -51,6 +46,10 @@ class SwPaM;
class SwAccessiblePortionData;
class SwAccessibleHyperTextData;
class SwXTextPortion;
+// --> OD 2010-02-19 #i108125#
+class SwParaChangeTrackingInfo;
+// <--
+
namespace rtl { class OUString; }
namespace com { namespace sun { namespace star {
namespace i18n { struct Boundary; }
@@ -63,19 +62,16 @@ typedef ::std::hash_map< ::rtl::OUString,
::std::equal_to< ::rtl::OUString > > tAccParaPropValMap;
class SwAccessibleParagraph :
+ // --> OD 2010-02-19 #i108125#
+ public SwClient,
+ // <--
public SwAccessibleContext,
public ::com::sun::star::accessibility::XAccessibleEditableText,
public com::sun::star::accessibility::XAccessibleSelection,
public com::sun::star::accessibility::XAccessibleHypertext,
- // --> OD 2008-05-19 #i71360#
public com::sun::star::accessibility::XAccessibleTextMarkup,
- // <--
- // --> OD 2008-05-29 #i89175#
public com::sun::star::accessibility::XAccessibleMultiLineText,
- // <--
- // --> OD 2006-07-11 #i63870#
public ::com::sun::star::accessibility::XAccessibleTextAttributes
- // <--
{
friend class SwAccessibleHyperlink;
@@ -98,6 +94,9 @@ class SwAccessibleParagraph :
// implementation for XAccessibleSelection
SwAccessibleSelectionHelper aSelectionHelper;
+ // --> OD 2010-02-19 #i108125#
+ SwParaChangeTrackingInfo* mpParaChangeTrackInfo;
+ // <--
/// get the SwTxtNode (requires frame; check before)
const SwTxtNode* GetTxtNode() const;
@@ -237,13 +236,17 @@ protected:
public:
- SwAccessibleParagraph( SwAccessibleMap* pInitMap,
- const SwTxtFrm *pTxtFrm );
+ SwAccessibleParagraph( SwAccessibleMap& rInitMap,
+ const SwTxtFrm& rTxtFrm );
inline operator ::com::sun::star::accessibility::XAccessibleText *();
virtual sal_Bool HasCursor(); // required by map to remember that object
+ // --> OD 2010-02-19 #i108125#
+ virtual void Modify( SfxPoolItem* pOld, SfxPoolItem* pNew);
+ // <--
+
//===== XAccessibleContext ==============================================
/// Return this object's description.
diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx
index 31f05063263e..8e4593377c63 100644
--- a/sw/source/core/access/accselectionhelper.cxx
+++ b/sw/source/core/access/accselectionhelper.cxx
@@ -32,15 +32,14 @@
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <accselectionhelper.hxx>
-#ifndef _ACCCONTEXT_HXX
#include <acccontext.hxx>
-#endif
#include <accmap.hxx>
#include <svx/AccessibleShape.hxx>
#include <viewsh.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <vcl/svapp.hxx> // for SolarMutex
#include <tools/debug.hxx>
+#include <flyfrm.hxx>
using namespace ::com::sun::star;
@@ -50,7 +49,7 @@ using ::com::sun::star::accessibility::XAccessible;
using ::com::sun::star::accessibility::XAccessibleContext;
using ::com::sun::star::accessibility::XAccessibleSelection;
-
+using namespace ::sw::access;
SwAccessibleSelectionHelper::SwAccessibleSelectionHelper(
SwAccessibleContext& rCtxt ) :
@@ -100,7 +99,8 @@ void SwAccessibleSelectionHelper::selectAccessibleChild(
vos::OGuard aGuard(Application::GetSolarMutex());
// Get the respective child as SwFrm (also do index checking), ...
- const SwFrmOrObj aChild = rContext.GetChild( nChildIndex );
+ const SwAccessibleChild aChild = rContext.GetChild( *(rContext.GetMap()),
+ nChildIndex );
if( !aChild.IsValid() )
throwIndexOutOfBoundsException();
@@ -110,7 +110,7 @@ void SwAccessibleSelectionHelper::selectAccessibleChild(
SwFEShell* pFEShell = GetFEShell();
if( pFEShell != NULL )
{
- const SdrObject *pObj = aChild.GetSdrObject();
+ const SdrObject *pObj = aChild.GetDrawObject();
if( pObj )
{
bRet = rContext.Select( const_cast< SdrObject *>( pObj ), 0==aChild.GetSwFrm());
@@ -129,7 +129,8 @@ sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
vos::OGuard aGuard(Application::GetSolarMutex());
// Get the respective child as SwFrm (also do index checking), ...
- const SwFrmOrObj aChild = rContext.GetChild( nChildIndex );
+ const SwAccessibleChild aChild = rContext.GetChild( *(rContext.GetMap()),
+ nChildIndex );
if( !aChild.IsValid() )
throwIndexOutOfBoundsException();
@@ -138,13 +139,13 @@ sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
SwFEShell* pFEShell = GetFEShell();
if( pFEShell )
{
- if( aChild.GetSwFrm() != 0 )
+ if ( aChild.GetSwFrm() != 0 )
{
bRet = (pFEShell->GetCurrFlyFrm() == aChild.GetSwFrm());
}
- else
+ else if ( aChild.GetDrawObject() )
{
- bRet = pFEShell->IsObjSelected( *aChild.GetSdrObject() );
+ bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() );
}
}
@@ -168,15 +169,15 @@ void SwAccessibleSelectionHelper::selectAllAccessibleChildren( )
SwFEShell* pFEShell = GetFEShell();
if( pFEShell )
{
- ::std::list< SwFrmOrObj > aChildren;
- rContext.GetChildren( aChildren );
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
- ::std::list< SwFrmOrObj >::const_iterator aIter = aChildren.begin();
- ::std::list< SwFrmOrObj >::const_iterator aEndIter = aChildren.end();
+ ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end();
while( aIter != aEndIter )
{
- const SwFrmOrObj& rChild = *aIter;
- const SdrObject *pObj = rChild.GetSdrObject();
+ const SwAccessibleChild& rChild = *aIter;
+ const SdrObject* pObj = rChild.GetDrawObject();
const SwFrm* pFrm = rChild.GetSwFrm();
if( pObj && !(pFrm != 0 && pFEShell->IsObjSelected()) )
{
@@ -200,11 +201,11 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
SwFEShell* pFEShell = GetFEShell();
if( pFEShell != 0 )
{
- const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
+ const SwFlyFrm* pFlyFrm = pFEShell->GetCurrFlyFrm();
if( pFlyFrm )
{
- if( rContext.GetParent(pFlyFrm, rContext.IsInPagePreview()) ==
- rContext.GetFrm() )
+ if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
+ rContext.GetFrm() )
{
nCount = 1;
}
@@ -214,20 +215,20 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
sal_uInt16 nSelObjs = pFEShell->IsObjSelected();
if( nSelObjs > 0 )
{
- ::std::list< SwFrmOrObj > aChildren;
- rContext.GetChildren( aChildren );
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
- ::std::list< SwFrmOrObj >::const_iterator aIter =
+ ::std::list< SwAccessibleChild >::const_iterator aIter =
aChildren.begin();
- ::std::list< SwFrmOrObj >::const_iterator aEndIter =
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter =
aChildren.end();
while( aIter != aEndIter && nCount < nSelObjs )
{
- const SwFrmOrObj& rChild = *aIter;
- if( rChild.GetSdrObject() && !rChild.GetSwFrm() &&
+ const SwAccessibleChild& rChild = *aIter;
+ if( rChild.GetDrawObject() && !rChild.GetSwFrm() &&
rContext.GetParent(rChild, rContext.IsInPagePreview())
== rContext.GetFrm() &&
- pFEShell->IsObjSelected( *rChild.GetSdrObject() ) )
+ pFEShell->IsObjSelected( *rChild.GetDrawObject() ) )
{
nCount++;
}
@@ -254,12 +255,12 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
if( 0 == pFEShell )
throwIndexOutOfBoundsException();
- SwFrmOrObj aChild;
+ SwAccessibleChild aChild;
const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
if( pFlyFrm )
{
if( 0 == nSelectedChildIndex &&
- rContext.GetParent(pFlyFrm, rContext.IsInPagePreview()) ==
+ rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
rContext.GetFrm() )
{
aChild = pFlyFrm;
@@ -271,18 +272,18 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
if( 0 == nSelObjs || nSelectedChildIndex >= nSelObjs )
throwIndexOutOfBoundsException();
- ::std::list< SwFrmOrObj > aChildren;
- rContext.GetChildren( aChildren );
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
- ::std::list< SwFrmOrObj >::const_iterator aIter = aChildren.begin();
- ::std::list< SwFrmOrObj >::const_iterator aEndIter = aChildren.end();
+ ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end();
while( aIter != aEndIter && !aChild.IsValid() )
{
- const SwFrmOrObj& rChild = *aIter;
- if( rChild.GetSdrObject() && !rChild.GetSwFrm() &&
+ const SwAccessibleChild& rChild = *aIter;
+ if( rChild.GetDrawObject() && !rChild.GetSwFrm() &&
rContext.GetParent(rChild, rContext.IsInPagePreview()) ==
rContext.GetFrm() &&
- pFEShell->IsObjSelected( *rChild.GetSdrObject() ) )
+ pFEShell->IsObjSelected( *rChild.GetDrawObject() ) )
{
if( 0 == nSelectedChildIndex )
aChild = rChild;
@@ -309,10 +310,10 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
xChild = xChildImpl.getBodyPtr();
}
}
- else
+ else if ( aChild.GetDrawObject() )
{
::vos::ORef < ::accessibility::AccessibleShape > xChildImpl(
- rContext.GetMap()->GetContextImpl( aChild.GetSdrObject(),
+ rContext.GetMap()->GetContextImpl( aChild.GetDrawObject(),
&rContext, sal_True ) );
if( xChildImpl.isValid() )
xChild = xChildImpl.getBodyPtr();
@@ -328,6 +329,6 @@ void SwAccessibleSelectionHelper::deselectAccessibleChild(
{
// return sal_False // we can't deselect
if( nChildIndex < 0 ||
- nChildIndex >= rContext.GetChildCount() )
+ nChildIndex >= rContext.GetChildCount( *(rContext.GetMap()) ) )
throwIndexOutOfBoundsException();
}
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 667319058fa1..43befb2a3f86 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -42,26 +42,25 @@
#include <vcl/svapp.hxx>
#include <frmfmt.hxx>
#include <tabfrm.hxx>
-// --> OD 2007-06-27 #i77106#
#include <rowfrm.hxx>
-// <--
#include <cellfrm.hxx>
#include <swtable.hxx>
-#include "crsrsh.hxx"
-#include "viscrs.hxx"
+#include <crsrsh.hxx>
+#include <viscrs.hxx>
#include <hints.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <accfrmobjslist.hxx>
-#include "accmap.hxx"
-#ifndef _ACCESS_HRC
-#include "access.hrc"
-#endif
+#include <accmap.hxx>
+#include <access.hrc>
#include <acctable.hxx>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
+using namespace ::sw::access;
const sal_Char sServiceName[] = "com.sun.star.table.AccessibleTableView";
const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleTableView";
@@ -83,15 +82,14 @@ public:
class SwAccessibleTableData_Impl
{
+ SwAccessibleMap& mrAccMap;
Int32Set_Impl maRows;
Int32Set_Impl maColumns;
Int32PairList_Impl maExtents; // cell extends for event processing only
Point maTabFrmPos;
const SwTabFrm *mpTabFrm;
sal_Bool mbIsInPagePreview;
- // --> OD 2007-06-27 #i77106#
bool mbOnlyTableColumnHeader;
- // <--
void CollectData( const SwFrm *pFrm );
void CollectExtents( const SwFrm *pFrm );
@@ -114,7 +112,8 @@ class SwAccessibleTableData_Impl
public:
// --> OD 2007-06-27 #i77106#
// add third optional parameter <bOnlyTableColumnHeader>, default value <false>
- SwAccessibleTableData_Impl( const SwTabFrm *pTabFrm,
+ SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
+ const SwTabFrm *pTabFrm,
sal_Bool bIsInPagePreview,
bool bOnlyTableColumnHeader = false );
// <--
@@ -154,12 +153,12 @@ public:
void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
{
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
- SwFrmOrObjSList::const_iterator aEndIter( aList.end() );
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
while( aIter != aEndIter )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
if( pLower )
{
@@ -189,12 +188,12 @@ void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm )
{
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
- SwFrmOrObjSList::const_iterator aEndIter( aList.end() );
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
while( aIter != aEndIter )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
if( pLower )
{
@@ -230,12 +229,12 @@ sal_Bool SwAccessibleTableData_Impl::FindCell(
{
sal_Bool bFound = sal_False;
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
- SwFrmOrObjSList::const_iterator aEndIter( aList.end() );
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
while( !bFound && aIter != aEndIter )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
ASSERT( pLower, "child should be a frame" );
if( pLower )
@@ -282,15 +281,15 @@ void SwAccessibleTableData_Impl::GetSelection(
SwAccTableSelHander_Impl& rSelHdl,
sal_Bool bColumns ) const
{
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
- SwFrmOrObjSList::const_iterator aEndIter( aList.end() );
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
while( aIter != aEndIter )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
ASSERT( pLower, "child should be a frame" );
- const SwRect& rBox = rLower.GetBox();
+ const SwRect& rBox = rLower.GetBox( mrAccMap );
if( pLower && rBox.IsOver( rArea ) )
{
if( rLower.IsAccessible( mbIsInPagePreview ) )
@@ -430,15 +429,15 @@ sal_Bool SwAccessibleTableData_Impl::CompareExtents(
return sal_True;
}
-SwAccessibleTableData_Impl::SwAccessibleTableData_Impl( const SwTabFrm *pTabFrm,
+SwAccessibleTableData_Impl::SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
+ const SwTabFrm *pTabFrm,
sal_Bool bIsInPagePreview,
bool bOnlyTableColumnHeader )
- : maTabFrmPos( pTabFrm->Frm().Pos() ),
- mpTabFrm( pTabFrm ),
- mbIsInPagePreview( bIsInPagePreview ),
- // --> OD 2007-06-27 #i77106#
- mbOnlyTableColumnHeader( bOnlyTableColumnHeader )
- // <--
+ : mrAccMap( rAccMap )
+ , maTabFrmPos( pTabFrm->Frm().Pos() )
+ , mpTabFrm( pTabFrm )
+ , mbIsInPagePreview( bIsInPagePreview )
+ , mbOnlyTableColumnHeader( bOnlyTableColumnHeader )
{
CollectData( mpTabFrm );
CollectExtents( mpTabFrm );
@@ -641,7 +640,7 @@ const SwTableBox* SwAccessibleTable::GetTableBox( sal_Int32 nChildIndex ) const
const SwTableBox* pBox = NULL;
// get table box for 'our' table cell
- SwFrmOrObj aCell( GetChild( nChildIndex ) );
+ SwAccessibleChild aCell( GetChild( *(const_cast<SwAccessibleMap*>(GetMap())), nChildIndex ) );
if( aCell.GetSwFrm() )
{
const SwFrm* pChildFrm = aCell.GetSwFrm();
@@ -855,7 +854,7 @@ uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleTable::getImplementationId()
SwAccessibleTableData_Impl* SwAccessibleTable::CreateNewTableData()
{
const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
- return new SwAccessibleTableData_Impl( pTabFrm, IsInPagePreview() );
+ return new SwAccessibleTableData_Impl( *GetMap(), pTabFrm, IsInPagePreview() );
}
// <--
@@ -907,24 +906,72 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleRowDescription(
sal_Int32 nRow )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- // TODO: Is there any reasonable we can do here?
- OUString sTmpDesc;
+ // --> OD 2010-03-10 #i87532#
+ // determine table cell in <nRow>th row and in first column of row header table
+ // and return its text content.
+ OUString sRowDesc;
GetTableData().CheckRowAndCol(nRow, 0, this);
- return sTmpDesc;
+ uno::Reference< XAccessibleTable > xTableRowHeader = getAccessibleRowHeaders();
+ if ( xTableRowHeader.is() )
+ {
+ uno::Reference< XAccessible > xRowHeaderCell =
+ xTableRowHeader->getAccessibleCellAt( nRow, 0 );
+ ASSERT( xRowHeaderCell.is(),
+ "<SwAccessibleTable::getAccessibleRowDescription(..)> - missing row header cell -> serious issue." );
+ uno::Reference< XAccessibleContext > xRowHeaderCellContext =
+ xRowHeaderCell->getAccessibleContext();
+ const sal_Int32 nCellChildCount( xRowHeaderCellContext->getAccessibleChildCount() );
+ for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
+ {
+ uno::Reference< XAccessible > xChild = xRowHeaderCellContext->getAccessibleChild( nChildIndex );
+ uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
+ if ( xChildText.is() )
+ {
+ sRowDesc = sRowDesc + xChildText->getText();
+ }
+ }
+ }
+
+ return sRowDesc;
+ // <--
}
OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription(
sal_Int32 nColumn )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- // TODO: Is there any reasonable we can do here?
- OUString sTmpDesc;
+ // --> OD 2010-03-10 #i87532#
+ // determine table cell in first row and in <nColumn>th column of column header table
+ // and return its text content.
+ OUString sColumnDesc;
GetTableData().CheckRowAndCol(0, nColumn, this);
- return sTmpDesc;
+ uno::Reference< XAccessibleTable > xTableColumnHeader = getAccessibleColumnHeaders();
+ if ( xTableColumnHeader.is() )
+ {
+ uno::Reference< XAccessible > xColumnHeaderCell =
+ xTableColumnHeader->getAccessibleCellAt( 0, nColumn );
+ ASSERT( xColumnHeaderCell.is(),
+ "<SwAccessibleTable::getAccessibleColumnDescription(..)> - missing column header cell -> serious issue." );
+ uno::Reference< XAccessibleContext > xColumnHeaderCellContext =
+ xColumnHeaderCell->getAccessibleContext();
+ const sal_Int32 nCellChildCount( xColumnHeaderCellContext->getAccessibleChildCount() );
+ for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
+ {
+ uno::Reference< XAccessible > xChild = xColumnHeaderCellContext->getAccessibleChild( nChildIndex );
+ uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
+ if ( xChildText.is() )
+ {
+ sColumnDesc = sColumnDesc + xChildText->getText();
+ }
+ }
+ }
+
+ return sColumnDesc;
+ // <--
}
sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt(
@@ -1001,9 +1048,18 @@ uno::Reference< XAccessibleTable > SAL_CALL
SwAccessibleTable::getAccessibleColumnHeaders( )
throw (uno::RuntimeException)
{
- // --> OD 2007-06-29 #i77106#
- return new SwAccessibleTableColHeaders(
- GetMap(), static_cast< const SwTabFrm *>( GetFrm() ) );
+ // --> OD 2010-03-10 #i87532#
+ // assure that return accesible object is empty, if no column header exists.
+ SwAccessibleTableColHeaders* pTableColHeaders =
+ new SwAccessibleTableColHeaders( GetMap(), static_cast< const SwTabFrm *>( GetFrm() ) );
+ uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders );
+ if ( pTableColHeaders->getAccessibleChildCount() <= 0 )
+ {
+ return uno::Reference< XAccessibleTable >();
+ }
+
+ return xTableColumnHeaders;
+ // <--
}
uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows()
@@ -1176,9 +1232,11 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleIndex(
CHECK_FOR_DEFUNC( XAccessibleTable )
- SwFrmOrObj aCell( GetTableData().GetCell( nRow, nColumn, sal_False, this ));
- if( aCell.IsValid() )
- nRet = GetChildIndex( aCell );
+ SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, sal_False, this ));
+ if ( aCell.IsValid() )
+ {
+ nRet = GetChildIndex( *(GetMap()), aCell );
+ }
return nRet;
}
@@ -1200,8 +1258,8 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex )
}
// <--
- SwFrmOrObj aCell( GetChild( nChildIndex ) );
- if( aCell.GetSwFrm() )
+ SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
+ if ( aCell.GetSwFrm() )
{
sal_Int32 nTop = aCell.GetSwFrm()->Frm().Top();
nTop -= GetFrm()->Frm().Top();
@@ -1239,8 +1297,8 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumn(
}
// <--
- SwFrmOrObj aCell( GetChild( nChildIndex ) );
- if( aCell.GetSwFrm() )
+ SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
+ if ( aCell.GetSwFrm() )
{
sal_Int32 nLeft = aCell.GetSwFrm()->Frm().Left();
nLeft -= GetFrm()->Frm().Left();
@@ -1307,8 +1365,8 @@ void SwAccessibleTable::Dispose( sal_Bool bRecursive )
SwAccessibleContext::Dispose( bRecursive );
}
-void SwAccessibleTable::DisposeChild( const SwFrmOrObj& rChildFrmOrObj,
- sal_Bool bRecursive )
+void SwAccessibleTable::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
+ sal_Bool bRecursive )
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1330,7 +1388,7 @@ void SwAccessibleTable::DisposeChild( const SwFrmOrObj& rChildFrmOrObj,
SwAccessibleContext::DisposeChild( rChildFrmOrObj, bRecursive );
}
-void SwAccessibleTable::InvalidateChildPosOrSize( const SwFrmOrObj& rChildFrmOrObj,
+void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChildFrmOrObj,
const SwRect& rOldBox )
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1358,15 +1416,9 @@ void SwAccessibleTable::InvalidateChildPosOrSize( const SwFrmOrObj& rChildFrmOrO
}
}
- // There are two reason why this method has been called. The first one
- // is there is no context for pFrm. The method is them called by
- // the map, and we have to call our superclass.
- // The other situation is that we have been call by a call to get notified
- // about its change. We then must not call the superclass
- ASSERT( rChildFrmOrObj.GetSwFrm(), "frame expected" );
- uno::Reference< XAccessible > xAcc( GetMap()->GetContext( rChildFrmOrObj.GetSwFrm(), sal_False ) );
- if( !xAcc.is() )
- SwAccessibleContext::InvalidateChildPosOrSize( rChildFrmOrObj, rOldBox );
+ // --> OD 2010-02-18 #i013961# - always call super class method
+ SwAccessibleContext::InvalidateChildPosOrSize( rChildFrmOrObj, rOldBox );
+ // <--
}
@@ -1661,7 +1713,7 @@ SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2
SwAccessibleTableData_Impl* SwAccessibleTableColHeaders::CreateNewTableData()
{
const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
- return new SwAccessibleTableData_Impl( pTabFrm, IsInPagePreview(), true );
+ return new SwAccessibleTableData_Impl( *(GetMap()), pTabFrm, IsInPagePreview(), true );
}
@@ -1687,11 +1739,11 @@ sal_Int32 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount(void)
sal_Int32 nCount = 0;
const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
- const SwFrmOrObjSList aVisList( GetVisArea(), pTabFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pTabFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( IsInPagePreview() ) )
{
nCount++;
@@ -1702,7 +1754,8 @@ sal_Int32 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount(void)
if ( !rLower.GetSwFrm()->IsRowFrm() ||
pTabFrm->IsInHeadline( *(rLower.GetSwFrm()) ) )
{
- nCount += SwAccessibleFrame::GetChildCount( GetVisArea(),
+ nCount += SwAccessibleFrame::GetChildCount( *(GetMap()),
+ GetVisArea(),
rLower.GetSwFrm(),
IsInPagePreview() );
}
diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx
index d874c86bcf3b..8bdf2e8b49b2 100644
--- a/sw/source/core/access/acctable.hxx
+++ b/sw/source/core/access/acctable.hxx
@@ -29,13 +29,16 @@
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+#include <acccontext.hxx>
class SwTabFrm;
class SwAccessibleTableData_Impl;
class SwTableBox;
+class SwSelBoxes;
+
+namespace sw { namespace access {
+ class SwAccessibleChild;
+} }
class SwAccessibleTable :
public SwAccessibleContext,
@@ -218,9 +221,10 @@ public:
// The object is not visible an longer and should be destroyed
virtual void Dispose( sal_Bool bRecursive = sal_False );
- virtual void DisposeChild( const SwFrmOrObj& rFrmOrObj, sal_Bool bRecursive );
- virtual void InvalidateChildPosOrSize( const SwFrmOrObj& rFrmOrObj,
- const SwRect& rFrm );
+ virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj,
+ sal_Bool bRecursive );
+ virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
+ const SwRect& rFrm );
//===== XAccessibleSelection ============================================
diff --git a/sw/source/core/access/makefile.mk b/sw/source/core/access/makefile.mk
index 20ffdad32118..72871314f722 100644
--- a/sw/source/core/access/makefile.mk
+++ b/sw/source/core/access/makefile.mk
@@ -63,7 +63,8 @@ SLOFILES = \
$(SLO)$/accselectionhelper.obj \
$(SLO)$/acctable.obj \
$(SLO)$/acctextframe.obj \
- $(SLO)$/textmarkuphelper.obj
+ $(SLO)$/textmarkuphelper.obj \
+ $(SLO)$/parachangetrackinginfo.obj
EXCEPTIONSFILES= \
$(SLO)$/acccell.obj \
@@ -89,7 +90,8 @@ EXCEPTIONSFILES= \
$(SLO)$/accselectionhelper.obj \
$(SLO)$/acctable.obj \
$(SLO)$/acctextframe.obj \
- $(SLO)$/textmarkuphelper.obj
+ $(SLO)$/textmarkuphelper.obj \
+ $(SLO)$/parachangetrackinginfo.obj
# --- Targets -------------------------------------------------------
diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx
new file mode 100644
index 000000000000..7c1e25f05c93
--- /dev/null
+++ b/sw/source/core/access/parachangetrackinginfo.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sw.hxx"
+
+#include <parachangetrackinginfo.hxx>
+
+#include <errhdl.hxx>
+#include <wrong.hxx>
+#include <com/sun/star/text/TextMarkupType.hpp>
+
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <IDocumentRedlineAccess.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+
+namespace css = com::sun::star;
+
+namespace {
+ void initChangeTrackTextMarkupLists( const SwTxtFrm& rTxtFrm,
+ SwWrongList*& opChangeTrackInsertionTextMarkupList,
+ SwWrongList*& opChangeTrackDeletionTextMarkupList,
+ SwWrongList*& opChangeTrackFormatChangeTextMarkupList )
+ {
+ opChangeTrackInsertionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+ opChangeTrackDeletionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+ opChangeTrackFormatChangeTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+
+ if ( !rTxtFrm.GetTxtNode() )
+ {
+ ASSERT( false,
+ "<initChangeTrackTextMarkupLists(..) - missing <SwTxtNode> instance!" );
+ return;
+ }
+ const SwTxtNode& rTxtNode( *(rTxtFrm.GetTxtNode()) );
+
+ const IDocumentRedlineAccess* pIDocChangeTrack( rTxtNode.getIDocumentRedlineAccess() );
+ if ( !pIDocChangeTrack )
+ {
+ ASSERT( false,
+ "<initChangeTrackTextMarkupLists(..) - missing <IDocumentRedlineAccess> instance!" );
+ return;
+ }
+
+ if ( !IDocumentRedlineAccess::IsShowChanges( pIDocChangeTrack->GetRedlineMode() ) ||
+ pIDocChangeTrack->GetRedlineTbl().Count() == 0 )
+ {
+ // nothing to do --> empty change track text markup lists.
+ return;
+ }
+
+ const sal_uInt16 nIdxOfFirstRedlineForTxtNode =
+ pIDocChangeTrack->GetRedlinePos( rTxtNode, USHRT_MAX );
+ if ( nIdxOfFirstRedlineForTxtNode == USHRT_MAX )
+ {
+ // nothing to do --> empty change track text markup lists.
+ return;
+ }
+
+ const xub_StrLen nTxtFrmTextStartPos = rTxtFrm.IsFollow()
+ ? rTxtFrm.GetOfst()
+ : 0;
+ const xub_StrLen nTxtFrmTextEndPos = rTxtFrm.HasFollow()
+ ? rTxtFrm.GetFollow()->GetOfst()
+ : rTxtFrm.GetTxt().Len();
+
+ // iteration over the redlines which overlap with the text node.
+ const SwRedlineTbl& rRedlineTbl = pIDocChangeTrack->GetRedlineTbl();
+ const USHORT nRedlineCount( rRedlineTbl.Count() );
+ for ( sal_uInt16 nActRedline = nIdxOfFirstRedlineForTxtNode;
+ nActRedline < nRedlineCount;
+ ++nActRedline)
+ {
+ const SwRedline* pActRedline = rRedlineTbl[ nActRedline ];
+ if ( pActRedline->Start()->nNode > rTxtNode.GetIndex() )
+ {
+ break;
+ }
+
+ xub_StrLen nTxtNodeChangeTrackStart( STRING_LEN );
+ xub_StrLen nTxtNodeChangeTrackEnd( STRING_LEN );
+ pActRedline->CalcStartEnd( rTxtNode.GetIndex(),
+ nTxtNodeChangeTrackStart,
+ nTxtNodeChangeTrackEnd );
+ if ( nTxtNodeChangeTrackStart > nTxtFrmTextEndPos ||
+ nTxtNodeChangeTrackEnd < nTxtFrmTextStartPos )
+ {
+ // Consider only redlines which overlap with the text frame's text.
+ continue;
+ }
+
+ SwWrongList* pMarkupList( 0 );
+ switch ( pActRedline->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ {
+ pMarkupList = opChangeTrackInsertionTextMarkupList;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ {
+ pMarkupList = opChangeTrackDeletionTextMarkupList;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ {
+ pMarkupList = opChangeTrackFormatChangeTextMarkupList;
+ }
+ break;
+ default:
+ {
+ // other types are not considered
+ }
+ }
+ if ( pMarkupList )
+ {
+ const xub_StrLen nTxtFrmChangeTrackStart =
+ nTxtNodeChangeTrackStart <= nTxtFrmTextStartPos
+ ? nTxtFrmTextStartPos
+ : nTxtNodeChangeTrackStart;
+
+ const xub_StrLen nTxtFrmChangeTrackEnd =
+ nTxtNodeChangeTrackEnd >= nTxtFrmTextEndPos
+ ? nTxtFrmTextEndPos
+ : nTxtNodeChangeTrackEnd;
+
+ pMarkupList->Insert( rtl::OUString(), 0,
+ nTxtFrmChangeTrackStart,
+ nTxtFrmChangeTrackEnd - nTxtFrmChangeTrackStart,
+ pMarkupList->Count() );
+ }
+ } // eof iteration over the redlines which overlap with the text node
+ }
+} // eof anonymous namespace
+
+SwParaChangeTrackingInfo::SwParaChangeTrackingInfo( const SwTxtFrm& rTxtFrm )
+ : mrTxtFrm( rTxtFrm )
+ , mpChangeTrackInsertionTextMarkupList( 0 )
+ , mpChangeTrackDeletionTextMarkupList( 0 )
+ , mpChangeTrackFormatChangeTextMarkupList( 0 )
+{
+}
+
+
+SwParaChangeTrackingInfo::~SwParaChangeTrackingInfo()
+{
+ reset();
+}
+
+void SwParaChangeTrackingInfo::reset()
+{
+ delete mpChangeTrackInsertionTextMarkupList;
+ mpChangeTrackInsertionTextMarkupList = 0;
+
+ delete mpChangeTrackDeletionTextMarkupList;
+ mpChangeTrackDeletionTextMarkupList = 0;
+
+ delete mpChangeTrackFormatChangeTextMarkupList;
+ mpChangeTrackFormatChangeTextMarkupList = 0;
+}
+
+const SwWrongList* SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList( const sal_Int32 nTextMarkupType )
+{
+ SwWrongList* pChangeTrackingTextMarkupList = 0;
+
+ if ( mpChangeTrackInsertionTextMarkupList == 0 )
+ {
+ ASSERT( mpChangeTrackDeletionTextMarkupList == 0,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..) - <mpChangeTrackDeletionTextMarkupList> expected to be NULL." );
+ ASSERT( mpChangeTrackFormatChangeTextMarkupList == 0,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..) - <mpChangeTrackFormatChangeTextMarkupList> expected to be NULL." );
+ initChangeTrackTextMarkupLists( mrTxtFrm,
+ mpChangeTrackInsertionTextMarkupList,
+ mpChangeTrackDeletionTextMarkupList,
+ mpChangeTrackFormatChangeTextMarkupList );
+ }
+
+ switch ( nTextMarkupType )
+ {
+ case css::text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackInsertionTextMarkupList;
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_DELETION:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackDeletionTextMarkupList;
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackFormatChangeTextMarkupList;
+ }
+ break;
+ default:
+ {
+ ASSERT( false,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..)> - misusage - unexpected text markup type for change tracking." );
+ }
+ }
+
+ return pChangeTrackingTextMarkupList;
+}
diff --git a/sw/source/core/access/parachangetrackinginfo.hxx b/sw/source/core/access/parachangetrackinginfo.hxx
new file mode 100644
index 000000000000..91131f37b757
--- /dev/null
+++ b/sw/source/core/access/parachangetrackinginfo.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PARACHANGETRACKINGINFO_HXX_
+#define _PARACHANGETRACKINGINFO_HXX_
+
+#include <sal/types.h>
+
+class SwTxtFrm;
+class SwWrongList;
+
+class SwParaChangeTrackingInfo
+{
+ public:
+ explicit SwParaChangeTrackingInfo( const SwTxtFrm& rTxtFrm );
+ ~SwParaChangeTrackingInfo();
+
+ void reset();
+
+ const SwWrongList* getChangeTrackingTextMarkupList( const sal_Int32 nTextMarkupType );
+
+ private:
+ SwParaChangeTrackingInfo( const SwParaChangeTrackingInfo& );
+ SwParaChangeTrackingInfo& operator=( const SwParaChangeTrackingInfo& );
+
+ const SwTxtFrm& mrTxtFrm;
+
+ SwWrongList* mpChangeTrackInsertionTextMarkupList;
+ SwWrongList* mpChangeTrackDeletionTextMarkupList;
+ SwWrongList* mpChangeTrackFormatChangeTextMarkupList;
+};
+#endif
+
diff --git a/sw/source/core/access/textmarkuphelper.cxx b/sw/source/core/access/textmarkuphelper.cxx
index 0d92791ab29f..408a22ebd8ba 100644
--- a/sw/source/core/access/textmarkuphelper.cxx
+++ b/sw/source/core/access/textmarkuphelper.cxx
@@ -34,7 +34,7 @@
#include <algorithm>
#include <comphelper/stlunosequence.hxx>
-#include "errhdl.hxx"
+#include <errhdl.hxx>
#include <com/sun/star/text/TextMarkupType.hpp>
#include <com/sun/star/accessibility/TextSegment.hpp>
@@ -81,22 +81,39 @@ namespace {
}
}
-// implementation of calss <SwTextMarkupoHelper>
-SwTextMarkupHelper::SwTextMarkupHelper( const SwTxtNode& rTxtNode,
- const SwAccessiblePortionData& rPortionData )
- : mrTxtNode( rTxtNode ),
- mrPortionData( rPortionData )
+// implementation of class <SwTextMarkupoHelper>
+SwTextMarkupHelper::SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwTxtNode& rTxtNode )
+ : mrPortionData( rPortionData )
+ // --> OD 2010-02-19 #i108125#
+ , mpTxtNode( &rTxtNode )
+ , mpTextMarkupList( 0 )
+ // <--
{
}
-sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
+// --> OD 2010-02-19 #i108125#
+SwTextMarkupHelper::SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwWrongList& rTextMarkupList )
+ : mrPortionData( rPortionData )
+ , mpTxtNode( 0 )
+ , mpTextMarkupList( &rTextMarkupList )
+{
+}
+// <--
+
+sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException)
{
sal_Int32 nTextMarkupCount( 0 );
+ // --> OD 2010-02-19 #i108125#
const SwWrongList* pTextMarkupList =
- getTextMarkupList( mrTxtNode, nTextMarkupType );
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
if ( pTextMarkupList )
{
nTextMarkupCount = pTextMarkupList->Count();
@@ -105,8 +122,8 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
return nTextMarkupCount;
}
::com::sun::star::accessibility::TextSegment
- SwTextMarkupHelper::getTextMarkup( sal_Int32 nTextMarkupIndex,
- sal_Int32 nTextMarkupType )
+ SwTextMarkupHelper::getTextMarkup( const sal_Int32 nTextMarkupIndex,
+ const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException)
@@ -121,8 +138,12 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
aTextMarkupSegment.SegmentStart = -1;
aTextMarkupSegment.SegmentEnd = -1;
+ // --> OD 2010-02-19 #i108125#
const SwWrongList* pTextMarkupList =
- getTextMarkupList( mrTxtNode, nTextMarkupType );
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
if ( pTextMarkupList )
{
const SwWrongArea* pTextMarkup =
@@ -149,8 +170,8 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
}
::com::sun::star::uno::Sequence< ::com::sun::star::accessibility::TextSegment >
- SwTextMarkupHelper::getTextMarkupAtIndex( sal_Int32 nCharIndex,
- sal_Int32 nTextMarkupType )
+ SwTextMarkupHelper::getTextMarkupAtIndex( const sal_Int32 nCharIndex,
+ const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException)
@@ -166,9 +187,13 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
return uno::Sequence< ::com::sun::star::accessibility::TextSegment >();
}
- ::std::vector< ::com::sun::star::accessibility::TextSegment > aTmpTextMarkups;
+ // --> OD 2010-02-19 #i108125#
const SwWrongList* pTextMarkupList =
- getTextMarkupList( mrTxtNode, nTextMarkupType );
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
+ ::std::vector< ::com::sun::star::accessibility::TextSegment > aTmpTextMarkups;
if ( pTextMarkupList )
{
const ::rtl::OUString rText = mrPortionData.GetAccessibleString();
diff --git a/sw/source/core/access/textmarkuphelper.hxx b/sw/source/core/access/textmarkuphelper.hxx
index 64fbfec394d7..9b2bb519a2a1 100644
--- a/sw/source/core/access/textmarkuphelper.hxx
+++ b/sw/source/core/access/textmarkuphelper.hxx
@@ -37,30 +37,37 @@ namespace com { namespace sun { namespace star { namespace accessibility {
struct TextSegment;
} } } }
-class SwTxtNode;
class SwAccessiblePortionData;
+class SwTxtNode;
+// --> OD 2010-02-19 #i108125#
+class SwWrongList;
+// <--
class SwTextMarkupHelper
{
public:
- SwTextMarkupHelper( const SwTxtNode& rTxtNode,
- const SwAccessiblePortionData& rPortionData );
+ SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwTxtNode& rTxtNode );
+ // --> OD 2010-02-19 #i108125#
+ SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwWrongList& rTextMarkupList );
+ // <--
~SwTextMarkupHelper() {}
- sal_Int32 getTextMarkupCount( sal_Int32 nTextMarkupType )
+ sal_Int32 getTextMarkupCount( const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
::com::sun::star::accessibility::TextSegment getTextMarkup(
- sal_Int32 nTextMarkupIndex,
- sal_Int32 nTextMarkupType )
+ const sal_Int32 nTextMarkupIndex,
+ const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< ::com::sun::star::accessibility::TextSegment >
- getTextMarkupAtIndex( sal_Int32 nCharIndex,
- sal_Int32 nTextMarkupType )
+ getTextMarkupAtIndex( const sal_Int32 nCharIndex,
+ const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
@@ -69,8 +76,12 @@ class SwTextMarkupHelper
SwTextMarkupHelper( const SwTextMarkupHelper& );
SwTextMarkupHelper& operator=( const SwTextMarkupHelper& );
- const SwTxtNode& mrTxtNode;
const SwAccessiblePortionData& mrPortionData;
+
+ // --> OD 2010-02-19 #i108125#
+ const SwTxtNode* mpTxtNode;
+ const SwWrongList* mpTextMarkupList;
+ // <--
};
#endif
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index bb458ad49643..aeaeeeb300bc 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -48,7 +48,6 @@
#include <swundo.hxx>
#include <breakit.hxx>
-/*testarea*/
#include <docsh.hxx>
#include <PostItMgr.hxx>
#include <viewsh.hxx>
@@ -334,7 +333,7 @@ BYTE SwPaM::Find( const SearchOptions& rSearchOpt, BOOL bSearchInNotes , utl::Te
xub_StrLen aStart = 0;
// do we need to finish a note?
- if (POSTITMGR->GetActivePostIt())
+ if (POSTITMGR->HasActiveSidebarWin())
{
if (bSearchInNotes)
{
@@ -354,7 +353,7 @@ BYTE SwPaM::Find( const SearchOptions& rSearchOpt, BOOL bSearchInNotes , utl::Te
}
else
{
- POSTITMGR->SetActivePostIt(0);
+ POSTITMGR->SetActiveSidebarWin(0);
}
}
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 6e04d49afb3e..ceb7d6e3463c 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -947,8 +947,6 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
// Anker noch nicht gesetzt ?
// DrawObjecte duerfen niemals in Kopf-/Fusszeilen landen.
const bool bIsAtCntnt = (FLY_AT_PAGE != eAnchorId);
-// FLY_AT_CNTNT == eAnchorId || FLY_IN_CNTNT == eAnchorId ||
-// FLY_AT_FLY == eAnchorId || FLY_AUTO_CNTNT == eAnchorId;
const SwNodeIndex* pChkIdx = 0;
if( !pAnchor )
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 96f15ba22be8..f7242d1d8132 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -1004,10 +1004,6 @@ void SwDrawView::CheckPossibilities()
}
if ( pFrm )
bProtect = pFrm->IsProtected(); //Rahmen, Bereiche usw.
- // --> OD 2006-11-06 #130889# - make code robust
-// if ( FLY_IN_CNTNT == ::FindFrmFmt( (SdrObject*)pObj )->GetAnchor().GetAnchorId() &&
-// rMrkList.GetMarkCount() > 1 )
-// bProtect = TRUE;
{
SwFrmFmt* pFrmFmt( ::FindFrmFmt( const_cast<SdrObject*>(pObj) ) );
if ( !pFrmFmt )
@@ -1022,7 +1018,6 @@ void SwDrawView::CheckPossibilities()
bProtect = TRUE;
}
}
- // <--
}
bMoveProtect |= bProtect;
bResizeProtect |= bProtect | bSzProtect;
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index 964a5a11cce4..0c9f8f2980bf 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -32,7 +32,8 @@
#include <postithelper.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
+#include <AnnotationWin.hxx>
+
#include <fmtfld.hxx>
#include <txtfld.hxx>
#include <docufld.hxx>
@@ -41,12 +42,50 @@
#include <pagefrm.hxx>
#include <rootfrm.hxx>
#include <txtfrm.hxx>
+#include <tabfrm.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <redline.hxx>
#include <scriptinfo.hxx>
#include <editeng/charhiddenitem.hxx>
+namespace {
+
+struct LayoutInfoOrder
+{
+ bool operator()( const SwLayoutInfo& rLayoutInfo,
+ const SwLayoutInfo& rNewLayoutInfo )
+ {
+ if ( rLayoutInfo.mnPageNumber != rNewLayoutInfo.mnPageNumber )
+ {
+ // corresponding <SwFrm> instances are on different pages
+ return rLayoutInfo.mnPageNumber < rNewLayoutInfo.mnPageNumber;
+ }
+ else
+ {
+ // corresponding <SwFrm> instances are in different repeating table header rows
+ ASSERT( rLayoutInfo.mpAnchorFrm->FindTabFrm(),
+ "<LayoutInfoOrder::operator()> - table frame not found" );
+ ASSERT( rNewLayoutInfo.mpAnchorFrm->FindTabFrm(),
+ "<LayoutInfoOrder::operator()> - table frame not found" );
+ const SwTabFrm* pLayoutInfoTabFrm( rLayoutInfo.mpAnchorFrm->FindTabFrm() );
+ const SwTabFrm* pNewLayoutInfoTabFrm( rNewLayoutInfo.mpAnchorFrm->FindTabFrm() );
+ const SwTabFrm* pTmpTabFrm( pNewLayoutInfoTabFrm );
+ while ( pTmpTabFrm && pTmpTabFrm->GetFollow() )
+ {
+ pTmpTabFrm = static_cast<const SwTabFrm*>(pTmpTabFrm->GetFollow()->GetFrm());
+ if ( pTmpTabFrm == pLayoutInfoTabFrm )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+};
+
+} // eof anonymous namespace
+
SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLayoutInfo >& rInfo, SwPosition& rPos )
{
SwLayoutStatus aRet = INVISIBLE;
@@ -67,11 +106,12 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLa
{
SwLayoutInfo aInfo;
pTxtFrm->GetCharRect( aInfo.mPosition, rPos, 0 );
+ aInfo.mpAnchorFrm = pTxtFrm;
aInfo.mPageFrame = pPage->Frm();
aInfo.mPagePrtArea = pPage->Prt();
aInfo.mPagePrtArea.Pos() += aInfo.mPageFrame.Pos();
aInfo.mnPageNumber = pPage->GetPhyPageNum();
- aInfo.mbMarginSide = pPage->MarginSide();
+ aInfo.meSidebarPosition = pPage->SidebarPosition();
aInfo.mRedlineAuthor = 0;
if( aRet == INVISIBLE )
@@ -91,7 +131,14 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLa
}
}
}
- rInfo.push_back( aInfo );
+
+ {
+ std::vector< SwLayoutInfo >::iterator aInsPosIter =
+ std::lower_bound( rInfo.begin(), rInfo.end(),
+ aInfo, LayoutInfoOrder() );
+
+ rInfo.insert( aInsPosIter, aInfo );
+ }
}
}
}
@@ -142,7 +189,7 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLa
return aRet;
}
-SwPosition SwPostItItem::GetPosition()
+SwPosition SwAnnotationItem::GetAnchorPosition() const
{
SwTxtFld* pFld = pFmtFld->GetTxtFld();
//if( pFld )
@@ -157,23 +204,30 @@ SwPosition SwPostItItem::GetPosition()
//}
}
-bool SwPostItItem::UseElement()
+bool SwAnnotationItem::UseElement()
{
return pFmtFld->IsFldInDoc();
}
-SwMarginWin* SwPostItItem::GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
+sw::sidebarwindows::SwSidebarWin* SwAnnotationItem::GetSidebarWindow(
+ SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits)
{
- return new SwPostIt(pParent,nBits,pFmtFld,aMgr,aBits);
+ return new sw::annotation::SwAnnotationWin( rEditWin, nBits,
+ aMgr, aBits,
+ *this,
+ pFmtFld );
}
/*
-SwPosition SwRedCommentItem::GetPosition()
+SwPosition SwRedCommentItem::GetAnchorPosition()
{
return *pRedline->Start();
}
-SwMarginWin* SwRedCommentItem::GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
+SwSidebarWin* SwRedCommentItem::GetSidebarWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
{
return new SwRedComment(pParent,nBits,aMgr,aBits,pRedline);
}
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index a0d9141778cb..0dc721a62f12 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1801,11 +1801,6 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const
else
eType = OBJCNT_FLY;
}
- // --> OD 2006-11-06 #130889# - make code robust
-// else if( pInvestigatedObj->ISA( SdrObjGroup ) &&
-// FLY_IN_CNTNT !=
-// ((SwDrawContact*)GetUserCall(pInvestigatedObj))->GetFmt()->GetAnchor().GetAnchorId() )
-// eType = OBJCNT_GROUPOBJ;
else if ( pInvestigatedObj->ISA( SdrObjGroup ) )
{
SwDrawContact* pDrawContact( dynamic_cast<SwDrawContact*>(GetUserCall( pInvestigatedObj ) ) );
@@ -1830,7 +1825,6 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const
}
}
}
- // <--
else
eType = OBJCNT_SIMPLE;
return eType;
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 7242ca411616..190cb5ecdf36 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -2322,12 +2322,6 @@ bool SwFEShell::IsGroupAllowed() const
else
pUpGroup = pObj->GetUpGroup();
- // --> OD 2006-11-06 #130889# - make code robust
-// if ( bIsGroupAllowed &&
-// FLY_IN_CNTNT == ::FindFrmFmt( (SdrObject*)pObj )->GetAnchor().GetAnchorId() )
-// {
-// bIsGroupAllowed = false;
-// }
if ( bIsGroupAllowed )
{
SwFrmFmt* pFrmFmt( ::FindFrmFmt( const_cast<SdrObject*>(pObj) ) );
@@ -2342,7 +2336,6 @@ bool SwFEShell::IsGroupAllowed() const
bIsGroupAllowed = false;
}
}
- // <--
// OD 27.06.2003 #108784# - check, if all selected objects are in the
// same header/footer or not in header/footer.
diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx
index f737cecafd65..fb479fc86549 100644
--- a/sw/source/core/inc/cellfrm.hxx
+++ b/sw/source/core/inc/cellfrm.hxx
@@ -51,6 +51,10 @@ public:
virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const;
virtual void CheckDirection( BOOL bVert );
+ // --> OD 2010-02-17 #i103961#
+ virtual void Cut();
+ // <--
+
const SwTableBox *GetTabBox() const { return pTabBox; }
// used for breaking table rows:
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 35e2ad6853bb..bc2fef9b8be4 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -33,6 +33,8 @@
#include "ftnboss.hxx"
#include <tools/mempool.hxx>
+#include <SidebarWindowsTypes.hxx>
+
class SwFlyFrm;
class SwFlyFrmFmt;
class SwPageDesc;
@@ -383,7 +385,7 @@ public:
static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
ViewShell* _pViewShell,
SwRect& _orBorderAndShadowBoundRect,
- bool bRightSidebar );
+ const bool bRightSidebar );
static void PaintNotesSidebar(const SwRect& _rPageRect, ViewShell* _pViewShell, USHORT nPageNum, bool bRight);
static void PaintNotesSidebarArrows(const Point &aMiddleFirst, const Point &aMiddleSecond, ViewShell* _pViewShell, const Color aColorUp, const Color aColorDown);
@@ -393,7 +395,7 @@ public:
asks the page on which side a margin should be shown, e.g for notes
returns true for left side, false for right side
*/
- bool MarginSide() const;
+ sw::sidebarwindows::SidebarPosition SidebarPosition() const;
virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const;
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index 38fb3e2bac7a..0f89b3b75663 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -35,8 +35,8 @@
#include <tools/string.hxx>
-#include "swtypes.hxx"
-#include "swrect.hxx"
+#include <swtypes.hxx>
+#include <swrect.hxx>
class ViewShell;
class SwFlyFrm;
@@ -54,17 +54,10 @@ class SwAccessibleMap;
class SdrObject;
class Fraction;
class SwPrtOptions;
-// OD 12.12.2002 #103492#
class SwPagePreviewLayout;
-// OD 15.01.2003 #103492#
-#ifndef _PREVWPAGE_HXX
-#include <prevwpage.hxx>
-#endif
-// OD 15.01.2003 #103492#
+struct PrevwPage;
#include <vector>
-// --> OD 2005-12-01 #i27138#
class SwTxtFrm;
-// <--
class SwViewImp
{
@@ -175,7 +168,7 @@ private:
*/
void _InvalidateAccessibleParaTextSelection();
- /** invalidate attributes for paragraphs
+ /** invalidate attributes for paragraphs and paragraph's characters
OD 2009-01-06 #i88069#
implementation for wrapper method
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index 5c16c1171397..2f8c8047c96e 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -57,7 +57,13 @@ public:
: maType(rType), mxPropertyBag(xPropertyBag), mnPos(nPos), mnLen(nLen), mpSubList(pSubList) {}
};
-enum WrongListType { WRONGLIST_SPELL, WRONGLIST_GRAMMAR, WRONGLIST_SMARTTAG };
+enum WrongListType
+{
+ WRONGLIST_SPELL,
+ WRONGLIST_GRAMMAR,
+ WRONGLIST_SMARTTAG,
+ WRONGLIST_CHANGETRACKING
+};
class SwWrongList
{
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 14bc23bb97a4..1475a3909220 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1460,15 +1460,23 @@ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect )
//mod #i6193# added sidebar width
const SwPostItMgr* pPostItMgr = pImp->GetShell()->GetPostItMgr();
const int nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ? pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() : 0;
- if (pPageFrm->MarginSide())
+ switch ( pPageFrm->SidebarPosition() )
{
- aPaint.Left( aPaint.Left() - nBorderWidth - nSidebarWidth);
- aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth);
- }
- else
- {
- aPaint.Left( aPaint.Left() - nBorderWidth );
- aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth + nSidebarWidth);
+ case sw::sidebarwindows::SIDEBAR_LEFT:
+ {
+ aPaint.Left( aPaint.Left() - nBorderWidth - nSidebarWidth);
+ aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth);
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_RIGHT:
+ {
+ aPaint.Left( aPaint.Left() - nBorderWidth );
+ aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth + nSidebarWidth);
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_NONE:
+ // nothing to do
+ break;
}
aPaint.Top( aPaint.Top() - nBorderWidth );
aPaint.Bottom( aPaint.Bottom() + nBorderWidth + nShadowWidth);
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index a2d32b3ab3bc..72976a786fa1 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -300,7 +300,7 @@ SwPageFrm::~SwPageFrm()
pImp->GetLayAction().SetAgain();
// OD 12.02.2003 #i9719#, #105645# - retouche area of page
// including border and shadow area.
- const bool bRightSidebar = !MarginSide();
+ const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT);
SwRect aRetoucheRect;
SwPageFrm::GetBorderAndShadowBoundRect( Frm(), pSh, aRetoucheRect, bRightSidebar );
pSh->AddPaintRect( aRetoucheRect );
@@ -655,7 +655,7 @@ void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew,
{
// OD 12.02.2003 #i9719#, #105645# - consider border and shadow of
// page frame for determine 'old' rectangle - it's used for invalidating.
- const bool bRightSidebar = !MarginSide();
+ const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT);
SwRect aOldRectWithBorderAndShadow;
SwPageFrm::GetBorderAndShadowBoundRect( aOldPageFrmRect, pSh, aOldRectWithBorderAndShadow, bRightSidebar );
pSh->InvalidateWindows( aOldRectWithBorderAndShadow );
@@ -1386,17 +1386,19 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn )
}
// false = right, true = left
-bool SwPageFrm::MarginSide() const
+sw::sidebarwindows::SidebarPosition SwPageFrm::SidebarPosition() const
{
if (!GetShell() || GetShell()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
- return false;
+ return sw::sidebarwindows::SIDEBAR_NONE;
else
{
const bool bLTR = GetUpper() ? static_cast<const SwRootFrm*>(GetUpper())->IsLeftToRightViewLayout() : true;
const bool bBookMode = GetShell()->GetViewOptions()->IsViewLayoutBookMode();
const bool bRightSidebar = bLTR ? (!bBookMode || OnRightPage()) : (bBookMode && !OnRightPage());
- return !bRightSidebar;
+ return bRightSidebar
+ ? sw::sidebarwindows::SIDEBAR_RIGHT
+ : sw::sidebarwindows::SIDEBAR_LEFT;
}
}
@@ -2310,7 +2312,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
const SwTwips nCurrentPageWidth = pFormatPage->Frm().Width() + (pFormatPage->IsEmptyPage() ? 0 : nSidebarWidth);
const Point aOldPagePos = pPageToAdjust->Frm().Pos();
- const bool bLeftSidebar = pPageToAdjust->MarginSide();
+ const bool bLeftSidebar = pPageToAdjust->SidebarPosition() == sw::sidebarwindows::SIDEBAR_LEFT;
const SwTwips nLeftPageAddOffset = bLeftSidebar ?
nSidebarWidth :
0;
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ee9671ac869f..09fc6b00e03d 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2838,7 +2838,7 @@ void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con
// <--
{
const bool bPaintRightShadow = !bBookMode || (pPage == Lower()) || (!bLTR && !pPage->OnRightPage()) || (bLTR && pPage->OnRightPage());
- const bool bRightSidebar = !pPage->MarginSide();
+ const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
if ( !pPage->IsEmptyPage() )
{
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c3bccc695934..f912be5cb9b1 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4773,6 +4773,30 @@ void SwRowFrm::Cut()
{
pTab->FindMaster()->InvalidatePos();
}
+
+ // --> OD 2010-02-17 #i103961#
+ // notification for accessibility
+ {
+ SwRootFrm *pRootFrm = FindRootFrm();
+ if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
+ {
+ ViewShell* pVSh = pRootFrm->GetCurrShell();
+ if ( pVSh && pVSh->Imp() )
+ {
+ SwFrm* pCellFrm( GetLower() );
+ while ( pCellFrm )
+ {
+ ASSERT( pCellFrm->IsCellFrm(),
+ "<SwRowFrm::Cut()> - unexpected type of SwRowFrm lower." );
+ pVSh->Imp()->DisposeAccessibleFrm( pCellFrm );
+
+ pCellFrm = pCellFrm->GetNext();
+ }
+ }
+ }
+ }
+ // <--
+
SwLayoutFrm::Cut();
}
@@ -5652,15 +5676,25 @@ long SwCellFrm::GetLayoutRowSpan() const
return nRet;
}
-/*************************************************************************
-|*
-|* SwCellFrm::Modify()
-|*
-|* Ersterstellung MA 20. Dec. 96
-|* Letzte Aenderung MA 20. Dec. 96
-|*
-|*************************************************************************/
+// --> OD 2010-02-17 #i103961#
+void SwCellFrm::Cut()
+{
+ // notification for accessibility
+ {
+ SwRootFrm *pRootFrm = FindRootFrm();
+ if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
+ {
+ ViewShell* pVSh = pRootFrm->GetCurrShell();
+ if ( pVSh && pVSh->Imp() )
+ {
+ pVSh->Imp()->DisposeAccessibleFrm( this );
+ }
+ }
+ }
+ SwLayoutFrm::Cut();
+}
+// <--
//
// Helper functions for repeated headlines:
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 5aff2f71b0d5..ade3efd4e70d 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -768,28 +768,6 @@ void SwFrm::Remove()
{
ASSERT( pUpper, "Removen ohne Upper?" );
- // --> OD 2004-09-27 #114344# - inform accessibility API - dispose table the
- // frame is in - before frame is 'removed from the layout' and
- // only for cell frames and row frames.
- if ( IsInTab() && ( IsRowFrm() || IsCellFrm() ) )
- {
- SwTabFrm* pTableFrm = FindTabFrm();
- if( pTableFrm != NULL &&
- pTableFrm->IsAccessibleFrm() &&
- pTableFrm->GetFmt() != NULL )
- {
- SwRootFrm *pRootFrm = pTableFrm->FindRootFrm();
- if( pRootFrm != NULL &&
- pRootFrm->IsAnyShellAccessible() )
- {
- ViewShell* pShell = pRootFrm->GetCurrShell();
- if( pShell != NULL )
- pShell->Imp()->DisposeAccessibleFrm( pTableFrm, sal_True );
- }
- }
- }
- // <--
-
if( pPrev )
// einer aus der Mitte wird removed
pPrev->pNext = pNext;
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 6c48aeeb181d..db245de1e28b 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -2341,84 +2341,6 @@ SwRect SwTxtFly::AnchoredObjToRect( const SwAnchoredObject* pAnchoredObj,
// Beidseitiger Umfluss bis zu einer Rahmenbreite von maximal 1,5 cm
#define FRAME_MAX 850
-//_FlyCntnt SwTxtFly::CalcSmart( const SdrObject *pObj ) const
-//{
-// _FlyCntnt eOrder;
-
-// // 11839: Nur die X-Positionen sind interessant, die Y-Positionen des
-// // CurrentFrames koennen sich noch aendern (wachsen).
-
-// SWRECTFN( pCurrFrm )
-// const long nCurrLeft = (pCurrFrm->*fnRect->fnGetPrtLeft)();
-// const long nCurrRight = (pCurrFrm->*fnRect->fnGetPrtRight)();
-// const SwRect aRect( GetBoundRect( pObj ) );
-// long nFlyLeft = (aRect.*fnRect->fnGetLeft)();
-// long nFlyRight = (aRect.*fnRect->fnGetRight)();
-
-// if ( nFlyRight < nCurrLeft || nFlyLeft > nCurrRight )
-// eOrder = SURROUND_PARALLEL;
-// else
-// {
-// long nLeft = nFlyLeft - nCurrLeft;
-// long nRight = nCurrRight - nFlyRight;
-// if( nFlyRight - nFlyLeft > FRAME_MAX )
-// {
-// if( nLeft < nRight )
-// nLeft = 0;
-// else
-// nRight = 0;
-// }
-// if( nLeft < TEXT_MIN )
-// nLeft = 0;
-// if( nRight < TEXT_MIN )
-// nRight = 0;
-// if( nLeft )
-// eOrder = nRight ? SURROUND_PARALLEL : SURROUND_LEFT;
-// else
-// eOrder = nRight ? SURROUND_RIGHT: SURROUND_NONE;
-// }
-
-// return eOrder;
-//}
-
-/*************************************************************************
- * SwTxtFly::GetOrder()
- *************************************************************************/
-
-//_FlyCntnt SwTxtFly::GetOrder( const SdrObject *pObj ) const
-//{
-// const SwFrmFmt *pFmt = ((SwContact*)GetUserCall(pObj))->GetFmt();
-// const SwFmtSurround &rFlyFmt = pFmt->GetSurround();
-// _FlyCntnt eOrder = rFlyFmt.GetSurround();
-
-// if( rFlyFmt.IsAnchorOnly() && &lcl_TheAnchor( pObj ) != GetMaster() )
-// {
-// const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
-// if( FLY_AT_CNTNT == rAnchor.GetAnchorId() ||
-// FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
-// return SURROUND_NONE;
-// }
-
-// Beim Durchlauf und Nowrap wird smart ignoriert.
-// if( SURROUND_THROUGHT == eOrder || SURROUND_NONE == eOrder )
-// return eOrder;
-
-// left is left and right is right
-// if ( pCurrFrm->IsRightToLeft() )
-// {
-// if ( SURROUND_LEFT == eOrder )
-// eOrder = SURROUND_RIGHT;
-// else if ( SURROUND_RIGHT == eOrder )
-// eOrder = SURROUND_LEFT;
-// }
-
-// "idealer Seitenumlauf":
-// if( SURROUND_IDEAL == eOrder )
-// eOrder = CalcSmart( pObj ); //Bei SMART wird die Order automatisch berechnet:
-
-// return eOrder;
-//}
-
SwSurround SwTxtFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchoredObj ) const
{
const SwFrmFmt* pFmt = &(pAnchoredObj->GetFrmFmt());
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 16fbc589c16d..0861f98b2ddf 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1026,6 +1026,13 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
SET_SCRIPT_INVAL( nPos )
}
}
+
+ // --> OD 2010-02-16 #i104008#
+ if ( GetShell() )
+ {
+ GetShell()->InvalidateAccessibleParaAttrs( *this );
+ }
+ // <--
}
break;
case RES_OBJECTDYING:
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 04bc229627a9..b2d91c48f598 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -430,7 +430,7 @@ void SwViewImp::DisposeAccessible( const SwFrm *pFrm,
do
{
if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().Dispose( pFrm, pObj, bRecursive );
+ pTmp->Imp()->GetAccessibleMap().Dispose( pFrm, pObj, 0, bRecursive );
pTmp = (ViewShell *)pTmp->GetNext();
} while ( pTmp != pVSh );
}
@@ -444,7 +444,7 @@ void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
do
{
if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().InvalidatePosOrSize( pFrm, pObj,
+ pTmp->Imp()->GetAccessibleMap().InvalidatePosOrSize( pFrm, pObj, 0,
rOldFrm );
pTmp = (ViewShell *)pTmp->GetNext();
} while ( pTmp != pVSh );
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 08aae426fd8c..156447fda9da 100755
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1231,16 +1231,23 @@ void ViewShell::VisPortChgd( const SwRect &rRect)
SwTwips nPageLeft = 0;
SwTwips nPageRight = 0;
- if (pPage->MarginSide())
+ switch ( pPage->SidebarPosition() )
{
- nPageLeft = aPageRect.Left() - nBorderWidth - nSidebarWidth;
- nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth;
- }
- else
- {
- // OD 03.03.2003 #107927# - use correct datatype
- nPageLeft = aPageRect.Left() - nBorderWidth;
- nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth + nSidebarWidth;
+ case sw::sidebarwindows::SIDEBAR_LEFT:
+ {
+ nPageLeft = aPageRect.Left() - nBorderWidth - nSidebarWidth;
+ nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth;
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_RIGHT:
+ {
+ nPageLeft = aPageRect.Left() - nBorderWidth;
+ nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth + nSidebarWidth;
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_NONE:
+ // nothing to do
+ break;
}
if( nPageLeft < nMinLeft )
nMinLeft = nPageLeft;
@@ -1310,6 +1317,15 @@ void ViewShell::VisPortChgd( const SwRect &rRect)
}
GetWin()->Update();
+ // --> OD 2010-02-11 #i88070#
+ if ( pPostItMgr )
+ {
+ pPostItMgr->Rescale();
+ pPostItMgr->CalcRects();
+ pPostItMgr->LayoutPostIts();
+ }
+ // <--
+
if ( !bScrolled && pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
pPostItMgr->CorrectPositions();
@@ -1708,7 +1724,8 @@ void ViewShell::PaintDesktop( const SwRect &rRect )
aPageRect.SSize() = rFormatPage.Frm().SSize();
}
- const bool bSidebarRight = !static_cast<const SwPageFrm*>(pPage)->MarginSide();
+ const bool bSidebarRight =
+ static_cast<const SwPageFrm*>(pPage)->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
aPageRect.Pos().X() -= bSidebarRight ? 0 : nSidebarWidth;
aPageRect.SSize().Width() += nSidebarWidth;
@@ -2591,6 +2608,15 @@ void ViewShell::InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm )
}
}
+SwAccessibleMap* ViewShell::GetAccessibleMap()
+{
+ if ( Imp()->IsAccessible() )
+ {
+ return &(Imp()->GetAccessibleMap());
+ }
+
+ return 0;
+}
/* -----------------------------06.05.2002 13:23------------------------------
---------------------------------------------------------------------------*/
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index ba3879aad165..2cf1ca325a5b 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -1679,7 +1679,7 @@ SfxItemSet* SwFltOutBase::NewFlyDefaults()
return p;
}
-BOOL SwFltOutBase::BeginFly( RndStdIds eAnchor /*= FLY_AT_CNTNT*/,
+BOOL SwFltOutBase::BeginFly( RndStdIds eAnchor /*= FLY_AT_PARA*/,
BOOL bAbsolutePos /*= FALSE*/,
const SfxItemSet*
#ifdef DBG_UTIL
@@ -1731,7 +1731,7 @@ SwFrmFmt* SwFltOutDoc::MakeFly( RndStdIds eAnchor, SfxItemSet* pSet )
return pFly;
}
-BOOL SwFltOutDoc::BeginFly( RndStdIds eAnchor /*= FLY_AT_CNTNT*/,
+BOOL SwFltOutDoc::BeginFly( RndStdIds eAnchor /*= FLY_AT_PARA*/,
BOOL bAbsolutePos /*= FALSE*/,
const SfxItemSet* pMoreAttrs /*= 0*/ )
@@ -1837,7 +1837,7 @@ void SwFltOutDoc::EndFly()
return GetDoc().GetAttrPool().GetDefaultItem(nWhich);
}
-BOOL SwFltFormatCollection::BeginFly( RndStdIds eAnchor /*= FLY_AT_CNTNT*/,
+BOOL SwFltFormatCollection::BeginFly( RndStdIds eAnchor /*= FLY_AT_PARA*/,
BOOL bAbsolutePos /*= FALSE*/,
const SfxItemSet* pMoreAttrs /*= 0*/ )
@@ -1865,7 +1865,7 @@ BOOL SwFltFormatCollection::BeginStyleFly( SwFltOutDoc* pOutDoc )
// Flys in SwFltShell
//-----------------------------------------------------------------------------
-BOOL SwFltShell::BeginFly( RndStdIds eAnchor /*= FLY_AT_CNTNT*/,
+BOOL SwFltShell::BeginFly( RndStdIds eAnchor /*= FLY_AT_PARA*/,
BOOL bAbsolutePos /*= FALSE*/ )
{
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index a290e8f30790..3cf85185b434 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3245,7 +3245,7 @@ SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage,
nSwNumLevel = nWwNumType = 0xff;
pTableDesc = 0;
pNumOlst = 0;
- pNode_FLY_AT_CNTNT = 0;
+ pNode_FLY_AT_PARA = 0;
pDrawModel = 0;
pDrawPg = 0;
mpDrawEditEngine = 0;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 099ecca83d6a..0473f3c1431e 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -977,7 +977,7 @@ private:
ANLDRuleMap maANLDRules;
WW8_OLST* pNumOlst; // Gliederung im Text
- SwNode* pNode_FLY_AT_CNTNT; // set: WW8SwFlyPara() read: CreateSwTable()
+ SwNode* pNode_FLY_AT_PARA; // set: WW8SwFlyPara() read: CreateSwTable()
SdrModel* pDrawModel;
SdrPage* pDrawPg;
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 1f932e6a93bd..34ccac06a256 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -69,7 +69,6 @@
#include <view.hxx> // fuer die aktuelle Sicht
#include <edtwin.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
#include <wrtsh.hxx> // Verbindung zur Core
#include <docsh.hxx> // Dokumenterzeugung
#include <basesh.hxx>
@@ -429,8 +428,12 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium )
pView->GetEditWin().StopQuickHelp();
//#i91811# mod if we have an active margin window, write back the text
- if (pView && pView->GetPostItMgr() && pView->GetPostItMgr()->GetActivePostIt())
- pView->GetPostItMgr()->GetActivePostIt()->UpdateData();
+ if ( pView &&
+ pView->GetPostItMgr() &&
+ pView->GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
+ }
if( pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) &&
!pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS) )
@@ -575,8 +578,12 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium )
pView->GetEditWin().StopQuickHelp();
//#i91811# mod if we have an active margin window, write back the text
- if (pView && pView->GetPostItMgr() && pView->GetPostItMgr()->GetActivePostIt())
- pView->GetPostItMgr()->GetActivePostIt()->UpdateData();
+ if ( pView &&
+ pView->GetPostItMgr() &&
+ pView->GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
+ }
ULONG nVBWarning = 0;
diff --git a/sw/source/ui/docvw/AnchorOverlayObject.cxx b/sw/source/ui/docvw/AnchorOverlayObject.cxx
new file mode 100644
index 000000000000..53afaf625710
--- /dev/null
+++ b/sw/source/ui/docvw/AnchorOverlayObject.cxx
@@ -0,0 +1,467 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postit.cxx,v $
+ * $Revision: 1.8.42.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <AnchorOverlayObject.hxx>
+#include <SidebarWindowsConsts.hxx>
+
+#include <swrect.hxx>
+#include <view.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+//////////////////////////////////////////////////////////////////////////////
+// helper class: Primitive for discrete visualisation
+
+class AnchorPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
+{
+private:
+ basegfx::B2DPolygon maTriangle;
+ basegfx::B2DPolygon maLine;
+ basegfx::B2DPolygon maLineTop;
+ const AnchorState maAnchorState;
+ basegfx::BColor maColor;
+
+ // discrete line width
+ double mfLogicLineWidth;
+
+ // bitfield
+ bool mbShadow : 1;
+ bool mbLineSolid : 1;
+
+protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
+
+public:
+ AnchorPrimitive( const basegfx::B2DPolygon& rTriangle,
+ const basegfx::B2DPolygon& rLine,
+ const basegfx::B2DPolygon& rLineTop,
+ AnchorState aAnchorState,
+ const basegfx::BColor& rColor,
+ double fLogicLineWidth,
+ bool bShadow,
+ bool bLineSolid )
+ : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
+ maTriangle(rTriangle),
+ maLine(rLine),
+ maLineTop(rLineTop),
+ maAnchorState(aAnchorState),
+ maColor(rColor),
+ mfLogicLineWidth(fLogicLineWidth),
+ mbShadow(bShadow),
+ mbLineSolid(bLineSolid)
+ {}
+
+ // data access
+ const basegfx::B2DPolygon& getTriangle() const { return maTriangle; }
+ const basegfx::B2DPolygon& getLine() const { return maLine; }
+ const basegfx::B2DPolygon& getLineTop() const { return maLineTop; }
+ const AnchorState getAnchorState() const { return maAnchorState; }
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getLogicLineWidth() const { return mfLogicLineWidth; }
+ bool getShadow() const { return mbShadow; }
+ bool getLineSolid() const { return mbLineSolid; }
+
+ virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+};
+
+drawinglayer::primitive2d::Primitive2DSequence AnchorPrimitive::create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if ( AS_TRI == maAnchorState ||
+ AS_ALL == maAnchorState ||
+ AS_START == maAnchorState )
+ {
+ // create triangle
+ const drawinglayer::primitive2d::Primitive2DReference aTriangle(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(getTriangle()),
+ getColor()));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aTriangle);
+ }
+
+ if ( AS_ALL == maAnchorState ||
+ AS_START == maAnchorState )
+ {
+ // create line start
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ getColor(),
+ getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
+
+ if(getLineSolid())
+ {
+ const drawinglayer::primitive2d::Primitive2DReference aSolidLine(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLine(),
+ aLineAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aSolidLine);
+ }
+ else
+ {
+ ::std::vector< double > aDotDashArray;
+ const double fDistance(3.0 * 15.0);
+ const double fDashLen(5.0 * 15.0);
+
+ aDotDashArray.push_back(fDashLen);
+ aDotDashArray.push_back(fDistance);
+
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
+ aDotDashArray,
+ fDistance + fDashLen);
+
+ const drawinglayer::primitive2d::Primitive2DReference aStrokedLine(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLine(),
+ aLineAttribute,
+ aStrokeAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aStrokedLine);
+ }
+ }
+
+ if(aRetval.hasElements() && getShadow())
+ {
+ // shadow is only for triangle and line start, and in upper left
+ // and lower right direction, in different colors
+ const double fColorChange(20.0 / 255.0);
+ const basegfx::B3DTuple aColorChange(fColorChange, fColorChange, fColorChange);
+ basegfx::BColor aLighterColor(getColor() + aColorChange);
+ basegfx::BColor aDarkerColor(getColor() - aColorChange);
+
+ aLighterColor.clamp();
+ aDarkerColor.clamp();
+
+ // create shadow sequence
+ drawinglayer::primitive2d::Primitive2DSequence aShadows(2);
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.set(0, 2, -getDiscreteUnit());
+ aTransform.set(1, 2, -getDiscreteUnit());
+
+ aShadows[0] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::ShadowPrimitive2D(
+ aTransform,
+ aLighterColor,
+ aRetval));
+
+ aTransform.set(0, 2, getDiscreteUnit());
+ aTransform.set(1, 2, getDiscreteUnit());
+
+ aShadows[1] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::ShadowPrimitive2D(
+ aTransform,
+ aDarkerColor,
+ aRetval));
+
+ // add shadow before geometry to make it be proccessed first
+ const drawinglayer::primitive2d::Primitive2DSequence aTemporary(aRetval);
+
+ aRetval = aShadows;
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemporary);
+ }
+
+ if ( AS_ALL == maAnchorState ||
+ AS_END == maAnchorState )
+ {
+ // LineTop has to be created, too, but uses no shadow, so add after
+ // the other parts are created
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ getColor(),
+ getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
+
+ const drawinglayer::primitive2d::Primitive2DReference aLineTop(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLineTop(),
+ aLineAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aLineTop);
+ }
+
+ return aRetval;
+}
+
+bool AnchorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
+{
+ if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const AnchorPrimitive& rCompare = static_cast< const AnchorPrimitive& >(rPrimitive);
+
+ return (getTriangle() == rCompare.getTriangle()
+ && getLine() == rCompare.getLine()
+ && getLineTop() == rCompare.getLineTop()
+ && getAnchorState() == rCompare.getAnchorState()
+ && getColor() == rCompare.getColor()
+ && getLogicLineWidth() == rCompare.getLogicLineWidth()
+ && getShadow() == rCompare.getShadow()
+ && getLineSolid() == rCompare.getLineSolid());
+ }
+
+ return false;
+}
+
+ImplPrimitrive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
+
+/****** AnchorOverlayObject ***********************************************************/
+/*static*/ AnchorOverlayObject* AnchorOverlayObject::CreateAnchorOverlayObject(
+ SwView& rDocView,
+ const SwRect& aAnchorRect,
+ const long& aPageBorder,
+ const Point& aLineStart,
+ const Point& aLineEnd,
+ const Color& aColorAnchor )
+{
+ AnchorOverlayObject* pAnchorOverlayObject( 0 );
+ if ( rDocView.GetDrawView() )
+ {
+ SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
+ if( pPaintWindow )
+ {
+ sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager();
+
+ if ( pOverlayManager )
+ {
+ pAnchorOverlayObject = new AnchorOverlayObject(
+ basegfx::B2DPoint( aAnchorRect.Left() , aAnchorRect.Bottom()-5*15),
+ basegfx::B2DPoint( aAnchorRect.Left()-5*15 , aAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( aAnchorRect.Left()+5*15 , aAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( aAnchorRect.Left(), aAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aPageBorder ,aAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
+ basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) ,
+ aColorAnchor,
+ false,
+ false);
+ pOverlayManager->add(*pAnchorOverlayObject);
+ }
+ }
+ }
+
+ return pAnchorOverlayObject;
+}
+
+/*static*/ void AnchorOverlayObject::DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor )
+{
+ if ( pAnchor )
+ {
+ if ( pAnchor->getOverlayManager() )
+ {
+ // remove this object from the chain
+ pAnchor->getOverlayManager()->remove(*pAnchor);
+ }
+ delete pAnchor;
+ }
+}
+
+AnchorOverlayObject::AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ const basegfx::B2DPoint& rThirdPos,
+ const basegfx::B2DPoint& rFourthPos,
+ const basegfx::B2DPoint& rFifthPos,
+ const basegfx::B2DPoint& rSixthPos,
+ const basegfx::B2DPoint& rSeventhPos,
+ const Color aBaseColor,
+ const bool bShadowedEffect,
+ const bool bLineSolid)
+ : OverlayObjectWithBasePosition( rBasePos, aBaseColor )
+ , maSecondPosition(rSecondPos)
+ , maThirdPosition(rThirdPos)
+ , maFourthPosition(rFourthPos)
+ , maFifthPosition(rFifthPos)
+ , maSixthPosition(rSixthPos)
+ , maSeventhPosition(rSeventhPos)
+ , maTriangle()
+ , maLine()
+ , maLineTop()
+ , mHeight(0)
+ , mAnchorState(AS_ALL)
+ , mbShadowedEffect(bShadowedEffect)
+ , mbLineSolid(bLineSolid)
+{
+}
+
+AnchorOverlayObject::~AnchorOverlayObject()
+{
+}
+
+void AnchorOverlayObject::implEnsureGeometry()
+{
+ if(!maTriangle.count())
+ {
+ maTriangle.append(getBasePosition());
+ maTriangle.append(GetSecondPosition());
+ maTriangle.append(GetThirdPosition());
+ maTriangle.setClosed(true);
+ }
+
+ if(!maLine.count())
+ {
+ maLine.append(GetFourthPosition());
+ maLine.append(GetFifthPosition());
+ maLine.append(GetSixthPosition());
+ }
+
+ if(!maLineTop.count())
+ {
+ maLineTop.append(GetSixthPosition());
+ maLineTop.append(GetSeventhPosition());
+ }
+}
+
+void AnchorOverlayObject::implResetGeometry()
+{
+ maTriangle.clear();
+ maLine.clear();
+ maLineTop.clear();
+}
+
+drawinglayer::primitive2d::Primitive2DSequence AnchorOverlayObject::createOverlayObjectPrimitive2DSequence()
+{
+ implEnsureGeometry();
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new AnchorPrimitive( maTriangle,
+ maLine,
+ maLineTop,
+ GetAnchorState(),
+ getBaseColor().getBColor(),
+ ANCHORLINE_WIDTH * 15.0,
+ getShadowedEffect(),
+ getLineSolid()) );
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+}
+
+void AnchorOverlayObject::SetAllPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5,
+ const basegfx::B2DPoint& rPoint6,
+ const basegfx::B2DPoint& rPoint7)
+{
+ if ( rPoint1 != getBasePosition() ||
+ rPoint2 != GetSecondPosition() ||
+ rPoint3 != GetThirdPosition() ||
+ rPoint4 != GetFourthPosition() ||
+ rPoint5 != GetFifthPosition() ||
+ rPoint6 != GetSixthPosition() ||
+ rPoint7 != GetSeventhPosition() )
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+ maThirdPosition = rPoint3;
+ maFourthPosition = rPoint4;
+ maFifthPosition = rPoint5;
+ maSixthPosition = rPoint6;
+ maSeventhPosition = rPoint7;
+
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetSixthPosition(const basegfx::B2DPoint& rNew)
+{
+ if(rNew != maSixthPosition)
+ {
+ maSixthPosition = rNew;
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetSeventhPosition(const basegfx::B2DPoint& rNew)
+{
+ if(rNew != maSeventhPosition)
+ {
+ maSeventhPosition = rNew;
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetTriPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2,const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,const basegfx::B2DPoint& rPoint5)
+{
+ if(rPoint1 != getBasePosition()
+ || rPoint2 != GetSecondPosition()
+ || rPoint3 != GetThirdPosition()
+ || rPoint4 != GetFourthPosition()
+ || rPoint5 != GetFifthPosition())
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+ maThirdPosition = rPoint3;
+ maFourthPosition = rPoint4;
+ maFifthPosition = rPoint5;
+
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::setLineSolid( const bool bNew )
+{
+ if ( bNew != getLineSolid() )
+ {
+ mbLineSolid = bNew;
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetAnchorState( const AnchorState aState)
+{
+ if ( mAnchorState != aState)
+ {
+ mAnchorState = aState;
+ objectChange();
+ }
+}
+
+} } // end of namespace sw::annotation
+
diff --git a/sw/source/ui/docvw/AnchorOverlayObject.hxx b/sw/source/ui/docvw/AnchorOverlayObject.hxx
new file mode 100644
index 000000000000..cea567f22921
--- /dev/null
+++ b/sw/source/ui/docvw/AnchorOverlayObject.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANCHOROVERLAYOBJECT_HXX
+#define _ANCHOROVERLAYOBJECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+class SwView;
+class SwRect;
+class Point;
+
+namespace sw { namespace sidebarwindows {
+
+enum AnchorState
+{
+ AS_ALL,
+ AS_START,
+ AS_END,
+ AS_TRI
+};
+
+class AnchorOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
+{
+ public:
+ static AnchorOverlayObject* CreateAnchorOverlayObject( SwView& rDocView,
+ const SwRect& aAnchorRect,
+ const long& aPageBorder,
+ const Point& aLineStart,
+ const Point& aLineEnd,
+ const Color& aColorAnchor );
+ static void DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor );
+
+ inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
+ const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
+ const basegfx::B2DPoint& GetFourthPosition() const { return maFourthPosition; }
+ const basegfx::B2DPoint& GetFifthPosition() const { return maFifthPosition; }
+ const basegfx::B2DPoint& GetSixthPosition() const { return maSixthPosition; }
+ const basegfx::B2DPoint& GetSeventhPosition() const { return maSeventhPosition; }
+
+ void SetAllPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5,
+ const basegfx::B2DPoint& rPoint6,
+ const basegfx::B2DPoint& rPoint7 );
+ void SetTriPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5 );
+ void SetSixthPosition( const basegfx::B2DPoint& rNew );
+ void SetSeventhPosition( const basegfx::B2DPoint& rNew );
+
+ void setLineSolid( const bool bNew );
+ inline bool getLineSolid() const { return mbLineSolid; }
+
+ inline void SetHeight( const unsigned long aHeight ) { mHeight = aHeight; };
+
+ bool getShadowedEffect() const { return mbShadowedEffect; }
+
+ void SetAnchorState( const AnchorState aState );
+ inline AnchorState GetAnchorState() const { return mAnchorState; }
+
+ protected:
+ /* 6------------7
+ 1 /
+ /4\ ---------------5
+ 2 - 3
+ */
+
+ basegfx::B2DPoint maSecondPosition;
+ basegfx::B2DPoint maThirdPosition;
+ basegfx::B2DPoint maFourthPosition;
+ basegfx::B2DPoint maFifthPosition;
+ basegfx::B2DPoint maSixthPosition;
+ basegfx::B2DPoint maSeventhPosition;
+
+ // helpers to fill and reset geometry
+ void implEnsureGeometry();
+ void implResetGeometry();
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ private:
+ // object's geometry
+ basegfx::B2DPolygon maTriangle;
+ basegfx::B2DPolygon maLine;
+ basegfx::B2DPolygon maLineTop;
+ unsigned long mHeight;
+ AnchorState mAnchorState;
+
+ bool mbShadowedEffect : 1;
+ bool mbLineSolid : 1;
+
+ AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ const basegfx::B2DPoint& rThirdPos,
+ const basegfx::B2DPoint& rFourthPos,
+ const basegfx::B2DPoint& rFifthPos,
+ const basegfx::B2DPoint& rSixthPos,
+ const basegfx::B2DPoint& rSeventhPos,
+ const Color aBaseColor,
+ const bool bShadowedEffect,
+ const bool bLineSolid );
+ virtual ~AnchorOverlayObject();
+};
+
+} } // end of namespace sw::annotation
+
+#endif
diff --git a/sw/source/ui/docvw/AnnotationMenuButton.cxx b/sw/source/ui/docvw/AnnotationMenuButton.cxx
new file mode 100644
index 000000000000..6022a4646ae6
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationMenuButton.cxx
@@ -0,0 +1,222 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <AnnotationMenuButton.hxx>
+
+#include <annotation.hrc>
+#include <app.hrc>
+#include <access.hrc>
+
+#include <unotools/useroptions.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/decoview.hxx>
+#include <vcl/gradient.hxx>
+
+#include <cmdid.h>
+#include <SidebarWin.hxx>
+
+namespace sw { namespace annotation {
+
+Color ColorFromAlphaColor( const UINT8 aTransparency,
+ const Color &aFront,
+ const Color &aBack )
+{
+ return Color((UINT8)(aFront.GetRed() * aTransparency/(double)255 + aBack.GetRed() * (1-aTransparency/(double)255)),
+ (UINT8)(aFront.GetGreen() * aTransparency/(double)255 + aBack.GetGreen() * (1-aTransparency/(double)255)),
+ (UINT8)(aFront.GetBlue() * aTransparency/(double)255 + aBack.GetBlue() * (1-aTransparency/(double)255)));
+}
+
+AnnotationMenuButton::AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin )
+ : MenuButton( &rSidebarWin )
+ , mrSidebarWin( rSidebarWin )
+{
+ AddEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) );
+
+ SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_BUTTON_NAME ) );
+ SetAccessibleDescription( SW_RES( STR_ACCESS_ANNOTATION_BUTTON_DESC ) );
+ SetQuickHelpText( GetAccessibleDescription() );
+}
+
+AnnotationMenuButton::~AnnotationMenuButton()
+{
+ RemoveEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) );
+}
+
+void AnnotationMenuButton::Select()
+{
+ mrSidebarWin.ExecuteCommand( GetCurItemId() );
+}
+
+void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ PopupMenu* pButtonPopup( GetPopupMenu() );
+ if ( mrSidebarWin.IsReadOnly() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ pButtonPopup->EnableItem( FN_DELETE_NOTE, false );
+ pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, false );
+ pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, false );
+ }
+ else
+ {
+ if ( mrSidebarWin.IsProtected() )
+ {
+ pButtonPopup->EnableItem( FN_DELETE_NOTE, false );
+ }
+ else
+ {
+ pButtonPopup->EnableItem( FN_DELETE_NOTE, true );
+ }
+ pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, true );
+ pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, true );
+ }
+
+ if ( mrSidebarWin.IsProtected() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ }
+ else
+ {
+ SvtUserOptions aUserOpt;
+ String sAuthor;
+ if ( !(sAuthor = aUserOpt.GetFullName()).Len() )
+ {
+ if ( !(sAuthor = aUserOpt.GetID()).Len() )
+ {
+ sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+ }
+ }
+ // do not allow to reply to ourself and no answer possible if this note is in a protected section
+ if ( sAuthor == mrSidebarWin.GetAuthor() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ }
+ else
+ {
+ pButtonPopup->EnableItem( FN_REPLY, true );
+ }
+ }
+
+ MenuButton::MouseButtonDown( rMEvt );
+}
+
+void AnnotationMenuButton::Paint( const Rectangle& /*rRect*/ )
+{
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ SetFillColor(COL_BLACK);
+ else
+ SetFillColor( mrSidebarWin.ColorDark() );
+ SetLineColor();
+ const Rectangle aRect( Rectangle( Point( 0, 0 ), PixelToLogic( GetSizePixel() ) ) );
+ DrawRect( aRect );
+
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ //draw rect around button
+ SetFillColor(COL_BLACK);
+ SetLineColor(COL_WHITE);
+ }
+ else
+ {
+ //draw button
+ Gradient aGradient;
+ if ( IsMouseOver() )
+ aGradient = Gradient( GRADIENT_LINEAR,
+ ColorFromAlphaColor( 80, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ),
+ ColorFromAlphaColor( 15, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ else
+ aGradient = Gradient( GRADIENT_LINEAR,
+ ColorFromAlphaColor( 15, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ),
+ ColorFromAlphaColor( 80, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ DrawGradient( aRect, aGradient );
+
+ //draw rect around button
+ SetFillColor();
+ SetLineColor( ColorFromAlphaColor( 90, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ }
+ DrawRect( aRect );
+
+ if ( mrSidebarWin.IsPreview() )
+ {
+ Font aOldFont( mrSidebarWin.GetFont() );
+ Font aFont(aOldFont);
+ Color aCol( COL_BLACK);
+ aFont.SetColor( aCol );
+ aFont.SetHeight(200);
+ aFont.SetWeight(WEIGHT_MEDIUM);
+ SetFont( aFont );
+ DrawText( aRect ,
+ rtl::OUString::createFromAscii("Edit Note"),
+ TEXT_DRAW_CENTER );
+ SetFont( aOldFont );
+ }
+ else
+ {
+ Rectangle aSymbolRect( aRect );
+ // 25% distance to the left and right button border
+ const long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth()*250)+500)/1000;
+ aSymbolRect.Left()+=nBorderDistanceLeftAndRight;
+ aSymbolRect.Right()-=nBorderDistanceLeftAndRight;
+ // 40% distance to the top button border
+ const long nBorderDistanceTop = ((aSymbolRect.GetHeight()*400)+500)/1000;
+ aSymbolRect.Top()+=nBorderDistanceTop;
+ // 15% distance to the bottom button border
+ const long nBorderDistanceBottom = ((aSymbolRect.GetHeight()*150)+500)/1000;
+ aSymbolRect.Bottom()-=nBorderDistanceBottom;
+ DecorationView aDecoView( this );
+ aDecoView.DrawSymbol( aSymbolRect, SYMBOL_SPIN_DOWN,
+ ( Application::GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? Color( COL_WHITE )
+ : Color( COL_BLACK ) ) );
+ }
+}
+
+void AnnotationMenuButton::KeyInput( const KeyEvent& rKeyEvt )
+{
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ const USHORT nKey = rKeyCode.GetCode();
+ if ( nKey == KEY_TAB )
+ {
+ mrSidebarWin.ActivatePostIt();
+ mrSidebarWin.GrabFocus();
+ }
+ else
+ {
+ MenuButton::KeyInput( rKeyEvt );
+ }
+}
+
+} } // end of namespace sw::annotation
+
diff --git a/sw/source/ui/docvw/AnnotationMenuButton.hxx b/sw/source/ui/docvw/AnnotationMenuButton.hxx
new file mode 100644
index 000000000000..c74719f1cad4
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationMenuButton.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATIONMENUBUTTON_HXX
+#define _ANNOTATIONMENUBUTTON_HXX
+
+#include <vcl/menubtn.hxx>
+
+namespace sw { namespace sidebarwindows {
+ class SwSidebarWin;
+} }
+
+namespace sw { namespace annotation {
+
+class AnnotationMenuButton : public MenuButton
+{
+ public:
+ AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+ ~AnnotationMenuButton();
+
+ // overloaded <MenuButton> methods
+ virtual void Select();
+
+ // overloaded <Window> methods
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+
+ private:
+ sw::sidebarwindows::SwSidebarWin& mrSidebarWin;
+};
+
+} } // end of namespace sw::annotation
+
+#endif
diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx
new file mode 100644
index 000000000000..91ea1e13b077
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationWin.cxx
@@ -0,0 +1,292 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <AnnotationWin.hxx>
+
+#include <AnnotationMenuButton.hxx>
+#include <PostItMgr.hxx>
+
+#include <annotation.hrc>
+#include <popup.hrc>
+#include <cmdid.h>
+
+#include <vcl/menu.hxx>
+
+#include <svl/undo.hxx>
+#include <unotools/syslocale.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <editeng/postitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/langitem.hxx>
+
+#include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editobj.hxx>
+
+#include <docufld.hxx> // SwPostItField
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <SwUndoField.hxx>
+
+namespace sw { namespace annotation {
+
+SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem,
+ SwFmtFld* aField )
+ : SwSidebarWin( rEditWin, nBits, aMgr, aBits, rSidebarItem )
+ , mpFmtFld(aField)
+ , mpFld( static_cast<SwPostItField*>(aField->GetFld()))
+ , mpButtonPopup(0)
+{
+}
+
+SwAnnotationWin::~SwAnnotationWin()
+{
+ delete mpButtonPopup;
+}
+
+void SwAnnotationWin::SetPostItText()
+{
+ // get text from SwPostItField and insert into our textview
+ Engine()->SetModifyHdl( Link() );
+ Engine()->EnableUndo( FALSE );
+ mpFld = static_cast<SwPostItField*>(mpFmtFld->GetFld());
+ if( mpFld->GetTextObject() )
+ Engine()->SetText( *mpFld->GetTextObject() );
+ else
+ {
+ Engine()->Clear();
+ GetOutlinerView()->SetAttribs(DefaultItem());
+ GetOutlinerView()->InsertText(mpFld->GetPar2(),false);
+ }
+
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+ Engine()->EnableUndo( TRUE );
+ Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) );
+ Invalidate();
+}
+
+void SwAnnotationWin::UpdateData()
+{
+ if ( Engine()->IsModified() )
+ {
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwField* pOldField = mpFld->Copy();
+ mpFld->SetPar2(Engine()->GetEditEngine().GetText());
+ mpFld->SetTextObject(Engine()->CreateParaObject());
+ DocView().GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
+ delete pOldField;
+ // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one)
+ Mgr().SetLayout();
+ // #i98686# if we have several views, all notes should update their text
+ mpFmtFld->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED));
+ DocView().GetDocShell()->SetModified();
+ }
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+void SwAnnotationWin::Delete()
+{
+ SwSidebarWin::Delete();
+ // we delete the field directly, the Mgr cleans up the PostIt by listening
+ DocView().GetWrtShellPtr()->GotoField(*mpFmtFld);
+ GrabFocusToDocument();
+ DocView().GetWrtShellPtr()->DelRight();
+}
+
+void SwAnnotationWin::GotoPos()
+{
+ DocView().GetDocShell()->GetWrtShell()->GotoField(*mpFmtFld);
+}
+
+sal_uInt32 SwAnnotationWin::MoveCaret()
+{
+ // if this is an answer, do not skip over all following ones, but insert directly behind the current one
+ // but when just leaving a note, skip all following ones as well to continue typing
+ return Mgr().IsAnswer()
+ ? 1
+ : 1 + CountFollowing();
+}
+
+//returns true, if there is another note right before this note
+bool SwAnnotationWin::CalcFollow()
+{
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() - 1, RES_TXTATR_FIELD );
+ const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
+ return pFld && (pFld->Which()== RES_POSTITFLD);
+}
+
+// counts how many SwPostItField we have right after the current one
+sal_uInt32 SwAnnotationWin::CountFollowing()
+{
+ sal_uInt32 aCount = 1; // we start with 1, so we have to subtract one at the end again
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+
+ SwTxtAttr * pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() + 1,
+ RES_TXTATR_FIELD );
+ SwField* pFld = pTxtAttr
+ ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld())
+ : 0;
+ while ( pFld && ( pFld->Which()== RES_POSTITFLD ) )
+ {
+ aCount++;
+ pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() + aCount,
+ RES_TXTATR_FIELD );
+ pFld = pTxtAttr
+ ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld())
+ : 0;
+ }
+ return aCount - 1;
+}
+
+MenuButton* SwAnnotationWin::CreateMenuButton()
+{
+ mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON));
+ XubString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR );
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1,GetAuthor());
+ aText = aRewriter.Apply(aText);
+ mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
+ MenuButton* pMenuButton = new AnnotationMenuButton( *this );
+ pMenuButton->SetPopupMenu( mpButtonPopup );
+ pMenuButton->Show();
+ return pMenuButton;
+}
+
+void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
+{
+ //collect our old meta data
+ SwSidebarWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
+ const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
+ String aText = String(SW_RES(STR_REPLY));
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, pWin->GetAuthor());
+ aText = aRewriter.Apply(aText);
+ aText.Append(String(rtl::OUString::createFromAscii(" (") +
+ String(rLocalData.getDate( pWin->GetDate())) + rtl::OUString::createFromAscii(", ") +
+ String(rLocalData.getTime( pWin->GetTime(),false)) + rtl::OUString::createFromAscii("): \"")));
+ GetOutlinerView()->InsertText(aText,false);
+
+ // insert old, selected text or "..."
+ // TOOD: iterate over all paragraphs, not only first one to find out if it is empty
+ if (pText->GetTextObject().GetText(0) != String(rtl::OUString::createFromAscii("")))
+ GetOutlinerView()->GetEditView().InsertText(pText->GetTextObject());
+ else
+ GetOutlinerView()->InsertText(rtl::OUString::createFromAscii("..."),false);
+ GetOutlinerView()->InsertText(rtl::OUString::createFromAscii("\"\n"),false);
+
+ GetOutlinerView()->SetSelection(ESelection(0x0,0x0,0xFFFF,0xFFFF));
+ SfxItemSet aAnswerSet( DocView().GetDocShell()->GetPool() );
+ aAnswerSet.Put(SvxFontHeightItem(200,80,EE_CHAR_FONTHEIGHT));
+ aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC));
+ GetOutlinerView()->SetAttribs(aAnswerSet);
+ GetOutlinerView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
+
+ //remove all attributes and reset our standard ones
+ GetOutlinerView()->GetEditView().RemoveAttribsKeepLanguages(true);
+ GetOutlinerView()->SetAttribs(DefaultItem());
+ // lets insert an undo step so the initial text can be easily deleted
+ // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
+ Engine()->SetModifyHdl( Link() );
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwField* pOldField = mpFld->Copy();
+ mpFld->SetPar2(Engine()->GetEditEngine().GetText());
+ mpFld->SetTextObject(Engine()->CreateParaObject());
+ DocView().GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
+ delete pOldField;
+ Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) );
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+SvxLanguageItem SwAnnotationWin::GetLanguage(void)
+{
+ // set initial language for outliner
+ USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( mpFld->GetLanguage() );
+ USHORT nLangWhichId = 0;
+ switch (nScriptType)
+ {
+ case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break;
+ case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ default: DBG_ERROR("GetLanguage: wrong script tye");
+ }
+ return SvxLanguageItem(mpFld->GetLanguage(),nLangWhichId);
+}
+
+bool SwAnnotationWin::IsProtected()
+{
+ return SwSidebarWin::IsProtected() ||
+ GetLayoutStatus() == SwPostItHelper::DELETED ||
+ ( mpFmtFld ? mpFmtFld->IsProtect() : false );
+}
+
+String SwAnnotationWin::GetAuthor()
+{
+ return mpFld->GetPar1();
+}
+
+Date SwAnnotationWin::GetDate()
+{
+ return mpFld->GetDate();
+}
+
+Time SwAnnotationWin::GetTime()
+{
+ return mpFld->GetTime();
+}
+
+} } // end of namespace sw::annotation
diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index 25adc5006c4d..c6b0ad4a136f 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -31,6 +31,15 @@
#include "PostItMgr.hxx"
#include <postithelper.hxx>
+#include <SidebarWin.hxx>
+#include <AnnotationWin.hxx>
+#include <frmsidebarwincontainer.hxx>
+#include <accmap.hxx>
+
+#include <SidebarWindowsConsts.hxx>
+#include <AnchorOverlayObject.hxx>
+#include <ShadowOverlayObject.hxx>
+
#include <vcl/svapp.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/outdev.hxx>
@@ -45,7 +54,6 @@
#include <fmtfld.hxx>
#include <docufld.hxx>
#include <edtwin.hxx>
-#include <postit.hxx>
#include <txtfld.hxx>
#include <ndtxt.hxx>
#include <redline.hxx>
@@ -55,7 +63,7 @@
#include <tools/color.hxx>
#include <swmodule.hxx>
-#include <docvw.hrc>
+#include <annotation.hrc>
#include "cmdid.h"
#include <SwRewriter.hxx>
@@ -80,8 +88,8 @@
#include "swevent.hxx"
-// distance between ankor Y and initial note position
-#define POSTIT_INITIAL_ANKOR_DISTANCE 20
+// distance between Anchor Y and initial note position
+#define POSTIT_INITIAL_ANCHOR_DISTANCE 20
//distance between two postits
#define POSTIT_SPACE_BETWEEN 8
#define POSTIT_MINIMUMSIZE_WITH_META 60
@@ -90,6 +98,8 @@
// if we layout more often we stop, this should never happen
#define MAX_LOOP_COUNT 50
+using namespace sw::sidebarwindows;
+
/*
bool comp_author( const SwPostItItem* a, const SwPostItItem* b)
{
@@ -102,16 +112,22 @@ bool comp_date( const SwPostItItem* a, const SwPostItItem* b)
}
*/
-// if position is on the same line, sort by x (Left) position, otherwise by y(Bottom) position
-// if two notes are at the same position, sort by logical node position
-bool comp_pos(const SwMarginItem *a, const SwMarginItem *b)
+//
+bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b)
{
- return (a->mPos.Bottom() == b->mPos.Bottom()) ?
- ( ((a->mPos.Left() == b->mPos.Left()) && (a->GetBroadCaster()->ISA(SwFmtFld) && b->GetBroadCaster()->ISA(SwFmtFld)) ) ?
- *(static_cast<SwFmtFld*>(a->GetBroadCaster())->GetTxtFld()->GetStart()) <
- *(static_cast<SwFmtFld*>(b->GetBroadCaster())->GetTxtFld()->GetStart())
- : a->mPos.Left() < b->mPos.Left() )
- : a->mPos.Bottom() < b->mPos.Bottom();
+ // --> OD 2010-01-19 #i88070#
+ // sort by anchor position
+//// if position is on the same line, sort by x (Left) position, otherwise by y(Bottom) position
+//// if two notes are at the same position, sort by logical node position
+// return (a->maLayoutInfo.mPosition.Bottom() == b->maLayoutInfo.mPosition.Bottom())
+// ? ( ( (a->maLayoutInfo.mPosition.Left() == b->maLayoutInfo.mPosition.Left()) &&
+// (a->GetBroadCaster()->ISA(SwFmtFld) && b->GetBroadCaster()->ISA(SwFmtFld)) )
+// ? *(static_cast<SwFmtFld*>(a->GetBroadCaster())->GetTxtFld()->GetStart()) <
+// *(static_cast<SwFmtFld*>(b->GetBroadCaster())->GetTxtFld()->GetStart())
+// : a->maLayoutInfo.mPosition.Left() < b->maLayoutInfo.mPosition.Left() )
+// : a->maLayoutInfo.mPosition.Bottom() < b->maLayoutInfo.mPosition.Bottom();
+ return a->GetAnchorPosition() < b->GetAnchorPosition();
+ // <--
}
SwPostItMgr::SwPostItMgr(SwView* pView)
@@ -127,12 +143,14 @@ SwPostItMgr::SwPostItMgr(SwView* pView)
, mbReadOnly(mpView->GetDocShell()->IsReadOnly())
, mbDeleteNote(true)
, mpAnswer(0)
+ , mbIsShowAnchor( false )
+ , mpFrmSidebarWinContainer( 0 )
{
if(!mpView->GetDrawView() )
mpView->GetWrtShell().MakeDrawView();
SwNoteProps aProps;
- mpIsShowAnkor = aProps.IsShowAnkor();
+ mbIsShowAnchor = aProps.IsShowAnchor();
//make sure we get the colour yellow always, even if not the first one of comments or redlining
SW_MOD()->GetRedlineAuthor();
@@ -140,7 +158,7 @@ SwPostItMgr::SwPostItMgr(SwView* pView)
// collect all PostIts and redline comments that exist after loading the document
// don't check for existance for any of them, don't focus them
AddPostIts(false,false);
- /* this code can be used once we want redline comments in the margin
+ /* this code can be used once we want redline comments in the Sidebar
AddRedlineComments(false,false);
*/
// we want to receive stuff like SFX_HINT_DOCCHANGED
@@ -156,27 +174,30 @@ SwPostItMgr::~SwPostItMgr()
{
if ( mnEventId )
Application::RemoveUserEvent( mnEventId );
- // forget about all our margin windows
- RemoveMarginWin();
+ // forget about all our Sidebar windows
+ RemoveSidebarWin();
EndListening( *mpView->GetDocShell() );
for(std::vector<SwPostItPageItem*>::iterator i = mPages.begin(); i!= mPages.end() ; i++)
delete (*i);
mPages.clear();
+
+ delete mpFrmSidebarWinContainer;
+ mpFrmSidebarWinContainer = 0;
}
void SwPostItMgr::CheckForRemovedPostIts()
{
bool bRemoved = false;
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end(); )
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end(); )
{
- std::list<SwMarginItem*>::iterator it = i++;
+ std::list<SwSidebarItem*>::iterator it = i++;
if ( !(*it)->UseElement() )
{
- SwMarginItem* p = (*it);
+ SwSidebarItem* p = (*it);
mvPostItFlds.remove(*it);
- if (GetActivePostIt() == p->pPostIt)
- SetActivePostIt(0);
+ if (GetActiveSidebarWin() == p->pPostIt)
+ SetActiveSidebarWin(0);
if (p->pPostIt)
delete p->pPostIt;
delete p;
@@ -204,7 +225,7 @@ void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool b
{
if (bCheckExistance)
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->GetBroadCaster() == pItem )
return;
@@ -212,7 +233,7 @@ void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool b
}
mbLayout = bFocus;
if (pItem->ISA(SwFmtFld))
- mvPostItFlds.push_back(new SwPostItItem(static_cast<SwFmtFld*>(pItem), true, bFocus) );
+ mvPostItFlds.push_back(new SwAnnotationItem(static_cast<SwFmtFld*>(pItem), true, bFocus) );
/*
else
if (pItem->ISA(SwRedline))
@@ -225,13 +246,13 @@ void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool b
void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast )
{
EndListening(*pBroadcast);
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->GetBroadCaster() == pBroadcast )
{
- SwMarginItem* p = (*i);
- if (GetActivePostIt() == p->pPostIt)
- SetActivePostIt(0);
+ SwSidebarItem* p = (*i);
+ if (GetActiveSidebarWin() == p->pPostIt)
+ SetActiveSidebarWin(0);
mvPostItFlds.remove(*i);
delete p->pPostIt;
delete p;
@@ -379,7 +400,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
case SWFMTFLD_CHANGED:
{
SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( pFmtFld == (*i)->GetBroadCaster() )
{
@@ -396,7 +417,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
case SWFMTFLD_LANGUAGE:
{
SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( pFmtFld == (*i)->GetBroadCaster() )
{
@@ -410,7 +431,8 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
}
- (*i)->pPostIt->SetLanguage(SvxLanguageItem((*i)->GetFmtFld()->GetFld()->GetLanguage(),nLangWhichId));
+ (*i)->pPostIt->SetLanguage( SvxLanguageItem((*i)->GetFmtFld()->GetFld()->GetLanguage(),
+ nLangWhichId) );
}
break;
}
@@ -429,7 +451,7 @@ void SwPostItMgr::Focus(SfxBroadcaster& rBC)
mpView->ExecViewOptions(aRequest);
}
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
// field to get the focus is the broadcaster
if ( &rBC == (*i)->GetBroadCaster() )
@@ -463,9 +485,9 @@ bool SwPostItMgr::CalcRects()
PreparePageContainer();
if ( !mvPostItFlds.empty() )
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- SwMarginItem* pItem = (*i);
+ SwSidebarItem* pItem = (*i);
if ( !pItem->UseElement() )
{
DBG_ERROR("PostIt is not in doc or other wrong use");
@@ -474,32 +496,30 @@ bool SwPostItMgr::CalcRects()
}
//save old rect and visible state
- SwRect aOldRect(pItem->mPos);
+ SwRect aOldRect(pItem->maLayoutInfo.mPosition);
SwPostItHelper::SwLayoutStatus eOldStatus = pItem->mLayoutStatus;
std::vector< SwLayoutInfo > aInfo;
- SwPosition aPosition = pItem->GetPosition();
- pItem->mLayoutStatus = SwPostItHelper::getLayoutInfos( aInfo, aPosition );
+ {
+ SwPosition aPosition = pItem->GetAnchorPosition();
+ pItem->mLayoutStatus = SwPostItHelper::getLayoutInfos( aInfo, aPosition );
+ }
if( aInfo.size() )
{
- SwLayoutInfo& rInfo = aInfo[0];
- pItem->mPos = rInfo.mPosition;
- pItem->mPagePos = rInfo.mPageFrame;
- pItem->mFramePos = rInfo.mPagePrtArea;
- pItem->bMarginSide = rInfo.mbMarginSide;
- pItem->mnPageNumber = rInfo.mnPageNumber;
- pItem->mRedlineAuthor = rInfo.mRedlineAuthor;
+ pItem->maLayoutInfo = aInfo[0];
}
- bChange = bChange || (pItem->mPos != aOldRect) || (eOldStatus != pItem->mLayoutStatus);
+ bChange = bChange ||
+ ( pItem->maLayoutInfo.mPosition != aOldRect ) ||
+ ( eOldStatus != pItem->mLayoutStatus );
}
// show notes in right order in navigator
- //prevent ankors during layout to overlap, e.g. when moving a frame
+ //prevent Anchors during layout to overlap, e.g. when moving a frame
Sort(SORT_POS);
// sort the items into the right page vector, so layout can be done by page
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- SwMarginItem* pItem = (*i);
+ SwSidebarItem* pItem = (*i);
if( SwPostItHelper::INVISIBLE == pItem->mLayoutStatus )
{
if (pItem->pPostIt)
@@ -517,7 +537,7 @@ bool SwPostItMgr::CalcRects()
}
}
- const unsigned long aPageNum = pItem->mnPageNumber;
+ const unsigned long aPageNum = pItem->maLayoutInfo.mnPageNumber;
if (aPageNum > mPages.size())
{
const unsigned long nNumberOfPages = mPages.size();
@@ -525,8 +545,8 @@ bool SwPostItMgr::CalcRects()
mPages.push_back( new SwPostItPageItem());
}
mPages[aPageNum-1]->mList->push_back(pItem);
- mPages[aPageNum-1]->mPageRect = pItem->mPagePos;
- mPages[aPageNum-1]->bMarginSide = pItem->bMarginSide;
+ mPages[aPageNum-1]->mPageRect = pItem->maLayoutInfo.mPageFrame;
+ mPages[aPageNum-1]->eSidebarPosition = pItem->maLayoutInfo.meSidebarPosition;
}
if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
@@ -555,9 +575,9 @@ bool SwPostItMgr::CalcRects()
bool SwPostItMgr::HasScrollbars() const
{
- for(std::list<SwMarginItem*>::const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- if ((*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->Scrollbar())
+ if ((*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->HasScrollbar())
return true;
}
return false;
@@ -609,63 +629,80 @@ void SwPostItMgr::LayoutPostIts()
// only layout if there are notes on this page
if (mPages[n]->mList->size()>0)
{
- std::list<SwMarginWin*> aVisiblePostItList;
+ std::list<SwSidebarWin*> aVisiblePostItList;
unsigned long lNeededHeight = 0;
long mlPageBorder = 0;
long mlPageEnd = 0;
- for(SwMarginItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
{
- SwMarginItem* pItem = (*i);
- SwMarginWin* pPostIt = pItem->pPostIt;
+ SwSidebarItem* pItem = (*i);
+ SwSidebarWin* pPostIt = pItem->pPostIt;
- if (mPages[n]->bMarginSide)
+ if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
{
// x value for notes positioning
mlPageBorder = mpEditWin->LogicToPixel( Point( mPages[n]->mPageRect.Left(), 0)).X() - GetSidebarWidth(true);// - GetSidebarBorderWidth(true);
//bending point
- mlPageEnd = mpWrtShell->getIDocumentSettingAccess()->get( IDocumentSettingAccess::BROWSE_MODE) ? pItem->mFramePos.Left() : mPages[n]->mPageRect.Left() + 350;
+ mlPageEnd =
+ mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)
+ ? pItem->maLayoutInfo.mPagePrtArea.Left()
+ : mPages[n]->mPageRect.Left() + 350;
}
- else
+ else if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
{
// x value for notes positioning
mlPageBorder = mpEditWin->LogicToPixel( Point(mPages[n]->mPageRect.Right(), 0)).X() + GetSidebarBorderWidth(true);
//bending point
- mlPageEnd = mpWrtShell->getIDocumentSettingAccess()->get( IDocumentSettingAccess::BROWSE_MODE) ? pItem->mFramePos.Right() : mPages[n]->mPageRect.Right() - 350;
+ mlPageEnd =
+ mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)
+ ? pItem->maLayoutInfo.mPagePrtArea.Right() :
+ mPages[n]->mPageRect.Right() - 350;
}
if (pItem->bShow)
{
- long Y = mpEditWin->LogicToPixel( Point(0,pItem->mPos.Bottom())).Y();
+ long Y = mpEditWin->LogicToPixel( Point(0,pItem->maLayoutInfo.mPosition.Bottom())).Y();
long aPostItHeight = 0;
if (!pPostIt)
{
- pPostIt = (*i)->GetMarginWindow(static_cast<Window*>(&mpView->GetEditWin()),WINDOW_CONTROL|WB_NODIALOGCONTROL,this,0);
+ pPostIt = (*i)->GetSidebarWindow( mpView->GetEditWin(),
+ WB_DIALOGCONTROL,
+ *this,
+ 0 );
pPostIt->InitControls();
pPostIt->SetReadonly(mbReadOnly);
pItem->pPostIt = pPostIt;
if (mpAnswer)
{
if (pPostIt->CalcFollow()) //do we really have another note in front of this one
- static_cast<SwPostIt*>(pPostIt)->InitAnswer(mpAnswer);
+ static_cast<sw::annotation::SwAnnotationWin*>(pPostIt)->InitAnswer(mpAnswer);
delete mpAnswer;
mpAnswer = 0;
}
}
- if (pItem->pPostIt->ISA(SwPostIt))
- {
- static_cast<SwPostIt*>(pPostIt)->SetChangeTracking(pItem->mLayoutStatus,GetColorAnkor(pItem->mRedlineAuthor));
- }
- pPostIt->SetMarginSide(mPages[n]->bMarginSide);
+ pPostIt->SetChangeTracking(
+ pItem->mLayoutStatus,
+ GetColorAnchor(pItem->maLayoutInfo.mRedlineAuthor));
+ pPostIt->SetSidebarPosition(mPages[n]->eSidebarPosition);
pPostIt->SetFollow(pPostIt->CalcFollow());
- aPostItHeight = ( pPostIt->GetPostItTextHeight() < pPostIt->GetMinimumSizeWithoutMeta() ? pPostIt->GetMinimumSizeWithoutMeta() : pPostIt->GetPostItTextHeight() ) + pPostIt->GetMetaHeight();
- pPostIt->SetPosSizePixelRect( mlPageBorder ,Y-GetInitialAnchorDistance(), GetNoteWidth() ,aPostItHeight,pItem->mPos, mlPageEnd);
+ aPostItHeight = ( pPostIt->GetPostItTextHeight() < pPostIt->GetMinimumSizeWithoutMeta()
+ ? pPostIt->GetMinimumSizeWithoutMeta()
+ : pPostIt->GetPostItTextHeight() )
+ + pPostIt->GetMetaHeight();
+ pPostIt->SetPosSizePixelRect( mlPageBorder ,
+ Y - GetInitialAnchorDistance(),
+ GetNoteWidth() ,
+ aPostItHeight,
+ pItem->maLayoutInfo.mPosition,
+ mlPageEnd );
+ pPostIt->ChangeSidebarItem( *pItem );
if (pItem->bFocus)
{
mbLayout = true;
- pPostIt->GrabFocus();
+ pPostIt->GrabFocus();
pItem->bFocus = false;
}
// only the visible postits are used for the final layout
@@ -705,7 +742,7 @@ void SwPostItMgr::LayoutPostIts()
- enlarge all notes till GetNextBorder(), as we resized to average value before
*/
//lets hide the ones which overlap the page
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
{
if (mPages[n]->lOffset != 0)
(*i)->TranslateTopPosition(mPages[n]->lOffset);
@@ -720,24 +757,28 @@ void SwPostItMgr::LayoutPostIts()
{
if (mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() < (mPages[n]->mPageRect.Top()+aSidebarheight))
{
- if (mPages[n]->bMarginSide)
- (*i)->ShowAnkorOnly(Point(mPages[n]->mPageRect.Left(),mPages[n]->mPageRect.Top()));
- else
- (*i)->ShowAnkorOnly(Point(mPages[n]->mPageRect.Right(),mPages[n]->mPageRect.Top()));
+ if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
+ (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Left(),
+ mPages[n]->mPageRect.Top()));
+ else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
+ (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Right(),
+ mPages[n]->mPageRect.Top()));
}
else
{
- if (mPages[n]->bMarginSide)
- (*i)->ShowAnkorOnly(Point(mPages[n]->mPageRect.Left(),mPages[n]->mPageRect.Bottom()));
- else
- (*i)->ShowAnkorOnly(Point(mPages[n]->mPageRect.Right(),mPages[n]->mPageRect.Bottom()));
+ if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
+ (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Left(),
+ mPages[n]->mPageRect.Bottom()));
+ else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
+ (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Right(),
+ mPages[n]->mPageRect.Bottom()));
}
DBG_ASSERT(mPages[n]->bScrollbar,"SwPostItMgr::LayoutByPage(): note overlaps, but bScrollbar is not true");
}
}
// do some magic so we really see the focused note
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
{
if ((*i)->HasChildPathFocus())
{
@@ -748,7 +789,7 @@ void SwPostItMgr::LayoutPostIts()
}
else
{
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
(*i)->SetPosAndSize();
bool bOldScrollbar = mPages[n]->bScrollbar;
@@ -767,9 +808,9 @@ void SwPostItMgr::LayoutPostIts()
if (!ShowNotes())
{ // we do not want to see the notes anymore -> Options-Writer-View-Notes
bool bRepair = false;
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- SwMarginItem* pItem = (*i);
+ SwSidebarItem* pItem = (*i);
if ( !pItem->UseElement() )
{
DBG_ERROR("PostIt is not in doc!");
@@ -782,7 +823,7 @@ void SwPostItMgr::LayoutPostIts()
(*i)->pPostIt->HideNote();
if ((*i)->pPostIt->HasChildPathFocus())
{
- SetActivePostIt(0);
+ SetActiveSidebarWin(0);
(*i)->pPostIt->GrabFocusToDocument();
}
}
@@ -809,7 +850,7 @@ bool SwPostItMgr::BorderOverPageBorder(unsigned long aPage) const
return false;
}
- SwMarginItem_iterator aItem = mPages[aPage-1]->mList->end();
+ SwSidebarItem_iterator aItem = mPages[aPage-1]->mList->end();
--aItem;
DBG_ASSERT ((*aItem)->pPostIt,"BorderOverPageBorder: NULL postIt, should never happen");
if ((*aItem)->pPostIt)
@@ -832,9 +873,9 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
const bool bOldUp = ArrowEnabled(KEY_PAGEUP,aPage);
const bool bOldDown = ArrowEnabled(KEY_PAGEDOWN,aPage);
const long aSidebarheight = mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height();
- for(SwMarginItem_iterator i = mPages[aPage-1]->mList->begin(); i!= mPages[aPage-1]->mList->end(); i++)
+ for(SwSidebarItem_iterator i = mPages[aPage-1]->mList->begin(); i!= mPages[aPage-1]->mList->end(); i++)
{
- SwMarginWin* pPostIt = (*i)->pPostIt;
+ SwSidebarWin* pPostIt = (*i)->pPostIt;
// if this is an answer, we should take the normal position and not the real, slightly moved position
pPostIt->SetVirtualPosSize(pPostIt->GetPosPixel(),pPostIt->GetSizePixel());
pPostIt->TranslateTopPosition(lScroll);
@@ -851,17 +892,17 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
{
if ( mpEditWin->PixelToLogic(Point(0,pPostIt->VirtualPos().Y())).Y() < (mPages[aPage-1]->mPageRect.Top()+aSidebarheight))
{
- if (mPages[aPage-1]->bMarginSide)
- pPostIt->ShowAnkorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Top()));
- else
- pPostIt->ShowAnkorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Top()));
+ if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Top()));
+ else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Top()));
}
else
{
- if (mPages[aPage-1]->bMarginSide)
- pPostIt->ShowAnkorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Bottom()));
- else
- pPostIt->ShowAnkorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Bottom()));
+ if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Bottom()));
+ else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Bottom()));
}
}
}
@@ -874,7 +915,7 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
}
}
-void SwPostItMgr::AutoScroll(const SwMarginWin* pPostIt,const unsigned long aPage )
+void SwPostItMgr::AutoScroll(const SwSidebarWin* pPostIt,const unsigned long aPage )
{
// otherwise all notes are visible
if (mPages[aPage-1]->bScrollbar)
@@ -894,7 +935,7 @@ void SwPostItMgr::AutoScroll(const SwMarginWin* pPostIt,const unsigned long aPag
}
}
-void SwPostItMgr::MakeVisible(const SwMarginWin* pPostIt,long aPage )
+void SwPostItMgr::MakeVisible(const SwSidebarWin* pPostIt,long aPage )
{
if (aPage == -1)
{
@@ -903,7 +944,7 @@ void SwPostItMgr::MakeVisible(const SwMarginWin* pPostIt,long aPage )
{
if (mPages[n]->mList->size()>0)
{
- for(SwMarginItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
{
if ((*i)->pPostIt==pPostIt)
{
@@ -952,7 +993,7 @@ Color SwPostItMgr::GetArrowColor(USHORT aDirection,unsigned long aPage) const
}
}
-bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const Rectangle aBorder, long lNeededHeight)
+bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList,const Rectangle aBorder, long lNeededHeight)
{
/*** General layout idea:***/
// - if we have space left, we always move the current one up,
@@ -982,12 +1023,12 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
bScrollbars = true;
lTopBorder += GetSidebarScrollerHeight() + 10;
lBottomBorder -= (GetSidebarScrollerHeight() + 10);
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
(*i)->SetSize(Size((*i)->VirtualSize().getWidth(),(*i)->GetMinimumSizeWithMeta()));
}
else
{
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
{
if ( (*i)->VirtualSize().getHeight() > lAverageHeight)
(*i)->SetSize(Size((*i)->VirtualSize().getWidth(),lAverageHeight));
@@ -1004,9 +1045,9 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
loop++;
bDone = true;
lSpaceUsed = lTopBorder + GetSpaceBetween();
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
{
- SwMarginWin_iterator aNextPostIt = i;
+ SwSidebarWin_iterator aNextPostIt = i;
++aNextPostIt;
if (aNextPostIt !=aVisiblePostItList.end())
@@ -1025,7 +1066,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
if ( ((*i)->VirtualPos().Y()- lTranslatePos - GetSpaceBetween()) > lTopBorder)
{
if ((*aNextPostIt)->IsFollow())
- (*i)->TranslateTopPosition(-1*(lTranslatePos+ANKORLINE_WIDTH));
+ (*i)->TranslateTopPosition(-1*(lTranslatePos+ANCHORLINE_WIDTH));
else
(*i)->TranslateTopPosition(-1*(lTranslatePos+GetSpaceBetween()));
}
@@ -1034,7 +1075,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
long lMoveUp = (*i)->VirtualPos().Y() - lTopBorder;
(*i)->TranslateTopPosition(-1* lMoveUp);
if ((*aNextPostIt)->IsFollow())
- (*aNextPostIt)->TranslateTopPosition( (lTranslatePos+ANKORLINE_WIDTH) - lMoveUp);
+ (*aNextPostIt)->TranslateTopPosition( (lTranslatePos+ANCHORLINE_WIDTH) - lMoveUp);
else
(*aNextPostIt)->TranslateTopPosition( (lTranslatePos+GetSpaceBetween()) - lMoveUp);
}
@@ -1043,7 +1084,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
{
// no space left, left move the next one down
if ((*aNextPostIt)->IsFollow())
- (*aNextPostIt)->TranslateTopPosition(lTranslatePos+ANKORLINE_WIDTH);
+ (*aNextPostIt)->TranslateTopPosition(lTranslatePos+ANCHORLINE_WIDTH);
else
(*aNextPostIt)->TranslateTopPosition(lTranslatePos+GetSpaceBetween());
}
@@ -1062,14 +1103,14 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
}
}
if (aNextPostIt !=aVisiblePostItList.end() && (*aNextPostIt)->IsFollow())
- lSpaceUsed += (*i)->VirtualSize().Height() + ANKORLINE_WIDTH;
+ lSpaceUsed += (*i)->VirtualSize().Height() + ANCHORLINE_WIDTH;
else
lSpaceUsed += (*i)->VirtualSize().Height() + GetSpaceBetween();
}
else
{
//(*i) is the last visible item
- SwMarginWin_iterator aPrevPostIt = i;
+ SwSidebarWin_iterator aPrevPostIt = i;
--aPrevPostIt;
//lTranslatePos = ( (*aPrevPostIt)->VirtualPos().Y() + (*aPrevPostIt)->VirtualSize().Height() + GetSpaceBetween() ) - (*i)->VirtualPos().Y();
lTranslatePos = ( (*aPrevPostIt)->VirtualPos().Y() + (*aPrevPostIt)->VirtualSize().Height() ) - (*i)->VirtualPos().Y();
@@ -1079,7 +1120,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
if ( ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height()+lTranslatePos) < lBottomBorder)
{
if ( (*i)->IsFollow() )
- (*i)->TranslateTopPosition(lTranslatePos+ANKORLINE_WIDTH);
+ (*i)->TranslateTopPosition(lTranslatePos+ANCHORLINE_WIDTH);
else
(*i)->TranslateTopPosition(lTranslatePos+GetSpaceBetween());
}
@@ -1111,7 +1152,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
else
{
// only one left, make sure it is not hidden at the top or bottom
- SwMarginWin_iterator i = aVisiblePostItList.begin();
+ SwSidebarWin_iterator i = aVisiblePostItList.begin();
lTranslatePos = lTopBorder - (*i)->VirtualPos().Y();
if (lTranslatePos>0)
{
@@ -1164,11 +1205,11 @@ void SwPostItMgr::AddPostIts(bool bCheckExistance, bool bFocus)
PrepareView(true);
}
-void SwPostItMgr::RemoveMarginWin()
+void SwPostItMgr::RemoveSidebarWin()
{
if (!mvPostItFlds.empty())
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
EndListening( *((*i)->GetBroadCaster()) );
if ((*i)->pPostIt)
@@ -1188,8 +1229,10 @@ void SwPostItMgr::RemoveMarginWin()
void SwPostItMgr::Delete(String aAuthor)
{
mpWrtShell->StartAllAction();
- if ( GetActivePostIt() && (GetActivePostIt()->GetAuthor()==aAuthor) )
- SetActivePostIt(0);
+ if ( HasActiveSidebarWin() && (GetActiveSidebarWin()->GetAuthor()==aAuthor) )
+ {
+ SetActiveSidebarWin(0);
+ }
SwRewriter aRewriter;
String aUndoString = SW_RES(STR_DELETE_AUTHOR_NOTES);
aUndoString += aAuthor;
@@ -1198,7 +1241,7 @@ void SwPostItMgr::Delete(String aAuthor)
std::vector<SwFmtFld*> aTmp;
aTmp.reserve( mvPostItFlds.size() );
- for(std::list<SwMarginItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
+ for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
{
if ((*pPostIt)->GetFmtFld() && ((*pPostIt)->pPostIt->GetAuthor() == aAuthor) )
aTmp.push_back( (*pPostIt)->GetFmtFld() );
@@ -1208,36 +1251,6 @@ void SwPostItMgr::Delete(String aAuthor)
mpWrtShell->GotoField( *(*i) );
mpWrtShell->DelRight();
}
- /*
- for(std::list<SwPostItItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end(); )
- {
- SwPostItItem* pItem = (*i);
- SwPostItField* pPostItField = static_cast<SwPostItField*>(pItem->pFmtFld->GetFld());
- if (pPostItField->GetPar1() == aAuthor)
- {
- // stop listening, we delete ourselves
- EndListening( *(pItem->pFmtFld) );
-
- // remove reference to yet-to-die postit
- if (pItem->pPostIt == GetActivePostIt())
- SetActivePostIt(0);
-
- // delete the actual SwPostItField
- mpWrtShell->GotoField(*pItem->pFmtFld);
- mpWrtShell->DelRight();
- i = mvPostItFlds.erase(i);
-
- // delete visual representation
- // lazy delete doesn't work because references to document (mpFmtFld, mpView etc. may be dead before deletion)
- delete pItem->pPostIt;
-
- // delete struct saving the pointers
- delete pItem;
- }
- else
- ++i;
- }
- */
mpWrtShell->EndUndo( UNDO_DELETE );
PrepareView();
mpWrtShell->EndAllAction();
@@ -1249,14 +1262,14 @@ void SwPostItMgr::Delete(String aAuthor)
void SwPostItMgr::Delete()
{
mpWrtShell->StartAllAction();
- SetActivePostIt(0);
+ SetActiveSidebarWin(0);
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_DELETE_ALL_NOTES) );
mpWrtShell->StartUndo( UNDO_DELETE, &aRewriter );
std::vector<SwFmtFld*> aTmp;
aTmp.reserve( mvPostItFlds.size() );
- for(std::list<SwMarginItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
+ for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
{
if ((*pPostIt)->GetFmtFld())
aTmp.push_back( (*pPostIt)->GetFmtFld() );
@@ -1294,7 +1307,7 @@ void SwPostItMgr::Delete()
void SwPostItMgr::Hide(SwPostItField* pPostItField )
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ((*i)->GetFmtFld())
{
@@ -1313,7 +1326,7 @@ void SwPostItMgr::Hide(SwPostItField* pPostItField )
void SwPostItMgr::Hide( const String& rAuthor )
{
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->pPostIt && ((*i)->pPostIt->GetAuthor() == rAuthor) )
{
@@ -1327,7 +1340,7 @@ void SwPostItMgr::Hide( const String& rAuthor )
void SwPostItMgr::Hide()
{
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
(*i)->bShow = false;
(*i)->pPostIt->HideNote();
@@ -1337,7 +1350,7 @@ void SwPostItMgr::Hide()
void SwPostItMgr::Show()
{
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
(*i)->bShow = true;
}
@@ -1365,7 +1378,7 @@ void SwPostItMgr::Sort(const short aType)
}
}
-SwMarginWin* SwPostItMgr::GetPostIt(SfxBroadcaster* pBroadcaster) const
+SwSidebarWin* SwPostItMgr::GetSidebarWin( const SfxBroadcaster* pBroadcaster) const
{
for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
@@ -1375,32 +1388,12 @@ SwMarginWin* SwPostItMgr::GetPostIt(SfxBroadcaster* pBroadcaster) const
return NULL;
}
-SwPostIt* SwPostItMgr::GetPostIt(SwPostItField* pFld) const
-{
- for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
- {
- if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetFld() == pFld) )
- return static_cast<SwPostIt*>((*i)->pPostIt);
- }
- return NULL;
-}
-
-SwMarginWin* SwPostItMgr::GetPostIt( const SfxBroadcaster* pBroadcaster) const
-{
- for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
- {
- if ( (*i)->GetBroadCaster() == pBroadcaster)
- return (*i)->pPostIt;
- }
- return NULL;
-}
-
-SwPostIt* SwPostItMgr::GetPostIt(const SwPostItField* pFld) const
+sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItField* pFld) const
{
for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetFld() == pFld))
- return static_cast<SwPostIt*>((*i)->pPostIt);
+ return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt);
}
return NULL;
}
@@ -1429,15 +1422,16 @@ bool SwPostItMgr::ShowPreview(const SwField* pFld, SwFmtFld*& pFmtFld) const
return false;
}
-SwMarginWin* SwPostItMgr::GetNextPostIt(USHORT aDirection, SwMarginWin* aPostIt)
+SwSidebarWin* SwPostItMgr::GetNextPostIt( USHORT aDirection,
+ SwSidebarWin* aPostIt )
{
if (mvPostItFlds.size()>1)
{
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->pPostIt ==aPostIt)
{
- SwMarginItem_iterator iNextPostIt = i;
+ SwSidebarItem_iterator iNextPostIt = i;
if (aDirection==KEY_PAGEUP)
{
if ( iNextPostIt==mvPostItFlds.begin() )
@@ -1470,11 +1464,11 @@ long SwPostItMgr::GetNextBorder()
{
for (unsigned long n=0;n<mPages.size();n++)
{
- for(SwMarginItem_iterator b = mPages[n]->mList->begin(); b!= mPages[n]->mList->end(); b++)
+ for(SwSidebarItem_iterator b = mPages[n]->mList->begin(); b!= mPages[n]->mList->end(); b++)
{
if ((*b)->pPostIt == mpActivePostIt)
{
- SwMarginItem_iterator aNext = b;
+ SwSidebarItem_iterator aNext = b;
aNext++;
bool bFollow = (aNext == mPages[n]->mList->end()) ? false : (*aNext)->pPostIt->IsFollow();
if ( mPages[n]->bScrollbar || bFollow )
@@ -1507,15 +1501,16 @@ void SwPostItMgr::SetShadowState(const SwPostItField* pFld,bool bCursor)
{
// reset old one if still alive
// TODO: does not work properly if mouse and cursor was set
- SwPostIt* pOldPostIt = GetPostIt(mShadowState.mpShadowFld);
+ sw::annotation::SwAnnotationWin* pOldPostIt =
+ GetAnnotationWin(mShadowState.mpShadowFld);
if (pOldPostIt && pOldPostIt->Shadow() && (pOldPostIt->Shadow()->GetShadowState() != SS_EDIT))
- pOldPostIt->SetViewState(SS_NORMAL);
+ pOldPostIt->SetViewState(VS_NORMAL);
}
//set new one, if it is not currently edited
- SwPostIt* pNewPostIt = GetPostIt(pFld);
+ sw::annotation::SwAnnotationWin* pNewPostIt = GetAnnotationWin(pFld);
if (pNewPostIt && pNewPostIt->Shadow() && (pNewPostIt->Shadow()->GetShadowState() != SS_EDIT))
{
- pNewPostIt->SetViewState(SS_VIEW);
+ pNewPostIt->SetViewState(VS_VIEW);
//remember our new field
mShadowState.mpShadowFld = pFld;
mShadowState.bCursor = false;
@@ -1538,10 +1533,10 @@ void SwPostItMgr::SetShadowState(const SwPostItField* pFld,bool bCursor)
if (!mShadowState.bCursor && !mShadowState.bMouse)
{
// reset old one if still alive
- SwPostIt* pOldPostIt = GetPostIt(mShadowState.mpShadowFld);
+ sw::annotation::SwAnnotationWin* pOldPostIt = GetAnnotationWin(mShadowState.mpShadowFld);
if (pOldPostIt && pOldPostIt->Shadow() && (pOldPostIt->Shadow()->GetShadowState() != SS_EDIT))
{
- pOldPostIt->SetViewState(SS_NORMAL);
+ pOldPostIt->SetViewState(VS_NORMAL);
mShadowState.mpShadowFld = 0;
}
}
@@ -1583,8 +1578,9 @@ bool SwPostItMgr::IsHit(const Point &aPointPixel)
{
Rectangle aRect;
DBG_ASSERT(mPages.size()>nPageNum-1,"SwPostitMgr:: page container size wrong");
- aRect = mPages[nPageNum-1]->bMarginSide ? Rectangle(Point(aPageFrm.Left()-GetSidebarWidth()-GetSidebarBorderWidth(),aPageFrm.Top()),Size(GetSidebarWidth(),aPageFrm.Height())) :
- Rectangle( Point(aPageFrm.Right()+GetSidebarBorderWidth(),aPageFrm.Top()) , Size(GetSidebarWidth(),aPageFrm.Height()));
+ aRect = mPages[nPageNum-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Rectangle(Point(aPageFrm.Left()-GetSidebarWidth()-GetSidebarBorderWidth(),aPageFrm.Top()),Size(GetSidebarWidth(),aPageFrm.Height()))
+ : Rectangle( Point(aPageFrm.Right()+GetSidebarBorderWidth(),aPageFrm.Top()) , Size(GetSidebarWidth(),aPageFrm.Height()));
if (aRect.IsInside(aPoint))
{
// we hit the note's sidebar
@@ -1601,8 +1597,9 @@ bool SwPostItMgr::IsHit(const Point &aPointPixel)
Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const
{
SwRect aPageRect = mPages[aPage-1]->mPageRect;
- Point aPointBottom = mPages[aPage-1]->bMarginSide ? Point(aPageRect.Left() - GetSidebarWidth() - GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height()) :
- Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
+ Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth() - GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
Size aSize(GetSidebarWidth() - mpEditWin->PixelToLogic(Size(4,0)).Width(), mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height()) ;
return Rectangle(aPointBottom,aSize);
@@ -1611,8 +1608,9 @@ Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const
Rectangle SwPostItMgr::GetTopScrollRect(const unsigned long aPage) const
{
SwRect aPageRect = mPages[aPage-1]->mPageRect;
- Point aPointTop = mPages[aPage-1]->bMarginSide ? Point(aPageRect.Left() - GetSidebarWidth() -GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height()) :
- Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
+ Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth() -GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
Size aSize(GetSidebarWidth() - mpEditWin->PixelToLogic(Size(4,0)).Width(), mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height()) ;
return Rectangle(aPointTop,aSize);
}
@@ -1622,11 +1620,13 @@ Rectangle SwPostItMgr::GetTopScrollRect(const unsigned long aPage) const
bool SwPostItMgr::ScrollbarHit(const unsigned long aPage,const Point &aPoint)
{
SwRect aPageRect = mPages[aPage-1]->mPageRect;
- Point aPointBottom = mPages[aPage-1]->bMarginSide ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height()) :
- Point(aPageRect.Right() + GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
+ Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
- Point aPointTop = mPages[aPage-1]->bMarginSide ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height()) :
- Point(aPageRect.Right()+GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
+ Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height())
+ : Point(aPageRect.Right()+GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
Rectangle aRectBottom(GetBottomScrollRect(aPage));
Rectangle aRectTop(GetTopScrollRect(aPage));
@@ -1657,8 +1657,8 @@ void SwPostItMgr::CorrectPositions()
return;
// find first valid note
- SwMarginWin *pFirstPostIt = 0;
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ SwSidebarWin *pFirstPostIt = 0;
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
pFirstPostIt = (*i)->pPostIt;
if (pFirstPostIt)
@@ -1670,23 +1670,23 @@ void SwPostItMgr::CorrectPositions()
return;
// yeah, I know, if this is a left page it could be wrong, but finding the page and the note is probably not even faster than just doing it
- const long aAnkorX = mpEditWin->LogicToPixel( Point((long)(pFirstPostIt->Ankor()->GetSixthPosition().getX()),0)).X();
- const long aAnkorY = mpEditWin->LogicToPixel( Point(0,(long)(pFirstPostIt->Ankor()->GetSixthPosition().getY()))).Y() + 1;
- if (Point(aAnkorX,aAnkorY) != pFirstPostIt->GetPosPixel())
+ const long aAnchorX = mpEditWin->LogicToPixel( Point((long)(pFirstPostIt->Anchor()->GetSixthPosition().getX()),0)).X();
+ const long aAnchorY = mpEditWin->LogicToPixel( Point(0,(long)(pFirstPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
+ if (Point(aAnchorX,aAnchorY) != pFirstPostIt->GetPosPixel())
{
- long aAnkorPosX = 0;
- long aAnkorPosY = 0;
+ long aAnchorPosX = 0;
+ long aAnchorPosY = 0;
for (unsigned long n=0;n<mPages.size();n++)
{
- for(SwMarginItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
{
if ((*i)->bShow && (*i)->pPostIt)
{
- aAnkorPosX = mPages[n]->bMarginSide ?
- mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Ankor()->GetSeventhPosition().getX()),0)).X() :
- mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Ankor()->GetSixthPosition().getX()),0)).X();
- aAnkorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Ankor()->GetSixthPosition().getY()))).Y() + 1;
- (*i)->pPostIt->SetPosPixel(Point(aAnkorPosX,aAnkorPosY));
+ aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSeventhPosition().getX()),0)).X()
+ : mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSixthPosition().getX()),0)).X();
+ aAnchorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
+ (*i)->pPostIt->SetPosPixel(Point(aAnchorPosX,aAnchorPosY));
}
}
}
@@ -1757,29 +1757,29 @@ Color SwPostItMgr::GetColorLight(sal_uInt16 aAuthorIndex)
return Color(COL_WHITE);
}
-Color SwPostItMgr::GetColorAnkor(sal_uInt16 aAuthorIndex)
+Color SwPostItMgr::GetColorAnchor(sal_uInt16 aAuthorIndex)
{
if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
{
- static const Color aArrayAnkor[] = {
+ static const Color aArrayAnchor[] = {
COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
- return Color( aArrayAnkor[ aAuthorIndex % (sizeof( aArrayAnkor ) / sizeof( aArrayAnkor[0] ))]);
+ return Color( aArrayAnchor[ aAuthorIndex % (sizeof( aArrayAnchor ) / sizeof( aArrayAnchor[0] ))]);
}
else
return Color(COL_WHITE);
}
-void SwPostItMgr::SetActivePostIt( SwMarginWin* p)
+void SwPostItMgr::SetActiveSidebarWin( SwSidebarWin* p)
{
if ( p != mpActivePostIt )
{
// we need the temp variable so we can set mpActivePostIt before we call DeactivatePostIt
// therefore we get a new layout in DOCCHANGED when switching from postit to document,
// otherwise, GetActivePostIt() would still hold our old postit
- SwMarginWin* pActive = mpActivePostIt;
+ SwSidebarWin* pActive = mpActivePostIt;
mpActivePostIt = p;
if (pActive)
{
@@ -1816,7 +1816,7 @@ IMPL_LINK( SwPostItMgr, CalcHdl, void*, /* pVoid*/ )
void SwPostItMgr::Rescale()
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
if ( (*i)->pPostIt )
(*i)->pPostIt->Rescale();
}
@@ -1824,7 +1824,7 @@ void SwPostItMgr::Rescale()
sal_Int32 SwPostItMgr::GetInitialAnchorDistance() const
{
const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_INITIAL_ANKOR_DISTANCE * f.GetNumerator() / f.GetDenominator();
+ return POSTIT_INITIAL_ANCHOR_DISTANCE * f.GetNumerator() / f.GetDenominator();
}
sal_Int32 SwPostItMgr::GetSpaceBetween() const
@@ -1853,21 +1853,21 @@ sal_Int32 SwPostItMgr::GetSidebarScrollerHeight() const
void SwPostItMgr::SetSpellChecking()
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
if ( (*i)->pPostIt )
(*i)->pPostIt->SetSpellChecking();
}
void SwPostItMgr::SetReadOnlyState()
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
if ( (*i)->pPostIt )
(*i)->pPostIt->SetReadonly( mbReadOnly );
}
void SwPostItMgr::CheckMetaText()
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
if ( (*i)->pPostIt )
(*i)->pPostIt->CheckMetaText();
@@ -1875,45 +1875,45 @@ void SwPostItMgr::CheckMetaText()
sal_uInt16 SwPostItMgr::Replace(SvxSearchItem* pItem)
{
- SwMarginWin* pWin = GetActivePostIt();
- sal_uInt16 aResult = pWin->View()->StartSearchAndReplace( *pItem );
+ SwSidebarWin* pWin = GetActiveSidebarWin();
+ sal_uInt16 aResult = pWin->GetOutlinerView()->StartSearchAndReplace( *pItem );
if (!aResult)
- SetActivePostIt(0);
+ SetActiveSidebarWin(0);
return aResult;
}
sal_uInt16 SwPostItMgr::FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions, bool bSrchForward)
{
- SwMarginWin* pWin = GetActivePostIt();
+ SwSidebarWin* pWin = GetActiveSidebarWin();
SvxSearchItem aItem(SID_SEARCH_ITEM );
aItem.SetSearchOptions(rSearchOptions);
aItem.SetBackward(!bSrchForward);
- sal_uInt16 aResult = pWin->View()->StartSearchAndReplace( aItem );
+ sal_uInt16 aResult = pWin->GetOutlinerView()->StartSearchAndReplace( aItem );
if (!aResult)
- SetActivePostIt(0);
+ SetActiveSidebarWin(0);
return aResult;
}
sal_uInt16 SwPostItMgr::SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions, bool bSrchForward)
{
sal_uInt16 aResult = 0;
- SwMarginWin* pWin = GetPostIt(&pFld);
+ SwSidebarWin* pWin = GetSidebarWin(&pFld);
if (pWin)
{
- ESelection aOldSelection = pWin->View()->GetSelection();
+ ESelection aOldSelection = pWin->GetOutlinerView()->GetSelection();
if (bSrchForward)
- pWin->View()->SetSelection(ESelection(0,0,0,0));
+ pWin->GetOutlinerView()->SetSelection(ESelection(0,0,0,0));
else
- pWin->View()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
+ pWin->GetOutlinerView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
SvxSearchItem aItem(SID_SEARCH_ITEM );
aItem.SetSearchOptions(rSearchOptions);
aItem.SetBackward(!bSrchForward);
- aResult = pWin->View()->StartSearchAndReplace( aItem );
+ aResult = pWin->GetOutlinerView()->StartSearchAndReplace( aItem );
if (!aResult)
- pWin->View()->SetSelection(aOldSelection);
+ pWin->GetOutlinerView()->SetSelection(aOldSelection);
else
{
- SetActivePostIt(pWin);
+ SetActiveSidebarWin(pWin);
MakeVisible(pWin);
}
}
@@ -1945,6 +1945,121 @@ void SwPostItMgr::AssureStdModeAtShell()
}
}
+bool SwPostItMgr::HasActiveSidebarWin() const
+{
+ return mpActivePostIt != 0;
+}
+
+bool SwPostItMgr::HasActiveAnnotationWin() const
+{
+ return HasActiveSidebarWin() &&
+ dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt) != 0;
+}
+
+void SwPostItMgr::GrabFocusOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->GrabFocus();
+ }
+}
+
+void SwPostItMgr::UpdateDataOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->UpdateData();
+ }
+}
+
+void SwPostItMgr::DeleteActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->Delete();
+ }
+}
+
+void SwPostItMgr::HideActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->Hide();
+ }
+}
+
+void SwPostItMgr::ToggleInsModeOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->ToggleInsMode();
+ }
+}
+
+void SwPostItMgr::ConnectSidebarWinToFrm( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin )
+{
+ if ( mpFrmSidebarWinContainer == 0 )
+ {
+ mpFrmSidebarWinContainer = new SwFrmSidebarWinContainer();
+ }
+
+ const bool bInserted = mpFrmSidebarWinContainer->insert( rFrm, rFmtFld, rSidebarWin );
+ if ( bInserted &&
+ mpWrtShell->GetAccessibleMap() )
+ {
+ mpWrtShell->GetAccessibleMap()->InvalidatePosOrSize( 0, 0, &rSidebarWin, SwRect() );
+ }
+}
+
+void SwPostItMgr::DisconnectSidebarWinFromFrm( const SwFrm& rFrm,
+ SwSidebarWin& rSidebarWin )
+{
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ const bool bRemoved = mpFrmSidebarWinContainer->remove( rFrm, rSidebarWin );
+ if ( bRemoved &&
+ mpWrtShell->GetAccessibleMap() )
+ {
+ mpWrtShell->GetAccessibleMap()->Dispose( 0, 0, &rSidebarWin );
+ }
+ }
+}
+
+bool SwPostItMgr::HasFrmConnectedSidebarWins( const SwFrm& rFrm )
+{
+ bool bRet( false );
+
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ bRet = !mpFrmSidebarWinContainer->empty( rFrm );
+ }
+
+ return bRet;
+}
+
+Window* SwPostItMgr::GetSidebarWinForFrmByIndex( const SwFrm& rFrm,
+ const sal_Int32 nIndex )
+{
+ Window* pSidebarWin( 0 );
+
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ pSidebarWin = mpFrmSidebarWinContainer->get( rFrm, nIndex );
+ }
+
+ return pSidebarWin;
+}
+
+void SwPostItMgr::GetAllSidebarWinForFrm( const SwFrm& rFrm,
+ std::vector< Window* >* pChildren )
+{
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ mpFrmSidebarWinContainer->getAll( rFrm, pChildren );
+ }
+}
+
void SwNoteProps::Commit() {}
void SwNoteProps::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
-
diff --git a/sw/source/ui/docvw/ShadowOverlayObject.cxx b/sw/source/ui/docvw/ShadowOverlayObject.cxx
new file mode 100644
index 000000000000..21225e39f92e
--- /dev/null
+++ b/sw/source/ui/docvw/ShadowOverlayObject.cxx
@@ -0,0 +1,269 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postit.cxx,v $
+ * $Revision: 1.8.42.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <ShadowOverlayObject.hxx>
+
+#include <view.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/attribute/fillattribute.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+//////////////////////////////////////////////////////////////////////////////
+// helper SwPostItShadowPrimitive
+//
+// Used to allow view-dependent primitive definition. For that purpose, the
+// initially created primitive (this one) always has to be view-independent,
+// but the decomposition is made view-dependent. Very simple primitive which
+// just remembers the discrete data and applies it at decomposition time.
+
+class ShadowPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
+{
+private:
+ basegfx::B2DPoint maBasePosition;
+ basegfx::B2DPoint maSecondPosition;
+ ShadowState maShadowState;
+
+protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
+
+public:
+ ShadowPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ const basegfx::B2DPoint& rSecondPosition,
+ ShadowState aShadowState)
+ : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
+ maBasePosition(rBasePosition),
+ maSecondPosition(rSecondPosition),
+ maShadowState(aShadowState)
+ {}
+
+ // data access
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
+ ShadowState getShadowState() const { return maShadowState; }
+
+ virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+};
+
+drawinglayer::primitive2d::Primitive2DSequence ShadowPrimitive::create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ // get logic sizes in object coordinate system
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ basegfx::B2DRange aRange(getBasePosition());
+
+ switch(maShadowState)
+ {
+ case SS_NORMAL:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (2.0 * getDiscreteUnit())));
+ const ::drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
+ 2);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ case SS_VIEW:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
+ 4);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ case SS_EDIT:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0),
+ 4);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ return xRetval;
+}
+
+bool ShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
+{
+ if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const ShadowPrimitive& rCompare = static_cast< const ShadowPrimitive& >(rPrimitive);
+
+ return (getBasePosition() == rCompare.getBasePosition()
+ && getSecondPosition() == rCompare.getSecondPosition()
+ && getShadowState() == rCompare.getShadowState());
+ }
+
+ return false;
+}
+
+ImplPrimitrive2DIDBlock(ShadowPrimitive, PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE)
+
+/****** ShadowOverlayObject **************************************************/
+/* static */ ShadowOverlayObject* ShadowOverlayObject::CreateShadowOverlayObject( SwView& rDocView )
+{
+ ShadowOverlayObject* pShadowOverlayObject( 0 );
+
+ if ( rDocView.GetDrawView() )
+ {
+ SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
+ if( pPaintWindow )
+ {
+ sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager();
+
+ if ( pOverlayManager )
+ {
+ pShadowOverlayObject = new ShadowOverlayObject( basegfx::B2DPoint(0,0),
+ basegfx::B2DPoint(0,0),
+ Color(0,0,0),
+ SS_NORMAL );
+ pOverlayManager->add(*pShadowOverlayObject);
+ }
+ }
+ }
+
+ return pShadowOverlayObject;
+}
+
+/* static */ void ShadowOverlayObject::DestroyShadowOverlayObject( ShadowOverlayObject* pShadow )
+{
+ if ( pShadow )
+ {
+ if ( pShadow->getOverlayManager() )
+ {
+ pShadow->getOverlayManager()->remove(*pShadow);
+ }
+ delete pShadow;
+ }
+}
+
+ShadowOverlayObject::ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPosition,
+ Color aBaseColor,
+ ShadowState aState )
+ : OverlayObjectWithBasePosition(rBasePos, aBaseColor)
+ , maSecondPosition(rSecondPosition)
+ , mShadowState(aState)
+{
+}
+
+ShadowOverlayObject::~ShadowOverlayObject()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ShadowOverlayObject::createOverlayObjectPrimitive2DSequence()
+{
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new ShadowPrimitive( getBasePosition(),
+ GetSecondPosition(),
+ GetShadowState() ) );
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+}
+
+void ShadowOverlayObject::SetShadowState(ShadowState aState)
+{
+ if (mShadowState != aState)
+ {
+ mShadowState = aState;
+
+ objectChange();
+ }
+}
+
+void ShadowOverlayObject::SetPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2)
+{
+ if(!rPoint1.equal(getBasePosition()) || !rPoint2.equal(GetSecondPosition()))
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+
+ objectChange();
+ }
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/ShadowOverlayObject.hxx b/sw/source/ui/docvw/ShadowOverlayObject.hxx
new file mode 100644
index 000000000000..a00aea380fdb
--- /dev/null
+++ b/sw/source/ui/docvw/ShadowOverlayObject.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SHADOWOVERLAYOBJECT_HXX
+#define _SHADOWOVERLAYOBJECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+class SwView;
+
+namespace sw { namespace sidebarwindows {
+
+enum ShadowState
+{
+ SS_NORMAL,
+ SS_VIEW,
+ SS_EDIT
+};
+
+class ShadowOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
+{
+ protected:
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ private:
+ basegfx::B2DPoint maSecondPosition;
+ ShadowState mShadowState;
+
+ ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPosition,
+ Color aBaseColor,
+ ShadowState aState );
+ virtual ~ShadowOverlayObject();
+
+ public:
+ void SetShadowState(ShadowState aState);
+ inline ShadowState GetShadowState() {return mShadowState;}
+
+ inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
+ void SetSecondPosition( const basegfx::B2DPoint& rNew );
+
+ void SetPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2 );
+
+ static ShadowOverlayObject* CreateShadowOverlayObject( SwView& rDocView );
+ static void DestroyShadowOverlayObject( ShadowOverlayObject* pShadow );
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarTxtControl.cxx b/sw/source/ui/docvw/SidebarTxtControl.cxx
new file mode 100644
index 000000000000..61d4884157cf
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControl.cxx
@@ -0,0 +1,422 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarTxtControl.hxx>
+
+#include <SidebarTxtControlAcc.hxx>
+
+#include <SidebarWin.hxx>
+#include <PostItMgr.hxx>
+
+#include <cmdid.h>
+#include <docvw.hrc>
+
+#include <unotools/securityoptions.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/mnumgr.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/scrbar.hxx>
+
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/flditem.hxx>
+
+#include <uitool.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <shellres.hxx>
+#include <SwRewriter.hxx>
+#include <undobj.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+SidebarTxtControl::SidebarTxtControl( SwSidebarWin& rSidebarWin,
+ WinBits nBits,
+ SwView& rDocView,
+ SwPostItMgr& rPostItMgr )
+ : Control( &rSidebarWin, nBits )
+ , mrSidebarWin( rSidebarWin )
+ , mrDocView( rDocView )
+ , mrPostItMgr( rPostItMgr )
+ , mbMouseOver( false )
+{
+ AddEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+}
+
+SidebarTxtControl::~SidebarTxtControl()
+{
+ RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+}
+
+OutlinerView* SidebarTxtControl::GetTextView() const
+{
+ return mrSidebarWin.GetOutlinerView();
+}
+
+void SidebarTxtControl::GetFocus()
+{
+ Window::GetFocus();
+ if ( !mrSidebarWin.IsMouseOver() )
+ {
+ Invalidate();
+ }
+}
+
+void SidebarTxtControl::LoseFocus()
+{
+ // write the visible text back into the SwField
+ mrSidebarWin.UpdateData();
+
+ Window::LoseFocus();
+ if ( !mrSidebarWin.IsMouseOver() )
+ {
+ Invalidate();
+ }
+}
+
+void SidebarTxtControl::RequestHelp(const HelpEvent &rEvt)
+{
+ USHORT nResId = 0;
+ switch( mrSidebarWin.GetLayoutStatus() )
+ {
+ case SwPostItHelper::INSERTED: nResId = STR_REDLINE_INSERT; break;
+ case SwPostItHelper::DELETED: nResId = STR_REDLINE_DELETE; break;
+ default: nResId = 0;
+ }
+
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
+ if ( nResId &&
+ mrDocView.GetWrtShell().GetContentAtPos( mrSidebarWin.GetAnchorPos(), aCntntAtPos ) )
+ {
+ String sTxt;
+ sTxt = SW_RESSTR( nResId );
+ sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " ));
+ sTxt += aCntntAtPos.aFnd.pRedl->GetAuthorString();
+ sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ));
+ sTxt += GetAppLangDateTimeString( aCntntAtPos.aFnd.pRedl->GetTimeStamp() );
+ Help::ShowQuickHelp( this,PixelToLogic(Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sTxt);
+ }
+}
+
+void SidebarTxtControl::Paint( const Rectangle& rRect)
+{
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ if ( mrSidebarWin.IsMouseOverSidebarWin() ||
+ HasFocus() )
+ {
+ DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ),
+ Gradient( GRADIENT_LINEAR,
+ mrSidebarWin.ColorDark(),
+ mrSidebarWin.ColorDark() ) );
+ }
+ else
+ {
+ DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ),
+ Gradient( GRADIENT_LINEAR,
+ mrSidebarWin.ColorLight(),
+ mrSidebarWin.ColorDark()));
+ }
+ }
+
+ if ( GetTextView() )
+ {
+ GetTextView()->Paint( rRect );
+ }
+
+ if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED )
+ {
+ SetLineColor(mrSidebarWin.GetChangeColor());
+ DrawLine( PixelToLogic( GetPosPixel() ),
+ PixelToLogic( GetPosPixel() +
+ Point( GetSizePixel().Width(),
+ GetSizePixel().Height() ) ) );
+ DrawLine( PixelToLogic( GetPosPixel() +
+ Point( GetSizePixel().Width(),0) ),
+ PixelToLogic( GetPosPixel() +
+ Point( 0, GetSizePixel().Height() ) ) );
+ }
+}
+
+void SidebarTxtControl::KeyInput( const KeyEvent& rKeyEvt )
+{
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ USHORT nKey = rKeyCode.GetCode();
+ if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) &&
+ ( (nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN) ) )
+ {
+ mrSidebarWin.SwitchToPostIt(nKey);
+ }
+ else if ( nKey == KEY_ESCAPE ||
+ ( rKeyCode.IsMod1() &&
+ ( nKey == KEY_PAGEUP ||
+ nKey == KEY_PAGEDOWN ) ) )
+ {
+ mrSidebarWin.SwitchToFieldPos();
+ }
+ else if ( nKey == KEY_INSERT )
+ {
+ if ( !rKeyCode.IsMod1() && !rKeyCode.IsMod2() )
+ {
+ mrSidebarWin.ToggleInsMode();
+ }
+ }
+ else
+ {
+ //let's make sure we see our note
+ mrPostItMgr.MakeVisible(&mrSidebarWin);
+
+ long aOldHeight = mrSidebarWin.GetPostItTextHeight();
+ bool bDone = false;
+
+ /// HACK: need to switch off processing of Undo/Redo in Outliner
+ if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
+ {
+ bool bIsProtected = mrSidebarWin.IsProtected();
+ if ( !bIsProtected ||
+ ( bIsProtected &&
+ !mrSidebarWin.GetOutlinerView()->GetOutliner()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
+ {
+ bDone = GetTextView() && GetTextView()->PostKeyEvent( rKeyEvt );
+ }
+ else
+ {
+ InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
+ }
+ }
+ if (bDone)
+ mrSidebarWin.ResizeIfNeccessary( aOldHeight, mrSidebarWin.GetPostItTextHeight() );
+ else
+ {
+ // write back data first when showing navigator
+ if ( nKey==KEY_F5 )
+ mrSidebarWin.UpdateData();
+ if (!mrDocView.KeyInput(rKeyEvt))
+ Window::KeyInput(rKeyEvt);
+ }
+ }
+
+ mrDocView.GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+}
+
+void SidebarTxtControl::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ {
+ OutlinerView* pOutlinerView( GetTextView() );
+ pOutlinerView->MouseMove( rMEvt );
+ // mba: why does OutlinerView not handle the modifier setting?!
+ // this forces the postit to handle *all* pointer types
+ SetPointer( pOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
+
+ const EditView& aEV = pOutlinerView->GetEditView();
+ const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
+ if ( pItem )
+ {
+ const SvxFieldData* pFld = pItem->GetField();
+ const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
+ if ( pURL )
+ {
+ String sURL( pURL->GetURL() );
+ SvtSecurityOptions aSecOpts;
+ if ( aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK) )
+ {
+ sURL.InsertAscii( ": ", 0 );
+ sURL.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
+ }
+ Help::ShowQuickHelp( this,PixelToLogic(Rectangle(GetPosPixel(),Size(50,10))),sURL);
+ }
+ }
+ }
+}
+
+void SidebarTxtControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ {
+ SvtSecurityOptions aSecOpts;
+ bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK);
+
+ if ( !bExecuteMod || (bExecuteMod && rMEvt.GetModifier() == KEY_MOD1))
+ {
+ const EditView& aEV = GetTextView()->GetEditView();
+ const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
+ if ( pItem )
+ {
+ const SvxFieldData* pFld = pItem->GetField();
+ const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
+ if ( pURL )
+ {
+ GetTextView()->MouseButtonDown( rMEvt );
+ SwWrtShell &rSh = mrDocView.GetWrtShell();
+ String sURL( pURL->GetURL() );
+ String sTarget( pURL->GetTargetFrame() );
+ ::LoadURL( sURL, &rSh, URLLOAD_NOFILTER, &sTarget);
+ return;
+ }
+ }
+ }
+ }
+
+ GrabFocus();
+ if ( GetTextView() )
+ {
+ GetTextView()->MouseButtonDown( rMEvt );
+ }
+ mrDocView.GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+}
+
+void SidebarTxtControl::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ GetTextView()->MouseButtonUp( rMEvt );
+}
+
+IMPL_LINK( SidebarTxtControl, OnlineSpellCallback, SpellCallbackInfo*, pInfo )
+{
+ if ( pInfo->nCommand == SPELLCMD_STARTSPELLDLG )
+ {
+ mrDocView.GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
+ }
+ return 0;
+}
+
+IMPL_LINK( SidebarTxtControl, Select, Menu*, pSelMenu )
+{
+ mrSidebarWin.ExecuteCommand( pSelMenu->GetCurItemId() );
+ return 0;
+}
+
+void SidebarTxtControl::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ if ( !mrSidebarWin.IsProtected() &&
+ GetTextView() &&
+ GetTextView()->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(),TRUE ))
+ {
+ Link aLink = LINK(this, SidebarTxtControl, OnlineSpellCallback);
+ GetTextView()->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
+ }
+ else
+ {
+ SfxPopupMenuManager* aMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel());
+ ((PopupMenu*)aMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) );
+
+ {
+ XubString aText = ((PopupMenu*)aMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR );
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, mrSidebarWin.GetAuthor());
+ aText = aRewriter.Apply(aText);
+ ((PopupMenu*)aMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
+ }
+
+ if (rCEvt.IsMouseEvent())
+ ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,rCEvt.GetMousePosPixel());
+ else
+ {
+ const Size aSize = GetSizePixel();
+ const Point aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
+ ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,aPos);
+ }
+ delete aMgr;
+ }
+ }
+ else
+ if (rCEvt.GetCommand() == COMMAND_WHEEL)
+ {
+ if (mrSidebarWin.IsScrollbarVisible())
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if (pData->IsShift() || pData->IsMod1() || pData->IsMod2())
+ {
+ mrDocView.HandleWheelCommands(rCEvt);
+ }
+ else
+ {
+ HandleScrollCommand( rCEvt, 0 , mrSidebarWin.Scrollbar());
+ }
+ }
+ else
+ {
+ mrDocView.HandleWheelCommands(rCEvt);
+ }
+ }
+ else
+ {
+ if ( GetTextView() )
+ GetTextView()->Command( rCEvt );
+ else
+ Window::Command(rCEvt);
+ }
+}
+
+XubString SidebarTxtControl::GetSurroundingText() const
+{
+ if( GetTextView() )
+ return GetTextView()->GetSurroundingText();
+ else
+ return XubString::EmptyString();
+}
+
+Selection SidebarTxtControl::GetSurroundingTextSelection() const
+{
+ if( GetTextView() )
+ return GetTextView()->GetSurroundingTextSelection();
+ else
+ return Selection( 0, 0 );
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SidebarTxtControl::CreateAccessible()
+{
+
+ SidebarTxtControlAccessible* pAcc( new SidebarTxtControlAccessible( *this ) );
+ css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
+ SetWindowPeer( xWinPeer, pAcc );
+
+ css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/SidebarTxtControl.hxx b/sw/source/ui/docvw/SidebarTxtControl.hxx
new file mode 100644
index 000000000000..08a5de0003c4
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControl.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARTXTCONTROL_HXX
+#define _SIDEBARTXTCONTROL_HXX
+
+#include <vcl/ctrl.hxx>
+
+class OutlinerView;
+class SwView;
+class SwPostItMgr;
+class SpellCallbackInfo;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+
+class SidebarTxtControl : public Control
+{
+ private:
+ SwSidebarWin& mrSidebarWin;
+ SwView& mrDocView;
+ SwPostItMgr& mrPostItMgr;
+
+ bool mbMouseOver;
+
+ protected:
+ virtual void Paint( const Rectangle& rRect);
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void LoseFocus();
+ virtual void RequestHelp(const HelpEvent &rEvt);
+ virtual XubString GetSurroundingText() const;
+ virtual Selection GetSurroundingTextSelection() const;
+
+ DECL_LINK( Select, Menu* );
+
+ public:
+ SidebarTxtControl( SwSidebarWin& rSidebarWin,
+ WinBits nBits,
+ SwView& rDocView,
+ SwPostItMgr& rPostItMgr );
+ ~SidebarTxtControl();
+
+ virtual void GetFocus();
+
+ OutlinerView* GetTextView() const;
+
+ DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarTxtControlAcc.cxx b/sw/source/ui/docvw/SidebarTxtControlAcc.cxx
new file mode 100644
index 000000000000..8b0f0293367c
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControlAcc.cxx
@@ -0,0 +1,317 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarTxtControlAcc.hxx>
+
+#include <SidebarTxtControl.hxx>
+
+#include <svl/brdcst.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <editeng/unoforou.hxx>
+#include <editeng/unoviwou.hxx>
+#include <editeng/unoedhlp.hxx>
+#include <svx/AccessibleTextHelper.hxx>
+#include <editeng/outliner.hxx>
+
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+// =============================================================================
+// declaration and implementation of <SvxEditSource>
+// for <::accessibiliy::AccessibleTextHelper> instance
+// =============================================================================
+class SidebarTextEditSource : public SvxEditSource,
+ public SfxBroadcaster
+{
+ public:
+ SidebarTextEditSource( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTextEditSource();
+
+ virtual SvxEditSource* Clone() const;
+
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual SvxViewForwarder* GetViewForwarder();
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+
+ virtual void UpdateData();
+
+ virtual SfxBroadcaster& GetBroadcaster() const;
+ DECL_LINK( NotifyHdl, EENotify* );
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
+ SvxOutlinerForwarder mTextForwarder;
+ SvxDrawOutlinerViewForwarder mViewForwarder;
+};
+
+SidebarTextEditSource::SidebarTextEditSource( SidebarTxtControl& rSidebarTxtControl )
+ : SvxEditSource()
+ , mrSidebarTxtControl( rSidebarTxtControl )
+ , mTextForwarder( *(rSidebarTxtControl.GetTextView()->GetOutliner()), NULL )
+ , mViewForwarder( *(rSidebarTxtControl.GetTextView()) )
+{
+ if ( mrSidebarTxtControl.GetTextView() )
+ {
+ mrSidebarTxtControl.GetTextView()->GetOutliner()->SetNotifyHdl( LINK(this, SidebarTextEditSource, NotifyHdl) );
+ }
+}
+
+SidebarTextEditSource::~SidebarTextEditSource()
+{
+ if ( mrSidebarTxtControl.GetTextView() )
+ {
+ mrSidebarTxtControl.GetTextView()->GetOutliner()->SetNotifyHdl( Link() );
+ }
+}
+
+SvxEditSource* SidebarTextEditSource::Clone() const
+{
+ return new SidebarTextEditSource( mrSidebarTxtControl );
+}
+
+SvxTextForwarder* SidebarTextEditSource::GetTextForwarder()
+{
+ return &mTextForwarder;
+}
+
+SvxViewForwarder* SidebarTextEditSource::GetViewForwarder()
+{
+ return &mViewForwarder;
+}
+
+SvxEditViewForwarder* SidebarTextEditSource::GetEditViewForwarder( sal_Bool /*bCreate*/ )
+{
+ return &mViewForwarder;
+}
+
+void SidebarTextEditSource::UpdateData()
+{
+ // nothing to do
+}
+
+SfxBroadcaster& SidebarTextEditSource::GetBroadcaster() const
+{
+ return *( const_cast< SidebarTextEditSource* > (this) );
+}
+
+IMPL_LINK(SidebarTextEditSource, NotifyHdl, EENotify*, pNotify)
+{
+ if ( pNotify )
+ {
+ ::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( pNotify ) );
+
+ if( aHint.get() )
+ {
+ Broadcast( *aHint.get() );
+ }
+ }
+
+ return 0;
+}
+
+
+// =============================================================================
+// declaration and implementation of accessible context for <SidebarTxtControl> instance
+// =============================================================================
+class SidebarTxtControlAccessibleContext : public VCLXAccessibleComponent
+{
+ public:
+ explicit SidebarTxtControlAccessibleContext( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTxtControlAccessibleContext();
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 i )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ using WeakAggComponentImplHelperBase::addEventListener;
+ using WeakAggComponentImplHelperBase::removeEventListener;
+
+ virtual void SAL_CALL
+ addEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ removeEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
+ ::accessibility::AccessibleTextHelper* mpAccessibleTextHelper;
+
+ ::vos::OMutex maMutex;
+
+ void defunc();
+};
+
+SidebarTxtControlAccessibleContext::SidebarTxtControlAccessibleContext( SidebarTxtControl& rSidebarTxtControl )
+ : VCLXAccessibleComponent( rSidebarTxtControl.GetWindowPeer() )
+ , mrSidebarTxtControl( rSidebarTxtControl )
+ , mpAccessibleTextHelper( 0 )
+ , maMutex()
+{
+ ::std::auto_ptr<SvxEditSource> pEditSource(
+ new SidebarTextEditSource( mrSidebarTxtControl ) );
+ mpAccessibleTextHelper = new ::accessibility::AccessibleTextHelper( pEditSource );
+ mpAccessibleTextHelper->SetEventSource( mrSidebarTxtControl.GetWindowPeer() );
+}
+
+SidebarTxtControlAccessibleContext::~SidebarTxtControlAccessibleContext()
+{
+ defunc();
+}
+
+void SidebarTxtControlAccessibleContext::defunc()
+{
+ delete mpAccessibleTextHelper;
+ mpAccessibleTextHelper = 0;
+}
+
+sal_Int32 SAL_CALL SidebarTxtControlAccessibleContext::getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ sal_Int32 nChildCount( 0 );
+
+ if ( mpAccessibleTextHelper )
+ {
+ nChildCount = mpAccessibleTextHelper->GetChildCount();
+ }
+
+ return nChildCount;
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SAL_CALL SidebarTxtControlAccessibleContext::getAccessibleChild( sal_Int32 i )
+ throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException )
+{
+ vos::OGuard aGuard( maMutex );
+
+ css::uno::Reference< css::accessibility::XAccessible > xChild;
+
+ if ( mpAccessibleTextHelper )
+ {
+ xChild = mpAccessibleTextHelper->GetChild( i );
+ }
+
+ return xChild;
+}
+
+void SAL_CALL SidebarTxtControlAccessibleContext::addEventListener (
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener)
+ throw (css::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ if ( mpAccessibleTextHelper )
+ {
+ mpAccessibleTextHelper->AddEventListener(xListener);
+ }
+}
+
+void SAL_CALL SidebarTxtControlAccessibleContext::removeEventListener (
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener)
+ throw (css::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ if ( mpAccessibleTextHelper )
+ {
+ mpAccessibleTextHelper->RemoveEventListener(xListener);
+ }
+}
+
+void SidebarTxtControlAccessibleContext::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ if ( mpAccessibleTextHelper )
+ {
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_OBJECT_DYING:
+ {
+ defunc();
+ }
+ break;
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_CONTROL_GETFOCUS:
+ {
+ mpAccessibleTextHelper->SetFocus( sal_True );
+ }
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ case VCLEVENT_CONTROL_LOSEFOCUS:
+ {
+ mpAccessibleTextHelper->SetFocus( sal_False );
+ }
+ break;
+ }
+ }
+
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+}
+
+// =============================================================================
+// implementaion of accessible for <SidebarTxtControl> instance
+// =============================================================================
+SidebarTxtControlAccessible::SidebarTxtControlAccessible( SidebarTxtControl& rSidebarTxtControl )
+ : VCLXWindow()
+ , mrSidebarTxtControl( rSidebarTxtControl )
+{
+ SetWindow( &mrSidebarTxtControl );
+}
+
+SidebarTxtControlAccessible::~SidebarTxtControlAccessible()
+{
+}
+
+css::uno::Reference< css::accessibility::XAccessibleContext > SidebarTxtControlAccessible::CreateAccessibleContext()
+{
+ SidebarTxtControlAccessibleContext* pAccContext(
+ new SidebarTxtControlAccessibleContext( mrSidebarTxtControl ) );
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc( pAccContext );
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/SidebarTxtControlAcc.hxx b/sw/source/ui/docvw/SidebarTxtControlAcc.hxx
new file mode 100644
index 000000000000..57edc50512d5
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControlAcc.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARTXTCONTROLACC_HXX
+#define _SIDEBARTXTCONTROLACC_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+class SidebarTxtControl;
+
+class SidebarTxtControlAccessible : public VCLXWindow
+{
+ public:
+ explicit SidebarTxtControlAccessible( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTxtControlAccessible();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx
new file mode 100644
index 000000000000..cce6db3a891b
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWin.cxx
@@ -0,0 +1,1373 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarWin.hxx>
+#include <SidebarWinAcc.hxx>
+#include <PostItMgr.hxx>
+
+#include <SidebarTxtControl.hxx>
+#include <AnchorOverlayObject.hxx>
+#include <ShadowOverlayObject.hxx>
+
+#include <annotation.hrc>
+#include <popup.hrc>
+#include <docvw.hrc>
+#include <app.hrc>
+#include <access.hrc>
+
+#include <viewopt.hxx>
+#include <cmdid.h>
+
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/eeitem.hxx>
+
+#include <svl/zforlist.hxx>
+#include <svl/undo.hxx>
+#include <svl/stritem.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <vcl/scrbar.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/menubtn.hxx>
+
+#include <edtwin.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <doc.hxx>
+#include <swmodule.hxx>
+#include <langhelper.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+#define METABUTTON_WIDTH 16
+#define METABUTTON_HEIGHT 18
+#define METABUTTON_AREA_WIDTH 30
+#define POSTIT_META_HEIGHT (sal_Int32) 30
+#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
+
+#define POSTIT_SHADOW_BRIGHT Color(180,180,180)
+#define POSTIT_SHADOW_DARK Color(83,83,83)
+
+#define EMPTYSTRING rtl::OUString::createFromAscii("")
+
+/************** SwSidebarWin************************************/
+SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem )
+ : Window(&rEditWin, nBits)
+ , mrMgr(aMgr)
+ , mrView( rEditWin.GetView() )
+ , nFlags(aBits)
+ , mnEventId(0)
+ , mpOutlinerView(0)
+ , mpOutliner(0)
+ , mpSidebarTxtControl(0)
+ , mpVScrollbar(0)
+ , mpMetadataAuthor(0)
+ , mpMetadataDate(0)
+ , mpMenuButton(0)
+ , mpAnchor(0)
+ , mpShadow(0)
+ , mColorAnchor()
+ , mColorDark()
+ , mColorLight()
+ , mChangeColor()
+ , meSidebarPosition( sw::sidebarwindows::SIDEBAR_NONE )
+ , mPosSize()
+ , mAnchorRect()
+ , mPageBorder( 0 )
+ , mbMouseOver( false )
+ , mLayoutStatus( SwPostItHelper::INVISIBLE )
+ , mbReadonly( false )
+ , mbIsFollow( false )
+ , mrSidebarItem( rSidebarItem )
+ , mpAnchorFrm( rSidebarItem.maLayoutInfo.mpAnchorFrm )
+{
+ mpShadow = ShadowOverlayObject::CreateShadowOverlayObject( mrView );
+ if ( mpShadow )
+ {
+ mpShadow->setVisible(false);
+ }
+
+ mrMgr.ConnectSidebarWinToFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *(mrSidebarItem.GetFmtFld()),
+ *this );
+}
+
+SwSidebarWin::~SwSidebarWin()
+{
+ mrMgr.DisconnectSidebarWinFromFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *this );
+
+ Disable();
+
+ if ( mpSidebarTxtControl )
+ {
+ if ( mpOutlinerView )
+ {
+ mpOutlinerView->SetWindow( 0 );
+ }
+ delete mpSidebarTxtControl;
+ mpSidebarTxtControl = 0;
+ }
+
+ if ( mpOutlinerView )
+ {
+ delete mpOutlinerView;
+ mpOutlinerView = 0;
+ }
+
+ if (mpOutliner)
+ {
+ delete mpOutliner;
+ mpOutliner = 0;
+ }
+
+ if (mpMetadataAuthor)
+ {
+ mpMetadataAuthor->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpMetadataAuthor;
+ mpMetadataAuthor = 0;
+ }
+
+ if (mpMetadataDate)
+ {
+ mpMetadataDate->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpMetadataDate;
+ mpMetadataDate = 0;
+ }
+
+ if (mpVScrollbar)
+ {
+ mpVScrollbar->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpVScrollbar;
+ mpVScrollbar = 0;
+ }
+
+ AnchorOverlayObject::DestroyAnchorOverlayObject( mpAnchor );
+ mpAnchor = 0;
+
+ ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
+ mpShadow = 0;
+
+ delete mpMenuButton;
+ mpMenuButton = 0;
+
+ if (mnEventId)
+ Application::RemoveUserEvent( mnEventId );
+}
+
+void SwSidebarWin::Paint( const Rectangle& rRect)
+{
+ Window::Paint(rRect);
+
+ if (mpMetadataAuthor->IsVisible() )
+ {
+ //draw left over space
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ SetFillColor(COL_BLACK);
+ }
+ else
+ {
+ SetFillColor(mColorDark);
+ }
+ SetLineColor();
+ DrawRect( PixelToLogic(
+ Rectangle( Point( mpMetadataAuthor->GetPosPixel().X() +
+ mpMetadataAuthor->GetSizePixel().Width(),
+ mpMetadataAuthor->GetPosPixel().Y() ),
+ Size( GetMetaButtonAreaWidth(),
+ mpMetadataAuthor->GetSizePixel().Height() +
+ mpMetadataDate->GetSizePixel().Height() ) ) ) );
+ }
+}
+
+void SwSidebarWin::SetPosSizePixelRect( long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ const SwRect &aRect,
+ const long aPageBorder)
+{
+ mPosSize = Rectangle(Point(nX,nY),Size(nWidth,nHeight));
+ mAnchorRect = aRect;
+ mPageBorder = aPageBorder;
+}
+
+void SwSidebarWin::SetSize( const Size& rNewSize )
+{
+ mPosSize.SetSize(rNewSize);
+}
+
+void SwSidebarWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
+{
+ mPosSize = Rectangle(aPoint,aSize);
+}
+
+void SwSidebarWin::TranslateTopPosition(const long aAmount)
+{
+ mPosSize.Move(0,aAmount);
+}
+
+void SwSidebarWin::ShowAnchorOnly(const Point &aPoint)
+{
+ HideNote();
+ SetPosAndSize();
+ if (mpAnchor)
+ {
+ mpAnchor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
+ mpAnchor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
+ mpAnchor->SetAnchorState(AS_ALL);
+ mpAnchor->setVisible(true);
+ }
+ if (mpShadow)
+ mpShadow->setVisible(false);
+}
+
+SfxItemSet SwSidebarWin::DefaultItem()
+{
+ SfxItemSet aItem( mrView.GetDocShell()->GetPool() );
+ aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
+ aItem.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
+ EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
+ return aItem;
+}
+
+void SwSidebarWin::InitControls()
+{
+ AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+
+ // actual window which holds the user text
+ mpSidebarTxtControl = new SidebarTxtControl( *this,
+ WB_NODIALOGCONTROL,
+ mrView, mrMgr );
+ mpSidebarTxtControl->SetPointer(Pointer(POINTER_TEXT));
+
+ // window controls for author and date
+ mpMetadataAuthor = new Edit( this, 0 );
+ mpMetadataAuthor->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
+ mpMetadataAuthor->SetReadOnly();
+ mpMetadataAuthor->AlwaysDisableInput(true);
+ mpMetadataAuthor->SetCallHandlersOnInputDisabled(true);
+ mpMetadataAuthor->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ // we should leave this setting alone, but for this we need a better layout algo
+ // with variable meta size height
+ {
+ AllSettings aSettings = mpMetadataAuthor->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ Font aFont = aStyleSettings.GetFieldFont();
+ aFont.SetHeight(8);
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataAuthor->SetSettings(aSettings);
+ }
+
+ mpMetadataDate = new Edit( this, 0 );
+ mpMetadataDate->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_DATE_NAME ) );
+ mpMetadataDate->SetReadOnly();
+ mpMetadataDate->AlwaysDisableInput(true);
+ mpMetadataDate->SetCallHandlersOnInputDisabled(true);
+ mpMetadataDate->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ // we should leave this setting alone, but for this we need a better layout algo
+ // with variable meta size height
+ {
+ AllSettings aSettings = mpMetadataDate->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ Font aFont = aStyleSettings.GetFieldFont();
+ aFont.SetHeight(8);
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataDate->SetSettings(aSettings);
+ }
+
+
+ SwDocShell* aShell = mrView.GetDocShell();
+ mpOutliner = new Outliner(&aShell->GetPool(),OUTLINERMODE_TEXTOBJECT);
+ aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner );
+ mpOutliner->SetUpdateMode( TRUE );
+ Rescale();
+
+ OutputDevice* pDev = aShell->GetDoc()->getReferenceDevice(TRUE);
+ if ( pDev )
+ {
+ mpOutliner->SetRefDevice( pDev );
+ }
+
+ mpOutlinerView = new OutlinerView ( mpOutliner, mpSidebarTxtControl );
+ mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
+ mpOutliner->InsertView(mpOutlinerView );
+ mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
+
+ mpOutlinerView->SetAttribs(DefaultItem());
+
+ // TODO: ??
+ EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
+ mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
+
+ //create Scrollbars
+ mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ mpVScrollbar->EnableNativeWidget(false);
+ mpVScrollbar->EnableRTL( false );
+ mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl));
+ mpVScrollbar->EnableDrag();
+ mpVScrollbar->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = mpOutliner->GetControlWord();
+ // TODO: crash when AUTOCOMPLETE enabled
+ nCntrl |= EE_CNTRL_MARKFIELDS | EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT | EV_CNTRL_AUTOSCROLL | EE_CNTRL_URLSFXEXECUTE; // | EE_CNTRL_AUTOCOMPLETE;
+ if (pVOpt->IsFieldShadings())
+ nCntrl |= EE_CNTRL_MARKFIELDS;
+ else
+ nCntrl &= ~EE_CNTRL_MARKFIELDS;
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ mpOutliner->SetControlWord(nCntrl);
+
+ sal_uInt16 aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
+ SetColor( mrMgr.GetColorDark(aIndex),
+ mrMgr.GetColorLight(aIndex),
+ mrMgr.GetColorAnchor(aIndex));
+
+ CheckMetaText();
+
+ mpMenuButton = CreateMenuButton();
+
+ SetLanguage(GetLanguage());
+ GetOutlinerView()->StartSpeller();
+ SetPostItText();
+ Engine()->CompleteOnlineSpelling();
+
+ mpSidebarTxtControl->Show();
+ mpMetadataAuthor->Show();
+ mpMetadataDate->Show();
+ mpVScrollbar->Show();
+}
+
+void SwSidebarWin::CheckMetaText()
+{
+ const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
+ String sMeta = GetAuthor();
+ if (sMeta.Len() == 0)
+ {
+ sMeta = String(SW_RES(STR_NOAUTHOR));
+ }
+ else if (sMeta.Len() > 22)
+ {
+ sMeta.Erase(20);
+ sMeta = sMeta + rtl::OUString::createFromAscii("...");
+ }
+ if ( mpMetadataAuthor->GetText() != sMeta )
+ {
+ mpMetadataAuthor->SetText(sMeta);
+ }
+
+ Date aDate = GetDate();
+ if (aDate==Date())
+ {
+ sMeta = String(SW_RES(STR_POSTIT_TODAY));
+ }
+ else if (aDate == Date(Date()-1))
+ {
+ sMeta = String(SW_RES(STR_POSTIT_YESTERDAY));
+ }
+ else if (aDate.IsValid() )
+ {
+ sMeta = rLocalData.getDate(aDate);
+ }
+ else
+ {
+ sMeta = String(SW_RES(STR_NODATE));
+ }
+ if (GetTime()!=0)
+ {
+ sMeta = sMeta + rtl::OUString::createFromAscii(" ") + rLocalData.getTime( GetTime(),false );
+ }
+ if ( mpMetadataDate->GetText() != sMeta )
+ {
+ mpMetadataDate->SetText(sMeta);
+ }
+
+}
+
+void SwSidebarWin::Rescale()
+{
+ MapMode aMode = GetParent()->GetMapMode();
+ aMode.SetOrigin( Point() );
+ mpOutliner->SetRefMapMode( aMode );
+ SetMapMode( aMode );
+ mpSidebarTxtControl->SetMapMode( aMode );
+ if ( mpMetadataAuthor )
+ {
+ Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() );
+ sal_Int32 nHeight = aFont.GetHeight();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ aFont.SetHeight( nHeight );
+ mpMetadataAuthor->SetControlFont( aFont );
+ }
+ if ( mpMetadataDate )
+ {
+ Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
+ sal_Int32 nHeight = aFont.GetHeight();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ aFont.SetHeight( nHeight );
+ mpMetadataDate->SetControlFont( aFont );
+ }
+}
+
+void SwSidebarWin::SetPosAndSize()
+{
+ bool bChange = false;
+
+ if (GetSizePixel() != mPosSize.GetSize())
+ {
+ bChange = true;
+ SetSizePixel(mPosSize.GetSize());
+ DoResize();
+ }
+
+ if (GetPosPixel().X() != mPosSize.TopLeft().X() || (abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) )
+ {
+ bChange = true;
+ SetPosPixel(mPosSize.TopLeft());
+
+ Point aLineStart;
+ Point aLineEnd ;
+ switch ( meSidebarPosition )
+ {
+ case sw::sidebarwindows::SIDEBAR_LEFT:
+ {
+ aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
+ aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_RIGHT:
+ {
+ aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
+ aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
+ }
+ break;
+ default:
+ ASSERT( false,
+ "<SwSidebarWin::SetPosAndSize()> - unexpected position of sidebar" );
+ break;
+ }
+
+ if (!IsPreview())
+ {
+ if (mpAnchor)
+ {
+ mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
+ basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( mPageBorder ,mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
+ basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
+ mpAnchor->SetHeight(mAnchorRect.Height());
+ }
+ else
+ {
+ mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView,
+ mAnchorRect,
+ mPageBorder,
+ aLineStart,
+ aLineEnd,
+ mColorAnchor );
+ if ( mpAnchor )
+ {
+ mpAnchor->SetHeight(mAnchorRect.Height());
+ mpAnchor->setVisible(true);
+ mpAnchor->SetAnchorState(AS_TRI);
+ if (HasChildPathFocus())
+ {
+ mpAnchor->setLineSolid(true);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( mpAnchor &&
+ ( mpAnchor->getBasePosition() != basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom()-5*15) ) )
+ {
+ mpAnchor->SetTriPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
+ basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( mPageBorder , mAnchorRect.Bottom()+2*15));
+ }
+ }
+
+ if (bChange)
+ {
+ Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
+ Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
+ mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
+ }
+
+ if (mrMgr.ShowNotes())
+ {
+ if (IsFollow() && !HasChildPathFocus())
+ {
+ mpAnchor->SetAnchorState(AS_END);
+ }
+ else
+ {
+ mpAnchor->SetAnchorState(AS_ALL);
+ SwSidebarWin* pWin = GetTopReplyNote();
+ if (pWin)
+ pWin->Anchor()->SetAnchorState(AS_END);
+ }
+ }
+}
+
+void SwSidebarWin::DoResize()
+{
+ long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
+ long aHeight = GetSizePixel().Height();
+ unsigned long aWidth = GetSizePixel().Width();
+
+ aHeight -= GetMetaHeight();
+ mpMetadataAuthor->Show();
+ mpMetadataDate->Show();
+ mpSidebarTxtControl->SetQuickHelpText(EMPTYSTRING);
+
+ if ((aTextHeight > aHeight) && !IsPreview())
+ { // we need vertical scrollbars and have to reduce the width
+ aWidth -= GetScrollbarWidth();
+ mpVScrollbar->Show();
+ }
+ else
+ {
+ mpVScrollbar->Hide();
+ }
+
+ {
+ const Size aSizeOfMetadataControls( GetSizePixel().Width() - GetMetaButtonAreaWidth(),
+ GetMetaHeight()/2 );
+ mpMetadataAuthor->SetPosSizePixel( 0,
+ aHeight,
+ aSizeOfMetadataControls.Width(),
+ aSizeOfMetadataControls.Height() );
+ mpMetadataDate->SetPosSizePixel( 0,
+ aHeight + aSizeOfMetadataControls.Height(),
+ aSizeOfMetadataControls.Width(),
+ aSizeOfMetadataControls.Height() );
+ }
+
+ mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
+ mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
+ if (!mpVScrollbar->IsVisible())
+ { // if we do not have a scrollbar anymore, we want to see the complete text
+ mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
+ }
+
+ if (!Application::GetSettings().GetLayoutRTL())
+ {
+ mpSidebarTxtControl->SetPosSizePixel(0, 0, aWidth, aHeight);
+ mpVScrollbar->SetPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight);
+ }
+ else
+ {
+ mpSidebarTxtControl->SetPosSizePixel( ( (aTextHeight > aHeight) && !IsPreview()
+ ? GetScrollbarWidth() : 0 ) , 0,
+ aWidth, aHeight);
+ mpVScrollbar->SetPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight);
+ }
+
+ mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
+ mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
+ mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
+ SetScrollbar();
+ mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
+
+ //calculate rects for meta- button
+ const Fraction& fx( GetMapMode().GetScaleX() );
+ const Fraction& fy( GetMapMode().GetScaleY() );
+
+ const Point aPos( mpMetadataAuthor->GetPosPixel());
+ Rectangle aRectMetaButton;
+ if (IsPreview())
+ {
+ aRectMetaButton = PixelToLogic(
+ Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH*4+10)*fx.GetNumerator()/fx.GetDenominator(),
+ aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
+ Size( METABUTTON_WIDTH*4*fx.GetNumerator()/fx.GetDenominator(),
+ METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
+ }
+ else
+ {
+ aRectMetaButton = PixelToLogic(
+ Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(),
+ aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
+ Size( METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(),
+ METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
+ }
+
+ {
+ const Rectangle aRectMetaButtonPixel( LogicToPixel( aRectMetaButton ) );
+ mpMenuButton->SetPosSizePixel( aRectMetaButtonPixel.Left(),
+ aRectMetaButtonPixel.Top(),
+ aRectMetaButtonPixel.GetWidth(),
+ aRectMetaButtonPixel.GetHeight() );
+ }
+}
+
+void SwSidebarWin::SetSizePixel( const Size& rNewSize )
+{
+ Window::SetSizePixel(rNewSize);
+
+ if (mpShadow)
+ {
+ Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
+ Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
+ mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
+ }
+}
+
+void SwSidebarWin::SetScrollbar()
+{
+ mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY());
+}
+
+void SwSidebarWin::ResizeIfNeccessary(long aOldHeight, long aNewHeight)
+{
+ if (aOldHeight != aNewHeight)
+ {
+ //check for lower border or next note
+ long aBorder = mrMgr.GetNextBorder();
+ if (aBorder != -1)
+ {
+ if (aNewHeight > GetMinimumSizeWithoutMeta())
+ {
+ long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
+ if (aNewLowerValue < aBorder)
+ SetSizePixel(Size(GetSizePixel().Width(),aNewHeight+GetMetaHeight()));
+ else
+ SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
+ DoResize();
+ Invalidate();
+ }
+ else
+ {
+ if (GetSizePixel().Height() != GetMinimumSizeWithoutMeta() + GetMetaHeight())
+ SetSizePixel(Size(GetSizePixel().Width(),GetMinimumSizeWithoutMeta() + GetMetaHeight()));
+ DoResize();
+ Invalidate();
+ }
+ }
+ else
+ {
+ DoResize();
+ Invalidate();
+ }
+ }
+ else
+ {
+ SetScrollbar();
+ }
+}
+
+void SwSidebarWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
+{
+ mColorDark = aColorDark;
+ mColorLight = aColorLight;
+ mColorAnchor = aColorAnchor;
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ {
+ mpMetadataAuthor->SetControlBackground(mColorDark);
+ AllSettings aSettings = mpMetadataAuthor->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetFieldTextColor(aColorAnchor);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataAuthor->SetSettings(aSettings);
+ }
+
+ {
+ mpMetadataDate->SetControlBackground(mColorDark);
+ AllSettings aSettings = mpMetadataDate->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetFieldTextColor(aColorAnchor);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataDate->SetSettings(aSettings);
+ }
+
+ AllSettings aSettings2 = mpVScrollbar->GetSettings();
+ StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
+ aStyleSettings2.SetButtonTextColor(Color(0,0,0));
+ aStyleSettings2.SetCheckedColor(mColorLight); //hintergund
+ aStyleSettings2.SetShadowColor(mColorAnchor);
+ aStyleSettings2.SetFaceColor(mColorDark);
+ aSettings2.SetStyleSettings(aStyleSettings2);
+ mpVScrollbar->SetSettings(aSettings2);
+ }
+}
+
+void SwSidebarWin::SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition)
+{
+ meSidebarPosition = eSidebarPosition;
+}
+
+void SwSidebarWin::SetReadonly(BOOL bSet)
+{
+ mbReadonly = bSet;
+ GetOutlinerView()->SetReadOnly(bSet);
+}
+
+void SwSidebarWin::SetLanguage(const SvxLanguageItem aNewItem)
+{
+ Link pLink = Engine()->GetModifyHdl();
+ Engine()->SetModifyHdl( Link() );
+ ESelection aOld = GetOutlinerView()->GetSelection();
+
+ ESelection aNewSelection( 0, 0, (USHORT)Engine()->GetParagraphCount()-1, USHRT_MAX );
+ GetOutlinerView()->SetSelection( aNewSelection );
+ SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs());
+ aEditAttr.Put(aNewItem);
+ GetOutlinerView()->SetAttribs( aEditAttr );
+
+ GetOutlinerView()->SetSelection(aOld);
+ Engine()->SetModifyHdl( pLink );
+
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = Engine()->GetControlWord();
+ // turn off
+ if (!pVOpt->IsOnlineSpell())
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ Engine()->SetControlWord(nCntrl);
+
+ //turn back on
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ Engine()->SetControlWord(nCntrl);
+
+ Engine()->CompleteOnlineSpelling();
+ Invalidate();
+}
+
+void SwSidebarWin::DataChanged( const DataChangedEvent& aEvent)
+{
+ Window::DataChanged( aEvent );
+}
+
+void SwSidebarWin::GetFocus()
+{
+ if (mpSidebarTxtControl)
+ mpSidebarTxtControl->GrabFocus();
+}
+
+void SwSidebarWin::LoseFocus()
+{
+}
+
+void SwSidebarWin::ShowNote()
+{
+ SetPosAndSize();
+ if (!IsVisible())
+ Window::Show();
+ if (mpShadow && !mpShadow->isVisible())
+ mpShadow->setVisible(true);
+ if (mpAnchor && !mpAnchor->isVisible())
+ mpAnchor->setVisible(true);
+}
+
+void SwSidebarWin::HideNote()
+{
+ if (IsVisible())
+ Window::Hide();
+ if (mpAnchor)
+ {
+ if (mrMgr.IsShowAnchor())
+ mpAnchor->SetAnchorState(AS_TRI);
+ else
+ mpAnchor->setVisible(false);
+ }
+ if (mpShadow && mpShadow->isVisible())
+ mpShadow->setVisible(false);
+}
+
+void SwSidebarWin::ActivatePostIt()
+{
+ mrMgr.AssureStdModeAtShell();
+
+ mpOutliner->ClearModifyFlag();
+ mpOutliner->GetUndoManager().Clear();
+
+ CheckMetaText();
+ SetViewState(VS_EDIT);
+ GetOutlinerView()->ShowCursor();
+
+ mpOutlinerView->GetEditView().SetInsertMode(mrView.GetWrtShellPtr()->IsInsMode());
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ GetOutlinerView()->SetBackgroundColor(mColorDark);
+}
+
+void SwSidebarWin::DeactivatePostIt()
+{
+ // remove selection, #i87073#
+ if (GetOutlinerView()->GetEditView().HasSelection())
+ {
+ ESelection aSelection = GetOutlinerView()->GetEditView().GetSelection();
+ aSelection.nEndPara = aSelection.nStartPara;
+ aSelection.nEndPos = aSelection.nStartPos;
+ GetOutlinerView()->GetEditView().SetSelection(aSelection);
+ }
+
+ mpOutliner->CompleteOnlineSpelling();
+
+ SetViewState(VS_NORMAL);
+ // write the visible text back into the SwField
+ UpdateData();
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ GetOutlinerView()->SetBackgroundColor(COL_TRANSPARENT);
+
+
+ if ( !IsProtected() &&
+ Engine()->GetEditEngine().GetText()==String(EMPTYSTRING) )
+ {
+ mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
+ }
+}
+
+void SwSidebarWin::ToggleInsMode()
+{
+ if (!mrView.GetWrtShell().IsRedlineOn())
+ {
+ //change outliner
+ mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
+ //change documnet
+ mrView.GetWrtShell().ToggleInsMode();
+ //update statusbar
+ SfxBindings &rBnd = mrView.GetViewFrame()->GetBindings();
+ rBnd.Invalidate(SID_ATTR_INSERT);
+ rBnd.Update(SID_ATTR_INSERT);
+ }
+}
+
+void SwSidebarWin::ExecuteCommand(USHORT nSlot)
+{
+ mrMgr.AssureStdModeAtShell();
+
+ switch (nSlot)
+ {
+ case FN_POSTIT:
+ case FN_REPLY:
+ {
+ // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
+ // will be created
+ if (Engine()->GetEditEngine().GetText() != String(EMPTYSTRING))
+ {
+ OutlinerParaObject* pPara = new OutlinerParaObject(*GetOutlinerView()->GetEditView().CreateTextObject());
+ mrMgr.RegisterAnswer(pPara);
+ }
+ if (mrMgr.HasActiveSidebarWin())
+ mrMgr.SetActiveSidebarWin(0);
+ SwitchToFieldPos();
+ mrView.GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
+ break;
+ }
+ case FN_DELETE_COMMENT:
+ case FN_DELETE_NOTE:
+
+ //Delete(); // do not kill the parent of our open popup menu
+ mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
+ break;
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_ALL_NOTES:
+ // not possible as slot as this would require that "this" is the active postit
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot, 0, 0, SFX_CALLMODE_ASYNCHRON );
+ break;
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_HIDE_NOTE_AUTHOR:
+ {
+ // not possible as slot as this would require that "this" is the active postit
+ SfxStringItem aItem( nSlot, GetAuthor() );
+ const SfxPoolItem* aItems[2];
+ aItems[0] = &aItem;
+ aItems[1] = 0;
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot, aItems, 0, SFX_CALLMODE_ASYNCHRON );
+ }
+ default:
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot );
+ break;
+ }
+}
+
+SwEditWin* SwSidebarWin::EditWin()
+{
+ return &mrView.GetEditWin();
+}
+
+long SwSidebarWin::GetPostItTextHeight()
+{
+ return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
+}
+
+void SwSidebarWin::SwitchToPostIt(USHORT aDirection)
+{
+ SwSidebarWin* pPostIt = mrMgr.GetNextPostIt(aDirection, this);
+ if (pPostIt)
+ pPostIt->GrabFocus();
+}
+
+IMPL_LINK( SwSidebarWin, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>(pEvent);
+ if ( pWinEvent )
+ {
+ if ( pWinEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
+ {
+ MouseEvent* pMouseEvt = (MouseEvent*)pWinEvent->GetData();
+ if ( pMouseEvt->IsEnterWindow() )
+ {
+ mbMouseOver = true;
+ if ( !HasFocus() )
+ {
+ SetViewState(VS_VIEW);
+ Invalidate();
+ }
+ }
+ else if ( pMouseEvt->IsLeaveWindow())
+ {
+ if (IsPreview())
+ {
+ //doLazyDelete();
+ }
+ else
+ {
+ mbMouseOver = false;
+ if ( !HasFocus() )
+ {
+ SetViewState(VS_NORMAL);
+ Invalidate();
+ }
+ }
+ }
+ }
+ else if ( pWinEvent->GetId() == VCLEVENT_WINDOW_ACTIVATE &&
+ pWinEvent->GetWindow() == mpSidebarTxtControl )
+ {
+ const BOOL bLockView = mrView.GetWrtShell().IsViewLocked();
+ mrView.GetWrtShell().LockView( TRUE );
+
+ if ( !IsPreview() )
+ {
+ mrMgr.SetActiveSidebarWin( this );
+ }
+
+ mrView.GetWrtShell().LockView( bLockView );
+ mrMgr.MakeVisible( this );
+ }
+ else if ( pWinEvent->GetWindow() == mpSidebarTxtControl )
+ {
+ int i = 5;
+ ++i;
+ }
+ }
+ return sal_True;
+}
+
+void SwSidebarWin::Delete()
+{
+ if ( mrMgr.GetActiveSidebarWin() == this)
+ {
+ mrMgr.SetActiveSidebarWin(0);
+ // if the note is empty, the previous line will send a delete event, but we are already there
+ if (mnEventId)
+ {
+ Application::RemoveUserEvent( mnEventId );
+ mnEventId = 0;
+ }
+ }
+}
+
+IMPL_LINK(SwSidebarWin, ScrollHdl, ScrollBar*, pScroll)
+{
+ long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
+ GetOutlinerView()->Scroll( 0, nDiff );
+ return 0;
+}
+
+IMPL_LINK(SwSidebarWin, ModifyHdl, void*, pVoid)
+{
+ // no warnings, please
+ pVoid=0;
+ mrView.GetDocShell()->SetModified(sal_True);
+ return 0;
+}
+
+IMPL_LINK(SwSidebarWin, DeleteHdl, void*, pVoid)
+{
+ // no warnings, please
+ pVoid=0;
+ mnEventId = 0;
+ Delete();
+ return 0;
+}
+
+
+void SwSidebarWin::ResetAttributes()
+{
+ mpOutlinerView->RemoveAttribsKeepLanguages(TRUE);
+ mpOutliner->RemoveFields(TRUE);
+ mpOutlinerView->SetAttribs(DefaultItem());
+}
+
+sal_Int32 SwSidebarWin::GetScrollbarWidth()
+{
+ return mrView.GetWrtShell().GetViewOptions()->GetZoom() / 10;
+}
+
+sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth()
+{
+ const Fraction& f( GetMapMode().GetScaleX() );
+ if (IsPreview())
+ return 3 * METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+ else
+ return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwSidebarWin::GetMetaHeight()
+{
+ const Fraction& f( GetMapMode().GetScaleY() );
+ return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
+{
+ return mrMgr.GetMinimumSizeWithMeta();
+}
+
+sal_Int32 SwSidebarWin::GetMinimumSizeWithoutMeta()
+{
+ const Fraction& f( GetMapMode().GetScaleY() );
+ return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
+}
+
+void SwSidebarWin::SetSpellChecking()
+{
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = mpOutliner->GetControlWord();
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ mpOutliner->SetControlWord(nCntrl);
+
+ mpOutliner->CompleteOnlineSpelling();
+ Invalidate();
+}
+
+void SwSidebarWin::SetViewState(ViewState bViewState)
+{
+ switch (bViewState)
+ {
+ case VS_EDIT:
+ {
+ if (mpAnchor)
+ {
+ mpAnchor->SetAnchorState(AS_ALL);
+ SwSidebarWin* pWin = GetTopReplyNote();
+ if (pWin)
+ pWin->Anchor()->SetAnchorState(AS_END);
+ mpAnchor->setLineSolid(true);
+ }
+ if (mpShadow)
+ mpShadow->SetShadowState(SS_EDIT);
+ break;
+ }
+ case VS_VIEW:
+ {
+ if (mpAnchor)
+ mpAnchor->setLineSolid(true);
+ if (mpShadow)
+ mpShadow->SetShadowState(SS_VIEW);
+ break;
+ }
+ case VS_NORMAL:
+ {
+ if (mpAnchor)
+ {
+ if (IsFollow())
+ {
+ // if there is no visible parent note, we want to see the complete anchor ??
+ //if (IsAnyStackParentVisible())
+ mpAnchor->SetAnchorState(AS_END);
+ SwSidebarWin* pTopWinSelf = GetTopReplyNote();
+ SwSidebarWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
+ ? mrMgr.GetActiveSidebarWin()->GetTopReplyNote()
+ : 0;
+ if (pTopWinSelf && (pTopWinSelf!=pTopWinActive))
+ {
+ if (pTopWinSelf!=mrMgr.GetActiveSidebarWin())
+ pTopWinSelf->Anchor()->setLineSolid(false);
+ pTopWinSelf->Anchor()->SetAnchorState(AS_ALL);
+ }
+ }
+ mpAnchor->setLineSolid(false);
+ }
+ if (mpShadow)
+ mpShadow->SetShadowState(SS_NORMAL);
+ break;
+ }
+ }
+}
+
+SwSidebarWin* SwSidebarWin::GetTopReplyNote()
+{
+ SwSidebarWin* pTopNote = 0;
+ SwSidebarWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : 0;
+ while (pSidebarWin)
+ {
+ pTopNote = pSidebarWin;
+ pSidebarWin = pSidebarWin->IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, pSidebarWin) : 0;
+ }
+ return pTopNote;
+}
+
+void SwSidebarWin::SwitchToFieldPos()
+{
+ if ( mrMgr.GetActiveSidebarWin() == this )
+ mrMgr.SetActiveSidebarWin(0);
+ GotoPos();
+ sal_uInt32 aCount = MoveCaret();
+ if (aCount)
+ mrView.GetDocShell()->GetWrtShell()->SwCrsrShell::Right(aCount, 0, FALSE);
+ GrabFocusToDocument();
+}
+
+SvxLanguageItem SwSidebarWin::GetLanguage(void)
+{
+ return SvxLanguageItem(SwLangHelper::GetLanguage(mrView.GetWrtShell(),RES_CHRATR_LANGUAGE),RES_CHRATR_LANGUAGE);
+}
+
+void SwSidebarWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayoutStatus,
+ const Color& aChangeColor )
+{
+ if ( (mLayoutStatus != aLayoutStatus) ||
+ (mChangeColor != aChangeColor) )
+ {
+ mLayoutStatus = aLayoutStatus;
+ mChangeColor = aChangeColor;
+ Invalidate();
+ }
+}
+
+bool SwSidebarWin::HasScrollbar() const
+{
+ return mpVScrollbar != 0;
+}
+
+bool SwSidebarWin::IsScrollbarVisible() const
+{
+ return HasScrollbar() && mpVScrollbar->IsVisible();
+}
+
+void SwSidebarWin::ChangeSidebarItem( SwSidebarItem& rSidebarItem )
+{
+ const bool bAnchorChanged = mpAnchorFrm != rSidebarItem.maLayoutInfo.mpAnchorFrm;
+ if ( bAnchorChanged )
+ {
+ mrMgr.DisconnectSidebarWinFromFrm( *(mpAnchorFrm), *this );
+ }
+
+ mrSidebarItem = rSidebarItem;
+ mpAnchorFrm = mrSidebarItem.maLayoutInfo.mpAnchorFrm;
+
+ if ( GetWindowPeer() )
+ {
+ SidebarWinAccessible* pAcc =
+ static_cast<SidebarWinAccessible*>( GetWindowPeer() );
+ ASSERT( dynamic_cast<SidebarWinAccessible*>( GetWindowPeer() ),
+ "<SwSidebarWin::ChangeSidebarItem(..)> - unexpected type of window peer -> crash possible!" );
+ pAcc->ChangeSidebarItem( mrSidebarItem );
+ }
+
+ if ( bAnchorChanged )
+ {
+ mrMgr.ConnectSidebarWinToFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *(mrSidebarItem.GetFmtFld()),
+ *this );
+ }
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SwSidebarWin::CreateAccessible()
+{
+ SidebarWinAccessible* pAcc( new SidebarWinAccessible( *this,
+ mrView.GetWrtShell(),
+ mrSidebarItem ) );
+ css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
+ SetWindowPeer( xWinPeer, pAcc );
+
+ css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
+ return xAcc;
+}
+
+} } // eof of namespace sw::sidebarwindows
+
+/********** SwRedComment**************/
+/*
+SwRedComment::SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed)
+ : SwSidebarWin(pParent,nBits,aMgr,aBits),
+ pRedline(pRed)
+{
+}
+
+void SwRedComment::SetPopup()
+{
+ mpButtonPopup = new PopupMenu(SW_RES(MN_REDCOMMENT_BUTTON));
+ //mpButtonPopup->SetMenuFlags(MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
+}
+
+void SwRedComment::UpdateData()
+{
+ if ( Engine()->IsModified() )
+ {
+ // so we get a new layout of notes (Anchor position is still the same and we would otherwise not get one)
+ Mgr()->SetLayout();
+ // SetRedline is calling SetModified already
+ DocView()->GetWrtShell().SetRedlineComment(Engine()->GetEditEngine().GetText());
+ }
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+void SwRedComment::SetPostItText()
+{
+ Engine()->SetModifyHdl( Link() );
+ Engine()->EnableUndo( FALSE );
+
+ Engine()->Clear();
+ View()->SetAttribs(DefaultItem());
+ View()->InsertText(pRedline->GetComment(),false);
+
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+ Engine()->EnableUndo( TRUE );
+ Engine()->SetModifyHdl( LINK( this, SwSidebarWin, ModifyHdl ) );
+ Invalidate();
+}
+
+void SwRedComment::DeactivatePostIt()
+{
+ SwSidebarWin::DeactivatePostIt();
+ // current Redline is still selected
+ DocView()->GetWrtShellPtr()->ClearMark();
+}
+
+void SwRedComment::ActivatePostIt()
+{
+ SwSidebarWin::ActivatePostIt();
+
+ // do we want the redline selected?
+ // otherwise, SwRedComment::ActivatePostIt() as well as SwRedComment::DeactivatePostIt()
+ // can be thrown out completly
+ DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
+ DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()),true);
+}
+
+void SwRedComment::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
+ {
+ ExecuteCommand( mpButtonPopup->Execute( this,Rectangle(LogicToPixel(mRectMetaButton.BottomLeft()),LogicToPixel(mRectMetaButton.BottomLeft())),POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE) );
+ }
+}
+
+void SwRedComment::Delete()
+{
+ SwSidebarWin::Delete();
+ // we are not neccessarily on our redline, so let's move there
+ GotoPos();
+ DocView()->GetWrtShell().SetRedlineComment(EMPTYSTRING);
+ DocView()->GetWrtShell().ClearMark();
+ // so we get a new layout of notes (Anchor position is still the same and we would otherwise not get one)
+ Mgr()->SetLayout();
+ Mgr()->RemoveItem(pRedline);
+}
+
+void SwRedComment::GotoPos()
+{
+ DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
+ DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()));
+}
+
+String SwRedComment::GetAuthor()
+{
+ return pRedline->GetAuthorString();
+}
+
+Date SwRedComment::GetDate()
+{
+ return pRedline->GetTimeStamp().GetDate();
+}
+
+Time SwRedComment::GetTime()
+{
+ return pRedline->GetTimeStamp().GetTime();
+}
+
+bool SwRedComment::IsProtected()
+{
+ return SwSidebarWin::IsProtected() || pRedline->Start()->nNode.GetNode().GetTxtNode()->IsInProtectSect();
+}
+*/
diff --git a/sw/source/ui/docvw/SidebarWinAcc.cxx b/sw/source/ui/docvw/SidebarWinAcc.cxx
new file mode 100644
index 000000000000..214913963dcb
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWinAcc.cxx
@@ -0,0 +1,162 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarWinAcc.hxx>
+
+#include <SidebarWin.hxx>
+#include <viewsh.hxx>
+#include <accmap.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+// =============================================================================
+// declaration and implementation of accessible context for <SidebarWinAccessible> instance
+// =============================================================================
+class SidebarWinAccessibleContext : public VCLXAccessibleComponent
+{
+ public:
+ explicit SidebarWinAccessibleContext( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwFrm* pAnchorFrm )
+ : VCLXAccessibleComponent( rSidebarWin.GetWindowPeer() )
+ , mrViewShell( rViewShell )
+ , mpAnchorFrm( pAnchorFrm )
+ , maMutex()
+ {
+ rSidebarWin.SetAccessibleRole( css::accessibility::AccessibleRole::COMMENT );
+ }
+
+ virtual ~SidebarWinAccessibleContext()
+ {}
+
+ void ChangeAnchor( const SwFrm* pAnchorFrm )
+ {
+ vos::OGuard aGuard(maMutex);
+
+ mpAnchorFrm = pAnchorFrm;
+ }
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent() throw (css::uno::RuntimeException)
+ {
+ vos::OGuard aGuard(maMutex);
+
+ css::uno::Reference< css::accessibility::XAccessible > xAccParent;
+
+ if ( mpAnchorFrm &&
+ mrViewShell.GetAccessibleMap() )
+ {
+ xAccParent = mrViewShell.GetAccessibleMap()->GetContext( mpAnchorFrm, sal_False );
+ }
+
+ return xAccParent;
+ }
+
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (css::uno::RuntimeException)
+ {
+ vos::OGuard aGuard(maMutex);
+
+ sal_Int32 nIndex( -1 );
+
+ if ( mpAnchorFrm && GetWindow() &&
+ mrViewShell.GetAccessibleMap() )
+ {
+ nIndex = mrViewShell.GetAccessibleMap()->GetChildIndex( *mpAnchorFrm,
+ *GetWindow() );
+ }
+
+ return nIndex;
+ }
+
+ private:
+ ViewShell& mrViewShell;
+ const SwFrm* mpAnchorFrm;
+
+ ::vos::OMutex maMutex;
+};
+
+// =============================================================================
+// implementaion of accessible for <SwSidebarWin> instance
+// =============================================================================
+SidebarWinAccessible::SidebarWinAccessible( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwSidebarItem& rSidebarItem )
+ : VCLXWindow()
+ , mrSidebarWin( rSidebarWin )
+ , mrViewShell( rViewShell )
+ , mpAnchorFrm( rSidebarItem.maLayoutInfo.mpAnchorFrm )
+ , bAccContextCreated( false )
+{
+ SetWindow( &mrSidebarWin );
+}
+
+SidebarWinAccessible::~SidebarWinAccessible()
+{
+}
+
+void SidebarWinAccessible::ChangeSidebarItem( const SwSidebarItem& rSidebarItem )
+{
+ if ( bAccContextCreated )
+ {
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc
+ = getAccessibleContext();
+ if ( xAcc.is() )
+ {
+ SidebarWinAccessibleContext* pAccContext =
+ dynamic_cast<SidebarWinAccessibleContext*>(xAcc.get());
+ if ( pAccContext )
+ {
+ pAccContext->ChangeAnchor( rSidebarItem.maLayoutInfo.mpAnchorFrm );
+ }
+ }
+ }
+}
+
+css::uno::Reference< css::accessibility::XAccessibleContext > SidebarWinAccessible::CreateAccessibleContext()
+{
+ SidebarWinAccessibleContext* pAccContext =
+ new SidebarWinAccessibleContext( mrSidebarWin,
+ mrViewShell,
+ mpAnchorFrm );
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc( pAccContext );
+ bAccContextCreated = true;
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/SidebarWinAcc.hxx b/sw/source/ui/docvw/SidebarWinAcc.hxx
new file mode 100644
index 000000000000..0abe1acbfaf5
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWinAcc.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWINACC_HXX
+#define _SIDEBARWINACC_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+class ViewShell;
+class SwSidebarItem;
+class SwFrm;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+
+class SidebarWinAccessible : public VCLXWindow
+{
+ public:
+ explicit SidebarWinAccessible( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwSidebarItem& rSidebarItem );
+ virtual ~SidebarWinAccessible();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ void ChangeSidebarItem( const SwSidebarItem& rSidebarItem );
+
+ private:
+ SwSidebarWin& mrSidebarWin;
+ ViewShell& mrViewShell;
+ const SwFrm* mpAnchorFrm;
+ bool bAccContextCreated;
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/access.src b/sw/source/ui/docvw/access.src
index 17f06e8a0037..42081d3ab7e7 100644
--- a/sw/source/ui/docvw/access.src
+++ b/sw/source/ui/docvw/access.src
@@ -83,4 +83,20 @@ String STR_ACCESS_PAGE_DESC
{
Text [ en-US ] = "Page: $(ARG1)";
};
+String STR_ACCESS_ANNOTATION_AUTHOR_NAME
+{
+ Text [ en-US ] = "Author";
+};
+String STR_ACCESS_ANNOTATION_DATE_NAME
+{
+ Text [ en-US ] = "Date";
+};
+String STR_ACCESS_ANNOTATION_BUTTON_NAME
+{
+ Text [ en-US ] = "Actions";
+};
+String STR_ACCESS_ANNOTATION_BUTTON_DESC
+{
+ Text [ en-US ] = "Activate this button to open a list of actions which can be performed on this comment and other comments";
+};
diff --git a/sw/source/ui/docvw/annotation.hrc b/sw/source/ui/docvw/annotation.hrc
new file mode 100644
index 000000000000..e43a90342409
--- /dev/null
+++ b/sw/source/ui/docvw/annotation.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATION_HRC
+#define _ANNOTATION_HRC
+
+#include "rcid.hrc"
+
+#define STR_POSTIT_TODAY (RC_ANNOTATION_BEGIN + 1)
+#define STR_POSTIT_YESTERDAY (RC_ANNOTATION_BEGIN + 2)
+
+#define STR_DELETE_ALL_NOTES (RC_ANNOTATION_BEGIN + 3)
+#define STR_DELETE_AUTHOR_NOTES (RC_ANNOTATION_BEGIN + 4)
+
+#define STR_NODATE (RC_ANNOTATION_BEGIN + 5)
+#define STR_NOAUTHOR (RC_ANNOTATION_BEGIN + 6)
+
+#define STR_REPLY (RC_ANNOTATION_BEGIN + 7)
+
+
+#define ANNOTATION_ACT_END STR_REPLY
+#if ANNOTATION_ACT_END > RC_ANNOTATION_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+
+#endif
diff --git a/sw/source/ui/docvw/annotation.src b/sw/source/ui/docvw/annotation.src
new file mode 100644
index 000000000000..8dcda9c25b8c
--- /dev/null
+++ b/sw/source/ui/docvw/annotation.src
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "annotation.hrc"
+#include "cmdid.h"
+
+String STR_POSTIT_TODAY
+{
+ Text [ en-US ] = "Today," ;
+};
+
+String STR_POSTIT_YESTERDAY
+{
+ Text [ en-US ] = "Yesterday," ;
+};
+
+String STR_DELETE_ALL_NOTES
+{
+ Text [ en-US ] = "All Comments" ;
+};
+
+String STR_DELETE_AUTHOR_NOTES
+{
+ Text [ en-US ] = "Comments by " ;
+};
+
+String STR_NODATE
+{
+ Text [ en-US ] = "(no date)" ;
+};
+
+String STR_NOAUTHOR
+{
+ Text [ en-US ] = "(no author)" ;
+};
+
+String STR_REPLY
+{
+ Text [ en-US ] = "Reply to $1" ;
+};
+
diff --git a/sw/source/ui/docvw/docvw.hrc b/sw/source/ui/docvw/docvw.hrc
index 31fd6a04949e..c0f15291795b 100644
--- a/sw/source/ui/docvw/docvw.hrc
+++ b/sw/source/ui/docvw/docvw.hrc
@@ -81,17 +81,6 @@
#define STR_SMARTTAG_CLICK (RC_DOCVW_BEGIN + 21)
-#define STR_POSTIT_TODAY (RC_DOCVW_BEGIN + 22)
-#define STR_POSTIT_YESTERDAY (RC_DOCVW_BEGIN + 23)
-
-#define STR_DELETE_ALL_NOTES (RC_DOCVW_BEGIN + 24)
-#define STR_DELETE_AUTHOR_NOTES (RC_DOCVW_BEGIN + 25)
-
-#define STR_NODATE (RC_DOCVW_BEGIN + 26)
-#define STR_NOAUTHOR (RC_DOCVW_BEGIN + 27)
-
-#define STR_REPLY (RC_DOCVW_BEGIN + 28)
-
#define MSG_READONLY_CONTENT (RC_DOCVW_BEGIN + 1)
#define DOCVW_ACT_END STR_SMARTTAG_CLICK
diff --git a/sw/source/ui/docvw/docvw.src b/sw/source/ui/docvw/docvw.src
index d38f249d905e..dcd0f98103f4 100644
--- a/sw/source/ui/docvw/docvw.src
+++ b/sw/source/ui/docvw/docvw.src
@@ -294,38 +294,3 @@ String STR_SMARTTAG_CLICK
Text [ en-US ] = "%s-click to open Smart Tag menu" ;
};
-String STR_POSTIT_TODAY
-{
- Text [ en-US ] = "Today," ;
-};
-
-String STR_POSTIT_YESTERDAY
-{
- Text [ en-US ] = "Yesterday," ;
-};
-
-String STR_DELETE_ALL_NOTES
-{
- Text [ en-US ] = "All Comments" ;
-};
-
-String STR_DELETE_AUTHOR_NOTES
-{
- Text [ en-US ] = "Comments by " ;
-};
-
-String STR_NODATE
-{
- Text [ en-US ] = "(no date)" ;
-};
-
-String STR_NOAUTHOR
-{
- Text [ en-US ] = "(no author)" ;
-};
-
-String STR_REPLY
-{
- Text [ en-US ] = "Reply to $1" ;
-};
-
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 4bd3e0858dbd..e2e59e17831e 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -139,8 +139,7 @@
#include <doc.hxx>
#include <xmloff/odffields.hxx>
-#include "PostItMgr.hxx"
-#include "postit.hxx"
+#include <PostItMgr.hxx>
//JP 11.10.2001: enable test code for bug fix 91313
#if defined(DBG_UTIL) && (OSL_DEBUG_LEVEL > 1)
@@ -1342,8 +1341,8 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
}
aKeyEvent = KeyEvent( rKEvt.GetCharCode(),
- KeyCode( nKey, rKEvt.GetKeyCode().GetModifier() ),
- rKEvt.GetRepeat() );
+ KeyCode( nKey, rKEvt.GetKeyCode().GetModifier() ),
+ rKEvt.GetRepeat() );
}
}
@@ -2605,7 +2604,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
if (rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel()))
return;
- rView.GetPostItMgr()->SetActivePostIt(0);
+ rView.GetPostItMgr()->SetActiveSidebarWin(0);
GrabFocus();
@@ -4701,8 +4700,10 @@ BOOL SwEditWin::IsDrawSelMode()
void SwEditWin::GetFocus()
{
- if (rView.GetPostItMgr()->GetActivePostIt())
- rView.GetPostItMgr()->GetActivePostIt()->GrabFocus();
+ if ( rView.GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ rView.GetPostItMgr()->GrabFocusOnActiveSidebarWin();
+ }
else
{
rView.GotFocus();
diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx
index d605ef993457..763504c75db6 100644
--- a/sw/source/ui/docvw/edtwin2.cxx
+++ b/sw/source/ui/docvw/edtwin2.cxx
@@ -87,7 +87,6 @@
#include <utlui.hrc>
#endif
-#include <postit.hxx>
#include <PostItMgr.hxx>
#include <fmtfld.hxx>
diff --git a/sw/source/ui/docvw/frmsidebarwincontainer.cxx b/sw/source/ui/docvw/frmsidebarwincontainer.cxx
new file mode 100644
index 000000000000..b5e406dcf69b
--- /dev/null
+++ b/sw/source/ui/docvw/frmsidebarwincontainer.cxx
@@ -0,0 +1,216 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <frmsidebarwincontainer.hxx>
+
+#include <map>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <SidebarWin.hxx>
+
+namespace {
+ struct SidebarWinKey
+ {
+ const xub_StrLen mnIndex;
+
+ explicit SidebarWinKey( const xub_StrLen nIndex )
+ : mnIndex( nIndex )
+ {}
+
+ bool operator < ( const SidebarWinKey& rSidebarWinKey ) const
+ {
+ return mnIndex < rSidebarWinKey.mnIndex;
+ }
+ };
+
+ struct SidebarWinOrder
+ {
+ sal_Bool operator()( const SidebarWinKey& rSidebarWinKeyA,
+ const SidebarWinKey& rSidebarWinKeyB ) const
+ {
+ return rSidebarWinKeyA < rSidebarWinKeyB;
+ }
+ };
+
+ typedef ::std::map < SidebarWinKey, sw::sidebarwindows::SwSidebarWin*, SidebarWinOrder > SidebarWinContainer;
+
+ struct FrmKey
+ {
+ const SwFrm* mpFrm;
+
+ explicit FrmKey( const SwFrm* pFrm )
+ : mpFrm( pFrm )
+ {}
+
+ bool operator < ( const FrmKey& rFrmKey ) const
+ {
+ return mpFrm < rFrmKey.mpFrm;
+ }
+ };
+
+ struct FrmOrder
+ {
+ sal_Bool operator()( const FrmKey& rFrmKeyA,
+ const FrmKey& rFrmKeyB ) const
+ {
+ return rFrmKeyA < rFrmKeyB;
+ }
+ };
+
+ typedef ::std::map < FrmKey, SidebarWinContainer, FrmOrder > _FrmSidebarWinContainer;
+}
+
+namespace sw { namespace sidebarwindows {
+
+class FrmSidebarWinContainer : public _FrmSidebarWinContainer
+{
+};
+
+SwFrmSidebarWinContainer::SwFrmSidebarWinContainer()
+ : mpFrmSidebarWinContainer( new FrmSidebarWinContainer() )
+{}
+
+SwFrmSidebarWinContainer::~SwFrmSidebarWinContainer()
+{
+ mpFrmSidebarWinContainer->clear();
+ delete mpFrmSidebarWinContainer;
+}
+
+bool SwFrmSidebarWinContainer::insert( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin )
+{
+ bool bInserted( false );
+
+ FrmKey aFrmKey( &rFrm );
+ SidebarWinContainer& rSidebarWinContainer = (*mpFrmSidebarWinContainer)[ aFrmKey ];
+
+ SidebarWinKey aSidebarWinKey( *(rFmtFld.GetTxtFld()->GetStart()) );
+ if ( rSidebarWinContainer.empty() ||
+ rSidebarWinContainer.find( aSidebarWinKey) == rSidebarWinContainer.end() )
+ {
+ rSidebarWinContainer[ aSidebarWinKey ] = &rSidebarWin;
+ bInserted = true;
+ }
+
+ return bInserted;
+}
+
+bool SwFrmSidebarWinContainer::remove( const SwFrm& rFrm,
+ const SwSidebarWin& rSidebarWin )
+{
+ bool bRemoved( false );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ if ( (*aIter).second == &rSidebarWin )
+ {
+ rSidebarWinContainer.erase( aIter );
+ bRemoved = true;
+ break;
+ }
+ }
+ }
+
+ return bRemoved;
+}
+
+bool SwFrmSidebarWinContainer::empty( const SwFrm& rFrm )
+{
+ bool bEmpty( true );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ bEmpty = (*aFrmIter).second.empty();
+ }
+
+ return bEmpty;
+}
+
+SwSidebarWin* SwFrmSidebarWinContainer::get( const SwFrm& rFrm,
+ const sal_Int32 nIndex )
+{
+ SwSidebarWin* pRet( 0 );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ sal_Int32 nCounter( nIndex );
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ nCounter >= 0 && aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ if ( nCounter == 0 )
+ {
+ pRet = (*aIter).second;
+ break;
+ }
+
+ --nCounter;
+ }
+ }
+
+ return pRet;
+}
+
+void SwFrmSidebarWinContainer::getAll( const SwFrm& rFrm,
+ std::vector< Window* >* pSidebarWins )
+{
+ pSidebarWins->clear();
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ pSidebarWins->push_back( (*aIter).second );
+ }
+ }
+}
+
+} } // eof of namespace sw::sidebarwindows::
diff --git a/sw/source/ui/docvw/frmsidebarwincontainer.hxx b/sw/source/ui/docvw/frmsidebarwincontainer.hxx
new file mode 100644
index 000000000000..1583f36a0bb6
--- /dev/null
+++ b/sw/source/ui/docvw/frmsidebarwincontainer.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FRMSIDEBARWINCONTAINER_HXX
+#define _FRMSIDEBARWINCONTAINER_HXX
+
+#include <sal/types.h>
+#include <vector>
+
+class SwFrm;
+class SwFmtFld;
+class Window;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+class FrmSidebarWinContainer;
+
+class SwFrmSidebarWinContainer
+{
+ public:
+ SwFrmSidebarWinContainer();
+ ~SwFrmSidebarWinContainer();
+
+ bool insert( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin );
+
+ bool remove( const SwFrm& rFrm,
+ const SwSidebarWin& rSidebarWin );
+
+ bool empty( const SwFrm& rFrm );
+
+ SwSidebarWin* get( const SwFrm& rFrm,
+ const sal_Int32 nIndex );
+
+ void getAll( const SwFrm& rFrm,
+ std::vector< Window* >* pSidebarWins );
+
+ private:
+ FrmSidebarWinContainer* mpFrmSidebarWinContainer;
+};
+
+} } // eof of namespace sw::sidebarwindows::
+
+#endif
+
diff --git a/sw/source/ui/docvw/makefile.mk b/sw/source/ui/docvw/makefile.mk
index c3644c83f267..a2914b2f86b7 100644
--- a/sw/source/ui/docvw/makefile.mk
+++ b/sw/source/ui/docvw/makefile.mk
@@ -42,7 +42,8 @@ ENABLE_EXCEPTIONS=TRUE
SRS1NAME=$(TARGET)
SRC1FILES = \
access.src \
- docvw.src
+ docvw.src \
+ annotation.src
SLOFILES = \
$(SLO)$/edtdd.obj \
@@ -51,8 +52,16 @@ SLOFILES = \
$(SLO)$/edtwin3.obj \
$(SLO)$/romenu.obj \
$(SLO)$/srcedtw.obj \
- $(SLO)$/postit.obj \
- $(SLO)$/PostItMgr.obj
+ $(SLO)$/PostItMgr.obj \
+ $(SLO)$/frmsidebarwincontainer.obj \
+ $(SLO)$/AnchorOverlayObject.obj \
+ $(SLO)$/ShadowOverlayObject.obj \
+ $(SLO)$/SidebarWin.obj \
+ $(SLO)$/SidebarWinAcc.obj \
+ $(SLO)$/AnnotationWin.obj \
+ $(SLO)$/AnnotationMenuButton.obj \
+ $(SLO)$/SidebarTxtControl.obj \
+ $(SLO)$/SidebarTxtControlAcc.obj
# --- Tagets -------------------------------------------------------
diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx
deleted file mode 100644
index 06d26534abfd..000000000000
--- a/sw/source/ui/docvw/postit.cxx
+++ /dev/null
@@ -1,2482 +0,0 @@
-/************************************************************************* *
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "precompiled_sw.hxx"
-#include <postit.hxx>
-#include <PostItMgr.hxx>
-
-#include <popup.hrc>
-#include <docvw.hrc>
-#include <app.hrc>
-
-#include <hintids.hxx>
-#include "viewopt.hxx"
-#include "cmdid.h"
-
-#include <tools/poly.hxx> // Polygon
-
-#include <editeng/postitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/bulitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/frmdir.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/editview.hxx>
-#include <svx/svdview.hxx>
-#include <svx/sdrpaintwindow.hxx>
-#include <svx/sdr/overlay/overlaymanager.hxx>
-#include <editeng/editstat.hxx> //EditEngine flags
-#include <editeng/outliner.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editobj.hxx>
-#include <editeng/unolingu.hxx>
-
-#include <svtools/langtab.hxx>
-#include <svl/slstitm.hxx>
-#include <unotools/securityoptions.hxx>
-#include <unotools/useroptions.hxx>
-#include <svl/languageoptions.hxx>
-#include <svl/zforlist.hxx>
-#include <svtools/svmedit.hxx>
-
-#include <linguistic/lngprops.hxx>
-
-#include <sfx2/request.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/mnumgr.hxx>
-
-#include <vcl/vclenum.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/help.hxx>
-#include <vcl/scrbar.hxx>
-#include <vcl/button.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/gradient.hxx>
-#include <vcl/salbtype.hxx> // FRound
-#include <vcl/msgbox.hxx>
-
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/tuple/b2dtuple.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-
-#include <swrect.hxx>
-#include <docufld.hxx> // SwPostItField
-#include <edtwin.hxx>
-#include <view.hxx>
-#include <viewsh.hxx>
-#include <docsh.hxx>
-#include <shellres.hxx>
-#include <fmtfld.hxx>
-#include <wrtsh.hxx>
-#include <textsh.hxx>
-#include <doc.hxx>
-#include <txtfld.hxx>
-#include <redline.hxx>
-#include <uitool.hxx>
-#include <SwUndoField.hxx>
-#include <editsh.hxx>
-#include <swmodule.hxx>
-#include <node.hxx>
-#include <ndtxt.hxx>
-#include <langhelper.hxx>
-
-#include <sw_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/primitivetools2d.hxx>
-#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
-#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
-
-using namespace ::com::sun::star;
-
-#define METABUTTON_WIDTH 16
-#define METABUTTON_HEIGHT 18
-#define METABUTTON_AREA_WIDTH 30
-#define POSTIT_META_HEIGHT (sal_Int32) 30
-#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
-
-#define POSTIT_SHADOW_BRIGHT Color(180,180,180)
-#define POSTIT_SHADOW_DARK Color(83,83,83)
-
-#define LINEBREAK rtl::OUString::createFromAscii("\n")
-#define EMPTYSTRING rtl::OUString::createFromAscii("")
-
-TYPEINIT0(SwMarginWin);
-TYPEINIT1(SwPostIt,SwMarginWin);
-//TYPEINIT1(SwRedComment,SwMarginWin);
-
-Color ColorFromAlphaColor(UINT8 aTransparency, Color &aFront, Color &aBack )
-{
- return Color((UINT8)(aFront.GetRed() * aTransparency/(double)255 + aBack.GetRed() * (1-aTransparency/(double)255)),
- (UINT8)(aFront.GetGreen() * aTransparency/(double)255 + aBack.GetGreen() * (1-aTransparency/(double)255)),
- (UINT8)(aFront.GetBlue() * aTransparency/(double)255 + aBack.GetBlue() * (1-aTransparency/(double)255)));
-}
-
-/************ PostItTxt **************************************/
-PostItTxt::PostItTxt(Window* pParent, WinBits nBits) : Window(pParent, nBits), mpOutlinerView(0),mMouseOver(false),mbShowPopup(FALSE)
-{
- SetHelpId(26276);
- AddEventListener( LINK( this, PostItTxt, WindowEventListener ) );
- mpMarginWin = static_cast<SwMarginWin*>(GetParent());
-}
-
-PostItTxt::~PostItTxt()
-{
- RemoveEventListener( LINK( this, PostItTxt, WindowEventListener ) );
-}
-
-void PostItTxt::GetFocus()
-{
- BOOL bLockView = mpMarginWin->DocView()->GetWrtShell().IsViewLocked();
- mpMarginWin->DocView()->GetWrtShell().LockView( TRUE );
-
- if(mpMarginWin && !mpMarginWin->IsPreview())
- mpMarginWin->Mgr()->SetActivePostIt(mpMarginWin);
- Window::GetFocus();
- if (!mMouseOver)
- Invalidate();
-
- mpMarginWin->DocView()->GetWrtShell().LockView( bLockView );
- mpMarginWin->Mgr()->MakeVisible(mpMarginWin);
-}
-
-void PostItTxt::LoseFocus()
-{
- // write the visible text back into the SwField
- if ( mpMarginWin )
- mpMarginWin->UpdateData();
-
- Window::LoseFocus();
- if (!mMouseOver)
- Invalidate();
-}
-
-void PostItTxt::RequestHelp(const HelpEvent &rEvt)
-{
- USHORT nResId = 0;
- switch( mpMarginWin->GetStatus() )
- {
- case SwPostItHelper::INSERTED: nResId = STR_REDLINE_INSERT; break;
- case SwPostItHelper::DELETED: nResId = STR_REDLINE_DELETE; break;
- default: nResId = 0;
- }
-
- SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
- if ( nResId && mpMarginWin->DocView()->GetWrtShell().GetContentAtPos( mpMarginWin->GetAnkorRect().Pos(), aCntntAtPos ) )
- {
- String sTxt;
- sTxt = SW_RESSTR( nResId );
- sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " ));
- sTxt += aCntntAtPos.aFnd.pRedl->GetAuthorString();
- sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ));
- sTxt += GetAppLangDateTimeString( aCntntAtPos.aFnd.pRedl->GetTimeStamp() );
- Help::ShowQuickHelp( this,PixelToLogic(Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sTxt);
- }
-}
-
-void PostItTxt::Paint( const Rectangle& rRect)
-{
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- if (mMouseOver || HasFocus())
- DrawGradient(Rectangle(Point(0,0),PixelToLogic(GetSizePixel())),
- Gradient(GRADIENT_LINEAR,mpMarginWin->ColorDark(),mpMarginWin->ColorDark()));
- else
- DrawGradient(Rectangle(Point(0,0),PixelToLogic(GetSizePixel())),
- Gradient(GRADIENT_LINEAR,mpMarginWin->ColorLight(),mpMarginWin->ColorDark()));
- }
-
- mpOutlinerView->Paint( rRect );
-
- if (mpMarginWin->GetStatus()==SwPostItHelper::DELETED)
- {
- SetLineColor(static_cast<SwPostIt*>(mpMarginWin)->GetChangeColor());
- DrawLine(PixelToLogic(GetPosPixel()),PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width(),GetSizePixel().Height())));
- DrawLine(PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width(),0)),PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())));
- }
-}
-
-void PostItTxt::KeyInput( const KeyEvent& rKeyEvt )
-{
- const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
- USHORT nKey = rKeyCode.GetCode();
- SwView* pView = mpMarginWin->DocView();
- if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN)))
- mpMarginWin->SwitchToPostIt(nKey);
- else
- if ((nKey == KEY_ESCAPE) || (rKeyCode.IsMod1() && ((nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN))))
- mpMarginWin->SwitchToFieldPos();
- else
- if (nKey == KEY_INSERT)
- {
- if (!rKeyCode.IsMod1() && !rKeyCode.IsMod2())
- mpMarginWin->ToggleInsMode();
- }
- else
- {
- //let's make sure we see our note
- mpMarginWin->Mgr()->MakeVisible(mpMarginWin);
-
- long aOldHeight = mpMarginWin->GetPostItTextHeight();
- bool bDone = false;
-
- /// HACK: need to switch off processing of Undo/Redo in Outliner
- if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
- {
- /*
- SwPostItHelper::SwLayoutStatus aStatus = mpMarginWin->GetStatus();
- if ( (aStatus!=SwPostItHelper::DELETED) ||
- ( (aStatus==SwPostItHelper::DELETED) && (!mpMarginWin->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt))) )
- */
- bool bIsProtected = mpMarginWin->IsProtected();
- if (!bIsProtected || (bIsProtected && !mpMarginWin->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
- bDone = mpOutlinerView->PostKeyEvent( rKeyEvt );
- else
- InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
- }
- if (bDone)
- mpMarginWin->ResizeIfNeccessary(aOldHeight,mpMarginWin->GetPostItTextHeight());
- else
- {
- // write back data first when showing navigator
- if ( nKey==KEY_F5 )
- mpMarginWin->UpdateData();
- if (!pView->KeyInput(rKeyEvt))
- Window::KeyInput(rKeyEvt);
- }
- }
-
- pView->GetViewFrame()->GetBindings().InvalidateAll(FALSE);
-}
-
-void PostItTxt::MouseMove( const MouseEvent& rMEvt )
-{
- if ( mpOutlinerView )
- {
- mpOutlinerView->MouseMove( rMEvt );
- // mba: why does OutlinerView not handle the modifier setting?!
- // this forces the postit to handle *all* pointer types
- SetPointer( mpOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
-
- const EditView& aEV = mpOutlinerView->GetEditView();
- const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
- if ( pItem )
- {
- const SvxFieldData* pFld = pItem->GetField();
- const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
- if ( pURL )
- {
- String sURL( pURL->GetURL() );
- SvtSecurityOptions aSecOpts;
- if ( aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK) )
- {
- sURL.InsertAscii( ": ", 0 );
- sURL.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
- }
- Help::ShowQuickHelp( this,PixelToLogic(Rectangle(GetPosPixel(),Size(50,10))),sURL);
- }
- }
- }
-}
-
-void PostItTxt::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if (mpOutlinerView )
- {
- SvtSecurityOptions aSecOpts;
- bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK);
-
- if ( !bExecuteMod || (bExecuteMod && rMEvt.GetModifier() == KEY_MOD1))
- {
- const EditView& aEV = mpOutlinerView->GetEditView();
- const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
- if ( pItem )
- {
- const SvxFieldData* pFld = pItem->GetField();
- const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
- if ( pURL )
- {
- mpOutlinerView->MouseButtonDown( rMEvt );
- SwWrtShell &rSh = mpMarginWin->DocView()->GetWrtShell();
- String sURL( pURL->GetURL() );
- String sTarget( pURL->GetTargetFrame() );
- ::LoadURL( sURL, &rSh, URLLOAD_NOFILTER, &sTarget);
- return;
- }
- }
- }
- }
-
- GrabFocus();
- if ( mpOutlinerView )
- mpOutlinerView->MouseButtonDown( rMEvt );
- mpMarginWin->DocView()->GetViewFrame()->GetBindings().InvalidateAll(FALSE);
-}
-
-void PostItTxt::MouseButtonUp( const MouseEvent& rMEvt )
-{
- if ( mpOutlinerView )
- mpOutlinerView->MouseButtonUp( rMEvt );
-}
-
-IMPL_LINK(PostItTxt, OnlineSpellCallback, SpellCallbackInfo*, pInfo)
-{
- if ( mpMarginWin && (pInfo->nCommand == SPELLCMD_STARTSPELLDLG) )
- mpMarginWin->DocView()->GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
- return 0;
-}
-
-IMPL_LINK( PostItTxt, Select, Menu*, pSelMenu )
-{
- mpMarginWin->ExecuteCommand( pSelMenu->GetCurItemId() );
- return 0;
-}
-
-void PostItTxt::Command( const CommandEvent& rCEvt )
-{
- if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
- {
- if (!mpMarginWin->IsProtected() &&
- //if (!mpMarginWin->IsReadOnly() && (mpMarginWin->GetStatus()!=SwPostItHelper::DELETED) &&
- mpOutlinerView->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(),TRUE ))
- {
- Link aLink = LINK(this, PostItTxt, OnlineSpellCallback);
- mpOutlinerView->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
- }
- else
- {
- SfxPopupMenuManager* aMgr = mpMarginWin->DocView()->GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel());
- XubString aText = ((PopupMenu*)aMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR );
- SwRewriter aRewriter;
- aRewriter.AddRule(UNDO_ARG1, mpMarginWin->GetAuthor());
- aText = aRewriter.Apply(aText);
- ((PopupMenu*)aMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
- // SwPostItLinkForwarder_Impl aFwd( ((PopupMenu*)aMgr->GetSVMenu())->pSvMenu->GetSelectHdl(), mpPostIt );
- // ((PopupMenu*)aMgr->GetSVMenu())->pSvMenu->SetSelectHdl( LINK(&aFwd, SwPostItLinkForwarder_Impl, Select) );
-
- ((PopupMenu*)aMgr->GetSVMenu())->SetSelectHdl( LINK(this, PostItTxt, Select) );
-
- if (rCEvt.IsMouseEvent())
- ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,rCEvt.GetMousePosPixel());
- else
- {
- const Size aSize = GetSizePixel();
- const Point aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
- ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,aPos);
- }
- delete aMgr;
- }
- }
- else
- if (rCEvt.GetCommand() == COMMAND_WHEEL)
- {
- if (mpMarginWin->Scrollbar()->IsVisible())
- {
- const CommandWheelData* pData = rCEvt.GetWheelData();
- if (pData->IsShift() || pData->IsMod1() || pData->IsMod2())
- {
- mpMarginWin->DocView()->HandleWheelCommands(rCEvt);
- }
- else
- {
- HandleScrollCommand( rCEvt, 0 , mpMarginWin->Scrollbar());
-
- /*
- long nLines = pData->GetNotchDelta() * (long)pData->GetScrollLines();
- if ( ((mpMarginWin->Scrollbar()->GetRange().Min() == mpMarginWin->Scrollbar()->GetThumbPos()) && (nLines > 0)) ||
- ( (mpMarginWin->Scrollbar()->GetRange().Max() == mpMarginWin->Scrollbar()->GetThumbPos()+mpMarginWin->Scrollbar()->GetVisibleSize()) && (nLines < 0)) )
- {
- mpMarginWin->DocView()->HandleWheelCommands(rCEvt);
- }
- else
- {
- HandleScrollCommand( rCEvt, 0 , mpMarginWin->Scrollbar());
- }
- */
- }
- }
- else
- {
- mpMarginWin->DocView()->HandleWheelCommands(rCEvt);
- }
- }
- else
- {
- if ( mpOutlinerView )
- mpOutlinerView->Command( rCEvt );
- else
- Window::Command(rCEvt);
- }
-}
-
-void PostItTxt::DataChanged( const DataChangedEvent& aData)
-{
- Window::DataChanged( aData );
-}
-
-IMPL_LINK( PostItTxt, WindowEventListener, VclSimpleEvent*, pWinEvent )
-{
- if ( pWinEvent && pWinEvent->ISA( VclWindowEvent ) )
- {
- VclWindowEvent *pEvent = (VclWindowEvent*)pWinEvent;
- if (pEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE)
- {
- MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();
- if ( pMouseEvt->IsEnterWindow() )
- {
- mMouseOver = true;
- if (!mbShowPopup && !HasFocus())
- {
- mpMarginWin->SetViewState(SS_VIEW);
- Invalidate();
- }
- }
- else if ( pMouseEvt->IsLeaveWindow())
- {
- if (mpMarginWin->IsPreview())
- {
- //mpMarginWin->doLazyDelete();
- }
- else
- {
- mMouseOver = false;
- if (!mbShowPopup && !HasFocus())
- {
- mpMarginWin->SetViewState(SS_NORMAL);
- Invalidate();
- }
- }
- }
- }
- }
- return sal_True;
-}
-
-XubString PostItTxt::GetSurroundingText() const
-{
- if( mpOutlinerView )
- return mpOutlinerView->GetSurroundingText();
- else
- return XubString::EmptyString();
-}
-
-Selection PostItTxt::GetSurroundingTextSelection() const
-{
- if( mpOutlinerView )
- return mpOutlinerView->GetSurroundingTextSelection();
- else
- return Selection( 0, 0 );
-}
-
-/************** SwMarginWin***********************************++*/
-SwMarginWin::SwMarginWin(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
-: Window(pParent, nBits),
- mnEventId(0),
- mpOutlinerView(0),
- mpOutliner(0),
- mpPostItTxt(0),
- mpMeta(0),
- mpVScrollbar(0),
- mpAnkor(0),
- mpShadow(0),
- mpMgr(aMgr),
- mbMeta(true),
- nFlags(aBits),
- mbMouseOverButton(false),
- mpButtonPopup(0),
- mbIsFollow(false)
-{
- SwEditWin* aWin = static_cast<SwEditWin*>(GetParent());
- mpView = &aWin->GetView();
-
- SdrPaintWindow* pPaintWindow = mpView->GetDrawView()->GetPaintWindow(0);
- if(pPaintWindow)
- {
- pOverlayManager = pPaintWindow->GetOverlayManager();
-
- mpShadow = new SwPostItShadow(basegfx::B2DPoint(0,0),basegfx::B2DPoint(0,0),Color(0,0,0),SS_NORMAL);
- mpShadow->setVisible(false);
- pOverlayManager->add(*mpShadow);
- }
-}
-
-SwMarginWin::~SwMarginWin()
-{
- if (mpOutlinerView)
- {
- delete mpOutlinerView;
- }
-
- if (mpOutliner)
- {
- delete mpOutliner;
- }
-
- if (mpMeta)
- {
- mpMeta->RemoveEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) );
- delete mpMeta;
- }
-
- if (mpPostItTxt)
- {
- delete mpPostItTxt;
- }
-
- if (mpVScrollbar)
- {
- delete mpVScrollbar;
- }
-
- if (mpAnkor)
- {
- if (mpAnkor->getOverlayManager())
- {
- // remove this object from the chain
- mpAnkor->getOverlayManager()->remove(*mpAnkor);
- }
- delete mpAnkor;
- }
-
- if (mpShadow)
- {
- if (mpShadow->getOverlayManager())
- {
- mpShadow->getOverlayManager()->remove(*mpShadow);
- }
- delete mpShadow;
- }
-
- if (mpButtonPopup)
- {
- delete mpButtonPopup;
- }
-
- if (mnEventId)
- Application::RemoveUserEvent( mnEventId );
-}
-
-void SwMarginWin::Paint( const Rectangle& rRect)
-{
- Window::Paint(rRect);
-
- if (mpMeta->IsVisible() )
- {
- //draw left over space
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- SetFillColor(COL_BLACK);
- else
- SetFillColor(mColorDark);
- SetLineColor();
- DrawRect(PixelToLogic(Rectangle(Point(mpMeta->GetPosPixel().X()+mpMeta->GetSizePixel().Width(),mpMeta->GetPosPixel().Y()),Size(GetMetaButtonAreaWidth(),mpMeta->GetSizePixel().Height()))));
-
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode())
- {
- //draw rect around button
- SetFillColor(COL_BLACK);
- SetLineColor(COL_WHITE);
- }
- else
- {
- //draw button
- Gradient aGradient;
- if (mbMouseOverButton)
- aGradient = Gradient(GRADIENT_LINEAR,ColorFromAlphaColor(80,mColorAnkor,mColorDark),ColorFromAlphaColor(15,mColorAnkor,mColorDark));
- else
- aGradient = Gradient(GRADIENT_LINEAR,ColorFromAlphaColor(15,mColorAnkor,mColorDark),ColorFromAlphaColor(80,mColorAnkor,mColorDark));
- DrawGradient(mRectMetaButton,aGradient);
- //draw rect around button
- SetFillColor();
- SetLineColor(ColorFromAlphaColor(90,mColorAnkor,mColorDark));
- }
- DrawRect(mRectMetaButton);
-
- if (IsPreview())
- {
- Font aOldFont( GetFont());
- Font aFont(aOldFont);
- Color aCol( COL_BLACK);
- aFont.SetColor( aCol );
- aFont.SetHeight(200);
- aFont.SetWeight(WEIGHT_MEDIUM);
- SetFont( aFont );
- DrawText(mRectMetaButton,rtl::OUString::createFromAscii("Edit Note"),TEXT_DRAW_CENTER);
- SetFont( aOldFont );
- }
- else
- {
- //draw arrow
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- SetFillColor(COL_WHITE);
- else
- SetFillColor(COL_BLACK);
- SetLineColor();
- DrawPolygon(Polygon(aPopupTriangle));
- }
- }
-}
-
-void SwMarginWin::SetPosSizePixelRect(long nX, long nY,long nWidth, long nHeight,const SwRect &aRect, const long aPageBorder)
-{
- mbMeta = true;
- mPosSize = Rectangle(Point(nX,nY),Size(nWidth,nHeight));
- mAnkorRect = aRect;
- mPageBorder = aPageBorder;
-}
-
-void SwMarginWin::SetSize( const Size& rNewSize )
-{
- mPosSize.SetSize(rNewSize);
-}
-
-void SwMarginWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
-{
- mPosSize = Rectangle(aPoint,aSize);
-}
-
-void SwMarginWin::TranslateTopPosition(const long aAmount)
-{
- mPosSize.Move(0,aAmount);
-}
-
-void SwMarginWin::ShowAnkorOnly(const Point &aPoint)
-{
- HideNote();
- SetPosAndSize();
- if (mpAnkor)
- {
- mpAnkor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
- mpAnkor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
- mpAnkor->SetAnkorState(AS_ALL);
- mpAnkor->setVisible(true);
- }
- if (mpShadow)
- mpShadow->setVisible(false);
-}
-
-SfxItemSet SwMarginWin::DefaultItem()
-{
- SfxItemSet aItem( mpView->GetDocShell()->GetPool() );
- aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
- aItem.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
- EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
- return aItem;
-}
-
-void SwMarginWin::InitControls()
-{
- // actual window which holds the user text
- mpPostItTxt = new PostItTxt(this, WB_NODIALOGCONTROL);
- mpPostItTxt->SetPointer(Pointer(POINTER_TEXT));
-
- // window control for author and date
- mpMeta = new MultiLineEdit(this,0);
- mpMeta->SetReadOnly();
- mpMeta->SetRightToLeft(Application::GetSettings().GetLayoutRTL());
- mpMeta->AlwaysDisableInput(true);
- mpMeta->SetCallHandlersOnInputDisabled(true);
- mpMeta->AddEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) );
- AddEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) );
-
- // we should leave this setting alone, but for this we need a better layout algo
- // with variable meta size height
- AllSettings aSettings = mpMeta->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- Font aFont = aStyleSettings.GetFieldFont();
- aFont.SetHeight(8);
- aStyleSettings.SetFieldFont(aFont);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMeta->SetSettings(aSettings);
-
- SwDocShell* aShell = mpView->GetDocShell();
- mpOutliner = new Outliner(&aShell->GetPool(),OUTLINERMODE_TEXTOBJECT);
- aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner );
- // mpOutliner->EnableUndo( FALSE );
- mpOutliner->SetUpdateMode( TRUE );
- Rescale();
-
- OutputDevice* pDev = aShell->GetDoc()->getReferenceDevice(TRUE);
- if ( pDev )
- {
- mpOutliner->SetRefDevice( pDev );
- }
-
- mpOutlinerView = new OutlinerView ( mpOutliner, mpPostItTxt );
- mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
- mpOutliner->InsertView(mpOutlinerView );
- mpPostItTxt->SetTextView(mpOutlinerView);
- mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
-
- mpOutlinerView->SetAttribs(DefaultItem());
-
- // TODO: ??
- EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
- mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
-
- //create Scrollbars
- mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
- mpVScrollbar->EnableNativeWidget(false);
- mpVScrollbar->EnableRTL( false );
- mpVScrollbar->SetScrollHdl(LINK(this, SwMarginWin, ScrollHdl));
- mpVScrollbar->EnableDrag();
- mpVScrollbar->AddEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) );
-
- const SwViewOption* pVOpt = mpView->GetWrtShellPtr()->GetViewOptions();
- ULONG nCntrl = mpOutliner->GetControlWord();
- // TODO: crash when AUTOCOMPLETE enabled
- nCntrl |= EE_CNTRL_MARKFIELDS | EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT | EV_CNTRL_AUTOSCROLL | EE_CNTRL_URLSFXEXECUTE; // | EE_CNTRL_AUTOCOMPLETE;
- if (pVOpt->IsFieldShadings())
- nCntrl |= EE_CNTRL_MARKFIELDS;
- else
- nCntrl &= ~EE_CNTRL_MARKFIELDS;
- if (pVOpt->IsOnlineSpell())
- nCntrl |= EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- mpOutliner->SetControlWord(nCntrl);
-
- sal_uInt16 aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
- SetColor(mpMgr->GetColorDark(aIndex),mpMgr->GetColorLight(aIndex),mpMgr->GetColorAnkor(aIndex));
-
- CheckMetaText();
- SetPopup();
- SetLanguage(GetLanguage());
- View()->StartSpeller();
- SetPostItText();
- Engine()->CompleteOnlineSpelling();
-
- mpMeta->Show();
- mpVScrollbar->Show();
- mpPostItTxt->Show();
-}
-
-void SwMarginWin::CheckMetaText()
-{
- const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
- String sMeta = GetAuthor();
- if (sMeta==String(EMPTYSTRING))
- sMeta = String(SW_RES(STR_NOAUTHOR));
- if (sMeta.Len() > 22)
- {
- sMeta.Erase(20);
- sMeta = sMeta + rtl::OUString::createFromAscii("...");
- }
- Date aDate = GetDate();
- if (aDate==Date())
- sMeta = sMeta + LINEBREAK + String(SW_RES(STR_POSTIT_TODAY));
- else
- if (aDate == Date(Date()-1))
- sMeta = sMeta + LINEBREAK + String(SW_RES(STR_POSTIT_YESTERDAY));
- else
- if (aDate.IsValid() )
- sMeta = sMeta + LINEBREAK + rLocalData.getDate(aDate);
- else
- sMeta = sMeta + LINEBREAK + String(SW_RES(STR_NODATE));
- if (GetTime()!=0)
- sMeta = sMeta + rtl::OUString::createFromAscii(" ") + rLocalData.getTime( GetTime(),false );
- if (mpMeta->GetText() != sMeta)
- mpMeta->SetText(sMeta);
-}
-
-void SwMarginWin::Rescale()
-{
- MapMode aMode = GetParent()->GetMapMode();
- aMode.SetOrigin( Point() );
- //aMode.SetScaleX( aMode.GetScaleX() * Fraction( 8, 10 ) );
- //aMode.SetScaleY( aMode.GetScaleY() * Fraction( 8, 10 ) );
- mpOutliner->SetRefMapMode( aMode );
- SetMapMode( aMode );
- mpPostItTxt->SetMapMode( aMode );
- if ( mpMeta )
- {
- Font aFont( mpMeta->GetSettings().GetStyleSettings().GetFieldFont() );
- sal_Int32 nHeight = aFont.GetHeight();
- nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
- aFont.SetHeight( nHeight );
- mpMeta->SetControlFont( aFont );
- }
-}
-
-void SwMarginWin::SetPosAndSize()
-{
- bool bChange = false;
-
- if (GetSizePixel() != mPosSize.GetSize())
- {
- bChange = true;
- SetSizePixel(mPosSize.GetSize());
- DoResize();
- }
-
- if (GetPosPixel().X() != mPosSize.TopLeft().X() || (abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) )
- {
- bChange = true;
- SetPosPixel(mPosSize.TopLeft());
-
- Point aLineStart;
- Point aLineEnd ;
- if (mbMarginSide)
- {
- aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
- aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
- }
- else
- {
- aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
- aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
- }
-
- if (!IsPreview())
- {
- if (mpAnkor)
- {
- mpAnkor->SetAllPosition(basegfx::B2DPoint( mAnkorRect.Left() , mAnkorRect.Bottom() - 5* 15),
- basegfx::B2DPoint( mAnkorRect.Left()-5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left()+5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left(), mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( mPageBorder ,mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
- basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
- mpAnkor->SetHeight(mAnkorRect.Height());
- }
- else
- {
- mpAnkor = new SwPostItAnkor(basegfx::B2DPoint( mAnkorRect.Left() , mAnkorRect.Bottom()-5*15),
- basegfx::B2DPoint( mAnkorRect.Left()-5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left()+5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left(), mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( mPageBorder ,mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
- basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) ,
- mColorAnkor,
- false,
- false);
- mpAnkor->SetHeight(mAnkorRect.Height());
- mpAnkor->setVisible(true);
- mpAnkor->SetAnkorState(AS_TRI);
- if (HasChildPathFocus())
- {
- mpAnkor->setLineSolid(true);
- }
- pOverlayManager->add(*mpAnkor);
- }
- }
- }
- else
- {
- if ( mpAnkor && (mpAnkor->getBasePosition() != basegfx::B2DPoint( mAnkorRect.Left() , mAnkorRect.Bottom()-5*15)) )
- mpAnkor->SetTriPosition(basegfx::B2DPoint( mAnkorRect.Left() , mAnkorRect.Bottom() - 5* 15),
- basegfx::B2DPoint( mAnkorRect.Left()-5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left()+5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left(), mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( mPageBorder ,mAnkorRect.Bottom()+2*15));
- }
-
- if (bChange)
- {
- Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
- Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
- mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
- }
-
- if (mpMgr->ShowNotes())
- {
- if (IsFollow() && !HasChildPathFocus())
- {
- mpAnkor->SetAnkorState(AS_END);
- }
- else
- {
- mpAnkor->SetAnkorState(AS_ALL);
- SwMarginWin* pWin = GetTopReplyNote();
- if (pWin)
- pWin->Ankor()->SetAnkorState(AS_END);
- }
- }
-}
-
-void SwMarginWin::DoResize()
-{
- long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
- long aHeight = GetSizePixel().Height();
- unsigned long aWidth = GetSizePixel().Width();
-
- if (mbMeta)
- {
- aHeight -= GetMetaHeight();
- mpMeta->Show();
- mpPostItTxt->SetQuickHelpText(EMPTYSTRING);
- }
- else
- {
- mpMeta->Hide();
- mpPostItTxt->SetQuickHelpText(mpMeta->GetText());
- }
-
- if ((aTextHeight > aHeight) && !IsPreview())
- { // we need vertical scrollbars and have to reduce the width
- aWidth -= GetScrollbarWidth();
- mpVScrollbar->Show();
- }
- else
- {
- mpVScrollbar->Hide();
- }
-
- mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width()-GetMetaButtonAreaWidth(),GetMetaHeight());
- mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
- mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
- if (!mpVScrollbar->IsVisible())
- { // if we do not have a scrollbar anymore, we want to see the complete text
- mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
- }
-
- if (!Application::GetSettings().GetLayoutRTL())
- {
- mpPostItTxt->SetPosSizePixel(0, 0, aWidth, aHeight);
- mpVScrollbar->SetPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight);
- }
- else
- {
- mpPostItTxt->SetPosSizePixel((aTextHeight > aHeight) && !IsPreview() ? GetScrollbarWidth() : 0 , 0, aWidth, aHeight);
- mpVScrollbar->SetPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight);
- }
-
- mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
- mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
- mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
- SetScrollbar();
- mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
-
- //calculate rects for meta- button
- const Fraction& fx( GetMapMode().GetScaleX() );
- const Fraction& fy( GetMapMode().GetScaleY() );
-
- Point aPos( mpMeta->GetPosPixel());
- Point aBase( aPos.X() + aPos.X() + GetSizePixel().Width(), aPos.Y() );
- Point aLeft = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+5)*fx.GetNumerator()/fx.GetDenominator(), aBase.Y()+17*fy.GetNumerator()/fx.GetDenominator() ) );
- Point aRight = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH-1)*fx.GetNumerator()/fx.GetDenominator(), aBase.Y()+17*fy.GetNumerator()/fy.GetDenominator() ) );
- Point aBottom = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+2)*fx.GetNumerator()/fx.GetDenominator(), aBase.Y()+20*fy.GetNumerator()/fy.GetDenominator() ) );
-
- aPopupTriangle.clear();
- aPopupTriangle.append(basegfx::B2DPoint(aLeft.X(),aLeft.Y()));
- aPopupTriangle.append(basegfx::B2DPoint(aRight.X(),aRight.Y()));
- aPopupTriangle.append(basegfx::B2DPoint(aBottom.X(),aBottom.Y()));
- aPopupTriangle.setClosed(true);
- if (IsPreview())
- mRectMetaButton = PixelToLogic( Rectangle( Point(
- aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH*4+10)*fx.GetNumerator()/fx.GetDenominator(),
- aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
- Size( METABUTTON_WIDTH*4*fx.GetNumerator()/fx.GetDenominator(), METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
- else
- mRectMetaButton = PixelToLogic( Rectangle( Point(
- aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(),
- aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
- Size( METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(), METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
-}
-
-void SwMarginWin::SetSizePixel( const Size& rNewSize )
-{
- Window::SetSizePixel(rNewSize);
-
- if (mpShadow)
- {
- Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
- Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
- mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
- }
-}
-
-void SwMarginWin::SetScrollbar()
-{
- mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY());
-}
-
-void SwMarginWin::ResizeIfNeccessary(long aOldHeight, long aNewHeight)
-{
- if (aOldHeight != aNewHeight)
- {
- //check for lower border or next note
- long aBorder = mpMgr->GetNextBorder();
- if (aBorder != -1)
- {
- if (aNewHeight > GetMinimumSizeWithoutMeta())
- {
- long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
- if (aNewLowerValue < aBorder)
- SetSizePixel(Size(GetSizePixel().Width(),aNewHeight+GetMetaHeight()));
- else
- SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
- DoResize();
- Invalidate();
- }
- else
- {
- if (GetSizePixel().Height() != GetMinimumSizeWithoutMeta() + GetMetaHeight())
- SetSizePixel(Size(GetSizePixel().Width(),GetMinimumSizeWithoutMeta() + GetMetaHeight()));
- DoResize();
- Invalidate();
- }
- }
- else
- {
- DoResize();
- Invalidate();
- }
- }
- else
- {
- SetScrollbar();
- }
-}
-
-void SwMarginWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnkor)
-{
- mColorDark = aColorDark;
- mColorLight = aColorLight;
- mColorAnkor = aColorAnkor;
-
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- //Wallpaper aWall(Gradient(GRADIENT_LINEAR,mColorLight,mColorDark));
- //mpPostItTxt->SetBackground(aWall);
-
- mpMeta->SetControlBackground(mColorDark);
- AllSettings aSettings = mpMeta->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- aStyleSettings.SetFieldTextColor(aColorAnkor);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMeta->SetSettings(aSettings);
-
- AllSettings aSettings2 = mpVScrollbar->GetSettings();
- StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
- aStyleSettings2.SetButtonTextColor(Color(0,0,0));
- //aStyleSettings2.SetLightColor(mColorAnkor);
- aStyleSettings2.SetCheckedColor(mColorLight); //hintergund
- //aStyleSettings2.SetLightBorderColor(mColorAnkor);
- aStyleSettings2.SetShadowColor(mColorAnkor);
- aStyleSettings2.SetFaceColor(mColorDark);
- aSettings2.SetStyleSettings(aStyleSettings2);
- mpVScrollbar->SetSettings(aSettings2);
- }
-}
-
-void SwMarginWin::SetMarginSide(bool aMarginSide)
-{
- mbMarginSide = aMarginSide;
-}
-
-void SwMarginWin::SetReadonly(BOOL bSet)
-{
- mbReadonly = bSet;
- View()->SetReadOnly(bSet);
-}
-
-void SwMarginWin::SetLanguage(const SvxLanguageItem aNewItem)
-{
- Engine()->SetModifyHdl( Link() );
- ESelection aOld = View()->GetSelection();
-
- ESelection aNewSelection( 0, 0, (USHORT)Engine()->GetParagraphCount()-1, USHRT_MAX );
- View()->SetSelection( aNewSelection );
- SfxItemSet aEditAttr(View()->GetAttribs());
- aEditAttr.Put(aNewItem);
- View()->SetAttribs( aEditAttr );
-
- View()->SetSelection(aOld);
- Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
-
- const SwViewOption* pVOpt = DocView()->GetWrtShellPtr()->GetViewOptions();
- ULONG nCntrl = Engine()->GetControlWord();
- // turn off
- if (!pVOpt->IsOnlineSpell())
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- Engine()->SetControlWord(nCntrl);
-
- //turn back on
- if (pVOpt->IsOnlineSpell())
- nCntrl |= EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- Engine()->SetControlWord(nCntrl);
-
- Engine()->CompleteOnlineSpelling();
- Invalidate();
-}
-
-void SwMarginWin::DataChanged( const DataChangedEvent& aEvent)
-{
- Window::DataChanged( aEvent );
-}
-
-void SwMarginWin::GetFocus()
-{
- if (mpPostItTxt)
- mpPostItTxt->GrabFocus();
-}
-
-void SwMarginWin::LoseFocus()
-{
-}
-
-void SwMarginWin::ShowNote()
-{
- SetPosAndSize();
- if (!IsVisible())
- Window::Show();
- if (mpAnkor && !mpShadow->isVisible())
- mpShadow->setVisible(true);
- if (mpAnkor && !mpAnkor->isVisible())
- mpAnkor->setVisible(true);
-}
-
-void SwMarginWin::HideNote()
-{
- if (IsVisible())
- Window::Hide();
- if (mpAnkor)
- {
- if (mpMgr->IsShowAnkor())
- mpAnkor->SetAnkorState(AS_TRI);
- else
- mpAnkor->setVisible(false);
- }
- if (mpShadow && mpShadow->isVisible())
- mpShadow->setVisible(false);
-}
-
-void SwMarginWin::ActivatePostIt()
-{
- mpMgr->AssureStdModeAtShell();
-
- mpOutliner->ClearModifyFlag();
- mpOutliner->GetUndoManager().Clear();
-
- CheckMetaText();
- SetViewState(SS_EDIT);
- View()->ShowCursor();
-
- mpOutlinerView->GetEditView().SetInsertMode(mpView->GetWrtShellPtr()->IsInsMode());
-
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- View()->SetBackgroundColor(mColorDark);
-
- // mpPostItTxt->SetBackground(Wallpaper(mColorDark));
-}
-
-void SwMarginWin::DeactivatePostIt()
-{
- // remove selection, #i87073#
- if (View()->GetEditView().HasSelection())
- {
- ESelection aSelection = View()->GetEditView().GetSelection();
- aSelection.nEndPara = aSelection.nStartPara;
- aSelection.nEndPos = aSelection.nStartPos;
- View()->GetEditView().SetSelection(aSelection);
- }
-
- mpOutliner->CompleteOnlineSpelling();
-
- SetViewState(SS_NORMAL);
- // write the visible text back into the SwField
- UpdateData();
-
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- View()->SetBackgroundColor(COL_TRANSPARENT);
-
- //mpPostItTxt->SetBackground(Gradient(GRADIENT_LINEAR,mColorLight,mColorDark));
-
- if ( !IsProtected() &&
- //if (!IsReadOnly() && (GetStatus()!=SwPostItHelper::DELETED) &&
- Engine()->GetEditEngine().GetText()==String(EMPTYSTRING) )
- mnEventId = Application::PostUserEvent( LINK( this, SwMarginWin, DeleteHdl), 0 );
-}
-
-void SwMarginWin::ToggleInsMode()
-{
- if (!mpView->GetWrtShell().IsRedlineOn())
- {
- //change outliner
- mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
- //change documnet
- mpView->GetWrtShell().ToggleInsMode();
- //update statusbar
- SfxBindings &rBnd = mpView->GetViewFrame()->GetBindings();
- rBnd.Invalidate(SID_ATTR_INSERT);
- rBnd.Update(SID_ATTR_INSERT);
- }
-}
-
-void SwMarginWin::ExecuteCommand(USHORT nSlot)
-{
- mpMgr->AssureStdModeAtShell();
-
- switch (nSlot)
- {
- case FN_POSTIT:
- case FN_REPLY:
- {
- // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
- // will be created
- SwView* pView = DocView();
- if (Engine()->GetEditEngine().GetText() != String(EMPTYSTRING))
- {
- OutlinerParaObject* pPara = new OutlinerParaObject(*View()->GetEditView().CreateTextObject());
- Mgr()->RegisterAnswer(pPara);
- }
- if (Mgr()->GetActivePostIt())
- Mgr()->SetActivePostIt(0);
- SwitchToFieldPos();
- pView->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
- break;
- }
- case FN_DELETE_COMMENT:
- case FN_DELETE_NOTE:
-
- //Delete(); // do not kill the parent of our open popup menu
- mnEventId = Application::PostUserEvent( LINK( this, SwMarginWin, DeleteHdl), 0 );
- break;
- /*
- case FN_HIDE_NOTE:
- if ( Mgr()->GetActivePostIt() == this )
- {
- Mgr()->SetActivePostIt(0);
- // put the cursor back into the document
- SwitchToFieldPos();
- }
- Mgr()->Hide(mpFld);
- break;
- */
- case FN_DELETE_ALL_NOTES:
- case FN_HIDE_ALL_NOTES:
- // not possible as slot as this would require that "this" is the active postit
- DocView()->GetViewFrame()->GetBindings().Execute( nSlot, 0, 0, SFX_CALLMODE_ASYNCHRON );
- break;
- case FN_DELETE_NOTE_AUTHOR:
- case FN_HIDE_NOTE_AUTHOR:
- {
- // not possible as slot as this would require that "this" is the active postit
- SfxStringItem aItem( nSlot, GetAuthor() );
- const SfxPoolItem* aItems[2];
- aItems[0] = &aItem;
- aItems[1] = 0;
- DocView()->GetViewFrame()->GetBindings().Execute( nSlot, aItems, 0, SFX_CALLMODE_ASYNCHRON );
- }
- default:
- mpView->GetViewFrame()->GetBindings().Execute( nSlot );
- break;
- }
-}
-
-bool SwMarginWin::CalcFollow()
-{
- return false;
-}
-
-SwEditWin* SwMarginWin::EditWin()
-{
- return &mpView->GetEditWin();
-}
-
-String SwPostIt::GetAuthor()
-{
- return mpFld->GetPar1();
-}
-
-Date SwPostIt::GetDate()
-{
- return mpFld->GetDate();
-}
-
-Time SwPostIt::GetTime()
-{
- return mpFld->GetTime();
-}
-
-long SwMarginWin::GetPostItTextHeight()
-{
- return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
-}
-
-void SwMarginWin::SwitchToPostIt(USHORT aDirection)
-{
- if (mpMgr)
- {
- SwMarginWin* pPostIt = mpMgr->GetNextPostIt(aDirection, this);
- if (pPostIt)
- pPostIt->GrabFocus();
- }
-}
-
-void SwMarginWin::MouseButtonDown( const MouseEvent& /*rMEvt */)
-{
-}
-
-void SwMarginWin::MouseMove( const MouseEvent& rMEvt )
-{
- if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())))
- {
- if (!mbMouseOverButton)
- {
- Invalidate(mRectMetaButton);
- mbMouseOverButton = true;
- }
- }
- else
- {
- if (mbMouseOverButton)
- {
- Invalidate(mRectMetaButton);
- mbMouseOverButton = false;
- }
- }
-}
-
-void SwMarginWin::Delete()
-{
- if ( Mgr()->GetActivePostIt() == this)
- {
- Mgr()->SetActivePostIt(0);
- // if the note is empty, the previous line will send a delete event, but we are already there
- if (mnEventId)
- {
- Application::RemoveUserEvent( mnEventId );
- mnEventId = 0;
- }
- }
-}
-
-IMPL_LINK(SwMarginWin, ScrollHdl, ScrollBar*, pScroll)
-{
- long nDiff = View()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
- View()->Scroll( 0, nDiff );
- return 0;
-}
-
-IMPL_LINK(SwMarginWin, ModifyHdl, void*, pVoid)
-{
- // no warnings, please
- pVoid=0;
- DocView()->GetDocShell()->SetModified(sal_True);
- return 0;
-}
-
-IMPL_LINK(SwMarginWin, DeleteHdl, void*, pVoid)
-{
- // no warnings, please
- pVoid=0;
- mnEventId = 0;
- Delete();
- return 0;
-}
-
-
-void SwMarginWin::ResetAttributes()
-{
- mpOutlinerView->RemoveAttribsKeepLanguages(TRUE);
- mpOutliner->RemoveFields(TRUE);
- mpOutlinerView->SetAttribs(DefaultItem());
-}
-
-sal_Int32 SwMarginWin::GetScrollbarWidth()
-{
- return mpView->GetWrtShell().GetViewOptions()->GetZoom() / 10;
-}
-
-sal_Int32 SwMarginWin::GetMetaButtonAreaWidth()
-{
- const Fraction& f( GetMapMode().GetScaleX() );
- if (IsPreview())
- return 3 * METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
- else
- return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
-}
-
-sal_Int32 SwMarginWin::GetMetaHeight()
-{
- const Fraction& f( GetMapMode().GetScaleY() );
- return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
-}
-
-sal_Int32 SwMarginWin::GetMinimumSizeWithMeta()
-{
- return mpMgr->GetMinimumSizeWithMeta();
-}
-
-sal_Int32 SwMarginWin::GetMinimumSizeWithoutMeta()
-{
- const Fraction& f( GetMapMode().GetScaleY() );
- return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
-}
-
-void SwMarginWin::SetSpellChecking()
-{
- const SwViewOption* pVOpt = mpView->GetWrtShellPtr()->GetViewOptions();
- ULONG nCntrl = mpOutliner->GetControlWord();
- if (pVOpt->IsOnlineSpell())
- nCntrl |= EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- mpOutliner->SetControlWord(nCntrl);
-
- mpOutliner->CompleteOnlineSpelling();
- Invalidate();
-}
-
-void SwMarginWin::SetViewState(ShadowState bState)
-{
- switch (bState)
- {
- case SS_EDIT:
- {
- if (mpAnkor)
- {
- mpAnkor->SetAnkorState(AS_ALL);
- SwMarginWin* pWin = GetTopReplyNote();
- if (pWin)
- pWin->Ankor()->SetAnkorState(AS_END);
- mpAnkor->setLineSolid(true);
- }
- if (mpShadow)
- mpShadow->SetShadowState(bState);
- break;
- }
- case SS_VIEW:
- {
- if (mpAnkor)
- mpAnkor->setLineSolid(true);
- if (mpShadow)
- mpShadow->SetShadowState(bState);
- break;
- }
- case SS_NORMAL:
- {
- if (mpAnkor)
- {
- if (IsFollow())
- {
- // if there is no visible parent note, we want to see the complete anchor ??
- //if (IsAnyStackParentVisible())
- mpAnkor->SetAnkorState(AS_END);
- SwMarginWin* pTopWinSelf = GetTopReplyNote();
- SwMarginWin* pTopWinActive = mpMgr->GetActivePostIt() ? mpMgr->GetActivePostIt()->GetTopReplyNote() : 0;
- if (pTopWinSelf && (pTopWinSelf!=pTopWinActive))
- {
- if (pTopWinSelf!=mpMgr->GetActivePostIt())
- pTopWinSelf->Ankor()->setLineSolid(false);
- pTopWinSelf->Ankor()->SetAnkorState(AS_ALL);
- }
- }
- mpAnkor->setLineSolid(false);
- }
- if (mpShadow)
- mpShadow->SetShadowState(bState);
- break;
- }
- }
-}
-
-bool SwMarginWin::IsAnyStackParentVisible()
-{
- SwMarginWin* pMarginWin = mpMgr->GetNextPostIt(KEY_PAGEUP, this);
- while (pMarginWin)
- {
- if (pMarginWin->IsFollow())
- {
- pMarginWin = mpMgr->GetNextPostIt(KEY_PAGEUP, pMarginWin);
- if (pMarginWin && pMarginWin->IsVisible())
- return true;
- }
- else
- return pMarginWin && pMarginWin->IsVisible() ? true : false;
- }
- return false;
-}
-
-SwMarginWin* SwMarginWin::GetTopReplyNote()
-{
- SwMarginWin* pTopNote = 0;
- SwMarginWin* pMarginWin = IsFollow() ? mpMgr->GetNextPostIt(KEY_PAGEUP, this) : 0;
- while (pMarginWin)
- {
- pTopNote = pMarginWin;
- pMarginWin = pMarginWin->IsFollow() ? mpMgr->GetNextPostIt(KEY_PAGEUP, pMarginWin) : 0;
- }
- return pTopNote;
-}
-
-void SwMarginWin::SwitchToFieldPos()
-{
- if ( Mgr()->GetActivePostIt() == this )
- Mgr()->SetActivePostIt(0);
- GotoPos();
- sal_uInt32 aCount = MoveCaret();
- if (aCount)
- DocView()->GetDocShell()->GetWrtShell()->SwCrsrShell::Right(aCount, 0, FALSE);
- GrabFocusToDocument();
-}
-
-String SwMarginWin::GetAuthor()
-{
- return String(EMPTYSTRING);
-}
-
-Date SwMarginWin::GetDate()
-{
- return Date(0);
-}
-
-Time SwMarginWin::GetTime()
-{
- return Time(0);
-}
-
-SvxLanguageItem SwMarginWin::GetLanguage(void)
-{
- return SvxLanguageItem(SwLangHelper::GetLanguage(DocView()->GetWrtShell(),RES_CHRATR_LANGUAGE),RES_CHRATR_LANGUAGE);
-}
-
-/***** SwPostIt *********************************************/
-SwPostIt::SwPostIt( Window* pParent, WinBits nBits, SwFmtFld* aField,SwPostItMgr* aMgr,SwPostItBits aBits)
- : SwMarginWin(pParent,nBits,aMgr,aBits),
- mpFmtFld(aField),
- mpFld( static_cast<SwPostItField*>(aField->GetFld())),
- mStatus(SwPostItHelper::INVISIBLE)
-{
-}
-
-void SwPostIt::SetPostItText()
-{
- // get text from SwPostItField and insert into our textview
- Engine()->SetModifyHdl( Link() );
- Engine()->EnableUndo( FALSE );
- mpFld = static_cast<SwPostItField*>(mpFmtFld->GetFld());
- if( mpFld->GetTextObject() )
- Engine()->SetText( *mpFld->GetTextObject() );
- else
- {
- Engine()->Clear();
- View()->SetAttribs(DefaultItem());
- View()->InsertText(mpFld->GetPar2(),false);
- }
-
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
- Engine()->EnableUndo( TRUE );
- Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
- Invalidate();
-}
-
-void SwPostIt::UpdateData()
-{
- if ( Engine()->IsModified() )
- {
- SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
- SwPosition aPosition( pTxtFld->GetTxtNode() );
- aPosition.nContent = *pTxtFld->GetStart();
- SwField* pOldField = mpFld->Copy();
- mpFld->SetPar2(Engine()->GetEditEngine().GetText());
- mpFld->SetTextObject(Engine()->CreateParaObject());
- DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
- delete pOldField;
- // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one)
- Mgr()->SetLayout();
- // #i98686# if we have several views, all notes should update their text
- mpFmtFld->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED));
- DocView()->GetDocShell()->SetModified();
- }
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
-}
-
-void SwPostIt::SetChangeTracking(SwPostItHelper::SwLayoutStatus& aStatus,Color aColor)
-{
- if ( (mStatus != aStatus) || (mChangeColor != aColor) )
- {
- mStatus = aStatus;
- mChangeColor = aColor;
- Invalidate();
- }
-}
-
-void SwPostIt::Delete()
-{
- SwMarginWin::Delete();
- // we delete the field directly, the Mgr cleans up the PostIt by listening
- DocView()->GetWrtShellPtr()->GotoField(*mpFmtFld);
- GrabFocusToDocument();
- DocView()->GetWrtShellPtr()->DelRight();
-}
-
-void SwPostIt::GotoPos()
-{
- DocView()->GetDocShell()->GetWrtShell()->GotoField(*mpFmtFld);
-}
-
-sal_uInt32 SwPostIt::MoveCaret()
-{
- // if this is an answer, do not skip over all following ones, but insert directly behind the current one
- // but when just leaving a note, skip all following ones as well to continue typing
- return Mgr()->IsAnswer() ? 1 : 1 + CountFollowing();
-}
-
-//returns true, if there is another note right before this note
-bool SwPostIt::CalcFollow()
-{
- SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
- SwPosition aPosition( pTxtFld->GetTxtNode() );
- aPosition.nContent = *pTxtFld->GetStart();
- SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
- aPosition.nContent.GetIndex() - 1, RES_TXTATR_FIELD );
- const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
- return pFld && (pFld->Which()== RES_POSTITFLD);
-}
-
-// counts how many SwPostItField we have right after the current one
-sal_uInt32 SwPostIt::CountFollowing()
-{
- sal_uInt32 aCount = 1; // we start with 1, so we have to subtract one at the end again
- SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
- SwPosition aPosition( pTxtFld->GetTxtNode() );
- aPosition.nContent = *pTxtFld->GetStart();
-
- SwTxtAttr * pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
- aPosition.nContent.GetIndex() + 1, RES_TXTATR_FIELD );
- SwField* pFld = pTxtAttr ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) : 0;
- while (pFld && (pFld->Which()== RES_POSTITFLD))
- {
- aCount++;
- pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
- aPosition.nContent.GetIndex() + aCount, RES_TXTATR_FIELD );
- pFld = pTxtAttr ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) : 0;
- }
- return aCount - 1;
-}
-
-void SwPostIt::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
- {
- if (IsPreview())
- {
- doLazyDelete();
- if (Mgr())
- {
- SwPostIt* pPostIt = dynamic_cast<SwPostIt*>(Mgr()->GetPostIt(mpFmtFld));
- if (pPostIt)
- {
- pPostIt->GrabFocus();
- Mgr()->MakeVisible(pPostIt);
- }
- }
-
- }
- else
- {
- if ( mbReadonly )
- {
- mpButtonPopup->EnableItem(FN_REPLY,false);
- mpButtonPopup->EnableItem(FN_DELETE_NOTE,false);
- mpButtonPopup->EnableItem(FN_DELETE_NOTE_AUTHOR,false);
- mpButtonPopup->EnableItem(FN_DELETE_ALL_NOTES,false);
- }
- else
- {
- if (IsProtected())
- mpButtonPopup->EnableItem(FN_DELETE_NOTE,false);
- else
- mpButtonPopup->EnableItem(FN_DELETE_NOTE,true);
- mpButtonPopup->EnableItem(FN_DELETE_NOTE_AUTHOR,true);
- mpButtonPopup->EnableItem(FN_DELETE_ALL_NOTES,true);
- }
- SvtUserOptions aUserOpt;
- String sAuthor;
- if( !(sAuthor = aUserOpt.GetFullName()).Len())
- if( !(sAuthor = aUserOpt.GetID()).Len() )
- sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
- // do not allow to reply to ourself and no answer possible if this note is in a protected section
- if ((sAuthor == GetAuthor()) || (IsProtected()))
- mpButtonPopup->EnableItem(FN_REPLY,false);
- else
- mpButtonPopup->EnableItem(FN_REPLY,true);
-
- // show the popup menu and execute the selected command
- ExecuteCommand( mpButtonPopup->Execute( this,Rectangle(LogicToPixel(mRectMetaButton.BottomLeft()),LogicToPixel(mRectMetaButton.BottomLeft())),POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE) );
- }
- }
-}
-
-void SwPostIt::SetPopup()
-{
- mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON));
- //mpButtonPopup->SetMenuFlags(MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
- XubString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR );
- SwRewriter aRewriter;
- aRewriter.AddRule(UNDO_ARG1,GetAuthor());
- aText = aRewriter.Apply(aText);
- mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
-}
-
-void SwPostIt::InitAnswer(OutlinerParaObject* pText)
-{
- //collect our old meta data
- SwMarginWin* pWin = Mgr()->GetNextPostIt(KEY_PAGEUP, this);
- const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
- String aText = String(SW_RES(STR_REPLY));
- SwRewriter aRewriter;
- aRewriter.AddRule(UNDO_ARG1, pWin->GetAuthor());
- aText = aRewriter.Apply(aText);
- aText.Append(String(rtl::OUString::createFromAscii(" (") +
- String(rLocalData.getDate( pWin->GetDate())) + rtl::OUString::createFromAscii(", ") +
- String(rLocalData.getTime( pWin->GetTime(),false)) + rtl::OUString::createFromAscii("): \"")));
- View()->InsertText(aText,false);
-
- // insert old, selected text or "..."
- // TOOD: iterate over all paragraphs, not only first one to find out if it is empty
- if (pText->GetTextObject().GetText(0) != String(EMPTYSTRING))
- View()->GetEditView().InsertText(pText->GetTextObject());
- else
- View()->InsertText(rtl::OUString::createFromAscii("..."),false);
- View()->InsertText(rtl::OUString::createFromAscii("\"\n"),false);
-
- View()->SetSelection(ESelection(0x0,0x0,0xFFFF,0xFFFF));
- SfxItemSet aAnswerSet( DocView()->GetDocShell()->GetPool() );
- aAnswerSet.Put(SvxFontHeightItem(200,80,EE_CHAR_FONTHEIGHT));
- aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC));
- View()->SetAttribs(aAnswerSet);
- View()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
-
- //remove all attributes and reset our standard ones
- View()->GetEditView().RemoveAttribsKeepLanguages(true);
- View()->SetAttribs(DefaultItem());
- // lets insert an undo step so the initial text can be easily deleted
- // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
- Engine()->SetModifyHdl( Link() );
- SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
- SwPosition aPosition( pTxtFld->GetTxtNode() );
- aPosition.nContent = *pTxtFld->GetStart();
- SwField* pOldField = mpFld->Copy();
- mpFld->SetPar2(Engine()->GetEditEngine().GetText());
- mpFld->SetTextObject(Engine()->CreateParaObject());
- DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
- delete pOldField;
- Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
-}
-
-SvxLanguageItem SwPostIt::GetLanguage(void)
-{
- // set initial language for outliner
- USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( mpFld->GetLanguage() );
- USHORT nLangWhichId = 0;
- switch (nScriptType)
- {
- case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break;
- case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
- default: DBG_ERROR("GetLanguage: wrong script tye");
- }
- return SvxLanguageItem(mpFld->GetLanguage(),nLangWhichId);
-}
-
-bool SwPostIt::IsProtected()
-{
- bool aReturn;
- aReturn = mpFmtFld ? (SwMarginWin::IsProtected() || (mStatus==SwPostItHelper::DELETED) ||
- mpFmtFld->IsProtect()) : (SwMarginWin::IsProtected() || (mStatus==SwPostItHelper::DELETED));
- return aReturn;
-}
-
-/********** SwRedComment**************/
-/*
-SwRedComment::SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed)
- : SwMarginWin(pParent,nBits,aMgr,aBits),
- pRedline(pRed)
-{
-}
-
-void SwRedComment::SetPopup()
-{
- mpButtonPopup = new PopupMenu(SW_RES(MN_REDCOMMENT_BUTTON));
- //mpButtonPopup->SetMenuFlags(MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
-}
-
-void SwRedComment::UpdateData()
-{
- if ( Engine()->IsModified() )
- {
- // so we get a new layout of notes (ankor position is still the same and we would otherwise not get one)
- Mgr()->SetLayout();
- // SetRedline is calling SetModified already
- DocView()->GetWrtShell().SetRedlineComment(Engine()->GetEditEngine().GetText());
- }
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
-}
-
-void SwRedComment::SetPostItText()
-{
- Engine()->SetModifyHdl( Link() );
- Engine()->EnableUndo( FALSE );
-
- Engine()->Clear();
- View()->SetAttribs(DefaultItem());
- View()->InsertText(pRedline->GetComment(),false);
-
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
- Engine()->EnableUndo( TRUE );
- Engine()->SetModifyHdl( LINK( this, SwMarginWin, ModifyHdl ) );
- Invalidate();
-}
-
-void SwRedComment::DeactivatePostIt()
-{
- SwMarginWin::DeactivatePostIt();
- // current Redline is still selected
- DocView()->GetWrtShellPtr()->ClearMark();
-}
-
-void SwRedComment::ActivatePostIt()
-{
- SwMarginWin::ActivatePostIt();
-
- // do we want the redline selected?
- // otherwise, SwRedComment::ActivatePostIt() as well as SwRedComment::DeactivatePostIt()
- // can be thrown out completly
- DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
- DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()),true);
-}
-
-void SwRedComment::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
- {
- ExecuteCommand( mpButtonPopup->Execute( this,Rectangle(LogicToPixel(mRectMetaButton.BottomLeft()),LogicToPixel(mRectMetaButton.BottomLeft())),POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE) );
- }
-}
-
-void SwRedComment::Delete()
-{
- SwMarginWin::Delete();
- // we are not neccessarily on our redline, so let's move there
- GotoPos();
- DocView()->GetWrtShell().SetRedlineComment(EMPTYSTRING);
- DocView()->GetWrtShell().ClearMark();
- // so we get a new layout of notes (ankor position is still the same and we would otherwise not get one)
- Mgr()->SetLayout();
- Mgr()->RemoveItem(pRedline);
-}
-
-void SwRedComment::GotoPos()
-{
- DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
- DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()));
-}
-
-String SwRedComment::GetAuthor()
-{
- return pRedline->GetAuthorString();
-}
-
-Date SwRedComment::GetDate()
-{
- return pRedline->GetTimeStamp().GetDate();
-}
-
-Time SwRedComment::GetTime()
-{
- return pRedline->GetTimeStamp().GetTime();
-}
-
-bool SwRedComment::IsProtected()
-{
- return SwMarginWin::IsProtected() || pRedline->Start()->nNode.GetNode().GetTxtNode()->IsInProtectSect();
-}
-*/
-
-//////////////////////////////////////////////////////////////////////////////
-// helper SwPostItShadowPrimitive
-//
-// Used to allow view-dependent primitive definition. For that purpose, the
-// initially created primitive (this one) always has to be view-independent,
-// but the decomposition is made view-dependent. Very simple primitive which
-// just remembers the discrete data and applies it at decomposition time.
-
-class SwPostItShadowPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
-{
-private:
- basegfx::B2DPoint maBasePosition;
- basegfx::B2DPoint maSecondPosition;
- ShadowState maShadowState;
-
-protected:
- virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
- const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
-
-public:
- SwPostItShadowPrimitive(
- const basegfx::B2DPoint& rBasePosition,
- const basegfx::B2DPoint& rSecondPosition,
- ShadowState aShadowState)
- : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
- maBasePosition(rBasePosition),
- maSecondPosition(rSecondPosition),
- maShadowState(aShadowState)
- {}
-
- // data access
- const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
- const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
- ShadowState getShadowState() const { return maShadowState; }
-
- virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
-
- DeclPrimitrive2DIDBlock()
-};
-
-drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::create2DDecomposition(
- const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
-{
- // get logic sizes in object coordinate system
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
- basegfx::B2DRange aRange(getBasePosition());
-
- switch(maShadowState)
- {
- case SS_NORMAL:
- {
- aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (2.0 * getDiscreteUnit())));
- const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
- drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
- 0.0,
- 0.5,
- 0.5,
- 1800.0 * F_PI1800,
- basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
- basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
- 2);
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::FillGradientPrimitive2D(
- aRange,
- aFillGradientAttribute));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- break;
- }
- case SS_VIEW:
- {
- aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
- const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
- drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
- 0.0,
- 0.5,
- 0.5,
- 1800.0 * F_PI1800,
- basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
- basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
- 4);
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::FillGradientPrimitive2D(
- aRange,
- aFillGradientAttribute));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- break;
- }
- case SS_EDIT:
- {
- aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
- const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
- drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
- 0.0,
- 0.5,
- 0.5,
- 1800.0 * F_PI1800,
- basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
- basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0),
- 4);
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::FillGradientPrimitive2D(
- aRange,
- aFillGradientAttribute));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- break;
- }
- default:
- {
- break;
- }
- }
-
- return xRetval;
-}
-
-bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
-{
- if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
- {
- const SwPostItShadowPrimitive& rCompare = static_cast< const SwPostItShadowPrimitive& >(rPrimitive);
-
- return (getBasePosition() == rCompare.getBasePosition()
- && getSecondPosition() == rCompare.getSecondPosition()
- && getShadowState() == rCompare.getShadowState());
- }
-
- return false;
-}
-
-ImplPrimitrive2DIDBlock(SwPostItShadowPrimitive, PRIMITIVE2D_ID_SWPOSTITSHADOWPRIMITIVE)
-
-/****** SwPostItShadow ***********************************************************/
-SwPostItShadow::SwPostItShadow(const basegfx::B2DPoint& rBasePos,const basegfx::B2DPoint& rSecondPosition,
- Color aBaseColor,ShadowState aState)
- : OverlayObjectWithBasePosition(rBasePos, aBaseColor),
- maSecondPosition(rSecondPosition),
- mShadowState(aState)
-{
-// mbAllowsAnimation = false;
-}
-
-SwPostItShadow::~SwPostItShadow()
-{
-}
-
-drawinglayer::primitive2d::Primitive2DSequence SwPostItShadow::createOverlayObjectPrimitive2DSequence()
-{
- const drawinglayer::primitive2d::Primitive2DReference aReference(
- new SwPostItShadowPrimitive(
- getBasePosition(),
- GetSecondPosition(),
- GetShadowState()));
- return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
-}
-
-void SwPostItShadow::SetShadowState(ShadowState aState)
-{
- if (mShadowState != aState)
- {
- mShadowState = aState;
-
- objectChange();
- }
-}
-
-void SwPostItShadow::SetPosition(const basegfx::B2DPoint& rPoint1,
- const basegfx::B2DPoint& rPoint2)
-{
- if(!rPoint1.equal(getBasePosition()) || !rPoint2.equal(GetSecondPosition()))
- {
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
-
- objectChange();
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-// helper class: Primitive for discrete visualisation
-
-class SwPostItAnkorPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
-{
-private:
- basegfx::B2DPolygon maTriangle;
- basegfx::B2DPolygon maLine;
- basegfx::B2DPolygon maLineTop;
- AnkorState maAnkorState;
- basegfx::BColor maColor;
-
- // discrete line width
- double mfLogicLineWidth;
-
- // bitfield
- bool mbShadow : 1;
- bool mbLineSolid : 1;
-
-protected:
- virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
- const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
-
-public:
- SwPostItAnkorPrimitive(
- const basegfx::B2DPolygon& rTriangle,
- const basegfx::B2DPolygon& rLine,
- const basegfx::B2DPolygon& rLineTop,
- AnkorState aAnkorState,
- const basegfx::BColor& rColor,
- double fLogicLineWidth,
- bool bShadow,
- bool bLineSolid)
- : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
- maTriangle(rTriangle),
- maLine(rLine),
- maLineTop(rLineTop),
- maAnkorState(aAnkorState),
- maColor(rColor),
- mfLogicLineWidth(fLogicLineWidth),
- mbShadow(bShadow),
- mbLineSolid(bLineSolid)
- {}
-
- // data access
- const basegfx::B2DPolygon& getTriangle() const { return maTriangle; }
- const basegfx::B2DPolygon& getLine() const { return maLine; }
- const basegfx::B2DPolygon& getLineTop() const { return maLineTop; }
- AnkorState getAnkorState() const { return maAnkorState; }
- const basegfx::BColor& getColor() const { return maColor; }
- double getLogicLineWidth() const { return mfLogicLineWidth; }
- bool getShadow() const { return mbShadow; }
- bool getLineSolid() const { return mbLineSolid; }
-
- virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
-
- DeclPrimitrive2DIDBlock()
-};
-
-drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::create2DDecomposition(
- const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
-{
- drawinglayer::primitive2d::Primitive2DSequence aRetval;
-
- if(AS_TRI == getAnkorState() || AS_ALL == getAnkorState() || AS_START == getAnkorState())
- {
- // create triangle
- const drawinglayer::primitive2d::Primitive2DReference aTriangle(
- new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(getTriangle()),
- getColor()));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aTriangle);
- }
-
- if(AS_ALL == getAnkorState() || AS_START == getAnkorState())
- {
- // create line start
- const drawinglayer::attribute::LineAttribute aLineAttribute(
- getColor(),
- getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
-
- if(getLineSolid())
- {
- const drawinglayer::primitive2d::Primitive2DReference aSolidLine(
- new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
- getLine(),
- aLineAttribute));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aSolidLine);
- }
- else
- {
- ::std::vector< double > aDotDashArray;
- const double fDistance(3.0 * 15.0);
- const double fDashLen(5.0 * 15.0);
-
- aDotDashArray.push_back(fDashLen);
- aDotDashArray.push_back(fDistance);
-
- const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
- aDotDashArray,
- fDistance + fDashLen);
-
- const drawinglayer::primitive2d::Primitive2DReference aStrokedLine(
- new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
- getLine(),
- aLineAttribute,
- aStrokeAttribute));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aStrokedLine);
- }
- }
-
- if(aRetval.hasElements() && getShadow())
- {
- // shadow is only for triangle and line start, and in upper left
- // and lower right direction, in different colors
- const double fColorChange(20.0 / 255.0);
- const basegfx::B3DTuple aColorChange(fColorChange, fColorChange, fColorChange);
- basegfx::BColor aLighterColor(getColor() + aColorChange);
- basegfx::BColor aDarkerColor(getColor() - aColorChange);
-
- aLighterColor.clamp();
- aDarkerColor.clamp();
-
- // create shadow sequence
- drawinglayer::primitive2d::Primitive2DSequence aShadows(2);
- basegfx::B2DHomMatrix aTransform;
-
- aTransform.set(0, 2, -getDiscreteUnit());
- aTransform.set(1, 2, -getDiscreteUnit());
-
- aShadows[0] = drawinglayer::primitive2d::Primitive2DReference(
- new drawinglayer::primitive2d::ShadowPrimitive2D(
- aTransform,
- aLighterColor,
- aRetval));
-
- aTransform.set(0, 2, getDiscreteUnit());
- aTransform.set(1, 2, getDiscreteUnit());
-
- aShadows[1] = drawinglayer::primitive2d::Primitive2DReference(
- new drawinglayer::primitive2d::ShadowPrimitive2D(
- aTransform,
- aDarkerColor,
- aRetval));
-
- // add shadow before geometry to make it be proccessed first
- const drawinglayer::primitive2d::Primitive2DSequence aTemporary(aRetval);
-
- aRetval = aShadows;
- drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemporary);
- }
-
- if(AS_ALL == getAnkorState() || AS_END == getAnkorState())
- {
- // LineTop has to be created, too, but uses no shadow, so add after
- // the other parts are created
- const drawinglayer::attribute::LineAttribute aLineAttribute(
- getColor(),
- getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
-
- const drawinglayer::primitive2d::Primitive2DReference aLineTop(
- new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
- getLineTop(),
- aLineAttribute));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aLineTop);
- }
-
- return aRetval;
-}
-
-bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
-{
- if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
- {
- const SwPostItAnkorPrimitive& rCompare = static_cast< const SwPostItAnkorPrimitive& >(rPrimitive);
-
- return (getTriangle() == rCompare.getTriangle()
- && getLine() == rCompare.getLine()
- && getLineTop() == rCompare.getLineTop()
- && getAnkorState() == rCompare.getAnkorState()
- && getColor() == rCompare.getColor()
- && getLogicLineWidth() == rCompare.getLogicLineWidth()
- && getShadow() == rCompare.getShadow()
- && getLineSolid() == rCompare.getLineSolid());
- }
-
- return false;
-}
-
-ImplPrimitrive2DIDBlock(SwPostItAnkorPrimitive, PRIMITIVE2D_ID_SWPOSTITANKORPRIMITIVE)
-
-/****** SwPostItAnkor ***********************************************************/
-
-void SwPostItAnkor::implEnsureGeometry()
-{
- if(!maTriangle.count())
- {
- maTriangle.append(getBasePosition());
- maTriangle.append(GetSecondPosition());
- maTriangle.append(GetThirdPosition());
- maTriangle.setClosed(true);
- }
-
- if(!maLine.count())
- {
- maLine.append(GetFourthPosition());
- maLine.append(GetFifthPosition());
- maLine.append(GetSixthPosition());
- }
-
- if(!maLineTop.count())
- {
- maLineTop.append(GetSixthPosition());
- maLineTop.append(GetSeventhPosition());
- }
-}
-
-void SwPostItAnkor::implResetGeometry()
-{
- maTriangle.clear();
- maLine.clear();
- maLineTop.clear();
-}
-
-SwPostItAnkor::SwPostItAnkor(const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos,
- const basegfx::B2DPoint& rFourthPos,
- const basegfx::B2DPoint& rFifthPos,
- const basegfx::B2DPoint& rSixthPos,
- const basegfx::B2DPoint& rSeventhPos,
- Color aBaseColor,
- bool bShadowedEffect,
- bool bLineSolid)
- : OverlayObjectWithBasePosition(rBasePos, aBaseColor),
- maSecondPosition(rSecondPos),
- maThirdPosition(rThirdPos),
- maFourthPosition(rFourthPos),
- maFifthPosition(rFifthPos),
- maSixthPosition(rSixthPos),
- maSeventhPosition(rSeventhPos),
- maTriangle(),
- maLine(),
- maLineTop(),
- mHeight(0),
- mAnkorState(AS_ALL),
- mbShadowedEffect(bShadowedEffect),
- mbLineSolid(bLineSolid)
-{
- //mbAllowsAnimation = true;
-}
-
-SwPostItAnkor::~SwPostItAnkor()
-{
-}
-
-drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkor::createOverlayObjectPrimitive2DSequence()
-{
- implEnsureGeometry();
-
- const drawinglayer::primitive2d::Primitive2DReference aReference(
- new SwPostItAnkorPrimitive(
- maTriangle,
- maLine,
- maLineTop,
- GetAnkorState(),
- getBaseColor().getBColor(),
- ANKORLINE_WIDTH * 15.0,
- getShadowedEffect(),
- getLineSolid()));
-
- return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
-}
-
-void SwPostItAnkor::SetAllPosition(const basegfx::B2DPoint& rPoint1,
- const basegfx::B2DPoint& rPoint2,
- const basegfx::B2DPoint& rPoint3,
- const basegfx::B2DPoint& rPoint4,
- const basegfx::B2DPoint& rPoint5,
- const basegfx::B2DPoint& rPoint6,
- const basegfx::B2DPoint& rPoint7)
-{
- if(rPoint1 != getBasePosition()
- || rPoint2 != GetSecondPosition()
- || rPoint3 != GetThirdPosition()
- || rPoint4 != GetFourthPosition()
- || rPoint5 != GetFifthPosition()
- || rPoint6 != GetSixthPosition()
- || rPoint7 != GetSeventhPosition())
- {
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
- maThirdPosition = rPoint3;
- maFourthPosition = rPoint4;
- maFifthPosition = rPoint5;
- maSixthPosition = rPoint6;
- maSeventhPosition = rPoint7;
-
- implResetGeometry();
- objectChange();
- }
-}
-
-void SwPostItAnkor::SetSixthPosition(const basegfx::B2DPoint& rNew)
-{
- if(rNew != maSixthPosition)
- {
- maSixthPosition = rNew;
- implResetGeometry();
- objectChange();
- }
-}
-
-void SwPostItAnkor::SetSeventhPosition(const basegfx::B2DPoint& rNew)
-{
- if(rNew != maSeventhPosition)
- {
- maSeventhPosition = rNew;
- implResetGeometry();
- objectChange();
- }
-}
-
-void SwPostItAnkor::SetTriPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2,const basegfx::B2DPoint& rPoint3,
- const basegfx::B2DPoint& rPoint4,const basegfx::B2DPoint& rPoint5)
-{
- if(rPoint1 != getBasePosition()
- || rPoint2 != GetSecondPosition()
- || rPoint3 != GetThirdPosition()
- || rPoint4 != GetFourthPosition()
- || rPoint5 != GetFifthPosition())
- {
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
- maThirdPosition = rPoint3;
- maFourthPosition = rPoint4;
- maFifthPosition = rPoint5;
-
- implResetGeometry();
- objectChange();
- }
-}
-
-void SwPostItAnkor::setLineSolid(bool bNew)
-{
- if(bNew != getLineSolid())
- {
- mbLineSolid = bNew;
- objectChange();
- }
-}
-
-void SwPostItAnkor::SetAnkorState(AnkorState aState)
-{
- if (mAnkorState != aState)
- {
- mAnkorState = aState;
- objectChange();
- }
-}
diff --git a/sw/source/ui/inc/SidebarWindowsConsts.hxx b/sw/source/ui/inc/SidebarWindowsConsts.hxx
new file mode 100644
index 000000000000..378b2be0790a
--- /dev/null
+++ b/sw/source/ui/inc/SidebarWindowsConsts.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWINDOWSCONSTS_HXX
+#define _SIDEBARWINDOWSCONSTS_HXX
+
+namespace sw { namespace sidebarwindows {
+
+const sal_Int8 ANCHORLINE_WIDTH = 1;
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/makefile.mk b/sw/source/ui/makefile.mk
index fa1dea2bac5c..b331a2a00765 100644
--- a/sw/source/ui/makefile.mk
+++ b/sw/source/ui/makefile.mk
@@ -58,8 +58,8 @@ SUBLIBS1= \
$(SLB)$/dbui.lib \
$(SLB)$/dialog.lib \
$(SLB)$/dochdl.lib \
- $(SLB)$/docvw.lib \
- $(SLB)$/envelp.lib \
+ $(SLB)$/docvw.lib \
+ $(SLB)$/envelp.lib \
$(SLB)$/fldui.lib \
$(SLB)$/frmdlg.lib \
$(SLB)$/globdoc.lib
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
index b7b7b509d036..52c4d10c3f02 100755
--- a/sw/source/ui/shells/annotsh.cxx
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -96,8 +96,8 @@
#include <breakit.hxx>
#include "annotsh.hxx"
#include "view.hxx"
-#include "PostItMgr.hxx"
-#include "postit.hxx"
+#include <PostItMgr.hxx>
+#include <SidebarWin.hxx>
#include "swtypes.hxx"
@@ -160,22 +160,23 @@ SwAnnotationShell::~SwAnnotationShell()
SfxUndoManager* SwAnnotationShell::GetUndoManager()
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveSidebarWin() )
{
DBG_ASSERT(pPostItMgr,"PostItMgr::Layout(): We are looping forever");
return 0;
}
- return &pPostItMgr->GetActivePostIt()->Engine()->GetUndoManager();
+ return &pPostItMgr->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner()->GetUndoManager();
}
void SwAnnotationShell::Exec( SfxRequest &rReq )
{
//TODO: clean this up!!!!
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
@@ -269,7 +270,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
}
case FN_FORMAT_RESET:
{
- pPostItMgr->GetActivePostIt()->ResetAttributes();
+ pPostItMgr->GetActiveSidebarWin()->ResetAttributes();
rReq.Done();
break;
}
@@ -320,7 +321,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
aSel.nEndPos++;
pOLV->SetSelection(aSel);
}
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
}
break;
@@ -350,7 +351,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
}
case SID_CHARMAP:
{
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
InsertSymbol(rReq);
break;
}
@@ -359,7 +360,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
const SfxPoolItem* pItem = 0;
if(pNewAttrs)
pNewAttrs->GetItemState(nSlot, FALSE, &pItem );
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue());
break;
}
@@ -577,10 +578,10 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
//SID_ATTR_PARA_ADJUST_BLOCK
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxWhichIter aIter(rSet);
@@ -764,7 +765,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
if(nEEWhich)
rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
- if (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
nWhich = aIter.NextWhich();
@@ -784,19 +785,19 @@ void SwAnnotationShell::StateSearch(SfxItemSet &rSet)
void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
- long aOldHeight = pPostItMgr->GetActivePostIt()->GetPostItTextHeight();
+ long aOldHeight = pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight();
sal_uInt16 nSlot = rReq.GetSlot();
switch (nSlot)
{
case SID_CUT:
- if ( (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
+ if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
pOLV->Cut();
break;
case SID_COPY:
@@ -804,12 +805,12 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
pOLV->Copy();
break;
case SID_PASTE:
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
pOLV->Paste();
break;
case SID_PASTE_SPECIAL:
{
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( &rView.GetEditWin() );
@@ -852,19 +853,19 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
break;
}
}
- pPostItMgr->GetActivePostIt()->ResizeIfNeccessary(aOldHeight,pPostItMgr->GetActivePostIt()->GetPostItTextHeight());
+ pPostItMgr->GetActiveSidebarWin()->ResizeIfNeccessary(aOldHeight,pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight());
}
void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) );
bool bPastePossible = ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) || aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
- bPastePossible = bPastePossible && (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED);
+ bPastePossible = bPastePossible && (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED);
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
@@ -875,7 +876,7 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet)
{
case SID_CUT:
{
- if ( (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED) || !pOLV->HasSelection() )
+ if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) || !pOLV->HasSelection() )
rSet.DisableItem( nWhich );
}
case SID_COPY:
@@ -939,10 +940,10 @@ void SwAnnotationShell::StateStatusLine(SfxItemSet &rSet)
void SwAnnotationShell::StateInsert(SfxItemSet &rSet)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
@@ -985,7 +986,7 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet)
break;
}
- if (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
nWhich = aIter.NextWhich();
@@ -1006,8 +1007,8 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq)
case FN_POSTIT:
case FN_DELETE_COMMENT:
case FN_DELETE_NOTE:
- if ( pPostItMgr->GetActivePostIt() )
- pPostItMgr->GetActivePostIt()->ExecuteCommand(nSlot);
+ if ( pPostItMgr->HasActiveSidebarWin() )
+ pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
break;
case FN_DELETE_ALL_NOTES:
pPostItMgr->Delete();
@@ -1021,7 +1022,7 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq)
}
case FN_HIDE_NOTE:
/*
- if ( Mgr()->GetActivePostIt() == this )
+ if ( Mgr()->GetActiveSidebarWin() == this )
{
Mgr()->SetActivePostIt(0);
// put the cursor back into the document
@@ -1060,20 +1061,29 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
case FN_HIDE_NOTE_AUTHOR:
case FN_HIDE_ALL_NOTES:
{
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() || !pPostItMgr->GetActivePostIt()->ISA(SwPostIt))
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveAnnotationWin() )
+ {
rSet.DisableItem(nWhich);
+ }
break;
}
case FN_DELETE_COMMENT:
{
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() ) //|| !pPostItMgr->GetActivePostIt()->ISA(SwRedComment))
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveSidebarWin() /*HasActiveRedCommentWin()*/ )
+ {
rSet.DisableItem(nWhich);
+ }
break;
}
case FN_REPLY:
{
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() || !pPostItMgr->GetActivePostIt()->ISA(SwPostIt))
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveAnnotationWin() )
+ {
rSet.DisableItem(nWhich);
+ }
else
{
SvtUserOptions aUserOpt;
@@ -1081,7 +1091,7 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
if( !(sAuthor = aUserOpt.GetFullName()).Len())
if( !(sAuthor = aUserOpt.GetID()).Len() )
sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
- if (sAuthor == pPostItMgr->GetActivePostIt()->GetAuthor())
+ if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor())
rSet.DisableItem(nWhich);
}
break;
@@ -1091,9 +1101,9 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
break;
}
- if (pPostItMgr->GetActivePostIt())
+ if (pPostItMgr->HasActiveSidebarWin())
{
- if ( (pPostItMgr->GetActivePostIt()->IsProtected()) &&
+ if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) &&
( (nSlotId==FN_DELETE_NOTE) || (nSlotId==FN_REPLY) ) )
rSet.DisableItem( nWhich );
}
@@ -1104,10 +1114,10 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
void SwAnnotationShell::ExecLingu(SfxRequest &rReq)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
sal_uInt16 nSlot = rReq.GetSlot();
SwWrtShell &rSh = rView.GetWrtShell();
@@ -1219,10 +1229,10 @@ void SwAnnotationShell::ExecLingu(SfxRequest &rReq)
void SwAnnotationShell::GetLinguState(SfxItemSet &rSet)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxWhichIter aIter(rSet);
@@ -1264,7 +1274,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet)
break;
}
- if (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
nWhich = aIter.NextWhich();
@@ -1274,10 +1284,10 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet)
void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
using namespace ::com::sun::star::i18n;
{
@@ -1321,7 +1331,9 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
SfxUndoManager* pUndoManager = GetUndoManager();
SwWrtShell &rSh = rView.GetWrtShell();
- long aOldHeight = rView.GetPostItMgr()->GetActivePostIt() ? rView.GetPostItMgr()->GetActivePostIt()->GetPostItTextHeight() : 0;
+ long aOldHeight = rView.GetPostItMgr()->HasActiveSidebarWin()
+ ? rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight()
+ : 0;
USHORT nId = rReq.GetSlot();
sal_uInt16 nCnt = 1;
@@ -1381,14 +1393,14 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
- if (rView.GetPostItMgr()->GetActivePostIt())
- rView.GetPostItMgr()->GetActivePostIt()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActivePostIt()->GetPostItTextHeight());
+ if (rView.GetPostItMgr()->HasActiveSidebarWin())
+ rView.GetPostItMgr()->GetActiveSidebarWin()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight());
}
void SwAnnotationShell::StateUndo(SfxItemSet &rSet)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
SfxWhichIter aIter(rSet);
@@ -1477,7 +1489,7 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet)
}
- if (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
nWhich = aIter.NextWhich();
@@ -1498,10 +1510,10 @@ void SwAnnotationShell::StateDisableItems( SfxItemSet &rSet )
void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
const SfxItemSet *pArgs = rReq.GetArgs();
const SfxPoolItem* pItem = 0;
diff --git a/sw/source/ui/shells/textdrw.cxx b/sw/source/ui/shells/textdrw.cxx
index 5c6d043e0e01..e4d1bc817940 100644
--- a/sw/source/ui/shells/textdrw.cxx
+++ b/sw/source/ui/shells/textdrw.cxx
@@ -133,7 +133,6 @@ void SwBaseShell::InsertURLButton(const String& rURL, const String& rTarget, con
if (rSh.IsObjSelected())
{
-// rSh.ChgAnchor(FLY_AT_CNTNT);
rSh.UnSelectFrm();
}
}
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
index a5093e8efcdd..3f26e47c8823 100644
--- a/sw/source/ui/shells/textfld.cxx
+++ b/sw/source/ui/shells/textfld.cxx
@@ -80,8 +80,7 @@
#include <app.hrc>
-#include "PostItMgr.hxx"
-#include "postit.hxx"
+#include <PostItMgr.hxx>
using namespace nsSwDocInfoSubType;
@@ -315,8 +314,11 @@ void SwTextShell::ExecField(SfxRequest &rReq)
}
break;
case FN_DELETE_NOTE:
- if ( GetView().GetPostItMgr() && GetView().GetPostItMgr()->GetActivePostIt() )
- GetView().GetPostItMgr()->GetActivePostIt()->Delete();
+ if ( GetView().GetPostItMgr() &&
+ GetView().GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ GetView().GetPostItMgr()->DeleteActiveSidebarWin();
+ }
break;
case FN_DELETE_ALL_NOTES:
if ( GetView().GetPostItMgr() )
@@ -330,8 +332,11 @@ void SwTextShell::ExecField(SfxRequest &rReq)
}
break;
case FN_HIDE_NOTE:
- if ( GetView().GetPostItMgr() && GetView().GetPostItMgr()->GetActivePostIt() )
- GetView().GetPostItMgr()->GetActivePostIt()->Hide();
+ if ( GetView().GetPostItMgr() &&
+ GetView().GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ GetView().GetPostItMgr()->HideActiveSidebarWin();
+ }
break;
case FN_HIDE_ALL_NOTES:
if ( GetView().GetPostItMgr() )
@@ -627,7 +632,7 @@ void SwTextShell::StateField( SfxItemSet &rSet )
SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
if ( !pPostItMgr )
rSet.InvalidateItem( nWhich );
- else if ( !pPostItMgr->GetActivePostIt() )
+ else if ( !pPostItMgr->HasActiveSidebarWin() )
{
rSet.InvalidateItem( FN_DELETE_NOTE );
rSet.InvalidateItem( FN_HIDE_NOTE );
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 2717af61e8df..4396ff03807c 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -212,7 +212,7 @@ void SwView::GotFocus() const
SwAnnotationShell* pAsAnnotationShell = PTR_CAST( SwAnnotationShell, pTopShell );
if ( pAsAnnotationShell )
{
- mpPostItMgr->SetActivePostIt(0);
+ mpPostItMgr->SetActiveSidebarWin(0);
const_cast< SwView* >( this )->AttrChangedNotify( pWrtShell );
}
}
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 1be7cebbb2f9..e19e06916145 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -125,7 +125,6 @@
#include <dbmgr.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
#include <ndtxt.hxx> //#outline level,added by zhaojianwei
@@ -1760,8 +1759,10 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq)
break;
case SID_ATTR_INSERT:
SwPostItMgr* pMgr = GetPostItMgr();
- if (pMgr && pMgr->GetActivePostIt())
- pMgr->GetActivePostIt()->ToggleInsMode();
+ if ( pMgr && pMgr->HasActiveSidebarWin() )
+ {
+ pMgr->ToggleInsModeOnActiveSidebarWin();
+ }
else
rSh.ToggleInsMode();
bUp = TRUE;
@@ -1776,9 +1777,6 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq)
}
}
-
-
-
void SwView::InsFrmMode(USHORT nCols)
{
if ( pWrtShell->HasWholeTabSelection() )
diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx
index d3c5d54d8743..9dfa8e79ecfa 100644
--- a/sw/source/ui/uiview/viewmdi.cxx
+++ b/sw/source/ui/uiview/viewmdi.cxx
@@ -82,7 +82,6 @@
#include <IDocumentSettingAccess.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
USHORT SwView::nMoveType = NID_PGE;
sal_Int32 SwView::nActMark = 0;
@@ -241,12 +240,12 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
if( bUnLockView )
pWrtShell->LockView( FALSE );
- if ( mpPostItMgr )
- {
- mpPostItMgr->Rescale();
- mpPostItMgr->CalcRects();
- mpPostItMgr->LayoutPostIts();
- }
+// if ( mpPostItMgr )
+// {
+// mpPostItMgr->Rescale();
+// mpPostItMgr->CalcRects();
+// mpPostItMgr->LayoutPostIts();
+// }
// eZoom = eZoomType;
}
@@ -489,15 +488,15 @@ IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
break;
case NID_POSTIT:
{
- SwMarginWin* pPostIt = pThis->GetPostItMgr()->GetActivePostIt();
+ sw::sidebarwindows::SwSidebarWin* pPostIt = pThis->GetPostItMgr()->GetActiveSidebarWin();
if (pPostIt)
- pThis->GetPostItMgr()->SetActivePostIt(0);
+ pThis->GetPostItMgr()->SetActiveSidebarWin(0);
SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
if (rSh.MoveFldType(pFldType, bNext))
pThis->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
else
//first/last item
- pThis->GetPostItMgr()->SetActivePostIt(pPostIt);
+ pThis->GetPostItMgr()->SetActiveSidebarWin(pPostIt);
}
break;
case NID_SRCH_REP:
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index b12fc6280cc9..57c7bd20623c 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -602,7 +602,7 @@ void SwView::Replace()
}
else
{
- if (GetPostItMgr()->GetActivePostIt())
+ if (GetPostItMgr()->HasActiveSidebarWin())
GetPostItMgr()->Replace(pSrchItem);
sal_Bool bReplaced = pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(),
pSrchItem->GetRegExp());
diff --git a/sw/source/ui/utlui/attrdesc.cxx b/sw/source/ui/utlui/attrdesc.cxx
index 06c1a580a73f..418ea4a4559b 100644
--- a/sw/source/ui/utlui/attrdesc.cxx
+++ b/sw/source/ui/utlui/attrdesc.cxx
@@ -683,13 +683,13 @@ SfxItemPresentation SwFmtAnchor::GetPresentation
switch ( GetAnchorId() )
{
case FLY_AT_PARA:
- nId = STR_FLY_AT_CNTNT;
+ nId = STR_FLY_AT_PARA;
break;
case FLY_AS_CHAR:
- nId = STR_FLY_IN_CNTNT;
+ nId = STR_FLY_AS_CHAR;
break;
case FLY_AT_PAGE:
- nId = STR_FLY_PAGE;
+ nId = STR_FLY_AT_PAGE;
break;
default:;//prevent warning
}
diff --git a/sw/source/ui/utlui/attrdesc.hrc b/sw/source/ui/utlui/attrdesc.hrc
index a750750566f3..1f2c5d34fa37 100644
--- a/sw/source/ui/utlui/attrdesc.hrc
+++ b/sw/source/ui/utlui/attrdesc.hrc
@@ -55,9 +55,9 @@
#define STR_FRM_WIDTH (RC_ATTR_BEGIN + 23)
#define STR_FRM_FIXEDHEIGHT (RC_ATTR_BEGIN + 24)
#define STR_FRM_MINHEIGHT (RC_ATTR_BEGIN + 25)
-#define STR_FLY_AT_CNTNT (RC_ATTR_BEGIN + 26)
-#define STR_FLY_IN_CNTNT (RC_ATTR_BEGIN + 27)
-#define STR_FLY_PAGE (RC_ATTR_BEGIN + 28)
+#define STR_FLY_AT_PARA (RC_ATTR_BEGIN + 26)
+#define STR_FLY_AS_CHAR (RC_ATTR_BEGIN + 27)
+#define STR_FLY_AT_PAGE (RC_ATTR_BEGIN + 28)
#define STR_POS_X (RC_ATTR_BEGIN + 29)
#define STR_POS_Y (RC_ATTR_BEGIN + 30)
#define STR_VERT_TOP (RC_ATTR_BEGIN + 31)
diff --git a/sw/source/ui/utlui/attrdesc.src b/sw/source/ui/utlui/attrdesc.src
index f1602efcacd8..809af110da6f 100644
--- a/sw/source/ui/utlui/attrdesc.src
+++ b/sw/source/ui/utlui/attrdesc.src
@@ -148,15 +148,15 @@ String STR_FRM_MINHEIGHT
/* ### ACHTUNG: Neuer Text in Resource? min. Höhe: : min. H÷he: */
Text [ en-US ] = "Min. height:" ;
};
-String STR_FLY_AT_CNTNT
+String STR_FLY_AT_PARA
{
Text [ en-US ] = "to paragraph" ;
};
-String STR_FLY_IN_CNTNT
+String STR_FLY_AS_CHAR
{
Text [ en-US ] = "to character" ;
};
-String STR_FLY_PAGE
+String STR_FLY_AT_PAGE
{
Text [ en-US ] = "to page" ;
};
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 141b82f6ea26..0b0bca564f48 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -106,7 +106,6 @@
#include <swundo.hxx>
#include <ndtxt.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
#include <postithelper.hxx>
#include <redline.hxx>
#include <docary.hxx>
@@ -2671,7 +2670,7 @@ void SwContentTree::ExcecuteContextMenuAction( USHORT nSelectedPopupEntry )
break;
case 602:
{
- pActiveShell->GetView().GetPostItMgr()->SetActivePostIt(0);
+ pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0);
pActiveShell->GetView().GetPostItMgr()->Delete();
break;
}
@@ -2933,7 +2932,7 @@ void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode)
{
if (((SwPostItContent*)pCnt)->IsPostIt())
{
- pActiveShell->GetView().GetPostItMgr()->SetActivePostIt(0);
+ pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0);
pActiveShell->DelRight();
}
/*
@@ -3141,7 +3140,7 @@ void SwContentTree::GotoContent(SwContent* pCnt)
}
SwView& rView = pActiveShell->GetView();
rView.StopShellTimer();
- rView.GetPostItMgr()->SetActivePostIt(0);
+ rView.GetPostItMgr()->SetActiveSidebarWin(0);
rView.GetEditWin().GrabFocus();
}
/*-----------------06.02.97 19.14-------------------
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index 57e76a9cff61..c7cb89bf5e61 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -1476,7 +1476,7 @@ SelectionType SwWrtShell::GetSelectionType() const
// return nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS;
SwView &_rView = ((SwView&)GetView());
- if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->GetActivePostIt() )
+ if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
return nsSelectionType::SEL_POSTIT;
int nCnt;
@@ -1808,7 +1808,7 @@ BOOL SwWrtShell::Pop( BOOL bOldCrsr )
--------------------------------------------------------------------*/
BOOL SwWrtShell::CanInsert()
{
- return (!(IsSelFrmMode() | IsObjSelected() | (GetView().GetDrawFuncPtr() != NULL) | (GetView().GetPostItMgr()->GetActivePostIt()!= NULL)));
+ return (!(IsSelFrmMode() | IsObjSelected() | (GetView().GetDrawFuncPtr() != NULL) | (GetView().GetPostItMgr()->GetActiveSidebarWin()!= NULL)));
}
// die Core erzeugt eine Selektion, das SttSelect muss gerufen werden
diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk
index 557e871a74e7..8f74c982486f 100644
--- a/sw/util/makefile.mk
+++ b/sw/util/makefile.mk
@@ -44,7 +44,7 @@ sw_res_files= \
$(SRS)$/dialog.srs \
$(SRS)$/chrdlg.srs \
$(SRS)$/config.srs \
- $(SRS)$/dbui.srs \
+ $(SRS)$/dbui.srs \
$(SRS)$/dochdl.srs \
$(SRS)$/docvw.srs \
$(SRS)$/envelp.srs \
@@ -60,7 +60,7 @@ sw_res_files= \
$(SRS)$/smartmenu.srs \
$(SRS)$/table.srs \
$(SRS)$/uiview.srs \
- $(SRS)$/undo.srs \
+ $(SRS)$/undo.srs \
$(SRS)$/unocore.srs \
$(SRS)$/utlui.srs \
$(SRS)$/web.srs \