LibreOffice Module sw (master)  1
AnnotationWin2.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sal/config.h>
21 
22 #include <cstddef>
23 
24 #include "SidebarWinAcc.hxx"
25 #include <PostItMgr.hxx>
26 #include <AnnotationWin.hxx>
27 #include <IDocumentUndoRedo.hxx>
29 #include "SidebarTxtControl.hxx"
30 #include "SidebarScrollBar.hxx"
31 #include "AnchorOverlayObject.hxx"
32 #include "ShadowOverlayObject.hxx"
33 #include "OverlayRanges.hxx"
34 
35 #include <strings.hrc>
36 
37 #include <viewopt.hxx>
38 #include <cmdid.h>
39 
40 #include <editeng/fhgtitem.hxx>
41 #include <editeng/langitem.hxx>
42 #include <editeng/editview.hxx>
43 #include <editeng/outliner.hxx>
44 #include <editeng/editeng.hxx>
45 #include <editeng/eeitem.hxx>
46 #include <editeng/outlobj.hxx>
47 
48 #include <svl/undo.hxx>
49 #include <svl/stritem.hxx>
50 
51 #include <sfx2/viewfrm.hxx>
52 #include <sfx2/bindings.hxx>
53 #include <sfx2/dispatch.hxx>
54 
55 #include <vcl/fixed.hxx>
56 #include <vcl/event.hxx>
57 #include <vcl/scrbar.hxx>
58 #include <vcl/svapp.hxx>
59 #include <vcl/menubtn.hxx>
60 #include <vcl/settings.hxx>
61 #include <vcl/ptrstyle.hxx>
62 #include <vcl/uitest/logger.hxx>
64 
65 #include <edtwin.hxx>
66 #include <view.hxx>
67 #include <docsh.hxx>
68 #include <wrtsh.hxx>
69 #include <doc.hxx>
70 #include <swmodule.hxx>
71 
72 #include <txtannotationfld.hxx>
73 #include <ndtxt.hxx>
74 
78 #include <memory>
79 #include <comphelper/lok.hxx>
80 
81 using namespace sw::sidebarwindows;
82 
83 namespace
84 {
85 
86 void collectUIInformation( const OUString& aevent , const OUString& aID )
87 {
88  EventDescription aDescription;
89  aDescription.aID = aID;
90  aDescription.aParameters = {{"" , ""}};
91  aDescription.aAction = aevent;
92  aDescription.aParent = "MainWindow";
93  aDescription.aKeyWord = "SwEditWinUIObject";
94  UITestLogger::getInstance().logEvent(aDescription);
95 }
96 
98 void lcl_translateTwips(vcl::Window const & rParent, vcl::Window& rChild, MouseEvent* pMouseEvent)
99 {
100  // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones.
101  Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel());
102  if (!rChild.IsMapModeEnabled())
103  {
104  MapMode aMapMode(rChild.GetMapMode());
105  aMapMode.SetMapUnit(MapUnit::MapTwip);
106  aMapMode.SetScaleX(rParent.GetMapMode().GetScaleX());
107  aMapMode.SetScaleY(rParent.GetMapMode().GetScaleY());
108  rChild.SetMapMode(aMapMode);
109  rChild.EnableMapMode();
110  }
111  aOffset = rChild.PixelToLogic(aOffset);
112  MapMode aMapMode(rChild.GetMapMode());
113  aMapMode.SetOrigin(aOffset);
114  aMapMode.SetMapUnit(rParent.GetMapMode().GetMapUnit());
115  rChild.SetMapMode(aMapMode);
116  rChild.EnableMapMode(false);
117 
118  if (pMouseEvent)
119  {
120  // Set event coordinates, so they contain relative coordinates instead of absolute ones.
121  Point aPos = pMouseEvent->GetPosPixel();
122  aPos.Move(-aOffset.getX(), -aOffset.getY());
123  MouseEvent aMouseEvent(aPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(), pMouseEvent->GetButtons(), pMouseEvent->GetModifier());
124  *pMouseEvent = aMouseEvent;
125  }
126 }
127 
129 vcl::Window* lcl_getHitWindow(sw::annotation::SwAnnotationWin& rParent, const MouseEvent& rMouseEvent)
130 {
131  vcl::Window* pRet = nullptr;
132 
133  rParent.EditWin().Push(PushFlags::MAPMODE);
134  rParent.EditWin().EnableMapMode();
135  for (sal_Int16 i = rParent.GetChildCount() - 1; i >= 0; --i)
136  {
137  vcl::Window* pChild = rParent.GetChild(i);
138 
139  Point aPosition(rParent.GetPosPixel());
140  aPosition.Move(pChild->GetPosPixel().getX(), pChild->GetPosPixel().getY());
141  Size aSize(rParent.GetSizePixel());
142  tools::Rectangle aRectangleLogic(rParent.EditWin().PixelToLogic(aPosition), rParent.EditWin().PixelToLogic(aSize));
143  if (aRectangleLogic.IsInside(rMouseEvent.GetPosPixel()))
144  {
145  pRet = pChild;
146  break;
147  }
148  }
149  rParent.EditWin().Pop();
150  return pRet;
151 }
152 
153 }
154 
155 namespace sw::annotation {
156 
157 #define METABUTTON_WIDTH 16
158 #define METABUTTON_HEIGHT 18
159 #define METABUTTON_AREA_WIDTH 30
160 #define POSTIT_META_FIELD_HEIGHT sal_Int32(15)
161 #define POSTIT_MINIMUMSIZE_WITHOUT_META 50
162 
163 
164 void SwAnnotationWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
165 {
166  Window::Paint(rRenderContext, rRect);
167 
168  if (!mpMetadataAuthor->IsVisible())
169  return;
170 
171  //draw left over space
173  {
174  rRenderContext.SetFillColor(COL_BLACK);
175  }
176  else
177  {
178  rRenderContext.SetFillColor(mColorDark);
179  }
180 
181  sal_uInt32 boxHeight = mpMetadataAuthor->GetSizePixel().Height() + mpMetadataDate->GetSizePixel().Height();
182  boxHeight += IsResolved() ? mpMetadataResolved->GetSizePixel().Height() : 0;
183 
184  rRenderContext.SetLineColor();
185  tools::Rectangle aRectangle(Point(mpMetadataAuthor->GetPosPixel().X() + mpMetadataAuthor->GetSizePixel().Width(),
186  mpMetadataAuthor->GetPosPixel().Y()),
187  Size(GetMetaButtonAreaWidth(), boxHeight));
188 
190  aRectangle = rRect;
191  else
192  aRectangle = PixelToLogic(aRectangle);
193  rRenderContext.DrawRect(aRectangle);
194 }
195 
196 void SwAnnotationWin::PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
197 {
198  Paint(rRenderContext, rRect);
199 
200  for (sal_uInt16 i = 0; i < GetChildCount(); ++i)
201  {
202  vcl::Window* pChild = GetChild(i);
203 
204  // No point in showing this button till click on it are not handled.
205  if (pChild == mpMenuButton.get())
206  continue;
207 
208  if (!pChild->IsVisible())
209  continue;
210 
211  rRenderContext.Push(PushFlags::MAPMODE);
212  Point aOffset(PixelToLogic(pChild->GetPosPixel()));
213  MapMode aMapMode(rRenderContext.GetMapMode());
214  aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
215  rRenderContext.SetMapMode(aMapMode);
216 
217  bool bPopChild = false;
218  if (pChild->GetMapMode().GetMapUnit() != rRenderContext.GetMapMode().GetMapUnit())
219  {
220  // This is needed for the scrollbar that has its map unit in pixels.
221  pChild->Push(PushFlags::MAPMODE);
222  bPopChild = true;
223  pChild->EnableMapMode();
224  aMapMode = pChild->GetMapMode();
225  aMapMode.SetMapUnit(rRenderContext.GetMapMode().GetMapUnit());
226  aMapMode.SetScaleX(rRenderContext.GetMapMode().GetScaleX());
227  aMapMode.SetScaleY(rRenderContext.GetMapMode().GetScaleY());
228  pChild->SetMapMode(aMapMode);
229  }
230 
231  pChild->Paint(rRenderContext, rRect);
232 
233  if (bPopChild)
234  pChild->Pop();
235  rRenderContext.Pop();
236  }
237 
238  const drawinglayer::geometry::ViewInformation2D aViewInformation;
239  std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aViewInformation));
240 
241  // drawinglayer sets the map mode to pixels, not needed here.
242  rRenderContext.Pop();
243  // Work in document-global twips.
244  rRenderContext.Pop();
245  if (mpAnchor)
246  pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence());
247  if (mpTextRangeOverlay)
248  pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
249 
250  rRenderContext.Push(PushFlags::NONE);
251  pProcessor.reset();
252  rRenderContext.Push(PushFlags::NONE);
253 }
254 
255 bool SwAnnotationWin::IsHitWindow(const Point& rPointLogic)
256 {
257  tools::Rectangle aRectangleLogic(EditWin().PixelToLogic(GetPosPixel()), EditWin().PixelToLogic(GetSizePixel()));
258  return aRectangleLogic.IsInside(rPointLogic);
259 }
260 
261 void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
262 {
263  mpSidebarTextControl->Push(PushFlags::MAPMODE);
264  MouseEvent aMouseEvent(rPosition);
265  lcl_translateTwips(EditWin(), *mpSidebarTextControl, &aMouseEvent);
266  Point aPosition(aMouseEvent.GetPosPixel());
267 
268  EditView& rEditView = GetOutlinerView()->GetEditView();
269  rEditView.SetCursorLogicPosition(aPosition, bPoint, bClearMark);
270 
271  mpSidebarTextControl->Pop();
272 }
273 
274 void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFlags)
275 {
276  Size aSz = PixelToLogic(GetSizePixel());
277 
278  if (mpMetadataAuthor->IsVisible() )
279  {
280  pDev->SetFillColor(mColorDark);
281  pDev->SetLineColor();
282  pDev->DrawRect( tools::Rectangle( rPt, aSz ) );
283  }
284 
285  if (mpMetadataAuthor->IsVisible())
286  {
287  vcl::Font aOrigFont(mpMetadataAuthor->GetControlFont());
288  Point aPos(PixelToLogic(mpMetadataAuthor->GetPosPixel()));
289  aPos += rPt;
290  vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetLabelFont() );
291  mpMetadataAuthor->SetControlFont( aFont );
292  mpMetadataAuthor->Draw(pDev, aPos, nInFlags);
293  mpMetadataAuthor->SetControlFont( aOrigFont );
294  }
295 
296  if (mpMetadataDate->IsVisible())
297  {
298  vcl::Font aOrigFont(mpMetadataDate->GetControlFont());
299  Point aPos(PixelToLogic(mpMetadataDate->GetPosPixel()));
300  aPos += rPt;
301  vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() );
302  mpMetadataDate->SetControlFont( aFont );
303  mpMetadataDate->Draw(pDev, aPos, nInFlags);
304  mpMetadataDate->SetControlFont( aOrigFont );
305  }
306 
307  if (mpMetadataResolved->IsVisible())
308  {
309  vcl::Font aOrigFont(mpMetadataResolved->GetControlFont());
310  Point aPos(PixelToLogic(mpMetadataResolved->GetPosPixel()));
311  aPos += rPt;
312  vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetLabelFont() );
313  mpMetadataResolved->SetControlFont( aFont );
314  mpMetadataResolved->Draw(pDev, aPos, nInFlags);
315  mpMetadataResolved->SetControlFont( aOrigFont );
316  }
317 
318  mpSidebarTextControl->Draw(pDev, rPt, nInFlags);
319 
320  const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
321  std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
323  *pDev, aNewViewInfos ));
324 
325  if (mpAnchor)
326  pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence());
327  if (mpTextRangeOverlay)
328  pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
329  pProcessor.reset();
330 
331  if (!mpVScrollbar->IsVisible())
332  return;
333 
334  // if there is a scrollbar shown, draw "..." to indicate the comment isn't
335  // completely shown
336  vcl::Font aOrigFont(mpMetadataDate->GetControlFont());
337  Color aOrigBg( mpMetadataDate->GetControlBackground() );
338  OUString sOrigText(mpMetadataDate->GetText());
339 
340  Point aPos(PixelToLogic(mpMenuButton->GetPosPixel()));
341  aPos += rPt;
342 
343  vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() );
344  mpMetadataDate->SetControlFont( aFont );
345  mpMetadataDate->SetControlBackground( Color(0xFFFFFF) );
346  mpMetadataDate->SetText("...");
347  Size aOrigSize = mpMetadataDate->GetSizePixel();
348  mpMetadataDate->SetSizePixel(mpMenuButton->GetSizePixel());
349  mpMetadataDate->Draw(pDev, aPos, nInFlags);
350  mpMetadataDate->SetSizePixel(aOrigSize);
351 
352  mpMetadataDate->SetText(sOrigText);
353  mpMetadataDate->SetControlFont( aOrigFont );
354  mpMetadataDate->SetControlBackground( aOrigBg );
355 }
356 
357 void SwAnnotationWin::KeyInput(const KeyEvent& rKeyEvent)
358 {
359  if (mpSidebarTextControl)
360  {
361  mpSidebarTextControl->Push(PushFlags::MAPMODE);
362  lcl_translateTwips(EditWin(), *mpSidebarTextControl, nullptr);
363 
364  mpSidebarTextControl->KeyInput(rKeyEvent);
365 
366  mpSidebarTextControl->Pop();
367  }
368 }
369 
370 void SwAnnotationWin::MouseMove(const MouseEvent& rMouseEvent)
371 {
372  if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
373  {
374  pHit->Push(PushFlags::MAPMODE);
375  MouseEvent aMouseEvent(rMouseEvent);
376  lcl_translateTwips(EditWin(), *pHit, &aMouseEvent);
377 
378  pHit->MouseMove(aMouseEvent);
379 
380  pHit->Pop();
381  }
382 }
383 
384 void SwAnnotationWin::MouseButtonDown(const MouseEvent& rMouseEvent)
385 {
386  if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
387  {
388  pHit->Push(PushFlags::MAPMODE);
389  MouseEvent aMouseEvent(rMouseEvent);
390  lcl_translateTwips(EditWin(), *pHit, &aMouseEvent);
391 
392  pHit->MouseButtonDown(aMouseEvent);
393 
394  pHit->Pop();
395  }
396 }
397 
398 void SwAnnotationWin::MouseButtonUp(const MouseEvent& rMouseEvent)
399 {
400  if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
401  {
402  pHit->Push(PushFlags::MAPMODE);
403  MouseEvent aMouseEvent(rMouseEvent);
404  lcl_translateTwips(EditWin(), *pHit, &aMouseEvent);
405 
406  pHit->MouseButtonUp(aMouseEvent);
407 
408  pHit->Pop();
409  }
410 }
411 
412 void SwAnnotationWin::SetPosSizePixelRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
413  const SwRect& aAnchorRect, const tools::Long aPageBorder)
414 {
415  mPosSize = tools::Rectangle(Point(nX,nY),Size(nWidth,nHeight));
416  if (!mAnchorRect.IsEmpty() && mAnchorRect != aAnchorRect)
417  mbAnchorRectChanged = true;
418  mAnchorRect = aAnchorRect;
419  mPageBorder = aPageBorder;
420 }
421 
422 void SwAnnotationWin::SetSize( const Size& rNewSize )
423 {
424  mPosSize.SetSize(rNewSize);
425 }
426 
427 void SwAnnotationWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
428 {
429  mPosSize = tools::Rectangle(aPoint,aSize);
430 }
431 
432 void SwAnnotationWin::TranslateTopPosition(const tools::Long aAmount)
433 {
434  mPosSize.Move(0,aAmount);
435 }
436 
437 void SwAnnotationWin::ShowAnchorOnly(const Point &aPoint)
438 {
439  HideNote();
440  SetPosAndSize();
441  if (mpAnchor)
442  {
443  mpAnchor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
444  mpAnchor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
445  mpAnchor->SetAnchorState(AnchorState::All);
446  mpAnchor->setVisible(true);
447  }
448  if (mpShadow)
449  mpShadow->setVisible(false);
450 }
451 
452 SfxItemSet SwAnnotationWin::DefaultItem()
453 {
454  SfxItemSet aItem( mrView.GetDocShell()->GetPool() );
455  aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
456  return aItem;
457 }
458 
459 void SwAnnotationWin::InitControls()
460 {
461  AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
462 
463  // actual window which holds the user text
464  mpSidebarTextControl = VclPtr<SidebarTextControl>::Create( *this,
466  mrView, mrMgr );
467  mpSidebarTextControl->SetPointer(PointerStyle::Text);
468 
469  // window controls for author and date
470  mpMetadataAuthor = VclPtr<FixedText>::Create(this);
471  mpMetadataAuthor->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
472  mpMetadataAuthor->EnableRTL(AllSettings::GetLayoutRTL());
473  mpMetadataAuthor->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
474  // we should leave this setting alone, but for this we need a better layout algo
475  // with variable meta size height
476  {
477  AllSettings aSettings = mpMetadataAuthor->GetSettings();
478  StyleSettings aStyleSettings = aSettings.GetStyleSettings();
479  vcl::Font aFont = aStyleSettings.GetLabelFont();
480  aFont.SetFontHeight(8);
481  aStyleSettings.SetLabelFont(aFont);
482  aSettings.SetStyleSettings(aStyleSettings);
483  mpMetadataAuthor->SetSettings(aSettings);
484  }
485 
486  mpMetadataDate = VclPtr<FixedText>::Create(this);
487  mpMetadataDate->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_DATE_NAME ) );
488  mpMetadataDate->EnableRTL(AllSettings::GetLayoutRTL());
489  mpMetadataDate->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
490  // we should leave this setting alone, but for this we need a better layout algo
491  // with variable meta size height
492  {
493  AllSettings aSettings = mpMetadataDate->GetSettings();
494  StyleSettings aStyleSettings = aSettings.GetStyleSettings();
495  vcl::Font aFont = aStyleSettings.GetLabelFont();
496  aFont.SetFontHeight(8);
497  aStyleSettings.SetLabelFont(aFont);
498  aSettings.SetStyleSettings(aStyleSettings);
499  mpMetadataDate->SetSettings(aSettings);
500  }
501 
502  mpMetadataResolved = VclPtr<FixedText>::Create(this);
503  mpMetadataResolved->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
504  mpMetadataResolved->EnableRTL(AllSettings::GetLayoutRTL());
505  mpMetadataResolved->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
506  // we should leave this setting alone, but for this we need a better layout algo
507  // with variable meta size height
508  {
509  AllSettings aSettings = mpMetadataResolved->GetSettings();
510  StyleSettings aStyleSettings = aSettings.GetStyleSettings();
511  vcl::Font aFont = aStyleSettings.GetLabelFont();
512  aFont.SetFontHeight(8);
513  aStyleSettings.SetLabelFont(aFont);
514  aSettings.SetStyleSettings(aStyleSettings);
515  mpMetadataResolved->SetSettings(aSettings);
516  mpMetadataResolved->SetText( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
517  }
518 
519  SwDocShell* aShell = mrView.GetDocShell();
520  mpOutliner.reset(new Outliner(&aShell->GetPool(),OutlinerMode::TextObject));
521  aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner.get() );
522  mpOutliner->SetUpdateMode( true );
523  Rescale();
524 
525  mpSidebarTextControl->EnableRTL( false );
526  mpOutlinerView.reset(new OutlinerView ( mpOutliner.get(), mpSidebarTextControl ));
527  mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
528  mpOutliner->InsertView(mpOutlinerView.get() );
529  mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );
530 
531  mpOutlinerView->SetAttribs(DefaultItem());
532 
534  {
535  // If there is a callback already registered, inform the new outliner view about it.
536  mpOutlinerView->RegisterViewShell(&mrView);
537  }
538 
539  //create Scrollbars
541  mpVScrollbar->EnableNativeWidget(false);
542  mpVScrollbar->EnableRTL( false );
543  mpVScrollbar->SetScrollHdl(LINK(this, SwAnnotationWin, ScrollHdl));
544  mpVScrollbar->EnableDrag();
545  mpVScrollbar->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
546 
547  const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
548  EEControlBits nCntrl = mpOutliner->GetControlWord();
549  // TODO: crash when AUTOCOMPLETE enabled
550  nCntrl |= EEControlBits::MARKFIELDS | EEControlBits::PASTESPECIAL | EEControlBits::AUTOCORRECT | EEControlBits::USECHARATTRIBS; // | EEControlBits::AUTOCOMPLETE;
552  nCntrl |= EEControlBits::MARKFIELDS;
553  else
554  nCntrl &= ~EEControlBits::MARKFIELDS;
555  if (pVOpt->IsOnlineSpell())
556  nCntrl |= EEControlBits::ONLINESPELLING;
557  else
558  nCntrl &= ~EEControlBits::ONLINESPELLING;
559  mpOutliner->SetControlWord(nCntrl);
560 
561  std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
562  SetColor( SwPostItMgr::GetColorDark(aIndex),
565 
566  CheckMetaText();
567 
568  mpMenuButton = CreateMenuButton();
569 
571  GetOutlinerView()->StartSpeller();
572  SetPostItText();
573  mpOutliner->CompleteOnlineSpelling();
574 
575  mpSidebarTextControl->Show();
576  mpMetadataAuthor->Show();
577  mpMetadataDate->Show();
578  if(IsResolved()) { mpMetadataResolved->Show(); }
579  mpVScrollbar->Show();
580 }
581 
582 void SwAnnotationWin::CheckMetaText()
583 {
584  const SvtSysLocale aSysLocale;
585  const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
586  OUString sMeta = GetAuthor();
587  if (sMeta.isEmpty())
588  {
589  sMeta = SwResId(STR_NOAUTHOR);
590  }
591  else if (sMeta.getLength() > 23)
592  {
593  sMeta = OUString::Concat(sMeta.subView(0, 20)) + "...";
594  }
595  if ( mpMetadataAuthor->GetText() != sMeta )
596  {
597  mpMetadataAuthor->SetText(sMeta);
598  }
599 
600  Date aDate = GetDate();
601  if (aDate.IsValidAndGregorian() )
602  {
603  sMeta = rLocalData.getDate(aDate);
604  }
605  else
606  {
607  sMeta = SwResId(STR_NODATE);
608  }
609  if (GetTime().GetTime()!=0)
610  {
611  sMeta += " " + rLocalData.getTime( GetTime(),false );
612  }
613  if ( mpMetadataDate->GetText() != sMeta )
614  {
615  mpMetadataDate->SetText(sMeta);
616  }
617 }
618 
619 void SwAnnotationWin::Rescale()
620 {
621  // On Android, this method leads to invoke ImpEditEngine::UpdateViews
622  // which hides the text cursor. Moreover it causes sudden document scroll
623  // when modifying a commented text. Not clear the root cause,
624  // anyway skipping this method fixes the problem, and there should be
625  // no side effect, since the client has disabled annotations rendering.
627  return;
628 
629  MapMode aMode = GetParent()->GetMapMode();
630  aMode.SetOrigin( Point() );
631  mpOutliner->SetRefMapMode( aMode );
632  SetMapMode( aMode );
633  mpSidebarTextControl->SetMapMode( aMode );
634  const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY();
635  if ( mpMetadataAuthor )
636  {
637  vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetLabelFont() );
638  sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
639  aFont.SetFontHeight( nHeight );
640  mpMetadataAuthor->SetControlFont( aFont );
641  }
642  if ( mpMetadataDate )
643  {
644  vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() );
645  sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
646  aFont.SetFontHeight( nHeight );
647  mpMetadataDate->SetControlFont( aFont );
648  }
649  if ( mpMetadataResolved )
650  {
651  vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetLabelFont() );
652  sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
653  aFont.SetFontHeight( nHeight );
654  mpMetadataResolved->SetControlFont( aFont );
655  }
656 }
657 
658 void SwAnnotationWin::SetPosAndSize()
659 {
660  bool bChange = false;
661 
662  if (GetSizePixel() != mPosSize.GetSize())
663  {
664  bChange = true;
665  SetSizePixel(mPosSize.GetSize());
666 
668  {
669  // Position is not yet set at VCL level, but the map mode should
670  // contain the right origin to emit the correct cursor position.
671  mpSidebarTextControl->Push(PushFlags::MAPMODE);
672  Point aOffset(mPosSize.Left(), mPosSize.Top());
673  aOffset = PixelToLogic(aOffset);
674  MapMode aMapMode(mpSidebarTextControl->GetMapMode());
675  aMapMode.SetOrigin(aOffset);
676  mpSidebarTextControl->SetMapMode(aMapMode);
677  mpSidebarTextControl->EnableMapMode(false);
678  }
679 
680  DoResize();
681 
683  mpSidebarTextControl->Pop();
684  }
685 
686  if (GetPosPixel().X() != mPosSize.TopLeft().X() || (std::abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) )
687  {
688  bChange = true;
689  SetPosPixel(mPosSize.TopLeft());
690 
691  Point aLineStart;
692  Point aLineEnd ;
693  switch ( meSidebarPosition )
694  {
696  {
697  aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
698  aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
699  }
700  break;
702  {
703  aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
704  aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
705  }
706  break;
707  default:
708  OSL_FAIL( "<SwAnnotationWin::SetPosAndSize()> - unexpected position of sidebar" );
709  break;
710  }
711 
712  // LOK has map mode disabled, and we still want to perform pixel ->
713  // twips conversion for the size of the line above the note.
714  if (comphelper::LibreOfficeKit::isActive() && !EditWin().IsMapModeEnabled())
715  {
716  EditWin().EnableMapMode();
717  Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY());
718  aSize = EditWin().PixelToLogic(aSize);
719  aLineEnd = aLineStart;
720  aLineEnd.Move(aSize.getWidth(), aSize.getHeight());
721  EditWin().EnableMapMode(false);
722  }
723 
724  if (mpAnchor)
725  {
726  mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
727  basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15),
728  basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15),
729  basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15),
730  basegfx::B2DPoint( mPageBorder ,mAnchorRect.Bottom()+2*15),
731  basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
732  basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
733  }
734  else
735  {
737  mAnchorRect,
738  mPageBorder,
739  aLineStart,
740  aLineEnd,
741  mColorAnchor );
742  if ( mpAnchor )
743  {
744  mpAnchor->setVisible(true);
745  mpAnchor->SetAnchorState(AnchorState::Tri);
746  if (HasChildPathFocus())
747  {
748  mpAnchor->setLineSolid(true);
749  }
750  }
751  }
752  }
753  else
754  {
755  if ( mpAnchor &&
756  ( mpAnchor->getBasePosition() != basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom()-5*15) ) )
757  {
758  mpAnchor->SetTriPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
759  basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15),
760  basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15),
761  basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15),
762  basegfx::B2DPoint( mPageBorder , mAnchorRect.Bottom()+2*15));
763  }
764  }
765 
766  if (mpShadow && bChange)
767  {
768  Point aStart = EditWin().PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
769  Point aEnd = EditWin().PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
770  mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
771  }
772 
773  if (mrMgr.ShowNotes())
774  {
775  if (IsFollow() && !HasChildPathFocus())
776  {
777  // #i111964#
778  if ( mpAnchor )
779  {
780  mpAnchor->SetAnchorState(AnchorState::End);
781  }
782  }
783  else
784  {
785  // #i111964#
786  if ( mpAnchor )
787  {
788  mpAnchor->SetAnchorState(AnchorState::All);
789  }
790  SwAnnotationWin* pWin = GetTopReplyNote();
791  // #i111964#
792  if ( pWin != this && pWin->Anchor() )
793  {
795  }
796  }
797  }
798 
799 
800  // text range overlay
801  maAnnotationTextRanges.clear();
802  if ( mrSidebarItem.maLayoutInfo.mnStartNodeIdx != 0
803  && mrSidebarItem.maLayoutInfo.mnStartContent != -1 )
804  {
805  const SwTextAnnotationField* pTextAnnotationField =
806  dynamic_cast< const SwTextAnnotationField* >( mrSidebarItem.GetFormatField().GetTextField() );
807  SwTextNode* pTextNode = pTextAnnotationField ? pTextAnnotationField->GetpTextNode() : nullptr;
808  SwContentNode* pContentNd = nullptr;
809  if (pTextNode)
810  {
811  SwNodes& rNds = pTextNode->GetDoc().GetNodes();
812  pContentNd = rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetContentNode();
813  }
814  if (pContentNd)
815  {
816  SwPosition aStartPos( *pContentNd, mrSidebarItem.maLayoutInfo.mnStartContent );
817  SwShellCursor* pTmpCursor = nullptr;
818  const bool bTableCursorNeeded = pTextNode->FindTableBoxStartNode() != pContentNd->FindTableBoxStartNode();
819  if ( bTableCursorNeeded )
820  {
821  SwShellTableCursor* pTableCursor = new SwShellTableCursor( mrView.GetWrtShell(), aStartPos );
822  pTableCursor->SetMark();
823  pTableCursor->GetMark()->nNode = *pTextNode;
824  pTableCursor->GetMark()->nContent.Assign( pTextNode, pTextAnnotationField->GetStart()+1 );
825  pTableCursor->NewTableSelection();
826  pTmpCursor = pTableCursor;
827  }
828  else
829  {
830  SwShellCursor* pCursor = new SwShellCursor( mrView.GetWrtShell(), aStartPos );
831  pCursor->SetMark();
832  pCursor->GetMark()->nNode = *pTextNode;
833  pCursor->GetMark()->nContent.Assign( pTextNode, pTextAnnotationField->GetStart()+1 );
834  pTmpCursor = pCursor;
835  }
836  std::unique_ptr<SwShellCursor> pTmpCursorForAnnotationTextRange( pTmpCursor );
837 
838  // For annotation text range rectangles to be calculated correctly,
839  // we need the map mode disabled
840  bool bDisableMapMode = comphelper::LibreOfficeKit::isActive() && EditWin().IsMapModeEnabled();
841  if (bDisableMapMode)
842  EditWin().EnableMapMode(false);
843 
844  if (mrSidebarItem.maLayoutInfo.mPositionFromCommentAnchor)
845  pTmpCursorForAnnotationTextRange->FillRects();
846 
847  if (bDisableMapMode)
848  EditWin().EnableMapMode();
849 
850  SwRects* pRects(pTmpCursorForAnnotationTextRange.get());
851  for(const SwRect & rNextRect : *pRects)
852  {
853  const tools::Rectangle aPntRect(rNextRect.SVRect());
854  maAnnotationTextRanges.emplace_back(
855  aPntRect.Left(), aPntRect.Top(),
856  aPntRect.Right() + 1, aPntRect.Bottom() + 1);
857  }
858  }
859  }
860 
861  if (mrMgr.ShowNotes() && !maAnnotationTextRanges.empty())
862  {
863  if ( mpTextRangeOverlay != nullptr )
864  {
865  mpTextRangeOverlay->setRanges( maAnnotationTextRanges );
866  if ( mpAnchor != nullptr && mpAnchor->getLineSolid() )
867  {
868  mpTextRangeOverlay->ShowSolidBorder();
869  }
870  else
871  {
872  mpTextRangeOverlay->HideSolidBorder();
873  }
874  }
875  else if (!IsFollow())
876  {
877  // This window is not a reply, then draw its range overlay.
878  mpTextRangeOverlay =
880  mrView,
881  mColorAnchor,
882  maAnnotationTextRanges,
883  mpAnchor && mpAnchor->getLineSolid() );
884  }
885  }
886  else
887  {
888  mpTextRangeOverlay.reset();
889  }
890 }
891 
892 void SwAnnotationWin::DoResize()
893 {
894  tools::Long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
895  tools::Long aHeight = GetSizePixel().Height();
896  tools::ULong aWidth = GetSizePixel().Width();
897 
898  aHeight -= GetMetaHeight();
899  mpMetadataAuthor->Show();
900  if(IsResolved()) { mpMetadataResolved->Show(); }
901  mpMetadataDate->Show();
902  mpSidebarTextControl->SetQuickHelpText(OUString());
903  unsigned int numFields = GetNumFields();
904  if (aTextHeight > aHeight)
905  { // we need vertical scrollbars and have to reduce the width
906  aWidth -= GetScrollbarWidth();
907  mpVScrollbar->Show();
908  }
909  else
910  {
911  mpVScrollbar->Hide();
912  }
913 
914  {
915  const Size aSizeOfMetadataControls( GetSizePixel().Width() - GetMetaButtonAreaWidth(),
916  GetMetaHeight()/numFields );
917  mpMetadataAuthor->setPosSizePixel( 0,
918  aHeight,
919  aSizeOfMetadataControls.Width(),
920  aSizeOfMetadataControls.Height() );
921  mpMetadataDate->setPosSizePixel( 0,
922  aHeight + aSizeOfMetadataControls.Height(),
923  aSizeOfMetadataControls.Width(),
924  aSizeOfMetadataControls.Height() );
925  if(IsResolved()) {
926  mpMetadataResolved->setPosSizePixel( 0,
927  aHeight + aSizeOfMetadataControls.Height()*2,
928  aSizeOfMetadataControls.Width(),
929  aSizeOfMetadataControls.Height() );
930  }
931  }
932 
933  mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
934  if (!mpVScrollbar->IsVisible())
935  { // if we do not have a scrollbar anymore, we want to see the complete text
936  mpOutlinerView->SetVisArea( PixelToLogic( tools::Rectangle(0,0,aWidth,aHeight) ) );
937  }
938  tools::Rectangle aOutputArea = PixelToLogic(tools::Rectangle(0, 0, aWidth, aHeight));
939  mpOutlinerView->SetOutputArea(aOutputArea);
940 
941  // Don't leave an empty area at the bottom if we can move the text down.
942  tools::Long nMaxVisAreaTop = mpOutliner->GetTextHeight() - aOutputArea.GetHeight();
943  if (mpOutlinerView->GetVisArea().Top() > nMaxVisAreaTop)
944  {
945  GetOutlinerView()->Scroll(0, mpOutlinerView->GetVisArea().Top() - nMaxVisAreaTop);
946  }
947 
949  {
950  mpSidebarTextControl->setPosSizePixel(0, 0, aWidth, aHeight);
951  mpVScrollbar->setPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight);
952  }
953  else
954  {
955  mpSidebarTextControl->setPosSizePixel( ( aTextHeight > aHeight ? GetScrollbarWidth() : 0 ), 0,
956  aWidth, aHeight);
957  mpVScrollbar->setPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight);
958  }
959 
960  mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
961  mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
962  mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
963  SetScrollbar();
964  mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
965 
966  //calculate rects for meta- button
967  const Fraction& fx( GetMapMode().GetScaleX() );
968  const Fraction& fy( GetMapMode().GetScaleY() );
969 
970  const Point aPos( mpMetadataAuthor->GetPosPixel());
971  mpMenuButton->setPosSizePixel( tools::Long(aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx),
972  tools::Long(aPos.Y()+5*fy),
975 }
976 
977 void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
978 {
979  Window::SetSizePixel(rNewSize);
980 
981  if (mpShadow)
982  {
983  Point aStart = EditWin().PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
984  Point aEnd = EditWin().PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
985  mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
986  }
987 }
988 
989 void SwAnnotationWin::SetScrollbar()
990 {
991  mpVScrollbar->SetThumbPos(mpOutlinerView->GetVisArea().Top());
992 }
993 
994 void SwAnnotationWin::ResizeIfNecessary(tools::Long aOldHeight, tools::Long aNewHeight)
995 {
996  if (aOldHeight != aNewHeight)
997  {
998  //check for lower border or next note
999  tools::Long aBorder = mrMgr.GetNextBorder();
1000  if (aBorder != -1)
1001  {
1002  if (aNewHeight > GetMinimumSizeWithoutMeta())
1003  {
1004  tools::Long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
1005  if (aNewLowerValue < aBorder)
1006  SetSizePixel(Size(GetSizePixel().Width(),aNewHeight+GetMetaHeight()));
1007  else
1008  SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
1009  DoResize();
1010  Invalidate();
1011  }
1012  else
1013  {
1014  if (GetSizePixel().Height() != GetMinimumSizeWithoutMeta() + GetMetaHeight())
1015  SetSizePixel(Size(GetSizePixel().Width(),GetMinimumSizeWithoutMeta() + GetMetaHeight()));
1016  DoResize();
1017  Invalidate();
1018  }
1019  }
1020  else
1021  {
1022  DoResize();
1023  Invalidate();
1024  }
1025  }
1026  else
1027  {
1028  SetScrollbar();
1029  }
1030 }
1031 
1032 void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
1033 {
1034  mColorDark = aColorDark;
1035  mColorLight = aColorLight;
1036  mColorAnchor = aColorAnchor;
1037 
1038  if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1039  return;
1040 
1041  {
1042  mpMetadataAuthor->SetControlBackground(mColorDark);
1043  AllSettings aSettings = mpMetadataAuthor->GetSettings();
1044  StyleSettings aStyleSettings = aSettings.GetStyleSettings();
1045  aStyleSettings.SetLabelTextColor(aColorAnchor);
1046  aSettings.SetStyleSettings(aStyleSettings);
1047  mpMetadataAuthor->SetSettings(aSettings);
1048  }
1049 
1050  {
1051  mpMetadataDate->SetControlBackground(mColorDark);
1052  AllSettings aSettings = mpMetadataDate->GetSettings();
1053  StyleSettings aStyleSettings = aSettings.GetStyleSettings();
1054  aStyleSettings.SetLabelTextColor(aColorAnchor);
1055  aSettings.SetStyleSettings(aStyleSettings);
1056  mpMetadataDate->SetSettings(aSettings);
1057  }
1058 
1059  {
1060  mpMetadataResolved->SetControlBackground(mColorDark);
1061  AllSettings aSettings = mpMetadataResolved->GetSettings();
1062  StyleSettings aStyleSettings = aSettings.GetStyleSettings();
1063  aStyleSettings.SetLabelTextColor(aColorAnchor);
1064  aSettings.SetStyleSettings(aStyleSettings);
1065  mpMetadataResolved->SetSettings(aSettings);
1066  }
1067 
1068  AllSettings aSettings2 = mpVScrollbar->GetSettings();
1069  StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
1070  aStyleSettings2.SetButtonTextColor(Color(0,0,0));
1071  aStyleSettings2.SetCheckedColor(mColorLight); // background
1072  aStyleSettings2.SetShadowColor(mColorAnchor);
1073  aStyleSettings2.SetFaceColor(mColorDark);
1074  aSettings2.SetStyleSettings(aStyleSettings2);
1075  mpVScrollbar->SetSettings(aSettings2);
1076 }
1077 
1078 void SwAnnotationWin::SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition)
1079 {
1080  meSidebarPosition = eSidebarPosition;
1081 }
1082 
1083 void SwAnnotationWin::SetReadonly(bool bSet)
1084 {
1085  mbReadonly = bSet;
1086  GetOutlinerView()->SetReadOnly(bSet);
1087 }
1088 
1090 {
1091  IDocumentUndoRedo& rUndoRedo(
1092  mrView.GetDocShell()->GetDoc()->GetIDocumentUndoRedo());
1093  const bool bDocUndoEnabled = rUndoRedo.DoesUndo();
1094  const bool bOutlinerUndoEnabled = mpOutliner->IsUndoEnabled();
1095  const bool bOutlinerModified = mpOutliner->IsModified();
1096  const bool bDisableAndRestoreUndoMode = !bDocUndoEnabled && bOutlinerUndoEnabled;
1097 
1098  if (bDisableAndRestoreUndoMode)
1099  {
1100  // doc undo is disabled, but outliner was enabled, turn outliner undo off
1101  // for the duration of this function
1102  mpOutliner->EnableUndo(false);
1103  }
1104 
1105  Link<LinkParamNone*,void> aLink = mpOutliner->GetModifyHdl();
1106  mpOutliner->SetModifyHdl( Link<LinkParamNone*,void>() );
1107  ESelection aOld = GetOutlinerView()->GetSelection();
1108 
1109  ESelection aNewSelection( 0, 0, mpOutliner->GetParagraphCount()-1, EE_TEXTPOS_ALL );
1110  GetOutlinerView()->SetSelection( aNewSelection );
1111  SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs());
1112  aEditAttr.Put(rNewItem);
1113  GetOutlinerView()->SetAttribs( aEditAttr );
1114 
1115  if (!mpOutliner->IsUndoEnabled() && !bOutlinerModified)
1116  {
1117  // if undo was disabled (e.g. this is a redo action) and we were
1118  // originally 'unmodified' keep it that way
1119  mpOutliner->ClearModifyFlag();
1120  }
1121 
1122  GetOutlinerView()->SetSelection(aOld);
1123  mpOutliner->SetModifyHdl( aLink );
1124 
1125  const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
1126  EEControlBits nCntrl = mpOutliner->GetControlWord();
1127  // turn off
1128  nCntrl &= ~EEControlBits::ONLINESPELLING;
1129  mpOutliner->SetControlWord(nCntrl);
1130 
1131  //turn back on
1132  if (pVOpt->IsOnlineSpell())
1133  nCntrl |= EEControlBits::ONLINESPELLING;
1134  else
1135  nCntrl &= ~EEControlBits::ONLINESPELLING;
1136  mpOutliner->SetControlWord(nCntrl);
1137 
1138  mpOutliner->CompleteOnlineSpelling();
1139 
1140  // restore original mode
1141  if (bDisableAndRestoreUndoMode)
1142  mpOutliner->EnableUndo(true);
1143 
1144  Invalidate();
1145 }
1146 
1147 void SwAnnotationWin::GetFocus()
1148 {
1149  if (mpSidebarTextControl)
1150  mpSidebarTextControl->GrabFocus();
1151 }
1152 
1153 void SwAnnotationWin::LoseFocus()
1154 {
1155 }
1156 
1157 void SwAnnotationWin::ShowNote()
1158 {
1159  SetPosAndSize();
1160  if (!IsVisible())
1161  Window::Show();
1162  if (mpShadow && !mpShadow->isVisible())
1163  mpShadow->setVisible(true);
1164  if (mpAnchor && !mpAnchor->isVisible())
1165  mpAnchor->setVisible(true);
1166  if (mpTextRangeOverlay && !mpTextRangeOverlay->isVisible())
1167  mpTextRangeOverlay->setVisible(true);
1168 
1169  // Invalidate.
1170  InvalidateControl();
1171  collectUIInformation("SHOW",get_id());
1172 }
1173 
1174 void SwAnnotationWin::HideNote()
1175 {
1176  if (IsVisible())
1177  Window::Hide();
1178  if (mpAnchor)
1179  {
1180  if (mrMgr.IsShowAnchor())
1181  mpAnchor->SetAnchorState(AnchorState::Tri);
1182  else
1183  mpAnchor->setVisible(false);
1184  }
1185  if (mpShadow && mpShadow->isVisible())
1186  mpShadow->setVisible(false);
1187  if (mpTextRangeOverlay && mpTextRangeOverlay->isVisible())
1188  mpTextRangeOverlay->setVisible(false);
1189  collectUIInformation("HIDE",get_id());
1190 }
1191 
1192 void SwAnnotationWin::InvalidateControl()
1193 {
1194  // Invalidate.
1195  mpSidebarTextControl->Push(PushFlags::MAPMODE);
1196  lcl_translateTwips(EditWin(), *mpSidebarTextControl, nullptr);
1197  mpSidebarTextControl->Invalidate();
1198  mpSidebarTextControl->Pop();
1199 }
1200 
1201 void SwAnnotationWin::ActivatePostIt()
1202 {
1203  mrMgr.AssureStdModeAtShell();
1204 
1205  mpOutliner->ClearModifyFlag();
1206  mpOutliner->GetUndoManager().Clear();
1207 
1208  CheckMetaText();
1209  SetViewState(ViewState::EDIT);
1210  GetOutlinerView()->ShowCursor();
1211 
1212  mpOutlinerView->GetEditView().SetInsertMode(mrView.GetWrtShellPtr()->IsInsMode());
1213 
1215  GetOutlinerView()->SetBackgroundColor(mColorDark);
1216 
1217  //tdf#119130 only have the active postit as a dialog control in which pressing
1218  //ctrl+tab cycles between text and button so we don't waste time searching
1219  //thousands of SwAnnotationWins
1220  SetStyle(GetStyle() | WB_DIALOGCONTROL);
1221 }
1222 
1223 void SwAnnotationWin::DeactivatePostIt()
1224 {
1225  //tdf#119130 only have the active postit as a dialog control in which pressing
1226  //ctrl+tab cycles between text and button so we don't waste time searching
1227  //thousands of SwAnnotationWins
1228  SetStyle(GetStyle() & ~WB_DIALOGCONTROL);
1229 
1230  // remove selection, #i87073#
1231  if (GetOutlinerView()->GetEditView().HasSelection())
1232  {
1233  ESelection aSelection = GetOutlinerView()->GetEditView().GetSelection();
1234  aSelection.nEndPara = aSelection.nStartPara;
1235  aSelection.nEndPos = aSelection.nStartPos;
1236  GetOutlinerView()->GetEditView().SetSelection(aSelection);
1237  }
1238 
1239  mpOutliner->CompleteOnlineSpelling();
1240 
1241  SetViewState(ViewState::NORMAL);
1242  // Make sure this view doesn't emit LOK callbacks during the update, as the
1243  // sidebar window's SidebarTextControl doesn't have a valid twip offset
1244  // (map mode origin) during that operation.
1245  bool bTiledPainting = comphelper::LibreOfficeKit::isTiledPainting();
1247  // write the visible text back into the SwField
1248  UpdateData();
1250 
1251  if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1252  GetOutlinerView()->SetBackgroundColor(COL_TRANSPARENT);
1253 
1254  if ( !IsProtected() && mpOutliner->GetEditEngine().GetText().isEmpty() )
1255  {
1256  mnEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1257  }
1258 }
1259 
1260 void SwAnnotationWin::ToggleInsMode()
1261 {
1262  if (!mrView.GetWrtShell().IsRedlineOn())
1263  {
1264  //change outliner
1265  mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
1266  //change document
1267  mrView.GetWrtShell().ToggleInsMode();
1268  //update statusbar
1269  SfxBindings &rBnd = mrView.GetViewFrame()->GetBindings();
1270  rBnd.Invalidate(SID_ATTR_INSERT);
1271  rBnd.Update(SID_ATTR_INSERT);
1272  }
1273 }
1274 
1275 void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
1276 {
1277  mrMgr.AssureStdModeAtShell();
1278 
1279  switch (nSlot)
1280  {
1281  case FN_POSTIT:
1282  case FN_REPLY:
1283  {
1284  // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
1285  // will be created
1286  if (!mpOutliner->GetEditEngine().GetText().isEmpty())
1287  {
1288  OutlinerParaObject* pPara = new OutlinerParaObject(GetOutlinerView()->GetEditView().CreateTextObject());
1289  mrMgr.RegisterAnswer(pPara);
1290  }
1291  if (mrMgr.HasActiveSidebarWin())
1292  mrMgr.SetActiveSidebarWin(nullptr);
1293  SwitchToFieldPos();
1294  mrView.GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
1295  break;
1296  }
1297  case FN_DELETE_COMMENT:
1298  //Delete(); // do not kill the parent of our open popup menu
1299  mnEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1300  break;
1302  DeleteThread();
1303  break;
1304  case FN_RESOLVE_NOTE:
1305  ToggleResolved();
1306  DoResize();
1307  Invalidate();
1308  mrMgr.LayoutPostIts();
1309  break;
1311  GetTopReplyNote()->SetResolved(!IsThreadResolved());
1312  mrMgr.UpdateResolvedStatus(GetTopReplyNote());
1313  DoResize();
1314  Invalidate();
1315  mrMgr.LayoutPostIts();
1316  break;
1317  case FN_FORMAT_ALL_NOTES:
1318  case FN_DELETE_ALL_NOTES:
1319  case FN_HIDE_ALL_NOTES:
1320  // not possible as slot as this would require that "this" is the active postit
1321  mrView.GetViewFrame()->GetBindings().Execute( nSlot, nullptr, SfxCallMode::ASYNCHRON );
1322  break;
1323  case FN_DELETE_NOTE_AUTHOR:
1324  case FN_HIDE_NOTE_AUTHOR:
1325  {
1326  // not possible as slot as this would require that "this" is the active postit
1327  SfxStringItem aItem( nSlot, GetAuthor() );
1328  const SfxPoolItem* aItems[2];
1329  aItems[0] = &aItem;
1330  aItems[1] = nullptr;
1331  mrView.GetViewFrame()->GetBindings().Execute( nSlot, aItems, SfxCallMode::ASYNCHRON );
1332  }
1333  break;
1334  default:
1335  mrView.GetViewFrame()->GetBindings().Execute( nSlot );
1336  break;
1337  }
1338 }
1339 
1340 SwEditWin& SwAnnotationWin::EditWin()
1341 {
1342  return mrView.GetEditWin();
1343 }
1344 
1345 tools::Long SwAnnotationWin::GetPostItTextHeight()
1346 {
1347  return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
1348 }
1349 
1350 void SwAnnotationWin::SwitchToPostIt(sal_uInt16 aDirection)
1351 {
1352  SwAnnotationWin* pPostIt = mrMgr.GetNextPostIt(aDirection, this);
1353  if (pPostIt)
1354  pPostIt->GrabFocus();
1355 }
1356 
1357 IMPL_LINK( SwAnnotationWin, WindowEventListener, VclWindowEvent&, rEvent, void )
1358 {
1359  if ( rEvent.GetId() == VclEventId::WindowMouseMove )
1360  {
1361  MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
1362  if ( pMouseEvt->IsEnterWindow() )
1363  {
1364  mbMouseOver = true;
1365  if ( !HasFocus() )
1366  {
1367  SetViewState(ViewState::VIEW);
1368  Invalidate();
1369  }
1370  }
1371  else if ( pMouseEvt->IsLeaveWindow())
1372  {
1373  mbMouseOver = false;
1374  if ( !HasFocus() )
1375  {
1376  SetViewState(ViewState::NORMAL);
1377  Invalidate();
1378  }
1379  }
1380  }
1381  else if ( rEvent.GetId() == VclEventId::WindowActivate &&
1382  rEvent.GetWindow() == mpSidebarTextControl )
1383  {
1384  SetActiveSidebarWin();
1385  /* We want this SwAnnotationWin to become visible on activation,
1386  but if we are activating because the mouse is pressed in the
1387  annotation and SidebarTextControl::MouseButtonDown is calling
1388  'GrabFocus' then leave the MakeVisible to
1389  SidebarTextControl::MouseButtonUp instead. That way a mouse down
1390  doesn't scroll the writer window while the mouse is pressed, and so
1391  doesn't select random text as the editview is scrolled under the
1392  mouse */
1393  if (!mpSidebarTextControl->MouseDownGainingFocus())
1394  mrMgr.MakeVisible( this );
1395  }
1396 }
1397 
1398 bool SwAnnotationWin::SetActiveSidebarWin()
1399 {
1400  if (mrMgr.GetActiveSidebarWin() == this)
1401  return false;
1402  const bool bLockView = mrView.GetWrtShell().IsViewLocked();
1403  mrView.GetWrtShell().LockView( true );
1404  mrMgr.SetActiveSidebarWin(this);
1405  mrView.GetWrtShell().LockView( bLockView );
1406  return true;
1407 }
1408 
1409 void SwAnnotationWin::UnsetActiveSidebarWin()
1410 {
1411  if (mrMgr.GetActiveSidebarWin() != this)
1412  return;
1413  const bool bLockView = mrView.GetWrtShell().IsViewLocked();
1414  mrView.GetWrtShell().LockView( true );
1415  mrMgr.SetActiveSidebarWin(nullptr);
1416  mrView.GetWrtShell().LockView( bLockView );
1417 }
1418 
1419 IMPL_LINK(SwAnnotationWin, ScrollHdl, ScrollBar*, pScroll, void)
1420 {
1421  tools::Long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
1422  GetOutlinerView()->Scroll( 0, nDiff );
1423 }
1424 
1426 {
1427  mrView.GetDocShell()->SetModified();
1428 }
1429 
1430 IMPL_LINK_NOARG(SwAnnotationWin, DeleteHdl, void*, void)
1431 {
1432  mnEventId = nullptr;
1433  Delete();
1434 }
1435 
1436 void SwAnnotationWin::ResetAttributes()
1437 {
1438  mpOutlinerView->RemoveAttribsKeepLanguages(true);
1439  mpOutliner->RemoveFields();
1440  mpOutlinerView->SetAttribs(DefaultItem());
1441 }
1442 
1443 sal_Int32 SwAnnotationWin::GetScrollbarWidth() const
1444 {
1445  return mrView.GetWrtShell().GetViewOptions()->GetZoom() / 10;
1446 }
1447 
1448 sal_Int32 SwAnnotationWin::GetMetaButtonAreaWidth() const
1449 {
1450  const Fraction& f( GetMapMode().GetScaleX() );
1451  return tools::Long(METABUTTON_AREA_WIDTH * f);
1452 }
1453 
1454 sal_Int32 SwAnnotationWin::GetMetaHeight() const
1455 {
1456  const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
1457  const int fields = GetNumFields();
1458  return tools::Long(fields*POSTIT_META_FIELD_HEIGHT*f);
1459 }
1460 
1461 sal_Int32 SwAnnotationWin::GetNumFields() const
1462 {
1463  return IsResolved() ? 3 : 2;
1464 }
1465 
1466 sal_Int32 SwAnnotationWin::GetMinimumSizeWithMeta() const
1467 {
1468  return mrMgr.GetMinimumSizeWithMeta();
1469 }
1470 
1471 sal_Int32 SwAnnotationWin::GetMinimumSizeWithoutMeta() const
1472 {
1473  const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
1475 }
1476 
1477 void SwAnnotationWin::SetSpellChecking()
1478 {
1479  const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
1480  EEControlBits nCntrl = mpOutliner->GetControlWord();
1481  if (pVOpt->IsOnlineSpell())
1482  nCntrl |= EEControlBits::ONLINESPELLING;
1483  else
1484  nCntrl &= ~EEControlBits::ONLINESPELLING;
1485  mpOutliner->SetControlWord(nCntrl);
1486 
1487  mpOutliner->CompleteOnlineSpelling();
1488  Invalidate();
1489 }
1490 
1491 void SwAnnotationWin::SetViewState(ViewState bViewState)
1492 {
1493  switch (bViewState)
1494  {
1495  case ViewState::EDIT:
1496  {
1497  if (mpAnchor)
1498  {
1499  mpAnchor->SetAnchorState(AnchorState::All);
1500  SwAnnotationWin* pWin = GetTopReplyNote();
1501  // #i111964#
1502  if ( pWin != this && pWin->Anchor() )
1503  {
1505  }
1506  mpAnchor->setLineSolid(true);
1507  if ( mpTextRangeOverlay != nullptr )
1508  {
1509  mpTextRangeOverlay->ShowSolidBorder();
1510  }
1511  }
1512  if (mpShadow)
1513  mpShadow->SetShadowState(SS_EDIT);
1514  break;
1515  }
1516  case ViewState::VIEW:
1517  {
1518  if (mpAnchor)
1519  {
1520  mpAnchor->setLineSolid(true);
1521  if ( mpTextRangeOverlay != nullptr )
1522  {
1523  mpTextRangeOverlay->ShowSolidBorder();
1524  }
1525  }
1526  if (mpShadow)
1527  mpShadow->SetShadowState(SS_VIEW);
1528  break;
1529  }
1530  case ViewState::NORMAL:
1531  {
1532  if (mpAnchor)
1533  {
1534  if (IsFollow())
1535  {
1536  // if there is no visible parent note, we want to see the complete anchor ??
1537  //if (IsAnyStackParentVisible())
1538  mpAnchor->SetAnchorState(AnchorState::End);
1539  SwAnnotationWin* pTopWinSelf = GetTopReplyNote();
1540  SwAnnotationWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
1541  ? mrMgr.GetActiveSidebarWin()->GetTopReplyNote()
1542  : nullptr;
1543  // #i111964#
1544  if ( ( pTopWinSelf != this ) &&
1545  ( pTopWinSelf != pTopWinActive ) &&
1546  pTopWinSelf->Anchor() )
1547  {
1548  if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() )
1549  {
1550  pTopWinSelf->Anchor()->setLineSolid(false);
1551  if ( pTopWinSelf->TextRange() != nullptr )
1552  {
1553  pTopWinSelf->TextRange()->HideSolidBorder();
1554  }
1555  }
1556  pTopWinSelf->Anchor()->SetAnchorState(AnchorState::All);
1557  }
1558  }
1559  mpAnchor->setLineSolid(false);
1560  if ( mpTextRangeOverlay != nullptr )
1561  {
1562  mpTextRangeOverlay->HideSolidBorder();
1563  }
1564  }
1565  if ( mpShadow )
1566  {
1567  mpShadow->SetShadowState(SS_NORMAL);
1568  }
1569  break;
1570  }
1571  }
1572 }
1573 
1574 SwAnnotationWin* SwAnnotationWin::GetTopReplyNote()
1575 {
1576  SwAnnotationWin* pTopNote = this;
1577  SwAnnotationWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : nullptr;
1578  while (pSidebarWin)
1579  {
1580  pTopNote = pSidebarWin;
1581  pSidebarWin = pSidebarWin->IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, pSidebarWin) : nullptr;
1582  }
1583  return pTopNote;
1584 }
1585 
1586 void SwAnnotationWin::SwitchToFieldPos()
1587 {
1588  if ( mrMgr.GetActiveSidebarWin() == this )
1589  mrMgr.SetActiveSidebarWin(nullptr);
1590  GotoPos();
1591  sal_uInt32 aCount = MoveCaret();
1592  if (aCount)
1593  mrView.GetDocShell()->GetWrtShell()->SwCursorShell::Right(aCount, 0);
1594  GrabFocusToDocument();
1595  collectUIInformation("LEAVE",get_id());
1596 }
1597 
1598 void SwAnnotationWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayoutStatus,
1599  const Color& aChangeColor )
1600 {
1601  if ( (mLayoutStatus != aLayoutStatus) ||
1602  (mChangeColor != aChangeColor) )
1603  {
1604  mLayoutStatus = aLayoutStatus;
1605  mChangeColor = aChangeColor;
1606  Invalidate();
1607  }
1608 }
1609 
1610 bool SwAnnotationWin::HasScrollbar() const
1611 {
1612  return mpVScrollbar != nullptr;
1613 }
1614 
1615 bool SwAnnotationWin::IsScrollbarVisible() const
1616 {
1617  return HasScrollbar() && mpVScrollbar->IsVisible();
1618 }
1619 
1620 void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem const & rSidebarItem )
1621 {
1622  const bool bAnchorChanged = mpAnchorFrame != rSidebarItem.maLayoutInfo.mpAnchorFrame;
1623  if ( bAnchorChanged )
1624  {
1625  mrMgr.DisconnectSidebarWinFromFrame( *mpAnchorFrame, *this );
1626  }
1627 
1628  mrSidebarItem = rSidebarItem;
1629  mpAnchorFrame = mrSidebarItem.maLayoutInfo.mpAnchorFrame;
1630 
1631  if ( GetWindowPeer() )
1632  {
1633  SidebarWinAccessible* pAcc =
1634  static_cast<SidebarWinAccessible*>( GetWindowPeer() );
1635  OSL_ENSURE( dynamic_cast<SidebarWinAccessible*>( GetWindowPeer() ),
1636  "<SwAnnotationWin::ChangeSidebarItem(..)> - unexpected type of window peer -> crash possible!" );
1637  pAcc->ChangeSidebarItem( mrSidebarItem );
1638  }
1639 
1640  if ( bAnchorChanged )
1641  {
1642  mrMgr.ConnectSidebarWinToFrame( *(mrSidebarItem.maLayoutInfo.mpAnchorFrame),
1643  mrSidebarItem.GetFormatField(),
1644  *this );
1645  }
1646 }
1647 
1648 css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAccessible()
1649 {
1650  SidebarWinAccessible* pAcc( new SidebarWinAccessible( *this,
1651  mrView.GetWrtShell(),
1652  mrSidebarItem ) );
1653  css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
1654  SetWindowPeer( xWinPeer, pAcc );
1655 
1656  css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
1657  return xAcc;
1658 }
1659 
1660 } // eof of namespace sw::sidebarwindows
1661 
1662 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:750
virtual Point GetPosPixel() const
void SetCheckedColor(const Color &rColor)
const Fraction & GetScaleX() const
sal_Int32 nStartPara
Marks a position in the document model.
Definition: pam.hxx:35
const SwFrame * mpAnchorFrame
#define METABUTTON_AREA_WIDTH
void SetStyleSettings(const StyleSettings &rSet)
WinBits const WB_NODIALOGCONTROL
SwNodeIndex nNode
Definition: pam.hxx:37
::sw::overlay::OverlayRanges * TextRange()
MouseEventModifiers GetMode() const
long Long
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
const SwPosition * GetMark() const
Definition: pam.hxx:209
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:395
bool IsMapModeEnabled() const
tools::Long GetOutOffXPixel() const
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:651
Any GetTime(const OUString &val)
IMPL_LINK(SidebarTextControl, OnlineSpellCallback, SpellCallbackInfo &, rInfo, void)
virtual Size GetSizePixel() const
void SetCalcFieldValueHdl(Outliner *pOutliner)
In the Outliner, set a link to the method for field display in edit objects.
Definition: docdraw.cxx:474
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
const MapMode & GetMapMode() const
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
static Color GetColorAnchor(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2168
WinBits const WB_VSCROLL
void EnableMapMode(bool bEnable=true)
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Invalidate(sal_uInt16 nId)
void setTiledPainting(bool bTiledPainting)
void SetButtonTextColor(const Color &rColor)
EEControlBits
void SetMapMode()
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
#define POSTIT_MINIMUMSIZE_WITHOUT_META
static std::unique_ptr< AnchorOverlayObject > CreateAnchorOverlayObject(SwView const &rDocView, const SwRect &aAnchorRect, tools::Long aPageBorder, const Point &aLineStart, const Point &aLineEnd, const Color &aColorAnchor)
bool IsValidAndGregorian() const
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
sal_uInt16 GetClicks() const
void ChangeSidebarItem(const SwSidebarItem &rSidebarItem)
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
const LocaleDataWrapper & GetLocaleData() const
ESelection aNewSelection(GetSelection())
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:754
sal_uInt16 GetButtons() const
const vcl::Font & GetLabelFont() const
SwIndex nContent
Definition: pam.hxx:38
const Fraction & GetScaleY() const
unsigned long ULong
#define X
bool IsEnterWindow() const
constexpr sal_uInt16 KEY_PAGEUP
static Color GetColorDark(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2138
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
bool GetHighContrastMode() const
#define FN_DELETE_COMMENT
Definition: cmdid.h:752
#define POSTIT_META_FIELD_HEIGHT
sal_Int32 nEndPos
virtual bool DoesUndo() const =0
Is Undo enabled?
void DrawRect(const tools::Rectangle &rRect)
SfxItemPool & GetPool() const
#define FN_RESOLVE_NOTE
Definition: cmdid.h:755
void SetMapUnit(MapUnit eUnit)
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
WinBits const WB_DIALOGCONTROL
#define FN_REPLY
Definition: cmdid.h:753
void SetLineColor()
sal_Int32 nEndPara
#define SW_MOD()
Definition: swmodule.hxx:255
bool IsLeaveWindow() const
int i
SwAnnotationWin * GetTopReplyNote()
Find the first annotation for the thread which this annotation is in.
DrawFlags
SwDoc & GetDoc()
Definition: node.hxx:211
static std::unique_ptr< OverlayRanges > CreateOverlayRange(SwView const &rDocView, const Color &rColor, const std::vector< basegfx::B2DRange > &rRanges, const bool bShowSolidBorder)
#define METABUTTON_WIDTH
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:746
#define METABUTTON_HEIGHT
void SetOrigin(const Point &rOrigin)
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:749
void SetCursorLogicPosition(const Point &rPosition, bool bPoint, bool bClearMark)
const SwFrame * mpAnchorFrame
IMPL_LINK_NOARG(DocumentTimerManager, DoIdleJobs, Timer *, void)
void SetFillColor()
tools::Long Width() const
static bool GetLayoutRTL()
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:818
bool IsInside(const Point &rPOINT) const
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:757
const sal_Int16 mnEventId
MapUnit GetMapUnit() const
OUString SwResId(const char *pId)
Definition: swmodule.cxx:166
bool IsOnlineSpell() const
Definition: viewopt.hxx:365
sal_uInt16 GetModifier() const
void SetLabelTextColor(const Color &rColor)
static bool IsFieldShadings()
Definition: viewopt.hxx:665
void GrabFocus()
#define Y
SwLayoutInfo maLayoutInfo
tools::Long GetOutOffYPixel() const
::sw::sidebarwindows::AnchorOverlayObject * Anchor()
void SetAnchorState(const AnchorState aState)
Point PixelToLogic(const Point &rDevicePt) const
std::unique_ptr< drawinglayer::processor2d::BaseProcessor2D > createBaseProcessor2DFromOutputDevice(OutputDevice &rTargetOutDev, const drawinglayer::geometry::ViewInformation2D &rViewInformation2D)
void Update(sal_uInt16 nId)
WinBits const WB_3DLOOK
OUString getDate(const Date &rDate) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
sal_uInt16 GetChildCount() const
std::vector< SwRect > SwRects
Definition: swregion.hxx:26
void SetFaceColor(const Color &rColor)
std::deque< AttacherIndex_Impl > aIndex
static Color GetColorLight(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2153
void SetLabelFont(const vcl::Font &rFont)
SlideSorterView & mrView
bool IsVisible() const
SwNodes & GetNodes()
Definition: doc.hxx:407
static VclPtr< reference_type > Create(Arg &&...arg)
tools::Long Height() const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
const Point & GetPosPixel() const
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:196
void SetFontHeight(tools::Long nHeight)
tools::Long GetHeight() const
void(* f)(TrueTypeTable *)
void SetShadowColor(const Color &rColor)
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
void SetLanguage(SwWrtShell &rWrtSh, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:219
std::map< OUString, OUString > aParameters
void Push(PushFlags nFlags=PushFlags::ALL)
bool NewTableSelection()
Definition: swcrsr.cxx:2521
#define EE_TEXTPOS_ALL
#define FN_POSTIT
Definition: cmdid.h:213
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:756
vcl::Window * GetChild(sal_uInt16 nChild) const
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:747
WinBits const WB_DRAG
sal_Int32 nStartPos