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