LibreOffice Module sdext (master)  1
PresenterHelpView.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 <vcl/settings.hxx>
21 #include "PresenterHelpView.hxx"
22 #include "PresenterButton.hxx"
25 #include <com/sun/star/awt/XWindowPeer.hpp>
26 #include <com/sun/star/container/XNameAccess.hpp>
27 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
28 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
29 #include <com/sun/star/rendering/CompositeOperation.hpp>
30 #include <com/sun/star/rendering/TextDirection.hpp>
31 #include <com/sun/star/util/Color.hpp>
32 #include <algorithm>
33 #include <numeric>
34 #include <string_view>
35 #include <vector>
36 
37 using namespace ::com::sun::star;
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::drawing::framework;
40 using ::std::vector;
41 
42 namespace sdext::presenter {
43 
44 namespace {
45  const sal_Int32 gnHorizontalGap (20);
46  const sal_Int32 gnVerticalBorder (30);
47  const sal_Int32 gnVerticalButtonPadding (12);
48 
49  class LineDescriptor
50  {
51  public:
52  LineDescriptor();
53  void AddPart (
54  std::u16string_view rsLine,
55  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont);
56  bool IsEmpty() const;
57 
58  OUString msLine;
59  geometry::RealSize2D maSize;
61 
62  void CalculateSize (const css::uno::Reference<css::rendering::XCanvasFont>& rxFont);
63  };
64 
65  class LineDescriptorList
66  {
67  public:
68  LineDescriptorList (
69  const OUString& rsText,
70  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
71  const sal_Int32 nMaximalWidth);
72 
73  void Update (
74  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
75  const sal_Int32 nMaximalWidth);
76 
77  double Paint(
78  const Reference<rendering::XCanvas>& rxCanvas,
79  const geometry::RealRectangle2D& rBBox,
80  const bool bFlushLeft,
81  const rendering::ViewState& rViewState,
82  rendering::RenderState& rRenderState,
83  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont) const;
84  double GetHeight() const;
85 
86  private:
87  const OUString msText;
88  std::shared_ptr<vector<LineDescriptor> > mpLineDescriptors;
89 
90  static void SplitText (const OUString& rsText, vector<OUString>& rTextParts);
91  void FormatText (
92  const vector<OUString>& rTextParts,
93  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
94  const sal_Int32 nMaximalWidth);
95  };
96 
97  class Block
98  {
99  public:
100  Block (
101  const OUString& rsLeftText,
102  const OUString& rsRightText,
103  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
104  const sal_Int32 nMaximalWidth);
105  Block(const Block&) = delete;
106  Block& operator=(const Block&) = delete;
107  void Update (
108  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
109  const sal_Int32 nMaximalWidth);
110 
111  LineDescriptorList maLeft;
112  LineDescriptorList maRight;
113  };
114 } // end of anonymous namespace
115 
116 class PresenterHelpView::TextContainer : public vector<std::shared_ptr<Block> >
117 {
118 };
119 
121  const Reference<uno::XComponentContext>& rxContext,
122  const Reference<XResourceId>& rxViewId,
123  const Reference<frame::XController>& rxController,
124  const ::rtl::Reference<PresenterController>& rpPresenterController)
126  mxComponentContext(rxContext),
127  mxViewId(rxViewId),
128  mpPresenterController(rpPresenterController),
129  mnSeparatorY(0),
130  mnMaximalWidth(0)
131 {
132  try
133  {
134  // Get the content window via the pane anchor.
135  Reference<XControllerManager> xCM (rxController, UNO_QUERY_THROW);
136  Reference<XConfigurationController> xCC (
137  xCM->getConfigurationController(), UNO_SET_THROW);
138  mxPane.set(xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW);
139 
140  mxWindow = mxPane->getWindow();
141  ProvideCanvas();
142 
143  mxWindow->addWindowListener(this);
144  mxWindow->addPaintListener(this);
145  Reference<awt::XWindowPeer> xPeer (mxWindow, UNO_QUERY);
146  if (xPeer.is())
147  xPeer->setBackground(util::Color(0xff000000));
148  mxWindow->setVisible(true);
149 
150  if (mpPresenterController.is())
151  {
152  mpFont = mpPresenterController->GetViewFont(mxViewId->getResourceURL());
153  if (mpFont)
154  {
155  mpFont->PrepareFont(mxCanvas);
156  }
157  }
158 
159  // Create the close button.
163  mpPresenterController->GetTheme(),
164  mxWindow,
165  mxCanvas,
166  "HelpViewCloser");
167 
168  ReadHelpStrings();
169  Resize();
170  }
171  catch (RuntimeException&)
172  {
173  mxViewId = nullptr;
174  mxWindow = nullptr;
175  throw;
176  }
177 }
178 
180 {
181 }
182 
184 {
185  mxViewId = nullptr;
186 
187  if (mpCloseButton.is())
188  {
190  mpCloseButton = nullptr;
191  if (xComponent.is())
192  xComponent->dispose();
193  }
194 
195  if (mxWindow.is())
196  {
197  mxWindow->removeWindowListener(this);
198  mxWindow->removePaintListener(this);
199  }
200 }
201 
202 //----- lang::XEventListener --------------------------------------------------
203 
204 void SAL_CALL PresenterHelpView::disposing (const lang::EventObject& rEventObject)
205 {
206  if (rEventObject.Source == mxCanvas)
207  {
208  mxCanvas = nullptr;
209  }
210  else if (rEventObject.Source == mxWindow)
211  {
212  mxWindow = nullptr;
213  dispose();
214  }
215 }
216 
217 //----- XWindowListener -------------------------------------------------------
218 
219 void SAL_CALL PresenterHelpView::windowResized (const awt::WindowEvent&)
220 {
221  ThrowIfDisposed();
222  Resize();
223 }
224 
225 void SAL_CALL PresenterHelpView::windowMoved (const awt::WindowEvent&)
226 {
227  ThrowIfDisposed();
228 }
229 
230 void SAL_CALL PresenterHelpView::windowShown (const lang::EventObject&)
231 {
232  ThrowIfDisposed();
233  Resize();
234 }
235 
236 void SAL_CALL PresenterHelpView::windowHidden (const lang::EventObject&)
237 {
238  ThrowIfDisposed();
239 }
240 
241 //----- XPaintListener --------------------------------------------------------
242 
243 void SAL_CALL PresenterHelpView::windowPaint (const css::awt::PaintEvent& rEvent)
244 {
245  Paint(rEvent.UpdateRect);
246 }
247 
248 void PresenterHelpView::Paint (const awt::Rectangle& rUpdateBox)
249 {
250  ProvideCanvas();
251  if ( ! mxCanvas.is())
252  return;
253 
254  // Clear background.
255  const awt::Rectangle aWindowBox (mxWindow->getPosSize());
256  mpPresenterController->GetCanvasHelper()->Paint(
257  mpPresenterController->GetViewBackground(mxViewId->getResourceURL()),
258  mxCanvas,
259  rUpdateBox,
260  awt::Rectangle(0,0,aWindowBox.Width,aWindowBox.Height),
261  awt::Rectangle());
262 
263  // Paint vertical divider.
264 
265  rendering::ViewState aViewState(
266  geometry::AffineMatrix2D(1,0,0, 0,1,0),
267  PresenterGeometryHelper::CreatePolygon(rUpdateBox, mxCanvas->getDevice()));
268 
269  rendering::RenderState aRenderState (
270  geometry::AffineMatrix2D(1,0,0, 0,1,0),
271  nullptr,
272  Sequence<double>(4),
273  rendering::CompositeOperation::SOURCE);
274  PresenterCanvasHelper::SetDeviceColor(aRenderState, mpFont->mnColor);
275 
276  mxCanvas->drawLine(
277  geometry::RealPoint2D((aWindowBox.Width/2.0), gnVerticalBorder),
278  geometry::RealPoint2D((aWindowBox.Width/2.0), mnSeparatorY - gnVerticalBorder),
279  aViewState,
280  aRenderState);
281 
282  // Paint the horizontal separator.
283  mxCanvas->drawLine(
284  geometry::RealPoint2D(0, mnSeparatorY),
285  geometry::RealPoint2D(aWindowBox.Width, mnSeparatorY),
286  aViewState,
287  aRenderState);
288 
289  // Paint text.
290  double nY (gnVerticalBorder);
291  for (const auto& rxBlock : *mpTextContainer)
292  {
293  sal_Int32 LeftX1 = gnHorizontalGap;
294  sal_Int32 LeftX2 = aWindowBox.Width/2 - gnHorizontalGap;
295  sal_Int32 RightX1 = aWindowBox.Width/2 + gnHorizontalGap;
296  sal_Int32 RightX2 = aWindowBox.Width - gnHorizontalGap;
297  /* check whether RTL interface or not
298  then replace the windowbox position */
300  {
301  LeftX1 = aWindowBox.Width/2 + gnHorizontalGap;
302  LeftX2 = aWindowBox.Width - gnHorizontalGap;
303  RightX1 = gnHorizontalGap;
304  RightX2 = aWindowBox.Width/2 - gnHorizontalGap;
305  }
306  const double nLeftHeight (
307  rxBlock->maLeft.Paint(mxCanvas,
308  geometry::RealRectangle2D(
309  LeftX1,
310  nY,
311  LeftX2,
312  aWindowBox.Height - gnVerticalBorder),
313  false,
314  aViewState,
315  aRenderState,
316  mpFont->mxFont));
317  const double nRightHeight (
318  rxBlock->maRight.Paint(mxCanvas,
319  geometry::RealRectangle2D(
320  RightX1,
321  nY,
322  RightX2,
323  aWindowBox.Height - gnVerticalBorder),
324  true,
325  aViewState,
326  aRenderState,
327  mpFont->mxFont));
328 
329  nY += ::std::max(nLeftHeight,nRightHeight);
330  }
331 
332  Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY);
333  if (xSpriteCanvas.is())
334  xSpriteCanvas->updateScreen(false);
335 }
336 
338 {
339  mpTextContainer.reset(new TextContainer);
340  PresenterConfigurationAccess aConfiguration (
342  "/org.openoffice.Office.PresenterScreen/",
345  aConfiguration.GetConfigurationNode("PresenterScreenSettings/HelpView/HelpStrings"),
346  UNO_QUERY);
348  xStrings,
349  [this](OUString const&, uno::Reference<beans::XPropertySet> const& xProps)
350  {
351  return this->ProcessString(xProps);
352  });
353 }
354 
356  const Reference<beans::XPropertySet>& rsProperties)
357 {
358  if ( ! rsProperties.is())
359  return;
360 
361  OUString sLeftText;
362  PresenterConfigurationAccess::GetProperty(rsProperties, "Left") >>= sLeftText;
363  OUString sRightText;
364  PresenterConfigurationAccess::GetProperty(rsProperties, "Right") >>= sRightText;
365  mpTextContainer->push_back(
366  std::make_shared<Block>(
367  sLeftText, sRightText, mpFont->mxFont, mnMaximalWidth));
368 }
369 
371 {
372  if (!mpFont)
373  return;
374 
375  sal_Int32 nBestSize (6);
376 
377  // Scaling down and then reformatting can cause the text to be too large
378  // still. So do this again and again until the text size is
379  // small enough. Restrict the number of loops.
380  for (int nLoopCount=0; nLoopCount<5; ++nLoopCount)
381  {
382  double nY = std::accumulate(mpTextContainer->begin(), mpTextContainer->end(), double(0),
383  [](const double& sum, const std::shared_ptr<Block>& rxBlock) {
384  return sum + std::max(
385  rxBlock->maLeft.GetHeight(),
386  rxBlock->maRight.GetHeight());
387  });
388 
389  const double nHeightDifference (nY - (mnSeparatorY-gnVerticalBorder));
390  if (nHeightDifference <= 0 && nHeightDifference > -50)
391  {
392  // We have found a good font size that is large and leaves not
393  // too much space below the help text.
394  return;
395  }
396 
397  // Use a simple linear transformation to calculate initial guess of
398  // a size that lets all help text be shown inside the window.
399  const double nScale (double(mnSeparatorY-gnVerticalBorder) / nY);
400  if (nScale > 1.0 && nScale < 1.05)
401  break;
402 
403  sal_Int32 nFontSizeGuess (sal_Int32(mpFont->mnSize * nScale));
404  if (nHeightDifference<=0 && mpFont->mnSize>nBestSize)
405  nBestSize = mpFont->mnSize;
406  mpFont->mnSize = nFontSizeGuess;
407  mpFont->mxFont = nullptr;
408  mpFont->PrepareFont(mxCanvas);
409 
410  // Reformat blocks.
411  for (auto& rxBlock : *mpTextContainer)
412  rxBlock->Update(mpFont->mxFont, mnMaximalWidth);
413  }
414 
415  if (nBestSize != mpFont->mnSize)
416  {
417  mpFont->mnSize = nBestSize;
418  mpFont->mxFont = nullptr;
419  mpFont->PrepareFont(mxCanvas);
420 
421  // Reformat blocks.
422  for (auto& rxBlock : *mpTextContainer)
423  {
424  rxBlock->Update(mpFont->mxFont, mnMaximalWidth);
425  }
426  }
427 }
428 
429 //----- XResourceId -----------------------------------------------------------
430 
431 Reference<XResourceId> SAL_CALL PresenterHelpView::getResourceId()
432 {
433  ThrowIfDisposed();
434  return mxViewId;
435 }
436 
438 {
439  return false;
440 }
441 
442 
444 {
445  if ( ! mxCanvas.is() && mxPane.is())
446  {
447  mxCanvas = mxPane->getCanvas();
448  if ( ! mxCanvas.is())
449  return;
450  Reference<lang::XComponent> xComponent (mxCanvas, UNO_QUERY);
451  if (xComponent.is())
452  xComponent->addEventListener(static_cast<awt::XPaintListener*>(this));
453 
454  if (mpCloseButton.is())
455  mpCloseButton->SetCanvas(mxCanvas, mxWindow);
456  }
457 }
458 
460 {
461  if (!(mpCloseButton && mxWindow.is()))
462  return;
463 
464  const awt::Rectangle aWindowBox (mxWindow->getPosSize());
465  mnMaximalWidth = (mxWindow->getPosSize().Width - 4*gnHorizontalGap) / 2;
466 
467  // Place vertical separator.
468  mnSeparatorY = aWindowBox.Height
469  - mpCloseButton->GetSize().Height - gnVerticalButtonPadding;
470 
471  mpCloseButton->SetCenter(geometry::RealPoint2D(
472  aWindowBox.Width/2.0,
473  aWindowBox.Height - mpCloseButton->GetSize().Height/2.0));
474 
475  CheckFontSize();
476 }
477 
479 {
480  if (rBHelper.bDisposed || rBHelper.bInDispose)
481  {
482  throw lang::DisposedException (
483  "PresenterHelpView has been already disposed",
484  static_cast<uno::XWeak*>(this));
485  }
486 }
487 
488 //===== LineDescriptor =========================================================
489 
490 namespace {
491 
492 LineDescriptor::LineDescriptor()
493  : maSize(0,0),
495 {
496 }
497 
498 void LineDescriptor::AddPart (
499  std::u16string_view rsLine,
500  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont)
501 {
502  msLine += rsLine;
503 
504  CalculateSize(rxFont);
505 }
506 
507 bool LineDescriptor::IsEmpty() const
508 {
509  return msLine.isEmpty();
510 }
511 
512 void LineDescriptor::CalculateSize (
513  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont)
514 {
515  OSL_ASSERT(rxFont.is());
516 
517  rendering::StringContext aContext (msLine, 0, msLine.getLength());
518  Reference<rendering::XTextLayout> xLayout (
519  rxFont->createTextLayout(aContext, rendering::TextDirection::WEAK_LEFT_TO_RIGHT, 0));
520  const geometry::RealRectangle2D aTextBBox (xLayout->queryTextBounds());
521  maSize = css::geometry::RealSize2D(aTextBBox.X2 - aTextBBox.X1, aTextBBox.Y2 - aTextBBox.Y1);
522  mnVerticalOffset = aTextBBox.Y2;
523 }
524 
525 } // end of anonymous namespace
526 
527 //===== LineDescriptorList ====================================================
528 
529 namespace {
530 
531 LineDescriptorList::LineDescriptorList (
532  const OUString& rsText,
533  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
534  const sal_Int32 nMaximalWidth)
535  : msText(rsText)
536 {
537  Update(rxFont, nMaximalWidth);
538 }
539 
540 double LineDescriptorList::Paint(
541  const Reference<rendering::XCanvas>& rxCanvas,
542  const geometry::RealRectangle2D& rBBox,
543  const bool bFlushLeft,
544  const rendering::ViewState& rViewState,
545  rendering::RenderState& rRenderState,
546  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont) const
547 {
548  if ( ! rxCanvas.is())
549  return 0;
550 
551  double nY (rBBox.Y1);
552  for (const auto& rLine : *mpLineDescriptors)
553  {
554  double nX;
557  {
558  nX = rBBox.X1;
559  if ( ! bFlushLeft)
560  nX = rBBox.X2 - rLine.maSize.Width;
561  }
562  else
563  {
564  nX=rBBox.X2 - rLine.maSize.Width;
565  if ( ! bFlushLeft)
566  nX = rBBox.X1;
567  }
568  rRenderState.AffineTransform.m02 = nX;
569  rRenderState.AffineTransform.m12 = nY + rLine.maSize.Height - rLine.mnVerticalOffset;
570 
571  const rendering::StringContext aContext (rLine.msLine, 0, rLine.msLine.getLength());
572  Reference<rendering::XTextLayout> xLayout (
573  rxFont->createTextLayout(aContext, rendering::TextDirection::WEAK_LEFT_TO_RIGHT, 0));
574  rxCanvas->drawTextLayout (
575  xLayout,
576  rViewState,
577  rRenderState);
578 
579  nY += rLine.maSize.Height * 1.2;
580  }
581 
582  return nY - rBBox.Y1;
583 }
584 
585 double LineDescriptorList::GetHeight() const
586 {
587  return std::accumulate(mpLineDescriptors->begin(), mpLineDescriptors->end(), double(0),
588  [](const double& nHeight, const LineDescriptor& rLine) {
589  return nHeight + rLine.maSize.Height * 1.2;
590  });
591 }
592 
593 void LineDescriptorList::Update (
594  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
595  const sal_Int32 nMaximalWidth)
596 {
597  vector<OUString> aTextParts;
598  SplitText(msText, aTextParts);
599  FormatText(aTextParts, rxFont, nMaximalWidth);
600 }
601 
602 void LineDescriptorList::SplitText (
603  const OUString& rsText,
604  vector<OUString>& rTextParts)
605 {
606  const char cQuote ('\'');
607  const char cSeparator (',');
608 
609  sal_Int32 nIndex (0);
610  sal_Int32 nStart (0);
611  sal_Int32 nLength (rsText.getLength());
612  bool bIsQuoted (false);
613  while (nIndex < nLength)
614  {
615  const sal_Int32 nQuoteIndex (rsText.indexOf(cQuote, nIndex));
616  const sal_Int32 nSeparatorIndex (rsText.indexOf(cSeparator, nIndex));
617  if (nQuoteIndex>=0 && (nSeparatorIndex==-1 || nQuoteIndex<nSeparatorIndex))
618  {
619  bIsQuoted = !bIsQuoted;
620  nIndex = nQuoteIndex+1;
621  continue;
622  }
623 
624  const sal_Int32 nNextIndex = nSeparatorIndex;
625  if (nNextIndex < 0)
626  {
627  break;
628  }
629  else if ( ! bIsQuoted)
630  {
631  rTextParts.push_back(rsText.copy(nStart, nNextIndex-nStart));
632  nStart = nNextIndex + 1;
633  }
634  nIndex = nNextIndex+1;
635  }
636  if (nStart < nLength)
637  rTextParts.push_back(rsText.copy(nStart, nLength-nStart));
638 }
639 
640 void LineDescriptorList::FormatText (
641  const vector<OUString>& rTextParts,
642  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
643  const sal_Int32 nMaximalWidth)
644 {
645  LineDescriptor aLineDescriptor;
646 
647  mpLineDescriptors = std::make_shared<vector<LineDescriptor>>();
648 
649  vector<OUString>::const_iterator iPart (rTextParts.begin());
650  vector<OUString>::const_iterator iEnd (rTextParts.end());
651  while (iPart!=iEnd)
652  {
653  if (aLineDescriptor.IsEmpty())
654  {
655  // Avoid empty lines.
657  rxFont, *iPart).Width > nMaximalWidth)
658  {
659  const char cSpace (' ');
660 
661  sal_Int32 nIndex (0);
662  sal_Int32 nStart (0);
663  sal_Int32 nLength (iPart->getLength());
664  while (nIndex < nLength)
665  {
666  sal_Int32 nSpaceIndex (iPart->indexOf(cSpace, nIndex));
667  while (nSpaceIndex >= 0 && PresenterCanvasHelper::GetTextSize(
668  rxFont, iPart->copy(nStart, nSpaceIndex-nStart)).Width <= nMaximalWidth)
669  {
670  nIndex = nSpaceIndex;
671  nSpaceIndex = iPart->indexOf(cSpace, nIndex+1);
672  }
673 
674  if (nSpaceIndex < 0 && PresenterCanvasHelper::GetTextSize(
675  rxFont, iPart->copy(nStart, nLength-nStart)).Width <= nMaximalWidth)
676  {
677  nIndex = nLength;
678  }
679 
680  if (nIndex == nStart)
681  {
682  nIndex = nLength;
683  }
684 
685  aLineDescriptor.AddPart(iPart->subView(nStart, nIndex-nStart), rxFont);
686  if (nIndex != nLength)
687  {
688  mpLineDescriptors->push_back(aLineDescriptor);
689  aLineDescriptor = LineDescriptor();
690  }
691  nStart = nIndex;
692  }
693  }
694  else
695  {
696  aLineDescriptor.AddPart(*iPart, rxFont);
697  }
698  }
700  rxFont, aLineDescriptor.msLine+", "+*iPart).Width > nMaximalWidth)
701  {
702  aLineDescriptor.AddPart(u",", rxFont);
703  mpLineDescriptors->push_back(aLineDescriptor);
704  aLineDescriptor = LineDescriptor();
705  continue;
706  }
707  else
708  {
709  aLineDescriptor.AddPart(OUString(", "+*iPart), rxFont);
710  }
711  ++iPart;
712  }
713  if ( ! aLineDescriptor.IsEmpty())
714  {
715  mpLineDescriptors->push_back(aLineDescriptor);
716  }
717 }
718 
719 } // end of anonymous namespace
720 
721 //===== Block =================================================================
722 
723 namespace {
724 
725 Block::Block (
726  const OUString& rsLeftText,
727  const OUString& rsRightText,
728  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
729  const sal_Int32 nMaximalWidth)
730  : maLeft(rsLeftText, rxFont, nMaximalWidth),
731  maRight(rsRightText, rxFont, nMaximalWidth)
732 {
733 }
734 
735 void Block::Update (
736  const css::uno::Reference<css::rendering::XCanvasFont>& rxFont,
737  const sal_Int32 nMaximalWidth)
738 {
739  maLeft.Update(rxFont, nMaximalWidth);
740  maRight.Update(rxFont, nMaximalWidth);
741 }
742 
743 } // end of anonymous namespace
744 
745 } // end of namespace ::sdext::presenter
746 
747 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void ForAll(const css::uno::Reference< css::container::XNameAccess > &rxContainer, const ::std::vector< OUString > &rArguments, const ItemProcessor &rProcessor)
Execute a functor for all elements of the given container.
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
sal_Int32 nIndex
static css::uno::Any GetProperty(const css::uno::Reference< css::beans::XPropertySet > &rxProperties, const OUString &rsKey)
This method wraps a call to getPropertyValue() and returns an empty Any instead of throwing an except...
css::uno::Reference< css::drawing::framework::XResourceId > mxViewId
cppu::WeakComponentImplHelper< css::drawing::framework::XView, css::awt::XWindowListener, css::awt::XPaintListener > PresenterHelpViewInterfaceBase
css::uno::Reference< css::awt::XWindow > mxWindow
css::uno::Reference< css::drawing::framework::XPane > mxPane
void Paint(const css::awt::Rectangle &rRedrawArea)
This class gives access to the configuration.
std::mutex m_aMutex
LineDescriptorList maLeft
void CheckFontSize()
Find a font size, so that all text can be displayed at the same time.
PresenterHelpView(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const css::uno::Reference< css::frame::XController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
std::shared_ptr< vector< LineDescriptor > > mpLineDescriptors
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
css::uno::Reference< css::rendering::XCanvas > mxCanvas
std::unique_ptr< TextContainer > mpTextContainer
virtual sal_Bool SAL_CALL isAnchorOnly() override
LineDescriptorList maRight
css::uno::Any GetConfigurationNode(const OUString &rsPathToNode)
Return a configuration node below the root of the called object.
unsigned char sal_Bool
static bool GetLayoutRTL()
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
static css::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
void ProcessString(const css::uno::Reference< css::beans::XPropertySet > &rsProperties)
rtl::Reference< PresenterController > mpPresenterController
const OUString msText
::rtl::Reference< PresenterButton > mpCloseButton
static void SetDeviceColor(css::rendering::RenderState &rRenderState, const css::util::Color aColor)
static css::geometry::RealSize2D GetTextSize(const css::uno::Reference< css::rendering::XCanvasFont > &rxFont, const OUString &rsText)
virtual void SAL_CALL disposing() override
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
double mnVerticalOffset
PresenterTheme::SharedFontDescriptor mpFont
::rtl::Reference< PresenterController > mpPresenterController
OUString msLine
sal_Int32 nLength
void dispose()
const double gnVerticalBorder(5)
static::rtl::Reference< PresenterButton > Create(const css::uno::Reference< css::uno::XComponentContext > &rxComponentContext, const ::rtl::Reference< PresenterController > &rpPresenterController, const std::shared_ptr< PresenterTheme > &rpTheme, const css::uno::Reference< css::awt::XWindow > &rxParentWindow, const css::uno::Reference< css::rendering::XCanvas > &rxParentCanvas, const OUString &rsConfigurationName)
geometry::RealSize2D maSize
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
sal_uInt32 mnSize