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 <config_wasm_strip.h>
21
22#include <sal/config.h>
23
24#include <cstddef>
25
26#include "SidebarWinAcc.hxx"
27#include <PostItMgr.hxx>
28#include <AnnotationWin.hxx>
29#include <IDocumentUndoRedo.hxx>
31#include "SidebarTxtControl.hxx"
34#include "OverlayRanges.hxx"
35
36#include <strings.hrc>
37
38#include <viewopt.hxx>
39#include <cmdid.h>
40
41#include <editeng/fhgtitem.hxx>
42#include <editeng/langitem.hxx>
43#include <editeng/editview.hxx>
44#include <editeng/outliner.hxx>
45#include <editeng/editeng.hxx>
46#include <editeng/eeitem.hxx>
47#include <editeng/outlobj.hxx>
48
49#include <svl/undo.hxx>
50#include <svl/stritem.hxx>
51
52#include <sfx2/viewfrm.hxx>
53#include <sfx2/bindings.hxx>
54#include <sfx2/dispatch.hxx>
55
56#include <vcl/decoview.hxx>
57#include <vcl/event.hxx>
58#include <vcl/gradient.hxx>
59#include <vcl/svapp.hxx>
60#include <vcl/settings.hxx>
61#include <vcl/ptrstyle.hxx>
62#include <vcl/uitest/logger.hxx>
64
65#include <edtwin.hxx>
66#include <view.hxx>
67#include <docsh.hxx>
68#include <wrtsh.hxx>
69#include <doc.hxx>
70#include <docufld.hxx>
71#include <swmodule.hxx>
72
73#include <SwRewriter.hxx>
74#include <txtannotationfld.hxx>
75#include <ndtxt.hxx>
76
79#include <osl/diagnose.h>
82#include <memory>
83#include <comphelper/lok.hxx>
84
85using namespace sw::sidebarwindows;
86
87namespace
88{
89
90void collectUIInformation( const OUString& aevent , const OUString& aID )
91{
92 EventDescription aDescription;
93 aDescription.aID = aID;
94 aDescription.aParameters = {{"" , ""}};
95 aDescription.aAction = aevent;
96 aDescription.aParent = "MainWindow";
97 aDescription.aKeyWord = "SwEditWinUIObject";
98 UITestLogger::getInstance().logEvent(aDescription);
99}
100
101}
102
103namespace sw::annotation {
104
105#define METABUTTON_WIDTH 16
106#define METABUTTON_HEIGHT 18
107#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
108
110{
111 bool bMenuButtonVisible = mxMenuButton->get_visible();
112 // No point in showing this button till click on it are not handled.
113 if (bMenuButtonVisible)
114 mxMenuButton->hide();
115
116 // draw left over space
117 if (Application::GetSettings().GetStyleSettings().GetHighContrastMode())
118 rRenderContext.SetFillColor(COL_BLACK);
119 else
120 rRenderContext.SetFillColor(mColorDark);
121 rRenderContext.SetLineColor();
122 rRenderContext.DrawRect(rRect);
123
124 m_xContainer->draw(rRenderContext, rRect.TopLeft(), GetSizePixel());
125
126 const drawinglayer::geometry::ViewInformation2D aViewInformation;
127 std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation));
128
129 // drawinglayer sets the map mode to pixels, not needed here.
130 rRenderContext.Pop();
131 // Work in document-global twips.
132 rRenderContext.Pop();
133 if (mpAnchor)
134 pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence());
136 pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
137
138 rRenderContext.Push(vcl::PushFlags::NONE);
139 pProcessor.reset();
140 rRenderContext.Push(vcl::PushFlags::NONE);
141
142 if (bMenuButtonVisible)
143 mxMenuButton->show();
144}
145
146bool SwAnnotationWin::IsHitWindow(const Point& rPointLogic)
147{
149 return aRectangleLogic.Contains(rPointLogic);
150}
151
152void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
153{
154 mxSidebarTextControl->SetCursorLogicPosition(rPosition, bPoint, bClearMark);
155}
156
157void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt)
158{
159 // tdf#143511 unclip SysObj so get_extents_relative_to of children
160 // of the SysObj can provide meaningful results
162
163 pDev->Push();
164
166 pDev->SetLineColor();
167
169 vcl::Font aFont = maLabelFont;
170 aFont.SetFontHeight(aFont.GetFontHeight() * 20);
171 pDev->SetFont(aFont);
172
174
175 pDev->DrawRect(tools::Rectangle(rPt, aSz));
176
177 if (mxMetadataAuthor->get_visible())
178 {
179 int x, y, width, height;
180 mxMetadataAuthor->get_extents_relative_to(*m_xContainer, x, y, width, height);
181 Point aPos(rPt + PixelToLogic(Point(x, y)));
182 Size aSize(PixelToLogic(Size(width, height)));
183
185 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
186 pDev->DrawText(aPos, mxMetadataAuthor->get_label());
187 pDev->Pop();
188 }
189
190 if (mxMetadataDate->get_visible())
191 {
192 int x, y, width, height;
193 mxMetadataDate->get_extents_relative_to(*m_xContainer, x, y, width, height);
194 Point aPos(rPt + PixelToLogic(Point(x, y)));
195 Size aSize(PixelToLogic(Size(width, height)));
196
198 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
199 pDev->DrawText(aPos, mxMetadataDate->get_label());
200 pDev->Pop();
201 }
202
203 if (mxMetadataResolved->get_visible())
204 {
205 int x, y, width, height;
206 mxMetadataResolved->get_extents_relative_to(*m_xContainer, x, y, width, height);
207 Point aPos(rPt + PixelToLogic(Point(x, y)));
208 Size aSize(PixelToLogic(Size(width, height)));
209
211 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
212 pDev->DrawText(aPos, mxMetadataResolved->get_label());
213 pDev->Pop();
214 }
215
216 mxSidebarTextControl->DrawForPage(pDev, rPt);
217
219 std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
221 *pDev, aNewViewInfos ));
222
223 if (mpAnchor)
224 pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence());
226 pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
227 pProcessor.reset();
228
229 if (mxVScrollbar->get_vpolicy() != VclPolicyType::NEVER)
230 {
231 // if there is a scrollbar shown, draw "..." to indicate the comment isn't
232 // completely shown
233 int x, y, width, height;
234 mxMenuButton->get_extents_relative_to(*m_xContainer, x, y, width, height);
235 Point aPos(rPt + PixelToLogic(Point(x, y)));
236 pDev->DrawText(aPos, "...");
237 }
238
239 pDev->Pop();
240}
241
243 const SwRect& aAnchorRect, const tools::Long aPageBorder)
244{
245 mPosSize = tools::Rectangle(Point(nX,nY),Size(nWidth,nHeight));
246 if (!mAnchorRect.IsEmpty() && mAnchorRect != aAnchorRect)
247 mbAnchorRectChanged = true;
248 mAnchorRect = aAnchorRect;
249 mPageBorder = aPageBorder;
250}
251
252void SwAnnotationWin::SetSize( const Size& rNewSize )
253{
254 mPosSize.SetSize(rNewSize);
255}
256
257void SwAnnotationWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
258{
259 mPosSize = tools::Rectangle(aPoint,aSize);
260}
261
263{
264 mPosSize.Move(0,aAmount);
265}
266
267void SwAnnotationWin::ShowAnchorOnly(const Point &aPoint)
268{
269 HideNote();
271 if (mpAnchor)
272 {
273 mpAnchor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
274 mpAnchor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
275 mpAnchor->SetAnchorState(AnchorState::All);
276 mpAnchor->setVisible(true);
277 }
278 if (mpShadow)
279 mpShadow->setVisible(false);
280}
281
283{
284 SfxItemSet aItem( mrView.GetDocShell()->GetPool() );
286 return aItem;
287}
288
290{
291 // window controls for author and date
292 mxMetadataAuthor = m_xBuilder->weld_label("author");
293 mxMetadataAuthor->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
295
298
299 // we should leave this setting alone, but for this we need a better layout algo
300 // with variable meta size height
301 mxMetadataAuthor->set_font(maLabelFont);
302
303 mxMetadataDate = m_xBuilder->weld_label("date");
304 mxMetadataDate->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_DATE_NAME ) );
306 mxMetadataDate->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
307
308 // we should leave this setting alone, but for this we need a better layout algo
309 // with variable meta size height
310 mxMetadataDate->set_font(maLabelFont);
311
312 mxMetadataResolved = m_xBuilder->weld_label("resolved");
313 mxMetadataResolved->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
315 mxMetadataResolved->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
316
317 // we should leave this setting alone, but for this we need a better layout algo
318 // with variable meta size height
320 mxMetadataResolved->set_label(SwResId(STR_ACCESS_ANNOTATION_RESOLVED_NAME));
321
322 SwDocShell* aShell = mrView.GetDocShell();
323 mpOutliner.reset(new Outliner(&aShell->GetPool(),OutlinerMode::TextObject));
324 aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner.get() );
325 mpOutliner->SetUpdateLayout( true );
326
327 mpOutlinerView.reset(new OutlinerView(mpOutliner.get(), nullptr));
328 mpOutliner->InsertView(mpOutlinerView.get());
329
330 //create Scrollbars
331 mxVScrollbar = m_xBuilder->weld_scrolled_window("scrolledwindow", true);
332
333 mxMenuButton = m_xBuilder->weld_menu_button("menubutton");
335
336 // actual window which holds the user text
339 mxSidebarTextControl->SetPointer(PointerStyle::Text);
340
341 Rescale();
342
343 mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
344 mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );
345
346 mpOutlinerView->SetAttribs(DefaultItem());
347
348 mxVScrollbar->set_direction(false);
349 mxVScrollbar->connect_vadjustment_changed(LINK(this, SwAnnotationWin, ScrollHdl));
350 mxVScrollbar->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
351
352 EEControlBits nCntrl = mpOutliner->GetControlWord();
353 // TODO: crash when AUTOCOMPLETE enabled
354 nCntrl |= EEControlBits::MARKFIELDS | EEControlBits::PASTESPECIAL | EEControlBits::AUTOCORRECT | EEControlBits::USECHARATTRIBS; // | EEControlBits::AUTOCOMPLETE;
355
356 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
357 {
358 const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
359 if (pVOpt->IsFieldShadings())
360 nCntrl |= EEControlBits::MARKFIELDS;
361 else
362 nCntrl &= ~EEControlBits::MARKFIELDS;
363 if (pVOpt->IsOnlineSpell())
364 nCntrl |= EEControlBits::ONLINESPELLING;
365 else
366 nCntrl &= ~EEControlBits::ONLINESPELLING;
367 }
368 mpOutliner->SetControlWord(nCntrl);
369
370 std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
374
376
377 // expand %1 "Author"
378 OUString aText = mxMenuButton->get_item_label("deleteby");
379 SwRewriter aRewriter;
380 aRewriter.AddRule(UndoArg1, GetAuthor());
381 aText = aRewriter.Apply(aText);
382 mxMenuButton->set_item_label("deleteby", aText);
383
384 mxMenuButton->set_accessible_name(SwResId(STR_ACCESS_ANNOTATION_BUTTON_NAME));
385 mxMenuButton->set_accessible_description(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
386 mxMenuButton->set_tooltip_text(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
387
388 mxMenuButton->connect_toggled(LINK(this, SwAnnotationWin, ToggleHdl));
389 mxMenuButton->connect_selected(LINK(this, SwAnnotationWin, SelectHdl));
390 mxMenuButton->connect_key_press(LINK(this, SwAnnotationWin, KeyInputHdl));
391 mxMenuButton->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
392
396 mpOutliner->CompleteOnlineSpelling();
397
398 mxSidebarTextControl->Show();
399 mxMetadataAuthor->show();
400 mxMetadataDate->show();
401 mxMetadataResolved->set_visible(IsResolved());
402 mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
403}
404
406{
407 const SvtSysLocale aSysLocale;
408 const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
409 OUString sMeta = GetAuthor();
410 if (sMeta.isEmpty())
411 {
412 sMeta = SwResId(STR_NOAUTHOR);
413 }
414 else if (sMeta.getLength() > 23)
415 {
416 sMeta = OUString::Concat(sMeta.subView(0, 20)) + "...";
417 }
418 if ( mxMetadataAuthor->get_label() != sMeta )
419 {
420 mxMetadataAuthor->set_label(sMeta);
421 }
422
423 Date aDate = GetDate();
424 if (aDate.IsValidAndGregorian() )
425 {
426 sMeta = rLocalData.getDate(aDate);
427 }
428 else
429 {
430 sMeta = SwResId(STR_NODATE);
431 }
432 if (GetTime().GetTime()!=0)
433 {
434 sMeta += " " + rLocalData.getTime( GetTime(),false );
435 }
436 if ( mxMetadataDate->get_label() != sMeta )
437 {
438 mxMetadataDate->set_label(sMeta);
439 }
440
441 std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
445}
446
447static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack)
448{
449 return Color(sal_uInt8(aFront.GetRed() * aTransparency / 255.0 + aBack.GetRed() * (1 - aTransparency / 255.0)),
450 sal_uInt8(aFront.GetGreen() * aTransparency / 255.0 + aBack.GetGreen() * (1 - aTransparency / 255.0)),
451 sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0)));
452}
453
455{
456 if (!mxMenuButton)
457 return;
458
459 mxMenuButton->set_background(mColorDark);
460
461 SwWrtShell* pWrtShell = mrView.GetWrtShellPtr();
462 if (!pWrtShell)
463 return;
464 const Fraction& rFraction = pWrtShell->GetOut()->GetMapMode().GetScaleY();
465
467 Size aSize(tools::Long(METABUTTON_WIDTH * rFraction),
468 tools::Long(METABUTTON_HEIGHT * rFraction));
469 tools::Rectangle aRect(Point(0, 0), aSize);
470 xVirDev->SetOutputSizePixel(aSize);
471
472 Gradient aGradient(css::awt::GradientStyle_LINEAR,
475 xVirDev->DrawGradient(aRect, aGradient);
476
477 //draw rect around button
478 xVirDev->SetFillColor();
479 xVirDev->SetLineColor(ColorFromAlphaColor(90, mColorAnchor, mColorDark));
480 xVirDev->DrawRect(aRect);
481
482 tools::Rectangle aSymbolRect(aRect);
483 // 25% distance to the left and right button border
484 const tools::Long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth() * 250) + 500) / 1000;
485 aSymbolRect.AdjustLeft(nBorderDistanceLeftAndRight );
486 aSymbolRect.AdjustRight( -nBorderDistanceLeftAndRight );
487 // 40% distance to the top button border
488 const tools::Long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 400) + 500) / 1000;
489 aSymbolRect.AdjustTop(nBorderDistanceTop );
490 // 15% distance to the bottom button border
491 const tools::Long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 150) + 500) / 1000;
492 aSymbolRect.AdjustBottom( -nBorderDistanceBottom );
493 DecorationView aDecoView(xVirDev.get());
494 aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, GetTextColor(),
495 DrawSymbolFlags::NONE);
496 mxMenuButton->set_image(xVirDev);
497 mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height() + 4);
498}
499
501{
502 // On Android, this method leads to invoke ImpEditEngine::UpdateViews
503 // which hides the text cursor. Moreover it causes sudden document scroll
504 // when modifying a commented text. Not clear the root cause,
505 // anyway skipping this method fixes the problem, and there should be
506 // no side effect, since the client has disabled annotations rendering.
508 return;
509
510 MapMode aMode = GetParent()->GetMapMode();
511 aMode.SetOrigin( Point() );
512 SetMapMode( aMode );
513 mxSidebarTextControl->SetMapMode( aMode );
514
515 SwWrtShell* pWrtShell = mrView.GetWrtShellPtr();
516 if (!pWrtShell)
517 return;
518 const Fraction& rFraction = pWrtShell->GetOut()->GetMapMode().GetScaleY();
519
520 vcl::Font aFont = maLabelFont;
521 sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
522 aFont.SetFontHeight( nHeight );
523
525 mxMetadataAuthor->set_font(aFont);
526 if (mxMetadataDate)
527 mxMetadataDate->set_font(aFont);
529 mxMetadataResolved->set_font(aFont);
531 if (mxVScrollbar)
532 mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
533}
534
536{
537 bool bChange = false;
538
539 if (GetSizePixel() != mPosSize.GetSize())
540 {
541 bChange = true;
543
544 DoResize();
545 }
546
547 if (GetPosPixel().X() != mPosSize.Left() || (std::abs(GetPosPixel().Y() - mPosSize.Top()) > 5) )
548 {
549 bChange = true;
551
552 Point aLineStart;
553 Point aLineEnd ;
554 switch ( meSidebarPosition )
555 {
557 {
558 aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
559 aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
560 }
561 break;
563 {
564 aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
565 aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
566 }
567 break;
568 default:
569 OSL_FAIL( "<SwAnnotationWin::SetPosAndSize()> - unexpected position of sidebar" );
570 break;
571 }
572
573 // LOK has map mode disabled, and we still want to perform pixel ->
574 // twips conversion for the size of the line above the note.
576 {
578 Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY());
579 aSize = EditWin().PixelToLogic(aSize);
580 aLineEnd = aLineStart;
581 aLineEnd.Move(aSize.getWidth(), aSize.getHeight());
582 EditWin().EnableMapMode(false);
583 }
584
585 if (mpAnchor)
586 {
587 mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
592 basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
593 basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
594 }
595 else
596 {
597 mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView,
600 aLineStart,
601 aLineEnd,
602 mColorAnchor );
603 if ( mpAnchor )
604 {
605 mpAnchor->setVisible(true);
606 mpAnchor->SetAnchorState(AnchorState::Tri);
607 if (HasChildPathFocus())
608 {
609 mpAnchor->setLineSolid(true);
610 }
611 }
612 }
613 }
614 else
615 {
616 if ( mpAnchor &&
617 ( mpAnchor->getBasePosition() != basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom()-5*15) ) )
618 {
619 mpAnchor->SetTriPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
624 }
625 }
626
627 if (mpShadow && bChange)
628 {
631 mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
632 }
633
634 if (mrMgr.ShowNotes())
635 {
636 if (IsFollow() && !HasChildPathFocus())
637 {
638 // #i111964#
639 if ( mpAnchor )
640 {
641 mpAnchor->SetAnchorState(AnchorState::End);
642 }
643 }
644 else
645 {
646 // #i111964#
647 if ( mpAnchor )
648 {
649 mpAnchor->SetAnchorState(AnchorState::All);
650 }
652 // #i111964#
653 if ( pWin != this && pWin->Anchor() )
654 {
655 pWin->Anchor()->SetAnchorState(AnchorState::End);
656 }
657 }
658 }
659
660
661 // text range overlay
665 {
666 const SwTextAnnotationField* pTextAnnotationField =
668 SwTextNode* pTextNode = pTextAnnotationField ? pTextAnnotationField->GetpTextNode() : nullptr;
669 SwContentNode* pContentNd = nullptr;
670 if (pTextNode)
671 {
672 SwNodes& rNds = pTextNode->GetDoc().GetNodes();
673 pContentNd = rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetContentNode();
674 }
675 if (pContentNd)
676 {
677 SwPosition aStartPos( *pContentNd, mrSidebarItem.maLayoutInfo.mnStartContent );
678 SwShellCursor* pTmpCursor = nullptr;
679 const bool bTableCursorNeeded = pTextNode->FindTableBoxStartNode() != pContentNd->FindTableBoxStartNode();
680 if ( bTableCursorNeeded )
681 {
682 SwShellTableCursor* pTableCursor = new SwShellTableCursor( mrView.GetWrtShell(), aStartPos );
683 pTableCursor->SetMark();
684 pTableCursor->GetMark()->Assign( *pTextNode, pTextAnnotationField->GetStart()+1 );
685 pTableCursor->NewTableSelection();
686 pTmpCursor = pTableCursor;
687 }
688 else
689 {
690 SwShellCursor* pCursor = new SwShellCursor( mrView.GetWrtShell(), aStartPos );
691 pCursor->SetMark();
692 pCursor->GetMark()->Assign(*pTextNode, pTextAnnotationField->GetStart()+1 );
693 pTmpCursor = pCursor;
694 }
695 std::unique_ptr<SwShellCursor> pTmpCursorForAnnotationTextRange( pTmpCursor );
696
697 // For annotation text range rectangles to be calculated correctly,
698 // we need the map mode disabled
699 bool bDisableMapMode = comphelper::LibreOfficeKit::isActive() && EditWin().IsMapModeEnabled();
700 if (bDisableMapMode)
701 EditWin().EnableMapMode(false);
702
704 pTmpCursorForAnnotationTextRange->FillRects();
705
706 if (bDisableMapMode)
708
709 SwRects* pRects(pTmpCursorForAnnotationTextRange.get());
710 for(const SwRect & rNextRect : *pRects)
711 {
712 const tools::Rectangle aPntRect(rNextRect.SVRect());
713 maAnnotationTextRanges.emplace_back(
714 aPntRect.Left(), aPntRect.Top(),
715 aPntRect.Right() + 1, aPntRect.Bottom() + 1);
716 }
717 }
718 }
719
720 if (mrMgr.ShowNotes() && !maAnnotationTextRanges.empty())
721 {
722 if ( mpTextRangeOverlay != nullptr )
723 {
724 mpTextRangeOverlay->setRanges( std::vector(maAnnotationTextRanges) );
725 if ( mpAnchor != nullptr && mpAnchor->getLineSolid() )
726 {
727 mpTextRangeOverlay->ShowSolidBorder();
728 }
729 else
730 {
731 mpTextRangeOverlay->HideSolidBorder();
732 }
733 }
734 else if (!IsFollow())
735 {
736 // This window is not a reply, then draw its range overlay.
739 mrView,
741 std::vector(maAnnotationTextRanges),
742 mpAnchor && mpAnchor->getLineSolid() );
743 }
744 }
745 else
746 {
747 mpTextRangeOverlay.reset();
748 }
749}
750
752{
753 tools::Long aHeight = GetSizePixel().Height();
754 tools::ULong aWidth = GetSizePixel().Width();
755
756 aHeight -= GetMetaHeight();
757
758 mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth, aHeight) ) ) ;
759 tools::Long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
760
761 mxMetadataAuthor->show();
762 if(IsResolved()) { mxMetadataResolved->show(); }
763 mxMetadataDate->show();
764
765 if (aTextHeight > aHeight)
766 {
767 const int nThickness = mxVScrollbar->get_scroll_thickness();
768 if (nThickness)
769 {
770 // we need vertical scrollbars and have to reduce the width
771 aWidth -= nThickness;
772 mpOutliner->SetPaperSize(PixelToLogic(Size(aWidth, aHeight)));
773 }
774 mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
775 }
776 else
777 {
778 mxVScrollbar->set_vpolicy(VclPolicyType::NEVER);
779 }
780
781 tools::Rectangle aOutputArea = PixelToLogic(tools::Rectangle(0, 0, aWidth, aHeight));
782 if (mxVScrollbar->get_vpolicy() == VclPolicyType::NEVER)
783 {
784 // if we do not have a scrollbar anymore, we want to see the complete text
785 mpOutlinerView->SetVisArea(aOutputArea);
786 }
787 mpOutlinerView->SetOutputArea(aOutputArea);
788 mpOutlinerView->ShowCursor(true, true);
789
790 // Don't leave an empty area at the bottom if we can move the text down.
791 tools::Long nMaxVisAreaTop = mpOutliner->GetTextHeight() - aOutputArea.GetHeight();
792 if (mpOutlinerView->GetVisArea().Top() > nMaxVisAreaTop)
793 {
794 GetOutlinerView()->Scroll(0, mpOutlinerView->GetVisArea().Top() - nMaxVisAreaTop);
795 }
796
797 int nUpper = mpOutliner->GetTextHeight();
798 int nCurrentDocPos = mpOutlinerView->GetVisArea().Top();
799 int nStepIncrement = mpOutliner->GetTextHeight() / 10;
800 int nPageIncrement = PixelToLogic(Size(0,aHeight)).Height() * 8 / 10;
801 int nPageSize = PixelToLogic(Size(0,aHeight)).Height();
802
803 /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
804 effectively...
805
806 lower = gtk_adjustment_get_lower
807 upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
808
809 and requires that upper > lower or the deceleration animation never ends
810 */
811 nPageSize = std::min(nPageSize, nUpper);
812
813 mxVScrollbar->vadjustment_configure(nCurrentDocPos, 0, nUpper,
814 nStepIncrement, nPageIncrement, nPageSize);
815}
816
817void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
818{
820 return;
821
823
824 if (mpShadow)
825 {
828 mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
829 }
830}
831
833{
834 mxVScrollbar->vadjustment_set_value(mpOutlinerView->GetVisArea().Top());
835}
836
838{
839 if (aOldHeight != aNewHeight)
840 {
841 //check for lower border or next note
842 tools::Long aBorder = mrMgr.GetNextBorder();
843 if (aBorder != -1)
844 {
845 if (aNewHeight > GetMinimumSizeWithoutMeta())
846 {
847 tools::Long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
848 if (aNewLowerValue < aBorder)
850 else
851 SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
852 DoResize();
853 Invalidate();
854 }
855 else
856 {
859 DoResize();
860 Invalidate();
861 }
862 }
863 else
864 {
865 DoResize();
866 Invalidate();
867 }
868 }
869 else
870 {
871 SetScrollbar();
872 }
873}
874
875void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
876{
877 mColorDark = aColorDark;
878 mColorLight = aColorLight;
879 mColorAnchor = aColorAnchor;
880
881 if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
882 return;
883
884 m_xContainer->set_background(mColorDark);
886
887 mxMetadataAuthor->set_font_color(aColorAnchor);
888
889 mxMetadataDate->set_font_color(aColorAnchor);
890
891 mxMetadataResolved->set_font_color(aColorAnchor);
892
893 mxVScrollbar->customize_scrollbars(mColorLight,
895 mColorDark);
896}
897
899{
900 meSidebarPosition = eSidebarPosition;
901}
902
904{
905 mbReadonly = bSet;
907}
908
910{
911 IDocumentUndoRedo& rUndoRedo(
913 const bool bDocUndoEnabled = rUndoRedo.DoesUndo();
914 const bool bOutlinerUndoEnabled = mpOutliner->IsUndoEnabled();
915 const bool bOutlinerModified = mpOutliner->IsModified();
916 const bool bDisableAndRestoreUndoMode = !bDocUndoEnabled && bOutlinerUndoEnabled;
917
918 if (bDisableAndRestoreUndoMode)
919 {
920 // doc undo is disabled, but outliner was enabled, turn outliner undo off
921 // for the duration of this function
922 mpOutliner->EnableUndo(false);
923 }
924
925 Link<LinkParamNone*,void> aLink = mpOutliner->GetModifyHdl();
926 mpOutliner->SetModifyHdl( Link<LinkParamNone*,void>() );
928
929 ESelection aNewSelection( 0, 0, mpOutliner->GetParagraphCount()-1, EE_TEXTPOS_ALL );
931 SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs());
932 aEditAttr.Put(rNewItem);
933 GetOutlinerView()->SetAttribs( aEditAttr );
934
935 if (!mpOutliner->IsUndoEnabled() && !bOutlinerModified)
936 {
937 // if undo was disabled (e.g. this is a redo action) and we were
938 // originally 'unmodified' keep it that way
939 mpOutliner->ClearModifyFlag();
940 }
941
943 mpOutliner->SetModifyHdl( aLink );
944
945 EEControlBits nCntrl = mpOutliner->GetControlWord();
946 // turn off
947 nCntrl &= ~EEControlBits::ONLINESPELLING;
948 mpOutliner->SetControlWord(nCntrl);
949
950 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
951 {
952 const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
953 //turn back on
954 if (pVOpt->IsOnlineSpell())
955 nCntrl |= EEControlBits::ONLINESPELLING;
956 else
957 nCntrl &= ~EEControlBits::ONLINESPELLING;
958 }
959 mpOutliner->SetControlWord(nCntrl);
960
961 mpOutliner->CompleteOnlineSpelling();
962
963 // restore original mode
964 if (bDisableAndRestoreUndoMode)
965 mpOutliner->EnableUndo(true);
966
967 Invalidate();
968}
969
971{
973 mxSidebarTextControl->GrabFocus();
974}
975
977{
978}
979
981{
983 if (!IsVisible())
984 Window::Show();
985 if (mpShadow && !mpShadow->isVisible())
986 mpShadow->setVisible(true);
987 if (mpAnchor && !mpAnchor->isVisible())
988 mpAnchor->setVisible(true);
989 if (mpTextRangeOverlay && !mpTextRangeOverlay->isVisible())
990 mpTextRangeOverlay->setVisible(true);
991
992 collectUIInformation("SHOW",get_id());
993}
994
996{
997 if (IsVisible())
998 Window::Hide();
999 if (mpAnchor)
1000 {
1001 if (mrMgr.IsShowAnchor())
1002 mpAnchor->SetAnchorState(AnchorState::Tri);
1003 else
1004 mpAnchor->setVisible(false);
1005 }
1006 if (mpShadow && mpShadow->isVisible())
1007 mpShadow->setVisible(false);
1008 if (mpTextRangeOverlay && mpTextRangeOverlay->isVisible())
1009 mpTextRangeOverlay->setVisible(false);
1010 collectUIInformation("HIDE",get_id());
1011}
1012
1014{
1016
1017 mpOutliner->ClearModifyFlag();
1018 mpOutliner->GetUndoManager().Clear();
1019
1020 CheckMetaText();
1021 SetViewState(ViewState::EDIT);
1022
1023 // prevent autoscroll to the old cursor location
1024 // when cursor out of visible area
1025 GetOutlinerView()->ShowCursor(false);
1026
1027 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
1028 mpOutlinerView->GetEditView().SetInsertMode(pWrtShell->IsInsMode());
1029
1030 if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1032
1033 //tdf#119130 only have the active postit as a dialog control in which pressing
1034 //ctrl+tab cycles between text and button so we don't waste time searching
1035 //thousands of SwAnnotationWins
1037}
1038
1040{
1041 //tdf#119130 only have the active postit as a dialog control in which pressing
1042 //ctrl+tab cycles between text and button so we don't waste time searching
1043 //thousands of SwAnnotationWins
1045
1046 // remove selection, #i87073#
1047 if (GetOutlinerView()->GetEditView().HasSelection())
1048 {
1050 aSelection.nEndPara = aSelection.nStartPara;
1051 aSelection.nEndPos = aSelection.nStartPos;
1052 GetOutlinerView()->GetEditView().SetSelection(aSelection);
1053 }
1054
1055 mpOutliner->CompleteOnlineSpelling();
1056
1057 SetViewState(ViewState::NORMAL);
1058 // Make sure this view doesn't emit LOK callbacks during the update, as the
1059 // sidebar window's SidebarTextControl doesn't have a valid twip offset
1060 // (map mode origin) during that operation.
1061 bool bTiledPainting = comphelper::LibreOfficeKit::isTiledPainting();
1063 // write the visible text back into the SwField
1064 UpdateData();
1066
1067 if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1069
1070 if (!mnDeleteEventId && !IsReadOnlyOrProtected() && mpOutliner->GetEditEngine().GetText().isEmpty())
1071 {
1072 mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1073 }
1074}
1075
1077{
1079 {
1080 //change outliner
1081 mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
1082 //change document
1084 //update statusbar
1086 rBnd.Invalidate(SID_ATTR_INSERT);
1087 rBnd.Update(SID_ATTR_INSERT);
1088 }
1089}
1090
1092{
1094
1095 switch (nSlot)
1096 {
1097 case FN_POSTIT:
1098 case FN_REPLY:
1099 {
1100 // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
1101 // will be created
1102 if (!mpOutliner->GetEditEngine().GetText().isEmpty())
1103 {
1104 OutlinerParaObject aPara(GetOutlinerView()->GetEditView().CreateTextObject());
1105 mrMgr.RegisterAnswer(&aPara);
1106 }
1108 mrMgr.SetActiveSidebarWin(nullptr);
1111
1112 if (nSlot == FN_REPLY)
1113 {
1114 // Get newly created SwPostItField and set its paraIdParent
1115 auto pPostItField = mrMgr.GetLatestPostItField();
1116 pPostItField->SetParentId(GetTopReplyNote()->GetParaId());
1117 }
1118 break;
1119 }
1120 case FN_DELETE_COMMENT:
1121 //Delete(); // do not kill the parent of our open popup menu
1122 mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1123 break;
1125 DeleteThread();
1126 break;
1127 case FN_RESOLVE_NOTE:
1129 DoResize();
1130 Invalidate();
1132 break;
1136 DoResize();
1137 Invalidate();
1139 break;
1142 case FN_HIDE_ALL_NOTES:
1143 // not possible as slot as this would require that "this" is the active postit
1144 mrView.GetViewFrame().GetBindings().Execute( nSlot, nullptr, SfxCallMode::ASYNCHRON );
1145 break;
1148 {
1149 // not possible as slot as this would require that "this" is the active postit
1150 SfxStringItem aItem( nSlot, GetAuthor() );
1151 const SfxPoolItem* aItems[2];
1152 aItems[0] = &aItem;
1153 aItems[1] = nullptr;
1154 mrView.GetViewFrame().GetBindings().Execute( nSlot, aItems, SfxCallMode::ASYNCHRON );
1155 }
1156 break;
1157 default:
1159 break;
1160 }
1161}
1162
1164{
1165 return mrView.GetEditWin();
1166}
1167
1169{
1170 return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
1171}
1172
1173void SwAnnotationWin::SwitchToPostIt(sal_uInt16 aDirection)
1174{
1176 if (pPostIt)
1177 pPostIt->GrabFocus();
1178}
1179
1180IMPL_LINK(SwAnnotationWin, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
1181{
1182 if (rMEvt.IsEnterWindow())
1183 {
1184 mbMouseOver = true;
1185 if ( !HasFocus() )
1186 {
1187 SetViewState(ViewState::VIEW);
1188 Invalidate();
1189 }
1190 }
1191 else if (rMEvt.IsLeaveWindow())
1192 {
1193 mbMouseOver = false;
1194 if ( !HasFocus() )
1195 {
1196 SetViewState(ViewState::NORMAL);
1197 Invalidate();
1198 }
1199 }
1200 return false;
1201}
1202
1204{
1205 if (mrMgr.GetActiveSidebarWin() == this)
1206 return false;
1207 mrView.GetWrtShell().LockView( true );
1209 mrView.GetWrtShell().LockView( true );
1210
1211 return true;
1212}
1213
1215{
1216 if (mrMgr.GetActiveSidebarWin() != this)
1217 return;
1218 mrView.GetWrtShell().LockView( true );
1219 mrMgr.SetActiveSidebarWin(nullptr);
1220 mrView.GetWrtShell().LockView( false );
1221}
1222
1224{
1225 mrView.GetWrtShell().LockView( bLock );
1226}
1227
1228IMPL_LINK(SwAnnotationWin, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
1229{
1230 tools::Long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - rScrolledWindow.vadjustment_get_value();
1231 GetOutlinerView()->Scroll( 0, nDiff );
1232}
1233
1235{
1236 mrView.GetDocShell()->SetModified();
1237}
1238
1239IMPL_LINK_NOARG(SwAnnotationWin, DeleteHdl, void*, void)
1240{
1241 mnDeleteEventId = nullptr;
1242 Delete();
1243}
1244
1246{
1247 mpOutlinerView->RemoveAttribsKeepLanguages(true);
1248 mpOutliner->RemoveFields();
1249 mpOutlinerView->SetAttribs(DefaultItem());
1250}
1251
1253{
1254 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
1255 {
1256 const Fraction& f(pWrtShell->GetOut()->GetMapMode().GetScaleY());
1257 return tools::Long(Application::GetSettings().GetStyleSettings().GetScrollBarSize() * f);
1258 }
1259 else
1260 return tools::Long(Application::GetSettings().GetStyleSettings().GetScrollBarSize());
1261}
1262
1264{
1265 const int fields = GetNumFields();
1266
1267 sal_Int32 nRequiredHeight = 0;
1268 weld::Label* aLabels[3] = { mxMetadataAuthor.get(), mxMetadataDate.get(), mxMetadataResolved.get() };
1269 for (int i = 0; i < fields; ++i)
1270 nRequiredHeight += aLabels[i]->get_preferred_size().Height();
1271
1272 return nRequiredHeight;
1273}
1274
1276{
1277 return IsResolved() ? 3 : 2;
1278}
1279
1281{
1283}
1284
1286{
1287 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
1288 {
1289 const Fraction& f(pWrtShell->GetOut()->GetMapMode().GetScaleY());
1291 }
1292 else
1294}
1295
1297{
1298 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
1299 {
1300 const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
1301 EEControlBits nCntrl = mpOutliner->GetControlWord();
1302 if (pVOpt->IsOnlineSpell())
1303 nCntrl |= EEControlBits::ONLINESPELLING;
1304 else
1305 nCntrl &= ~EEControlBits::ONLINESPELLING;
1306 mpOutliner->SetControlWord(nCntrl);
1307
1308 mpOutliner->CompleteOnlineSpelling();
1309 Invalidate();
1310 }
1311}
1312
1314{
1315 switch (bViewState)
1316 {
1317 case ViewState::EDIT:
1318 {
1319 if (mpAnchor)
1320 {
1321 mpAnchor->SetAnchorState(AnchorState::All);
1323 // #i111964#
1324 if ( pWin != this && pWin->Anchor() )
1325 {
1326 pWin->Anchor()->SetAnchorState(AnchorState::End);
1327 }
1328 mpAnchor->setLineSolid(true);
1329 if ( mpTextRangeOverlay != nullptr )
1330 {
1331 mpTextRangeOverlay->ShowSolidBorder();
1332 }
1333 }
1334 if (mpShadow)
1335 mpShadow->SetShadowState(SS_EDIT);
1336 break;
1337 }
1338 case ViewState::VIEW:
1339 {
1340 if (mpAnchor)
1341 {
1342 mpAnchor->setLineSolid(true);
1343 if ( mpTextRangeOverlay != nullptr )
1344 {
1345 mpTextRangeOverlay->ShowSolidBorder();
1346 }
1347 }
1348 if (mpShadow)
1349 mpShadow->SetShadowState(SS_VIEW);
1350 break;
1351 }
1352 case ViewState::NORMAL:
1353 {
1354 if (mpAnchor)
1355 {
1356 if (IsFollow())
1357 {
1358 // if there is no visible parent note, we want to see the complete anchor ??
1359 //if (IsAnyStackParentVisible())
1360 mpAnchor->SetAnchorState(AnchorState::End);
1361 SwAnnotationWin* pTopWinSelf = GetTopReplyNote();
1362 SwAnnotationWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
1364 : nullptr;
1365 // #i111964#
1366 if ( ( pTopWinSelf != this ) &&
1367 ( pTopWinSelf != pTopWinActive ) &&
1368 pTopWinSelf->Anchor() )
1369 {
1370 if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() )
1371 {
1372 pTopWinSelf->Anchor()->setLineSolid(false);
1373 if ( pTopWinSelf->TextRange() != nullptr )
1374 {
1375 pTopWinSelf->TextRange()->HideSolidBorder();
1376 }
1377 }
1378 pTopWinSelf->Anchor()->SetAnchorState(AnchorState::All);
1379 }
1380 }
1381 mpAnchor->setLineSolid(false);
1382 if ( mpTextRangeOverlay != nullptr )
1383 {
1384 mpTextRangeOverlay->HideSolidBorder();
1385 }
1386 }
1387 if ( mpShadow )
1388 {
1389 mpShadow->SetShadowState(SS_NORMAL);
1390 }
1391 break;
1392 }
1393 }
1394}
1395
1397{
1398 SwAnnotationWin* pTopNote = this;
1399 SwAnnotationWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : nullptr;
1400 while (pSidebarWin)
1401 {
1402 pTopNote = pSidebarWin;
1403 pSidebarWin = pSidebarWin->IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, pSidebarWin) : nullptr;
1404 }
1405 return pTopNote;
1406}
1407
1409{
1410 if ( mrMgr.GetActiveSidebarWin() == this )
1411 mrMgr.SetActiveSidebarWin(nullptr);
1412 GotoPos();
1413 sal_uInt32 aCount = MoveCaret();
1414 if (aCount)
1415 mrView.GetDocShell()->GetWrtShell()->SwCursorShell::Right(aCount, SwCursorSkipMode::Chars);
1417 collectUIInformation("LEAVE",get_id());
1418}
1419
1421 const Color& aChangeColor )
1422{
1423 if ( (mLayoutStatus != aLayoutStatus) ||
1424 (mChangeColor != aChangeColor) )
1425 {
1426 mLayoutStatus = aLayoutStatus;
1427 mChangeColor = aChangeColor;
1428 Invalidate();
1429 }
1430}
1431
1433{
1434 return static_cast<bool>(mxVScrollbar);
1435}
1436
1438{
1439 return HasScrollbar() && mxVScrollbar->get_vpolicy() == VclPolicyType::ALWAYS;
1440}
1441
1443{
1444#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1445 const bool bAnchorChanged = mpAnchorFrame != rSidebarItem.maLayoutInfo.mpAnchorFrame;
1446 if ( bAnchorChanged )
1447 {
1449 }
1450#endif
1451
1452 mrSidebarItem = rSidebarItem;
1454
1455#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1457 mxSidebarWinAccessible->ChangeSidebarItem( mrSidebarItem );
1458
1459 if ( bAnchorChanged )
1460 {
1463 *this );
1464 }
1465#endif
1466}
1467
1468css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAccessible()
1469{
1470#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1471 // This is rather dodgy code. Normally in CreateAccessible, if we want a custom
1472 // object, we return a custom object, but we do no override the default toolkit
1473 // window peer.
1477 mrSidebarItem );
1478#endif
1480}
1481
1482} // eof of namespace sw::sidebarwindows
1483
1484/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define POSTIT_MINIMUMSIZE_WITHOUT_META
#define METABUTTON_HEIGHT
#define METABUTTON_WIDTH
SlideSorterView & mrView
@ UndoArg1
Definition: SwRewriter.hxx:29
const StyleSettings & GetStyleSettings() const
static bool GetLayoutRTL()
static const AllSettings & GetSettings()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
sal_uInt8 GetBlue() const
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
bool IsValidAndGregorian() const
void DrawSymbol(const tools::Rectangle &rRect, SymbolType eType, const Color &rColor, DrawSymbolFlags nStyle=DrawSymbolFlags::NONE)
ESelection GetSelection() const
void SetSelection(const ESelection &rNewSel)
std::unique_ptr< weld::Builder > m_xBuilder
void UnclipVisibleSysObj()
std::unique_ptr< weld::Container > m_xContainer
OUString getDate(const Date &rDate) const
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
void SetOrigin(const Point &rOrigin)
const Fraction & GetScaleY() const
void SetSelection(const ESelection &)
void SetReadOnly(bool bReadOnly)
void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll)
void SetBackgroundColor(const Color &rColor)
ESelection GetSelection() const
void SetAttribs(const SfxItemSet &)
void StartSpeller(weld::Widget *pDialogParent)
EditView & GetEditView() const
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
void SetFont(const vcl::Font &rNewFont)
void DrawRect(const tools::Rectangle &rRect)
void SetLineColor()
void SetTextColor(const Color &rColor)
void SetFillColor()
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
void IntersectClipRegion(const tools::Rectangle &rRect)
void Update(sal_uInt16 nId)
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
void Invalidate(sal_uInt16 nId)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxItemPool & GetPool() const
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
SfxViewFrame & GetViewFrame() const
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
constexpr tools::Long Width() const
const vcl::Font & GetLabelFont() const
const LocaleDataWrapper & GetLocaleData() const
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:225
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
SwNodes & GetNodes()
Definition: doc.hxx:422
void SetCalcFieldValueHdl(Outliner *pOutliner)
In the Outliner, set a link to the method for field display in edit objects.
Definition: docdraw.cxx:540
bool IsRedlineOn() const
Definition: edredln.cxx:43
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:149
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:218
SwDoc & GetDoc()
Definition: node.hxx:233
const SwPosition * GetMark() const
Definition: pam.hxx:255
void SetParentId(const sal_uInt32 nParentId)
Definition: docufld.cxx:1854
sal_Int32 GetMinimumSizeWithMeta() const
Definition: PostItMgr.cxx:2278
SwPostItField * GetLatestPostItField()
Definition: PostItMgr.cxx:1815
static Color GetColorDark(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2167
bool ShowNotes() const
Definition: PostItMgr.cxx:2122
void RegisterAnswer(const OutlinerParaObject *pAnswer)
Definition: PostItMgr.hxx:258
static Color GetColorAnchor(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2197
void ConnectSidebarWinToFrame(const SwFrame &rFrame, const SwFormatField &rFormatField, sw::annotation::SwAnnotationWin &rSidebarWin)
Definition: PostItMgr.cxx:2436
static Color GetColorLight(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2182
void LayoutPostIts()
Definition: PostItMgr.cxx:708
void SetActiveSidebarWin(sw::annotation::SwAnnotationWin *p)
Definition: PostItMgr.cxx:2212
bool IsShowAnchor() const
Definition: PostItMgr.hxx:193
sw::annotation::SwAnnotationWin * GetNextPostIt(sal_uInt16 aDirection, sw::annotation::SwAnnotationWin *aPostIt)
Definition: PostItMgr.cxx:1820
void DisconnectSidebarWinFromFrame(const SwFrame &rFrame, sw::annotation::SwAnnotationWin &rSidebarWin)
Definition: PostItMgr.cxx:2453
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
Definition: PostItMgr.hxx:237
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2384
void AssureStdModeAtShell()
Definition: PostItMgr.cxx:2360
tools::Long GetNextBorder()
Definition: PostItMgr.cxx:1856
void UpdateResolvedStatus(const sw::annotation::SwAnnotationWin *topNote)
Definition: PostItMgr.cxx:2517
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
bool IsEmpty() const
Definition: swrect.hxx:304
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
OUString Apply(const OUString &rStr) const
Definition: SwRewriter.cxx:39
Represents the current text cursor of one opened edit window.
Definition: viscrs.hxx:140
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:939
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:1133
SwLayoutInfo maLayoutInfo
virtual const SwFormatField & GetFormatField() const =0
bool NewTableSelection()
Definition: swcrsr.cxx:2526
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
bool IsOnlineSpell() const
Definition: viewopt.hxx:539
bool IsFieldShadings() const
Definition: viewopt.hxx:838
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:364
void LockView(bool b)
Definition: viewsh.hxx:490
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:424
SwEditWin & GetEditWin()
Definition: view.hxx:426
SwDocShell * GetDocShell()
Definition: view.cxx:1180
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void ToggleInsMode()
Definition: wrtsh.hxx:171
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
reference_type * get() const
void SetPosSizePixelRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const SwRect &aAnchorRect, const tools::Long PageBorder)
SwPostItHelper::SwLayoutStatus mLayoutStatus
void SwitchToPostIt(sal_uInt16 aDirection)
void PaintTile(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
sw::sidebarwindows::SidebarPosition meSidebarPosition
std::unique_ptr< sw::overlay::OverlayRanges > mpTextRangeOverlay
std::unique_ptr< weld::Label > mxMetadataResolved
std::unique_ptr< Outliner > mpOutliner
::sw::sidebarwindows::AnchorOverlayObject * Anchor()
SwAnnotationWin * GetTopReplyNote()
Find the first annotation for the thread which this annotation is in.
virtual void GetFocus() override
void SetColor(Color aColorDark, Color aColorLight, Color aColorAnchor)
void SetSizePixel(const Size &rNewSize) override
void DrawForPage(OutputDevice *pDev, const Point &rPos)
std::unique_ptr< sw::sidebarwindows::AnchorOverlayObject > mpAnchor
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
std::unique_ptr< OutlinerView > mpOutlinerView
void SetVirtualPosSize(const Point &aPoint, const Size &aSize)
std::unique_ptr< weld::CustomWeld > mxSidebarTextControlWin
void TranslateTopPosition(const tools::Long aAmount)
bool IsHitWindow(const Point &rPointLogic)
Is there a matching sub-widget inside this sidebar widget for rPointLogic?
sal_Int32 GetMinimumSizeWithoutMeta() const
void SetCursorLogicPosition(const Point &rPosition, bool bPoint, bool bClearMark)
Allows adjusting the point or mark of the selection to a document coordinate.
void SetLanguage(const SvxLanguageItem &rNewItem)
sal_Int32 GetMinimumSizeWithMeta() const
std::unique_ptr< weld::MenuButton > mxMenuButton
rtl::Reference< sw::sidebarwindows::SidebarWinAccessible > mxSidebarWinAccessible
void SetViewState(::sw::sidebarwindows::ViewState bViewState)
std::vector< basegfx::B2DRange > maAnnotationTextRanges
void SetChangeTracking(const SwPostItHelper::SwLayoutStatus aStatus, const Color &aColor)
std::unique_ptr< sw::sidebarwindows::ShadowOverlayObject > mpShadow
void ShowAnchorOnly(const Point &aPoint)
void SetSize(const Size &rNewSize)
std::unique_ptr< weld::ScrolledWindow > mxVScrollbar
void ExecuteCommand(sal_uInt16 nSlot)
SvxLanguageItem GetLanguage() const
::sw::overlay::OverlayRanges * TextRange()
std::unique_ptr< weld::Label > mxMetadataDate
std::unique_ptr< sw::sidebarwindows::SidebarTextControl > mxSidebarTextControl
std::unique_ptr< weld::Label > mxMetadataAuthor
void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition)
void ChangeSidebarItem(SwSidebarItem const &rSidebarItem)
virtual void LoseFocus() override
void ResizeIfNecessary(tools::Long aOldHeight, tools::Long aNewHeight)
static std::unique_ptr< OverlayRanges > CreateOverlayRange(SwView const &rDocView, const Color &rColor, std::vector< basegfx::B2DRange > &&rRanges, const bool bShowSolidBorder)
void SetAnchorState(const AnchorState aState)
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr tools::Long Top() const
void SetSize(const Size &)
constexpr Point TopLeft() const
constexpr Size GetSize() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr tools::Long GetHeight() const
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
tools::Long GetFontHeight() const
void SetFontHeight(tools::Long nHeight)
void SetStyle(WinBits nStyle)
vcl::Window * GetParent() const
bool HasChildPathFocus(bool bSystemWindow=false) const
Point LogicToPixel(const Point &rLogicPt) const
const OUString & get_id() const
virtual void SetSizePixel(const Size &rNewSize)
Size get_preferred_size() const
void GrabFocus()
virtual Point GetPosPixel() const
void SetMapMode()
bool IsMapModeEnabled() const
void GrabFocusToDocument()
WinBits GetStyle() const
const MapMode & GetMapMode() const
const Color & GetTextColor() const
Point PixelToLogic(const Point &rDevicePt) const
virtual Size GetSizePixel() const
bool IsVisible() const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual void SetPosPixel(const Point &rNewPos)
void EnableMapMode(bool bEnable=true)
#define FN_RESOLVE_NOTE
Definition: cmdid.h:795
#define FN_REPLY
Definition: cmdid.h:793
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:786
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:789
#define FN_POSTIT
Definition: cmdid.h:233
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:790
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:787
#define FN_DELETE_COMMENT
Definition: cmdid.h:792
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:797
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:796
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:794
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
float y
float x
ESelection aNewSelection(GetSelection())
#define EE_TEXTPOS_ALL
EEControlBits
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
std::deque< AttacherIndex_Impl > aIndex
constexpr sal_uInt16 KEY_PAGEUP
void setTiledPainting(bool bTiledPainting)
std::unique_ptr< BaseProcessor2D > createProcessor2DFromOutputDevice(OutputDevice &rTargetOutDev, const drawinglayer::geometry::ViewInformation2D &rViewInformation2D)
int i
IMPL_LINK(SwAnnotationWin, SelectHdl, const OUString &, rIdent, void)
IMPL_LINK_NOARG(SwAnnotationWin, ToggleHdl, weld::Toggleable &, void)
static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color &aFront, const Color &aBack)
unsigned long ULong
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
#define Y
sal_Int32 nStartPara
sal_Int32 nEndPos
sal_Int32 nStartPos
sal_Int32 nEndPara
std::map< OUString, OUString > aParameters
sal_Int32 mnStartContent
SwNodeOffset mnStartNodeIdx
const SwFrame * mpAnchorFrame
bool mPositionFromCommentAnchor
If true, the overlay arrow points to the comment anchor, otherwise it points to the commented frame.
Marks a position in the document model.
Definition: pam.hxx:38
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:256
std::vector< SwRect > SwRects
Definition: swregion.hxx:26
css::drawing::Direction3D aDirection
unsigned char sal_uInt8
WinBits const WB_DIALOGCONTROL