[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/inc sw/Library_sw.mk sw/source writerfilter/source xmloff/inc xmloff/source
Oliver-Rainer Wittmann
orw at apache.org
Thu Dec 19 12:08:09 PST 2013
sw/Library_sw.mk | 2
sw/inc/IDocumentMarkAccess.hxx | 31 +
sw/inc/SidebarWin.hxx | 46 +-
sw/inc/doc.hxx | 14
sw/inc/docufld.hxx | 22 -
sw/inc/hintids.hxx | 2
sw/inc/ndhints.hxx | 25 -
sw/inc/postithelper.hxx | 75 +++-
sw/inc/txatbase.hxx | 1
sw/inc/txtannotationfld.hxx | 45 ++
sw/inc/unobookmark.hxx | 4
sw/inc/unofield.hxx | 6
sw/inc/unoport.hxx | 4
sw/source/core/access/accpara.cxx | 8
sw/source/core/bastyp/init.cxx | 4
sw/source/core/crsr/annotationmark.cxx | 118 +++++++
sw/source/core/crsr/bookmrk.cxx | 1
sw/source/core/crsr/findtxt.cxx | 17 -
sw/source/core/doc/dbgoutsw.cxx | 2
sw/source/core/doc/docbm.cxx | 353 ++++++++++++++--------
sw/source/core/doc/doccomp.cxx | 7
sw/source/core/doc/doccorr.cxx | 4
sw/source/core/doc/docdde.cxx | 12
sw/source/core/doc/docedt.cxx | 24 -
sw/source/core/doc/docfld.cxx | 12
sw/source/core/doc/docfmt.cxx | 8
sw/source/core/doc/doclay.cxx | 10
sw/source/core/doc/tblcpy.cxx | 2
sw/source/core/doc/tblrwcl.cxx | 2
sw/source/core/docnode/ndcopy.cxx | 53 ++-
sw/source/core/docnode/nodes.cxx | 27 -
sw/source/core/docnode/section.cxx | 2
sw/source/core/edit/edfld.cxx | 2
sw/source/core/edit/edlingu.cxx | 1
sw/source/core/fields/docufld.cxx | 11
sw/source/core/fields/postithelper.cxx | 108 +++---
sw/source/core/fields/reffld.cxx | 7
sw/source/core/frmedt/fefly1.cxx | 5
sw/source/core/inc/MarkManager.hxx | 35 +-
sw/source/core/inc/UndoDelete.hxx | 6
sw/source/core/inc/annotationmark.hxx | 47 ++
sw/source/core/inc/crossrefbookmark.hxx | 2
sw/source/core/table/swtable.cxx | 4
sw/source/core/text/inftxt.cxx | 27 -
sw/source/core/text/itratr.cxx | 32 +
sw/source/core/text/pormulti.cxx | 4
sw/source/core/text/portxt.cxx | 2
sw/source/core/text/txtfld.cxx | 1
sw/source/core/text/txtfrm.cxx | 49 +--
sw/source/core/txtnode/atrfld.cxx | 59 +++
sw/source/core/txtnode/atrftn.cxx | 6
sw/source/core/txtnode/ndtxt.cxx | 96 +++--
sw/source/core/txtnode/thints.cxx | 63 ++-
sw/source/core/txtnode/txtatr2.cxx | 4
sw/source/core/undo/rolbck.cxx | 19 -
sw/source/core/undo/unattr.cxx | 2
sw/source/core/undo/unbkmk.cxx | 7
sw/source/core/undo/undel.cxx | 31 +
sw/source/core/undo/undobj.cxx | 131 ++++----
sw/source/core/unocore/unobkm.cxx | 40 +-
sw/source/core/unocore/unofield.cxx | 214 ++++++++-----
sw/source/core/unocore/unoport.cxx | 29 +
sw/source/core/unocore/unoportenum.cxx | 300 +++++++++++++-----
sw/source/core/view/vprint.cxx | 5
sw/source/filter/ascii/ascatr.cxx | 1
sw/source/filter/html/css1atr.cxx | 2
sw/source/filter/html/htmlatr.cxx | 18 -
sw/source/filter/html/htmlgrin.cxx | 21 -
sw/source/filter/html/swhtml.cxx | 3
sw/source/filter/html/wrthtml.cxx | 21 -
sw/source/filter/writer/writer.cxx | 8
sw/source/filter/ww1/fltshell.cxx | 15
sw/source/filter/ww8/attributeoutputbase.hxx | 2
sw/source/filter/ww8/wrtw8nds.cxx | 11
sw/source/filter/ww8/ww8atr.cxx | 3
sw/source/filter/ww8/ww8par.cxx | 23 +
sw/source/ui/dialog/uiregionsw.cxx | 4
sw/source/ui/dochdl/swdtflvr.cxx | 8
sw/source/ui/docvw/AnnotationWin.cxx | 10
sw/source/ui/docvw/OverlayRanges.cxx | 190 +++++++++++
sw/source/ui/docvw/OverlayRanges.hxx | 86 +++++
sw/source/ui/docvw/PostItMgr.cxx | 121 +++----
sw/source/ui/docvw/SidebarWin.cxx | 113 ++++++-
sw/source/ui/fldui/fldmgr.cxx | 222 +++++++------
sw/source/ui/fldui/fldref.cxx | 6
sw/source/ui/inc/fldmgr.hxx | 4
sw/source/ui/inc/wrtsh.hxx | 4
sw/source/ui/shells/textfld.cxx | 7
sw/source/ui/uiview/view2.cxx | 4
sw/source/ui/uiview/viewmdi.cxx | 4
sw/source/ui/utlui/bookctrl.cxx | 2
sw/source/ui/utlui/content.cxx | 8
sw/source/ui/utlui/navipi.cxx | 4
sw/source/ui/wrtsh/wrtsh2.cxx | 43 +-
sw/source/ui/wrtsh/wrtsh3.cxx | 2
writerfilter/source/dmapper/DomainMapper.cxx | 4
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 69 ++--
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 11
writerfilter/source/dmapper/PropertyMap.cxx | 31 +
xmloff/inc/txtfldi.hxx | 6
xmloff/source/text/txtfldi.cxx | 107 ++----
xmloff/source/text/txtparae.cxx | 80 ++--
102 files changed, 2361 insertions(+), 1209 deletions(-)
New commits:
commit ebd2922ebd3cf2d3899fb80780d38f367197aadf
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Dec 19 18:50:58 2013 +0000
123792: complete annotations on text ranges feature
- rely annotations on text ranges on new annotation marks
- support arbitrary text ranges for annotations
- fix undo/redo regarding annotations an text ranges
- support annotations on overlapping text ranges
- fix *.docx import for annotations on overlapping text ranges
- fix ODF import of annotations on text ranges
cherry-picked from branch ooxml-osba
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 8adedd7..ebda1cb 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -130,6 +130,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/core/bastyp/swregion \
sw/source/core/bastyp/swtypes \
sw/source/core/bastyp/tabcol \
+ sw/source/core/crsr/annotationmark \
sw/source/core/crsr/BlockCursor \
sw/source/core/crsr/bookmrk \
sw/source/core/crsr/callnk \
@@ -576,6 +577,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/ui/docvw/AnchorOverlayObject \
sw/source/ui/docvw/AnnotationMenuButton \
sw/source/ui/docvw/AnnotationWin \
+ sw/source/ui/docvw/OverlayRanges \
sw/source/ui/docvw/PostItMgr \
sw/source/ui/docvw/ShadowOverlayObject \
sw/source/ui/docvw/SidebarTxtControl \
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 78052dc..d263d0e 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -50,6 +50,7 @@ class IDocumentMarkAccess
BOOKMARK,
CROSSREF_HEADING_BOOKMARK,
CROSSREF_NUMITEM_BOOKMARK,
+ ANNOTATIONMARK,
TEXT_FIELDMARK,
CHECKBOX_FIELDMARK,
NAVIGATOR_REMINDER
@@ -86,6 +87,10 @@ class IDocumentMarkAccess
const rtl::OUString& rName,
const rtl::OUString& rType) = 0;
+ virtual sw::mark::IMark* makeAnnotationMark(
+ const SwPaM& rPaM,
+ const ::rtl::OUString& rName ) = 0;
+
/** Returns a mark in the document for a paragraph.
If there is none, a mark will be created.
@@ -159,6 +164,9 @@ class IDocumentMarkAccess
const xub_StrLen nOffset) =0;
/** Deletes marks in a range
+
+ Note: navigator reminders are excluded
+
*/
virtual void deleteMarks(
const SwNodeIndex& rStt,
@@ -187,15 +195,17 @@ class IDocumentMarkAccess
/** returns a STL-like random access iterator to the begin of the sequence of marks.
*/
- virtual const_iterator_t getMarksBegin() const =0;
+ virtual const_iterator_t getAllMarksBegin() const =0;
/** returns a STL-like random access iterator to the end of the sequence of marks.
*/
- virtual const_iterator_t getMarksEnd() const =0;
+ virtual const_iterator_t getAllMarksEnd() const =0;
/** returns the number of marks.
+
+ Note: annotation marks are excluded
*/
- virtual sal_Int32 getMarksCount() const =0;
+ virtual sal_Int32 getAllMarksCount() const =0;
/** Finds a mark by name.
@@ -203,12 +213,12 @@ class IDocumentMarkAccess
[in] the name of the mark to find.
@returns
- an iterator pointing to the mark, or pointing to getMarksEnd() if nothing was found.
+ an iterator pointing to the mark, or pointing to getAllMarksEnd() if nothing was found.
*/
virtual const_iterator_t findMark(const ::rtl::OUString& rMark) const =0;
- // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK)
+ // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK )
/** returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
*/
@@ -238,6 +248,17 @@ class IDocumentMarkAccess
virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0;
virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0;
+ // Marks exclusive annotation marks
+ virtual const_iterator_t getCommonMarksBegin() const = 0;
+ virtual const_iterator_t getCommonMarksEnd() const = 0;
+ virtual sal_Int32 getCommonMarksCount() const = 0;
+
+ // Annotation Marks
+ virtual const_iterator_t getAnnotationMarksBegin() const = 0;
+ virtual const_iterator_t getAnnotationMarksEnd() const = 0;
+ virtual sal_Int32 getAnnotationMarksCount() const = 0;
+ virtual const_iterator_t findAnnotationMark( const ::rtl::OUString& rName ) const = 0;
+
// Returns the MarkType used to create the mark
static MarkType SAL_DLLPUBLIC_EXPORT GetType(const ::sw::mark::IMark& rMark);
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
index 4e2f05f..66806d6 100644
--- a/sw/inc/SidebarWin.hxx
+++ b/sw/inc/SidebarWin.hxx
@@ -46,9 +46,11 @@ class SwEditWin;
class SwView;
class Edit;
class MenuButton;
-//class SwRedline;
class SwFrm;
+namespace sw { namespace overlay {
+ class OverlayRanges;
+}}
namespace sw { namespace sidebarwindows {
@@ -76,7 +78,7 @@ class SwSidebarWin : public Window
long nY,
long nWidth,
long nHeight,
- const SwRect &aRect,
+ const SwRect& aAnchorRect,
const long PageBorder);
void SetPosAndSize();
void TranslateTopPosition(const long aAmount);
@@ -91,6 +93,7 @@ class SwSidebarWin : public Window
inline ScrollBar* Scrollbar() { return mpVScrollbar; }
inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
+ inline ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay;}
long GetPostItTextHeight();
@@ -127,14 +130,20 @@ class SwSidebarWin : public Window
void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
void SetReadonly(sal_Bool bSet);
- sal_Bool IsReadOnly() { return mbReadonly;}
- bool IsPreview() { return nFlags & PB_Preview;}
-
- void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
+ sal_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 Rescale();
void SetViewState(::sw::sidebarwindows::ViewState bViewState);
@@ -142,18 +151,15 @@ class SwSidebarWin : public Window
void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
virtual bool CalcFollow() = 0;
-#if 0
-#endif
-
- sal_Int32 GetMetaHeight();
- sal_Int32 GetMinimumSizeWithMeta();
- sal_Int32 GetMinimumSizeWithoutMeta();
- sal_Int32 GetMetaButtonAreaWidth();
- sal_Int32 GetScrollbarWidth();
+ sal_Int32 GetMetaHeight();
+ sal_Int32 GetMinimumSizeWithMeta();
+ sal_Int32 GetMinimumSizeWithoutMeta();
+ sal_Int32 GetMetaButtonAreaWidth();
+ sal_Int32 GetScrollbarWidth();
- void SetSpellChecking();
+ void SetSpellChecking();
- void ToggleInsMode();
+ void ToggleInsMode();
virtual void ActivatePostIt();
virtual void DeactivatePostIt();
@@ -163,7 +169,10 @@ class SwSidebarWin : public Window
SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
Color GetChangeColor() { return mChangeColor; }
- virtual bool IsProtected() {return mbReadonly;};
+ virtual bool IsProtected()
+ {
+ return mbReadonly;
+ }
DECL_LINK( WindowEventListener, VclSimpleEvent* );
inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
@@ -213,6 +222,7 @@ class SwSidebarWin : public Window
sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
sw::sidebarwindows::ShadowOverlayObject* mpShadow;
+ sw::overlay::OverlayRanges* mpTextRangeOverlay;
Color mColorAnchor;
Color mColorDark;
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index d96c983..3f67f86 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1108,12 +1108,14 @@ public:
const SwSelBoxes* pSelBoxes = 0,
SwFrmFmt *pParent = 0 );
- void CopyWithFlyInFly( const SwNodeRange& rRg,
- const xub_StrLen nEndContentIndex,
- const SwNodeIndex& rInsPos,
- sal_Bool bMakeNewFrms = sal_True,
- sal_Bool bDelRedlines = sal_True,
- sal_Bool bCopyFlyAtFly = sal_False ) const;
+ void CopyWithFlyInFly(
+ const SwNodeRange& rRg,
+ const xub_StrLen nEndContentIndex,
+ const SwNodeIndex& rInsPos,
+ const SwPaM* pCopiedPaM = NULL,
+ const sal_Bool bMakeNewFrms = sal_True,
+ const sal_Bool bDelRedlines = sal_True,
+ const sal_Bool bCopyFlyAtFly = sal_False ) const;
sal_Bool SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet );
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 2374293..4d07dd0 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -500,12 +500,16 @@ public:
class SwPostItFieldType : public SwFieldType
{
private:
- SwDoc* mpDoc;
+ SwDoc* mpDoc;
public:
SwPostItFieldType(SwDoc* pDoc);
- virtual SwFieldType* Copy() const;
- SwDoc* GetDoc() {return mpDoc;};
+ virtual SwFieldType* Copy() const;
+
+ SwDoc* GetDoc() const
+ {
+ return mpDoc;
+ };
};
@@ -544,13 +548,13 @@ public:
}
// Author
- virtual const String& GetPar1() const;
- virtual void SetPar1(const String& rStr);
+ virtual const String& GetPar1() const;
+ virtual void SetPar1(const String& rStr);
// Text
- virtual String GetPar2() const;
- virtual void SetPar2(const String& rStr);
- inline const String& GetContent() const
+ virtual String GetPar2() const;
+ virtual void SetPar2(const String& rStr);
+ inline const String& GetContent() const
{
return msCommentContent;
}
@@ -559,7 +563,7 @@ public:
void SetName(const String& rStr);
const String& GetName() const;
- const OutlinerParaObject* GetTextObject() const;
+ const OutlinerParaObject* GetTextObject() const;
void SetTextObject( OutlinerParaObject* pText );
sal_uInt32 GetNumberOfParagraphs() const;
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index f5b4ce1..f5fe084 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -141,7 +141,7 @@ RES_TXTATR_NOEND_BEGIN = RES_TXTATR_WITHEND_END,
RES_TXTATR_FIELD = RES_TXTATR_NOEND_BEGIN, // 53
RES_TXTATR_FLYCNT, // 54
RES_TXTATR_FTN, // 55
- RES_TXTATR_DUMMY4, // 56
+ RES_TXTATR_ANNOTATION, // 56
RES_TXTATR_DUMMY3, // 57
RES_TXTATR_DUMMY1, // 58
RES_TXTATR_DUMMY2, // 59
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx
index de110de..26ae87b 100644
--- a/sw/inc/ndhints.hxx
+++ b/sw/inc/ndhints.hxx
@@ -45,17 +45,24 @@ typedef enum {
} CopyOrNew_t;
// if COPY then pTxtNode must be given!
-SW_DLLPRIVATE SwTxtAttr *
-MakeTxtAttr( SwDoc & rDoc, SfxPoolItem & rNew,
- xub_StrLen const nStt, xub_StrLen const nEnd,
- CopyOrNew_t const bIsCopy = NEW, SwTxtNode *const pTxtNode = 0);
-SW_DLLPRIVATE SwTxtAttr *
-MakeTxtAttr( SwDoc & rDoc, const SfxItemSet & rSet,
- xub_StrLen nStt, xub_StrLen nEnd );
+SW_DLLPRIVATE SwTxtAttr * MakeTxtAttr(
+ SwDoc & rDoc,
+ SfxPoolItem & rNew,
+ xub_StrLen const nStt,
+ xub_StrLen const nEnd,
+ CopyOrNew_t const bIsCopy = NEW,
+ SwTxtNode *const pTxtNode = 0 );
+
+SW_DLLPRIVATE SwTxtAttr * MakeTxtAttr(
+ SwDoc & rDoc,
+ const SfxItemSet & rSet,
+ xub_StrLen nStt,
+ xub_StrLen nEnd );
// create redline dummy text hint that must not be inserted into hints array
-SW_DLLPRIVATE SwTxtAttr*
-MakeRedlineTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr );
+SW_DLLPRIVATE SwTxtAttr* MakeRedlineTxtAttr(
+ SwDoc & rDoc,
+ SfxPoolItem& rAttr );
/*
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index ed07f00..fd14653 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -49,15 +49,24 @@ struct SwLayoutInfo
{
const SwFrm* mpAnchorFrm;
SwRect mPosition;
+
+ // optional start of the annotation
+ sal_uLong mnStartNodeIdx;
+ xub_StrLen mnStartContent;
+
SwRect mPageFrame;
SwRect mPagePrtArea;
unsigned long mnPageNumber;
+
sw::sidebarwindows::SidebarPosition meSidebarPosition;
+
sal_uInt16 mRedlineAuthor;
SwLayoutInfo()
: mpAnchorFrm(0)
, mPosition()
+ , mnStartNodeIdx( 0 )
+ , mnStartContent( STRING_NOTFOUND )
, mPageFrame()
, mPagePrtArea()
, mnPageNumber(1)
@@ -73,7 +82,11 @@ namespace SwPostItHelper
INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN
};
- SwLayoutStatus getLayoutInfos( std::vector< SwLayoutInfo >&, SwPosition& );
+ SwLayoutStatus getLayoutInfos(
+ SwLayoutInfo& o_rInfo,
+ const SwPosition& rAnchorPos,
+ const SwPosition* pAnnotationStartPos = NULL );
+
long getLayoutHeight( const SwRootFrm* pRoot );
void setSidebarChanged( SwRootFrm* pRoot, bool bBrowseMode );
unsigned long getPageInfo( SwRect& rPageFrm, const SwRootFrm* , const Point& );
@@ -96,12 +109,17 @@ public:
, bFocus(aFocus)
, mLayoutStatus( SwPostItHelper::INVISIBLE )
, maLayoutInfo()
- {}
- virtual ~SwSidebarItem(){}
+ {
+ }
+
+ virtual ~SwSidebarItem()
+ {
+ }
+
virtual SwPosition GetAnchorPosition() const = 0;
virtual bool UseElement() = 0;
- virtual SwFmtFld* GetFmtFld() const = 0;
- virtual SfxBroadcaster* GetBroadCaster() const = 0;
+ virtual const SwFmtFld& GetFmtFld() const = 0;
+ virtual const SfxBroadcaster* GetBroadCaster() const = 0;
virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
WinBits nBits,
SwPostItMgr& aMgr,
@@ -131,25 +149,38 @@ public:
class SwAnnotationItem: public SwSidebarItem
{
- private:
- SwFmtFld* pFmtFld;
-
- public:
- SwAnnotationItem( SwFmtFld* p,
- const bool aShow,
- const bool aFocus)
- : SwSidebarItem( aShow, aFocus )
- , pFmtFld(p)
- {}
- virtual ~SwAnnotationItem() {}
+public:
+ SwAnnotationItem(
+ SwFmtFld& rFmtFld,
+ const bool bShow,
+ const bool bFocus)
+ : SwSidebarItem( bShow, bFocus )
+ , mrFmtFld( rFmtFld )
+ {
+ }
+
+ virtual ~SwAnnotationItem()
+ {
+ }
+
virtual SwPosition GetAnchorPosition() const;
virtual bool UseElement();
- virtual SwFmtFld* GetFmtFld() const {return pFmtFld;}
- virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pFmtFld); }
- virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
- WinBits nBits,
- SwPostItMgr& aMgr,
- SwPostItBits aBits);
+ virtual const SwFmtFld& GetFmtFld() const
+ {
+ return mrFmtFld;
+ }
+ virtual const SfxBroadcaster* GetBroadCaster() const
+ {
+ return dynamic_cast<const SfxBroadcaster *> (&mrFmtFld);
+ }
+ virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow(
+ SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits );
+
+private:
+ SwFmtFld& mrFmtFld;
};
#endif // _POSTITHELPER_HXX
diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index 1d7fd4b..c67e6e1 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -187,6 +187,7 @@ inline const SwFmtFld& SwTxtAttr::GetFmtFld() const
{
ASSERT( m_pAttr
&& ( m_pAttr->Which() == RES_TXTATR_FIELD
+ || m_pAttr->Which() == RES_TXTATR_ANNOTATION
|| m_pAttr->Which() == RES_TXTATR_INPUTFIELD ),
"Wrong attribute" );
return (const SwFmtFld&)(*m_pAttr);
diff --git a/sw/inc/txtannotationfld.hxx b/sw/inc/txtannotationfld.hxx
new file mode 100755
index 0000000..f7cd9b8
--- /dev/null
+++ b/sw/inc/txtannotationfld.hxx
@@ -0,0 +1,45 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+#ifndef _TXTANNOTATIONFLD_HXX
+#define _TXTANNOTATIONFLD_HXX
+
+#include <txtfld.hxx>
+#include <IMark.hxx>
+
+class SwDoc;
+
+class SwTxtAnnotationFld : public SwTxtFld
+{
+public:
+ SwTxtAnnotationFld(
+ SwFmtFld & rAttr,
+ xub_StrLen const nStart );
+
+ virtual ~SwTxtAnnotationFld();
+
+ ::sw::mark::IMark* GetAnnotationMark(
+ SwDoc* pDoc = NULL ) const;
+};
+
+#endif
+
diff --git a/sw/inc/unobookmark.hxx b/sw/inc/unobookmark.hxx
index 63f8d1c..924d055 100644
--- a/sw/inc/unobookmark.hxx
+++ b/sw/inc/unobookmark.hxx
@@ -88,7 +88,7 @@ public:
/// descriptor
SwXBookmark();
- static ::com::sun::star::uno::Reference<::com::sun::star::text::XTextContent>
+ static ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark);
/// @return IMark for this, but only if it lives in pDoc
@@ -246,7 +246,7 @@ public:
SwXFieldmark( bool isReplacementObject );
// (as the parent class) newly created <SwXFieldmark> instances for an existing <IMark> instance needs to be registered in the Mark
- static ::com::sun::star::uno::Reference<::com::sun::star::text::XTextContent>
+ static ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
CreateXFieldmark(
SwDoc & rDoc,
::sw::mark::IMark & rBookmark );
diff --git a/sw/inc/unofield.hxx b/sw/inc/unofield.hxx
index 13fb148..939ad23 100644
--- a/sw/inc/unofield.hxx
+++ b/sw/inc/unofield.hxx
@@ -129,8 +129,8 @@ class SwXTextField : public cppu::WeakImplHelper5
>,
public SwClient
{
- SwEventListenerContainer aLstnrCntnr;
- const SwFmtFld* pFmtFld;
+ SwEventListenerContainer m_aLstnrCntnr;
+ const SwFmtFld* m_pFmtFld;
SwDoc* m_pDoc;
SwTextAPIObject* m_pTextObject;
@@ -197,7 +197,7 @@ public:
void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
const SwField* GetField() const;
- const SwFmtFld* GetFldFmt(){return GetField() ? pFmtFld : 0; };
+ const SwFmtFld* GetFldFmt(){return GetField() ? m_pFmtFld : 0; };
void Invalidate();
diff --git a/sw/inc/unoport.hxx b/sw/inc/unoport.hxx
index 2923c98..aa66a61 100644
--- a/sw/inc/unoport.hxx
+++ b/sw/inc/unoport.hxx
@@ -81,7 +81,9 @@ enum SwTextPortionType
PORTION_META,
PORTION_FIELD_START,
PORTION_FIELD_END,
- PORTION_FIELD_START_END
+ PORTION_FIELD_START_END,
+ PORTION_ANNOTATION,
+ PORTION_ANNOTATION_END
};
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 5dff84d..cc8d55d 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1650,12 +1650,16 @@ String SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
for( sal_uInt16 i = 0; i < nSize; ++i )
{
const SwTxtAttr* pHt = (*pSwpHints)[i];
- if (pHt->Which() == RES_TXTATR_FIELD && (nFldIndex-- == 0))
+ if ( ( pHt->Which() == RES_TXTATR_FIELD
+ || pHt->Which() == RES_TXTATR_ANNOTATION
+ || pHt->Which() == RES_TXTATR_INPUTFIELD )
+ && (nFldIndex-- == 0))
{
pTxtFld = (SwTxtFld *)pHt;
break;
}
- else if (pHt->Which() == RES_TXTATR_REFMARK && (nFldIndex-- == 0))
+ else if ( pHt->Which() == RES_TXTATR_REFMARK
+ && (nFldIndex-- == 0) )
strTypeName = String(OUString(RTL_CONSTASCII_USTRINGPARAM("set reference")));
}
}
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 31dedef..41ed3b1 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -320,7 +320,7 @@ SfxItemInfo __FAR_DATA aSlotTab[] =
{ 0, 0 }, // RES_TXTATR_FIELD
{ 0, 0 }, // RES_TXTATR_FLYCNT
{ 0, 0 }, // RES_TXTATR_FTN
- { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY4
+ { 0, 0 }, // RES_TXTATR_ANNOTATION
{ 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY3
{ 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY1
{ 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY2
@@ -533,9 +533,9 @@ void _InitCore()
aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld( RES_TXTATR_FIELD );
aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 );
aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn;
+ aAttrTab[ RES_TXTATR_ANNOTATION - POOLATTR_BEGIN ] = new SwFmtFld( RES_TXTATR_ANNOTATION );
// TextAttr - Dummies
- aAttrTab[ RES_TXTATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY4 );
aAttrTab[ RES_TXTATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY3 );
aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 );
aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
diff --git a/sw/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx
new file mode 100755
index 0000000..1c81537
--- /dev/null
+++ b/sw/source/core/crsr/annotationmark.cxx
@@ -0,0 +1,118 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <annotationmark.hxx>
+
+#include <doc.hxx>
+#include <IDocumentMarkAccess.hxx>
+#include <fldbas.hxx>
+#include <switerator.hxx>
+#include <fmtfld.hxx>
+#include <docufld.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <UndoBookmark.hxx>
+#include <ndtxt.hxx>
+#include <txtfld.hxx>
+
+namespace sw { namespace mark
+{
+ AnnotationMark::AnnotationMark(
+ const SwPaM& rPaM,
+ const ::rtl::OUString& rName )
+ : MarkBase( rPaM, rName )
+ {
+ if ( rName.getLength() == 0 )
+ {
+ SetName( MarkBase::GenerateNewName( ::rtl::OUString::createFromAscii("__Annotation__") ) );
+ }
+ }
+
+
+ AnnotationMark::~AnnotationMark()
+ {
+ }
+
+
+ void AnnotationMark::InitDoc(SwDoc* const io_pDoc)
+ {
+ SwTxtFld* pTxtFld =
+ GetMarkEnd().nNode.GetNode().GetTxtNode()->GetFldTxtAttrAt(
+ GetMarkEnd().nContent.GetIndex()-1, true );
+ if ( pTxtFld != NULL )
+ {
+ const SwPostItField* pPostItField = dynamic_cast< const SwPostItField* >(pTxtFld->GetFmtFld().GetField());
+ ASSERT( pPostItField != NULL, "<AnnotationMark::InitDoc(..)> - annotation field missing!" );
+ if ( pPostItField != NULL )
+ {
+ // use the annotation mark's name as the annotation name, if
+ // - the annotation field has an empty annotation name or
+ // - the annotation mark's name differs (on mark creation a name clash had been detected)
+ if ( pPostItField->GetName().Len() == 0
+ || rtl::OUString( pPostItField->GetName() ) != GetName() )
+ {
+ const_cast<SwPostItField*>(pPostItField)->SetName( GetName() );
+ }
+ }
+ }
+
+ if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ io_pDoc->GetIDocumentUndoRedo().AppendUndo( new SwUndoInsBookmark(*this) );
+ }
+ io_pDoc->SetModified();
+ }
+
+
+ const SwFmtFld* AnnotationMark::GetAnnotationFmtFld() const
+ {
+ SwDoc* pDoc = GetMarkPos().GetDoc();
+ if ( pDoc == NULL )
+ {
+ ASSERT( false, "<AnnotationMark::GetAnnotationFmtFld()> - missing document at annotation mark" );
+ return NULL;
+ }
+
+ SwFmtFld* pAnnotationFmtFld = NULL;
+
+ SwFieldType* pType = pDoc->GetFldType( RES_POSTITFLD, String(), false );
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
+ for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld != NULL; pFmtFld = aIter.Next() )
+ {
+ if ( pFmtFld->IsFldInDoc() )
+ {
+ const SwPostItField* pPostItField = dynamic_cast< const SwPostItField* >(pFmtFld->GetField());
+ if ( pPostItField != NULL
+ && rtl::OUString( pPostItField->GetName() ) == GetName() )
+ {
+ pAnnotationFmtFld = pFmtFld;
+ break;
+ }
+ }
+ }
+
+ return pAnnotationFmtFld;
+ }
+}}
+
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index bfe3485..55a483c 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -184,7 +184,6 @@ namespace sw { namespace mark
if(nCount == SAL_MAX_INT32)
{
sal_Int32 nRandom;
- ::rtl::OUStringBuffer sUniquePostfixBuffer;
rtl_random_getBytes(aPool, &nRandom, sizeof(nRandom));
sUniquePostfix = ::rtl::OUStringBuffer(13).appendAscii("_").append(static_cast<sal_Int32>(abs(nRandom))).makeStringAndClear();
nCount = 0;
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index eee2731..f4db117 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -131,14 +131,16 @@ String& lcl_CleanStr(
case RES_TXTATR_FLYCNT:
case RES_TXTATR_FTN:
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
case RES_TXTATR_REFMARK:
case RES_TXTATR_TOXMARK:
case RES_TXTATR_META:
case RES_TXTATR_METAFIELD:
{
- sal_Bool bEmpty = RES_TXTATR_FIELD != pHt->Which() ||
- !(static_cast<SwTxtFld const*>(pHt)
- ->GetFmtFld().GetField()->ExpandField(true).Len());
+ const bool bEmpty =
+ ( pHt->Which() != RES_TXTATR_FIELD
+ && pHt->Which() != RES_TXTATR_ANNOTATION )
+ || !(static_cast<SwTxtFld const*>(pHt)->GetFmtFld().GetField()->ExpandField(true).Len());
if ( bEmpty && nStart == nAkt )
{
rArr.Insert( nAkt, rArr.Count() );
@@ -195,8 +197,7 @@ xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts)
{
aIndex++;
const SwTxtAttr* pTxtAttr = (*pHts)[i];
- if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
- && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+ if ( pTxtAttr->Which() == RES_TXTATR_ANNOTATION )
{
aCount--;
if (!aCount)
@@ -208,8 +209,7 @@ xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts)
for (xub_StrLen i = aIndex; i <pHts->Count();i++)
{
const SwTxtAttr* pTxtAttr = (*pHts)[i];
- if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
- && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+ if ( pTxtAttr->Which() == RES_TXTATR_ANNOTATION )
break;
else
aIndex++;
@@ -303,8 +303,7 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes
{
const xub_StrLen aPos = *(*pHts)[i]->GetStart();
const SwTxtAttr* pTxtAttr = (*pHts)[i];
- if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
- && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+ if ( pTxtAttr->Which()==RES_TXTATR_ANNOTATION )
{
if ( (aPos >= nStart) && (aPos <= nEnde) )
aNumberPostits++;
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 7743f4a..57b7e44 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -178,7 +178,7 @@ map<sal_uInt16,String,CompareUShort> & GetItemWhichMap()
aItemWhichMap[RES_TXTATR_FIELD] = String("TXTATR_FIELD", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_FLYCNT] = String("TXTATR_FLYCNT", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_FTN] = String("TXTATR_FTN", RTL_TEXTENCODING_ASCII_US);
- aItemWhichMap[RES_TXTATR_DUMMY4] = String("TXTATR_DUMMY4", RTL_TEXTENCODING_ASCII_US);
+ aItemWhichMap[RES_TXTATR_ANNOTATION] = String("TXTATR_ANNOTATION", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_DUMMY3] = String("TXTATR_DUMMY3", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_DUMMY1] = String("TXTATR_DUMMY1", RTL_TEXTENCODING_ASCII_US);
aItemWhichMap[RES_TXTATR_DUMMY2] = String("TXTATR_DUMMY2", RTL_TEXTENCODING_ASCII_US);
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 41d790d..fc091af 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -30,6 +30,7 @@
#include <boost/bind.hpp>
#include <cntfrm.hxx>
#include <crossrefbookmark.hxx>
+#include <annotationmark.hxx>
#include <dcontact.hxx>
#include <doc.hxx>
#include <docary.hxx>
@@ -279,6 +280,8 @@ IDocumentMarkAccess::MarkType IDocumentMarkAccess::GetType(const IMark& rBkmk)
return CROSSREF_HEADING_BOOKMARK;
else if(*pMarkTypeInfo == typeid(CrossRefNumItemBookmark))
return CROSSREF_NUMITEM_BOOKMARK;
+ else if(*pMarkTypeInfo == typeid(AnnotationMark))
+ return ANNOTATIONMARK;
else if(*pMarkTypeInfo == typeid(TextFieldmark))
return TEXT_FIELDMARK;
else if(*pMarkTypeInfo == typeid(CheckboxFieldmark))
@@ -317,20 +320,15 @@ bool SAL_DLLPUBLIC_EXPORT IDocumentMarkAccess::IsLegalPaMForCrossRefHeadingBookm
namespace sw { namespace mark
{
MarkManager::MarkManager(SwDoc& rDoc)
- : m_pDoc(&rDoc)
+ : m_vAllMarks()
+ , m_vBookmarks()
+ , m_vFieldmarks()
+ , m_vAnnotationMarks()
+ , m_vCommonMarks()
+ , m_pDoc(&rDoc)
{ }
-#if OSL_DEBUG_LEVEL > 1
- void MarkManager::dumpFieldmarks( ) const
- {
- const_iterator_t pIt = m_vFieldmarks.begin();
- for (; pIt != m_vFieldmarks.end( ); pIt++)
- {
- rtl::OUString str = (*pIt)->ToString();
- OSL_TRACE("%s\n",
- ::rtl::OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr());
- }
- }
-#endif
+
+
::sw::mark::IMark* MarkManager::makeMark(const SwPaM& rPaM,
const ::rtl::OUString& rName,
const IDocumentMarkAccess::MarkType eType)
@@ -351,7 +349,7 @@ namespace sw { namespace mark
}
#endif
// see for example _SaveCntntIdx, Shells
- OSL_PRECOND(m_vMarks.size() < USHRT_MAX,
+ OSL_PRECOND(m_vAllMarks.size() < USHRT_MAX,
"MarkManager::makeMark(..)"
" - more than USHRT_MAX marks are not supported correctly");
// There should only be one CrossRefBookmark per Textnode per Type
@@ -389,6 +387,9 @@ namespace sw { namespace mark
case IDocumentMarkAccess::UNO_BOOKMARK:
pMarkBase = new UnoMark(rPaM);
break;
+ case IDocumentMarkAccess::ANNOTATIONMARK:
+ pMarkBase = new AnnotationMark( rPaM, rName );
+ break;
}
OSL_ENSURE( pMarkBase!=NULL,
"MarkManager::makeMark(..)"
@@ -399,35 +400,41 @@ namespace sw { namespace mark
pMarkBase->Swap();
// for performance reasons, we trust UnoMarks to have a (generated) unique name
- if(eType != IDocumentMarkAccess::UNO_BOOKMARK)
- pMarkBase->SetName(getUniqueMarkName(pMarkBase->GetName()));
+ if ( eType != IDocumentMarkAccess::UNO_BOOKMARK )
+ pMarkBase->SetName( getUniqueMarkName( pMarkBase->GetName() ) );
// register mark
- lcl_InsertMarkSorted(m_vMarks, pMark);
+ lcl_InsertMarkSorted( m_vAllMarks, pMark );
switch(eType)
{
case IDocumentMarkAccess::BOOKMARK:
case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
- // if(dynamic_cast<IBookmark*>)
+ lcl_InsertMarkSorted(m_vCommonMarks, pMark);
+ // if(dynamic_cast<IBookmark*>)
lcl_InsertMarkSorted(m_vBookmarks, pMark);
break;
case IDocumentMarkAccess::TEXT_FIELDMARK:
case IDocumentMarkAccess::CHECKBOX_FIELDMARK:
- // if(dynamic_cast<IFieldmark*>
+ lcl_InsertMarkSorted(m_vCommonMarks, pMark);
+ // if(dynamic_cast<IFieldmark*>
lcl_InsertMarkSorted(m_vFieldmarks, pMark);
break;
+ case IDocumentMarkAccess::ANNOTATIONMARK:
+ lcl_InsertMarkSorted( m_vAnnotationMarks, pMark );
+ break;
case IDocumentMarkAccess::NAVIGATOR_REMINDER:
case IDocumentMarkAccess::DDE_BOOKMARK:
case IDocumentMarkAccess::UNO_BOOKMARK:
- // no special array for these
+ lcl_InsertMarkSorted(m_vCommonMarks, pMark);
+ // no special array for these
break;
}
pMarkBase->InitDoc(m_pDoc);
#if 0
OSL_TRACE("--- makeType ---");
OSL_TRACE("Marks");
- lcl_DebugMarks(m_vMarks);
+ lcl_DebugMarks(m_vAllMarks);
OSL_TRACE("Bookmarks");
lcl_DebugMarks(m_vBookmarks);
OSL_TRACE("Fieldmarks");
@@ -436,7 +443,9 @@ namespace sw { namespace mark
return pMark.get();
}
- ::sw::mark::IFieldmark* MarkManager::makeFieldBookmark( const SwPaM& rPaM,
+
+ ::sw::mark::IFieldmark* MarkManager::makeFieldBookmark(
+ const SwPaM& rPaM,
const rtl::OUString& rName,
const rtl::OUString& rType )
{
@@ -448,7 +457,9 @@ namespace sw { namespace mark
return pFieldMark;
}
- ::sw::mark::IFieldmark* MarkManager::makeNoTextFieldBookmark( const SwPaM& rPaM,
+
+ ::sw::mark::IFieldmark* MarkManager::makeNoTextFieldBookmark(
+ const SwPaM& rPaM,
const rtl::OUString& rName,
const rtl::OUString& rType)
{
@@ -460,8 +471,10 @@ namespace sw { namespace mark
return pFieldMark;
}
- ::sw::mark::IMark* MarkManager::getMarkForTxtNode(const SwTxtNode& rTxtNode,
- const IDocumentMarkAccess::MarkType eType)
+
+ ::sw::mark::IMark* MarkManager::getMarkForTxtNode(
+ const SwTxtNode& rTxtNode,
+ const IDocumentMarkAccess::MarkType eType )
{
SwPosition aPos(rTxtNode);
aPos.nContent.Assign(&(const_cast<SwTxtNode&>(rTxtNode)), 0);
@@ -472,7 +485,16 @@ namespace sw { namespace mark
return makeMark(aPaM, ::rtl::OUString(), eType);
}
- void MarkManager::repositionMark( ::sw::mark::IMark* const io_pMark,
+
+ sw::mark::IMark* MarkManager::makeAnnotationMark(
+ const SwPaM& rPaM,
+ const ::rtl::OUString& rName )
+ {
+ return makeMark( rPaM, rName, IDocumentMarkAccess::ANNOTATIONMARK );
+ }
+
+ void MarkManager::repositionMark(
+ ::sw::mark::IMark* const io_pMark,
const SwPaM& rPaM)
{
OSL_PRECOND(io_pMark->GetMarkPos().GetDoc() == m_pDoc,
@@ -491,37 +513,46 @@ namespace sw { namespace mark
sortMarks();
}
- bool MarkManager::renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName)
+
+ bool MarkManager::renameMark(
+ ::sw::mark::IMark* io_pMark,
+ const ::rtl::OUString& rNewName )
{
OSL_PRECOND(io_pMark->GetMarkPos().GetDoc() == m_pDoc,
"<MarkManager::repositionMark(..)>"
" - Mark is not in my doc.");
- if(io_pMark->GetName() == rNewName)
+ if ( io_pMark->GetName() == rNewName )
return true;
- if(findMark(rNewName) != getMarksEnd())
+ if ( findMark(rNewName) != m_vAllMarks.end() )
return false;
dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)->SetName(rNewName);
return true;
}
- void MarkManager::correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset)
+
+ void MarkManager::correctMarksAbsolute(
+ const SwNodeIndex& rOldNode,
+ const SwPosition& rNewPos,
+ const xub_StrLen nOffset)
{
const SwNode* const pOldNode = &rOldNode.GetNode();
SwPosition aNewPos(rNewPos);
aNewPos.nContent += nOffset;
bool isSortingNeeded = false;
- for(iterator_t ppMark = m_vMarks.begin();
- ppMark != m_vMarks.end();
+
+ for(iterator_t ppMark = m_vAllMarks.begin();
+ ppMark != m_vAllMarks.end();
ppMark++)
{
- // is on position ??
- bool bChangedPos = false, bChangedOPos = false;
::sw::mark::MarkBase* pMark = dynamic_cast< ::sw::mark::MarkBase* >(ppMark->get());
+ // is on position ??
+ bool bChangedPos = false;
if(&pMark->GetMarkPos().nNode.GetNode() == pOldNode)
{
pMark->SetMarkPos(aNewPos);
bChangedPos = true;
}
+ bool bChangedOPos = false;
if (pMark->IsExpanded() &&
&pMark->GetOtherMarkPos().nNode.GetNode() == pOldNode)
{
@@ -531,23 +562,26 @@ namespace sw { namespace mark
// illegal selection? collapse the mark and restore sorting later
isSortingNeeded |= lcl_FixCorrectedMark(bChangedPos, bChangedOPos, pMark);
}
+
// restore sorting if needed
if(isSortingNeeded)
sortMarks();
#if 0
OSL_TRACE("correctMarksAbsolute");
- lcl_DebugMarks(m_vMarks);
+ lcl_DebugMarks(m_vAllMarks);
#endif
}
+
void MarkManager::correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset)
{
const SwNode* const pOldNode = &rOldNode.GetNode();
SwPosition aNewPos(rNewPos);
aNewPos.nContent += nOffset;
bool isSortingNeeded = false;
- for(iterator_t ppMark = m_vMarks.begin();
- ppMark != m_vMarks.end();
+
+ for(iterator_t ppMark = m_vAllMarks.begin();
+ ppMark != m_vAllMarks.end();
ppMark++)
{
// is on position ??
@@ -571,15 +605,17 @@ namespace sw { namespace mark
// illegal selection? collapse the mark and restore sorting later
isSortingNeeded |= lcl_FixCorrectedMark(bChangedPos, bChangedOPos, pMark);
}
+
// restore sorting if needed
if(isSortingNeeded)
sortMarks();
#if 0
OSL_TRACE("correctMarksRelative");
- lcl_DebugMarks(m_vMarks);
+ lcl_DebugMarks(m_vAllMarks);
#endif
}
+
void MarkManager::deleteMarks(
const SwNodeIndex& rStt,
const SwNodeIndex& rEnd,
@@ -589,10 +625,11 @@ namespace sw { namespace mark
{
vector<const_iterator_t> vMarksToDelete;
bool isSortingNeeded = false;
+
// copy all bookmarks in the move area to a vector storing all position data as offset
// reassignment is performed after the move
- for(iterator_t ppMark = m_vMarks.begin();
- ppMark != m_vMarks.end();
+ for(iterator_t ppMark = m_vAllMarks.begin();
+ ppMark != m_vAllMarks.end();
ppMark++)
{
// navigator marks should not be moved
@@ -679,7 +716,7 @@ namespace sw { namespace mark
}
// we just remembered the iterators to delete, so we do not need to search
- // for the shared_ptr<> (the entry in m_vMarks) again
+ // for the shared_ptr<> (the entry in m_vAllMarks) again
// reverse iteration, since erasing an entry invalidates iterators
// behind it (the iterators in vMarksToDelete are sorted)
for(vector<const_iterator_t>::reverse_iterator pppMark = vMarksToDelete.rbegin();
@@ -692,49 +729,69 @@ namespace sw { namespace mark
sortMarks();
#if 0
OSL_TRACE("deleteMarks");
- lcl_DebugMarks(m_vMarks);
+ lcl_DebugMarks(m_vAllMarks);
#endif
}
+
void MarkManager::deleteMark(const const_iterator_t ppMark)
{
- if(ppMark == m_vMarks.end()) return;
+ if(ppMark == m_vAllMarks.end()) return;
switch(IDocumentMarkAccess::GetType(**ppMark))
{
case IDocumentMarkAccess::BOOKMARK:
case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
- // if(dynamic_cast<IBookmark*>)
- {
- IDocumentMarkAccess::iterator_t ppBookmark = lcl_FindMark(m_vBookmarks, *ppMark);
- OSL_ENSURE(ppBookmark != m_vBookmarks.end(),
- "<MarkManager::deleteMark(..)>"
- " - Bookmark not found.");
- m_vBookmarks.erase(ppBookmark);
+ // if(dynamic_cast<IBookmark*>)
+ {
+ IDocumentMarkAccess::iterator_t ppBookmark = lcl_FindMark(m_vBookmarks, *ppMark);
+ OSL_ENSURE(ppBookmark != m_vBookmarks.end(),
+ "<MarkManager::deleteMark(..)>"
+ " - Bookmark not found.");
+ m_vBookmarks.erase(ppBookmark);
+
+ ppBookmark = lcl_FindMark(m_vCommonMarks, *ppMark);
+ m_vCommonMarks.erase(ppBookmark);
+ }
break;
- }
+
case IDocumentMarkAccess::TEXT_FIELDMARK:
case IDocumentMarkAccess::CHECKBOX_FIELDMARK:
- // if(dynamic_cast<IFieldmark*>
- {
- IDocumentMarkAccess::iterator_t ppFieldmark = lcl_FindMark(m_vFieldmarks, *ppMark);
- OSL_ENSURE(ppFieldmark != m_vFieldmarks.end(),
- "<MarkManager::deleteMark(..)>"
- " - Bookmark not found.");
- m_vFieldmarks.erase(ppFieldmark);
-
- sw::mark::TextFieldmark* pTextFieldmark = dynamic_cast<sw::mark::TextFieldmark*>(ppMark->get());
- if ( pTextFieldmark )
+ // if(dynamic_cast<IFieldmark*>
{
- pTextFieldmark->ReleaseDoc(m_pDoc);
+ IDocumentMarkAccess::iterator_t ppFieldmark = lcl_FindMark(m_vFieldmarks, *ppMark);
+ OSL_ENSURE(ppFieldmark != m_vFieldmarks.end(),
+ "<MarkManager::deleteMark(..)>"
+ " - Bookmark not found.");
+ m_vFieldmarks.erase(ppFieldmark);
+
+ sw::mark::TextFieldmark* pTextFieldmark = dynamic_cast<sw::mark::TextFieldmark*>(ppMark->get());
+ if ( pTextFieldmark )
+ {
+ pTextFieldmark->ReleaseDoc(m_pDoc);
+ }
+
+ ppFieldmark = lcl_FindMark(m_vCommonMarks, *ppMark);
+ m_vCommonMarks.erase(ppFieldmark);
}
break;
- }
+
+ case IDocumentMarkAccess::ANNOTATIONMARK:
+ {
+ IDocumentMarkAccess::iterator_t ppAnnotationMark = lcl_FindMark(m_vAnnotationMarks, *ppMark);
+ OSL_ENSURE( ppAnnotationMark != m_vAnnotationMarks.end(), "<MarkManager::deleteMark(..)> - Annotation Mark not found." );
+ m_vAnnotationMarks.erase(ppAnnotationMark);
+ }
+ break;
+
case IDocumentMarkAccess::NAVIGATOR_REMINDER:
case IDocumentMarkAccess::DDE_BOOKMARK:
case IDocumentMarkAccess::UNO_BOOKMARK:
- // no special array for these
+ {
+ IDocumentMarkAccess::iterator_t ppOtherMark = lcl_FindMark(m_vCommonMarks, *ppMark);
+ m_vCommonMarks.erase(ppOtherMark);
+ }
break;
}
DdeBookmark* const pDdeBookmark = dynamic_cast<DdeBookmark*>(ppMark->get());
@@ -747,9 +804,9 @@ namespace sw { namespace mark
// the temporary hold instance assures that the mark is deleted after the
// mark container has been updated. Thus, the mark could not be found anymore
// in the mark container by other calls trying to recursively delete the mark.
- iterator_t aToBeDeletedMarkIter = m_vMarks.begin() + (ppMark - m_vMarks.begin());
+ iterator_t aToBeDeletedMarkIter = m_vAllMarks.begin() + (ppMark - m_vAllMarks.begin());
pMark_t pToBeDeletedMark = *aToBeDeletedMarkIter;
- m_vMarks.erase( aToBeDeletedMarkIter );
+ m_vAllMarks.erase( aToBeDeletedMarkIter );
}
void MarkManager::deleteMark(const IMark* const pMark)
@@ -759,22 +816,18 @@ namespace sw { namespace mark
" - Mark is not in my doc.");
// finds the last Mark that is starting before pMark
// (pMarkLow < pMark)
- iterator_t pMarkLow = lower_bound(
- m_vMarks.begin(), m_vMarks.end(),
- pMark->GetMarkStart(),
- bind(&IMark::StartsBefore, _1, _2));
- // finds the first Mark that pMark is starting before
- // (pMark < pMarkHigh)
- //iterator_t pMarkHigh = upper_bound(
- // pMarkLow, m_vMarks.end(),
- // pMark->GetMarkStart(),
- // bind(&IMark::StartsBefore, _2, _1));
- // since it should be rare that pMark isnt found at all
- // we skip the bisect search on the upper bound
- iterator_t pMarkHigh = m_vMarks.end();
- iterator_t pMarkFound = find_if(
- pMarkLow, pMarkHigh,
- bind(equal_to<const IMark*>(), bind(&boost::shared_ptr<IMark>::get, _1), pMark));
+ iterator_t pMarkLow =
+ lower_bound(
+ m_vAllMarks.begin(),
+ m_vAllMarks.end(),
+ pMark->GetMarkStart(),
+ bind(&IMark::StartsBefore, _1, _2) );
+ iterator_t pMarkHigh = m_vAllMarks.end();
+ iterator_t pMarkFound =
+ find_if(
+ pMarkLow,
+ pMarkHigh,
+ bind(equal_to<const IMark*>(), bind(&boost::shared_ptr<IMark>::get, _1), pMark) );
if(pMarkFound != pMarkHigh)
deleteMark(pMarkFound);
}
@@ -783,20 +836,24 @@ namespace sw { namespace mark
{
m_vFieldmarks.clear();
m_vBookmarks.clear();
+
+ m_vCommonMarks.clear();
+
+ m_vAnnotationMarks.clear();
+
#ifdef DEBUG
- for(iterator_t pBkmk = m_vMarks.begin();
- pBkmk != m_vMarks.end();
+ for(iterator_t pBkmk = m_vAllMarks.begin();
+ pBkmk != m_vAllMarks.end();
++pBkmk)
- OSL_ENSURE(pBkmk->unique(),
- "<MarkManager::clearAllMarks(..)>"
- " - a Bookmark is still in use.");
+ OSL_ENSURE( pBkmk->unique(),
+ "<MarkManager::clearAllMarks(..)> - a Bookmark is still in use.");
#endif
- m_vMarks.clear();
+ m_vAllMarks.clear();
}
IDocumentMarkAccess::const_iterator_t MarkManager::findMark(const ::rtl::OUString& rName) const
{
- return lcl_FindMarkByName(rName, m_vMarks.begin(), m_vMarks.end());
+ return lcl_FindMarkByName(rName, m_vAllMarks.begin(), m_vAllMarks.end());
}
IDocumentMarkAccess::const_iterator_t MarkManager::findBookmark(const ::rtl::OUString& rName) const
@@ -804,14 +861,14 @@ namespace sw { namespace mark
return lcl_FindMarkByName(rName, m_vBookmarks.begin(), m_vBookmarks.end());
}
- IDocumentMarkAccess::const_iterator_t MarkManager::getMarksBegin() const
- { return m_vMarks.begin(); }
+ IDocumentMarkAccess::const_iterator_t MarkManager::getAllMarksBegin() const
+ { return m_vAllMarks.begin(); }
- IDocumentMarkAccess::const_iterator_t MarkManager::getMarksEnd() const
- { return m_vMarks.end(); }
+ IDocumentMarkAccess::const_iterator_t MarkManager::getAllMarksEnd() const
+ { return m_vAllMarks.end(); }
- sal_Int32 MarkManager::getMarksCount() const
- { return m_vMarks.size(); }
+ sal_Int32 MarkManager::getAllMarksCount() const
+ { return m_vAllMarks.size(); }
IDocumentMarkAccess::const_iterator_t MarkManager::getBookmarksBegin() const
{ return m_vBookmarks.begin(); }
@@ -838,28 +895,87 @@ namespace sw { namespace mark
IFieldmark* MarkManager::getFieldmarkBefore(const SwPosition& rPos) const
{ return dynamic_cast<IFieldmark*>(lcl_getMarkBefore(m_vFieldmarks, rPos)); }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::getCommonMarksBegin() const
+ {
+ return m_vCommonMarks.begin();
+ }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::getCommonMarksEnd() const
+ {
+ return m_vCommonMarks.end();
+ }
+
+ sal_Int32 MarkManager::getCommonMarksCount() const
+ {
+ return m_vCommonMarks.size();
+ }
+
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::getAnnotationMarksBegin() const
+ {
+ return m_vAnnotationMarks.begin();
+ }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::getAnnotationMarksEnd() const
+ {
+ return m_vAnnotationMarks.end();
+ }
+
+ sal_Int32 MarkManager::getAnnotationMarksCount() const
+ {
+ return m_vAnnotationMarks.size();
+ }
+
+ IDocumentMarkAccess::const_iterator_t MarkManager::findAnnotationMark( const ::rtl::OUString& rName ) const
+ {
+ return lcl_FindMarkByName( rName, m_vAnnotationMarks.begin(), m_vAnnotationMarks.end() );
+ }
+
+
::rtl::OUString MarkManager::getUniqueMarkName(const ::rtl::OUString& rName) const
{
OSL_ENSURE(rName.getLength(),
- "<MarkManager::getUniqueMarkName(..)>"
- " - a name should be proposed");
- if(findMark(rName) == getMarksEnd()) return rName;
+ "<MarkManager::getUniqueMarkName(..)> - a name should be proposed");
+ if ( findMark(rName) == getAllMarksEnd() )
+ {
+ return rName;
+ }
+
::rtl::OUStringBuffer sBuf;
::rtl::OUString sTmp;
for(sal_Int32 nCnt = 1; nCnt < SAL_MAX_INT32; nCnt++)
{
sTmp = sBuf.append(rName).append(nCnt).makeStringAndClear();
- if(findMark(sTmp) == getMarksEnd()) break;
+ if ( findMark(sTmp) == getAllMarksEnd() )
+ {
+ break;
+ }
}
return sTmp;
}
void MarkManager::sortMarks()
{
- sort(m_vMarks.begin(), m_vMarks.end(), &lcl_MarkOrderingByStart);
+ sort(m_vAllMarks.begin(), m_vAllMarks.end(), &lcl_MarkOrderingByStart);
+ sort(m_vCommonMarks.begin(), m_vCommonMarks.end(), &lcl_MarkOrderingByStart);
sort(m_vBookmarks.begin(), m_vBookmarks.end(), &lcl_MarkOrderingByStart);
sort(m_vFieldmarks.begin(), m_vFieldmarks.end(), &lcl_MarkOrderingByStart);
+ sort(m_vAnnotationMarks.begin(), m_vAnnotationMarks.end(), &lcl_MarkOrderingByStart);
+ }
+
+#if OSL_DEBUG_LEVEL > 1
+ void MarkManager::dumpFieldmarks( ) const
+ {
+ const_iterator_t pIt = m_vFieldmarks.begin();
+ for (; pIt != m_vFieldmarks.end( ); pIt++)
+ {
+ rtl::OUString str = (*pIt)->ToString();
+ OSL_TRACE("%s\n",
+ ::rtl::OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr());
+ }
}
+#endif
}} // namespace ::sw::mark
@@ -1241,41 +1357,36 @@ void _SaveCntntIdx(SwDoc* pDoc,
aSave.SetTypeAndCount( 0x8000, 0 );
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
- const sal_Int32 nBkmks = pMarkAccess->getMarksCount();
- for(; aSave.GetCount() < nBkmks; aSave.IncCount())
+ const sal_Int32 nMarksCount = pMarkAccess->getAllMarksCount();
+ for ( ; aSave.GetCount() < nMarksCount; aSave.IncCount() )
{
- bool bEqual = false;
- bool bLower = false;
- const ::sw::mark::IMark* pBkmk = (pMarkAccess->getMarksBegin() + aSave.GetCount())->get();
+ bool bMarkPosEqual = false;
+ const ::sw::mark::IMark* pBkmk = (pMarkAccess->getAllMarksBegin() + aSave.GetCount())->get();
if(pBkmk->GetMarkPos().nNode.GetIndex() == nNode
&& pBkmk->GetMarkPos().nContent.GetIndex() <= nCntnt)
{
if(pBkmk->GetMarkPos().nContent.GetIndex() < nCntnt)
{
- bLower = true; // a hint for the other position...
aSave.SetContent(pBkmk->GetMarkPos().nContent.GetIndex());
aSave.Add(rSaveArr);
}
else // if a bookmark position is equal nCntnt, the other position
- bEqual = true; // has to decide if it is added to the array
+ bMarkPosEqual = true; // has to decide if it is added to the array
}
if(pBkmk->IsExpanded()
&& pBkmk->GetOtherMarkPos().nNode.GetIndex() == nNode
&& pBkmk->GetOtherMarkPos().nContent.GetIndex() <= nCntnt)
{
- if(bLower || pBkmk->GetOtherMarkPos().nContent.GetIndex() < nCntnt)
- {
- if(bEqual)
- { // the other position is before, the (main) position is equal
- aSave.SetContent(pBkmk->GetMarkPos().nContent.GetIndex());
- aSave.Add(rSaveArr);
- }
- aSave.SetContent(pBkmk->GetOtherMarkPos().nContent.GetIndex());
- aSave.IncType();
+ if(bMarkPosEqual)
+ { // the other position is before, the (main) position is equal
+ aSave.SetContent(pBkmk->GetMarkPos().nContent.GetIndex());
aSave.Add(rSaveArr);
- aSave.DecType();
}
+ aSave.SetContent(pBkmk->GetOtherMarkPos().nContent.GetIndex());
+ aSave.IncType();
+ aSave.Add(rSaveArr);
+ aSave.DecType();
}
}
@@ -1467,7 +1578,7 @@ void _RestoreCntntIdx(SwDoc* pDoc,
{
case 0x8000:
{
- MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get());
+ MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getAllMarksBegin()[aSave.GetCount()].get());
SwPosition aNewPos(pMark->GetMarkPos());
aNewPos.nNode = *pCNd;
aNewPos.nContent.Assign(pCNd, aSave.GetContent() + nOffset);
@@ -1476,7 +1587,7 @@ void _RestoreCntntIdx(SwDoc* pDoc,
break;
case 0x8001:
{
- MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get());
+ MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getAllMarksBegin()[aSave.GetCount()].get());
SwPosition aNewPos(pMark->GetOtherMarkPos());
aNewPos.nNode = *pCNd;
aNewPos.nContent.Assign(pCNd, aSave.GetContent() + nOffset);
@@ -1634,7 +1745,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr,
{
case 0x8000:
{
- MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get());
+ MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getAllMarksBegin()[aSave.GetCount()].get());
SwPosition aNewPos(pMark->GetMarkPos());
aNewPos.nNode = rNd;
aNewPos.nContent.Assign(pCNd, Min(aSave.GetContent(), nLen));
@@ -1643,7 +1754,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr,
break;
case 0x8001:
{
- MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get());
+ MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getAllMarksBegin()[aSave.GetCount()].get());
SwPosition aNewPos(pMark->GetOtherMarkPos());
aNewPos.nNode = rNd;
aNewPos.nContent.Assign(pCNd, Min(aSave.GetContent(), nLen));
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 169eea5..66295a4 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1354,8 +1354,11 @@ void SwCompareData::ShowInsert( sal_uLong nStt, sal_uLong nEnd )
}
-void SwCompareData::ShowDelete( const CompareData& rData, sal_uLong nStt,
- sal_uLong nEnd, sal_uLong nInsPos )
+void SwCompareData::ShowDelete(
+ const CompareData& rData,
+ sal_uLong nStt,
+ sal_uLong nEnd,
+ sal_uLong nInsPos )
{
SwNodeRange aRg(
((SwCompareLine*)rData.GetLine( nStt ))->GetNode(), 0,
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index 7301346..16f3455 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -204,7 +204,9 @@ void SwDoc::CorrAbs(const SwNodeIndex& rOldNode,
aNewPos.nContent += nOffset;
getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset);
- { // fix redlines
+
+ // fix redlines
+ {
SwRedlineTbl& rTbl = *pRedlineTbl;
for (sal_uInt16 n = 0; n < rTbl.Count(); )
{
diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx
index 6a8e993..fcab094 100644
--- a/sw/source/core/doc/docdde.cxx
+++ b/sw/source/core/doc/docdde.cxx
@@ -55,16 +55,20 @@ using namespace ::com::sun::star;
namespace
{
- static ::sw::mark::DdeBookmark* lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName, bool bCaseSensitive)
+ static ::sw::mark::DdeBookmark* lcl_FindDdeBookmark(
+ const IDocumentMarkAccess& rMarkAccess,
+ const String& rName,
+ const bool bCaseSensitive )
{
//Iterating over all bookmarks, checking DdeBookmarks
const ::rtl::OUString sNameLc = bCaseSensitive ? rName : GetAppCharClass().lower(rName);
- for(IDocumentMarkAccess::const_iterator_t ppMark = rMarkAccess.getMarksBegin();
- ppMark != rMarkAccess.getMarksEnd();
+ for(IDocumentMarkAccess::const_iterator_t ppMark = rMarkAccess.getCommonMarksBegin();
+ ppMark != rMarkAccess.getCommonMarksEnd();
ppMark++)
{
- if (::sw::mark::DdeBookmark* const pBkmk = dynamic_cast< ::sw::mark::DdeBookmark*>(ppMark->get()))
+ if ( IDocumentMarkAccess::GetType( *(ppMark->get()) ) == IDocumentMarkAccess::DDE_BOOKMARK)
{
+ ::sw::mark::DdeBookmark* const pBkmk = dynamic_cast< ::sw::mark::DdeBookmark*>(ppMark->get());
if (
(bCaseSensitive && (pBkmk->GetName() == sNameLc)) ||
(!bCaseSensitive && GetAppCharClass().lower(pBkmk->GetName()) == String(sNameLc))
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 8ffe087..fa42f2d 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -1690,30 +1690,6 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
}
}
- // Delete fieldmarks before postits, but let's leave them alone during import.
- if ( GetIDocumentUndoRedo().DoesUndo()
- && pStt->nNode == pEnd->nNode
- && (pEnd->nContent.GetIndex() - pStt->nContent.GetIndex()) == 1 )
- {
- SwTxtNode* pTxtNd = rPam.Start()->nNode.GetNode().GetTxtNode();
- xub_StrLen nIndex = rPam.Start()->nContent.GetIndex();
- // We may have a postit here.
- if (pTxtNd->GetTxt().GetChar(nIndex) == CH_TXTATR_INWORD)
- {
- SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(nIndex, RES_TXTATR_FIELD);
- if ( pTxtAttr != NULL
- && pTxtAttr->GetFmtFld().GetField()->Which() == RES_POSTITFLD )
- {
- const SwPostItField* pField = dynamic_cast<const SwPostItField*>(pTxtAttr->GetFmtFld().GetField());
- IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark(pField->GetName());
- if (ppMark != getIDocumentMarkAccess()->getMarksEnd())
- {
- getIDocumentMarkAccess()->deleteMark(ppMark);
- }
- }
- }
- }
-
{
// Bug 26675: DataChanged vorm loeschen verschicken, dann bekommt
// man noch mit, welche Objecte sich im Bereich befinden.
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 2031333..384bfa2 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -278,11 +278,11 @@ const SwFldTypes* SwDoc::GetFldTypes() const
Beschreibung: Den ersten Typen mit ResId und Namen finden
--------------------------------------------------------------------*/
-SwFieldType* SwDoc::GetFldType( sal_uInt16 nResId, const String& rName,
- bool bDbFieldMatching // used in some UNO calls for RES_DBFLD
- // to use different string matching code
- // #i51815#
- ) const
+SwFieldType* SwDoc::GetFldType(
+ sal_uInt16 nResId,
+ const String& rName,
+ bool bDbFieldMatching // used in some UNO calls for RES_DBFLD to use different string matching code #i51815#
+ ) const
{
sal_uInt16 nSize = pFldTypes->Count(), i = 0;
const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
@@ -2210,7 +2210,7 @@ bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLong nLen )
n < nEnd; ++n )
{
const SwTxtAttr* pAttr = pTNd->GetSwpHints()[ n ];
- if( RES_TXTATR_FIELD == pAttr->Which() )
+ if ( pAttr->Which() == RES_TXTATR_FIELD )
{
b = sal_True;
break;
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 74e9504..f094190 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -719,7 +719,7 @@ static bool lcl_InsAttr(
: pNode->Len();
SwRegHistory history( pNode, *pNode, pHistory );
bRet = history.InsertItems( aTxtSet, nInsCnt, nEnd, nFlags )
- || bRet;
+ || bRet;
if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
&& pDoc->GetRedlineTbl().Count())))
@@ -733,8 +733,10 @@ static bool lcl_InsAttr(
pUndo->SaveRedlineData( aPam, bTxtIns );
if( pDoc->IsRedlineOn() )
- pDoc->AppendRedline( new SwRedline( bTxtIns
- ? nsRedlineType_t::REDLINE_INSERT : nsRedlineType_t::REDLINE_FORMAT, aPam ), true);
+ pDoc->AppendRedline(
+ new SwRedline(
+ bTxtIns ? nsRedlineType_t::REDLINE_INSERT : nsRedlineType_t::REDLINE_FORMAT, aPam ),
+ true);
else if( bTxtIns )
pDoc->SplitRedline( aPam );
}
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 503ec15..bd30d3f 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -389,9 +389,11 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt )
|*
|*************************************************************************/
-SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
- const SwFmtAnchor& rNewAnchor,
- bool bSetTxtFlyAtt, bool bMakeFrms )
+SwFrmFmt *SwDoc::CopyLayoutFmt(
+ const SwFrmFmt& rSource,
+ const SwFmtAnchor& rNewAnchor,
+ bool bSetTxtFlyAtt,
+ bool bMakeFrms )
{
const bool bFly = RES_FLYFRMFMT == rSource.Which();
const bool bDraw = RES_DRAWFRMFMT == rSource.Which();
@@ -497,7 +499,7 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
// sorge dafuer das auch Fly's in Fly's kopiert werden
aIdx = *pSttNd->EndOfSectionNode();
- pSrcDoc->CopyWithFlyInFly( aRg, 0, aIdx, sal_False, sal_True, sal_True );
+ pSrcDoc->CopyWithFlyInFly( aRg, 0, aIdx, NULL, sal_False, sal_True, sal_True );
}
else
{
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 91c27d7..43463d2 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -561,7 +561,7 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
SwNodeIndex aSavePos( aInsIdx, -1 );
if( pRg.get() )
- pCpyDoc->CopyWithFlyInFly( *pRg, 0, aInsIdx, sal_False );
+ pCpyDoc->CopyWithFlyInFly( *pRg, 0, aInsIdx, NULL, sal_False );
else
pDoc->GetNodes().MakeTxtNode( aInsIdx, (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
aSavePos++;
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 2afc3ee..5f6eb5d 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -2098,7 +2098,7 @@ sal_Bool lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara )
*rpFndBox->GetBox()->GetSttNd()->EndOfSectionNode() );
SwNodeIndex aInsIdx( *pBox->GetSttNd(), 1 );
- pFromDoc->CopyWithFlyInFly( aCpyRg, 0, aInsIdx, sal_False );
+ pFromDoc->CopyWithFlyInFly( aCpyRg, 0, aInsIdx, NULL, sal_False );
// den initialen TextNode loeschen
pCpyPara->pDoc->GetNodes().Delete( aInsIdx, 1 );
}
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 1cad72b..d1b487c 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -132,7 +132,9 @@ namespace
}
// TODO: use SaveBookmark (from _DelBookmarks)
- static void lcl_CopyBookmarks(const SwPaM& rPam, SwPaM& rCpyPam)
+ static void lcl_CopyBookmarks(
+ const SwPaM& rPam,
+ SwPaM& rCpyPam )
{
const SwDoc* pSrcDoc = rPam.GetDoc();
SwDoc* pDestDoc = rCpyPam.GetDoc();
@@ -144,19 +146,23 @@ namespace
typedef ::std::vector< const ::sw::mark::IMark* > mark_vector_t;
mark_vector_t vMarksToCopy;
- for(IDocumentMarkAccess::const_iterator_t ppMark = pSrcMarkAccess->getMarksBegin();
- ppMark != pSrcMarkAccess->getMarksEnd();
- ppMark++)
+ for ( IDocumentMarkAccess::const_iterator_t ppMark = pSrcMarkAccess->getAllMarksBegin();
+ ppMark != pSrcMarkAccess->getAllMarksEnd();
+ ppMark++ )
{
const ::sw::mark::IMark* const pMark = ppMark->get();
+
const SwPosition& rMarkStart = pMark->GetMarkStart();
const SwPosition& rMarkEnd = pMark->GetMarkEnd();
- // only include marks that are in the range and not touching
- // both start and end
- bool bIsNotOnBoundary = pMark->IsExpanded()
+ // only include marks that are in the range and not touching both start and end
+ // - not for annotation marks.
+ const bool bIsNotOnBoundary =
+ pMark->IsExpanded()
? (rMarkStart != rStt || rMarkEnd != rEnd) // rMarkStart != rMarkEnd
: (rMarkStart != rStt && rMarkEnd != rEnd); // rMarkStart == rMarkEnd
- if(rMarkStart >= rStt && rMarkEnd <= rEnd && bIsNotOnBoundary)
+ if ( rMarkStart >= rStt && rMarkEnd <= rEnd
+ && ( bIsNotOnBoundary
+ || IDocumentMarkAccess::GetType( *pMark ) == IDocumentMarkAccess::ANNOTATIONMARK ) )
{
vMarksToCopy.push_back(pMark);
}
@@ -1245,13 +1251,13 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
if( aInsPos == pEnd->nNode )
{
SwNodeIndex aSaveIdx( aInsPos, -1 );
- CopyWithFlyInFly( aRg, 0,aInsPos, bMakeNewFrms, sal_False );
+ CopyWithFlyInFly( aRg, 0, aInsPos, &rPam, bMakeNewFrms, sal_False );
aSaveIdx++;
pEnd->nNode = aSaveIdx;
pEnd->nContent.Assign( aSaveIdx.GetNode().GetTxtNode(), 0 );
}
else
- CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, sal_False );
+ CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, &rPam, bMakeNewFrms, sal_False );
bCopyBookmarks = false;
@@ -1281,7 +1287,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
aCpyPam.Exchange();
// dann kopiere noch alle Bookmarks
- if( bCopyBookmarks && getIDocumentMarkAccess()->getMarksCount() )
+ if( bCopyBookmarks && getIDocumentMarkAccess()->getAllMarksCount() )
lcl_CopyBookmarks( rPam, aCpyPam );
if( nsRedlineMode_t::REDLINE_DELETE_REDLINES & eOld )
@@ -1318,9 +1324,14 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
// ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------
-void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex,
- const SwNodeIndex& rInsPos, sal_Bool bMakeNewFrms,
- sal_Bool bDelRedlines, sal_Bool bCopyFlyAtFly ) const
+void SwDoc::CopyWithFlyInFly(
+ const SwNodeRange& rRg,
+ const xub_StrLen nEndContentIndex,
+ const SwNodeIndex& rInsPos,
+ const SwPaM* pCopiedPaM,
+ const sal_Bool bMakeNewFrms,
+ const sal_Bool bDelRedlines,
+ const sal_Bool bCopyFlyAtFly ) const
{
SwDoc* pDest = rInsPos.GetNode().GetDoc();
@@ -1362,12 +1373,14 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte
SwNodeRange aCpyRange( aSavePos, rInsPos );
// dann kopiere noch alle Bookmarks
- if( getIDocumentMarkAccess()->getMarksCount() )
+ if( getIDocumentMarkAccess()->getAllMarksCount() )
{
SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
SwPaM aCpyTmp( aCpyRange.aStart, aCpyRange.aEnd );
- lcl_CopyBookmarks( aRgTmp, aCpyTmp );
+ lcl_CopyBookmarks(
+ pCopiedPaM != NULL ? *pCopiedPaM : aRgTmp,
+ aCpyTmp );
}
if( bDelRedlines && ( nsRedlineMode_t::REDLINE_DELETE_REDLINES & pDest->GetRedlineMode() ))
@@ -1392,9 +1405,11 @@ void lcl_ChainFmts( SwFlyFrmFmt *pSrc, SwFlyFrmFmt *pDest )
}
}
-void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg,
- const xub_StrLen nEndContentIndex, const SwNodeIndex& rStartIdx,
- const bool bCopyFlyAtFly ) const
+void SwDoc::CopyFlyInFlyImpl(
+ const SwNodeRange& rRg,
+ const xub_StrLen nEndContentIndex,
+ const SwNodeIndex& rStartIdx,
+ const bool bCopyFlyAtFly ) const
{
// Bug 22727: suche erst mal alle Flys zusammen, sortiere sie entsprechend
// ihrer Ordnungsnummer und kopiere sie erst dann. Damit wird
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 53a7eec..2da512d 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -304,6 +304,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
switch ( pAttr->Which() )
{
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
case RES_TXTATR_INPUTFIELD:
{
SwTxtFld* pTxtFld = static_cast<SwTxtFld*>(pAttr);
@@ -320,16 +321,17 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
: SWFMTFLD_REMOVED ) ) );
}
else
- if( RES_DDEFLD == pTyp->Which() )
- {
- if( bToUndo )
- ((SwDDEFieldType*)pTyp)->DecRefCnt();
- else
- ((SwDDEFieldType*)pTyp)->IncRefCnt();
- }
- nDelMsg = RES_FIELD_DELETED;
+ if( RES_DDEFLD == pTyp->Which() )
+ {
+ if( bToUndo )
+ ((SwDDEFieldType*)pTyp)->DecRefCnt();
+ else
+ ((SwDDEFieldType*)pTyp)->IncRefCnt();
+ }
+ nDelMsg = RES_FIELD_DELETED;
}
break;
+
case RES_TXTATR_FTN:
nDelMsg = RES_FOOTNOTE_DELETED;
break;
@@ -357,19 +359,20 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
default:
break;
}
+
if( nDelMsg && bToUndo )
{
SwPtrMsgPoolItem aMsgHint( nDelMsg,
- (void*)&pAttr->GetAttr() );
+ (void*)&pAttr->GetAttr() );
rNds.GetDoc()->GetUnoCallBack()->
- ModifyNotification( &aMsgHint, &aMsgHint );
+ ModifyNotification( &aMsgHint, &aMsgHint );
}
}
}
-//FEATURE::CONDCOLL
+ //FEATURE::CONDCOLL
if( RES_CONDTXTFMTCOLL == pTxtNd->GetTxtColl()->Which() )
pTxtNd->ChkCondColl();
-//FEATURE::CONDCOLL
+ //FEATURE::CONDCOLL
}
else
{
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 6cf91af..716b0ea 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1548,7 +1548,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
SwTblNumFmtMerge aTNFM( *pSrcDoc, *pDoc );
- pSrcDoc->CopyWithFlyInFly( *pCpyRg, 0, rInsPos, bCreateFrm );
+ pSrcDoc->CopyWithFlyInFly( *pCpyRg, 0, rInsPos, NULL, bCreateFrm );
aSave++;
if( !bCreateFrm )
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 1a1a3d7..43271d8 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -316,6 +316,7 @@ void SwEditShell::UpdateFlds( SwField &rFld )
sal_Bool bTblSelBreak = sal_False;
SwMsgPoolItem aFldHint( RES_TXTATR_FIELD );
+ SwMsgPoolItem aAnnotationFldHint( RES_TXTATR_ANNOTATION );
SwMsgPoolItem aInputFldHint( RES_TXTATR_INPUTFIELD );
FOREACHPAM_START(this) // fuer jeden PaM
if( PCURCRSR->HasMark() && bOkay ) // ... mit Selektion
@@ -338,6 +339,7 @@ void SwEditShell::UpdateFlds( SwField &rFld )
while( bOkay
&& pCurStt->nContent != pCurEnd->nContent
&& ( aPam.Find( aFldHint, sal_False, fnMoveForward, &aCurPam )
+ || aPam.Find( aAnnotationFldHint, sal_False, fnMoveForward, &aCurPam )
|| aPam.Find( aInputFldHint, sal_False, fnMoveForward, &aCurPam ) ) )
{
// wenn nur ein Pam mehr als ein Feld enthaelt ...
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 6b3830a..c390287 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1878,6 +1878,7 @@ void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > xAlt,
switch (nWhich)
{
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
case RES_TXTATR_FTN:
case RES_TXTATR_FLYCNT:
bField = true;
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 42be67b..71287a3 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1764,7 +1764,8 @@ const String& SwHiddenParaField::GetPar1() const
--------------------------------------------------------------------*/
SwPostItFieldType::SwPostItFieldType(SwDoc *pDoc)
- : SwFieldType( RES_POSTITFLD ),mpDoc(pDoc)
+ : SwFieldType( RES_POSTITFLD )
+ , mpDoc(pDoc)
{}
/* ---------------------------------------------------------------------------
@@ -1790,15 +1791,15 @@ SwPostItField::SwPostItField(
, msAuthorInitials( rAuthorInitials )
, msName( rName )
, maDateTime( rDateTime )
- , mpText(0)
- , m_pTextObject(0)
+ , mpText( NULL )
+ , m_pTextObject( NULL )
{
}
SwPostItField::~SwPostItField()
{
- if ( m_pTextObject )
+ if ( m_pTextObject != NULL )
{
m_pTextObject->DisposeEditSource();
m_pTextObject->release();
@@ -1835,6 +1836,8 @@ SwField* SwPostItField::Copy() const
pRet->SetTextObject( new OutlinerParaObject(*mpText) );
}
+ // Note: member <m_pTextObject> not copied.
+
return pRet;
}
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index 7b0fd9b..219abf3 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -82,62 +82,66 @@ struct LayoutInfoOrder
} // eof anonymous namespace
-SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLayoutInfo >& rInfo, SwPosition& rPos )
+SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos(
+ SwLayoutInfo& o_rInfo,
+ const SwPosition& rAnchorPos,
+ const SwPosition* pAnnotationStartPos )
{
SwLayoutStatus aRet = INVISIBLE;
- const SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode();
- SwCntntNode* pNode = rPos.nNode.GetNode().GetCntntNode(); // getfirstcontentnode // getnext...
- if( !pNode )
+ SwTxtNode* pTxtNode = rAnchorPos.nNode.GetNode().GetTxtNode();
+ if ( pTxtNode == NULL )
return aRet;
- SwIterator<SwTxtFrm,SwCntntNode> aIter( *pNode );
- for( SwTxtFrm* pTxtFrm = aIter.First(); pTxtFrm; pTxtFrm = aIter.Next() )
+
+ SwIterator<SwTxtFrm,SwCntntNode> aIter( *pTxtNode );
+ for( SwTxtFrm* pTxtFrm = aIter.First(); pTxtFrm != NULL; pTxtFrm = aIter.Next() )
{
if( !pTxtFrm->IsFollow() )
{
- pTxtFrm = ((SwTxtFrm*)pTxtFrm)->GetFrmAtPos( rPos );
- SwPageFrm *pPage = pTxtFrm ? pTxtFrm->FindPageFrm() : 0;
- // #i103490#
- if ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() )
+ pTxtFrm = pTxtFrm->GetFrmAtPos( rAnchorPos );
+ SwPageFrm *pPage = pTxtFrm ? pTxtFrm->FindPageFrm() : 0;
+ if ( pPage != NULL && !pPage->IsInvalid() && !pPage->IsInvalidFly() )
{
- 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.meSidebarPosition = pPage->SidebarPosition();
- aInfo.mRedlineAuthor = 0;
-
- if( aRet == INVISIBLE )
+ aRet = VISIBLE;
+
+ o_rInfo.mpAnchorFrm = pTxtFrm;
+ pTxtFrm->GetCharRect( o_rInfo.mPosition, rAnchorPos, 0 );
+ if ( pAnnotationStartPos != NULL )
{
- aRet = VISIBLE;
- const IDocumentRedlineAccess* pIDRA = pNode->getIDocumentRedlineAccess();
- if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) )
- {
- const SwRedline* pRedline = pIDRA->GetRedline( rPos, 0 );
- if( pRedline )
- {
- if( nsRedlineType_t::REDLINE_INSERT == pRedline->GetType() )
- aRet = INSERTED;
- else if( nsRedlineType_t::REDLINE_DELETE == pRedline->GetType() )
- aRet = DELETED;
- aInfo.mRedlineAuthor = pRedline->GetAuthor();
- }
- }
+ o_rInfo.mnStartNodeIdx = pAnnotationStartPos->nNode.GetIndex();
+ o_rInfo.mnStartContent = pAnnotationStartPos->nContent.GetIndex();
}
-
+ else
{
- std::vector< SwLayoutInfo >::iterator aInsPosIter =
- std::lower_bound( rInfo.begin(), rInfo.end(),
- aInfo, LayoutInfoOrder() );
-
- rInfo.insert( aInsPosIter, aInfo );
+ o_rInfo.mnStartNodeIdx = 0;
+ o_rInfo.mnStartContent = STRING_NOTFOUND;
+ }
+ o_rInfo.mPageFrame = pPage->Frm();
+ o_rInfo.mPagePrtArea = pPage->Prt();
+ o_rInfo.mPagePrtArea.Pos() += o_rInfo.mPageFrame.Pos();
+ o_rInfo.mnPageNumber = pPage->GetPhyPageNum();
+ o_rInfo.meSidebarPosition = pPage->SidebarPosition();
+ o_rInfo.mRedlineAuthor = 0;
+
+ const IDocumentRedlineAccess* pIDRA = pTxtNode->getIDocumentRedlineAccess();
+ if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) )
+ {
+ const SwRedline* pRedline = pIDRA->GetRedline( rAnchorPos, 0 );
+ if( pRedline )
+ {
+ if( nsRedlineType_t::REDLINE_INSERT == pRedline->GetType() )
+ aRet = INSERTED;
+ else if( nsRedlineType_t::REDLINE_DELETE == pRedline->GetType() )
+ aRet = DELETED;
+ o_rInfo.mRedlineAuthor = pRedline->GetAuthor();
+ }
}
}
}
}
- return ((aRet==VISIBLE) && SwScriptInfo::IsInHiddenRange( *pTxtNode , rPos.nContent.GetIndex()) ) ? HIDDEN : aRet;
+
+ return ( (aRet==VISIBLE) && SwScriptInfo::IsInHiddenRange( *pTxtNode , rAnchorPos.nContent.GetIndex()) )
+ ? HIDDEN
+ : aRet;
}
long SwPostItHelper::getLayoutHeight( const SwRootFrm* pRoot )
@@ -170,22 +174,22 @@ unsigned long SwPostItHelper::getPageInfo( SwRect& rPageFrm, const SwRootFrm* pR
SwPosition SwAnnotationItem::GetAnchorPosition() const
{
- SwTxtFld* pFld = pFmtFld->GetTxtFld();
- //if( pFld )
+ SwTxtFld* pTxtFld = mrFmtFld.GetTxtFld();
+ //if( pTxtFld )
//{
- SwTxtNode* pTNd = pFld->GetpTxtNode();
- // if( pTNd )
- // {
- SwPosition aPos( *pTNd );
- aPos.nContent.Assign( pTNd, *pFld->GetStart() );
+ SwTxtNode* pTxtNode = pTxtFld->GetpTxtNode();
+ //if( pTxtNode )
+ //{
+ SwPosition aPos( *pTxtNode );
+ aPos.nContent.Assign( pTxtNode, *(pTxtFld->GetStart()) );
return aPos;
- // }
+ //}
//}
}
bool SwAnnotationItem::UseElement()
{
- return pFmtFld->IsFldInDoc();
+ return mrFmtFld.IsFldInDoc();
}
sw::sidebarwindows::SwSidebarWin* SwAnnotationItem::GetSidebarWindow(
@@ -197,7 +201,7 @@ sw::sidebarwindows::SwSidebarWin* SwAnnotationItem::GetSidebarWindow(
return new sw::annotation::SwAnnotationWin( rEditWin, nBits,
aMgr, aBits,
*this,
- pFmtFld );
+ &mrFmtFld );
}
/*
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 3820a0c..80632ea 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -313,9 +313,8 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
case REF_ONLYCAPTION:
{
const SwTxtAttr* const pTxtAttr = pTxtNd->GetTxtAttrForCharAt(nStt, RES_TXTATR_FIELD);
- if( pTxtAttr )
- nStt = SwGetExpField::GetReferenceTextPos(
- pTxtAttr->GetFmtFld(), *pDoc );
+ if( pTxtAttr != NULL )
+ nStt = SwGetExpField::GetReferenceTextPos( pTxtAttr->GetFmtFld(), *pDoc );
else if( nStt + 1 < nEnd )
++nStt;
}
@@ -832,7 +831,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark,
case REF_BOOKMARK:
{
IDocumentMarkAccess::const_iterator_t ppMark = pDoc->getIDocumentMarkAccess()->findMark(rRefMark);
- if(ppMark != pDoc->getIDocumentMarkAccess()->getMarksEnd())
+ if(ppMark != pDoc->getIDocumentMarkAccess()->getAllMarksEnd())
{
const ::sw::mark::IMark* pBkmk = ppMark->get();
const SwPosition* pPos = &pBkmk->GetMarkStart();
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index c11997c..502975e 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1483,9 +1483,8 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference <
// search for a sequence field:
const SfxPoolItem* pItem;
for( sal_uInt16 n = 0, nEnd = pHts->Count(); n < nEnd; ++n )
- if( RES_TXTATR_FIELD == ( pItem =
- &(*pHts)[ n ]->GetAttr())->Which() &&
- TYP_SEQFLD == ((SwFmtFld*)pItem)->GetField()->GetTypeId() )
+ if( RES_TXTATR_FIELD == ( pItem = &(*pHts)[ n ]->GetAttr())->Which()
+ && TYP_SEQFLD == ((SwFmtFld*)pItem)->GetField()->GetTypeId() )
{
// sequence field found
SwFlyFrm* pChgFly = (SwFlyFrm*)pAnchor->GetUpper();
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index 1791308..0621140 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -50,6 +50,11 @@ namespace sw { namespace mark
virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark);
+ virtual sw::mark::IMark* makeAnnotationMark(
+ const SwPaM& rPaM,
+ const ::rtl::OUString& rName );
+
+
virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM);
virtual bool renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName);
virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset);
@@ -63,9 +68,9 @@ namespace sw { namespace mark
virtual void clearAllMarks();
// marks
- virtual const_iterator_t getMarksBegin() const;
- virtual const_iterator_t getMarksEnd() const;
- virtual sal_Int32 getMarksCount() const;
+ virtual const_iterator_t getAllMarksBegin() const;
+ virtual const_iterator_t getAllMarksEnd() const;
+ virtual sal_Int32 getAllMarksCount() const;
virtual const_iterator_t findMark(const ::rtl::OUString& rName) const;
// bookmarks
@@ -79,14 +84,36 @@ namespace sw { namespace mark
virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const;
virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const;
+ // Marks exclusive annotation marks
+ virtual const_iterator_t getCommonMarksBegin() const;
+ virtual const_iterator_t getCommonMarksEnd() const;
+ virtual sal_Int32 getCommonMarksCount() const;
+
+ // Annotation Marks
+ virtual const_iterator_t getAnnotationMarksBegin() const;
+ virtual const_iterator_t getAnnotationMarksEnd() const;
+ virtual sal_Int32 getAnnotationMarksCount() const;
+ virtual const_iterator_t findAnnotationMark( const ::rtl::OUString& rName ) const;
+
private:
// make names
::rtl::OUString getUniqueMarkName(const ::rtl::OUString& rName) const;
void sortMarks();
- container_t m_vMarks;
+ // container for all marks
+ container_t m_vAllMarks;
+
+ // additional container for bookmarks
container_t m_vBookmarks;
+ // additional container for fieldmarks
container_t m_vFieldmarks;
+
+ // container for annotation marks
+ container_t m_vAnnotationMarks;
+
+ // container for all marks except annotation marks
+ container_t m_vCommonMarks;
+
SwDoc * const m_pDoc;
};
}}
diff --git a/sw/source/core/inc/UndoDelete.hxx b/sw/source/core/inc/UndoDelete.hxx
index f12e221..61c5efe 100644
--- a/sw/source/core/inc/UndoDelete.hxx
+++ b/sw/source/core/inc/UndoDelete.hxx
@@ -69,8 +69,10 @@ class SwUndoDelete
sal_Bool SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
SwTxtNode* pSttTxtNd, SwTxtNode* pEndTxtNd );
public:
- SwUndoDelete( SwPaM&,
- sal_Bool bFullPara = sal_False, sal_Bool bCalledByTblCpy = sal_False );
+ SwUndoDelete(
+ SwPaM&,
+ sal_Bool bFullPara = sal_False,
+ sal_Bool bCalledByTblCpy = sal_False );
virtual ~SwUndoDelete();
virtual void UndoImpl( ::sw::UndoRedoContext & );
diff --git a/sw/source/core/inc/annotationmark.hxx b/sw/source/core/inc/annotationmark.hxx
new file mode 100755
index 0000000..c855e60
--- /dev/null
+++ b/sw/source/core/inc/annotationmark.hxx
@@ -0,0 +1,47 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+#ifndef _ANNOTATIONMARK_HXX
+#define _ANNOTATIONMARK_HXX
+
+#include <bookmrk.hxx>
+#include <rtl/ustring.hxx>
+
+class SwFmtFld;
+
+namespace sw { namespace mark
+{
+ class AnnotationMark : public MarkBase
+ {
+ public:
+ AnnotationMark(
+ const SwPaM& rPaM,
+ const ::rtl::OUString& rName );
+
+ virtual ~AnnotationMark();
+
+ virtual void InitDoc(SwDoc* const io_Doc);
+
+ const SwFmtFld* GetAnnotationFmtFld() const;
+ };
+}}
+#endif
diff --git a/sw/source/core/inc/crossrefbookmark.hxx b/sw/source/core/inc/crossrefbookmark.hxx
index dd5ef00..d2b9966 100644
--- a/sw/source/core/inc/crossrefbookmark.hxx
+++ b/sw/source/core/inc/crossrefbookmark.hxx
@@ -73,7 +73,6 @@ namespace sw { namespace mark
const KeyCode& rCode,
const ::rtl::OUString& rName,
const ::rtl::OUString& rShortName);
- static ::rtl::OUString GenerateNewName();
static bool IsLegalName(const ::rtl::OUString& rName);
};
@@ -85,7 +84,6 @@ namespace sw { namespace mark
const KeyCode& rCode,
const ::rtl::OUString& rName,
const ::rtl::OUString& rShortName);
- static ::rtl::OUString GenerateNewName();
static bool IsLegalName(const ::rtl::OUString& rName);
static const ::rtl::OUString our_sNamePrefix;
};
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 43648b4..f1652f7 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2586,8 +2586,8 @@ sal_uLong SwTableBox::IsValidNumTxtNd( sal_Bool bCheckAttr ) const
*pAttr->GetStart() ||
*pAttr->GetAnyEnd() < rTxt.Len() )
{
- if ((*pAttr->GetStart() == nNextSetField) &&
- (pAttr->Which() == RES_TXTATR_FIELD))
+ if ( (*pAttr->GetStart() == nNextSetField)
+ && (pAttr->Which() == RES_TXTATR_FIELD))
{
// #i104949# hideous hack for report builder:
// it inserts hidden variable-set fields at
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 9d8ba29..0dc3dae 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -38,7 +38,6 @@
#include <editeng/splwrap.hxx>
#include <editeng/pgrditem.hxx>
#include <editeng/tstpitem.hxx>
-#include <xmloff/odffields.hxx>
#include <SwSmartTagMgr.hxx>
#include <linguistic/lngprops.hxx>
@@ -47,9 +46,6 @@
#include <editeng/forbiddenruleitem.hxx>
#include <txatbase.hxx>
#include <fmtinfmt.hxx>
-#include <fmtfld.hxx>
-#include <fldbas.hxx>
-#include <PostItMgr.hxx>
#include <swmodule.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
@@ -1203,7 +1199,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
if(aIntersect.HasArea())
{
SwTxtNode *pNd = pFrm->GetTxtNode();
- const ::sw::mark::IFieldmark* pFieldmark = NULL;
+ const ::sw::mark::IMark* pFieldmark = NULL;
if(pNd)
{
const SwDoc *doc=pNd->GetDoc();
@@ -1229,26 +1225,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
{
OutputDevice* pOutDev = (OutputDevice*)GetOut();
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list