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