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