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