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::createBaseProcessor2DFromOutputDevice(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 mpOutliner->SetRefMapMode( aMode );
505 SetMapMode( aMode );
506 mxSidebarTextControl->SetMapMode( aMode );
507 const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY();
508
509 vcl::Font aFont = maLabelFont;
510 sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
511 aFont.SetFontHeight( nHeight );
512
514 mxMetadataAuthor->set_font(aFont);
515 if (mxMetadataDate)
516 mxMetadataDate->set_font(aFont);
518 mxMetadataResolved->set_font(aFont);
520 if (mxVScrollbar)
521 mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
522}
523
525{
526 bool bChange = false;
527
528 if (GetSizePixel() != mPosSize.GetSize())
529 {
530 bChange = true;
532
533 DoResize();
534 }
535
536 if (GetPosPixel().X() != mPosSize.Left() || (std::abs(GetPosPixel().Y() - mPosSize.Top()) > 5) )
537 {
538 bChange = true;
540
541 Point aLineStart;
542 Point aLineEnd ;
543 switch ( meSidebarPosition )
544 {
546 {
547 aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
548 aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
549 }
550 break;
552 {
553 aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
554 aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
555 }
556 break;
557 default:
558 OSL_FAIL( "<SwAnnotationWin::SetPosAndSize()> - unexpected position of sidebar" );
559 break;
560 }
561
562 // LOK has map mode disabled, and we still want to perform pixel ->
563 // twips conversion for the size of the line above the note.
565 {
567 Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY());
568 aSize = EditWin().PixelToLogic(aSize);
569 aLineEnd = aLineStart;
570 aLineEnd.Move(aSize.getWidth(), aSize.getHeight());
571 EditWin().EnableMapMode(false);
572 }
573
574 if (mpAnchor)
575 {
576 mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
581 basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
582 basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
583 }
584 else
585 {
586 mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView,
589 aLineStart,
590 aLineEnd,
591 mColorAnchor );
592 if ( mpAnchor )
593 {
594 mpAnchor->setVisible(true);
595 mpAnchor->SetAnchorState(AnchorState::Tri);
596 if (HasChildPathFocus())
597 {
598 mpAnchor->setLineSolid(true);
599 }
600 }
601 }
602 }
603 else
604 {
605 if ( mpAnchor &&
606 ( mpAnchor->getBasePosition() != basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom()-5*15) ) )
607 {
608 mpAnchor->SetTriPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
613 }
614 }
615
616 if (mpShadow && bChange)
617 {
620 mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
621 }
622
623 if (mrMgr.ShowNotes())
624 {
625 if (IsFollow() && !HasChildPathFocus())
626 {
627 // #i111964#
628 if ( mpAnchor )
629 {
630 mpAnchor->SetAnchorState(AnchorState::End);
631 }
632 }
633 else
634 {
635 // #i111964#
636 if ( mpAnchor )
637 {
638 mpAnchor->SetAnchorState(AnchorState::All);
639 }
641 // #i111964#
642 if ( pWin != this && pWin->Anchor() )
643 {
644 pWin->Anchor()->SetAnchorState(AnchorState::End);
645 }
646 }
647 }
648
649
650 // text range overlay
654 {
655 const SwTextAnnotationField* pTextAnnotationField =
657 SwTextNode* pTextNode = pTextAnnotationField ? pTextAnnotationField->GetpTextNode() : nullptr;
658 SwContentNode* pContentNd = nullptr;
659 if (pTextNode)
660 {
661 SwNodes& rNds = pTextNode->GetDoc().GetNodes();
662 pContentNd = rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetContentNode();
663 }
664 if (pContentNd)
665 {
666 SwPosition aStartPos( *pContentNd, mrSidebarItem.maLayoutInfo.mnStartContent );
667 SwShellCursor* pTmpCursor = nullptr;
668 const bool bTableCursorNeeded = pTextNode->FindTableBoxStartNode() != pContentNd->FindTableBoxStartNode();
669 if ( bTableCursorNeeded )
670 {
671 SwShellTableCursor* pTableCursor = new SwShellTableCursor( mrView.GetWrtShell(), aStartPos );
672 pTableCursor->SetMark();
673 pTableCursor->GetMark()->Assign( *pTextNode, pTextAnnotationField->GetStart()+1 );
674 pTableCursor->NewTableSelection();
675 pTmpCursor = pTableCursor;
676 }
677 else
678 {
679 SwShellCursor* pCursor = new SwShellCursor( mrView.GetWrtShell(), aStartPos );
680 pCursor->SetMark();
681 pCursor->GetMark()->Assign(*pTextNode, pTextAnnotationField->GetStart()+1 );
682 pTmpCursor = pCursor;
683 }
684 std::unique_ptr<SwShellCursor> pTmpCursorForAnnotationTextRange( pTmpCursor );
685
686 // For annotation text range rectangles to be calculated correctly,
687 // we need the map mode disabled
688 bool bDisableMapMode = comphelper::LibreOfficeKit::isActive() && EditWin().IsMapModeEnabled();
689 if (bDisableMapMode)
690 EditWin().EnableMapMode(false);
691
693 pTmpCursorForAnnotationTextRange->FillRects();
694
695 if (bDisableMapMode)
697
698 SwRects* pRects(pTmpCursorForAnnotationTextRange.get());
699 for(const SwRect & rNextRect : *pRects)
700 {
701 const tools::Rectangle aPntRect(rNextRect.SVRect());
702 maAnnotationTextRanges.emplace_back(
703 aPntRect.Left(), aPntRect.Top(),
704 aPntRect.Right() + 1, aPntRect.Bottom() + 1);
705 }
706 }
707 }
708
709 if (mrMgr.ShowNotes() && !maAnnotationTextRanges.empty())
710 {
711 if ( mpTextRangeOverlay != nullptr )
712 {
713 mpTextRangeOverlay->setRanges( std::vector(maAnnotationTextRanges) );
714 if ( mpAnchor != nullptr && mpAnchor->getLineSolid() )
715 {
716 mpTextRangeOverlay->ShowSolidBorder();
717 }
718 else
719 {
720 mpTextRangeOverlay->HideSolidBorder();
721 }
722 }
723 else if (!IsFollow())
724 {
725 // This window is not a reply, then draw its range overlay.
728 mrView,
730 std::vector(maAnnotationTextRanges),
731 mpAnchor && mpAnchor->getLineSolid() );
732 }
733 }
734 else
735 {
736 mpTextRangeOverlay.reset();
737 }
738}
739
741{
742 tools::Long aHeight = GetSizePixel().Height();
743 tools::ULong aWidth = GetSizePixel().Width();
744
745 aHeight -= GetMetaHeight();
746
747 mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth, aHeight) ) ) ;
748 tools::Long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
749
750 mxMetadataAuthor->show();
751 if(IsResolved()) { mxMetadataResolved->show(); }
752 mxMetadataDate->show();
753
754 if (aTextHeight > aHeight)
755 {
756 const int nThickness = mxVScrollbar->get_scroll_thickness();
757 if (nThickness)
758 {
759 // we need vertical scrollbars and have to reduce the width
760 aWidth -= nThickness;
761 mpOutliner->SetPaperSize(PixelToLogic(Size(aWidth, aHeight)));
762 }
763 mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
764 }
765 else
766 {
767 mxVScrollbar->set_vpolicy(VclPolicyType::NEVER);
768 }
769
770 tools::Rectangle aOutputArea = PixelToLogic(tools::Rectangle(0, 0, aWidth, aHeight));
771 if (mxVScrollbar->get_vpolicy() == VclPolicyType::NEVER)
772 {
773 // if we do not have a scrollbar anymore, we want to see the complete text
774 mpOutlinerView->SetVisArea(aOutputArea);
775 }
776 mpOutlinerView->SetOutputArea(aOutputArea);
777 mpOutlinerView->ShowCursor(true, true);
778
779 // Don't leave an empty area at the bottom if we can move the text down.
780 tools::Long nMaxVisAreaTop = mpOutliner->GetTextHeight() - aOutputArea.GetHeight();
781 if (mpOutlinerView->GetVisArea().Top() > nMaxVisAreaTop)
782 {
783 GetOutlinerView()->Scroll(0, mpOutlinerView->GetVisArea().Top() - nMaxVisAreaTop);
784 }
785
786 int nUpper = mpOutliner->GetTextHeight();
787 int nCurrentDocPos = mpOutlinerView->GetVisArea().Top();
788 int nStepIncrement = mpOutliner->GetTextHeight() / 10;
789 int nPageIncrement = PixelToLogic(Size(0,aHeight)).Height() * 8 / 10;
790 int nPageSize = PixelToLogic(Size(0,aHeight)).Height();
791
792 /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
793 effectively...
794
795 lower = gtk_adjustment_get_lower
796 upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
797
798 and requires that upper > lower or the deceleration animation never ends
799 */
800 nPageSize = std::min(nPageSize, nUpper);
801
802 mxVScrollbar->vadjustment_configure(nCurrentDocPos, 0, nUpper,
803 nStepIncrement, nPageIncrement, nPageSize);
804}
805
806void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
807{
809 return;
810
812
813 if (mpShadow)
814 {
817 mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
818 }
819}
820
822{
823 mxVScrollbar->vadjustment_set_value(mpOutlinerView->GetVisArea().Top());
824}
825
827{
828 if (aOldHeight != aNewHeight)
829 {
830 //check for lower border or next note
831 tools::Long aBorder = mrMgr.GetNextBorder();
832 if (aBorder != -1)
833 {
834 if (aNewHeight > GetMinimumSizeWithoutMeta())
835 {
836 tools::Long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
837 if (aNewLowerValue < aBorder)
839 else
840 SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
841 DoResize();
842 Invalidate();
843 }
844 else
845 {
848 DoResize();
849 Invalidate();
850 }
851 }
852 else
853 {
854 DoResize();
855 Invalidate();
856 }
857 }
858 else
859 {
860 SetScrollbar();
861 }
862}
863
864void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
865{
866 mColorDark = aColorDark;
867 mColorLight = aColorLight;
868 mColorAnchor = aColorAnchor;
869
870 if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
871 return;
872
873 m_xContainer->set_background(mColorDark);
875
876 mxMetadataAuthor->set_font_color(aColorAnchor);
877
878 mxMetadataDate->set_font_color(aColorAnchor);
879
880 mxMetadataResolved->set_font_color(aColorAnchor);
881
882 mxVScrollbar->customize_scrollbars(mColorLight,
884 mColorDark);
885}
886
888{
889 meSidebarPosition = eSidebarPosition;
890}
891
893{
894 mbReadonly = bSet;
896}
897
899{
900 IDocumentUndoRedo& rUndoRedo(
902 const bool bDocUndoEnabled = rUndoRedo.DoesUndo();
903 const bool bOutlinerUndoEnabled = mpOutliner->IsUndoEnabled();
904 const bool bOutlinerModified = mpOutliner->IsModified();
905 const bool bDisableAndRestoreUndoMode = !bDocUndoEnabled && bOutlinerUndoEnabled;
906
907 if (bDisableAndRestoreUndoMode)
908 {
909 // doc undo is disabled, but outliner was enabled, turn outliner undo off
910 // for the duration of this function
911 mpOutliner->EnableUndo(false);
912 }
913
914 Link<LinkParamNone*,void> aLink = mpOutliner->GetModifyHdl();
915 mpOutliner->SetModifyHdl( Link<LinkParamNone*,void>() );
917
918 ESelection aNewSelection( 0, 0, mpOutliner->GetParagraphCount()-1, EE_TEXTPOS_ALL );
920 SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs());
921 aEditAttr.Put(rNewItem);
922 GetOutlinerView()->SetAttribs( aEditAttr );
923
924 if (!mpOutliner->IsUndoEnabled() && !bOutlinerModified)
925 {
926 // if undo was disabled (e.g. this is a redo action) and we were
927 // originally 'unmodified' keep it that way
928 mpOutliner->ClearModifyFlag();
929 }
930
932 mpOutliner->SetModifyHdl( aLink );
933
935 EEControlBits nCntrl = mpOutliner->GetControlWord();
936 // turn off
937 nCntrl &= ~EEControlBits::ONLINESPELLING;
938 mpOutliner->SetControlWord(nCntrl);
939
940 //turn back on
941 if (pVOpt->IsOnlineSpell())
942 nCntrl |= EEControlBits::ONLINESPELLING;
943 else
944 nCntrl &= ~EEControlBits::ONLINESPELLING;
945 mpOutliner->SetControlWord(nCntrl);
946
947 mpOutliner->CompleteOnlineSpelling();
948
949 // restore original mode
950 if (bDisableAndRestoreUndoMode)
951 mpOutliner->EnableUndo(true);
952
953 Invalidate();
954}
955
957{
959 mxSidebarTextControl->GrabFocus();
960}
961
963{
964}
965
967{
969 if (!IsVisible())
970 Window::Show();
971 if (mpShadow && !mpShadow->isVisible())
972 mpShadow->setVisible(true);
973 if (mpAnchor && !mpAnchor->isVisible())
974 mpAnchor->setVisible(true);
975 if (mpTextRangeOverlay && !mpTextRangeOverlay->isVisible())
976 mpTextRangeOverlay->setVisible(true);
977
978 collectUIInformation("SHOW",get_id());
979}
980
982{
983 if (IsVisible())
984 Window::Hide();
985 if (mpAnchor)
986 {
987 if (mrMgr.IsShowAnchor())
988 mpAnchor->SetAnchorState(AnchorState::Tri);
989 else
990 mpAnchor->setVisible(false);
991 }
992 if (mpShadow && mpShadow->isVisible())
993 mpShadow->setVisible(false);
994 if (mpTextRangeOverlay && mpTextRangeOverlay->isVisible())
995 mpTextRangeOverlay->setVisible(false);
996 collectUIInformation("HIDE",get_id());
997}
998
1000{
1002
1003 mpOutliner->ClearModifyFlag();
1004 mpOutliner->GetUndoManager().Clear();
1005
1006 CheckMetaText();
1007 SetViewState(ViewState::EDIT);
1008
1009 // prevent autoscroll to the old cursor location
1010 // when cursor out of visible area
1011 GetOutlinerView()->ShowCursor(false);
1012
1013 mpOutlinerView->GetEditView().SetInsertMode(mrView.GetWrtShellPtr()->IsInsMode());
1014
1015 if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1017
1018 //tdf#119130 only have the active postit as a dialog control in which pressing
1019 //ctrl+tab cycles between text and button so we don't waste time searching
1020 //thousands of SwAnnotationWins
1022}
1023
1025{
1026 //tdf#119130 only have the active postit as a dialog control in which pressing
1027 //ctrl+tab cycles between text and button so we don't waste time searching
1028 //thousands of SwAnnotationWins
1030
1031 // remove selection, #i87073#
1032 if (GetOutlinerView()->GetEditView().HasSelection())
1033 {
1035 aSelection.nEndPara = aSelection.nStartPara;
1036 aSelection.nEndPos = aSelection.nStartPos;
1037 GetOutlinerView()->GetEditView().SetSelection(aSelection);
1038 }
1039
1040 mpOutliner->CompleteOnlineSpelling();
1041
1042 SetViewState(ViewState::NORMAL);
1043 // Make sure this view doesn't emit LOK callbacks during the update, as the
1044 // sidebar window's SidebarTextControl doesn't have a valid twip offset
1045 // (map mode origin) during that operation.
1046 bool bTiledPainting = comphelper::LibreOfficeKit::isTiledPainting();
1048 // write the visible text back into the SwField
1049 UpdateData();
1051
1052 if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1054
1055 if (!mnDeleteEventId && !IsProtected() && mpOutliner->GetEditEngine().GetText().isEmpty())
1056 {
1057 mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1058 }
1059}
1060
1062{
1064 {
1065 //change outliner
1066 mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
1067 //change document
1069 //update statusbar
1071 rBnd.Invalidate(SID_ATTR_INSERT);
1072 rBnd.Update(SID_ATTR_INSERT);
1073 }
1074}
1075
1077{
1079
1080 switch (nSlot)
1081 {
1082 case FN_POSTIT:
1083 case FN_REPLY:
1084 {
1085 // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
1086 // will be created
1087 if (!mpOutliner->GetEditEngine().GetText().isEmpty())
1088 {
1089 OutlinerParaObject aPara(GetOutlinerView()->GetEditView().CreateTextObject());
1090 mrMgr.RegisterAnswer(&aPara);
1091 }
1093 mrMgr.SetActiveSidebarWin(nullptr);
1096 break;
1097 }
1098 case FN_DELETE_COMMENT:
1099 //Delete(); // do not kill the parent of our open popup menu
1100 mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1101 break;
1103 DeleteThread();
1104 break;
1105 case FN_RESOLVE_NOTE:
1107 DoResize();
1108 Invalidate();
1110 break;
1114 DoResize();
1115 Invalidate();
1117 break;
1120 case FN_HIDE_ALL_NOTES:
1121 // not possible as slot as this would require that "this" is the active postit
1122 mrView.GetViewFrame()->GetBindings().Execute( nSlot, nullptr, SfxCallMode::ASYNCHRON );
1123 break;
1126 {
1127 // not possible as slot as this would require that "this" is the active postit
1128 SfxStringItem aItem( nSlot, GetAuthor() );
1129 const SfxPoolItem* aItems[2];
1130 aItems[0] = &aItem;
1131 aItems[1] = nullptr;
1132 mrView.GetViewFrame()->GetBindings().Execute( nSlot, aItems, SfxCallMode::ASYNCHRON );
1133 }
1134 break;
1135 default:
1136 mrView.GetViewFrame()->GetBindings().Execute( nSlot );
1137 break;
1138 }
1139}
1140
1142{
1143 return mrView.GetEditWin();
1144}
1145
1147{
1148 return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
1149}
1150
1151void SwAnnotationWin::SwitchToPostIt(sal_uInt16 aDirection)
1152{
1154 if (pPostIt)
1155 pPostIt->GrabFocus();
1156}
1157
1158IMPL_LINK(SwAnnotationWin, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
1159{
1160 if (rMEvt.IsEnterWindow())
1161 {
1162 mbMouseOver = true;
1163 if ( !HasFocus() )
1164 {
1165 SetViewState(ViewState::VIEW);
1166 Invalidate();
1167 }
1168 }
1169 else if (rMEvt.IsLeaveWindow())
1170 {
1171 mbMouseOver = false;
1172 if ( !HasFocus() )
1173 {
1174 SetViewState(ViewState::NORMAL);
1175 Invalidate();
1176 }
1177 }
1178 return false;
1179}
1180
1182{
1183 if (mrMgr.GetActiveSidebarWin() == this)
1184 return false;
1185 mrView.GetWrtShell().LockView( true );
1187 mrView.GetWrtShell().LockView( true );
1188
1189 return true;
1190}
1191
1193{
1194 if (mrMgr.GetActiveSidebarWin() != this)
1195 return;
1196 mrView.GetWrtShell().LockView( true );
1197 mrMgr.SetActiveSidebarWin(nullptr);
1198 mrView.GetWrtShell().LockView( false );
1199}
1200
1202{
1203 mrView.GetWrtShell().LockView( bLock );
1204}
1205
1206IMPL_LINK(SwAnnotationWin, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
1207{
1208 tools::Long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - rScrolledWindow.vadjustment_get_value();
1209 GetOutlinerView()->Scroll( 0, nDiff );
1210}
1211
1213{
1214 mrView.GetDocShell()->SetModified();
1215}
1216
1217IMPL_LINK_NOARG(SwAnnotationWin, DeleteHdl, void*, void)
1218{
1219 mnDeleteEventId = nullptr;
1220 Delete();
1221}
1222
1224{
1225 mpOutlinerView->RemoveAttribsKeepLanguages(true);
1226 mpOutliner->RemoveFields();
1227 mpOutlinerView->SetAttribs(DefaultItem());
1228}
1229
1231{
1233 return tools::Long(Application::GetSettings().GetStyleSettings().GetScrollBarSize() * f);
1234}
1235
1237{
1238 const int fields = GetNumFields();
1239
1240 sal_Int32 nRequiredHeight = 0;
1241 weld::Label* aLabels[3] = { mxMetadataAuthor.get(), mxMetadataDate.get(), mxMetadataResolved.get() };
1242 for (int i = 0; i < fields; ++i)
1243 nRequiredHeight += aLabels[i]->get_preferred_size().Height();
1244
1245 return nRequiredHeight;
1246}
1247
1249{
1250 return IsResolved() ? 3 : 2;
1251}
1252
1254{
1256}
1257
1259{
1262}
1263
1265{
1267 EEControlBits nCntrl = mpOutliner->GetControlWord();
1268 if (pVOpt->IsOnlineSpell())
1269 nCntrl |= EEControlBits::ONLINESPELLING;
1270 else
1271 nCntrl &= ~EEControlBits::ONLINESPELLING;
1272 mpOutliner->SetControlWord(nCntrl);
1273
1274 mpOutliner->CompleteOnlineSpelling();
1275 Invalidate();
1276}
1277
1279{
1280 switch (bViewState)
1281 {
1282 case ViewState::EDIT:
1283 {
1284 if (mpAnchor)
1285 {
1286 mpAnchor->SetAnchorState(AnchorState::All);
1288 // #i111964#
1289 if ( pWin != this && pWin->Anchor() )
1290 {
1291 pWin->Anchor()->SetAnchorState(AnchorState::End);
1292 }
1293 mpAnchor->setLineSolid(true);
1294 if ( mpTextRangeOverlay != nullptr )
1295 {
1296 mpTextRangeOverlay->ShowSolidBorder();
1297 }
1298 }
1299 if (mpShadow)
1300 mpShadow->SetShadowState(SS_EDIT);
1301 break;
1302 }
1303 case ViewState::VIEW:
1304 {
1305 if (mpAnchor)
1306 {
1307 mpAnchor->setLineSolid(true);
1308 if ( mpTextRangeOverlay != nullptr )
1309 {
1310 mpTextRangeOverlay->ShowSolidBorder();
1311 }
1312 }
1313 if (mpShadow)
1314 mpShadow->SetShadowState(SS_VIEW);
1315 break;
1316 }
1317 case ViewState::NORMAL:
1318 {
1319 if (mpAnchor)
1320 {
1321 if (IsFollow())
1322 {
1323 // if there is no visible parent note, we want to see the complete anchor ??
1324 //if (IsAnyStackParentVisible())
1325 mpAnchor->SetAnchorState(AnchorState::End);
1326 SwAnnotationWin* pTopWinSelf = GetTopReplyNote();
1327 SwAnnotationWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
1329 : nullptr;
1330 // #i111964#
1331 if ( ( pTopWinSelf != this ) &&
1332 ( pTopWinSelf != pTopWinActive ) &&
1333 pTopWinSelf->Anchor() )
1334 {
1335 if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() )
1336 {
1337 pTopWinSelf->Anchor()->setLineSolid(false);
1338 if ( pTopWinSelf->TextRange() != nullptr )
1339 {
1340 pTopWinSelf->TextRange()->HideSolidBorder();
1341 }
1342 }
1343 pTopWinSelf->Anchor()->SetAnchorState(AnchorState::All);
1344 }
1345 }
1346 mpAnchor->setLineSolid(false);
1347 if ( mpTextRangeOverlay != nullptr )
1348 {
1349 mpTextRangeOverlay->HideSolidBorder();
1350 }
1351 }
1352 if ( mpShadow )
1353 {
1354 mpShadow->SetShadowState(SS_NORMAL);
1355 }
1356 break;
1357 }
1358 }
1359}
1360
1362{
1363 SwAnnotationWin* pTopNote = this;
1364 SwAnnotationWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : nullptr;
1365 while (pSidebarWin)
1366 {
1367 pTopNote = pSidebarWin;
1368 pSidebarWin = pSidebarWin->IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, pSidebarWin) : nullptr;
1369 }
1370 return pTopNote;
1371}
1372
1374{
1375 if ( mrMgr.GetActiveSidebarWin() == this )
1376 mrMgr.SetActiveSidebarWin(nullptr);
1377 GotoPos();
1378 sal_uInt32 aCount = MoveCaret();
1379 if (aCount)
1380 mrView.GetDocShell()->GetWrtShell()->SwCursorShell::Right(aCount, SwCursorSkipMode::Chars);
1382 collectUIInformation("LEAVE",get_id());
1383}
1384
1386 const Color& aChangeColor )
1387{
1388 if ( (mLayoutStatus != aLayoutStatus) ||
1389 (mChangeColor != aChangeColor) )
1390 {
1391 mLayoutStatus = aLayoutStatus;
1392 mChangeColor = aChangeColor;
1393 Invalidate();
1394 }
1395}
1396
1398{
1399 return static_cast<bool>(mxVScrollbar);
1400}
1401
1403{
1404 return HasScrollbar() && mxVScrollbar->get_vpolicy() == VclPolicyType::ALWAYS;
1405}
1406
1408{
1409#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1410 const bool bAnchorChanged = mpAnchorFrame != rSidebarItem.maLayoutInfo.mpAnchorFrame;
1411 if ( bAnchorChanged )
1412 {
1414 }
1415#endif
1416
1417 mrSidebarItem = rSidebarItem;
1419
1420#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1422 mxSidebarWinAccessible->ChangeSidebarItem( mrSidebarItem );
1423
1424 if ( bAnchorChanged )
1425 {
1428 *this );
1429 }
1430#endif
1431}
1432
1433css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAccessible()
1434{
1435#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1436 // This is rather dodgy code. Normally in CreateAccessible, if we want a custom
1437 // object, we return a custom object, but we do no override the default toolkit
1438 // window peer.
1442 mrSidebarItem );
1443#endif
1445}
1446
1447} // eof of namespace sw::sidebarwindows
1448
1449/* 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)
virtual bool DoesUndo() const =0
Is Undo enabled?
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:145
SwNodes & GetNodes()
Definition: doc.hxx:413
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:202
SwDoc & GetDoc()
Definition: node.hxx:217
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
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:892
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:1059
SwLayoutInfo maLayoutInfo
virtual const SwFormatField & GetFormatField() const =0
bool NewTableSelection()
Definition: swcrsr.cxx:2518
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:86
static bool IsFieldShadings()
Definition: viewopt.hxx:671
bool IsOnlineSpell() const
Definition: viewopt.hxx:371
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:347
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:436
void LockView(bool b)
Definition: viewsh.hxx:475
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
SwEditWin & GetEditWin()
Definition: view.hxx:416
SwDocShell * GetDocShell()
Definition: view.cxx:1159
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:774
#define FN_REPLY
Definition: cmdid.h:772
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:765
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:768
#define FN_POSTIT
Definition: cmdid.h:226
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:769
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:766
#define FN_DELETE_COMMENT
Definition: cmdid.h:771
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:776
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:775
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:773
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< drawinglayer::processor2d::BaseProcessor2D > createBaseProcessor2DFromOutputDevice(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
void(* f)(TrueTypeTable *)
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:164
#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