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 [4/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/ui/docvw/PostItMgr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/PostItMgr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/PostItMgr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/PostItMgr.cxx Wed Dec 18 12:36:23 2013
@@ -51,6 +51,7 @@
#include <docufld.hxx>
#include <edtwin.hxx>
#include <txtfld.hxx>
+#include <txtannotationfld.hxx>
#include <ndtxt.hxx>
#include <redline.hxx>
#include <docary.hxx>
@@ -93,34 +94,11 @@
using namespace sw::sidebarwindows;
-/*
-bool comp_author( const SwPostItItem* a, const SwPostItItem* b)
-{
- return a->pFmtFld->GetFld()->GetPar1() < b->pFmtFld->GetFld()->GetPar1();
-}
-bool comp_date( const SwPostItItem* a, const SwPostItItem* b)
-{
- return static_cast<SwPostItField*>(a->pFmtFld->GetFld())->GetDate() < static_cast<SwPostItField*>(b->pFmtFld->GetFld())->GetDate();
-}
-*/
-
-//
bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b)
{
- // --> OD 2010-01-19 #i88070#
// sort by anchor position
-//// if position is on the same line, sort by x (Left) position, otherwise by y(Bottom) position
-//// if two notes are at the same position, sort by logical node position
-// return (a->maLayoutInfo.mPosition.Bottom() == b->maLayoutInfo.mPosition.Bottom())
-// ? ( ( (a->maLayoutInfo.mPosition.Left() == b->maLayoutInfo.mPosition.Left()) &&
-// (a->GetBroadCaster()->ISA(SwFmtFld) && b->GetBroadCaster()->ISA(SwFmtFld)) )
-// ? *(static_cast<SwFmtFld*>(a->GetBroadCaster())->GetTxtFld()->GetStart()) <
-// *(static_cast<SwFmtFld*>(b->GetBroadCaster())->GetTxtFld()->GetStart())
-// : a->maLayoutInfo.mPosition.Left() < b->maLayoutInfo.mPosition.Left() )
-// : a->maLayoutInfo.mPosition.Bottom() < b->maLayoutInfo.mPosition.Bottom();
return a->GetAnchorPosition() < b->GetAnchorPosition();
- // <--
}
SwPostItMgr::SwPostItMgr(SwView* pView)
@@ -226,7 +204,7 @@ void SwPostItMgr::InsertItem(SfxBroadcas
}
mbLayout = bFocus;
if (pItem->ISA(SwFmtFld))
- mvPostItFlds.push_back(new SwAnnotationItem(static_cast<SwFmtFld*>(pItem), true, bFocus) );
+ mvPostItFlds.push_back(new SwAnnotationItem(static_cast<SwFmtFld&>(*pItem), true, bFocus) );
/*
else
if (pItem->ISA(SwRedline))
@@ -407,33 +385,36 @@ void SwPostItMgr::Notify( SfxBroadcaster
}
break;
}
- case SWFMTFLD_LANGUAGE:
- {
- SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
- for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
- {
- if ( pFmtFld == (*i)->GetBroadCaster() )
- {
- if ((*i)->pPostIt)
- {
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld()->GetField()->GetLanguage() );
- sal_uInt16 nLangWhichId = 0;
- switch (nScriptType)
- {
- case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break;
- case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
- }
- (*i)->pPostIt->SetLanguage( SvxLanguageItem((*i)->GetFmtFld()->GetField()->GetLanguage(),
- nLangWhichId) );
- }
- break;
- }
- }
- break;
- }
- }
- }
+
+ case SWFMTFLD_LANGUAGE:
+ {
+ SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( pFmtFld == (*i)->GetBroadCaster() )
+ {
+ if ((*i)->pPostIt)
+ {
+ const sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld().GetField()->GetLanguage() );
+ sal_uInt16 nLangWhichId = 0;
+ switch (nScriptType)
+ {
+ case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break;
+ case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ }
+ (*i)->pPostIt->SetLanguage(
+ SvxLanguageItem(
+ (*i)->GetFmtFld().GetField()->GetLanguage(),
+ nLangWhichId) );
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
}
void SwPostItMgr::Focus(SfxBroadcaster& rBC)
@@ -465,105 +446,120 @@ void SwPostItMgr::Focus(SfxBroadcaster&
bool SwPostItMgr::CalcRects()
{
- if ( mnEventId )
- {
- // if CalcRects() was forced and an event is still pending: remove it
- // it is superfluous and also may cause reentrance problems if triggered while layouting
- Application::RemoveUserEvent( mnEventId );
- mnEventId = 0;
- }
+ if ( mnEventId )
+ {
+ // if CalcRects() was forced and an event is still pending: remove it
+ // it is superfluous and also may cause reentrance problems if triggered while layouting
+ Application::RemoveUserEvent( mnEventId );
+ mnEventId = 0;
+ }
- bool bChange = false;
- bool bRepair = false;
- PreparePageContainer();
- if ( !mvPostItFlds.empty() )
- {
+ bool bChange = false;
+ bool bRepair = false;
+ PreparePageContainer();
+ if ( !mvPostItFlds.empty() )
+ {
for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
- {
+ {
SwSidebarItem* pItem = (*i);
- if ( !pItem->UseElement() )
- {
- DBG_ERROR("PostIt is not in doc or other wrong use");
- bRepair = true;
- continue;
- }
-
- //save old rect and visible state
- SwRect aOldRect(pItem->maLayoutInfo.mPosition);
- SwPostItHelper::SwLayoutStatus eOldStatus = pItem->mLayoutStatus;
- std::vector< SwLayoutInfo > aInfo;
+ if ( !pItem->UseElement() )
{
- SwPosition aPosition = pItem->GetAnchorPosition();
- pItem->mLayoutStatus = SwPostItHelper::getLayoutInfos( aInfo, aPosition );
+ DBG_ERROR("PostIt is not in doc or other wrong use");
+ bRepair = true;
+ continue;
}
- if( aInfo.size() )
- {
- pItem->maLayoutInfo = aInfo[0];
+
+ const SwRect aOldAnchorRect( pItem->maLayoutInfo.mPosition );
+ const SwPostItHelper::SwLayoutStatus eOldLayoutStatus = pItem->mLayoutStatus;
+ const sal_uLong nOldStartNodeIdx( pItem->maLayoutInfo.mnStartNodeIdx );
+ const xub_StrLen nOldStartContent( pItem->maLayoutInfo.mnStartContent );
+
+ {
+ // update layout information
+ const SwTxtAnnotationFld* pTxtAnnotationFld =
+ dynamic_cast< const SwTxtAnnotationFld* >( pItem->GetFmtFld().GetTxtFld() );
+ const ::sw::mark::IMark* pAnnotationMark =
+ pTxtAnnotationFld != NULL ? pTxtAnnotationFld->GetAnnotationMark() : NULL;
+ if ( pAnnotationMark != NULL )
+ {
+ pItem->mLayoutStatus =
+ SwPostItHelper::getLayoutInfos(
+ pItem->maLayoutInfo,
+ pItem->GetAnchorPosition(),
+ &pAnnotationMark->GetMarkStart() );
+ }
+ else
+ {
+ pItem->mLayoutStatus =
+ SwPostItHelper::getLayoutInfos( pItem->maLayoutInfo, pItem->GetAnchorPosition() );
+ }
}
- bChange = bChange ||
- ( pItem->maLayoutInfo.mPosition != aOldRect ) ||
- ( eOldStatus != pItem->mLayoutStatus );
- }
+ bChange = bChange
+ || pItem->maLayoutInfo.mPosition != aOldAnchorRect
+ || pItem->mLayoutStatus != eOldLayoutStatus
+ || pItem->maLayoutInfo.mnStartNodeIdx != nOldStartNodeIdx
+ || pItem->maLayoutInfo.mnStartContent != nOldStartContent;
+ }
- // show notes in right order in navigator
+ // show notes in right order in navigator
//prevent Anchors during layout to overlap, e.g. when moving a frame
- Sort(SORT_POS);
+ Sort(SORT_POS);
- // sort the items into the right page vector, so layout can be done by page
+ // sort the items into the right page vector, so layout can be done by page
for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
- {
+ {
SwSidebarItem* pItem = (*i);
- if( SwPostItHelper::INVISIBLE == pItem->mLayoutStatus )
- {
- if (pItem->pPostIt)
- pItem->pPostIt->HideNote();
- continue;
- }
+ if( SwPostItHelper::INVISIBLE == pItem->mLayoutStatus )
+ {
+ if (pItem->pPostIt)
+ pItem->pPostIt->HideNote();
+ continue;
+ }
- if( SwPostItHelper::HIDDEN == pItem->mLayoutStatus )
- {
- if (!mpWrtShell->GetViewOptions()->IsShowHiddenChar())
- {
- if (pItem->pPostIt)
- pItem->pPostIt->HideNote();
- continue;
- }
- }
+ if( SwPostItHelper::HIDDEN == pItem->mLayoutStatus )
+ {
+ if (!mpWrtShell->GetViewOptions()->IsShowHiddenChar())
+ {
+ if (pItem->pPostIt)
+ pItem->pPostIt->HideNote();
+ continue;
+ }
+ }
const unsigned long aPageNum = pItem->maLayoutInfo.mnPageNumber;
- if (aPageNum > mPages.size())
- {
+ if (aPageNum > mPages.size())
+ {
const unsigned long nNumberOfPages = mPages.size();
- for (unsigned int j=0; j<aPageNum - nNumberOfPages; ++j)
- mPages.push_back( new SwPostItPageItem());
- }
- mPages[aPageNum-1]->mList->push_back(pItem);
+ for (unsigned int j=0; j<aPageNum - nNumberOfPages; ++j)
+ mPages.push_back( new SwPostItPageItem());
+ }
+ mPages[aPageNum-1]->mList->push_back(pItem);
mPages[aPageNum-1]->mPageRect = pItem->maLayoutInfo.mPageFrame;
mPages[aPageNum-1]->eSidebarPosition = pItem->maLayoutInfo.meSidebarPosition;
- }
+ }
- if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
- {
+ if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
+ {
long nLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() );
- if( nLayoutHeight > mbLayoutHeight )
- {
- if (mPages[0]->bScrollbar || HasScrollbars())
- bChange = true;
- }
+ if( nLayoutHeight > mbLayoutHeight )
+ {
+ if (mPages[0]->bScrollbar || HasScrollbars())
+ bChange = true;
+ }
else if( nLayoutHeight < mbLayoutHeight )
- {
- if (mPages[0]->bScrollbar || !BorderOverPageBorder(1))
- bChange = true;
- }
- }
- }
+ {
+ if (mPages[0]->bScrollbar || !BorderOverPageBorder(1))
+ bChange = true;
+ }
+ }
+ }
- if ( bRepair )
- CheckForRemovedPostIts();
+ if ( bRepair )
+ CheckForRemovedPostIts();
- mbLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() );
- mbWaitingForCalcRects = false;
- return bChange;
+ mbLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() );
+ mbWaitingForCalcRects = false;
+ return bChange;
}
bool SwPostItMgr::HasScrollbars() const
@@ -1203,7 +1199,7 @@ void SwPostItMgr::RemoveSidebarWin()
{
for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- EndListening( *((*i)->GetBroadCaster()) );
+ EndListening( *(const_cast<SfxBroadcaster*>((*i)->GetBroadCaster())) );
if ((*i)->pPostIt)
delete (*i)->pPostIt;
delete (*i);
@@ -1231,14 +1227,14 @@ void SwPostItMgr::Delete(String aAuthor)
aRewriter.AddRule(UNDO_ARG1, aUndoString);
mpWrtShell->StartUndo( UNDO_DELETE, &aRewriter );
- std::vector<SwFmtFld*> aTmp;
+ std::vector<const SwFmtFld*> aTmp;
aTmp.reserve( mvPostItFlds.size() );
for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
{
- if ((*pPostIt)->GetFmtFld() && ((*pPostIt)->pPostIt->GetAuthor() == aAuthor) )
- aTmp.push_back( (*pPostIt)->GetFmtFld() );
+ if ( (*pPostIt)->pPostIt->GetAuthor() == aAuthor )
+ aTmp.push_back( &(*pPostIt)->GetFmtFld() );
}
- for(std::vector<SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
+ for(std::vector<const SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
{
mpWrtShell->GotoField( *(*i) );
mpWrtShell->DelRight();
@@ -1259,14 +1255,13 @@ void SwPostItMgr::Delete()
aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_DELETE_ALL_NOTES) );
mpWrtShell->StartUndo( UNDO_DELETE, &aRewriter );
- std::vector<SwFmtFld*> aTmp;
+ std::vector<const SwFmtFld*> aTmp;
aTmp.reserve( mvPostItFlds.size() );
for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
- {
- if ((*pPostIt)->GetFmtFld())
- aTmp.push_back( (*pPostIt)->GetFmtFld() );
- }
- for(std::vector<SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
+ {
+ aTmp.push_back( &(*pPostIt)->GetFmtFld() );
+ }
+ for(std::vector<const SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
{
mpWrtShell->GotoField( *(*i) );
mpWrtShell->DelRight();
@@ -1384,7 +1379,7 @@ sw::annotation::SwAnnotationWin* SwPostI
{
for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetField() == pFld))
+ if ( (*i)->GetFmtFld().GetField() == pFld )
return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt);
}
return NULL;
@@ -1628,14 +1623,14 @@ void SwPostItMgr::CorrectPositions()
SwSidebarWin *pFirstPostIt = 0;
for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- pFirstPostIt = (*i)->pPostIt;
- if (pFirstPostIt)
- break;
+ pFirstPostIt = (*i)->pPostIt;
+ if (pFirstPostIt)
+ break;
}
//if we have not found a valid note, forget about it and leave
if (!pFirstPostIt)
- return;
+ return;
// yeah, I know, if this is a left page it could be wrong, but finding the page and the note is probably not even faster than just doing it
// --> OD 2010-06-03 #i111964# - check, if anchor overlay object exists.
@@ -1654,16 +1649,14 @@ void SwPostItMgr::CorrectPositions()
{
for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
{
- // --> OD 2010-06-03 #i111964# - check, if anchor overlay object exists.
if ( (*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->Anchor() )
- // <--
{
aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
? mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSeventhPosition().getX()),0)).X()
: mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSixthPosition().getX()),0)).X();
aAnchorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
(*i)->pPostIt->SetPosPixel(Point(aAnchorPosX,aAnchorPosY));
- }
+ }
}
}
}
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/SidebarWin.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/SidebarWin.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/SidebarWin.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/SidebarWin.cxx Wed Dec 18 12:36:23 2013
@@ -30,6 +30,7 @@
#include <SidebarTxtControl.hxx>
#include <AnchorOverlayObject.hxx>
#include <ShadowOverlayObject.hxx>
+#include <OverlayRanges.hxx>
#include <annotation.hrc>
#include <popup.hrc>
@@ -68,6 +69,9 @@
#include <swmodule.hxx>
#include <langhelper.hxx>
+#include <txtannotationfld.hxx>
+#include <ndtxt.hxx>
+
#include <sw_primitivetypes2d.hxx>
#include <drawinglayer/primitive2d/primitivetools2d.hxx>
#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
@@ -108,8 +112,9 @@ SwSidebarWin::SwSidebarWin( SwEditWin& r
, mpMetadataAuthor(0)
, mpMetadataDate(0)
, mpMenuButton(0)
- , mpAnchor(0)
- , mpShadow(0)
+ , mpAnchor( NULL )
+ , mpShadow( NULL )
+ , mpTextRangeOverlay( NULL )
, mColorAnchor()
, mColorDark()
, mColorLight()
@@ -132,7 +137,7 @@ SwSidebarWin::SwSidebarWin( SwEditWin& r
}
mrMgr.ConnectSidebarWinToFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
- *(mrSidebarItem.GetFmtFld()),
+ mrSidebarItem.GetFmtFld(),
*this );
}
@@ -187,10 +192,13 @@ SwSidebarWin::~SwSidebarWin()
}
AnchorOverlayObject::DestroyAnchorOverlayObject( mpAnchor );
- mpAnchor = 0;
+ mpAnchor = NULL;
ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
- mpShadow = 0;
+ mpShadow = NULL;
+
+ delete mpTextRangeOverlay;
+ mpTextRangeOverlay = NULL;
delete mpMenuButton;
mpMenuButton = 0;
@@ -229,11 +237,11 @@ void SwSidebarWin::SetPosSizePixelRect(
long nY,
long nWidth,
long nHeight,
- const SwRect &aRect,
+ const SwRect& aAnchorRect,
const long aPageBorder)
{
mPosSize = Rectangle(Point(nX,nY),Size(nWidth,nHeight));
- mAnchorRect = aRect;
+ mAnchorRect = aAnchorRect;
mPageBorder = aPageBorder;
}
@@ -551,30 +559,87 @@ void SwSidebarWin::SetPosAndSize()
{
if (IsFollow() && !HasChildPathFocus())
{
- // --> OD 2010-06-03 #i111964#
if ( mpAnchor )
{
mpAnchor->SetAnchorState(AS_END);
}
- // <--
}
else
{
- // --> OD 2010-06-03 #i111964#
if ( mpAnchor )
{
mpAnchor->SetAnchorState(AS_ALL);
}
- // <--
SwSidebarWin* pWin = GetTopReplyNote();
- // --> OD 2010-06-03 #i111964#
if ( pWin && pWin->Anchor() )
- // <--
{
pWin->Anchor()->SetAnchorState(AS_END);
}
}
}
+
+ // text range overlay
+ if ( mrSidebarItem.maLayoutInfo.mnStartNodeIdx != NULL
+ && mrSidebarItem.maLayoutInfo.mnStartContent != STRING_NOTFOUND )
+ {
+ std::vector< basegfx::B2DRange > aAnnotationTextRanges;
+ {
+ const SwTxtAnnotationFld* pTxtAnnotationFld =
+ dynamic_cast< const SwTxtAnnotationFld* >( mrSidebarItem.GetFmtFld().GetTxtFld() );
+ if ( pTxtAnnotationFld != NULL
+ && pTxtAnnotationFld->GetpTxtNode() != NULL )
+ {
+ SwTxtNode* pTxtNode = pTxtAnnotationFld->GetpTxtNode();
+ SwNodes& rNds = pTxtNode->GetDoc()->GetNodes();
+ SwCntntNode* const pCntntNd = rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetCntntNode();
+ SwPosition aStartPos( *pCntntNd, mrSidebarItem.maLayoutInfo.mnStartContent );
+ ::boost::scoped_ptr<SwShellCrsr> pTmpCrsrForAnnotationTextRange(
+ new SwShellCrsr( DocView().GetWrtShell(), aStartPos ) );
+ pTmpCrsrForAnnotationTextRange->SetMark();
+ pTmpCrsrForAnnotationTextRange->GetMark()->nNode = *pTxtNode;
+ pTmpCrsrForAnnotationTextRange->GetMark()->nContent.Assign( pTxtNode, *(pTxtAnnotationFld->GetStart())+1 );
+
+ pTmpCrsrForAnnotationTextRange->FillRects();
+
+ for( sal_uInt16 a(0); a < pTmpCrsrForAnnotationTextRange->Count(); ++a )
+ {
+ const SwRect aNextRect((*pTmpCrsrForAnnotationTextRange)[a]);
+ const Rectangle aPntRect(aNextRect.SVRect());
+
+ aAnnotationTextRanges.push_back(basegfx::B2DRange(
+ aPntRect.Left(), aPntRect.Top(),
+ aPntRect.Right() + 1, aPntRect.Bottom() + 1));
+ }
+ }
+ }
+
+ if ( mpTextRangeOverlay != NULL )
+ {
+ mpTextRangeOverlay->setRanges( aAnnotationTextRanges );
+ if ( mpAnchor != NULL && mpAnchor->getLineSolid() )
+ {
+ mpTextRangeOverlay->ShowSolidBorder();
+ }
+ else
+ {
+ mpTextRangeOverlay->HideSolidBorder();
+ }
+ }
+ else
+ {
+ mpTextRangeOverlay =
+ sw::overlay::OverlayRanges::CreateOverlayRange(
+ DocView(),
+ mColorAnchor,
+ aAnnotationTextRanges,
+ mpAnchor != NULL ? mpAnchor->getLineSolid() : false );
+ }
+ }
+ else
+ {
+ delete mpTextRangeOverlay;
+ mpTextRangeOverlay = NULL;
+ }
}
void SwSidebarWin::DoResize()
@@ -1138,6 +1203,10 @@ void SwSidebarWin::SetViewState(ViewStat
pWin->Anchor()->SetAnchorState(AS_END);
}
mpAnchor->setLineSolid(true);
+ if ( mpTextRangeOverlay != NULL )
+ {
+ mpTextRangeOverlay->ShowSolidBorder();
+ }
}
if (mpShadow)
mpShadow->SetShadowState(SS_EDIT);
@@ -1146,7 +1215,13 @@ void SwSidebarWin::SetViewState(ViewStat
case VS_VIEW:
{
if (mpAnchor)
+ {
mpAnchor->setLineSolid(true);
+ if ( mpTextRangeOverlay != NULL )
+ {
+ mpTextRangeOverlay->ShowSolidBorder();
+ }
+ }
if (mpShadow)
mpShadow->SetShadowState(SS_VIEW);
break;
@@ -1164,19 +1239,25 @@ void SwSidebarWin::SetViewState(ViewStat
SwSidebarWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
? mrMgr.GetActiveSidebarWin()->GetTopReplyNote()
: 0;
- // --> OD 2010-06-03 #i111964#
if ( pTopWinSelf && ( pTopWinSelf != pTopWinActive ) &&
pTopWinSelf->Anchor() )
- // <--
{
if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() )
- {
+ {
pTopWinSelf->Anchor()->setLineSolid(false);
+ if ( pTopWinSelf->TextRange() != NULL )
+ {
+ pTopWinSelf->TextRange()->HideSolidBorder();
+ }
}
pTopWinSelf->Anchor()->SetAnchorState(AS_ALL);
}
}
mpAnchor->setLineSolid(false);
+ if ( mpTextRangeOverlay != NULL )
+ {
+ mpTextRangeOverlay->HideSolidBorder();
+ }
}
if ( mpShadow )
{
@@ -1260,7 +1341,7 @@ void SwSidebarWin::ChangeSidebarItem( Sw
if ( bAnchorChanged )
{
mrMgr.ConnectSidebarWinToFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
- *(mrSidebarItem.GetFmtFld()),
+ mrSidebarItem.GetFmtFld(),
*this );
}
}
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx Wed Dec 18 12:36:23 2013
@@ -855,8 +855,7 @@ sal_uInt16 SwFldMgr::GetCurTypeId() cons
sal_Bool SwFldMgr::InsertFld(
- const SwInsertFld_Data& rData,
- const SwPaM *pPam )
+ const SwInsertFld_Data& rData )
{
SwField* pFld = 0;
sal_Bool bExp = sal_False;
@@ -877,241 +876,265 @@ sal_Bool SwFldMgr::InsertFld(
case TYP_POSTITFLD:
{
SwPostItFieldType* pType = (SwPostItFieldType*)pCurShell->GetFldType(0, RES_POSTITFLD);
- pFld = new SwPostItField(
- pType,
- rData.sPar2, // content
- rData.sPar1, // author
- aEmptyStr, // author's initials
- aEmptyStr, // name
- DateTime() );
- break;
+ SwPostItField* pPostItField =
+ new SwPostItField(
+ pType,
+ rData.sPar2, // content
+ rData.sPar1, // author
+ aEmptyStr, // author's initials
+ aEmptyStr, // name
+ DateTime() );
+ pFld = pPostItField;
}
+ break;
- case TYP_SCRIPTFLD:
- {
- SwScriptFieldType* pType =
+ case TYP_SCRIPTFLD:
+ {
+ SwScriptFieldType* pType =
(SwScriptFieldType*)pCurShell->GetFldType(0, RES_SCRIPTFLD);
pFld = new SwScriptField(pType, rData.sPar1, rData.sPar2, (sal_Bool)nFormatId);
- break;
- }
- case TYP_COMBINED_CHARS:
- {
- SwCombinedCharFieldType* pType = (SwCombinedCharFieldType*)
- pCurShell->GetFldType( 0, RES_COMBINED_CHARS );
+ break;
+ }
+
+ case TYP_COMBINED_CHARS:
+ {
+ SwCombinedCharFieldType* pType = (SwCombinedCharFieldType*)
+ pCurShell->GetFldType( 0, RES_COMBINED_CHARS );
pFld = new SwCombinedCharField( pType, rData.sPar1 );
- }
- break;
- case TYP_AUTHORITY:
- {
- SwAuthorityFieldType* pType =
+ }
+ break;
+
+ case TYP_AUTHORITY:
+ {
+ SwAuthorityFieldType* pType =
(SwAuthorityFieldType*)pCurShell->GetFldType(0, RES_AUTHORITY);
- if(!pType)
- {
- pType =
+ if(!pType)
+ {
+ pType =
(SwAuthorityFieldType*)pCurShell->InsertFldType(
- SwAuthorityFieldType(pCurShell->GetDoc()));
- }
+ SwAuthorityFieldType(pCurShell->GetDoc()));
+ }
pFld = new SwAuthorityField(pType, rData.sPar1);
- }
- break;
- case TYP_DATEFLD:
- case TYP_TIMEFLD:
- {
+ }
+ break;
+
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ {
sal_uInt16 nSub = static_cast< sal_uInt16 >(rData.nTypeId == TYP_DATEFLD ? DATEFLD : TIMEFLD);
nSub |= nSubType == DATE_VAR ? 0 : FIXEDFLD;
- SwDateTimeFieldType* pTyp =
+ SwDateTimeFieldType* pTyp =
(SwDateTimeFieldType*)pCurShell->GetFldType(0, RES_DATETIMEFLD);
pFld = new SwDateTimeField(pTyp, nSub, nFormatId);
pFld->SetPar2(rData.sPar2);
- break;
- }
- case TYP_FILENAMEFLD:
- {
- SwFileNameFieldType* pTyp =
+ break;
+ }
+
+ case TYP_FILENAMEFLD:
+ {
+ SwFileNameFieldType* pTyp =
(SwFileNameFieldType*)pCurShell->GetFldType(0, RES_FILENAMEFLD);
pFld = new SwFileNameField(pTyp, nFormatId);
- break;
- }
- case TYP_TEMPLNAMEFLD:
- {
- SwTemplNameFieldType* pTyp =
+ break;
+ }
+
+ case TYP_TEMPLNAMEFLD:
+ {
+ SwTemplNameFieldType* pTyp =
(SwTemplNameFieldType*)pCurShell->GetFldType(0, RES_TEMPLNAMEFLD);
pFld = new SwTemplNameField(pTyp, nFormatId);
- break;
- }
- case TYP_CHAPTERFLD:
+ break;
+ }
+
+ case TYP_CHAPTERFLD:
{
sal_uInt16 nByte = (sal_uInt16)rData.sPar2.ToInt32();
- SwChapterFieldType* pTyp =
+ SwChapterFieldType* pTyp =
(SwChapterFieldType*)pCurShell->GetFldType(0, RES_CHAPTERFLD);
pFld = new SwChapterField(pTyp, nFormatId);
- nByte = Max(sal_uInt16(1), nByte);
- nByte = Min(nByte, sal_uInt16(MAXLEVEL));
- nByte -= 1;
- ((SwChapterField*)pFld)->SetLevel((sal_uInt8)nByte);
- break;
- }
- case TYP_NEXTPAGEFLD:
- case TYP_PREVPAGEFLD:
- case TYP_PAGENUMBERFLD:
- {
+ nByte = Max(sal_uInt16(1), nByte);
+ nByte = Min(nByte, sal_uInt16(MAXLEVEL));
+ nByte -= 1;
+ ((SwChapterField*)pFld)->SetLevel((sal_uInt8)nByte);
+ break;
+ }
+
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_PAGENUMBERFLD:
+ {
short nOff = (short)rData.sPar2.ToInt32();
if(rData.nTypeId == TYP_NEXTPAGEFLD)
- {
+ {
if( SVX_NUM_CHAR_SPECIAL == nFormatId )
- nOff = 1;
- else
- nOff += 1;
+ nOff = 1;
+ else
+ nOff += 1;
nSubType = PG_NEXT;
- }
+ }
else if(rData.nTypeId == TYP_PREVPAGEFLD)
- {
+ {
if( SVX_NUM_CHAR_SPECIAL == nFormatId )
- nOff = -1;
- else
- nOff -= 1;
+ nOff = -1;
+ else
+ nOff -= 1;
nSubType = PG_PREV;
- }
- else
+ }
+ else
nSubType = PG_RANDOM;
- SwPageNumberFieldType* pTyp =
+ SwPageNumberFieldType* pTyp =
(SwPageNumberFieldType*)pCurShell->GetFldType(0, RES_PAGENUMBERFLD);
pFld = new SwPageNumberField(pTyp, nSubType, nFormatId, nOff);
if( SVX_NUM_CHAR_SPECIAL == nFormatId &&
( PG_PREV == nSubType || PG_NEXT == nSubType ) )
((SwPageNumberField*)pFld)->SetUserString( rData.sPar2 );
- break;
- }
- case TYP_DOCSTATFLD:
- { SwDocStatFieldType* pTyp =
+ break;
+ }
+
+ case TYP_DOCSTATFLD:
+ {
+ SwDocStatFieldType* pTyp =
(SwDocStatFieldType*)pCurShell->GetFldType(0, RES_DOCSTATFLD);
pFld = new SwDocStatField(pTyp, nSubType, nFormatId);
- break;
- }
- case TYP_AUTHORFLD:
- { SwAuthorFieldType* pTyp =
+ break;
+ }
+
+ case TYP_AUTHORFLD:
+ {
+ SwAuthorFieldType* pTyp =
(SwAuthorFieldType*)pCurShell->GetFldType(0, RES_AUTHORFLD);
pFld = new SwAuthorField(pTyp, nFormatId);
- break;
- }
- case TYP_CONDTXTFLD:
- case TYP_HIDDENTXTFLD:
- {
- SwHiddenTxtFieldType* pTyp =
+ break;
+ }
+
+ case TYP_CONDTXTFLD:
+ case TYP_HIDDENTXTFLD:
+ {
+ SwHiddenTxtFieldType* pTyp =
(SwHiddenTxtFieldType*)pCurShell->GetFldType(0, RES_HIDDENTXTFLD);
pFld = new SwHiddenTxtField(pTyp, sal_True, rData.sPar1, rData.sPar2, sal_False, rData.nTypeId);
- bExp = sal_True;
- break;
- }
- case TYP_HIDDENPARAFLD:
- {
- SwHiddenParaFieldType* pTyp =
+ bExp = sal_True;
+ break;
+ }
+
+ case TYP_HIDDENPARAFLD:
+ {
+ SwHiddenParaFieldType* pTyp =
(SwHiddenParaFieldType*)pCurShell->GetFldType(0, RES_HIDDENPARAFLD);
pFld = new SwHiddenParaField(pTyp, rData.sPar1);
- bExp = sal_True;
- break;
- }
- case TYP_SETREFFLD:
- {
+ bExp = sal_True;
+ break;
+ }
+
+ case TYP_SETREFFLD:
+ {
if( rData.sPar1.Len() > 0 && CanInsertRefMark( rData.sPar1 ) )
- {
+ {
pCurShell->SetAttrItem( SwFmtRefMark( rData.sPar1 ) );
- return sal_True;
- }
- return sal_False;
- }
- case TYP_GETREFFLD:
- {
- SwGetRefFieldType* pTyp =
+ return sal_True;
+ }
+ return sal_False;
+ }
+
+ case TYP_GETREFFLD:
+ {
+ SwGetRefFieldType* pTyp =
(SwGetRefFieldType*)pCurShell->GetFldType(0, RES_GETREFFLD);
sal_uInt16 nSeqNo = (sal_uInt16)rData.sPar2.ToInt32();
pFld = new SwGetRefField(pTyp, rData.sPar1, nSubType, nSeqNo, nFormatId);
- bExp = sal_True;
- break;
- }
- case TYP_DDEFLD:
- {
- //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
- // Namen haben! Wird hier noch nicht beachtet.
+ bExp = sal_True;
+ break;
+ }
+
+ case TYP_DDEFLD:
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
String sCmd( rData.sPar2 );
sal_uInt16 nTmpPos = sCmd.SearchAndReplace( ' ', sfx2::cTokenSeperator );
sCmd.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
SwDDEFieldType aType( rData.sPar1, sCmd, (sal_uInt16) nFormatId );
SwDDEFieldType* pTyp = (SwDDEFieldType*) pCurShell->InsertFldType( aType );
- pFld = new SwDDEField( pTyp );
- break;
- }
- case TYP_MACROFLD:
- {
- SwMacroFieldType* pTyp =
- (SwMacroFieldType*)pCurShell->GetFldType(0, RES_MACROFLD);
+ pFld = new SwDDEField( pTyp );
+ break;
+ }
+
+ case TYP_MACROFLD:
+ {
+ SwMacroFieldType* pTyp =
+ (SwMacroFieldType*)pCurShell->GetFldType(0, RES_MACROFLD);
- pFld = new SwMacroField(pTyp, rData.sPar1, rData.sPar2);
+ pFld = new SwMacroField(pTyp, rData.sPar1, rData.sPar2);
- break;
- }
- case TYP_INTERNETFLD:
- {
+ break;
+ }
+
+ case TYP_INTERNETFLD:
+ {
SwFmtINetFmt aFmt( rData.sPar1, sCurFrame );
- if( pMacroItem )
- aFmt.SetMacroTbl( &pMacroItem->GetMacroTable() );
+ if( pMacroItem )
+ aFmt.SetMacroTbl( &pMacroItem->GetMacroTable() );
return pCurShell->InsertURL( aFmt, rData.sPar2 );
- }
- case TYP_JUMPEDITFLD:
- {
- SwJumpEditFieldType* pTyp =
+ }
+
+ case TYP_JUMPEDITFLD:
+ {
+ SwJumpEditFieldType* pTyp =
(SwJumpEditFieldType*)pCurShell->GetFldType(0, RES_JUMPEDITFLD);
pFld = new SwJumpEditField(pTyp, nFormatId, rData.sPar1, rData.sPar2 );
- break;
- }
- case TYP_DOCINFOFLD:
- {
+ break;
+ }
+
+ case TYP_DOCINFOFLD:
+ {
SwDocInfoFieldType* pTyp = (SwDocInfoFieldType*)pCurShell->GetFldType(
- 0, RES_DOCINFOFLD );
+ 0, RES_DOCINFOFLD );
pFld = new SwDocInfoField(pTyp, nSubType, rData.sPar1, nFormatId);
- break;
- }
- case TYP_EXTUSERFLD:
- {
+ break;
+ }
+
+ case TYP_EXTUSERFLD:
+ {
SwExtUserFieldType* pTyp = (SwExtUserFieldType*)pCurShell->GetFldType(
- 0, RES_EXTUSERFLD);
+ 0, RES_EXTUSERFLD);
pFld = new SwExtUserField(pTyp, nSubType, nFormatId);
- break;
- }
- case TYP_DBFLD:
- {
- SwDBData aDBData;
- String sPar1;
+ break;
+ }
+
+ case TYP_DBFLD:
+ {
+ SwDBData aDBData;
+ String sPar1;
if (rData.sPar1.Search(DB_DELIM) == STRING_NOTFOUND)
- {
+ {
aDBData = pCurShell->GetDBData();
sPar1 = rData.sPar1;
- }
- else
- {
+ }
+ else
+ {
aDBData.sDataSource = rData.sPar1.GetToken(0, DB_DELIM);
aDBData.sCommand = rData.sPar1.GetToken(1, DB_DELIM);
aDBData.nCommandType = rData.sPar1.GetToken(2, DB_DELIM).ToInt32();
sPar1 = rData.sPar1.GetToken(3, DB_DELIM);
- }
+ }
if(aDBData.sDataSource.getLength() && pCurShell->GetDBData() != aDBData)
pCurShell->ChgDBData(aDBData);
SwDBFieldType* pTyp = (SwDBFieldType*)pCurShell->InsertFldType(
- SwDBFieldType(pCurShell->GetDoc(), sPar1, aDBData) );
- pFld = new SwDBField(pTyp);
+ SwDBFieldType(pCurShell->GetDoc(), sPar1, aDBData) );
+ pFld = new SwDBField(pTyp);
pFld->SetSubType(nSubType);
if( !(nSubType & nsSwExtendedSubType::SUB_OWN_FMT) ) // Datenbankformat ermitteln
- {
+ {
Reference< XDataSource> xSource;
rData.aDBDataSource >>= xSource;
Reference<XConnection> xConnection;
@@ -1121,132 +1144,135 @@ sal_Bool SwFldMgr::InsertFld(
if(xColumn.is())
{
nFormatId = pCurShell->GetNewDBMgr()->GetColumnFmt(xSource, xConnection, xColumn,
- pCurShell->GetNumberFormatter(), GetCurrLanguage() );
+ pCurShell->GetNumberFormatter(), GetCurrLanguage() );
}
else
nFormatId = pCurShell->GetNewDBMgr()->GetColumnFmt(
- aDBData.sDataSource, aDBData.sCommand, sPar1,
- pCurShell->GetNumberFormatter(), GetCurrLanguage() );
- }
+ aDBData.sDataSource, aDBData.sCommand, sPar1,
+ pCurShell->GetNumberFormatter(), GetCurrLanguage() );
+ }
pFld->ChangeFormat( nFormatId );
- bExp = sal_True;
- break;
- }
- case TYP_DBSETNUMBERFLD:
- case TYP_DBNUMSETFLD:
- case TYP_DBNEXTSETFLD:
- case TYP_DBNAMEFLD:
- {
- sal_uInt16 nPos, nTablePos, nCmdTypePos, nExpPos;
- String sPar1;
- SwDBData aDBData;
+ bExp = sal_True;
+ break;
+ }
+
+ case TYP_DBSETNUMBERFLD:
+ case TYP_DBNUMSETFLD:
+ case TYP_DBNEXTSETFLD:
+ case TYP_DBNAMEFLD:
+ {
+ sal_uInt16 nPos, nTablePos, nCmdTypePos, nExpPos;
+ String sPar1;
+ SwDBData aDBData;
// DBName aus rData.sPar1 extrahieren. Format: DBName.TableName.CommandType.ExpStrg
if ((nTablePos = rData.sPar1.Search(DB_DELIM)) != STRING_NOTFOUND)
aDBData.sDataSource = rData.sPar1.Copy(0, nTablePos++);
if ((nCmdTypePos = rData.sPar1.Search(DB_DELIM, nTablePos)) != STRING_NOTFOUND)
- {
+ {
aDBData.sCommand = rData.sPar1.Copy(nTablePos, nCmdTypePos++ - nTablePos);
- }
+ }
if ((nExpPos = rData.sPar1.Search(DB_DELIM, nCmdTypePos)) != STRING_NOTFOUND)
- {
+ {
aDBData.nCommandType = rData.sPar1.Copy(nCmdTypePos, nExpPos++ - nCmdTypePos).ToInt32();
- }
- if (nExpPos != STRING_NOTFOUND)
- nPos = nExpPos;
- else if (nTablePos != STRING_NOTFOUND)
- nPos = nTablePos;
- else
- nPos = 0;
+ }
+ if (nExpPos != STRING_NOTFOUND)
+ nPos = nExpPos;
+ else if (nTablePos != STRING_NOTFOUND)
+ nPos = nTablePos;
+ else
+ nPos = 0;
sPar1 = rData.sPar1.Copy(nPos);
if (aDBData.sDataSource.getLength() && pCurShell->GetDBData() != aDBData)
pCurShell->ChgDBData(aDBData);
switch(rData.nTypeId)
- {
- case TYP_DBNAMEFLD:
- {
- SwDBNameFieldType* pTyp =
+ {
+ case TYP_DBNAMEFLD:
+ {
+ SwDBNameFieldType* pTyp =
(SwDBNameFieldType*)pCurShell->GetFldType(0, RES_DBNAMEFLD);
- pFld = new SwDBNameField(pTyp, aDBData);
+ pFld = new SwDBNameField(pTyp, aDBData);
- break;
- }
- case TYP_DBNEXTSETFLD:
- {
+ break;
+ }
+ case TYP_DBNEXTSETFLD:
+ {
SwDBNextSetFieldType* pTyp = (SwDBNextSetFieldType*)pCurShell->GetFldType(
- 0, RES_DBNEXTSETFLD);
+ 0, RES_DBNEXTSETFLD);
pFld = new SwDBNextSetField(pTyp, sPar1, rData.sPar2, aDBData);
- bExp = sal_True;
- break;
- }
- case TYP_DBNUMSETFLD:
- {
+ bExp = sal_True;
+ break;
+ }
+ case TYP_DBNUMSETFLD:
+ {
SwDBNumSetFieldType* pTyp = (SwDBNumSetFieldType*)pCurShell->GetFldType(
- 0, RES_DBNUMSETFLD);
+ 0, RES_DBNUMSETFLD);
pFld = new SwDBNumSetField( pTyp, sPar1, rData.sPar2, aDBData);
- bExp = sal_True;
- break;
- }
- case TYP_DBSETNUMBERFLD:
- {
- SwDBSetNumberFieldType* pTyp = (SwDBSetNumberFieldType*)
- pCurShell->GetFldType(0, RES_DBSETNUMBERFLD);
+ bExp = sal_True;
+ break;
+ }
+ case TYP_DBSETNUMBERFLD:
+ {
+ SwDBSetNumberFieldType* pTyp = (SwDBSetNumberFieldType*)
+ pCurShell->GetFldType(0, RES_DBSETNUMBERFLD);
pFld = new SwDBSetNumberField( pTyp, aDBData, nFormatId);
- bExp = sal_True;
- break;
- }
- }
- break;
- }
- case TYP_USERFLD:
- {
- SwUserFieldType* pTyp =
+ bExp = sal_True;
+ break;
+ }
+ }
+ break;
+ }
+
+ case TYP_USERFLD:
+ {
+ SwUserFieldType* pTyp =
(SwUserFieldType*)pCurShell->GetFldType(RES_USERFLD, rData.sPar1);
- // nur wenn vorhanden
- if(!pTyp)
- {
+ // nur wenn vorhanden
+ if(!pTyp)
+ {
pTyp = (SwUserFieldType*)pCurShell->InsertFldType(
- SwUserFieldType(pCurShell->GetDoc(), rData.sPar1));
- }
+ SwUserFieldType(pCurShell->GetDoc(), rData.sPar1));
+ }
if (pTyp->GetContent(nFormatId) != rData.sPar2)
pTyp->SetContent(rData.sPar2, nFormatId);
pFld = new SwUserField(pTyp, 0, nFormatId);
if (pFld->GetSubType() != nSubType)
pFld->SetSubType(nSubType);
- bTbl = sal_True;
- break;
- }
- case TYP_INPUTFLD:
- {
+ bTbl = sal_True;
+ break;
+ }
+
+ case TYP_INPUTFLD:
+ {
if ((nSubType & 0x00ff) == INP_VAR)
- {
- SwSetExpFieldType* pTyp = (SwSetExpFieldType*)
- pCurShell->GetFldType(RES_SETEXPFLD, rData.sPar1);
+ {
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)
+ pCurShell->GetFldType(RES_SETEXPFLD, rData.sPar1);
- // kein Experssion Type mit dem Namen vorhanden -> anlegen
- if(pTyp)
- {
- SwSetExpField* pExpFld =
+ // kein Experssion Type mit dem Namen vorhanden -> anlegen
+ if(pTyp)
+ {
+ SwSetExpField* pExpFld =
new SwSetExpField(pTyp, aEmptyStr, nFormatId);
- // Typ vom SwSetExpFieldType nicht veraendern:
- sal_uInt16 nOldSubType = pExpFld->GetSubType();
+ // Typ vom SwSetExpFieldType nicht veraendern:
+ sal_uInt16 nOldSubType = pExpFld->GetSubType();
pExpFld->SetSubType(nOldSubType | (nSubType & 0xff00));
pExpFld->SetPromptText(rData.sPar2);
- pExpFld->SetInputFlag(sal_True) ;
- bExp = sal_True;
- pFld = pExpFld;
- }
- else
- return sal_False;
- }
- else
- {
+ pExpFld->SetInputFlag(sal_True) ;
+ bExp = sal_True;
+ pFld = pExpFld;
+ }
+ else
+ return sal_False;
+ }
+ else
+ {
SwInputFieldType* pTyp =
(SwInputFieldType*)pCurShell->GetFldType(0, RES_INPUTFLD);
@@ -1255,122 +1281,128 @@ sal_Bool SwFldMgr::InsertFld(
pFld = pInpFld;
}
- // Dialog starten
- //
+ // Dialog starten
+ //
pCurShell->StartInputFldDlg(pFld, sal_False, rData.pParent);
- break;
- }
- case TYP_SETFLD:
- {
+ break;
+ }
+
+ case TYP_SETFLD:
+ {
if (!rData.sPar2.Len()) // Leere Variablen sind nicht erlaubt
- return sal_False;
+ return sal_False;
SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pCurShell->InsertFldType(
- SwSetExpFieldType(pCurShell->GetDoc(), rData.sPar1) );
+ SwSetExpFieldType(pCurShell->GetDoc(), rData.sPar1) );
SwSetExpField* pExpFld = new SwSetExpField( pTyp, rData.sPar2, nFormatId);
pExpFld->SetSubType(nSubType);
pExpFld->SetPar2(rData.sPar2);
- bExp = sal_True;
- pFld = pExpFld;
- break;
- }
- case TYP_SEQFLD:
- {
+ bExp = sal_True;
+ pFld = pExpFld;
+ break;
+ }
+
+ case TYP_SEQFLD:
+ {
SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pCurShell->InsertFldType(
- SwSetExpFieldType(pCurShell->GetDoc(), rData.sPar1, nsSwGetSetExpType::GSE_SEQ));
+ SwSetExpFieldType(pCurShell->GetDoc(), rData.sPar1, nsSwGetSetExpType::GSE_SEQ));
sal_uInt8 nLevel = static_cast< sal_uInt8 >(nSubType & 0xff);
- pTyp->SetOutlineLvl(nLevel);
+ pTyp->SetOutlineLvl(nLevel);
if (nLevel != 0x7f && cSeparator == 0)
cSeparator = '.';
pTyp->SetDelimiter(cSeparator);
SwSetExpField* pExpFld = new SwSetExpField(pTyp, rData.sPar2, nFormatId);
- bExp = sal_True;
- pFld = pExpFld;
+ bExp = sal_True;
+ pFld = pExpFld;
nSubType = nsSwGetSetExpType::GSE_SEQ;
- break;
- }
- case TYP_GETFLD:
- {
- // gibt es ein entprechendes SetField
- SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
- pCurShell->GetFldType(RES_SETEXPFLD, rData.sPar1);
+ break;
+ }
- if(pSetTyp)
- {
+ case TYP_GETFLD:
+ {
+ // gibt es ein entprechendes SetField
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ pCurShell->GetFldType(RES_SETEXPFLD, rData.sPar1);
+
+ if(pSetTyp)
+ {
SwGetExpFieldType* pTyp = (SwGetExpFieldType*)pCurShell->GetFldType(
- 0, RES_GETEXPFLD);
+ 0, RES_GETEXPFLD);
pFld = new SwGetExpField(pTyp, rData.sPar1, pSetTyp->GetType(), nFormatId);
pFld->SetSubType(nSubType | pSetTyp->GetType());
- bExp = sal_True;
- }
- else
- return sal_False;
- break;
- }
- case TYP_FORMELFLD:
- {
+ bExp = sal_True;
+ }
+ else
+ return sal_False;
+ break;
+ }
+
+ case TYP_FORMELFLD:
+ {
if(pCurShell->GetFrmType(0,sal_False) & FRMTYPE_TABLE)
- {
+ {
pCurShell->StartAllAction();
SvNumberFormatter* pFormatter = pCurShell->GetDoc()->GetNumberFormatter();
const SvNumberformat* pEntry = pFormatter->GetEntry(nFormatId);
- if (pEntry)
- {
- SfxStringItem aFormat(FN_NUMBER_FORMAT, pEntry->GetFormatstring());
+ if (pEntry)
+ {
+ SfxStringItem aFormat(FN_NUMBER_FORMAT, pEntry->GetFormatstring());
pCurShell->GetView().GetViewFrame()->GetDispatcher()->
- Execute(FN_NUMBER_FORMAT, SFX_CALLMODE_SYNCHRON, &aFormat, 0L);
- }
+ Execute(FN_NUMBER_FORMAT, SFX_CALLMODE_SYNCHRON, &aFormat, 0L);
+ }
SfxItemSet aBoxSet( pCurShell->GetAttrPool(),
- RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
+ RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
String sFml( rData.sPar2 );
- if( sFml.EraseLeadingChars().Len() &&
- '=' == sFml.GetChar( 0 ) )
- sFml.Erase( 0, 1 );
+ if( sFml.EraseLeadingChars().Len() &&
+ '=' == sFml.GetChar( 0 ) )
+ sFml.Erase( 0, 1 );
- aBoxSet.Put( SwTblBoxFormula( sFml ));
+ aBoxSet.Put( SwTblBoxFormula( sFml ));
pCurShell->SetTblBoxFormulaAttrs( aBoxSet );
pCurShell->UpdateTable();
pCurShell->EndAllAction();
- return sal_True;
+ return sal_True;
-/* // In der Tabelle Tabellenformeln einfuegen
+ /* // In der Tabelle Tabellenformeln einfuegen
SwTblFieldType* pTyp = (SwTblFieldType*)pCurShell->GetFldType(
- 0, RES_TABLEFLD);
+ 0, RES_TABLEFLD);
pFld = new SwTblField(pTyp, rData.sPar2, nsSwGetSetExpType::GSE_EXPR, nFormatId);
- bTbl = sal_True;*/
- }
- else
- {
- SwGetExpFieldType* pTyp = (SwGetExpFieldType*)
- pCurShell->GetFldType(0, RES_GETEXPFLD);
+ bTbl = sal_True;*/
+ }
+ else
+ {
+ SwGetExpFieldType* pTyp = (SwGetExpFieldType*)
+ pCurShell->GetFldType(0, RES_GETEXPFLD);
pFld = new SwGetExpField(pTyp, rData.sPar2, nsSwGetSetExpType::GSE_FORMULA, nFormatId);
pFld->SetSubType(nSubType);
- bExp = sal_True;
- }
- break;
- }
- case TYP_SETREFPAGEFLD:
- pFld = new SwRefPageSetField( (SwRefPageSetFieldType*)
- pCurShell->GetFldType( 0, RES_REFPAGESETFLD ),
- (short)rData.sPar2.ToInt32(), 0 != nSubType );
- bPageVar = sal_True;
- break;
+ bExp = sal_True;
+ }
+ break;
+ }
- case TYP_GETREFPAGEFLD:
- pFld = new SwRefPageGetField( (SwRefPageGetFieldType*)
- pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ), nFormatId );
- bPageVar = sal_True;
- break;
- case TYP_DROPDOWN :
+ case TYP_SETREFPAGEFLD:
+ pFld = new SwRefPageSetField( (SwRefPageSetFieldType*)
+ pCurShell->GetFldType( 0, RES_REFPAGESETFLD ),
+ (short)rData.sPar2.ToInt32(), 0 != nSubType );
+ bPageVar = sal_True;
+ break;
+
+ case TYP_GETREFPAGEFLD:
+ pFld = new SwRefPageGetField( (SwRefPageGetFieldType*)
+ pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ), nFormatId );
+ bPageVar = sal_True;
+ break;
+
+ case TYP_DROPDOWN :
{
pFld = new SwDropDownField(pCurShell->GetFldType( 0, RES_DROPDOWN ));
xub_StrLen nTokenCount = rData.sPar2.Len() ? rData.sPar2.GetTokenCount(DB_DELIM) : 0;
@@ -1382,49 +1414,45 @@ sal_Bool SwFldMgr::InsertFld(
((SwDropDownField*)pFld)->SetName(rData.sPar1);
}
break;
- default:
- { ASSERT(!this, "Falscher Feldtyp");
- return sal_False;
- }
- }
- ASSERT(pFld, "Feld nicht vorhanden");
+ default:
+ {
+ ASSERT(!this, "Falscher Feldtyp");
+ return sal_False;
+ }
+ }
+ ASSERT(pFld, "Feld nicht vorhanden");
- //the auto language flag has to be set prior to the language!
- pFld->SetAutomaticLanguage(rData.bIsAutomaticLanguage);
- sal_uInt16 nLang = GetCurrLanguage();
- pFld->SetLanguage(nLang);
- // Einfuegen
- pCurShell->StartAllAction();
+ //the auto language flag has to be set prior to the language!
+ pFld->SetAutomaticLanguage(rData.bIsAutomaticLanguage);
+ sal_uInt16 nLang = GetCurrLanguage();
+ pFld->SetLanguage(nLang);
- const SwPaM* pCommentRange = NULL;
- if (pPam && *pPam->GetPoint() != *pPam->GetMark() && rData.nTypeId == TYP_POSTITFLD)
- {
- pCommentRange = pPam;
- }
+ // Einfuegen
+ pCurShell->StartAllAction();
- pCurShell->Insert( *pFld, pCommentRange );
+ pCurShell->Insert( *pFld );
- if(bExp && bEvalExp)
+ if(bExp && bEvalExp)
pCurShell->UpdateExpFlds(sal_True);
- if(bTbl)
- {
+ if(bTbl)
+ {
pCurShell->Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
pCurShell->UpdateFlds(*pFld);
pCurShell->Right(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
- }
- else if( bPageVar )
+ }
+ else if( bPageVar )
((SwRefPageGetFieldType*)pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ))->UpdateFlds();
else if( TYP_GETREFFLD == rData.nTypeId )
- pFld->GetTyp()->ModifyNotification( 0, 0 );
+ pFld->GetTyp()->ModifyNotification( 0, 0 );
- // temporaeres Feld loeschen
- delete pFld;
+ // temporaeres Feld loeschen
+ delete pFld;
pCurShell->EndAllAction();
- return sal_True;
+ return sal_True;
}
/*--------------------------------------------------------------------
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldref.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldref.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldref.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldref.cxx Wed Dec 18 12:36:23 2013
@@ -513,7 +513,6 @@ void SwFldRefPage::UpdateSubType()
const sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)aTypeLB.GetEntryData(GetTypeSel());
String sOldSel;
- // --> OD 2007-11-22 #i83479#
if ( aSelectionLB.IsVisible() )
{
const sal_uInt16 nSelectionSel = aSelectionLB.GetSelectEntryPos();
@@ -522,17 +521,14 @@ void SwFldRefPage::UpdateSubType()
sOldSel = aSelectionLB.GetEntry(nSelectionSel);
}
}
- // <--
if (IsFldEdit() && !sOldSel.Len())
sOldSel = String::CreateFromInt32( pRefFld->GetSeqNo() + 1 );
aSelectionLB.SetUpdateMode(sal_False);
aSelectionLB.Clear();
- // --> OD 2007-11-21 #i83479#
aSelectionToolTipLB.SetUpdateMode(sal_False);
aSelectionToolTipLB.Clear();
bool bShowSelectionToolTipLB( false );
- // <--
if( REFFLDFLAG & nTypeId )
{
@@ -578,7 +574,6 @@ void SwFldRefPage::UpdateSubType()
sOldSel = aArr[n]->sDlgEntry;
}
}
- // --> OD 2007-11-14 #i83479#
else if ( nTypeId == REFFLDFLAG_HEADING )
{
bShowSelectionToolTipLB = true;
@@ -639,7 +634,6 @@ void SwFldRefPage::UpdateSubType()
}
}
}
- // <--
else
{
aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_SORT);
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx Wed Dec 18 12:36:23 2013
@@ -138,9 +138,7 @@ public:
{ pWrtShell = pShell; }
// insert field using TypeID (TYP_ ...)
- sal_Bool InsertFld(
- const SwInsertFld_Data& rData,
- const SwPaM* pPam = 0 );
+ sal_Bool InsertFld( const SwInsertFld_Data& rData );
// Direkt das aktuelle Feld aendern
void UpdateCurFld(sal_uLong nFormat,
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx Wed Dec 18 12:36:23 2013
@@ -297,9 +297,7 @@ typedef sal_Bool (SwWrtShell:: *FNSimple
int IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True);
// Editieren
- void Insert(
- SwField &,
- const SwPaM* pCommentRange = NULL );
+ void Insert( SwField& rFld );
void Insert(const String &);
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/shells/textfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/shells/textfld.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/shells/textfld.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/shells/textfld.cxx Wed Dec 18 12:36:23 2013
@@ -367,15 +367,10 @@ void SwTextShell::ExecField(SfxRequest &
if( !(sAuthor = aUserOpt.GetID()).Len() )
sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
- // Save the current selection, it will be required later for fieldmark insertion.
- const SwPaM& rCurrPaM = rSh.GetCurrentShellCursor();
- const SwPaM aSavedPaM( *rCurrPaM.GetPoint(), *rCurrPaM.GetMark() );
-
if( rSh.HasSelection() )
{
rSh.NormalizePam( sal_False );
rSh.KillPams();
- rSh.ClearMark();
}
// #120513# Inserting a comment into an autocompletion crashes
@@ -383,7 +378,7 @@ void SwTextShell::ExecField(SfxRequest &
GetView().GetEditWin().StopQuickHelp();
SwInsertFld_Data aData(TYP_POSTITFLD, 0, sAuthor, aEmptyStr, 0);
- aFldMgr.InsertFld( aData, &aSavedPaM );
+ aFldMgr.InsertFld( aData );
rSh.Push();
rSh.SwCrsrShell::Left(1, CRSR_SKIP_CHARS, sal_False);
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/uiview/view2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/uiview/view2.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/uiview/view2.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/uiview/view2.cxx Wed Dec 18 12:36:23 2013
@@ -1938,7 +1938,7 @@ sal_Bool SwView::JumpToSwMark( const Str
bRet = sal_True;
}
}
- else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) )
+ else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) )
pWrtShell->GotoMark( ppMark->get(), sal_False, sal_True ), bRet = sal_True;
else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) ))
bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() );
@@ -1960,7 +1960,7 @@ sal_Bool SwView::JumpToSwMark( const Str
}
}
}
- else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)))
+ else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)))
pWrtShell->GotoMark( ppMark->get(), sal_False, sal_True ), bRet = sal_True;
else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) ))
bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() );
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/uiview/viewmdi.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/uiview/viewmdi.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/uiview/viewmdi.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/uiview/viewmdi.cxx Wed Dec 18 12:36:23 2013
@@ -455,8 +455,8 @@ IMPL_STATIC_LINK( SwView, MoveNavigation
// collect navigator reminders
IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
::std::vector< const ::sw::mark::IMark* > vNavMarks;
- for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
- ppMark != pMarkAccess->getMarksEnd();
+ for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
+ ppMark != pMarkAccess->getAllMarksEnd();
ppMark++)
{
if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER )
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/bookctrl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/bookctrl.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/bookctrl.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/bookctrl.cxx Wed Dec 18 12:36:23 2013
@@ -128,7 +128,7 @@ void SwBookmarkControl::Command( const C
CaptureMouse();
BookmarkPopup_Impl aPop;
SwWrtShell* pWrtShell = ::GetActiveWrtShell();
- if( pWrtShell && pWrtShell->getIDocumentMarkAccess()->getMarksCount() > 0 )
+ if( pWrtShell && pWrtShell->getIDocumentMarkAccess()->getAllMarksCount() > 0 )
{
IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess();
IDocumentMarkAccess::const_iterator_t ppBookmarkStart = pMarkAccess->getBookmarksBegin();
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/content.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/content.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/content.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/content.cxx Wed Dec 18 12:36:23 2013
@@ -420,7 +420,7 @@ void SwContentType::Init(sal_Bool* pbInv
{
if ( (*i)->GetBroadCaster()->ISA(SwFmtFld)) // SwPostit
{
- SwFmtFld* aFmtFld = static_cast<SwFmtFld*>((*i)->GetBroadCaster());
+ const SwFmtFld* aFmtFld = static_cast<const SwFmtFld*>((*i)->GetBroadCaster());
if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
{
@@ -429,7 +429,7 @@ void SwContentType::Init(sal_Bool* pbInv
SwPostItContent* pCnt = new SwPostItContent(
this,
sEntry,
- (const SwFmtFld*)aFmtFld,
+ aFmtFld,
nMemberCount);
pMember->Insert(pCnt);
nMemberCount++;
@@ -768,7 +768,7 @@ void SwContentType::FillMemberList(sal_B
{
if ( (*i)->GetBroadCaster()->ISA(SwFmtFld)) // SwPostit
{
- SwFmtFld* aFmtFld = static_cast<SwFmtFld*>((*i)->GetBroadCaster());
+ const SwFmtFld* aFmtFld = static_cast<const SwFmtFld*>((*i)->GetBroadCaster());
if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
{
@@ -777,7 +777,7 @@ void SwContentType::FillMemberList(sal_B
SwPostItContent* pCnt = new SwPostItContent(
this,
sEntry,
- (const SwFmtFld*)aFmtFld,
+ aFmtFld,
nMemberCount);
pMember->Insert(pCnt);
nMemberCount++;
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/navipi.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/navipi.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/navipi.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/utlui/navipi.cxx Wed Dec 18 12:36:23 2013
@@ -598,8 +598,8 @@ void SwNavigationPI::MakeMark()
// collect and sort navigator reminder names
::std::vector< ::rtl::OUString > vNavMarkNames;
- for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
- ppMark != pMarkAccess->getMarksEnd();
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
+ ppMark != pMarkAccess->getAllMarksEnd();
ppMark++)
if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER )
vNavMarkNames.push_back(ppMark->get()->GetName());
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh2.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh2.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh2.cxx Wed Dec 18 12:36:23 2013
@@ -65,7 +65,6 @@
#include "swabstdlg.hxx"
#include "fldui.hrc"
#include <SwRewriter.hxx>
-#include <xmloff/odffields.hxx>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -75,9 +74,7 @@
Beschreibung:
------------------------------------------------------------------------*/
-void SwWrtShell::Insert(
- SwField& rFld,
- const SwPaM* pCommentRange )
+void SwWrtShell::Insert( SwField& rFld )
{
ResetCursorStack();
if(!_CanInsert())
@@ -89,25 +86,37 @@ void SwWrtShell::Insert(
StartUndo(UNDO_INSERT, &aRewriter);
- if ( pCommentRange && GetDoc() )
+ bool bDeleted = false;
+ const SwPaM* pAnnotationTextRange = NULL;
+ if ( HasSelection() )
{
- // If an annotation field is inserted, take care of the relevant fieldmark.
- IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess();
- sw::mark::IFieldmark* pFieldmark =
- pMarksAccess->makeFieldBookmark(
- *pCommentRange,
- ::rtl::OUString(),
- ::rtl::OUString::createFromAscii( ODF_COMMENTRANGE ) );
- ((SwPostItField&)rFld).SetName(pFieldmark->GetName());
+ if ( rFld.GetTyp()->Which() == RES_POSTITFLD )
+ {
+ // for annotation fields:
+ // - keep the current selection in order to create a corresponding annotation mark
+ // - collapse cursur to its point
+ const SwPaM& rCurrPaM = GetCurrentShellCursor();
+ pAnnotationTextRange = new SwPaM( *rCurrPaM.GetPoint(), *rCurrPaM.GetMark() );
+ ClearMark();
+ }
+ else
+ {
+ bDeleted = DelRight() != 0;
+ }
}
- bool bDeleted = false;
- if( HasSelection() )
+ SwEditShell::Insert2(rFld, bDeleted);
+
+ if ( pAnnotationTextRange != NULL )
{
- bDeleted = DelRight() != 0;
+ if ( GetDoc() != NULL )
+ {
+ IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess();
+ pMarksAccess->makeAnnotationMark( *pAnnotationTextRange, ::rtl::OUString() );
+ }
+ delete pAnnotationTextRange;
}
- SwEditShell::Insert2(rFld, bDeleted);
EndUndo();
EndAllAction();
}
Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh3.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh3.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh3.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh3.cxx Wed Dec 18 12:36:23 2013
@@ -147,7 +147,7 @@ void SwWrtShell::DrawSelChanged( )
sal_Bool SwWrtShell::GotoMark( const ::rtl::OUString& rName )
{
IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark( rName );
- if(ppMark == getIDocumentMarkAccess()->getMarksEnd()) return false;
+ if(ppMark == getIDocumentMarkAccess()->getAllMarksEnd()) return false;
return MoveBookMark( BOOKMARK_INDEX, ppMark->get() );
}
Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper.cxx (original)
+++ openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper.cxx Wed Dec 18 12:36:23 2013
@@ -2078,10 +2078,10 @@ void DomainMapper::lcl_attribute(Id nNam
m_pImpl->SetCurrentRedlineInitials(sStringValue);
break;
case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart:
- m_pImpl->AddAnnotationPosition(true);
+ m_pImpl->AddAnnotationPosition( true, nIntValue );
break;
case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd:
- m_pImpl->AddAnnotationPosition(false);
+ m_pImpl->AddAnnotationPosition( false, nIntValue );
break;
case NS_ooxml::LN_token:
/* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx (original)
+++ openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx Wed Dec 18 12:36:23 2013
@@ -148,6 +148,9 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bParaChanged( false ),
m_bIsLastParaInSection( false ),
m_bIsInComments( false )
+ , m_xAnnotationField()
+ , m_nAnnotationId( -1 )
+ , m_aAnnotationPositions()
{
appendTableManager( );
GetBodyText();
@@ -1279,30 +1282,33 @@ void DomainMapper_Impl::PopAnnotation()
RemoveLastParagraph();
m_aTextAppendStack.pop();
- // See if the annotation will be a single position or a range.
- if ( !m_aAnnotationPosition.m_xStart.is()
- || !m_aAnnotationPosition.m_xEnd.is() )
+ if ( m_nAnnotationId != -1 )
{
- uno::Sequence< beans::PropertyValue > aEmptyProperties;
- appendTextContent( uno::Reference< text::XTextContent >( m_xAnnotationField, uno::UNO_QUERY_THROW ), aEmptyProperties );
- }
- else
- {
- // Create a range that points to the annotation start/end.
- uno::Reference<text::XText> xText = m_aAnnotationPosition.m_xStart->getText();
- uno::Reference<text::XTextCursor> xCursor = xText->createTextCursorByRange(m_aAnnotationPosition.m_xStart);
- xCursor->gotoRange(m_aAnnotationPosition.m_xEnd, true);
- uno::Reference<text::XTextRange> xTextRange(xCursor, uno::UNO_QUERY_THROW);
-
- // Attach the annotation to the range.
- uno::Reference<text::XTextAppend> xTextAppend = m_aTextAppendStack.top().xTextAppend;
- xTextAppend->insertTextContent(xTextRange, uno::Reference<text::XTextContent>(m_xAnnotationField, uno::UNO_QUERY_THROW), !xCursor->isCollapsed());
+ // See if the annotation will be a single position or a range.
+ AnnotationPosition& aAnnotationPosition = m_aAnnotationPositions[ m_nAnnotationId ];
+ if ( !aAnnotationPosition.m_xStart.is()
+ || !aAnnotationPosition.m_xEnd.is() )
+ {
+ uno::Sequence< beans::PropertyValue > aEmptyProperties;
+ appendTextContent( uno::Reference< text::XTextContent >( m_xAnnotationField, uno::UNO_QUERY_THROW ), aEmptyProperties );
+ }
+ else
+ {
+ // Create a range that points to the annotation start/end.
+ uno::Reference<text::XText> xText = aAnnotationPosition.m_xStart->getText();
+ uno::Reference<text::XTextCursor> xCursor = xText->createTextCursorByRange( aAnnotationPosition.m_xStart );
+ xCursor->gotoRange( aAnnotationPosition.m_xEnd, true );
+ uno::Reference<text::XTextRange> xTextRange(xCursor, uno::UNO_QUERY_THROW);
+
+ // Attach the annotation to the range.
+ uno::Reference<text::XTextAppend> xTextAppend = m_aTextAppendStack.top().xTextAppend;
+ xTextAppend->insertTextContent(xTextRange, uno::Reference<text::XTextContent>(m_xAnnotationField, uno::UNO_QUERY_THROW), !xCursor->isCollapsed());
+ }
+ m_aAnnotationPositions.erase( m_nAnnotationId );
}
- m_aAnnotationPosition.m_xStart.clear();
- m_aAnnotationPosition.m_xEnd.clear();
m_xAnnotationField.clear();
-
+ m_nAnnotationId = -1;
}
void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape > xShape )
@@ -2912,7 +2918,9 @@ void DomainMapper_Impl::handleToc
pContext->SetTOC( xTOC );
}
-void DomainMapper_Impl::AddAnnotationPosition(const bool bStart)
+void DomainMapper_Impl::AddAnnotationPosition(
+ const bool bStart,
+ const sal_Int32 nAnnotationId )
{
if (m_aTextAppendStack.empty())
return;
@@ -2927,14 +2935,16 @@ void DomainMapper_Impl::AddAnnotationPos
}
// And save it, to be used by PopAnnotation() later.
- if (bStart)
+ AnnotationPosition& aAnnotationPosition = m_aAnnotationPositions[ nAnnotationId ];
+ if ( bStart )
{
- m_aAnnotationPosition.m_xStart = xCurrent;
+ aAnnotationPosition.m_xStart = xCurrent;
}
else
{
- m_aAnnotationPosition.m_xEnd = xCurrent;
+ aAnnotationPosition.m_xEnd = xCurrent;
}
+ m_aAnnotationPositions[ nAnnotationId ] = aAnnotationPosition;
}
/*-- 29.01.2007 11:33:16---------------------------------------------------
@@ -3810,9 +3820,16 @@ void DomainMapper_Impl::SetCurrentRedlin
void DomainMapper_Impl::SetCurrentRedlineId( sal_Int32 sId )
{
- RedlineParamsPtr pCurrent( GetTopRedline( ) );
- if ( pCurrent.get( ) )
- pCurrent->m_nId = sId;
+ if (m_xAnnotationField.is())
+ {
+ m_nAnnotationId = sId;
+ }
+ else
+ {
+ RedlineParamsPtr pCurrent( GetTopRedline( ) );
+ if ( pCurrent.get( ) )
+ pCurrent->m_nId = sId;
+ }
}
void DomainMapper_Impl::SetCurrentRedlineToken( sal_Int32 nToken )
Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx (original)
+++ openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx Wed Dec 18 12:36:23 2013
@@ -51,6 +51,7 @@
#include <FFDataHandler.hxx>
#include <FormControlHelper.hxx>
#include <map>
+#include <hash_map>
#include <string.h>
@@ -249,6 +250,7 @@ struct AnnotationPosition
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xStart;
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xEnd;
};
+typedef std::unordered_map< sal_Int32, AnnotationPosition > AnnotationPositions_t;
struct RedlineParams
{
@@ -363,8 +365,9 @@ private:
bool m_bIsInComments;
//annotation import
- uno::Reference< beans::XPropertySet > m_xAnnotationField;
- AnnotationPosition m_aAnnotationPosition;
+ uno::Reference< beans::XPropertySet > m_xAnnotationField;
+ sal_Int32 m_nAnnotationId;
+ AnnotationPositions_t m_aAnnotationPositions;
void GetCurrentLocale(::com::sun::star::lang::Locale& rLocale);
void SetNumberFormat( const ::rtl::OUString& rCommand,
@@ -553,7 +556,9 @@ public:
void AddBookmark( const ::rtl::OUString& rBookmarkName, const ::rtl::OUString& rId );
- void AddAnnotationPosition(const bool bStart);
+ void AddAnnotationPosition(
+ const bool bStart,
+ const sal_Int32 nAnnotationId );
DomainMapperTableManager& getTableManager()
{
Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/PropertyMap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/PropertyMap.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/PropertyMap.cxx (original)
+++ openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/PropertyMap.cxx Wed Dec 18 12:36:23 2013
@@ -995,19 +995,28 @@ void SectionPropertyMap::CloseSectionGro
uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration( );
xRangeProperties = uno::Reference< beans::XPropertySet >( xEnum->nextElement( ), uno::UNO_QUERY_THROW );
}
- else
+ else if( m_xStartingRange.is() )
+ {
xRangeProperties = uno::Reference< beans::XPropertySet >( m_xStartingRange, uno::UNO_QUERY_THROW );
- /* break type
- 0 - No break 1 - New Column 2 - New page 3 - Even page 4 - odd page */
- xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
- uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
- // todo: page breaks with odd/even page numbering are not available - find out current page number to check how to change the number
- // or add even/odd page break types
- if(m_bPageNoRestart || m_nPageNumber >= 0)
+ }
+ if ( xRangeProperties.is() )
{
- sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
- xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_NUMBER_OFFSET ),
- uno::makeAny( nPageNumber ));
+ /* break type: 0 - No break 1 - New Column 2 - New page 3 - Even page 4 - odd page */
+ uno::Reference< beans::XPropertySetInfo > xRangePropertiesInfo = xRangeProperties->getPropertySetInfo();
+ if ( xRangePropertiesInfo->hasPropertyByName( rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ) ) )
+ {
+ xRangeProperties->setPropertyValue(
+ rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
+ uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ) );
+ // todo: page breaks with odd/even page numbering are not available - find out current page number to check how to change the number
+ // or add even/odd page break types
+ if ( m_bPageNoRestart || m_nPageNumber >= 0 )
+ {
+ sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
+ xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_NUMBER_OFFSET ),
+ uno::makeAny( nPageNumber ));
+ }
+ }
}
}
}
Modified: openoffice/branches/ooxml-osba/main/xmloff/inc/txtfldi.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/xmloff/inc/txtfldi.hxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/xmloff/inc/txtfldi.hxx (original)
+++ openoffice/branches/ooxml-osba/main/xmloff/inc/txtfldi.hxx Wed Dec 18 12:36:23 2013
@@ -1362,8 +1362,7 @@ class XMLAnnotationImportContext : publi
com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > mxField;
com::sun::star::uno::Reference < com::sun::star::text::XTextCursor > mxCursor;
com::sun::star::uno::Reference < com::sun::star::text::XTextCursor > mxOldCursor;
- /// If this is an annotation end, then position of the start.
- com::sun::star::uno::Reference < com::sun::star::text::XTextContent > m_xStart;
+
const sal_uInt16 m_nToken;
public:
@@ -1385,8 +1384,7 @@ protected:
/// set properties
virtual void PrepareField(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet> & xPropertySet);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xPropertySet);
virtual SvXMLImportContext *CreateChildContext(
sal_uInt16 nPrefix,