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 <swmodule.hxx>
71
72#include <SwRewriter.hxx>
73#include <txtannotationfld.hxx>
74#include <ndtxt.hxx>
75
78#include <osl/diagnose.h>
81#include <memory>
82#include <comphelper/lok.hxx>
83
84using namespace sw::sidebarwindows;
85
86namespace
87{
88
89void collectUIInformation( const OUString& aevent , const OUString& aID )
90{
91 EventDescription aDescription;
92 aDescription.aID = aID;
93 aDescription.aParameters = {{"" , ""}};
94 aDescription.aAction = aevent;
95 aDescription.aParent = "MainWindow";
96 aDescription.aKeyWord = "SwEditWinUIObject";
97 UITestLogger::getInstance().logEvent(aDescription);
98}
99
100}
101
102namespace sw::annotation {
103
104#define METABUTTON_WIDTH 16
105#define METABUTTON_HEIGHT 18
106#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
107
109{
110 bool bMenuButtonVisible = mxMenuButton->get_visible();
111 // No point in showing this button till click on it are not handled.
112 if (bMenuButtonVisible)
113 mxMenuButton->hide();
114
115 // draw left over space
116 if (Application::GetSettings().GetStyleSettings().GetHighContrastMode())
117 rRenderContext.SetFillColor(COL_BLACK);
118 else
119 rRenderContext.SetFillColor(mColorDark);
120 rRenderContext.SetLineColor();
121 rRenderContext.DrawRect(rRect);
122
123 m_xContainer->draw(rRenderContext, rRect.TopLeft(), GetSizePixel());
124
125 const drawinglayer::geometry::ViewInformation2D aViewInformation;
126 std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation));
127
128 // drawinglayer sets the map mode to pixels, not needed here.
129 rRenderContext.Pop();
130 // Work in document-global twips.
131 rRenderContext.Pop();
132 if (mpAnchor)
133 pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence());
135 pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
136
137 rRenderContext.Push(vcl::PushFlags::NONE);
138 pProcessor.reset();
139 rRenderContext.Push(vcl::PushFlags::NONE);
140
141 if (bMenuButtonVisible)
142 mxMenuButton->show();
143}
144
145bool SwAnnotationWin::IsHitWindow(const Point& rPointLogic)
146{
148 return aRectangleLogic.Contains(rPointLogic);
149}
150
151void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
152{
153 mxSidebarTextControl->SetCursorLogicPosition(rPosition, bPoint, bClearMark);
154}
155
156void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt)
157{
158 // tdf#143511 unclip SysObj so get_extents_relative_to of children
159 // of the SysObj can provide meaningful results
161
162 pDev->Push();
163
165 pDev->SetLineColor();
166
168 vcl::Font aFont = maLabelFont;
169 aFont.SetFontHeight(aFont.GetFontHeight() * 20);
170 pDev->SetFont(aFont);
171
173
174 pDev->DrawRect(tools::Rectangle(rPt, aSz));
175
176 if (mxMetadataAuthor->get_visible())
177 {
178 int x, y, width, height;
179 mxMetadataAuthor->get_extents_relative_to(*m_xContainer, x, y, width, height);
180 Point aPos(rPt + PixelToLogic(Point(x, y)));
181 Size aSize(PixelToLogic(Size(width, height)));
182
184 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
185 pDev->DrawText(aPos, mxMetadataAuthor->get_label());
186 pDev->Pop();
187 }
188
189 if (mxMetadataDate->get_visible())
190 {
191 int x, y, width, height;
192 mxMetadataDate->get_extents_relative_to(*m_xContainer, x, y, width, height);
193 Point aPos(rPt + PixelToLogic(Point(x, y)));
194 Size aSize(PixelToLogic(Size(width, height)));
195
197 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
198 pDev->DrawText(aPos, mxMetadataDate->get_label());
199 pDev->Pop();
200 }
201
202 if (mxMetadataResolved->get_visible())
203 {
204 int x, y, width, height;
205 mxMetadataResolved->get_extents_relative_to(*m_xContainer, x, y, width, height);
206 Point aPos(rPt + PixelToLogic(Point(x, y)));
207 Size aSize(PixelToLogic(Size(width, height)));
208
210 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
211 pDev->DrawText(aPos, mxMetadataResolved->get_label());
212 pDev->Pop();
213 }
214
215 mxSidebarTextControl->DrawForPage(pDev, rPt);
216
218 std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
220 *pDev, aNewViewInfos ));
221
222 if (mpAnchor)
223 pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence());
225 pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
226 pProcessor.reset();
227
228 if (mxVScrollbar->get_vpolicy() != VclPolicyType::NEVER)
229 {
230 // if there is a scrollbar shown, draw "..." to indicate the comment isn't
231 // completely shown
232 int x, y, width, height;
233 mxMenuButton->get_extents_relative_to(*m_xContainer, x, y, width, height);
234 Point aPos(rPt + PixelToLogic(Point(x, y)));
235 pDev->DrawText(aPos, "...");
236 }
237
238 pDev->Pop();
239}
240
242 const SwRect& aAnchorRect, const tools::Long aPageBorder)
243{
244 mPosSize = tools::Rectangle(Point(nX,nY),Size(nWidth,nHeight));
245 if (!mAnchorRect.IsEmpty() && mAnchorRect != aAnchorRect)
246 mbAnchorRectChanged = true;
247 mAnchorRect = aAnchorRect;
248 mPageBorder = aPageBorder;
249}
250
251void SwAnnotationWin::SetSize( const Size& rNewSize )
252{
253 mPosSize.SetSize(rNewSize);
254}
255
256void SwAnnotationWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
257{
258 mPosSize = tools::Rectangle(aPoint,aSize);
259}
260
262{
263 mPosSize.Move(0,aAmount);
264}
265
266void SwAnnotationWin::ShowAnchorOnly(const Point &aPoint)
267{
268 HideNote();
270 if (mpAnchor)
271 {
272 mpAnchor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
273 mpAnchor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
274 mpAnchor->SetAnchorState(AnchorState::All);
275 mpAnchor->setVisible(true);
276 }
277 if (mpShadow)
278 mpShadow->setVisible(false);
279}
280
282{
283 SfxItemSet aItem( mrView.GetDocShell()->GetPool() );
285 return aItem;
286}
287
289{
290 // window controls for author and date
291 mxMetadataAuthor = m_xBuilder->weld_label("author");
292 mxMetadataAuthor->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
294
297
298 // we should leave this setting alone, but for this we need a better layout algo
299 // with variable meta size height
300 mxMetadataAuthor->set_font(maLabelFont);
301
302 mxMetadataDate = m_xBuilder->weld_label("date");
303 mxMetadataDate->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_DATE_NAME ) );
305 mxMetadataDate->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
306
307 // we should leave this setting alone, but for this we need a better layout algo
308 // with variable meta size height
309 mxMetadataDate->set_font(maLabelFont);
310
311 mxMetadataResolved = m_xBuilder->weld_label("resolved");
312 mxMetadataResolved->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
314 mxMetadataResolved->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
315
316 // we should leave this setting alone, but for this we need a better layout algo
317 // with variable meta size height
319 mxMetadataResolved->set_label(SwResId(STR_ACCESS_ANNOTATION_RESOLVED_NAME));
320
321 SwDocShell* aShell = mrView.GetDocShell();
322 mpOutliner.reset(new Outliner(&aShell->GetPool(),OutlinerMode::TextObject));
323 aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner.get() );
324 mpOutliner->SetUpdateLayout( true );
325
326 mpOutlinerView.reset(new OutlinerView(mpOutliner.get(), nullptr));
327 mpOutliner->InsertView(mpOutlinerView.get());
328
329 //create Scrollbars
330 mxVScrollbar = m_xBuilder->weld_scrolled_window("scrolledwindow", true);
331
332 mxMenuButton = m_xBuilder->weld_menu_button("menubutton");
334
335 // actual window which holds the user text
338 mxSidebarTextControl->SetPointer(PointerStyle::Text);
339
340 Rescale();
341
342 mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
343 mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );
344
345 mpOutlinerView->SetAttribs(DefaultItem());
346
347 mxVScrollbar->set_direction(false);
348 mxVScrollbar->connect_vadjustment_changed(LINK(this, SwAnnotationWin, ScrollHdl));
349 mxVScrollbar->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
350
352 EEControlBits nCntrl = mpOutliner->GetControlWord();
353 // TODO: crash when AUTOCOMPLETE enabled
354 nCntrl |= EEControlBits::MARKFIELDS | EEControlBits::PASTESPECIAL | EEControlBits::AUTOCORRECT | EEControlBits::USECHARATTRIBS; // | EEControlBits::AUTOCOMPLETE;
356 nCntrl |= EEControlBits::MARKFIELDS;
357 else
358 nCntrl &= ~EEControlBits::MARKFIELDS;
359 if (pVOpt->IsOnlineSpell())
360 nCntrl |= EEControlBits::ONLINESPELLING;
361 else
362 nCntrl &= ~EEControlBits::ONLINESPELLING;
363 mpOutliner->SetControlWord(nCntrl);
364
365 std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
369
371
372 // expand %1 "Author"
373 OUString aText = mxMenuButton->get_item_label("deleteby");
374 SwRewriter aRewriter;
375 aRewriter.AddRule(UndoArg1, GetAuthor());
376 aText = aRewriter.Apply(aText);
377 mxMenuButton->set_item_label("deleteby", aText);
378
379 mxMenuButton->set_accessible_name(SwResId(STR_ACCESS_ANNOTATION_BUTTON_NAME));
380 mxMenuButton->set_accessible_description(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
381 mxMenuButton->set_tooltip_text(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
382
383 mxMenuButton->connect_toggled(LINK(this, SwAnnotationWin, ToggleHdl));
384 mxMenuButton->connect_selected(LINK(this, SwAnnotationWin, SelectHdl));
385 mxMenuButton->connect_key_press(LINK(this, SwAnnotationWin, KeyInputHdl));
386 mxMenuButton->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
387
391 mpOutliner->CompleteOnlineSpelling();
392
393 mxSidebarTextControl->Show();
394 mxMetadataAuthor->show();
395 mxMetadataDate->show();
396 mxMetadataResolved->set_visible(IsResolved());
397 mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
398}
399
401{
402 const SvtSysLocale aSysLocale;
403 const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
404 OUString sMeta = GetAuthor();
405 if (sMeta.isEmpty())
406 {
407 sMeta = SwResId(STR_NOAUTHOR);
408 }
409 else if (sMeta.getLength() > 23)
410 {
411 sMeta = OUString::Concat(sMeta.subView(0, 20)) + "...";
412 }
413 if ( mxMetadataAuthor->get_label() != sMeta )
414 {
415 mxMetadataAuthor->set_label(sMeta);
416 }
417
418 Date aDate = GetDate();
419 if (aDate.IsValidAndGregorian() )
420 {
421 sMeta = rLocalData.getDate(aDate);
422 }
423 else
424 {
425 sMeta = SwResId(STR_NODATE);
426 }
427 if (GetTime().GetTime()!=0)
428 {
429 sMeta += " " + rLocalData.getTime( GetTime(),false );
430 }
431 if ( mxMetadataDate->get_label() != sMeta )
432 {
433 mxMetadataDate->set_label(sMeta);
434 }
435
436 std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
440}
441
442static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack)
443{
444 return Color(sal_uInt8(aFront.GetRed() * aTransparency / 255.0 + aBack.GetRed() * (1 - aTransparency / 255.0)),
445 sal_uInt8(aFront.GetGreen() * aTransparency / 255.0 + aBack.GetGreen() * (1 - aTransparency / 255.0)),
446 sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0)));
447}
448
450{
451 if (!mxMenuButton)
452 return;
453
454 mxMenuButton->set_background(mColorDark);
455
456 const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY();
457
459 Size aSize(tools::Long(METABUTTON_WIDTH * rFraction),
460 tools::Long(METABUTTON_HEIGHT * rFraction));
461 tools::Rectangle aRect(Point(0, 0), aSize);
462 xVirDev->SetOutputSizePixel(aSize);
463
464 Gradient aGradient(GradientStyle::Linear,
467 xVirDev->DrawGradient(aRect, aGradient);
468
469 //draw rect around button
470 xVirDev->SetFillColor();
471 xVirDev->SetLineColor(ColorFromAlphaColor(90, mColorAnchor, mColorDark));
472 xVirDev->DrawRect(aRect);
473
474 tools::Rectangle aSymbolRect(aRect);
475 // 25% distance to the left and right button border
476 const tools::Long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth() * 250) + 500) / 1000;
477 aSymbolRect.AdjustLeft(nBorderDistanceLeftAndRight );
478 aSymbolRect.AdjustRight( -nBorderDistanceLeftAndRight );
479 // 40% distance to the top button border
480 const tools::Long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 400) + 500) / 1000;
481 aSymbolRect.AdjustTop(nBorderDistanceTop );
482 // 15% distance to the bottom button border
483 const tools::Long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 150) + 500) / 1000;
484 aSymbolRect.AdjustBottom( -nBorderDistanceBottom );
485 DecorationView aDecoView(xVirDev.get());
486 aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, GetTextColor(),
487 DrawSymbolFlags::NONE);
488 mxMenuButton->set_image(xVirDev);
489 mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height() + 4);
490}
491
493{
494 // On Android, this method leads to invoke ImpEditEngine::UpdateViews
495 // which hides the text cursor. Moreover it causes sudden document scroll
496 // when modifying a commented text. Not clear the root cause,
497 // anyway skipping this method fixes the problem, and there should be
498 // no side effect, since the client has disabled annotations rendering.
500 return;
501
502 MapMode aMode = GetParent()->GetMapMode();
503 aMode.SetOrigin( Point() );
504 SetMapMode( aMode );
505 mxSidebarTextControl->SetMapMode( aMode );
506 const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY();
507
508 vcl::Font aFont = maLabelFont;
509 sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
510 aFont.SetFontHeight( nHeight );
511
513 mxMetadataAuthor->set_font(aFont);
514 if (mxMetadataDate)
515 mxMetadataDate->set_font(aFont);
517 mxMetadataResolved->set_font(aFont);
519 if (mxVScrollbar)
520 mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
521}
522
524{
525 bool bChange = false;
526
527 if (GetSizePixel() != mPosSize.GetSize())
528 {
529 bChange = true;
531
532 DoResize();
533 }
534
535 if (GetPosPixel().X() != mPosSize.Left() || (std::abs(GetPosPixel().Y() - mPosSize.Top()) > 5) )
536 {
537 bChange = true;
539
540 Point aLineStart;
541 Point aLineEnd ;
542 switch ( meSidebarPosition )
543 {
545 {
546 aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
547 aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
548 }
549 break;
551 {
552 aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
553 aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
554 }
555 break;
556 default:
557 OSL_FAIL( "<SwAnnotationWin::SetPosAndSize()> - unexpected position of sidebar" );
558 break;
559 }
560
561 // LOK has map mode disabled, and we still want to perform pixel ->
562 // twips conversion for the size of the line above the note.
564 {
566 Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY());
567 aSize = EditWin().PixelToLogic(aSize);
568 aLineEnd = aLineStart;
569 aLineEnd.Move(aSize.getWidth(), aSize.getHeight());
570 EditWin().EnableMapMode(false);
571 }
572
573 if (mpAnchor)
574 {
575 mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
580 basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
581 basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
582 }
583 else
584 {
585 mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView,
588 aLineStart,
589 aLineEnd,
590 mColorAnchor );
591 if ( mpAnchor )
592 {
593 mpAnchor->setVisible(true);
594 mpAnchor->SetAnchorState(AnchorState::Tri);
595 if (HasChildPathFocus())
596 {
597 mpAnchor->setLineSolid(true);
598 }
599 }
600 }
601 }
602 else
603 {
604 if ( mpAnchor &&
605 ( mpAnchor->getBasePosition() != basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom()-5*15) ) )
606 {
607 mpAnchor->SetTriPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
612 }
613 }
614
615 if (mpShadow && bChange)
616 {
619 mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
620 }
621
622 if (mrMgr.ShowNotes())
623 {
624 if (IsFollow() && !HasChildPathFocus())
625 {
626 // #i111964#
627 if ( mpAnchor )
628 {
629 mpAnchor->SetAnchorState(AnchorState::End);
630 }
631 }
632 else
633 {
634 // #i111964#
635 if ( mpAnchor )
636 {
637 mpAnchor->SetAnchorState(AnchorState::All);
638 }
640 // #i111964#
641 if ( pWin != this && pWin->Anchor() )
642 {
643 pWin->Anchor()->SetAnchorState(AnchorState::End);
644 }
645 }
646 }
647
648
649 // text range overlay
653 {
654 const SwTextAnnotationField* pTextAnnotationField =
656 SwTextNode* pTextNode = pTextAnnotationField ? pTextAnnotationField->GetpTextNode() : nullptr;
657 SwContentNode* pContentNd = nullptr;
658 if (pTextNode)
659 {
660 SwNodes& rNds = pTextNode->GetDoc().GetNodes();
661 pContentNd = rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetContentNode();
662 }
663 if (pContentNd)
664 {
665 SwPosition aStartPos( *pContentNd, mrSidebarItem.maLayoutInfo.mnStartContent );
666 SwShellCursor* pTmpCursor = nullptr;
667 const bool bTableCursorNeeded = pTextNode->FindTableBoxStartNode() != pContentNd->FindTableBoxStartNode();
668 if ( bTableCursorNeeded )
669 {
670 SwShellTableCursor* pTableCursor = new SwShellTableCursor( mrView.GetWrtShell(), aStartPos );
671 pTableCursor->SetMark();
672 pTableCursor->GetMark()->Assign( *pTextNode, pTextAnnotationField->GetStart()+1 );
673 pTableCursor->NewTableSelection();
674 pTmpCursor = pTableCursor;
675 }
676 else
677 {
678 SwShellCursor* pCursor = new SwShellCursor( mrView.GetWrtShell(), aStartPos );
679 pCursor->SetMark();
680 pCursor->GetMark()->Assign(*pTextNode, pTextAnnotationField->GetStart()+1 );
681 pTmpCursor = pCursor;
682 }
683 std::unique_ptr<SwShellCursor> pTmpCursorForAnnotationTextRange( pTmpCursor );
684
685 // For annotation text range rectangles to be calculated correctly,
686 // we need the map mode disabled
687 bool bDisableMapMode = comphelper::LibreOfficeKit::isActive() && EditWin().IsMapModeEnabled();
688 if (bDisableMapMode)
689 EditWin().EnableMapMode(false);
690
692 pTmpCursorForAnnotationTextRange->FillRects();
693
694 if (bDisableMapMode)
696
697 SwRects* pRects(pTmpCursorForAnnotationTextRange.get());
698 for(const SwRect & rNextRect : *pRects)
699 {
700 const tools::Rectangle aPntRect(rNextRect.SVRect());
701 maAnnotationTextRanges.emplace_back(
702 aPntRect.Left(), aPntRect.Top(),
703 aPntRect.Right() + 1, aPntRect.Bottom() + 1);
704 }
705 }
706 }
707
708 if (mrMgr.ShowNotes() && !maAnnotationTextRanges.empty())
709 {
710 if ( mpTextRangeOverlay != nullptr )
711 {
712 mpTextRangeOverlay->setRanges( std::vector(maAnnotationTextRanges) );
713 if ( mpAnchor != nullptr && mpAnchor->getLineSolid() )
714 {
715 mpTextRangeOverlay->ShowSolidBorder();
716 }
717 else
718 {
719 mpTextRangeOverlay->HideSolidBorder();
720 }
721 }
722 else if (!IsFollow())
723 {
724 // This window is not a reply, then draw its range overlay.
727 mrView,
729 std::vector(maAnnotationTextRanges),
730 mpAnchor && mpAnchor->getLineSolid() );
731 }
732 }
733 else
734 {
735 mpTextRangeOverlay.reset();
736 }
737}
738
740{
741 tools::Long aHeight = GetSizePixel().Height();
742 tools::ULong aWidth = GetSizePixel().Width();
743
744 aHeight -= GetMetaHeight();
745
746 mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth, aHeight) ) ) ;
747 tools::Long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
748
749 mxMetadataAuthor->show();
750 if(IsResolved()) { mxMetadataResolved->show(); }
751 mxMetadataDate->show();
752
753 if (aTextHeight > aHeight)
754 {
755 const int nThickness = mxVScrollbar->get_scroll_thickness();
756 if (nThickness)
757 {
758 // we need vertical scrollbars and have to reduce the width
759 aWidth -= nThickness;
760 mpOutliner->SetPaperSize(PixelToLogic(Size(aWidth, aHeight)));
761 }
762 mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
763 }
764 else
765 {
766 mxVScrollbar->set_vpolicy(VclPolicyType::NEVER);
767 }
768
769 tools::Rectangle aOutputArea = PixelToLogic(tools::Rectangle(0, 0, aWidth, aHeight));
770 if (mxVScrollbar->get_vpolicy() == VclPolicyType::NEVER)
771 {
772 // if we do not have a scrollbar anymore, we want to see the complete text
773 mpOutlinerView->SetVisArea(aOutputArea);
774 }
775 mpOutlinerView->SetOutputArea(aOutputArea);
776 mpOutlinerView->ShowCursor(true, true);
777
778 // Don't leave an empty area at the bottom if we can move the text down.
779 tools::Long nMaxVisAreaTop = mpOutliner->GetTextHeight() - aOutputArea.GetHeight();
780 if (mpOutlinerView->GetVisArea().Top() > nMaxVisAreaTop)
781 {
782 GetOutlinerView()->Scroll(0, mpOutlinerView->GetVisArea().Top() - nMaxVisAreaTop);
783 }
784
785 int nUpper = mpOutliner->GetTextHeight();
786 int nCurrentDocPos = mpOutlinerView->GetVisArea().Top();
787 int nStepIncrement = mpOutliner->GetTextHeight() / 10;
788 int nPageIncrement = PixelToLogic(Size(0,aHeight)).Height() * 8 / 10;
789 int nPageSize = PixelToLogic(Size(0,aHeight)).Height();
790
791 /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
792 effectively...
793
794 lower = gtk_adjustment_get_lower
795 upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
796
797 and requires that upper > lower or the deceleration animation never ends
798 */
799 nPageSize = std::min(nPageSize, nUpper);
800
801 mxVScrollbar->vadjustment_configure(nCurrentDocPos, 0, nUpper,
802 nStepIncrement, nPageIncrement, nPageSize);
803}
804
805void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
806{
808 return;
809
811
812 if (mpShadow)
813 {
816 mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
817 }
818}
819
821{
822 mxVScrollbar->vadjustment_set_value(mpOutlinerView->GetVisArea().Top());
823}
824
826{
827 if (aOldHeight != aNewHeight)
828 {
829 //check for lower border or next note
830 tools::Long aBorder = mrMgr.GetNextBorder();
831 if (aBorder != -1)
832 {
833 if (aNewHeight > GetMinimumSizeWithoutMeta())
834 {
835 tools::Long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
836 if (aNewLowerValue < aBorder)
838 else
839 SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
840 DoResize();
841 Invalidate();
842 }
843 else
844 {
847 DoResize();
848 Invalidate();
849 }
850 }
851 else
852 {
853 DoResize();
854 Invalidate();
855 }
856 }
857 else
858 {
859 SetScrollbar();
860 }
861}
862
863void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
864{
865 mColorDark = aColorDark;
866 mColorLight = aColorLight;
867 mColorAnchor = aColorAnchor;
868
869 if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
870 return;
871
872 m_xContainer->set_background(mColorDark);
874
875 mxMetadataAuthor->set_font_color(aColorAnchor);
876
877 mxMetadataDate->set_font_color(aColorAnchor);
878
879 mxMetadataResolved->set_font_color(aColorAnchor);
880
881 mxVScrollbar->customize_scrollbars(mColorLight,
883 mColorDark);
884}
885
887{
888 meSidebarPosition = eSidebarPosition;
889}
890
892{
893 mbReadonly = bSet;
895}
896
898{
899 IDocumentUndoRedo& rUndoRedo(
901 const bool bDocUndoEnabled = rUndoRedo.DoesUndo();
902 const bool bOutlinerUndoEnabled = mpOutliner->IsUndoEnabled();
903 const bool bOutlinerModified = mpOutliner->IsModified();
904 const bool bDisableAndRestoreUndoMode = !bDocUndoEnabled && bOutlinerUndoEnabled;
905
906 if (bDisableAndRestoreUndoMode)
907 {
908 // doc undo is disabled, but outliner was enabled, turn outliner undo off
909 // for the duration of this function
910 mpOutliner->EnableUndo(false);
911 }
912
913 Link<LinkParamNone*,void> aLink = mpOutliner->GetModifyHdl();
914 mpOutliner->SetModifyHdl( Link<LinkParamNone*,void>() );
916
917 ESelection aNewSelection( 0, 0, mpOutliner->GetParagraphCount()-1, EE_TEXTPOS_ALL );
919 SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs());
920 aEditAttr.Put(rNewItem);
921 GetOutlinerView()->SetAttribs( aEditAttr );
922
923 if (!mpOutliner->IsUndoEnabled() && !bOutlinerModified)
924 {
925 // if undo was disabled (e.g. this is a redo action) and we were
926 // originally 'unmodified' keep it that way
927 mpOutliner->ClearModifyFlag();
928 }
929
931 mpOutliner->SetModifyHdl( aLink );
932
934 EEControlBits nCntrl = mpOutliner->GetControlWord();
935 // turn off
936 nCntrl &= ~EEControlBits::ONLINESPELLING;
937 mpOutliner->SetControlWord(nCntrl);
938
939 //turn back on
940 if (pVOpt->IsOnlineSpell())
941 nCntrl |= EEControlBits::ONLINESPELLING;
942 else
943 nCntrl &= ~EEControlBits::ONLINESPELLING;
944 mpOutliner->SetControlWord(nCntrl);
945
946 mpOutliner->CompleteOnlineSpelling();
947
948 // restore original mode
949 if (bDisableAndRestoreUndoMode)
950 mpOutliner->EnableUndo(true);
951
952 Invalidate();
953}
954
956{
958 mxSidebarTextControl->GrabFocus();
959}
960
962{
963}
964
966{
968 if (!IsVisible())
969 Window::Show();
970 if (mpShadow && !mpShadow->isVisible())
971 mpShadow->setVisible(true);
972 if (mpAnchor && !mpAnchor->isVisible())
973 mpAnchor->setVisible(true);
974 if (mpTextRangeOverlay && !mpTextRangeOverlay->isVisible())
975 mpTextRangeOverlay->setVisible(true);
976
977 collectUIInformation("SHOW",get_id());
978}
979
981{
982 if (IsVisible())
983 Window::Hide();
984 if (mpAnchor)
985 {
986 if (mrMgr.IsShowAnchor())
987 mpAnchor->SetAnchorState(AnchorState::Tri);
988 else
989 mpAnchor->setVisible(false);
990 }
991 if (mpShadow && mpShadow->isVisible())
992 mpShadow->setVisible(false);
993 if (mpTextRangeOverlay && mpTextRangeOverlay->isVisible())
994 mpTextRangeOverlay->setVisible(false);
995 collectUIInformation("HIDE",get_id());
996}
997
999{
1001
1002 mpOutliner->ClearModifyFlag();
1003 mpOutliner->GetUndoManager().Clear();
1004
1005 CheckMetaText();
1006 SetViewState(ViewState::EDIT);
1007
1008 // prevent autoscroll to the old cursor location
1009 // when cursor out of visible area
1010 GetOutlinerView()->ShowCursor(false);
1011
1012 mpOutlinerView->GetEditView().SetInsertMode(mrView.GetWrtShellPtr()->IsInsMode());
1013
1014 if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1016
1017 //tdf#119130 only have the active postit as a dialog control in which pressing
1018 //ctrl+tab cycles between text and button so we don't waste time searching
1019 //thousands of SwAnnotationWins
1021}
1022
1024{
1025 //tdf#119130 only have the active postit as a dialog control in which pressing
1026 //ctrl+tab cycles between text and button so we don't waste time searching
1027 //thousands of SwAnnotationWins
1029
1030 // remove selection, #i87073#
1031 if (GetOutlinerView()->GetEditView().HasSelection())
1032 {
1034 aSelection.nEndPara = aSelection.nStartPara;
1035 aSelection.nEndPos = aSelection.nStartPos;
1036 GetOutlinerView()->GetEditView().SetSelection(aSelection);
1037 }
1038
1039 mpOutliner->CompleteOnlineSpelling();
1040
1041 SetViewState(ViewState::NORMAL);
1042 // Make sure this view doesn't emit LOK callbacks during the update, as the
1043 // sidebar window's SidebarTextControl doesn't have a valid twip offset
1044 // (map mode origin) during that operation.
1045 bool bTiledPainting = comphelper::LibreOfficeKit::isTiledPainting();
1047 // write the visible text back into the SwField
1048 UpdateData();
1050
1051 if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1053
1054 if (!mnDeleteEventId && !IsProtected() && mpOutliner->GetEditEngine().GetText().isEmpty())
1055 {
1056 mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1057 }
1058}
1059
1061{
1063 {
1064 //change outliner
1065 mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
1066 //change document
1068 //update statusbar
1070 rBnd.Invalidate(SID_ATTR_INSERT);
1071 rBnd.Update(SID_ATTR_INSERT);
1072 }
1073}
1074
1076{
1078
1079 switch (nSlot)
1080 {
1081 case FN_POSTIT:
1082 case FN_REPLY:
1083 {
1084 // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
1085 // will be created
1086 if (!mpOutliner->GetEditEngine().GetText().isEmpty())
1087 {
1088 OutlinerParaObject aPara(GetOutlinerView()->GetEditView().CreateTextObject());
1089 mrMgr.RegisterAnswer(&aPara);
1090 }
1092 mrMgr.SetActiveSidebarWin(nullptr);
1095 break;
1096 }
1097 case FN_DELETE_COMMENT:
1098 //Delete(); // do not kill the parent of our open popup menu
1099 mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1100 break;
1102 DeleteThread();
1103 break;
1104 case FN_RESOLVE_NOTE:
1106 DoResize();
1107 Invalidate();
1109 break;
1113 DoResize();
1114 Invalidate();
1116 break;
1119 case FN_HIDE_ALL_NOTES:
1120 // not possible as slot as this would require that "this" is the active postit
1121 mrView.GetViewFrame()->GetBindings().Execute( nSlot, nullptr, SfxCallMode::ASYNCHRON );
1122 break;
1125 {
1126 // not possible as slot as this would require that "this" is the active postit
1127 SfxStringItem aItem( nSlot, GetAuthor() );
1128 const SfxPoolItem* aItems[2];
1129 aItems[0] = &aItem;
1130 aItems[1] = nullptr;
1131 mrView.GetViewFrame()->GetBindings().Execute( nSlot, aItems, SfxCallMode::ASYNCHRON );
1132 }
1133 break;
1134 default:
1135 mrView.GetViewFrame()->GetBindings().Execute( nSlot );
1136 break;
1137 }
1138}
1139
1141{
1142 return mrView.GetEditWin();
1143}
1144
1146{
1147 return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
1148}
1149
1150void SwAnnotationWin::SwitchToPostIt(sal_uInt16 aDirection)
1151{
1153 if (pPostIt)
1154 pPostIt->GrabFocus();
1155}
1156
1157IMPL_LINK(SwAnnotationWin, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
1158{
1159 if (rMEvt.IsEnterWindow())
1160 {
1161 mbMouseOver = true;
1162 if ( !HasFocus() )
1163 {
1164 SetViewState(ViewState::VIEW);
1165 Invalidate();
1166 }
1167 }
1168 else if (rMEvt.IsLeaveWindow())
1169 {
1170 mbMouseOver = false;
1171 if ( !HasFocus() )
1172 {
1173 SetViewState(ViewState::NORMAL);
1174 Invalidate();
1175 }
1176 }
1177 return false;
1178}
1179
1181{
1182 if (mrMgr.GetActiveSidebarWin() == this)
1183 return false;
1184 mrView.GetWrtShell().LockView( true );
1186 mrView.GetWrtShell().LockView( true );
1187
1188 return true;
1189}
1190
1192{
1193 if (mrMgr.GetActiveSidebarWin() != this)
1194 return;
1195 mrView.GetWrtShell().LockView( true );
1196 mrMgr.SetActiveSidebarWin(nullptr);
1197 mrView.GetWrtShell().LockView( false );
1198}
1199
1201{
1202 mrView.GetWrtShell().LockView( bLock );
1203}
1204
1205IMPL_LINK(SwAnnotationWin, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
1206{
1207 tools::Long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - rScrolledWindow.vadjustment_get_value();
1208 GetOutlinerView()->Scroll( 0, nDiff );
1209}
1210
1212{
1213 mrView.GetDocShell()->SetModified();
1214}
1215
1216IMPL_LINK_NOARG(SwAnnotationWin, DeleteHdl, void*, void)
1217{
1218 mnDeleteEventId = nullptr;
1219 Delete();
1220}
1221
1223{
1224 mpOutlinerView->RemoveAttribsKeepLanguages(true);
1225 mpOutliner->RemoveFields();
1226 mpOutlinerView->SetAttribs(DefaultItem());
1227}
1228
1230{
1232 return tools::Long(Application::GetSettings().GetStyleSettings().GetScrollBarSize() * f);
1233}
1234
1236{
1237 const int fields = GetNumFields();
1238
1239 sal_Int32 nRequiredHeight = 0;
1240 weld::Label* aLabels[3] = { mxMetadataAuthor.get(), mxMetadataDate.get(), mxMetadataResolved.get() };
1241 for (int i = 0; i < fields; ++i)
1242 nRequiredHeight += aLabels[i]->get_preferred_size().Height();
1243
1244 return nRequiredHeight;
1245}
1246
1248{
1249 return IsResolved() ? 3 : 2;
1250}
1251
1253{
1255}
1256
1258{
1261}
1262
1264{
1266 EEControlBits nCntrl = mpOutliner->GetControlWord();
1267 if (pVOpt->IsOnlineSpell())
1268 nCntrl |= EEControlBits::ONLINESPELLING;
1269 else
1270 nCntrl &= ~EEControlBits::ONLINESPELLING;
1271 mpOutliner->SetControlWord(nCntrl);
1272
1273 mpOutliner->CompleteOnlineSpelling();
1274 Invalidate();
1275}
1276
1278{
1279 switch (bViewState)
1280 {
1281 case ViewState::EDIT:
1282 {
1283 if (mpAnchor)
1284 {
1285 mpAnchor->SetAnchorState(AnchorState::All);
1287 // #i111964#
1288 if ( pWin != this && pWin->Anchor() )
1289 {
1290 pWin->Anchor()->SetAnchorState(AnchorState::End);
1291 }
1292 mpAnchor->setLineSolid(true);
1293 if ( mpTextRangeOverlay != nullptr )
1294 {
1295 mpTextRangeOverlay->ShowSolidBorder();
1296 }
1297 }
1298 if (mpShadow)
1299 mpShadow->SetShadowState(SS_EDIT);
1300 break;
1301 }
1302 case ViewState::VIEW:
1303 {
1304 if (mpAnchor)
1305 {
1306 mpAnchor->setLineSolid(true);
1307 if ( mpTextRangeOverlay != nullptr )
1308 {
1309 mpTextRangeOverlay->ShowSolidBorder();
1310 }
1311 }
1312 if (mpShadow)
1313 mpShadow->SetShadowState(SS_VIEW);
1314 break;
1315 }
1316 case ViewState::NORMAL:
1317 {
1318 if (mpAnchor)
1319 {
1320 if (IsFollow())
1321 {
1322 // if there is no visible parent note, we want to see the complete anchor ??
1323 //if (IsAnyStackParentVisible())
1324 mpAnchor->SetAnchorState(AnchorState::End);
1325 SwAnnotationWin* pTopWinSelf = GetTopReplyNote();
1326 SwAnnotationWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
1328 : nullptr;
1329 // #i111964#
1330 if ( ( pTopWinSelf != this ) &&
1331 ( pTopWinSelf != pTopWinActive ) &&
1332 pTopWinSelf->Anchor() )
1333 {
1334 if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() )
1335 {
1336 pTopWinSelf->Anchor()->setLineSolid(false);
1337 if ( pTopWinSelf->TextRange() != nullptr )
1338 {
1339 pTopWinSelf->TextRange()->HideSolidBorder();
1340 }
1341 }
1342 pTopWinSelf->Anchor()->SetAnchorState(AnchorState::All);
1343 }
1344 }
1345 mpAnchor->setLineSolid(false);
1346 if ( mpTextRangeOverlay != nullptr )
1347 {
1348 mpTextRangeOverlay->HideSolidBorder();
1349 }
1350 }
1351 if ( mpShadow )
1352 {
1353 mpShadow->SetShadowState(SS_NORMAL);
1354 }
1355 break;
1356 }
1357 }
1358}
1359
1361{
1362 SwAnnotationWin* pTopNote = this;
1363 SwAnnotationWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : nullptr;
1364 while (pSidebarWin)
1365 {
1366 pTopNote = pSidebarWin;
1367 pSidebarWin = pSidebarWin->IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, pSidebarWin) : nullptr;
1368 }
1369 return pTopNote;
1370}
1371
1373{
1374 if ( mrMgr.GetActiveSidebarWin() == this )
1375 mrMgr.SetActiveSidebarWin(nullptr);
1376 GotoPos();
1377 sal_uInt32 aCount = MoveCaret();
1378 if (aCount)
1379 mrView.GetDocShell()->GetWrtShell()->SwCursorShell::Right(aCount, SwCursorSkipMode::Chars);
1381 collectUIInformation("LEAVE",get_id());
1382}
1383
1385 const Color& aChangeColor )
1386{
1387 if ( (mLayoutStatus != aLayoutStatus) ||
1388 (mChangeColor != aChangeColor) )
1389 {
1390 mLayoutStatus = aLayoutStatus;
1391 mChangeColor = aChangeColor;
1392 Invalidate();
1393 }
1394}
1395
1397{
1398 return static_cast<bool>(mxVScrollbar);
1399}
1400
1402{
1403 return HasScrollbar() && mxVScrollbar->get_vpolicy() == VclPolicyType::ALWAYS;
1404}
1405
1407{
1408#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1409 const bool bAnchorChanged = mpAnchorFrame != rSidebarItem.maLayoutInfo.mpAnchorFrame;
1410 if ( bAnchorChanged )
1411 {
1413 }
1414#endif
1415
1416 mrSidebarItem = rSidebarItem;
1418
1419#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1421 mxSidebarWinAccessible->ChangeSidebarItem( mrSidebarItem );
1422
1423 if ( bAnchorChanged )
1424 {
1427 *this );
1428 }
1429#endif
1430}
1431
1432css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAccessible()
1433{
1434#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1435 // This is rather dodgy code. Normally in CreateAccessible, if we want a custom
1436 // object, we return a custom object, but we do no override the default toolkit
1437 // window peer.
1441 mrSidebarItem );
1442#endif
1444}
1445
1446} // eof of namespace sw::sidebarwindows
1447
1448/* 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:152
SwNodes & GetNodes()
Definition: doc.hxx:418
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:148
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:218
SwDoc & GetDoc()
Definition: node.hxx:233
const SwPosition * GetMark() const
Definition: pam.hxx:263
sal_Int32 GetMinimumSizeWithMeta() const
Definition: PostItMgr.cxx:2272
static Color GetColorDark(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2161
bool ShowNotes() const
Definition: PostItMgr.cxx:2116
void RegisterAnswer(const OutlinerParaObject *pAnswer)
Definition: PostItMgr.hxx:256
static Color GetColorAnchor(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2191
void ConnectSidebarWinToFrame(const SwFrame &rFrame, const SwFormatField &rFormatField, sw::annotation::SwAnnotationWin &rSidebarWin)
Definition: PostItMgr.cxx:2430
static Color GetColorLight(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2176
void LayoutPostIts()
Definition: PostItMgr.cxx:707
void SetActiveSidebarWin(sw::annotation::SwAnnotationWin *p)
Definition: PostItMgr.cxx:2206
bool IsShowAnchor() const
Definition: PostItMgr.hxx:193
sw::annotation::SwAnnotationWin * GetNextPostIt(sal_uInt16 aDirection, sw::annotation::SwAnnotationWin *aPostIt)
Definition: PostItMgr.cxx:1814
void DisconnectSidebarWinFromFrame(const SwFrame &rFrame, sw::annotation::SwAnnotationWin &rSidebarWin)
Definition: PostItMgr.cxx:2447
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
Definition: PostItMgr.hxx:235
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2378
void AssureStdModeAtShell()
Definition: PostItMgr.cxx:2354
tools::Long GetNextBorder()
Definition: PostItMgr.cxx:1850
void UpdateResolvedStatus(const sw::annotation::SwAnnotationWin *topNote)
Definition: PostItMgr.cxx:2511
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:2521
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:111
static bool IsFieldShadings()
Definition: viewopt.hxx:780
bool IsOnlineSpell() const
Definition: viewopt.hxx:481
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:347
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:433
void LockView(bool b)
Definition: viewsh.hxx:472
SwWrtShell & GetWrtShell() const
Definition: view.hxx:421
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:422
SwEditWin & GetEditWin()
Definition: view.hxx:424
SwDocShell * GetDocShell()
Definition: view.cxx:1161
void ToggleInsMode()
Definition: wrtsh.hxx:171
bool IsInsMode() const
Definition: wrtsh.hxx:172
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:792
#define FN_REPLY
Definition: cmdid.h:790
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:783
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:786
#define FN_POSTIT
Definition: cmdid.h:230
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:787
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:784
#define FN_DELETE_COMMENT
Definition: cmdid.h:789
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:794
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:793
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:791
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 OString &, 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:37
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:230
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