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