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>
60#include <vcl/svapp.hxx>
61#include <vcl/settings.hxx>
62#include <vcl/ptrstyle.hxx>
63#include <vcl/uitest/logger.hxx>
65
66#include <edtwin.hxx>
67#include <view.hxx>
68#include <docsh.hxx>
69#include <wrtsh.hxx>
70#include <doc.hxx>
71#include <docstyle.hxx>
72#include <docufld.hxx>
73#include <swmodule.hxx>
74
75#include <SwRewriter.hxx>
76#include <txtannotationfld.hxx>
77#include <ndtxt.hxx>
78
81#include <osl/diagnose.h>
84#include <memory>
85#include <comphelper/lok.hxx>
86
87using namespace sw::sidebarwindows;
88
89namespace
90{
91
92void collectUIInformation( const OUString& aevent , const OUString& aID )
93{
94 EventDescription aDescription;
95 aDescription.aID = aID;
96 aDescription.aParameters = {{"" , ""}};
97 aDescription.aAction = aevent;
98 aDescription.aParent = "MainWindow";
99 aDescription.aKeyWord = "SwEditWinUIObject";
100 UITestLogger::getInstance().logEvent(aDescription);
101}
102
103}
104
105namespace sw::annotation {
106
107#define METABUTTON_WIDTH 16
108#define METABUTTON_HEIGHT 18
109#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
110
112{
113 bool bMenuButtonVisible = mxMenuButton->get_visible();
114 // No point in showing this button till click on it are not handled.
115 if (bMenuButtonVisible)
116 mxMenuButton->hide();
117
118 // draw left over space
119 if (Application::GetSettings().GetStyleSettings().GetHighContrastMode())
120 rRenderContext.SetFillColor(COL_BLACK);
121 else
122 rRenderContext.SetFillColor(mColorDark);
123 rRenderContext.SetLineColor();
124 rRenderContext.DrawRect(rRect);
125
126 m_xContainer->draw(rRenderContext, rRect.TopLeft(), GetSizePixel());
127
128 const drawinglayer::geometry::ViewInformation2D aViewInformation;
129 std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation));
130
131 // drawinglayer sets the map mode to pixels, not needed here.
132 rRenderContext.Pop();
133 // Work in document-global twips.
134 rRenderContext.Pop();
135 if (mpAnchor)
136 pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence());
138 pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
139
140 rRenderContext.Push(vcl::PushFlags::NONE);
141 pProcessor.reset();
142 rRenderContext.Push(vcl::PushFlags::NONE);
143
144 if (bMenuButtonVisible)
145 mxMenuButton->show();
146}
147
148bool SwAnnotationWin::IsHitWindow(const Point& rPointLogic)
149{
151 return aRectangleLogic.Contains(rPointLogic);
152}
153
154void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
155{
156 mxSidebarTextControl->SetCursorLogicPosition(rPosition, bPoint, bClearMark);
157}
158
160{
161 // tdf#143511 unclip SysObj so get_extents_relative_to of children
162 // of the SysObj can provide meaningful results
164
165 vcl::PDFExtOutDevData *const pPDFExtOutDevData(
166 dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()));
167 if (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF())
168 {
169 pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement, OUString());
170 }
171
172 pDev->Push();
173
175 pDev->SetLineColor();
176
178 vcl::Font aFont = maLabelFont;
179 aFont.SetFontHeight(aFont.GetFontHeight() * 20);
180 pDev->SetFont(aFont);
181
183
184 pDev->DrawRect(tools::Rectangle(rPt, aSz));
185
186 if (mxMetadataAuthor->get_visible())
187 {
188 int x, y, width, height;
189 mxMetadataAuthor->get_extents_relative_to(*m_xContainer, x, y, width, height);
190 Point aPos(rPt + PixelToLogic(Point(x, y)));
191 Size aSize(PixelToLogic(Size(width, height)));
192
194 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
195 pDev->DrawText(aPos, mxMetadataAuthor->get_label());
196 pDev->Pop();
197 }
198
199 if (mxMetadataDate->get_visible())
200 {
201 int x, y, width, height;
202 mxMetadataDate->get_extents_relative_to(*m_xContainer, x, y, width, height);
203 Point aPos(rPt + PixelToLogic(Point(x, y)));
204 Size aSize(PixelToLogic(Size(width, height)));
205
207 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
208 pDev->DrawText(aPos, mxMetadataDate->get_label());
209 pDev->Pop();
210 }
211
212 if (mxMetadataResolved->get_visible())
213 {
214 int x, y, width, height;
215 mxMetadataResolved->get_extents_relative_to(*m_xContainer, x, y, width, height);
216 Point aPos(rPt + PixelToLogic(Point(x, y)));
217 Size aSize(PixelToLogic(Size(width, height)));
218
220 pDev->IntersectClipRegion(tools::Rectangle(aPos, aSize));
221 pDev->DrawText(aPos, mxMetadataResolved->get_label());
222 pDev->Pop();
223 }
224
225 mxSidebarTextControl->DrawForPage(pDev, rPt);
226
228 std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
230 *pDev, aNewViewInfos ));
231
232 if (mpAnchor)
233 pProcessor->process(mpAnchor->getOverlayObjectPrimitive2DSequence());
235 pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
236 pProcessor.reset();
237
238 if (mxVScrollbar->get_vpolicy() != VclPolicyType::NEVER)
239 {
240 // if there is a scrollbar shown, draw "..." to indicate the comment isn't
241 // completely shown
242 int x, y, width, height;
243 mxMenuButton->get_extents_relative_to(*m_xContainer, x, y, width, height);
244 Point aPos(rPt + PixelToLogic(Point(x, y)));
245 pDev->DrawText(aPos, "...");
246 }
247
248 pDev->Pop();
249
250 if (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF())
251 {
252 pPDFExtOutDevData->EndStructureElement();
253 }
254}
255
257 const SwRect& aAnchorRect, const tools::Long aPageBorder)
258{
259 mPosSize = tools::Rectangle(Point(nX,nY),Size(nWidth,nHeight));
260 if (!mAnchorRect.IsEmpty() && mAnchorRect != aAnchorRect)
261 mbAnchorRectChanged = true;
262 mAnchorRect = aAnchorRect;
263 mPageBorder = aPageBorder;
264}
265
266void SwAnnotationWin::SetSize( const Size& rNewSize )
267{
268 mPosSize.SetSize(rNewSize);
269}
270
271void SwAnnotationWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
272{
273 mPosSize = tools::Rectangle(aPoint,aSize);
274}
275
277{
278 mPosSize.Move(0,aAmount);
279}
280
282{
283 HideNote();
285 if (mpAnchor)
286 {
287 mpAnchor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
288 mpAnchor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
289 mpAnchor->SetAnchorState(AnchorState::All);
290 mpAnchor->setVisible(true);
291 }
292 if (mpShadow)
293 mpShadow->setVisible(false);
294}
295
297{
298 // window controls for author and date
299 mxMetadataAuthor = m_xBuilder->weld_label("author");
300 mxMetadataAuthor->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
302
305
306 // we should leave this setting alone, but for this we need a better layout algo
307 // with variable meta size height
308 mxMetadataAuthor->set_font(maLabelFont);
309
310 mxMetadataDate = m_xBuilder->weld_label("date");
311 mxMetadataDate->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_DATE_NAME ) );
313 mxMetadataDate->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
314
315 // we should leave this setting alone, but for this we need a better layout algo
316 // with variable meta size height
317 mxMetadataDate->set_font(maLabelFont);
318
319 mxMetadataResolved = m_xBuilder->weld_label("resolved");
320 mxMetadataResolved->set_accessible_name( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
322 mxMetadataResolved->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
323
324 // we should leave this setting alone, but for this we need a better layout algo
325 // with variable meta size height
327 mxMetadataResolved->set_label(SwResId(STR_ACCESS_ANNOTATION_RESOLVED_NAME));
328
329 SwDocShell* aShell = mrView.GetDocShell();
330 mpOutliner.reset(new Outliner(&aShell->GetPool(),OutlinerMode::TextObject));
331 mpOutliner->SetStyleSheetPool(static_cast<SwDocStyleSheetPool*>(aShell->GetStyleSheetPool())->GetEEStyleSheetPool());
332 aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner.get() );
333 mpOutliner->SetUpdateLayout( true );
334
335 mpOutlinerView.reset(new OutlinerView(mpOutliner.get(), nullptr));
336 mpOutliner->InsertView(mpOutlinerView.get());
337
338 //create Scrollbars
339 mxVScrollbar = m_xBuilder->weld_scrolled_window("scrolledwindow", true);
340
341 mxMenuButton = m_xBuilder->weld_menu_button("menubutton");
343
344 // actual window which holds the user text
347 mxSidebarTextControl->SetPointer(PointerStyle::Text);
348
349 Rescale();
350
351 mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
352 mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );
353
354 mxVScrollbar->set_direction(false);
355 mxVScrollbar->connect_vadjustment_changed(LINK(this, SwAnnotationWin, ScrollHdl));
356 mxVScrollbar->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
357
358 EEControlBits nCntrl = mpOutliner->GetControlWord();
359 // TODO: crash when AUTOCOMPLETE enabled
360 nCntrl |= EEControlBits::MARKFIELDS | EEControlBits::PASTESPECIAL | EEControlBits::AUTOCORRECT | EEControlBits::USECHARATTRIBS; // | EEControlBits::AUTOCOMPLETE;
361 // Our stylesheet pool follows closely the core paragraph styles.
362 // We don't want the rtf import (during paste) to mess with that.
363 nCntrl &= ~EEControlBits::RTFSTYLESHEETS;
364
365 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
366 {
367 const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
368 if (pVOpt->IsFieldShadings())
369 nCntrl |= EEControlBits::MARKFIELDS;
370 else
371 nCntrl &= ~EEControlBits::MARKFIELDS;
372 if (pVOpt->IsOnlineSpell())
373 nCntrl |= EEControlBits::ONLINESPELLING;
374 else
375 nCntrl &= ~EEControlBits::ONLINESPELLING;
376 }
377 mpOutliner->SetControlWord(nCntrl);
378
379 std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
383
385
386 // expand %1 "Author"
387 OUString aText = mxMenuButton->get_item_label("deleteby");
388 SwRewriter aRewriter;
389 aRewriter.AddRule(UndoArg1, GetAuthor());
390 aText = aRewriter.Apply(aText);
391 mxMenuButton->set_item_label("deleteby", aText);
392
393 mxMenuButton->set_accessible_name(SwResId(STR_ACCESS_ANNOTATION_BUTTON_NAME));
394 mxMenuButton->set_accessible_description(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
395 mxMenuButton->set_tooltip_text(SwResId(STR_ACCESS_ANNOTATION_BUTTON_DESC));
396
397 mxMenuButton->connect_toggled(LINK(this, SwAnnotationWin, ToggleHdl));
398 mxMenuButton->connect_selected(LINK(this, SwAnnotationWin, SelectHdl));
399 mxMenuButton->connect_key_press(LINK(this, SwAnnotationWin, KeyInputHdl));
400 mxMenuButton->connect_mouse_move(LINK(this, SwAnnotationWin, MouseMoveHdl));
401
404 mpOutliner->CompleteOnlineSpelling();
405
406 mxSidebarTextControl->Show();
407 mxMetadataAuthor->show();
408 mxMetadataDate->show();
409 mxMetadataResolved->set_visible(IsResolved());
410 mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
411}
412
414{
415 const SvtSysLocale aSysLocale;
416 const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
417 OUString sMeta = GetAuthor();
418 if (sMeta.isEmpty())
419 {
420 sMeta = SwResId(STR_NOAUTHOR);
421 }
422 else if (sMeta.getLength() > 23)
423 {
424 sMeta = OUString::Concat(sMeta.subView(0, 20)) + "...";
425 }
426 if ( mxMetadataAuthor->get_label() != sMeta )
427 {
428 mxMetadataAuthor->set_label(sMeta);
429 }
430
431 Date aDate = GetDate();
432 if (aDate.IsValidAndGregorian() )
433 {
434 sMeta = rLocalData.getDate(aDate);
435 }
436 else
437 {
438 sMeta = SwResId(STR_NODATE);
439 }
440 if (GetTime().GetTime()!=0)
441 {
442 sMeta += " " + rLocalData.getTime( GetTime(),false );
443 }
444 if ( mxMetadataDate->get_label() != sMeta )
445 {
446 mxMetadataDate->set_label(sMeta);
447 }
448
449 std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
453}
454
455static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack)
456{
457 return Color(sal_uInt8(aFront.GetRed() * aTransparency / 255.0 + aBack.GetRed() * (1 - aTransparency / 255.0)),
458 sal_uInt8(aFront.GetGreen() * aTransparency / 255.0 + aBack.GetGreen() * (1 - aTransparency / 255.0)),
459 sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0)));
460}
461
463{
464 if (!mxMenuButton)
465 return;
466
467 mxMenuButton->set_background(mColorDark);
468
469 SwWrtShell* pWrtShell = mrView.GetWrtShellPtr();
470 if (!pWrtShell)
471 return;
472 const Fraction& rFraction = pWrtShell->GetOut()->GetMapMode().GetScaleY();
473
475 Size aSize(tools::Long(METABUTTON_WIDTH * rFraction),
476 tools::Long(METABUTTON_HEIGHT * rFraction));
477 tools::Rectangle aRect(Point(0, 0), aSize);
478 xVirDev->SetOutputSizePixel(aSize);
479
480 Gradient aGradient(css::awt::GradientStyle_LINEAR,
483 xVirDev->DrawGradient(aRect, aGradient);
484
485 //draw rect around button
486 xVirDev->SetFillColor();
487 xVirDev->SetLineColor(ColorFromAlphaColor(90, mColorAnchor, mColorDark));
488 xVirDev->DrawRect(aRect);
489
490 tools::Rectangle aSymbolRect(aRect);
491 // 25% distance to the left and right button border
492 const tools::Long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth() * 250) + 500) / 1000;
493 aSymbolRect.AdjustLeft(nBorderDistanceLeftAndRight );
494 aSymbolRect.AdjustRight( -nBorderDistanceLeftAndRight );
495 // 40% distance to the top button border
496 const tools::Long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 400) + 500) / 1000;
497 aSymbolRect.AdjustTop(nBorderDistanceTop );
498 // 15% distance to the bottom button border
499 const tools::Long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 150) + 500) / 1000;
500 aSymbolRect.AdjustBottom( -nBorderDistanceBottom );
501 DecorationView aDecoView(xVirDev.get());
502 aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, GetTextColor(),
503 DrawSymbolFlags::NONE);
504 mxMenuButton->set_image(xVirDev);
505 mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height() + 4);
506}
507
509{
510 // On Android, this method leads to invoke ImpEditEngine::UpdateViews
511 // which hides the text cursor. Moreover it causes sudden document scroll
512 // when modifying a commented text. Not clear the root cause,
513 // anyway skipping this method fixes the problem, and there should be
514 // no side effect, since the client has disabled annotations rendering.
516 return;
517
518 MapMode aMode = GetParent()->GetMapMode();
519 aMode.SetOrigin( Point() );
520 SetMapMode( aMode );
521 mxSidebarTextControl->SetMapMode( aMode );
522
523 SwWrtShell* pWrtShell = mrView.GetWrtShellPtr();
524 if (!pWrtShell)
525 return;
526 const Fraction& rFraction = pWrtShell->GetOut()->GetMapMode().GetScaleY();
527
528 vcl::Font aFont = maLabelFont;
529 sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
530 aFont.SetFontHeight( nHeight );
531
533 mxMetadataAuthor->set_font(aFont);
534 if (mxMetadataDate)
535 mxMetadataDate->set_font(aFont);
537 mxMetadataResolved->set_font(aFont);
539 if (mxVScrollbar)
540 mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
541}
542
544{
545 bool bChange = false;
546
547 if (GetSizePixel() != mPosSize.GetSize())
548 {
549 bChange = true;
551
552 DoResize();
553 }
554
555 if (GetPosPixel().X() != mPosSize.Left() || (std::abs(GetPosPixel().Y() - mPosSize.Top()) > 5) )
556 {
557 bChange = true;
559
560 Point aLineStart;
561 Point aLineEnd ;
562 switch ( meSidebarPosition )
563 {
565 {
566 aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
567 aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
568 }
569 break;
571 {
572 aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
573 aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
574 }
575 break;
576 default:
577 OSL_FAIL( "<SwAnnotationWin::SetPosAndSize()> - unexpected position of sidebar" );
578 break;
579 }
580
581 // LOK has map mode disabled, and we still want to perform pixel ->
582 // twips conversion for the size of the line above the note.
584 {
586 Size aSize(aLineEnd.getX() - aLineStart.getX(), aLineEnd.getY() - aLineStart.getY());
587 aSize = EditWin().PixelToLogic(aSize);
588 aLineEnd = aLineStart;
589 aLineEnd.Move(aSize.getWidth(), aSize.getHeight());
590 EditWin().EnableMapMode(false);
591 }
592
593 if (mpAnchor)
594 {
595 mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
600 basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
601 basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
602 }
603 else
604 {
605 mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView,
608 aLineStart,
609 aLineEnd,
610 mColorAnchor );
611 if ( mpAnchor )
612 {
613 mpAnchor->setVisible(true);
614 mpAnchor->SetAnchorState(AnchorState::Tri);
615 if (HasChildPathFocus())
616 {
617 mpAnchor->setLineSolid(true);
618 }
619 }
620 }
621 }
622 else
623 {
624 if ( mpAnchor &&
625 ( mpAnchor->getBasePosition() != basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom()-5*15) ) )
626 {
627 mpAnchor->SetTriPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
632 }
633 }
634
635 if (mpShadow && bChange)
636 {
639 mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
640 }
641
642 if (mrMgr.ShowNotes())
643 {
644 if (IsFollow() && !HasChildPathFocus())
645 {
646 // #i111964#
647 if ( mpAnchor )
648 {
649 mpAnchor->SetAnchorState(AnchorState::End);
650 }
651 }
652 else
653 {
654 // #i111964#
655 if ( mpAnchor )
656 {
657 mpAnchor->SetAnchorState(AnchorState::All);
658 }
660 // #i111964#
661 if ( pWin != this && pWin->Anchor() )
662 {
663 pWin->Anchor()->SetAnchorState(AnchorState::End);
664 }
665 }
666 }
667
668
669 // text range overlay
673 {
674 const SwTextAnnotationField* pTextAnnotationField =
676 SwTextNode* pTextNode = pTextAnnotationField ? pTextAnnotationField->GetpTextNode() : nullptr;
677 SwContentNode* pContentNd = nullptr;
678 if (pTextNode)
679 {
680 SwNodes& rNds = pTextNode->GetDoc().GetNodes();
681 pContentNd = rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetContentNode();
682 }
683 if (pContentNd)
684 {
685 SwPosition aStartPos( *pContentNd, mrSidebarItem.maLayoutInfo.mnStartContent );
686 SwShellCursor* pTmpCursor = nullptr;
687 const bool bTableCursorNeeded = pTextNode->FindTableBoxStartNode() != pContentNd->FindTableBoxStartNode();
688 if ( bTableCursorNeeded )
689 {
690 SwShellTableCursor* pTableCursor = new SwShellTableCursor( mrView.GetWrtShell(), aStartPos );
691 pTableCursor->SetMark();
692 pTableCursor->GetMark()->Assign( *pTextNode, pTextAnnotationField->GetStart()+1 );
693 pTableCursor->NewTableSelection();
694 pTmpCursor = pTableCursor;
695 }
696 else
697 {
698 SwShellCursor* pCursor = new SwShellCursor( mrView.GetWrtShell(), aStartPos );
699 pCursor->SetMark();
700 pCursor->GetMark()->Assign(*pTextNode, pTextAnnotationField->GetStart()+1 );
701 pTmpCursor = pCursor;
702 }
703 std::unique_ptr<SwShellCursor> pTmpCursorForAnnotationTextRange( pTmpCursor );
704
705 // For annotation text range rectangles to be calculated correctly,
706 // we need the map mode disabled
707 bool bDisableMapMode = comphelper::LibreOfficeKit::isActive() && EditWin().IsMapModeEnabled();
708 if (bDisableMapMode)
709 EditWin().EnableMapMode(false);
710
712 pTmpCursorForAnnotationTextRange->FillRects();
713
714 if (bDisableMapMode)
716
717 SwRects* pRects(pTmpCursorForAnnotationTextRange.get());
718 for(const SwRect & rNextRect : *pRects)
719 {
720 const tools::Rectangle aPntRect(rNextRect.SVRect());
721 maAnnotationTextRanges.emplace_back(
722 aPntRect.Left(), aPntRect.Top(),
723 aPntRect.Right() + 1, aPntRect.Bottom() + 1);
724 }
725 }
726 }
727
728 if (mrMgr.ShowNotes() && !maAnnotationTextRanges.empty())
729 {
730 if ( mpTextRangeOverlay != nullptr )
731 {
732 mpTextRangeOverlay->setRanges( std::vector(maAnnotationTextRanges) );
733 if ( mpAnchor != nullptr && mpAnchor->getLineSolid() )
734 {
735 mpTextRangeOverlay->ShowSolidBorder();
736 }
737 else
738 {
739 mpTextRangeOverlay->HideSolidBorder();
740 }
741 }
742 else if (!IsFollow())
743 {
744 // This window is not a reply, then draw its range overlay.
747 mrView,
749 std::vector(maAnnotationTextRanges),
750 mpAnchor && mpAnchor->getLineSolid() );
751 }
752 }
753 else
754 {
755 mpTextRangeOverlay.reset();
756 }
757}
758
760{
761 tools::Long aHeight = GetSizePixel().Height();
762 tools::ULong aWidth = GetSizePixel().Width();
763
764 aHeight -= GetMetaHeight();
765
766 mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth, aHeight) ) ) ;
767 tools::Long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
768
769 mxMetadataAuthor->show();
770 if(IsResolved()) { mxMetadataResolved->show(); }
771 mxMetadataDate->show();
772
773 if (aTextHeight > aHeight)
774 {
775 const int nThickness = mxVScrollbar->get_scroll_thickness();
776 if (nThickness)
777 {
778 // we need vertical scrollbars and have to reduce the width
779 aWidth -= nThickness;
780 mpOutliner->SetPaperSize(PixelToLogic(Size(aWidth, aHeight)));
781 }
782 mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
783 }
784 else
785 {
786 mxVScrollbar->set_vpolicy(VclPolicyType::NEVER);
787 }
788
789 tools::Rectangle aOutputArea = PixelToLogic(tools::Rectangle(0, 0, aWidth, aHeight));
790 if (mxVScrollbar->get_vpolicy() == VclPolicyType::NEVER)
791 {
792 // if we do not have a scrollbar anymore, we want to see the complete text
793 mpOutlinerView->SetVisArea(aOutputArea);
794 }
795 mpOutlinerView->SetOutputArea(aOutputArea);
796 mpOutlinerView->ShowCursor(true, true);
797
798 // Don't leave an empty area at the bottom if we can move the text down.
799 tools::Long nMaxVisAreaTop = mpOutliner->GetTextHeight() - aOutputArea.GetHeight();
800 if (mpOutlinerView->GetVisArea().Top() > nMaxVisAreaTop)
801 {
802 GetOutlinerView()->Scroll(0, mpOutlinerView->GetVisArea().Top() - nMaxVisAreaTop);
803 }
804
805 int nUpper = mpOutliner->GetTextHeight();
806 int nCurrentDocPos = mpOutlinerView->GetVisArea().Top();
807 int nStepIncrement = mpOutliner->GetTextHeight() / 10;
808 int nPageIncrement = PixelToLogic(Size(0,aHeight)).Height() * 8 / 10;
809 int nPageSize = PixelToLogic(Size(0,aHeight)).Height();
810
811 /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
812 effectively...
813
814 lower = gtk_adjustment_get_lower
815 upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
816
817 and requires that upper > lower or the deceleration animation never ends
818 */
819 nPageSize = std::min(nPageSize, nUpper);
820
821 mxVScrollbar->vadjustment_configure(nCurrentDocPos, 0, nUpper,
822 nStepIncrement, nPageIncrement, nPageSize);
823}
824
825void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
826{
828 return;
829
831
832 if (mpShadow)
833 {
836 mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
837 }
838}
839
841{
842 mxVScrollbar->vadjustment_set_value(mpOutlinerView->GetVisArea().Top());
843}
844
846{
847 if (aOldHeight != aNewHeight)
848 {
849 //check for lower border or next note
850 tools::Long aBorder = mrMgr.GetNextBorder();
851 if (aBorder != -1)
852 {
853 if (aNewHeight > GetMinimumSizeWithoutMeta())
854 {
855 tools::Long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
856 if (aNewLowerValue < aBorder)
858 else
859 SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
860 DoResize();
861 Invalidate();
862 }
863 else
864 {
867 DoResize();
868 Invalidate();
869 }
870 }
871 else
872 {
873 DoResize();
874 Invalidate();
875 }
876 }
877 else
878 {
879 SetScrollbar();
880 }
881}
882
883void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
884{
885 mColorDark = aColorDark;
886 mColorLight = aColorLight;
887 mColorAnchor = aColorAnchor;
888
889 if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
890 return;
891
892 m_xContainer->set_background(mColorDark);
894
895 mxMetadataAuthor->set_font_color(aColorAnchor);
896
897 mxMetadataDate->set_font_color(aColorAnchor);
898
899 mxMetadataResolved->set_font_color(aColorAnchor);
900
901 mxVScrollbar->customize_scrollbars(mColorLight,
903 mColorDark);
904}
905
907{
908 meSidebarPosition = eSidebarPosition;
909}
910
912{
913 mbReadonly = bSet;
915}
916
918{
920 mxSidebarTextControl->GrabFocus();
921}
922
924{
925}
926
928{
930 if (!IsVisible())
931 Window::Show();
932 if (mpShadow && !mpShadow->isVisible())
933 mpShadow->setVisible(true);
934 if (mpAnchor && !mpAnchor->isVisible())
935 mpAnchor->setVisible(true);
936 if (mpTextRangeOverlay && !mpTextRangeOverlay->isVisible())
937 mpTextRangeOverlay->setVisible(true);
938
939 collectUIInformation("SHOW",get_id());
940}
941
943{
944 if (IsVisible())
945 Window::Hide();
946 if (mpAnchor)
947 {
948 if (mrMgr.IsShowAnchor())
949 mpAnchor->SetAnchorState(AnchorState::Tri);
950 else
951 mpAnchor->setVisible(false);
952 }
953 if (mpShadow && mpShadow->isVisible())
954 mpShadow->setVisible(false);
955 if (mpTextRangeOverlay && mpTextRangeOverlay->isVisible())
956 mpTextRangeOverlay->setVisible(false);
957 collectUIInformation("HIDE",get_id());
958}
959
961{
963
964 mpOutliner->ClearModifyFlag();
965 mpOutliner->GetUndoManager().Clear();
966
968 SetViewState(ViewState::EDIT);
969
970 // prevent autoscroll to the old cursor location
971 // when cursor out of visible area
972 GetOutlinerView()->ShowCursor(false);
973
974 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
975 mpOutlinerView->GetEditView().SetInsertMode(pWrtShell->IsInsMode());
976
977 if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
979
980 //tdf#119130 only have the active postit as a dialog control in which pressing
981 //ctrl+tab cycles between text and button so we don't waste time searching
982 //thousands of SwAnnotationWins
984}
985
987{
988 //tdf#119130 only have the active postit as a dialog control in which pressing
989 //ctrl+tab cycles between text and button so we don't waste time searching
990 //thousands of SwAnnotationWins
992
993 // remove selection, #i87073#
994 if (GetOutlinerView()->GetEditView().HasSelection())
995 {
997 aSelection.nEndPara = aSelection.nStartPara;
998 aSelection.nEndPos = aSelection.nStartPos;
1000 }
1001
1002 mpOutliner->CompleteOnlineSpelling();
1003
1004 SetViewState(ViewState::NORMAL);
1005 // Make sure this view doesn't emit LOK callbacks during the update, as the
1006 // sidebar window's SidebarTextControl doesn't have a valid twip offset
1007 // (map mode origin) during that operation.
1008 bool bTiledPainting = comphelper::LibreOfficeKit::isTiledPainting();
1010 // write the visible text back into the SwField
1011 UpdateData();
1013
1014 if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1016
1017 if (!mnDeleteEventId && !IsReadOnlyOrProtected() && mpOutliner->GetEditEngine().GetText().isEmpty())
1018 {
1019 mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1020 }
1021}
1022
1024{
1026 {
1027 //change outliner
1028 mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
1029 //change document
1031 //update statusbar
1033 rBnd.Invalidate(SID_ATTR_INSERT);
1034 rBnd.Update(SID_ATTR_INSERT);
1035 }
1036}
1037
1039{
1041
1042 switch (nSlot)
1043 {
1044 case FN_POSTIT:
1045 case FN_REPLY:
1046 {
1047 // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
1048 // will be created
1049 if (!mpOutliner->GetEditEngine().GetText().isEmpty())
1050 {
1051 OutlinerParaObject aPara(GetOutlinerView()->GetEditView().CreateTextObject());
1052 mrMgr.RegisterAnswer(&aPara);
1053 }
1055 mrMgr.SetActiveSidebarWin(nullptr);
1058
1059 if (nSlot == FN_REPLY)
1060 {
1061 // Get newly created SwPostItField and set its paraIdParent
1062 auto pPostItField = mrMgr.GetLatestPostItField();
1063 pPostItField->SetParentId(GetTopReplyNote()->GetParaId());
1064 }
1065 break;
1066 }
1067 case FN_DELETE_COMMENT:
1068 //Delete(); // do not kill the parent of our open popup menu
1069 mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
1070 break;
1072 DeleteThread();
1073 break;
1074 case FN_RESOLVE_NOTE:
1076 DoResize();
1077 Invalidate();
1079 break;
1083 DoResize();
1084 Invalidate();
1086 break;
1089 case FN_HIDE_ALL_NOTES:
1090 // not possible as slot as this would require that "this" is the active postit
1091 mrView.GetViewFrame().GetBindings().Execute( nSlot, nullptr, SfxCallMode::ASYNCHRON );
1092 break;
1095 {
1096 // not possible as slot as this would require that "this" is the active postit
1097 SfxStringItem aItem( nSlot, GetAuthor() );
1098 const SfxPoolItem* aItems[2];
1099 aItems[0] = &aItem;
1100 aItems[1] = nullptr;
1101 mrView.GetViewFrame().GetBindings().Execute( nSlot, aItems, SfxCallMode::ASYNCHRON );
1102 }
1103 break;
1104 default:
1106 break;
1107 }
1108}
1109
1111{
1112 return mrView.GetEditWin();
1113}
1114
1116{
1117 return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
1118}
1119
1120void SwAnnotationWin::SwitchToPostIt(sal_uInt16 aDirection)
1121{
1123 if (pPostIt)
1124 pPostIt->GrabFocus();
1125}
1126
1127IMPL_LINK(SwAnnotationWin, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
1128{
1129 if (rMEvt.IsEnterWindow())
1130 {
1131 mbMouseOver = true;
1132 if ( !HasFocus() )
1133 {
1134 SetViewState(ViewState::VIEW);
1135 Invalidate();
1136 }
1137 }
1138 else if (rMEvt.IsLeaveWindow())
1139 {
1140 mbMouseOver = false;
1141 if ( !HasFocus() )
1142 {
1143 SetViewState(ViewState::NORMAL);
1144 Invalidate();
1145 }
1146 }
1147 return false;
1148}
1149
1151{
1152 if (mrMgr.GetActiveSidebarWin() == this)
1153 return false;
1154 mrView.GetWrtShell().LockView( true );
1156 mrView.GetWrtShell().LockView( true );
1157
1158 return true;
1159}
1160
1162{
1163 if (mrMgr.GetActiveSidebarWin() != this)
1164 return;
1165 mrView.GetWrtShell().LockView( true );
1166 mrMgr.SetActiveSidebarWin(nullptr);
1167 mrView.GetWrtShell().LockView( false );
1168}
1169
1171{
1172 mrView.GetWrtShell().LockView( bLock );
1173}
1174
1175IMPL_LINK(SwAnnotationWin, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
1176{
1177 tools::Long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - rScrolledWindow.vadjustment_get_value();
1178 GetOutlinerView()->Scroll( 0, nDiff );
1179}
1180
1182{
1183 mrView.GetDocShell()->SetModified();
1184}
1185
1186IMPL_LINK_NOARG(SwAnnotationWin, DeleteHdl, void*, void)
1187{
1188 mnDeleteEventId = nullptr;
1189 Delete();
1190}
1191
1193{
1194 mpOutlinerView->RemoveAttribsKeepLanguages(true);
1195 mpOutliner->RemoveFields();
1196}
1197
1199{
1200 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
1201 {
1202 const Fraction& f(pWrtShell->GetOut()->GetMapMode().GetScaleY());
1203 return tools::Long(Application::GetSettings().GetStyleSettings().GetScrollBarSize() * f);
1204 }
1205 else
1206 return tools::Long(Application::GetSettings().GetStyleSettings().GetScrollBarSize());
1207}
1208
1210{
1211 if (!moMetaHeight)
1212 {
1213 const int fields = GetNumFields();
1214
1215 sal_Int32 nRequiredHeight = 0;
1216 weld::Label* aLabels[3] = { mxMetadataAuthor.get(), mxMetadataDate.get(), mxMetadataResolved.get() };
1217 for (int i = 0; i < fields; ++i)
1218 nRequiredHeight += aLabels[i]->get_preferred_size().Height();
1219 moMetaHeight = nRequiredHeight;
1220 }
1221 return *moMetaHeight;
1222}
1223
1225{
1226 if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
1227 {
1228 moMetaHeight.reset();
1229 }
1230}
1231
1233{
1234 return IsResolved() ? 3 : 2;
1235}
1236
1238{
1240}
1241
1243{
1244 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
1245 {
1246 const Fraction& f(pWrtShell->GetOut()->GetMapMode().GetScaleY());
1248 }
1249 else
1251}
1252
1254{
1255 if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
1256 {
1257 const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
1258 EEControlBits nCntrl = mpOutliner->GetControlWord();
1259 mpOutliner->SetControlWord(nCntrl & ~EEControlBits::ONLINESPELLING);
1260 if (pVOpt->IsOnlineSpell())
1261 mpOutliner->SetControlWord(nCntrl | EEControlBits::ONLINESPELLING);
1262
1263 mpOutliner->CompleteOnlineSpelling();
1264 Invalidate();
1265 }
1266}
1267
1269{
1270 switch (bViewState)
1271 {
1272 case ViewState::EDIT:
1273 {
1274 if (mpAnchor)
1275 {
1276 mpAnchor->SetAnchorState(AnchorState::All);
1278 // #i111964#
1279 if ( pWin != this && pWin->Anchor() )
1280 {
1281 pWin->Anchor()->SetAnchorState(AnchorState::End);
1282 }
1283 mpAnchor->setLineSolid(true);
1284 if ( mpTextRangeOverlay != nullptr )
1285 {
1286 mpTextRangeOverlay->ShowSolidBorder();
1287 }
1288 }
1289 if (mpShadow)
1290 mpShadow->SetShadowState(SS_EDIT);
1291 break;
1292 }
1293 case ViewState::VIEW:
1294 {
1295 if (mpAnchor)
1296 {
1297 mpAnchor->setLineSolid(true);
1298 if ( mpTextRangeOverlay != nullptr )
1299 {
1300 mpTextRangeOverlay->ShowSolidBorder();
1301 }
1302 }
1303 if (mpShadow)
1304 mpShadow->SetShadowState(SS_VIEW);
1305 break;
1306 }
1307 case ViewState::NORMAL:
1308 {
1309 if (mpAnchor)
1310 {
1311 if (IsFollow())
1312 {
1313 // if there is no visible parent note, we want to see the complete anchor ??
1314 //if (IsAnyStackParentVisible())
1315 mpAnchor->SetAnchorState(AnchorState::End);
1316 SwAnnotationWin* pTopWinSelf = GetTopReplyNote();
1317 SwAnnotationWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
1319 : nullptr;
1320 // #i111964#
1321 if ( ( pTopWinSelf != this ) &&
1322 ( pTopWinSelf != pTopWinActive ) &&
1323 pTopWinSelf->Anchor() )
1324 {
1325 if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() )
1326 {
1327 pTopWinSelf->Anchor()->setLineSolid(false);
1328 if ( pTopWinSelf->TextRange() != nullptr )
1329 {
1330 pTopWinSelf->TextRange()->HideSolidBorder();
1331 }
1332 }
1333 pTopWinSelf->Anchor()->SetAnchorState(AnchorState::All);
1334 }
1335 }
1336 mpAnchor->setLineSolid(false);
1337 if ( mpTextRangeOverlay != nullptr )
1338 {
1339 mpTextRangeOverlay->HideSolidBorder();
1340 }
1341 }
1342 if ( mpShadow )
1343 {
1344 mpShadow->SetShadowState(SS_NORMAL);
1345 }
1346 break;
1347 }
1348 }
1349}
1350
1352{
1353 for (SwAnnotationWin* pTopNote = this;;)
1354 {
1355 if (!pTopNote->IsFollow())
1356 return pTopNote;
1357 SwAnnotationWin* pPrev = mrMgr.GetNextPostIt(KEY_PAGEUP, pTopNote);
1358 if (!pPrev)
1359 return pTopNote;
1360 pTopNote = pPrev;
1361 }
1362}
1363
1365{
1366 if ( mrMgr.GetActiveSidebarWin() == this )
1367 mrMgr.SetActiveSidebarWin(nullptr);
1368 GotoPos();
1369 sal_uInt32 aCount = MoveCaret();
1370 if (aCount)
1371 mrView.GetDocShell()->GetWrtShell()->SwCursorShell::Right(aCount, SwCursorSkipMode::Chars);
1373 collectUIInformation("LEAVE",get_id());
1374}
1375
1377 const Color& aChangeColor )
1378{
1379 if ( (mLayoutStatus != aLayoutStatus) ||
1380 (mChangeColor != aChangeColor) )
1381 {
1382 mLayoutStatus = aLayoutStatus;
1383 mChangeColor = aChangeColor;
1384 Invalidate();
1385 }
1386}
1387
1389{
1390 return static_cast<bool>(mxVScrollbar);
1391}
1392
1394{
1395 return HasScrollbar() && mxVScrollbar->get_vpolicy() == VclPolicyType::ALWAYS;
1396}
1397
1399{
1400#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1401 const bool bAnchorChanged = mpAnchorFrame != rSidebarItem.maLayoutInfo.mpAnchorFrame;
1402 if ( bAnchorChanged )
1403 {
1405 }
1406#endif
1407
1408 mrSidebarItem = rSidebarItem;
1410
1411#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1413 mxSidebarWinAccessible->ChangeSidebarItem( mrSidebarItem );
1414
1415 if ( bAnchorChanged )
1416 {
1419 *this );
1420 }
1421#endif
1422}
1423
1424css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAccessible()
1425{
1426#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1427 // This is rather dodgy code. Normally in CreateAccessible, if we want a custom
1428 // object, we return a custom object, but we do no override the default toolkit
1429 // window peer.
1433 mrSidebarItem );
1434#endif
1436}
1437
1438} // eof of namespace sw::sidebarwindows
1439
1440/* 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
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() 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 SetReadOnly(bool bReadOnly)
void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll)
void SetBackgroundColor(const Color &rColor)
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)
vcl::ExtOutDevData * GetExtOutDevData() const
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)
constexpr tools::Long Y() const
void Move(tools::Long nHorzMove, tools::Long nVertMove)
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
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)
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
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1152
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
SfxStyleSheetPool * GetEEStyleSheetPool() const
Definition: docstyle.hxx:236
SwNodes & GetNodes()
Definition: doc.hxx:422
void SetCalcFieldValueHdl(Outliner *pOutliner)
In the Outliner, set a link to the method for field display in edit objects.
Definition: docdraw.cxx:540
bool IsRedlineOn() const
Definition: edredln.cxx:43
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:149
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:218
SwDoc & GetDoc()
Definition: node.hxx:233
const SwPosition * GetMark() const
Definition: pam.hxx:255
void SetParentId(const sal_uInt32 nParentId)
Definition: docufld.cxx:1863
sal_Int32 GetMinimumSizeWithMeta() const
Definition: PostItMgr.cxx:2266
SwPostItField * GetLatestPostItField()
Definition: PostItMgr.cxx:1803
static Color GetColorDark(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2155
bool ShowNotes() const
Definition: PostItMgr.cxx:2110
void RegisterAnswer(const OutlinerParaObject *pAnswer)
Definition: PostItMgr.hxx:258
static Color GetColorAnchor(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2185
void ConnectSidebarWinToFrame(const SwFrame &rFrame, const SwFormatField &rFormatField, sw::annotation::SwAnnotationWin &rSidebarWin)
Definition: PostItMgr.cxx:2424
static Color GetColorLight(std::size_t aAuthorIndex)
Definition: PostItMgr.cxx:2170
void LayoutPostIts()
Definition: PostItMgr.cxx:696
void SetActiveSidebarWin(sw::annotation::SwAnnotationWin *p)
Definition: PostItMgr.cxx:2200
bool IsShowAnchor() const
Definition: PostItMgr.hxx:193
sw::annotation::SwAnnotationWin * GetNextPostIt(sal_uInt16 aDirection, sw::annotation::SwAnnotationWin *aPostIt)
Definition: PostItMgr.cxx:1808
void DisconnectSidebarWinFromFrame(const SwFrame &rFrame, sw::annotation::SwAnnotationWin &rSidebarWin)
Definition: PostItMgr.cxx:2441
sw::annotation::SwAnnotationWin * GetActiveSidebarWin()
Definition: PostItMgr.hxx:237
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2372
void AssureStdModeAtShell()
Definition: PostItMgr.cxx:2348
tools::Long GetNextBorder()
Definition: PostItMgr.cxx:1844
void UpdateResolvedStatus(const sw::annotation::SwAnnotationWin *topNote)
Definition: PostItMgr.cxx:2505
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:2524
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
bool IsOnlineSpell() const
Definition: viewopt.hxx:537
bool IsFieldShadings() const
Definition: viewopt.hxx:835
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:365
void LockView(bool b)
Definition: viewsh.hxx:491
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:424
SwEditWin & GetEditWin()
Definition: view.hxx:426
SwDocShell * GetDocShell()
Definition: view.cxx:1193
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void ToggleInsMode()
Definition: wrtsh.hxx:171
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
reference_type * get() const
void SetPosSizePixelRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const SwRect &aAnchorRect, const tools::Long PageBorder)
SwPostItHelper::SwLayoutStatus mLayoutStatus
void SwitchToPostIt(sal_uInt16 aDirection)
void PaintTile(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
sw::sidebarwindows::SidebarPosition meSidebarPosition
std::unique_ptr< sw::overlay::OverlayRanges > mpTextRangeOverlay
std::unique_ptr< weld::Label > mxMetadataResolved
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
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.
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)
::sw::overlay::OverlayRanges * TextRange()
std::optional< sal_Int32 > moMetaHeight
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)
bool GetIsExportTaggedPDF() const
sal_Int32 WrapBeginStructureElement(PDFWriter::StructElement eType, const OUString &rAlias=OUString())
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
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual void SetPosPixel(const Point &rNewPos)
void EnableMapMode(bool bEnable=true)
#define FN_RESOLVE_NOTE
Definition: cmdid.h:795
#define FN_REPLY
Definition: cmdid.h:793
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:786
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:789
#define FN_POSTIT
Definition: cmdid.h:233
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:790
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:787
#define FN_DELETE_COMMENT
Definition: cmdid.h:792
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:797
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:796
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:794
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
float y
float x
EEControlBits
std::deque< AttacherIndex_Impl > aIndex
constexpr sal_uInt16 KEY_PAGEUP
void setTiledPainting(bool bTiledPainting)
std::unique_ptr< BaseProcessor2D > createProcessor2DFromOutputDevice(OutputDevice &rTargetOutDev, const drawinglayer::geometry::ViewInformation2D &rViewInformation2D)
int i
IMPL_LINK(SwAnnotationWin, SelectHdl, const OUString &, rIdent, void)
IMPL_LINK_NOARG(SwAnnotationWin, ToggleHdl, weld::Toggleable &, void)
static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color &aFront, const Color &aBack)
unsigned long ULong
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
#define Y
sal_Int32 nStartPara
sal_Int32 nEndPos
sal_Int32 nStartPos
sal_Int32 nEndPara
std::map< OUString, OUString > aParameters
sal_Int32 mnStartContent
SwNodeOffset mnStartNodeIdx
const SwFrame * mpAnchorFrame
bool mPositionFromCommentAnchor
If true, the overlay arrow points to the comment anchor, otherwise it points to the commented frame.
Marks a position in the document model.
Definition: pam.hxx:38
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:254
std::vector< SwRect > SwRects
Definition: swregion.hxx:26
css::drawing::Direction3D aDirection
unsigned char sal_uInt8
WinBits const WB_DIALOGCONTROL