You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2013/12/18 13:36:26 UTC
svn commit: r1551920 [2/5] - in /openoffice/branches/ooxml-osba/main: sw/
sw/inc/ sw/source/core/access/ sw/source/core/bastyp/ sw/source/core/crsr/
sw/source/core/doc/ sw/source/core/docnode/ sw/source/core/edit/
sw/source/core/fields/ sw/source/core/...
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx Wed Dec 18 12:36:23 2013
@@ -1764,14 +1764,15 @@ const String& SwHiddenParaField::GetPar1
--------------------------------------------------------------------*/
SwPostItFieldType::SwPostItFieldType(SwDoc *pDoc)
- : SwFieldType( RES_POSTITFLD ),mpDoc(pDoc)
+ : SwFieldType( RES_POSTITFLD )
+ , mpDoc(pDoc)
{}
/* ---------------------------------------------------------------------------
---------------------------------------------------------------------------*/
SwFieldType* SwPostItFieldType::Copy() const
{
- return new SwPostItFieldType(mpDoc);
+ return new SwPostItFieldType(mpDoc);
}
@@ -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;
}
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/fields/postithelper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/fields/postithelper.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/fields/postithelper.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/fields/postithelper.cxx Wed Dec 18 12:36:23 2013
@@ -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;
+ aRet = VISIBLE;
- if( aRet == INVISIBLE )
+ 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() );
+ 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;
- rInfo.insert( aInsPosIter, aInfo );
+ 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::getPageInf
SwPosition SwAnnotationItem::GetAnchorPosition() const
{
- SwTxtFld* pFld = pFmtFld->GetTxtFld();
- //if( pFld )
- //{
- SwTxtNode* pTNd = pFld->GetpTxtNode();
- // if( pTNd )
- // {
- SwPosition aPos( *pTNd );
- aPos.nContent.Assign( pTNd, *pFld->GetStart() );
- return aPos;
- // }
- //}
+ SwTxtFld* pTxtFld = mrFmtFld.GetTxtFld();
+ //if( pTxtFld )
+ //{
+ 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* SwAnno
return new sw::annotation::SwAnnotationWin( rEditWin, nBits,
aMgr, aBits,
*this,
- pFmtFld );
+ &mrFmtFld );
}
/*
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/fields/reffld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/fields/reffld.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/fields/reffld.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/fields/reffld.cxx Wed Dec 18 12:36:23 2013
@@ -310,16 +310,15 @@ void SwGetRefField::UpdateField( const S
nStt = 0;
break;
- case REF_ONLYCAPTION:
- {
+ case REF_ONLYCAPTION:
+ {
const SwTxtAttr* const pTxtAttr = pTxtNd->GetTxtAttrForCharAt(nStt, RES_TXTATR_FIELD);
- if( pTxtAttr )
- nStt = SwGetExpField::GetReferenceTextPos(
- pTxtAttr->GetFmtFld(), *pDoc );
- else if( nStt + 1 < nEnd )
- ++nStt;
- }
- break;
+ if( pTxtAttr != NULL )
+ nStt = SwGetExpField::GetReferenceTextPos( pTxtAttr->GetFmtFld(), *pDoc );
+ else if( nStt + 1 < nEnd )
+ ++nStt;
+ }
+ break;
case REF_ONLYSEQNO:
if( nStt + 1 < nEnd )
@@ -832,7 +831,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor
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();
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/frmedt/fefly1.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/frmedt/fefly1.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/frmedt/fefly1.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/frmedt/fefly1.cxx Wed Dec 18 12:36:23 2013
@@ -1483,9 +1483,8 @@ Size SwFEShell::RequestObjectResize( con
// 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();
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/inc/MarkManager.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/inc/MarkManager.hxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/inc/MarkManager.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/inc/MarkManager.hxx Wed Dec 18 12:36:23 2013
@@ -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;
};
}}
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/inc/UndoDelete.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/inc/UndoDelete.hxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/inc/UndoDelete.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/inc/UndoDelete.hxx Wed Dec 18 12:36:23 2013
@@ -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 & );
Added: openoffice/branches/ooxml-osba/main/sw/source/core/inc/annotationmark.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/inc/annotationmark.hxx?rev=1551920&view=auto
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/inc/annotationmark.hxx (added)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/inc/annotationmark.hxx Wed Dec 18 12:36:23 2013
@@ -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
Propchange: openoffice/branches/ooxml-osba/main/sw/source/core/inc/annotationmark.hxx
------------------------------------------------------------------------------
svn:executable = *
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/inc/crossrefbookmark.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/inc/crossrefbookmark.hxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/inc/crossrefbookmark.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/inc/crossrefbookmark.hxx Wed Dec 18 12:36:23 2013
@@ -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;
};
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/table/swtable.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/table/swtable.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/table/swtable.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/table/swtable.cxx Wed Dec 18 12:36:23 2013
@@ -2586,8 +2586,8 @@ sal_uLong SwTableBox::IsValidNumTxtNd( s
*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
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx Wed Dec 18 12:36:23 2013
@@ -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( con
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( con
{
OutputDevice* pOutDev = (OutputDevice*)GetOut();
pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
- bool bFilled = false;
- // If this is a comment range, need to look up the color of the comment author.
- if ( pFieldmark->GetFieldname().equalsAscii( ODF_COMMENTRANGE ) )
- {
- // Search for the position of the postit field
- const sal_Unicode fld[] = { CH_TXTATR_INWORD, 0 };
- xub_StrLen nEndIdx = GetTxt().SearchChar(fld, GetIdx());
- if (nEndIdx != STRING_NOTFOUND)
- {
- SwTxtAttr* pTxtAttr = pNd->GetTxtAttrForCharAt(nEndIdx, RES_TXTATR_FIELD);
- const SwFmtFld& rPostItField = pTxtAttr->GetFmtFld();
- // Look up the author name
- const rtl::OUString& rAuthor = rPostItField.GetField()->GetPar1();
- sal_uInt16 nIndex = pNd->GetDoc()->InsertRedlineAuthor(rAuthor);
- pOutDev->SetFillColor( SwPostItMgr::GetColorLight(nIndex) );
- bFilled = true;
- }
- }
- if (!bFilled)
- pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+ pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
pOutDev->SetLineColor( );
pOutDev->DrawRect( aIntersect.SVRect() );
pOutDev->Pop();
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/text/itratr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/text/itratr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/text/itratr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/text/itratr.cxx Wed Dec 18 12:36:23 2013
@@ -770,17 +770,20 @@ void SwTxtNode::GetMinMaxSize( sal_uLong
nAdd = 20;
break;
}
- case RES_TXTATR_FIELD :
- {
- SwField *pFld = (SwField*)pHint->GetFmtFld().GetField();
- const String aTxt = pFld->ExpandField(true);
- if( lcl_MinMaxString( aArg, aIter.GetFnt(), aTxt, 0,
- aTxt.Len() ) )
- nAdd = 20;
- break;
- }
- default: aArg.nWordWidth = nOldWidth;
- aArg.nWordAdd = nOldAdd;
+
+ case RES_TXTATR_FIELD :
+ case RES_TXTATR_ANNOTATION :
+ {
+ SwField *pFld = (SwField*)pHint->GetFmtFld().GetField();
+ const String aTxt = pFld->ExpandField(true);
+ if( lcl_MinMaxString( aArg, aIter.GetFnt(), aTxt, 0,
+ aTxt.Len() ) )
+ nAdd = 20;
+ break;
+ }
+
+ default: aArg.nWordWidth = nOldWidth;
+ aArg.nWordAdd = nOldAdd;
}
aIter.SeekAndChgAttrIter( ++nIdx, pOut );
@@ -959,37 +962,40 @@ sal_uInt16 SwTxtNode::GetScalingOfSelect
XubString sTmp( cChar );
SwDrawTextInfo aDrawInf( pSh, *pOut, 0, sTmp, 0, 1 );
nProWidth += aIter.GetFnt()->_GetTxtSize( aDrawInf ).Width();
- nIdx++;
+ nIdx++;
}
- else if ( pHint && ( cChar == CH_TXTATR_BREAKWORD || CH_TXTATR_INWORD ) )
- {
- switch( pHint->Which() )
- {
- case RES_TXTATR_FTN :
- {
- const XubString aTxt = pHint->GetFtn().GetNumStr();
+ else if ( pHint && ( cChar == CH_TXTATR_BREAKWORD || CH_TXTATR_INWORD ) )
+ {
+ switch( pHint->Which() )
+ {
+ case RES_TXTATR_FTN :
+ {
+ const XubString aTxt = pHint->GetFtn().GetNumStr();
SwDrawTextInfo aDrawInf( pSh, *pOut, 0, aTxt, 0, aTxt.Len() );
nProWidth += aIter.GetFnt()->_GetTxtSize( aDrawInf ).Width();
- break;
- }
- case RES_TXTATR_FIELD :
- {
- SwField *pFld = (SwField*)pHint->GetFmtFld().GetField();
+ break;
+ }
+
+ case RES_TXTATR_FIELD :
+ case RES_TXTATR_ANNOTATION :
+ {
+ SwField *pFld = (SwField*)pHint->GetFmtFld().GetField();
String const aTxt = pFld->ExpandField(true);
SwDrawTextInfo aDrawInf( pSh, *pOut, 0, aTxt, 0, aTxt.Len() );
nProWidth += aIter.GetFnt()->_GetTxtSize( aDrawInf ).Width();
- break;
- }
- default:
- {
- // any suggestions for a default action?
- }
- } // end of switch
- nIdx++;
- } // end of while
- }
+ break;
+ }
+
+ default:
+ {
+ // any suggestions for a default action?
+ }
+ } // end of switch
+ nIdx++;
+ } // end of while
+ }
nWidth = Max( nWidth, nProWidth );
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/text/pormulti.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/text/pormulti.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/text/pormulti.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/text/pormulti.cxx Wed Dec 18 12:36:23 2013
@@ -2261,24 +2261,26 @@ SwLinePortion* SwTxtFormatter::MakeRestP
if( pFld && !pFld->HasFollow() )
pFld = NULL;
- SwLinePortion *pRest = NULL;
- if( pFld )
- {
+ SwLinePortion *pRest = NULL;
+ if( pFld )
+ {
const SwTxtAttr *pHint = GetAttr( nPosition - 1 );
- if( pHint && pHint->Which() == RES_TXTATR_FIELD )
- {
- pRest = NewFldPortion( GetInfo(), pHint );
- if( pRest->InFldGrp() )
- ((SwFldPortion*)pRest)->TakeNextOffset( pFld );
- else
- {
- delete pRest;
- pRest = NULL;
- }
- }
- }
+ if ( pHint
+ && ( pHint->Which() == RES_TXTATR_FIELD
+ || pHint->Which() == RES_TXTATR_ANNOTATION ) )
+ {
+ pRest = NewFldPortion( GetInfo(), pHint );
+ if( pRest->InFldGrp() )
+ ((SwFldPortion*)pRest)->TakeNextOffset( pFld );
+ else
+ {
+ delete pRest;
+ pRest = NULL;
+ }
+ }
+ }
if( !pHelpMulti )
- return pRest;
+ return pRest;
nPosition = nMultiPos + pHelpMulti->GetLen();
SwMultiCreator* pCreate = GetInfo().GetMultiCreator( nMultiPos, 0 );
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/text/portxt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/text/portxt.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/text/portxt.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/text/portxt.cxx Wed Dec 18 12:36:23 2013
@@ -911,7 +911,7 @@ void SwHolePortion::HandlePortion( SwPor
void SwFieldMarkPortion::Paint( const SwTxtPaintInfo & /*rInf*/) const
{
// These shouldn't be painted!
- // SwTxtPortion::Paint(rInf);
+ //SwTxtPortion::Paint(rInf);
}
sal_Bool SwFieldMarkPortion::Format( SwTxtFormatInfo & )
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/text/txtfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/text/txtfld.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/text/txtfld.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/text/txtfld.cxx Wed Dec 18 12:36:23 2013
@@ -439,6 +439,7 @@ SwLinePortion *SwTxtFormatter::NewExtraP
break;
}
case RES_TXTATR_FIELD :
+ case RES_TXTATR_ANNOTATION :
{
pRet = NewFldPortion( rInf, pHint );
break;
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/text/txtfrm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/text/txtfrm.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/text/txtfrm.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/text/txtfrm.cxx Wed Dec 18 12:36:23 2013
@@ -1097,27 +1097,30 @@ void SwTxtFrm::Modify( const SfxPoolItem
SetCompletePaint();
}
break;
- case RES_TXTATR_FIELD:
- {
- nPos = *((SwFmtFld*)pNew)->GetTxtFld()->GetStart();
- if( IsIdxInside( nPos, 1 ) )
- {
- if( pNew == pOld )
- {
- // Nur repainten
- // opt: invalidate aufs Window ?
- InvalidatePage();
- SetCompletePaint();
- }
- else
- _InvalidateRange( SwCharRange( nPos, 1 ) );
- }
- bSetFldsDirty = sal_True;
- // ST2
- if ( SwSmartTagMgr::Get().IsSmartTagsEnabled() )
- SET_WRONG( nPos, nPos + 1, false )
- }
- break;
+
+ case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
+ {
+ nPos = *((SwFmtFld*)pNew)->GetTxtFld()->GetStart();
+ if( IsIdxInside( nPos, 1 ) )
+ {
+ if( pNew == pOld )
+ {
+ // Nur repainten
+ // opt: invalidate aufs Window ?
+ InvalidatePage();
+ SetCompletePaint();
+ }
+ else
+ _InvalidateRange( SwCharRange( nPos, 1 ) );
+ }
+ bSetFldsDirty = sal_True;
+ // ST2
+ if ( SwSmartTagMgr::Get().IsSmartTagsEnabled() )
+ SET_WRONG( nPos, nPos + 1, false )
+ }
+ break;
+
case RES_TXTATR_FTN :
{
nPos = *((SwFmtFtn*)pNew)->GetTxtFtn()->GetStart();
@@ -1131,12 +1134,11 @@ void SwTxtFrm::Modify( const SfxPoolItem
InvalidateLineNum();
SwAttrSet& rNewSet = *((SwAttrSetChg*)pNew)->GetChgSet();
- const SfxPoolItem* pItem;
+ const SfxPoolItem* pItem = 0;
int nClear = 0;
MSHORT nCount = rNewSet.Count();
- if( SFX_ITEM_SET == rNewSet.GetItemState( RES_TXTATR_FTN,
- sal_False, &pItem ))
+ if( SFX_ITEM_SET == rNewSet.GetItemState( RES_TXTATR_FTN, sal_False, &pItem ))
{
nPos = *((SwFmtFtn*)pItem)->GetTxtFtn()->GetStart();
if( IsIdxInside( nPos, 1 ) )
@@ -1145,27 +1147,24 @@ void SwTxtFrm::Modify( const SfxPoolItem
--nCount;
}
- if( SFX_ITEM_SET == rNewSet.GetItemState( RES_TXTATR_FIELD,
- sal_False, &pItem ))
- {
- nPos = *((SwFmtFld*)pItem)->GetTxtFld()->GetStart();
- if( IsIdxInside( nPos, 1 ) )
- {
- const SfxPoolItem& rOldItem = ((SwAttrSetChg*)pOld)->
- GetChgSet()->Get( RES_TXTATR_FIELD );
- if( pItem == &rOldItem )
- {
- // Nur repainten
- // opt: invalidate aufs Window ?
- InvalidatePage();
- SetCompletePaint();
- }
- else
- _InvalidateRange( SwCharRange( nPos, 1 ) );
- }
- nClear |= 0x02;
- --nCount;
- }
+ if( SFX_ITEM_SET == rNewSet.GetItemState( RES_TXTATR_FIELD, sal_False, &pItem ))
+ {
+ nPos = *((SwFmtFld*)pItem)->GetTxtFld()->GetStart();
+ if( IsIdxInside( nPos, 1 ) )
+ {
+ const SfxPoolItem& rOldItem =
+ ((SwAttrSetChg*)pOld)->GetChgSet()->Get( RES_TXTATR_FIELD );
+ if( pItem == &rOldItem )
+ {
+ InvalidatePage();
+ SetCompletePaint();
+ }
+ else
+ _InvalidateRange( SwCharRange( nPos, 1 ) );
+ }
+ nClear |= 0x02;
+ --nCount;
+ }
sal_Bool bLineSpace = SFX_ITEM_SET == rNewSet.GetItemState(
RES_PARATR_LINESPACING, sal_False ),
bRegister = SFX_ITEM_SET == rNewSet.GetItemState(
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/atrfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/atrfld.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/atrfld.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/atrfld.cxx Wed Dec 18 12:36:23 2013
@@ -27,6 +27,7 @@
#include "fldbas.hxx" // fuer FieldType
#include <fmtfld.hxx>
#include <txtfld.hxx>
+#include <txtannotationfld.hxx>
#include <docufld.hxx>
#include <doc.hxx>
@@ -68,12 +69,17 @@ SwFmtFld::SwFmtFld( const SwField &rFld
, mpField( rFld.CopyField() )
, mpTxtFld( NULL )
{
- // input field in-place editing
if ( GetField()->GetTyp()->Which() == RES_INPUTFLD )
{
+ // input field in-place editing
SetWhich( RES_TXTATR_INPUTFIELD );
dynamic_cast<SwInputField*>(GetField())->SetFmtFld( *this );
}
+ else if ( GetField()->GetTyp()->Which() == RES_POSTITFLD )
+ {
+ // text annotation field
+ SetWhich( RES_TXTATR_ANNOTATION );
+ }
}
// #i24434#
@@ -91,12 +97,17 @@ SwFmtFld::SwFmtFld( const SwFmtFld& rAtt
{
rAttr.GetField()->GetTyp()->Add(this);
mpField = rAttr.GetField()->CopyField();
- // input field in-place editing
if ( GetField()->GetTyp()->Which() == RES_INPUTFLD )
{
+ // input field in-place editing
SetWhich( RES_TXTATR_INPUTFIELD );
dynamic_cast<SwInputField*>(GetField())->SetFmtFld( *this );
}
+ else if ( GetField()->GetTyp()->Which() == RES_POSTITFLD )
+ {
+ // text annotation field
+ SetWhich( RES_TXTATR_ANNOTATION );
+ }
}
}
@@ -518,3 +529,47 @@ void SwTxtInputFld::UpdateTextNodeConten
SwIndex aIdx( &GetTxtNode(), nIdx );
GetTxtNode().ReplaceText( aIdx, nDelLen, rNewContent );
}
+
+
+
+
+// text annotation field
+SwTxtAnnotationFld::SwTxtAnnotationFld(
+ SwFmtFld & rAttr,
+ xub_StrLen const nStart )
+ : SwTxtFld( rAttr, nStart )
+{
+}
+
+SwTxtAnnotationFld::~SwTxtAnnotationFld()
+{
+}
+
+
+::sw::mark::IMark* SwTxtAnnotationFld::GetAnnotationMark(
+ SwDoc* pDoc ) const
+{
+ const SwPostItField* pPostItField = dynamic_cast<const SwPostItField*>(GetFmtFld().GetField());
+ ASSERT( pPostItField != NULL, "<SwTxtAnnotationFld::GetAnnotationMark()> - field missing" );
+ if ( pPostItField == NULL )
+ {
+ return NULL;
+ }
+
+ if ( pDoc == NULL )
+ {
+ pDoc = static_cast<const SwPostItFieldType*>(pPostItField->GetTyp())->GetDoc();
+ }
+ ASSERT( pDoc != NULL, "<SwTxtAnnotationFld::GetAnnotationMark()> - missing document" );
+ if ( pDoc == NULL )
+ {
+ return NULL;
+ }
+
+ IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess();
+ IDocumentMarkAccess::const_iterator_t pMark = pMarksAccess->findAnnotationMark( pPostItField->GetName() );
+ return pMark != pMarksAccess->getAnnotationMarksEnd()
+ ? pMark->get()
+ : NULL;
+}
+
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/ndtxt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/ndtxt.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/ndtxt.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/ndtxt.cxx Wed Dec 18 12:36:23 2013
@@ -1071,22 +1071,22 @@ void SwTxtNode::Update(
}
}
- const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
- for ( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
- ppMark != pMarkAccess->getMarksEnd();
- ppMark++ )
- {
- // Bookmarks must never grow to either side, when
- // editing (directly) to the left or right (#i29942#)!
- // And a bookmark with same start and end must remain
- // to the left of the inserted text (used in XML import).
- const ::sw::mark::IMark* const pMark = ppMark->get();
- const SwPosition* pEnd = &pMark->GetMarkEnd();
- SwIndex & rIdx = const_cast<SwIndex&>(pEnd->nContent);
- if( this == &pEnd->nNode.GetNode() &&
- rPos.GetIndex() == rIdx.GetIndex() )
- {
- rIdx.Assign( &aTmpIdxReg, rIdx.GetIndex() );
+ // Bookmarks must never grow to either side, when editing (directly) to the left or right (#i29942#)!
+ // And a bookmark with same start and end must remain to the left of the inserted text (used in XML import).
+ {
+ const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
+ for ( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
+ ppMark != pMarkAccess->getAllMarksEnd();
+ ppMark++ )
+ {
+ const ::sw::mark::IMark* const pMark = ppMark->get();
+ const SwPosition* pEnd = &pMark->GetMarkEnd();
+ SwIndex & rIdx = const_cast<SwIndex&>(pEnd->nContent);
+ if( this == &pEnd->nNode.GetNode() &&
+ rPos.GetIndex() == rIdx.GetIndex() )
+ {
+ rIdx.Assign( &aTmpIdxReg, rIdx.GetIndex() );
+ }
}
}
}
@@ -1320,6 +1320,10 @@ SwTxtFld* SwTxtNode::GetFldTxtAttrAt(
pTxtFld = dynamic_cast<SwTxtFld*>(GetTxtAttrForCharAt( nIndex, RES_TXTATR_FIELD ));
if ( pTxtFld == NULL )
{
+ pTxtFld = dynamic_cast<SwTxtFld*>(GetTxtAttrForCharAt( nIndex, RES_TXTATR_ANNOTATION ));
+ }
+ if ( pTxtFld == NULL )
+ {
pTxtFld =
dynamic_cast<SwTxtFld*>( GetTxtAttrAt(
nIndex,
@@ -1372,9 +1376,8 @@ void lcl_CopyHint(
// TabellenFormel muessen relativ kopiert werden.
case RES_TXTATR_FIELD :
- case RES_TXTATR_INPUTFIELD :
{
- if( pOtherDoc )
+ if( pOtherDoc != NULL )
{
static_cast<const SwTxtFld*>(pHt)->CopyTxtFld( static_cast<SwTxtFld*>(pNewHt) );
}
@@ -1389,14 +1392,23 @@ void lcl_CopyHint(
static_cast<const SwTxtFld*>(pHt)->GetTxtNode().FindTableNode();
if( pDstTblNd )
{
- SwTblField* const pTblFld = const_cast<SwTblField*>(
- static_cast<const SwTblField*>(pNewHt->GetFmtFld().GetField()));
+ SwTblField* const pTblFld =
+ const_cast<SwTblField*>(static_cast<const SwTblField*>(
+ pNewHt->GetFmtFld().GetField()));
pTblFld->PtrToBoxNm( &pDstTblNd->GetTable() );
}
}
}
break;
+ case RES_TXTATR_INPUTFIELD :
+ case RES_TXTATR_ANNOTATION :
+ if( pOtherDoc != NULL )
+ {
+ static_cast<const SwTxtFld*>(pHt)->CopyTxtFld( static_cast<SwTxtFld*>(pNewHt) );
+ }
+ break;
+
case RES_TXTATR_TOXMARK :
if( pOtherDoc && pDest && pDest->GetpSwpHints()
&& USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
@@ -1758,10 +1770,11 @@ void SwTxtNode::CopyText( SwTxtNode *con
}
else
{
- pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt - nDeletedDummyChars,
+ pNewHt = pDest->InsertItem(
+ pHt->GetAttr(),
+ nAttrStt - nDeletedDummyChars,
nAttrEnd - nDeletedDummyChars,
- nsSetAttrMode::SETATTR_NOTXTATRCHR
- | nsSetAttrMode::SETATTR_IS_COPY);
+ nsSetAttrMode::SETATTR_NOTXTATRCHR | nsSetAttrMode::SETATTR_IS_COPY);
if (pNewHt)
{
lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
@@ -2996,69 +3009,74 @@ long SwTxtNode::GetLeftMarginForTabCalcu
}
// <--
-void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt,
- xub_StrLen nEndPos, sal_Bool bExpandFlds ) const
+void SwTxtNode::Replace0xFF(
+ XubString& rTxt,
+ xub_StrLen& rTxtStt,
+ xub_StrLen nEndPos,
+ sal_Bool bExpandFlds ) const
{
- if( GetpSwpHints() )
- {
- sal_Unicode cSrchChr = CH_TXTATR_BREAKWORD;
- for( int nSrchIter = 0; 2 > nSrchIter; ++nSrchIter,
- cSrchChr = CH_TXTATR_INWORD )
- {
- xub_StrLen nPos = rTxt.Search( cSrchChr );
- while( STRING_NOTFOUND != nPos && nPos < nEndPos )
+ if( GetpSwpHints() )
+ {
+ sal_Unicode cSrchChr = CH_TXTATR_BREAKWORD;
+ for( int nSrchIter = 0; 2 > nSrchIter; ++nSrchIter, cSrchChr = CH_TXTATR_INWORD )
+ {
+ xub_StrLen nPos = rTxt.Search( cSrchChr );
+ while( STRING_NOTFOUND != nPos && nPos < nEndPos )
{
const SwTxtAttr* const pAttr =
GetTxtAttrForCharAt( rTxtStt + nPos );
- if( pAttr )
- {
- switch( pAttr->Which() )
- {
- case RES_TXTATR_FIELD:
- rTxt.Erase( nPos, 1 );
- if( bExpandFlds )
- {
+ if( pAttr )
+ {
+ switch( pAttr->Which() )
+ {
+ case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
+ rTxt.Erase( nPos, 1 );
+ if( bExpandFlds )
+ {
const XubString aExpand(
static_cast<SwTxtFld const*>(pAttr)->GetFmtFld().GetField()->ExpandField(true));
- rTxt.Insert( aExpand, nPos );
- nPos = nPos + aExpand.Len();
- nEndPos = nEndPos + aExpand.Len();
- rTxtStt = rTxtStt - aExpand.Len();
- }
- ++rTxtStt;
- break;
- case RES_TXTATR_FTN:
- rTxt.Erase( nPos, 1 );
- if( bExpandFlds )
- {
- const SwFmtFtn& rFtn = pAttr->GetFtn();
- XubString sExpand;
- if( rFtn.GetNumStr().Len() )
- sExpand = rFtn.GetNumStr();
- else if( rFtn.IsEndNote() )
- sExpand = GetDoc()->GetEndNoteInfo().aFmt.
- GetNumStr( rFtn.GetNumber() );
- else
- sExpand = GetDoc()->GetFtnInfo().aFmt.
- GetNumStr( rFtn.GetNumber() );
- rTxt.Insert( sExpand, nPos );
- nPos = nPos + sExpand.Len();
- nEndPos = nEndPos + sExpand.Len();
- rTxtStt = rTxtStt - sExpand.Len();
- }
- ++rTxtStt;
- break;
- default:
- rTxt.Erase( nPos, 1 );
- ++rTxtStt;
- }
- }
- else
- ++nPos, ++nEndPos;
- nPos = rTxt.Search( cSrchChr, nPos );
- }
- }
- }
+ rTxt.Insert( aExpand, nPos );
+ nPos = nPos + aExpand.Len();
+ nEndPos = nEndPos + aExpand.Len();
+ rTxtStt = rTxtStt - aExpand.Len();
+ }
+ ++rTxtStt;
+ break;
+
+ case RES_TXTATR_FTN:
+ rTxt.Erase( nPos, 1 );
+ if( bExpandFlds )
+ {
+ const SwFmtFtn& rFtn = pAttr->GetFtn();
+ XubString sExpand;
+ if( rFtn.GetNumStr().Len() )
+ sExpand = rFtn.GetNumStr();
+ else if( rFtn.IsEndNote() )
+ sExpand = GetDoc()->GetEndNoteInfo().aFmt.
+ GetNumStr( rFtn.GetNumber() );
+ else
+ sExpand = GetDoc()->GetFtnInfo().aFmt.
+ GetNumStr( rFtn.GetNumber() );
+ rTxt.Insert( sExpand, nPos );
+ nPos = nPos + sExpand.Len();
+ nEndPos = nEndPos + sExpand.Len();
+ rTxtStt = rTxtStt - sExpand.Len();
+ }
+ ++rTxtStt;
+ break;
+
+ default:
+ rTxt.Erase( nPos, 1 );
+ ++rTxtStt;
+ }
+ }
+ else
+ ++nPos, ++nEndPos;
+ nPos = rTxt.Search( cSrchChr, nPos );
+ }
+ }
+ }
}
/*************************************************************************
@@ -3170,28 +3188,29 @@ sal_Bool SwTxtNode::GetExpandTxt( SwTxtN
}
}
else if ( pHt->HasDummyChar() && (nAttrStartIdx >= nIdx) )
- {
- aDestIdx = nInsPos + nAttrStartIdx;
- switch( nWhich )
- {
- case RES_TXTATR_FIELD:
- {
+ {
+ aDestIdx = nInsPos + nAttrStartIdx;
+ switch( nWhich )
+ {
+ case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
+ {
XubString const aExpand(
static_cast<SwTxtFld const*>(pHt)->GetFmtFld().GetField()->ExpandField(true) );
- if( aExpand.Len() )
- {
- aDestIdx++; // dahinter einfuegen;
+ if( aExpand.Len() )
+ {
+ aDestIdx++; // dahinter einfuegen;
rDestNd.InsertText( aExpand, aDestIdx );
- aDestIdx = nInsPos + nAttrStartIdx;
- nInsPos = nInsPos + aExpand.Len();
+ aDestIdx = nInsPos + nAttrStartIdx;
+ nInsPos = nInsPos + aExpand.Len();
}
rDestNd.EraseText( aDestIdx, 1 );
- --nInsPos;
- }
- break;
+ --nInsPos;
+ }
+ break;
- case RES_TXTATR_FTN:
- {
+ case RES_TXTATR_FTN:
+ {
if ( bWithFtn )
{
const SwFmtFtn& rFtn = pHt->GetFtn();
@@ -3200,42 +3219,42 @@ sal_Bool SwTxtNode::GetExpandTxt( SwTxtN
sExpand = rFtn.GetNumStr();
else if( rFtn.IsEndNote() )
sExpand = GetDoc()->GetEndNoteInfo().aFmt.
- GetNumStr( rFtn.GetNumber() );
+ GetNumStr( rFtn.GetNumber() );
else
sExpand = GetDoc()->GetFtnInfo().aFmt.
- GetNumStr( rFtn.GetNumber() );
+ GetNumStr( rFtn.GetNumber() );
if( sExpand.Len() )
{
aDestIdx++; // insert behind
SvxEscapementItem aItem(
- SVX_ESCAPEMENT_SUPERSCRIPT );
- rDestNd.InsertItem(aItem,
- aDestIdx.GetIndex(),
- aDestIdx.GetIndex() );
- rDestNd.InsertText( sExpand, aDestIdx,
- IDocumentContentOperations::INS_EMPTYEXPAND);
+ SVX_ESCAPEMENT_SUPERSCRIPT );
+ rDestNd.InsertItem(
+ aItem,
+ aDestIdx.GetIndex(),
+ aDestIdx.GetIndex() );
+ rDestNd.InsertText( sExpand, aDestIdx, IDocumentContentOperations::INS_EMPTYEXPAND);
aDestIdx = nInsPos + nAttrStartIdx;
nInsPos = nInsPos + sExpand.Len();
}
}
rDestNd.EraseText( aDestIdx, 1 );
- --nInsPos;
- }
- break;
+ --nInsPos;
+ }
+ break;
- default:
+ default:
rDestNd.EraseText( aDestIdx, 1 );
- --nInsPos;
- }
- }
- }
- }
+ --nInsPos;
+ }
+ }
+ }
+ }
- if( bWithNum )
- {
- aDestIdx = nDestStt;
+ if( bWithNum )
+ {
+ aDestIdx = nDestStt;
rDestNd.InsertText( GetNumString(), aDestIdx );
- }
+ }
if ( nHiddenChrs > 0 )
{
@@ -3271,7 +3290,8 @@ const ModelToViewHelper::ConversionMap*
for ( sal_uInt16 i = 0; pSwpHints2 && i < pSwpHints2->Count(); ++i )
{
const SwTxtAttr* pAttr = (*pSwpHints2)[i];
- if ( RES_TXTATR_FIELD == pAttr->Which() )
+ if ( pAttr->Which() == RES_TXTATR_FIELD
+ || pAttr->Which() == RES_TXTATR_ANNOTATION )
{
const XubString aExpand(
static_cast<SwTxtFld const*>(pAttr)->GetFmtFld().GetField()->ExpandField(true));
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/thints.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/thints.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/thints.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/thints.cxx Wed Dec 18 12:36:23 2013
@@ -53,6 +53,7 @@
#include <txtrfmrk.hxx>
#include <txtftn.hxx>
#include <txtfld.hxx>
+#include <txtannotationfld.hxx>
#include <charatr.hxx>
#include <charfmt.hxx>
#include <frmfmt.hxx>
@@ -1046,12 +1047,21 @@ SwTxtAttr* MakeTxtAttr(
case RES_TXTATR_INETFMT:
pNew = new SwTxtINetFmt( (SwFmtINetFmt&)rNew, nStt, nEnd );
break;
+
case RES_TXTATR_FIELD:
pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt );
break;
+
+ case RES_TXTATR_ANNOTATION:
+ {
+ pNew = new SwTxtAnnotationFld( static_cast<SwFmtFld &>(rNew), nStt );
+ }
+ break;
+
case RES_TXTATR_INPUTFIELD:
pNew = new SwTxtInputFld( static_cast<SwFmtFld &>(rNew), nStt, nEnd );
break;
+
case RES_TXTATR_FLYCNT:
{
// erst hier wird das Frame-Format kopiert (mit Inhalt) !!
@@ -1137,6 +1147,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr*
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
case RES_TXTATR_INPUTFIELD:
if( !pDoc->IsInDtor() )
{
@@ -1211,16 +1222,24 @@ void SwTxtNode::DestroyAttr( SwTxtAttr*
* SwTxtNode::Insert()
*************************************************************************/
-SwTxtAttr*
-SwTxtNode::InsertItem( SfxPoolItem& rAttr,
- const xub_StrLen nStart, const xub_StrLen nEnd, const SetAttrMode nMode )
+SwTxtAttr* SwTxtNode::InsertItem(
+ SfxPoolItem& rAttr,
+ const xub_StrLen nStart,
+ const xub_StrLen nEnd,
+ const SetAttrMode nMode )
{
// character attributes will be inserted as automatic styles:
ASSERT( !isCHRATR(rAttr.Which()), "AUTOSTYLES - "
"SwTxtNode::InsertItem should not be called with character attributes");
- SwTxtAttr *const pNew = MakeTxtAttr( *GetDoc(), rAttr, nStart, nEnd,
- (nMode & nsSetAttrMode::SETATTR_IS_COPY) ? COPY : NEW, this );
+ SwTxtAttr *const pNew =
+ MakeTxtAttr(
+ *GetDoc(),
+ rAttr,
+ nStart,
+ nEnd,
+ (nMode & nsSetAttrMode::SETATTR_IS_COPY) ? COPY : NEW,
+ this );
if ( pNew )
{
@@ -2608,20 +2627,20 @@ bool SwpHints::CalcHiddenParaField()
m_bCalcHiddenParaField = false;
bool bOldHasHiddenParaField = m_bHasHiddenParaField;
bool bNewHasHiddenParaField = false;
- const sal_uInt16 nSize = Count();
- const SwTxtAttr *pTxtHt;
+ const sal_uInt16 nSize = Count();
+ const SwTxtAttr *pTxtHt;
- for( sal_uInt16 nPos = 0; nPos < nSize; ++nPos )
- {
- pTxtHt = (*this)[ nPos ];
- const sal_uInt16 nWhich = pTxtHt->Which();
+ for( sal_uInt16 nPos = 0; nPos < nSize; ++nPos )
+ {
+ pTxtHt = (*this)[ nPos ];
+ const sal_uInt16 nWhich = pTxtHt->Which();
- if( RES_TXTATR_FIELD == nWhich )
- {
- const SwFmtFld& rFld = pTxtHt->GetFmtFld();
+ if( RES_TXTATR_FIELD == nWhich )
+ {
+ const SwFmtFld& rFld = pTxtHt->GetFmtFld();
if( RES_HIDDENPARAFLD == rFld.GetField()->GetTyp()->Which() )
- {
- if( !((SwHiddenParaField*)rFld.GetField())->IsHidden() )
+ {
+ if( !((SwHiddenParaField*)rFld.GetField())->IsHidden() )
{
SetHiddenParaField(false);
return bOldHasHiddenParaField != bNewHasHiddenParaField;
@@ -2805,8 +2824,10 @@ void lcl_CheckSortNumber( const SwpHints
* overwritten.
* The return value indicates successful insertion.
*/
-bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode,
- const SetAttrMode nMode )
+bool SwpHints::TryInsertHint(
+ SwTxtAttr* const pHint,
+ SwTxtNode &rNode,
+ const SetAttrMode nMode )
{
if ( USHRT_MAX == Count() ) // we're sorry, this flight is overbooked...
{
@@ -2846,10 +2867,13 @@ bool SwpHints::TryInsertHint( SwTxtAttr*
break;
}
// <--
+
case RES_TXTATR_INETFMT:
static_cast<SwTxtINetFmt*>(pHint)->InitINetFmt(rNode);
- break;
+ break;
+
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
case RES_TXTATR_INPUTFIELD:
{
sal_Bool bDelFirst = 0 != ((SwTxtFld*)pHint)->GetpTxtNode();
@@ -2919,6 +2943,12 @@ bool SwpHints::TryInsertHint( SwTxtAttr*
case RES_POSTITFLD:
if ( pDoc->GetDocShell() )
pDoc->GetDocShell()->Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SWFMTFLD_INSERTED ) );
+ // For annotations on text ranges the corresponding annotation mark is created afterwards.
+ // Thus, if there is already an annotation mark, clear the annotation's name in order to cut the relation
+ if ( dynamic_cast< SwTxtAnnotationFld* >(pHint)->GetAnnotationMark( rNode.GetDoc() ) != NULL )
+ {
+ const_cast<SwPostItField*>(dynamic_cast< const SwPostItField* >(pHint->GetFmtFld().GetField()))->SetName( String() );
+ }
break;
}
if( bInsFldType )
@@ -3118,7 +3148,7 @@ void SwpHints::DeleteAtPos( const sal_uI
NoteInHistory( pHint );
SwpHintsArray::DeleteAtPos( nPos );
- if( RES_TXTATR_FIELD == pHint->Which() )
+ if( pHint->Which() == RES_TXTATR_FIELD )
{
const SwFieldType* pFldTyp = ((SwTxtFld*)pHint)->GetFmtFld().GetField()->GetTyp();
if( RES_DDEFLD == pFldTyp->Which() )
@@ -3128,16 +3158,16 @@ void SwpHints::DeleteAtPos( const sal_uI
((SwDDEFieldType*)pFldTyp)->DecRefCnt();
((SwTxtFld*)pHint)->ChgTxtNode( 0 );
}
- else if( RES_POSTITFLD == pFldTyp->Which() )
- {
- const_cast<SwFmtFld&>(((SwTxtFld*)pHint)->GetFmtFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SWFMTFLD_REMOVED ) );
- }
else if ( m_bHasHiddenParaField &&
RES_HIDDENPARAFLD == pFldTyp->Which() )
{
m_bCalcHiddenParaField = true;
}
}
+ else if ( pHint->Which() == RES_TXTATR_ANNOTATION )
+ {
+ const_cast<SwFmtFld&>(((SwTxtFld*)pHint)->GetFmtFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SWFMTFLD_REMOVED ) );
+ }
CalcFlags();
CHECK;
@@ -3172,6 +3202,7 @@ void SwTxtNode::ClearSwpHintsArr( bool b
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
case RES_TXTATR_INPUTFIELD:
if( bDelFields )
bDel = true;
@@ -3264,6 +3295,7 @@ sal_Unicode GetCharOfTxtAttr( const SwTx
case RES_TXTATR_TOXMARK:
case RES_TXTATR_META:
case RES_TXTATR_METAFIELD:
+ case RES_TXTATR_ANNOTATION:
cRet = CH_TXTATR_INWORD;
break;
@@ -3271,11 +3303,6 @@ sal_Unicode GetCharOfTxtAttr( const SwTx
case RES_TXTATR_FLYCNT:
{
cRet = CH_TXTATR_BREAKWORD;
-
- // #i78149: PostIt fields should not break words for spell and grammar checking
- if (rAttr.Which() == RES_TXTATR_FIELD &&
- RES_POSTITFLD == rAttr.GetFmtFld().GetField()->GetTyp()->Which())
- cRet = CH_TXTATR_INWORD;
}
break;
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/txtatr2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/txtatr2.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/txtatr2.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/txtnode/txtatr2.cxx Wed Dec 18 12:36:23 2013
@@ -308,7 +308,9 @@ SwTxtMeta::CreateTxtMeta(
::sw::MetaFieldManager & i_rTargetDocManager,
SwTxtNode *const i_pTargetTxtNode,
SwFmtMeta & i_rAttr,
- xub_StrLen const i_nStart, xub_StrLen const i_nEnd, bool const i_bIsCopy)
+ xub_StrLen const i_nStart,
+ xub_StrLen const i_nEnd,
+ bool const i_bIsCopy)
{
if (COPY == i_bIsCopy)
{ // i_rAttr is already cloned, now call DoCopy to copy the sw::Meta
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/undo/rolbck.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/undo/rolbck.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/undo/rolbck.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/undo/rolbck.cxx Wed Dec 18 12:36:23 2013
@@ -675,11 +675,13 @@ void SwHistoryBookmark::SetInDoc( SwDoc*
if(pPam.get())
{
- if(pMark)
- pMarkAccess->deleteMark(pMark);
- ::sw::mark::IBookmark* const pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(
- pMarkAccess->makeMark(*pPam, m_aName, m_eBkmkType));
- if(pBookmark)
+ if ( pMark != NULL )
+ {
+ pMarkAccess->deleteMark( pMark );
+ }
+ ::sw::mark::IBookmark* const pBookmark =
+ dynamic_cast< ::sw::mark::IBookmark* >( pMarkAccess->makeMark(*pPam, m_aName, m_eBkmkType) );
+ if ( pBookmark != NULL )
{
pBookmark->SetKeyCode(m_aKeycode);
pBookmark->SetShortName(m_aShortName);
@@ -835,6 +837,7 @@ SwHistoryResetAttrSet::SwHistoryResetAtt
case RES_TXTATR_TOXMARK:
if (m_nStart != m_nEnd) break; // else: fall through!
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
case RES_TXTATR_FLYCNT:
case RES_TXTATR_FTN:
case RES_TXTATR_META:
@@ -1042,7 +1045,9 @@ void SwHistory::Add( const SfxPoolItem*
ASSERT( !m_nEndDiff, "History was not deleted after REDO" );
sal_uInt16 nWhich = pNewValue->Which();
- if( (nWhich >= POOLATTR_END) || (nWhich == RES_TXTATR_FIELD) )
+ if( (nWhich >= POOLATTR_END)
+ || (nWhich == RES_TXTATR_FIELD)
+ || (nWhich == RES_TXTATR_ANNOTATION) )
return;
// no default Attribute?
@@ -1079,6 +1084,7 @@ void SwHistory::Add( SwTxtAttr* pHint, s
->GetFlyCnt().GetFrmFmt() );
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
pHt = new SwHistorySetTxtFld(
static_cast<SwTxtFld*>(pHint), nNodeIdx );
break;
@@ -1313,6 +1319,7 @@ void SwHistory::CopyAttr(
switch( pHt->Which() )
{
case RES_TXTATR_FIELD:
+ case RES_TXTATR_ANNOTATION:
case RES_TXTATR_INPUTFIELD:
if( !bCopyFields )
bNextAttr = sal_True;
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/undo/unattr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/undo/unattr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/undo/unattr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/undo/unattr.cxx Wed Dec 18 12:36:23 2013
@@ -881,7 +881,7 @@ void SwUndoAttr::UndoImpl(::sw::UndoRedo
const bool bToLast = (1 == m_AttrSet.Count())
&& (RES_TXTATR_FIELD <= *m_AttrSet.GetRanges())
- && (*m_AttrSet.GetRanges() <= RES_TXTATR_FTN);
+ && (*m_AttrSet.GetRanges() <= RES_TXTATR_ANNOTATION);
// restore old values
m_pHistory->TmpRollback( pDoc, 0, !bToLast );
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/undo/unbkmk.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/undo/unbkmk.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/undo/unbkmk.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/undo/unbkmk.cxx Wed Dec 18 12:36:23 2013
@@ -57,10 +57,9 @@ void SwUndoBookmark::SetInDoc( SwDoc* pD
void SwUndoBookmark::ResetInDoc( SwDoc* pDoc )
{
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
- for (IDocumentMarkAccess::const_iterator_t ppBkmk =
- pMarkAccess->getMarksBegin();
- ppBkmk != pMarkAccess->getMarksEnd();
- ++ppBkmk)
+ for ( IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getAllMarksBegin();
+ ppBkmk != pMarkAccess->getAllMarksEnd();
+ ++ppBkmk )
{
if ( m_pHistoryBookmark->IsEqualBookmark( **ppBkmk ) )
{
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/undo/undel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/undo/undel.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/undo/undel.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/undo/undel.cxx Wed Dec 18 12:36:23 2013
@@ -106,13 +106,30 @@ section and the end paragraph not. Then
record this in nSectDiff.
*/
-SwUndoDelete::SwUndoDelete( SwPaM& rPam, sal_Bool bFullPara, sal_Bool bCalledByTblCpy )
- : SwUndo(UNDO_DELETE), SwUndRng( rPam ),
- pMvStt( 0 ), pSttStr(0), pEndStr(0), pRedlData(0), pRedlSaveData(0),
- nNode(0), nNdDiff(0), nSectDiff(0), nReplaceDummy(0), nSetPos(0),
- bGroup( sal_False ), bBackSp( sal_False ), bJoinNext( sal_False ), bTblDelLastNd( sal_False ),
- bDelFullPara( bFullPara ), bResetPgDesc( sal_False ), bResetPgBrk( sal_False ),
- bFromTableCopy( bCalledByTblCpy )
+SwUndoDelete::SwUndoDelete(
+ SwPaM& rPam,
+ sal_Bool bFullPara,
+ sal_Bool bCalledByTblCpy )
+ : SwUndo(UNDO_DELETE)
+ , SwUndRng( rPam )
+ , pMvStt( 0 )
+ , pSttStr(0)
+ , pEndStr(0)
+ , pRedlData(0)
+ , pRedlSaveData(0)
+ , nNode(0)
+ , nNdDiff(0)
+ , nSectDiff(0)
+ , nReplaceDummy(0)
+ , nSetPos(0)
+ , bGroup( sal_False )
+ , bBackSp( sal_False )
+ , bJoinNext( sal_False )
+ , bTblDelLastNd( sal_False )
+ , bDelFullPara( bFullPara )
+ , bResetPgDesc( sal_False )
+ , bResetPgBrk( sal_False )
+ , bFromTableCopy( bCalledByTblCpy )
{
bDelFullPara = bFullPara; // This is set e.g. if an empty paragraph before a table is deleted
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/undo/undobj.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/undo/undobj.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/undo/undobj.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/undo/undobj.cxx Wed Dec 18 12:36:23 2013
@@ -762,112 +762,121 @@ void SwUndoSaveCntnt::DelCntntIndex( con
}
}
- // 3. Bookmarks
+ // 3. Bookmarks
if( nsDelCntntType::DELCNT_BKM & nDelCntntType )
- {
+ {
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
- if( pMarkAccess->getMarksCount() )
- {
+ if( pMarkAccess->getAllMarksCount() )
+ {
- for( sal_uInt16 n = 0; n < pMarkAccess->getMarksCount(); ++n )
- {
- // --> OD 2007-10-17 #i81002#
+ for( sal_uInt16 n = 0; n < pMarkAccess->getAllMarksCount(); ++n )
+ {
bool bSavePos = false;
bool bSaveOtherPos = false;
- const ::sw::mark::IMark* pBkmk = (pMarkAccess->getMarksBegin() + n)->get();
+ const ::sw::mark::IMark* pBkmk = (pMarkAccess->getAllMarksBegin() + n)->get();
+
if( nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType )
{
- if( pStt->nNode <= pBkmk->GetMarkPos().nNode &&
- pBkmk->GetMarkPos().nNode < pEnd->nNode )
+ if ( pStt->nNode <= pBkmk->GetMarkPos().nNode
+ && pBkmk->GetMarkPos().nNode < pEnd->nNode )
+ {
bSavePos = true;
- if( pBkmk->IsExpanded() &&
- pStt->nNode <= pBkmk->GetOtherMarkPos().nNode &&
- pBkmk->GetOtherMarkPos().nNode < pEnd->nNode )
+ }
+ if ( pBkmk->IsExpanded()
+ && pStt->nNode <= pBkmk->GetOtherMarkPos().nNode
+ && pBkmk->GetOtherMarkPos().nNode < pEnd->nNode )
+ {
bSaveOtherPos = true;
+ }
}
else
{
- // --> OD 2009-08-06 #i92125#
- bool bKeepCrossRefBkmk( false );
+ // keep cross-reference bookmarks, if content inside one paragraph is deleted.
+ if ( rMark.nNode == rPoint.nNode
+ && ( IDocumentMarkAccess::GetType(*pBkmk) == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK
+ || IDocumentMarkAccess::GetType(*pBkmk) == IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
{
- if ( rMark.nNode == rPoint.nNode &&
- ( IDocumentMarkAccess::GetType(*pBkmk) ==
- IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK ||
- IDocumentMarkAccess::GetType(*pBkmk) ==
- IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
- {
- bKeepCrossRefBkmk = true;
- }
+ continue;
+ }
+
+ bool bMaybe = false;
+ if ( *pStt <= pBkmk->GetMarkPos() && pBkmk->GetMarkPos() <= *pEnd )
+ {
+ if ( pBkmk->GetMarkPos() == *pEnd
+ || ( *pStt == pBkmk->GetMarkPos() && pBkmk->IsExpanded() ) )
+ bMaybe = true;
+ else
+ bSavePos = true;
}
- if ( !bKeepCrossRefBkmk )
+ if( pBkmk->IsExpanded() &&
+ *pStt <= pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() <= *pEnd )
{
- bool bMaybe = false;
- if ( *pStt <= pBkmk->GetMarkPos() && pBkmk->GetMarkPos() <= *pEnd )
+ if ( bSavePos || bSaveOtherPos
+ || ( pBkmk->GetOtherMarkPos() < *pEnd && pBkmk->GetOtherMarkPos() > *pStt ) )
{
- if( pBkmk->GetMarkPos() == *pEnd ||
- ( *pStt == pBkmk->GetMarkPos() && pBkmk->IsExpanded() ) )
- bMaybe = true;
- else
+ if( bMaybe )
bSavePos = true;
+ bSaveOtherPos = true;
}
- if( pBkmk->IsExpanded() &&
- *pStt <= pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() <= *pEnd )
+ }
+
+ if ( !bSavePos && !bSaveOtherPos
+ && dynamic_cast< const ::sw::mark::CrossRefBookmark* >(pBkmk) )
+ {
+ // certain special handling for cross-reference bookmarks
+ const bool bDifferentTxtNodesAtMarkAndPoint =
+ rMark.nNode != rPoint.nNode
+ && rMark.nNode.GetNode().GetTxtNode()
+ && rPoint.nNode.GetNode().GetTxtNode();
+ if ( bDifferentTxtNodesAtMarkAndPoint )
{
- if( bSavePos || bSaveOtherPos ||
- ( pBkmk->GetOtherMarkPos() < *pEnd && pBkmk->GetOtherMarkPos() > *pStt ) )
+ // delete cross-reference bookmark at <pStt>, if only part of
+ // <pEnd> text node content is deleted.
+ if( pStt->nNode == pBkmk->GetMarkPos().nNode
+ && pEnd->nContent.GetIndex() != pEnd->nNode.GetNode().GetTxtNode()->Len() )
+ {
+ bSavePos = true;
+ bSaveOtherPos = false; // cross-reference bookmarks are not expanded
+ }
+ // delete cross-reference bookmark at <pEnd>, if only part of
+ // <pStt> text node content is deleted.
+ else if( pEnd->nNode == pBkmk->GetMarkPos().nNode &&
+ pStt->nContent.GetIndex() != 0 )
{
- if( bMaybe )
- bSavePos = true;
- bSaveOtherPos = true;
+ bSavePos = true;
+ bSaveOtherPos = false; // cross-reference bookmarks are not expanded
}
}
}
- // <--
-
- // --> OD 2007-10-17 #i81002#
- const bool bDifferentTxtNodesAtMarkAndPoint(
- rMark.nNode != rPoint.nNode &&
- rMark.nNode.GetNode().GetTxtNode() &&
- rPoint.nNode.GetNode().GetTxtNode() );
- // <--
- if( !bSavePos && !bSaveOtherPos && bDifferentTxtNodesAtMarkAndPoint &&
- dynamic_cast< const ::sw::mark::CrossRefBookmark* >(pBkmk))
+ else if ( IDocumentMarkAccess::GetType(*pBkmk) == IDocumentMarkAccess::ANNOTATIONMARK )
{
- // delete cross-reference bookmark at <pStt>, if only part of
- // <pEnd> text node content is deleted.
- if( pStt->nNode == pBkmk->GetMarkPos().nNode &&
- pEnd->nContent.GetIndex() !=
- pEnd->nNode.GetNode().GetTxtNode()->Len() )
- {
- bSavePos = true;
- bSaveOtherPos = false;
- }
- // delete cross-reference bookmark at <pEnd>, if only part of
- // <pStt> text node content is deleted.
- else if( pEnd->nNode == pBkmk->GetMarkPos().nNode &&
- pStt->nContent.GetIndex() != 0 )
+ // delete annotation marks, if its end position is covered by the deletion
+ const SwPosition& rAnnotationEndPos = pBkmk->GetMarkEnd();
+ if ( *pStt <= rAnnotationEndPos && rAnnotationEndPos <= *pEnd )
{
bSavePos = true;
- bSaveOtherPos = false;
+ bSaveOtherPos = true;
}
}
}
- if( bSavePos || bSaveOtherPos )
- {
- if( !pHistory )
- pHistory = new SwHistory;
-
- pHistory->Add( *pBkmk, bSavePos, bSaveOtherPos );
- if(bSavePos &&
- (bSaveOtherPos || !pBkmk->IsExpanded()))
+
+ if ( bSavePos || bSaveOtherPos )
+ {
+ if( !pHistory )
+ pHistory = new SwHistory;
+
+ pHistory->Add( *pBkmk, bSavePos, bSaveOtherPos );
+ if ( bSavePos
+ && ( bSaveOtherPos
+ || !pBkmk->IsExpanded() ) )
{
- pMarkAccess->deleteMark(pMarkAccess->getMarksBegin()+n);
+ pMarkAccess->deleteMark(pMarkAccess->getAllMarksBegin()+n);
n--;
}
- }
- }
- }
- }
+ }
+ }
+ }
+ }
}
Modified: openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unobkm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unobkm.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unobkm.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unobkm.cxx Wed Dec 18 12:36:23 2013
@@ -110,8 +110,7 @@ void SwXBookmark::Impl::registerInMark(
if (pBkmk)
{
pBkmk->Add(this);
- ::sw::mark::MarkBase *const pMarkBase(
- dynamic_cast< ::sw::mark::MarkBase * >(pBkmk));
+ ::sw::mark::MarkBase *const pMarkBase(dynamic_cast< ::sw::mark::MarkBase * >(pBkmk));
OSL_ENSURE(pMarkBase, "registerInMark: no MarkBase?");
if (pMarkBase)
{
@@ -133,7 +132,9 @@ const ::sw::mark::IMark* SwXBookmark::Ge
return m_pImpl->m_pRegisteredBookmark;
}
-SwXBookmark::SwXBookmark(::sw::mark::IMark *const pBkmk, SwDoc *const pDoc)
+SwXBookmark::SwXBookmark(
+ ::sw::mark::IMark *const pBkmk,
+ SwDoc *const pDoc)
: m_pImpl( new SwXBookmark::Impl(*this, pDoc, pBkmk) )
{
}
@@ -147,21 +148,21 @@ SwXBookmark::~SwXBookmark()
{
}
-uno::Reference<text::XTextContent>
-SwXBookmark::CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark)
+uno::Reference<text::XTextContent> SwXBookmark::CreateXBookmark(
+ SwDoc & rDoc,
+ ::sw::mark::IMark & rBookmark)
{
// #i105557#: do not iterate over the registered clients: race condition
- ::sw::mark::MarkBase *const pMarkBase(
- dynamic_cast< ::sw::mark::MarkBase * >(&rBookmark));
+ ::sw::mark::MarkBase *const pMarkBase(dynamic_cast< ::sw::mark::MarkBase * >(&rBookmark));
OSL_ENSURE(pMarkBase, "CreateXBookmark: no MarkBase?");
if (!pMarkBase) { return 0; }
uno::Reference<text::XTextContent> xBookmark(pMarkBase->GetXBookmark());
if (!xBookmark.is())
{
OSL_ENSURE(
- dynamic_cast< ::sw::mark::IBookmark* >(&rBookmark),
+ dynamic_cast< ::sw::mark::IBookmark* >(&rBookmark) || IDocumentMarkAccess::GetType(rBookmark) == IDocumentMarkAccess::ANNOTATIONMARK,
"<SwXBookmark::GetObject(..)>"
- "SwXBookmark requested for non-bookmark mark.");
+ "SwXBookmark requested for non-bookmark mark and non-annotation mark.");
SwXBookmark *const pXBookmark = new SwXBookmark(&rBookmark, &rDoc);
xBookmark.set(pXBookmark);
pXBookmark->registerInMark( pMarkBase);
@@ -193,8 +194,7 @@ const uno::Sequence< sal_Int8 > & SwXBoo
return aSeq;
}
-sal_Int64 SAL_CALL
-SwXBookmark::getSomething(const uno::Sequence< sal_Int8 >& rId)
+sal_Int64 SAL_CALL SwXBookmark::getSomething( const uno::Sequence< sal_Int8 >& rId )
throw (uno::RuntimeException)
{
return ::sw::UnoTunnelImpl<SwXBookmark>(rId, this);
@@ -260,23 +260,21 @@ throw (lang::IllegalArgumentException, u
}
}
-void SwXBookmark::attachToRange(
- const uno::Reference< text::XTextRange > & xTextRange)
+void SwXBookmark::attachToRange( const uno::Reference< text::XTextRange > & xTextRange )
throw (lang::IllegalArgumentException, uno::RuntimeException)
{
attachToRangeEx(xTextRange, IDocumentMarkAccess::BOOKMARK);
}
-void SAL_CALL
-SwXBookmark::attach(const uno::Reference< text::XTextRange > & xTextRange)
+void SAL_CALL SwXBookmark::attach( const uno::Reference< text::XTextRange > & xTextRange )
throw (lang::IllegalArgumentException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
attachToRange( xTextRange );
}
-uno::Reference< text::XTextRange > SAL_CALL
-SwXBookmark::getAnchor() throw (uno::RuntimeException)
+uno::Reference< text::XTextRange > SAL_CALL SwXBookmark::getAnchor()
+throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -291,13 +289,13 @@ SwXBookmark::getAnchor() throw (uno::Run
? &m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos() : NULL);
}
-void SAL_CALL SwXBookmark::dispose() throw (uno::RuntimeException)
+void SAL_CALL SwXBookmark::dispose()
+throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
if (m_pImpl->m_pRegisteredBookmark)
{
- m_pImpl->m_pDoc->getIDocumentMarkAccess()->deleteMark(
- m_pImpl->m_pRegisteredBookmark);
+ m_pImpl->m_pDoc->getIDocumentMarkAccess()->deleteMark( m_pImpl->m_pRegisteredBookmark );
}
}
@@ -352,7 +350,7 @@ throw (uno::RuntimeException)
}
IDocumentMarkAccess *const pMarkAccess =
m_pImpl->m_pDoc->getIDocumentMarkAccess();
- if(pMarkAccess->findMark(rName) != pMarkAccess->getMarksEnd())
+ if(pMarkAccess->findMark(rName) != pMarkAccess->getAllMarksEnd())
{
throw uno::RuntimeException();
}