20#include <config_wasm_strip.h>
22#include <boost/property_tree/json_parser.hpp>
79#include <LibreOfficeKit/LibreOfficeKitEnums.h>
86#define POSTIT_INITIAL_ANCHOR_DISTANCE 20
88#define POSTIT_SPACE_BETWEEN 8
89#define POSTIT_MINIMUMSIZE_WITH_META 60
90#define POSTIT_SCROLL_SIDEBAR_HEIGHT 20
93#define MAX_LOOP_COUNT 50
102 bool comp_pos(
const std::unique_ptr<SwSidebarItem>&
a,
const std::unique_ptr<SwSidebarItem>& b)
106 SwPosition aPosAnchorB = b->GetAnchorPosition();
108 bool aAnchorAInFooter =
false;
109 bool aAnchorBInFooter =
false;
113 aAnchorAInFooter =
true;
115 aAnchorBInFooter =
true;
120 if( aAnchorAInFooter && !aAnchorBInFooter )
124 else if( !aAnchorAInFooter && aAnchorBInFooter )
131 return aPosAnchorA < aPosAnchorB;
140 boost::property_tree::ptree aAnnotation;
141 aAnnotation.put(
"action", (
nType == CommentNotificationType::Add ?
"Add" :
142 (
nType == CommentNotificationType::Remove ?
"Remove" :
143 (
nType == CommentNotificationType::Modify ?
"Modify" :
144 (
nType == CommentNotificationType::Resolve ?
"Resolve" :
"???")))));
145 aAnnotation.put(
"id", nPostItId);
146 if (
nType != CommentNotificationType::Remove && pItem !=
nullptr)
154 aRect.
Pos().getX() + aRect.
SSize().Width(),
155 aRect.
Pos().getY() + aRect.
SSize().Height());
163 std::vector<OString> aRects;
166 const SwRect rect(aRange.getMinX(), aRange.getMinY(), aRange.getWidth(), aRange.getHeight());
172 aAnnotation.put(
"parent", pWin->
CalcParent());
173 aAnnotation.put(
"paraIdParent", pField->
GetParentId());
174 aAnnotation.put(
"author", pField->
GetPar1().toUtf8().getStr());
175 aAnnotation.put(
"text", pField->
GetPar2().toUtf8().getStr());
176 aAnnotation.put(
"resolved", pField->
GetResolved() ?
"true" :
"false");
178 aAnnotation.put(
"anchorPos", aSVRect.
toString());
179 aAnnotation.put(
"textRange", sRects.getStr());
182 boost::property_tree::ptree aTree;
183 aTree.add_child(
"comment", aAnnotation);
184 std::stringstream aStream;
185 boost::property_tree::write_json(aStream, aTree);
186 std::string aPayload = aStream.str();
198 , mpWrtShell(
mpView->GetDocShell()->GetWrtShell())
199 , mpEditWin(&
mpView->GetEditWin())
201 , mbWaitingForCalcRects(false)
202 , mpActivePostIt(nullptr)
208 , mbIsShowAnchor( false )
217 SW_MOD()->GetRedlineAuthor();
251 bool bRemoved =
false;
259 if((*it)->mpPostIt && (*it)->mpPostIt->GetPostItField())
260 lcl_CommentNotification(
mpView, CommentNotificationType::Remove,
nullptr, (*it)->mpPostIt->GetPostItField()->GetPostItId());
262 std::unique_ptr<SwSidebarItem>
p = std::move(*it);
266 p->mpPostIt.disposeAndClear();
271 lcl_CommentNotification(
mpView, CommentNotificationType::Remove,
nullptr, pPostItField->
GetPostItId());
306 if ( postItField->GetBroadcaster() == pItem )
313 if (
auto pSwFormatField =
dynamic_cast< SwFormatField *
>( pItem ))
315 mvPostItFields.push_back(std::make_unique<SwAnnotationItem>(*pSwFormatField, bFocus));
318 assert(
dynamic_cast< const SwFormatField *
>( pItem ) &&
"Mgr::InsertItem: seems like new stuff was added");
320 return pAnnotationItem;
327 [&pBroadcast](
const std::unique_ptr<SwSidebarItem>& pField) { return pField->GetBroadcaster() == pBroadcast; });
330 std::unique_ptr<SwSidebarItem>
p = std::move(*
i);
339 p->mpPostIt.disposeAndClear();
349 if ( pSfxEventHint->GetEventId() == SfxEventHintId::SwEventLayoutFinished )
361 switch ( pFormatHint->Which() )
385 OSL_FAIL(
"Inserted field not in document!" );
407 lcl_CommentNotification(
mpView, CommentNotificationType::Remove,
nullptr, pPostItField->
GetPostItId());
414 if (pFormatHint->GetView()==
mpView)
424 if ( pFormatField == postItField->GetBroadcaster() )
426 if (postItField->mpPostIt)
428 postItField->mpPostIt->SetPostItText();
436 lcl_CommentNotification(
mpView, CommentNotificationType::Modify, postItField.get(), 0);
438 lcl_CommentNotification(
mpView, CommentNotificationType::Resolve, postItField.get(), 0);
447 else if (
const SfxStyleSheetModifiedHint * pStyleHint =
dynamic_cast<const SfxStyleSheetModifiedHint*
>(&rHint) )
451 auto pField =
static_cast<SwPostItField*
>(postItField->GetFormatField().GetField());
460 case SfxHintId::ModeChanged:
470 case SfxHintId::DocChanged:
482 case SfxHintId::LanguageChanged:
487 case SfxHintId::SwSplitNodeOperation:
493 case SfxHintId::Dying:
498 OSL_FAIL(
"Notification for removed SwFormatField was not sent!");
519 if ( &rBC == postItField->GetBroadcaster() )
521 if (postItField->mpPostIt)
523 if (postItField->mpPostIt->IsResolved() &&
529 postItField->mpPostIt->GrabFocus();
535 postItField->mbFocus =
true;
551 bool bChange =
false;
552 bool bRepair =
false;
561 OSL_FAIL(
"PostIt is not in doc or other wrong use");
565 const SwRect aOldAnchorRect( pItem->maLayoutInfo.mPosition );
567 const SwNodeOffset nOldStartNodeIdx( pItem->maLayoutInfo.mnStartNodeIdx );
568 const sal_Int32 nOldStartContent( pItem->maLayoutInfo.mnStartContent );
573 const ::sw::mark::IMark* pAnnotationMark =
574 pTextAnnotationField !=
nullptr ? pTextAnnotationField->
GetAnnotationMark() :
nullptr;
575 if ( pAnnotationMark !=
nullptr )
577 pItem->mLayoutStatus =
580 pItem->GetAnchorPosition(),
585 pItem->mLayoutStatus =
590 || pItem->maLayoutInfo.mPosition != aOldAnchorRect
591 || pItem->mLayoutStatus != eOldLayoutStatus
592 || pItem->maLayoutInfo.mnStartNodeIdx != nOldStartNodeIdx
593 || pItem->maLayoutInfo.mnStartContent != nOldStartContent;
607 pItem->mpPostIt->HideNote();
616 pItem->mpPostIt->HideNote();
621 const tools::ULong aPageNum = pItem->maLayoutInfo.mnPageNumber;
622 if (aPageNum >
mPages.size())
626 for (
tools::ULong j=0; j<aPageNum - nNumberOfPages; ++j)
629 mPages[aPageNum-1]->mvSidebarItems.push_back(pItem.get());
630 mPages[aPageNum-1]->mPageRect = pItem->maLayoutInfo.mPageFrame;
631 mPages[aPageNum-1]->eSidebarPosition = pItem->maLayoutInfo.meSidebarPosition;
662 if (postItField->mbShow && postItField->mpPostIt && postItField->mpPostIt->HasScrollbar())
674 if (lContainerSize < lPageSize)
676 mPages.reserve(lPageSize);
680 else if (lContainerSize > lPageSize)
682 for (
int i=
mPages.size()-1;
i >= lPageSize;--
i)
688 for (
auto const& page :
mPages)
690 page->mvSidebarItems.clear();
692 page->bScrollbar =
false;
710 bool bUpdate =
false;
711 for (std::unique_ptr<SwPostItPageItem>& pPage :
mPages)
714 if (!pPage->mvSidebarItems.empty())
716 std::vector<SwAnnotationWin*> aVisiblePostItList;
721 for (
auto const& pItem : pPage->mvSidebarItems)
732 ? pItem->maLayoutInfo.mPagePrtArea.Left()
733 : pPage->mPageRect.Left() + 350;
742 ? pItem->maLayoutInfo.mPagePrtArea.Right() :
743 pPage->mPageRect.Right() - 350;
754 pPostIt->InitControls();
756 pItem->mpPostIt = pPostIt;
759 if (
static_cast<bool>(pPostIt->CalcParent()))
765 pPostIt->SetChangeTracking(
766 pItem->mLayoutStatus,
768 pPostIt->SetSidebarPosition(pPage->eSidebarPosition);
769 pPostIt->SetFollow(
static_cast<bool>(pPostIt->CalcParent()));
770 aPostItHeight = ( pPostIt->GetPostItTextHeight() < pPostIt->GetMinimumSizeWithoutMeta()
771 ? pPostIt->GetMinimumSizeWithoutMeta()
772 : pPostIt->GetPostItTextHeight() )
773 + pPostIt->GetMetaHeight();
774 pPostIt->SetPosSizePixelRect( mlPageBorder ,
778 pItem->maLayoutInfo.mPosition,
780 pPostIt->ChangeSidebarItem( *pItem );
785 pPostIt->GrabFocus();
786 pItem->mbFocus =
false;
789 aVisiblePostItList.push_back(pPostIt);
790 lNeededHeight += pPostIt->IsFollow() ? aPostItHeight : aPostItHeight+
GetSpaceBetween();
799 if ((!aVisiblePostItList.empty()) &&
ShowNotes())
801 bool bOldScrollbar = pPage->bScrollbar;
803 pPage->bScrollbar =
LayoutByPage(aVisiblePostItList, pPage->mPageRect.SVRect(), lNeededHeight);
805 pPage->bScrollbar =
false;
806 if (!pPage->bScrollbar)
814 tools::Long lOffset = -1 * nScrollSize * (aVisiblePostItList.size() - aAvailableHeight / nScrollSize);
815 if (pPage->lOffset < lOffset)
816 pPage->lOffset = lOffset;
818 bUpdate = (bOldScrollbar != pPage->bScrollbar) || bUpdate;
825 for (
auto const& visiblePostIt : aVisiblePostItList)
827 if (pPage->lOffset != 0)
828 visiblePostIt->TranslateTopPosition(pPage->lOffset);
830 bool bBottom =
mpEditWin->PixelToLogic(
Point(0,visiblePostIt->VirtualPos().Y()+visiblePostIt->VirtualSize().Height())).Y() <= (pPage->mPageRect.Bottom()-aSidebarheight);
831 bool bTop =
mpEditWin->PixelToLogic(
Point(0,visiblePostIt->VirtualPos().Y())).Y() >= (pPage->mPageRect.Top()+aSidebarheight);
832 if ( bBottom && bTop )
842 visiblePostIt->ShowNote();
848 if (
mpEditWin->PixelToLogic(
Point(0,visiblePostIt->VirtualPos().Y())).Y() < (pPage->mPageRect.Top()+aSidebarheight))
851 visiblePostIt->ShowAnchorOnly(
Point( pPage->mPageRect.Left(),
852 pPage->mPageRect.Top()));
854 visiblePostIt->ShowAnchorOnly(
Point( pPage->mPageRect.Right(),
855 pPage->mPageRect.Top()));
860 visiblePostIt->ShowAnchorOnly(
Point(pPage->mPageRect.Left(),
861 pPage->mPageRect.Bottom()));
863 visiblePostIt->ShowAnchorOnly(
Point(pPage->mPageRect.Right(),
864 pPage->mPageRect.Bottom()));
866 OSL_ENSURE(pPage->bScrollbar,
"SwPostItMgr::LayoutByPage(): note overlaps, but bScrollbar is not true");
872 for (
auto const& visiblePostIt : aVisiblePostItList)
874 visiblePostIt->SetPosAndSize();
877 bool bOldScrollbar = pPage->bScrollbar;
878 pPage->bScrollbar =
false;
879 bUpdate = (bOldScrollbar != pPage->bScrollbar) || bUpdate;
882 for (
auto const& visiblePostIt : aVisiblePostItList)
886 if (visiblePostIt->GetSidebarItem().mbPendingLayout)
887 lcl_CommentNotification(
mpView, CommentNotificationType::Add, &visiblePostIt->GetSidebarItem(), 0);
888 else if (visiblePostIt->IsAnchorRectChanged())
890 lcl_CommentNotification(
mpView, CommentNotificationType::Modify, &visiblePostIt->GetSidebarItem(), 0);
891 visiblePostIt->ResetAnchorRectChanged();
896 visiblePostIt->GetSidebarItem().mbPendingLayout =
false;
901 if (pPage->bScrollbar)
903 pPage->bScrollbar =
false;
910 bool bRepair =
false;
915 OSL_FAIL(
"PostIt is not in doc!");
920 if (postItField->mpPostIt)
922 postItField->mpPostIt->HideNote();
923 if (postItField->mpPostIt->HasChildPathFocus())
926 postItField->mpPostIt->GrabFocusToDocument();
949 if (
mPages[aPage-1]->mvSidebarItems.empty() )
951 OSL_FAIL(
"Notes SidePane painted but no rects and page lists calculated!");
955 auto aItem =
mPages[aPage-1]->mvSidebarItems.end();
957 OSL_ENSURE ((*aItem)->mpPostIt,
"BorderOverPageBorder: NULL postIt, should never happen");
958 if ((*aItem)->mpPostIt)
961 const tools::Long aEndValue =
mpEditWin->PixelToLogic(
Point(0,(*aItem)->mpPostIt->GetPosPixel().Y()+(*aItem)->mpPostIt->GetSizePixel().Height())).Y();
962 return aEndValue <=
mPages[aPage-1]->mPageRect.Bottom()-aSidebarheight;
970 assert(nPage <
mPages.size());
971 if (nPage >=
mPages.size())
973 for (
auto const& pItem :
mPages[nPage]->mvSidebarItems)
985 for (
const std::unique_ptr<SwSidebarItem>& pItem :
mvPostItFields)
991 bool bEnableMapMode = !
mpEditWin->IsMapModeEnabled();
1001 pPostIt->
PaintTile(rRenderContext, aRectangle);
1003 rRenderContext.
Pop();
1011 OSL_ENSURE((lScroll %
GetScrollSize() )==0,
"SwPostItMgr::Scroll: scrolling by wrong value");
1019 for (
auto const& item :
mPages[aPage-1]->mvSidebarItems)
1030 if ( bBottom && bTop)
1053 mPages[aPage-1]->lOffset += lScroll;
1064 if (!
mPages[aPage-1]->bScrollbar)
1070 if ( !(bBottom && bTop))
1077 assert(nScrollSize);
1078 const tools::Long lScroll = bBottom ? (aDiff + ( nScrollSize - (aDiff % nScrollSize))) : (aDiff - (nScrollSize + (aDiff % nScrollSize)));
1087 std::vector<SwPostItPageItem*>::size_type
n=0;
1088 for (
auto const& page :
mPages)
1090 for (
auto const& item : page->mvSidebarItems)
1092 if (item->mpPostIt==pPostIt)
1113 return (
mPages[aPage-1]->lOffset != 0);
1119 default:
return false;
1150 const tools::Long lVisibleHeight = lBottomBorder - lTopBorder;
1151 const size_t nPostItListSize = aVisiblePostItList.size();
1153 bool bScrollbars =
false;
1156 if (nPostItListSize > 0 && lVisibleHeight < lNeededHeight)
1165 for (
auto const& visiblePostIt : aVisiblePostItList)
1166 visiblePostIt->SetSize(
Size(visiblePostIt->VirtualSize().getWidth(),visiblePostIt->GetMinimumSizeWithMeta()));
1170 for (
auto const& visiblePostIt : aVisiblePostItList)
1172 if ( visiblePostIt->VirtualSize().getHeight() > lAverageHeight)
1173 visiblePostIt->SetSize(
Size(visiblePostIt->VirtualSize().getWidth(),lAverageHeight));
1179 if (aVisiblePostItList.size()>1)
1189 for(
auto i = aVisiblePostItList.begin();
i != aVisiblePostItList.end() ; ++
i)
1191 auto aNextPostIt =
i;
1194 if (aNextPostIt != aVisiblePostItList.end())
1196 lTranslatePos = ( (*i)->VirtualPos().Y() + (*i)->VirtualSize().Height()) - (*aNextPostIt)->VirtualPos().Y();
1197 if (lTranslatePos > 0)
1204 if ( (lSpaceUsed <= (*i)->VirtualPos().Y()) || (
i==aVisiblePostItList.begin()))
1207 if ( ((*i)->VirtualPos().Y()- lTranslatePos -
GetSpaceBetween()) > lTopBorder)
1209 if ((*aNextPostIt)->IsFollow())
1216 tools::Long lMoveUp = (*i)->VirtualPos().Y() - lTopBorder;
1217 (*i)->TranslateTopPosition(-1* lMoveUp);
1218 if ((*aNextPostIt)->IsFollow())
1219 (*aNextPostIt)->TranslateTopPosition( (lTranslatePos+
ANCHORLINE_WIDTH) - lMoveUp);
1221 (*aNextPostIt)->TranslateTopPosition( (lTranslatePos+
GetSpaceBetween()) - lMoveUp);
1227 if ((*aNextPostIt)->IsFollow())
1230 (*aNextPostIt)->TranslateTopPosition(lTranslatePos+
GetSpaceBetween());
1236 if (
i==aVisiblePostItList.begin())
1238 tools::Long lMoveDown = lTopBorder - (*i)->VirtualPos().Y();
1242 (*i)->TranslateTopPosition( lMoveDown);
1246 if ( (*aNextPostIt)->IsFollow() )
1254 auto aPrevPostIt =
i;
1256 lTranslatePos = ( (*aPrevPostIt)->VirtualPos().Y() + (*aPrevPostIt)->VirtualSize().Height() ) - (*i)->VirtualPos().Y();
1257 if (lTranslatePos > 0)
1260 if ( ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height()+lTranslatePos) < lBottomBorder)
1262 if ( (*i)->IsFollow() )
1269 (*i)->TranslateTopPosition(lBottomBorder - ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height()) );
1276 if (!bScrollbars && ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height() > lBottomBorder) )
1279 (*i)->TranslateTopPosition(lBottomBorder - ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height()));
1287 OSL_FAIL(
"PostItMgr::Layout(): We are looping forever");
1295 auto i = aVisiblePostItList.begin();
1296 lTranslatePos = lTopBorder - (*i)->VirtualPos().Y();
1297 if (lTranslatePos>0)
1301 lTranslatePos = lBottomBorder - ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height());
1302 if (lTranslatePos<0)
1304 (*i)->TranslateTopPosition(lTranslatePos);
1315 std::vector<SwFormatField*> vFormatFields;
1317 for(
auto pFormatField : vFormatFields)
1318 InsertItem(pFormatField, bCheckExistence, bFocus);
1329 postItField->mpPostIt.disposeAndClear();
1330 postItField.reset();
1343 virtual bool operator()(
const SwFormatField* pField)
const = 0;
1344 virtual ~FilterFunctor() {}
1347class IsPostitField :
public FilterFunctor
1356class IsPostitFieldWithAuthorOf :
public FilterFunctor
1360 explicit IsPostitFieldWithAuthorOf(OUString aAuthor)
1361 : m_sAuthor(
std::move(aAuthor))
1372class IsPostitFieldWithPostitId :
public FilterFunctor
1374 sal_uInt32 m_nPostItId;
1376 explicit IsPostitFieldWithPostitId(sal_uInt32 nPostItId)
1377 : m_nPostItId(nPostItId)
1388class IsFieldNotDeleted :
public FilterFunctor
1392 FilterFunctor
const& m_rNext;
1396 const FilterFunctor & rNext)
1403 if (!m_rNext(pField))
1420 std::vector<std::unique_ptr<SwSidebarItem>>& m_aSidebarItems;
1421 std::vector<const SwFormatField*> m_aFormatFields;
1423 FilterFunctor& m_rFilter;
1431 bool bAllInvalidated =
false;
1435 bAllInvalidated = pField ==
nullptr;
1436 if (!bAllInvalidated && m_rFilter(pField))
1439 m_aFormatFields.erase(std::remove(m_aFormatFields.begin(), m_aFormatFields.end(), pField), m_aFormatFields.end());
1445 bAllInvalidated = pField ==
nullptr;
1446 if (!bAllInvalidated && m_rFilter(pField))
1449 m_aFormatFields.push_back(pField);
1453 if (bAllInvalidated)
1460 FieldDocWatchingStack(std::vector<std::unique_ptr<SwSidebarItem>>& in,
SwDocShell &rDocShell, FilterFunctor& rFilter)
1461 : m_aSidebarItems(
in)
1462 , m_rDocShell(rDocShell)
1463 , m_rFilter(rFilter)
1470 EndListeningToAllFields();
1471 m_aFormatFields.clear();
1472 m_aFormatFields.reserve(m_aSidebarItems.size());
1473 for (
auto const& p : m_aSidebarItems)
1476 if (!m_rFilter(&rField))
1479 m_aFormatFields.push_back(&rField);
1482 void EndListeningToAllFields()
1484 for (
auto const& pField : m_aFormatFields)
1489 virtual ~FieldDocWatchingStack()
override
1491 EndListeningToAllFields();
1496 if (m_aFormatFields.empty())
1500 m_aFormatFields.pop_back();
1521 IsPostitFieldWithAuthorOf aFilter(rAuthor);
1523 IsFieldNotDeleted aFilter2(rIDRA, aFilter);
1550 IsPostitFieldWithPostitId aFilter(nPostItId);
1552 IsFieldNotDeleted aFilter2(rIDRA, aFilter);
1574 IsPostitFieldWithPostitId aFilter(nPostItId);
1598 IsPostitFieldWithPostitId aFilter(nPostItId);
1623 IsPostitFieldWithPostitId aFilter(nPostItId);
1648 IsPostitField aFilter;
1650 IsFieldNotDeleted aFilter2(rIDRA, aFilter);
1677 pWin = postItField->mpPostIt;
1689 aDlgAttr.
Put(aEditAttr);
1692 sal_uInt16 nRet = pDlg->Execute();
1695 aDlgAttr.
Put(*pDlg->GetOutputItemSet());
1711 if (!postItField->mpPostIt)
1713 OutlinerView* pOLV = postItField->mpPostIt->GetOutlinerView();
1729 postItField->mpPostIt->UpdateData();
1744 if ( postItField->mpPostIt && (postItField->mpPostIt->GetAuthor() == rAuthor) )
1746 postItField->mbShow =
false;
1747 postItField->mpPostIt->HideNote();
1758 postItField->mbShow =
false;
1759 if (postItField->mpPostIt)
1760 postItField->mpPostIt->HideNote();
1768 postItField->mbShow =
true;
1777 if ( postItField->GetBroadcaster() == pBroadcaster)
1778 return postItField->mpPostIt;
1787 if ( postItField->GetFormatField().GetField() == pField )
1788 return postItField->mpPostIt.get();
1798 return postItField->mpPostIt.get();
1814 [&aPostIt](
const std::unique_ptr<SwSidebarItem>& pField) { return pField->mpPostIt == aPostIt; });
1818 auto iNextPostIt =
i;
1836 if ( (*iNextPostIt)->mpPostIt == aPostIt)
1838 return (*iNextPostIt)->mpPostIt;
1846 for (
auto const& pPage :
mPages)
1848 for(
auto b = pPage->mvSidebarItems.begin(); b!= pPage->mvSidebarItems.end(); ++b)
1854 bool bFollow = (aNext != pPage->mvSidebarItems.end()) && (*aNext)->mpPostIt->IsFollow();
1855 if ( pPage->bScrollbar || bFollow )
1862 if (aNext == pPage->mvSidebarItems.end())
1871 OSL_FAIL(
"SwPostItMgr::GetNextBorder(): We have to find a next border here");
1943 if (
mPages.size() > aPage-1)
1960 OSL_ENSURE(
mPages.size()>nPageNum-1,
"SwPostitMgr:: page container size wrong");
1968 if (
mPages[nPageNum-1]->bScrollbar)
1984 bool bEnableMapMode = !
mpEditWin->IsMapModeEnabled();
1988 for (
const std::unique_ptr<SwSidebarItem>& pItem :
mvPostItFields)
2051 else if (aRectTop.
Contains(aPoint))
2071 pFirstPostIt = postItField->mpPostIt;
2093 for (
const std::unique_ptr<SwPostItPageItem>& pPage :
mPages)
2095 for (
auto const& item : pPage->mvSidebarItems)
2098 if ( item->mbShow && item->mpPostIt && item->mpPostIt->Anchor() )
2101 ?
mpEditWin->LogicToPixel(
Point(
static_cast<tools::Long>(item->mpPostIt->Anchor()->GetSeventhPosition().getX()),0)).X()
2103 aAnchorPosY =
mpEditWin->LogicToPixel(
Point(0,
static_cast<tools::Long>(item->mpPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
2104 item->mpPostIt->SetPosPixel(
Point(aAnchorPosX,aAnchorPosY));
2129 nZoom = fScaleX * 100;
2159 static const Color aArrayNormal[] = {
2164 return aArrayNormal[ aAuthorIndex %
SAL_N_ELEMENTS( aArrayNormal )];
2174 static const Color aArrayLight[] = {
2179 return aArrayLight[ aAuthorIndex %
SAL_N_ELEMENTS( aArrayLight )];
2189 static const Color aArrayAnchor[] = {
2194 return aArrayAnchor[ aAuthorIndex %
SAL_N_ELEMENTS( aArrayAnchor )];
2218 mpView->AttrChangedNotify(
nullptr);
2228 OSL_FAIL(
"Reentrance problem in Layout Manager!");
2229 mbWaitingForCalcRects =
false;
2234 if (CalcRects() || mbLayout)
2244 if ( postItField->mpPostIt )
2245 postItField->mpPostIt->Rescale();
2281 if ( postItField->mpPostIt )
2282 postItField->mpPostIt->SetSpellChecking();
2288 if ( postItField->mpPostIt )
2289 postItField->mpPostIt->SetReadonly(
mbReadOnly );
2295 if ( postItField->mpPostIt )
2296 postItField->mpPostIt->CheckMetaText();
2323 sal_uInt16 aResult = 0;
2423#if !ENABLE_WASM_STRIP_ACCESSIBILITY
2469 const sal_Int32 nIndex )
2482 std::vector< vcl::Window* >* pChildren )
2491 for (
auto const& pPage :
mPages)
2493 for(
auto b = pPage->mvSidebarItems.begin(); b!= pPage->mvSidebarItems.end(); ++b)
2495 if ((*b)->mpPostIt->IsResolved())
2497 (*b)->mpPostIt->SetResolved(
true);
2498 (*b)->mpPostIt->GetSidebarItem().mbShow =
visible;
2510 for (
auto const& pPage :
mPages)
2512 for(
auto b = pPage->mvSidebarItems.begin(); b!= pPage->mvSidebarItems.end(); ++b)
2514 if((*b)->mpPostIt->GetTopReplyNote() == topNote) {
2515 (*b)->mpPostIt->SetResolved(resolved);
const sal_Int16 mnEventId
#define POSTIT_SPACE_BETWEEN
#define POSTIT_MINIMUMSIZE_WITH_META
#define POSTIT_SCROLL_SIDEBAR_HEIGHT
#define POSTIT_INITIAL_ANCHOR_DISTANCE
IMPL_LINK_NOARG(SwPostItMgr, CalcHdl, void *, void)
#define COL_NOTES_SIDEPANE_ARROW_DISABLED
#define COL_NOTES_SIDEPANE_ARROW_ENABLED
static const AllSettings & GetSettings()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
css::util::DateTime GetUNODateTime() const
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
void SetOrigin(const Point &rOrigin)
const Fraction & GetScaleX() const
const Point & GetOrigin() const
void SetSelection(const ESelection &)
sal_Int32 StartSearchAndReplace(const SvxSearchItem &rSearchItem)
ESelection GetSelection() const
Outliner * GetOutliner() const
void SetAttribs(const SfxItemSet &)
void SelectRange(sal_Int32 nFirst, sal_Int32 nCount)
sal_Int32 GetParagraphCount() const
void EnableMapMode(bool bEnable=true)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
bool IsMapModeEnabled() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
virtual bool IsTextEdit() const final override
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
weld::Window * GetFrameWeld() const
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
SfxViewFrame & GetViewFrame() const
constexpr tools::Long Height() const
void SetBackward(bool bNewBackward)
void SetSearchOptions(const i18nutil::SearchOptions2 &rOpt)
virtual VclPtr< SfxAbstractTabDialog > CreateSwCharDlg(weld::Window *pParent, SwView &pVw, const SfxItemSet &rCoreSet, SwCharDlgMode nDialogMode, const OUString *pFormatStr=nullptr)=0
static SwAbstractDialogFactory * Create()
void InvalidatePosOrSize(const SwFrame *pFrame, const SdrObject *pObj, vcl::Window *pWindow, const SwRect &rOldFrame)
void A11yDispose(const SwFrame *pFrame, const SdrObject *pObj, vcl::Window *pWindow, bool bRecursive=false, bool bCanSkipInvisible=true)
static SfxItemPool * GetAnnotationPool(SwView const &rV)
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
SwDoc * GetDoc()
returns Doc. But be careful!
SfxStyleSheetPool * GetEEStyleSheetPool() const
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
void StartAllAction()
For all views of this document.
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
void EndTextEdit()
Deletes object if required.
size_t IsObjSelected() const
Instances of SwFields and those derived from it occur 0 to n times.
void CollectPostIts(std::vector< SwFormatField * > &rvFormatFields, IDocumentRedlineAccess const &rIDRA, bool HideRedlines)
SwFieldType * GetTyp() const
Base class of the Writer layout elements.
const SwStartNode * FindFooterStartNode() const
const SwStartNode * FindFootnoteStartNode() const
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
virtual void ImplCommit() override
bool IsShowAnchor() const
sal_uInt32 GetPostItId() const
void ChangeStyleSheetName(std::u16string_view rOldName, const SfxStyleSheetBase *pStyleSheet)
virtual OUString GetPar1() const override
Author.
const DateTime & GetDateTime() const
sal_uInt32 GetParentId() const
virtual OUString GetPar2() const override
Text.
void Focus(const SfxBroadcaster &rBC)
void RemoveItem(SfxBroadcaster *pBroadcast)
SwPostItMgr(SwView *aDoc)
sal_Int32 GetInitialAnchorDistance() const
bool ShowScrollbar(const tools::ULong aPage) const
void GrabFocusOnActiveSidebarWin()
sw::annotation::SwAnnotationWin * GetAnnotationWin(const SwPostItField *pField) const
void HideActiveSidebarWin()
std::vector< std::unique_ptr< SwPostItPageItem > > mPages
void SetShadowState(const SwPostItField *pField, bool bCursor=true)
bool ScrollbarHit(const tools::ULong aPage, const Point &aPoint)
sal_Int32 GetMinimumSizeWithMeta() const
sal_uInt16 SearchReplace(const SwFormatField &pField, const i18nutil::SearchOptions2 &rSearchOptions, bool bSrchForward)
void PrepareView(bool bIgnoreCount=false)
std::vector< std::unique_ptr< SwSidebarItem > > mvPostItFields
SwPostItField * GetLatestPostItField()
virtual ~SwPostItMgr() override
void ToggleResolved(sal_uInt32 nPostItId)
static Color GetColorDark(std::size_t aAuthorIndex)
static Color GetColorAnchor(std::size_t aAuthorIndex)
Color GetArrowColor(sal_uInt16 aDirection, tools::ULong aPage) const
FieldShadowState mShadowState
void ToggleInsModeOnActiveSidebarWin()
void MakeVisible(const sw::annotation::SwAnnotationWin *pPostIt)
void ConnectSidebarWinToFrame(const SwFrame &rFrame, const SwFormatField &rFormatField, sw::annotation::SwAnnotationWin &rSidebarWin)
void AddPostIts(bool bCheckExistence=true, bool bFocus=true)
tools::ULong GetSidebarWidth(bool bPx=false) const
bool LayoutByPage(std::vector< sw::annotation::SwAnnotationWin * > &aVisiblePostItList, const tools::Rectangle &rBorder, tools::Long lNeededHeight)
void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
std::unique_ptr< sw::sidebarwindows::SwFrameSidebarWinContainer > mpFrameSidebarWinContainer
void ExecuteFormatAllDialog(SwView &rView)
bool HasActiveAnnotationWin() const
bool HasScrollbars() const
static Color GetColorLight(std::size_t aAuthorIndex)
bool ArrowEnabled(sal_uInt16 aDirection, tools::ULong aPage) const
void DeleteCommentThread(sal_uInt32 nPostItId)
tools::ULong GetSidebarBorderWidth(bool bPx=false) const
tools::Rectangle GetTopScrollRect(const tools::ULong aPage) const
void Scroll(const tools::Long lScroll, const tools::ULong aPage)
VclPtr< SwEditWin > mpEditWin
void PreparePageContainer()
sal_Int32 GetScrollSize() const
std::optional< OutlinerParaObject > mpAnswer
void AutoScroll(const sw::annotation::SwAnnotationWin *pPostIt, const tools::ULong aPage)
vcl::Window * GetSidebarWinForFrameByIndex(const SwFrame &rFrame, const sal_Int32 nIndex)
bool BorderOverPageBorder(tools::ULong aPage) const
sal_uInt16 Replace(SvxSearchItem const *pItem)
VclPtr< sw::annotation::SwAnnotationWin > mpActivePostIt
SW_DLLPUBLIC void UpdateDataOnActiveSidebarWin()
void SetActiveSidebarWin(sw::annotation::SwAnnotationWin *p)
SwSidebarItem * InsertItem(SfxBroadcaster *pItem, bool bCheckExistence, bool bFocus)
void FormatAll(const SfxItemSet &rNewAttr)
bool CheckForRemovedPostIts()
bool HasFrameConnectedSidebarWins(const SwFrame &rFrame)
void ToggleResolvedForThread(sal_uInt32 nPostItId)
void DeleteActiveSidebarWin()
vcl::Window * IsHitSidebarWindow(const Point &rPointLogic)
Get the matching window that is responsible for handling mouse events of rPointLogic,...
sal_uInt16 FinishSearchReplace(const i18nutil::SearchOptions2 &rSearchOptions, bool bSrchForward)
sal_Int32 GetSidebarScrollerHeight() const
tools::Long mbLayoutHeight
void PaintTile(OutputDevice &rRenderContext)
tools::Rectangle GetBottomScrollRect(const tools::ULong aPage) const
sw::annotation::SwAnnotationWin * GetNextPostIt(sal_uInt16 aDirection, sw::annotation::SwAnnotationWin *aPostIt)
sw::annotation::SwAnnotationWin * GetSidebarWin(const SfxBroadcaster *pBroadcaster) const
void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
void ShowHideResolvedNotes(bool visible)
void GetAllSidebarWinForFrame(const SwFrame &rFrame, std::vector< vcl::Window * > *pChildren)
bool mbWaitingForCalcRects
void DisconnectSidebarWinFromFrame(const SwFrame &rFrame, sw::annotation::SwAnnotationWin &rSidebarWin)
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
SW_DLLPUBLIC bool HasActiveSidebarWin() const
void AssureStdModeAtShell()
bool IsHit(const Point &aPointPixel)
tools::Long GetNextBorder()
sal_Int32 GetSpaceBetween() const
void UpdateResolvedStatus(const sw::annotation::SwAnnotationWin *topNote)
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Top(const tools::Long nTop)
void Right(const tools::Long nRight)
void Bottom(const tools::Long nBottom)
void Pos(const Point &rNew)
void SSize(const Size &rNew)
tools::Rectangle SVRect() const
void Left(const tools::Long nLeft)
void AddRule(SwUndoArg eWhat, const OUString &rWith)
The root element of a Writer document layout.
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
::sw::mark::IMark * GetAnnotationMark() const
sal_uInt16 GetZoom() const
bool IsShowHiddenChar(bool bHard=false) const
bool IsResolvedPostIts() const
bool IsViewLocked() const
vcl::RenderContext * GetOut() const
const SwViewOption * GetViewOptions() const
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
SwRootFrame * GetLayout() const
sal_uInt16 GetNumPages() const
SwAccessibleMap * GetAccessibleMap()
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
void MakeVisible(const SwRect &)
SwWrtShell & GetWrtShell() const
virtual SdrView * GetDrawView() const override
void ExecViewOptions(SfxRequest &)
SwDocShell * GetDocShell()
bool IsSelFrameMode() const
bool GotoField(const SwFormatField &rField)
bool DelRight(bool isReplaceHeuristic=false)
virtual void DrawSelChanged() override
const SwView & GetView() const
reference_type * get() const
const SwRect & GetAnchorRect() const
void PaintTile(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
const std::vector< basegfx::B2DRange > & GetAnnotationTextRanges() const
::sw::sidebarwindows::AnchorOverlayObject * Anchor()
void DrawForPage(OutputDevice *pDev, const Point &rPos)
void SetVirtualPosSize(const Point &aPoint, const Size &aSize)
void TranslateTopPosition(const tools::Long aAmount)
bool IsHitWindow(const Point &rPointLogic)
Is there a matching sub-widget inside this sidebar widget for rPointLogic?
void ToggleResolvedForThread()
sal_uInt32 CalcParent()
Calculate parent postit id of current annotation window.
void SetViewState(::sw::sidebarwindows::ViewState bViewState)
void ShowAnchorOnly(const Point &aPoint)
::sw::sidebarwindows::ShadowOverlayObject * Shadow()
OutlinerView * GetOutlinerView()
const SwPostItField * GetPostItField() const
virtual Point GetPosPixel() const
virtual Size GetSizePixel() const
constexpr ::Color COL_AUTHOR9_DARK(0xD1, 0x76, 0x00)
constexpr ::Color COL_AUTHOR7_LIGHT(0xF2, 0xFE, 0xB5)
constexpr ::Color COL_AUTHOR5_LIGHT(0xFF, 0xE3, 0xE5)
constexpr ::Color COL_AUTHOR8_DARK(0x35, 0x55, 0x6B)
constexpr ::Color COL_AUTHOR8_LIGHT(0xE2, 0xEA, 0xF1)
constexpr ::Color COL_AUTHOR7_NORMAL(0xED, 0xFC, 0xA3)
constexpr ::Color COL_AUTHOR2_LIGHT(0xE9, 0xF2, 0xFF)
constexpr ::Color COL_AUTHOR8_NORMAL(0xD3, 0xDE, 0xE8)
constexpr ::Color COL_AUTHOR1_NORMAL(0xFF, 0xFF, 0x9E)
constexpr ::Color COL_AUTHOR9_LIGHT(0xFF, 0xE7, 0xC7)
constexpr ::Color COL_AUTHOR2_DARK(0x06, 0x46, 0xA2)
constexpr ::Color COL_AUTHOR1_LIGHT(0xFF, 0xFF, 0xC3)
constexpr ::Color COL_AUTHOR3_DARK(0x57, 0x9D, 0x1C)
constexpr ::Color COL_AUTHOR6_DARK(0x00, 0x80, 0x80)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_AUTHOR4_NORMAL(0xE4, 0xD2, 0xF5)
constexpr ::Color COL_AUTHOR7_DARK(0x8C, 0x84, 0x00)
constexpr ::Color COL_AUTHOR3_LIGHT(0xE2, 0xFA, 0xCF)
constexpr ::Color COL_AUTHOR5_NORMAL(0xFE, 0xCD, 0xD0)
constexpr ::Color COL_AUTHOR9_NORMAL(0xFF, 0xE2, 0xB9)
constexpr ::Color COL_AUTHOR4_LIGHT(0xEF, 0xE4, 0xF8)
constexpr ::Color COL_AUTHOR5_DARK(0xC5, 0x00, 0x0B)
constexpr ::Color COL_AUTHOR6_NORMAL(0xD2, 0xF6, 0xF6)
constexpr ::Color COL_AUTHOR4_DARK(0x69, 0x2B, 0x9D)
constexpr ::Color COL_AUTHOR6_LIGHT(0xE6, 0xFA, 0xFA)
constexpr ::Color COL_AUTHOR2_NORMAL(0xD8, 0xE8, 0xFF)
constexpr ::Color COL_AUTHOR1_DARK(0xC6, 0x92, 0x00)
constexpr ::Color COL_AUTHOR3_NORMAL(0xDA, 0xF8, 0xC1)
#define EE_TEXTPOS_MAX_COUNT
#define EE_PARA_MAX_COUNT
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_PAGEUP
#define LINK(Instance, Class, Member)
#define SAL_N_ELEMENTS(arr)
tools::Long getLayoutHeight(const SwRootFrame *pRoot)
tools::ULong getPageInfo(SwRect &rPageFrame, const SwRootFrame *, const Point &)
SwLayoutStatus getLayoutInfos(SwLayoutInfo &o_rInfo, const SwPosition &rAnchorPos, const sw::mark::IMark *pAnnotationMark=nullptr)
void setSidebarChanged(SwRootFrame *pRoot, bool bBrowseMode)
void setTiledPainting(bool bTiledPainting)
bool isTiledAnnotations()
OString join(std::string_view rSeparator, const std::vector< OString > &rSequence)
bool IsFieldDeletedInModel(IDocumentRedlineAccess const &rIDRA, SwTextField const &rTextField)
OUString toISO8601(const css::util::DateTime &rDateTime)
const SwPostItField * mpShadowField
bool mPositionFromCommentAnchor
If true, the overlay arrow points to the comment anchor, otherwise it points to the commented frame.
Marks a position in the document model.
OUString SwResId(TranslateId aId)
css::drawing::Direction3D aDirection
static void Add(SwRegionRects &rRegion, const SwRect &rRect)