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